~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/plugin_audit.h

  • Committer: Brian Aker
  • Date: 2008-08-11 05:29:08 UTC
  • Revision ID: brian@tangent.org-20080811052908-3cnnjvaa0ueffagw
Remove dead plugin type.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Copyright (C) 2007 MySQL AB
2
 
 
3
 
   This program is free software; you can redistribute it and/or modify
4
 
   it under the terms of the GNU General Public License as published by
5
 
   the Free Software Foundation; version 2 of the License.
6
 
 
7
 
   This program is distributed in the hope that it will be useful,
8
 
   but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 
   GNU General Public License for more details.
11
 
 
12
 
   You should have received a copy of the GNU General Public License
13
 
   along with this program; if not, write to the Free Software
14
 
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
15
 
 
16
 
#ifndef _my_audit_h
17
 
#define _my_audit_h
18
 
 
19
 
/*************************************************************************
20
 
  API for Audit plugin. (MYSQL_AUDIT_PLUGIN)
21
 
*/
22
 
 
23
 
#include <drizzled/plugin.h>
24
 
 
25
 
#define MYSQL_AUDIT_CLASS_MASK_SIZE 1
26
 
 
27
 
/*
28
 
  The first word in every event class struct indicates the specific
29
 
  class of the event.
30
 
*/
31
 
struct mysql_event
32
 
{
33
 
  int event_class;
34
 
};
35
 
 
36
 
 
37
 
/*************************************************************************
38
 
  AUDIT CLASS : GENERAL
39
 
  
40
 
  LOG events occurs before emitting to the general query log.
41
 
  ERROR events occur before transmitting errors to the user. 
42
 
  RESULT events occur after transmitting a resultset to the user.
43
 
*/
44
 
 
45
 
#define MYSQL_AUDIT_GENERAL_CLASS 0
46
 
#define MYSQL_AUDIT_GENERAL_CLASSMASK (1 << MYSQL_AUDIT_GENERAL_CLASS)
47
 
#define MYSQL_AUDIT_GENERAL_LOG 0
48
 
#define MYSQL_AUDIT_GENERAL_ERROR 1
49
 
#define MYSQL_AUDIT_GENERAL_RESULT 2
50
 
 
51
 
struct mysql_event_general
52
 
{
53
 
  int event_class;
54
 
  int general_error_code;
55
 
  unsigned long general_thread_id;
56
 
  const char *general_user;
57
 
  unsigned int general_user_length;
58
 
  const char *general_command;
59
 
  unsigned int general_command_length;
60
 
  const char *general_query;
61
 
  unsigned int general_query_length;
62
 
  struct charset_info_st *general_charset;
63
 
  uint64_t general_time;
64
 
  uint64_t general_rows;
65
 
};
66
 
 
67
 
 
68
 
/*************************************************************************
69
 
  Here we define the descriptor structure, that is referred from
70
 
  st_mysql_plugin.
71
 
 
72
 
  release_thd() event occurs when the event class consumer is to be
73
 
  disassociated from the specified THD. This would typically occur
74
 
  before some operation which may require sleeping - such as when
75
 
  waiting for the next query from the client.
76
 
  
77
 
  event_notify() is invoked whenever an event occurs which is of any
78
 
  class for which the plugin has interest. The first word of the
79
 
  mysql_event argument indicates the specific event class and the
80
 
  remainder of the structure is as required for that class.
81
 
  
82
 
  class_mask is an array of bits used to indicate what event classes
83
 
  that this plugin wants to receive.
84
 
*/
85
 
 
86
 
struct st_mysql_audit
87
 
{
88
 
  int interface_version;
89
 
  void (*release_thd)(MYSQL_THD);
90
 
  void (*event_notify)(MYSQL_THD, const struct mysql_event *);
91
 
  unsigned long class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE];
92
 
};
93
 
 
94
 
 
95
 
#endif