1
/* Copyright (C) 2007 MySQL AB
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.
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.
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 */
19
/*************************************************************************
20
API for Audit plugin. (MYSQL_AUDIT_PLUGIN)
23
#include <drizzled/plugin.h>
25
#define MYSQL_AUDIT_CLASS_MASK_SIZE 1
28
The first word in every event class struct indicates the specific
37
/*************************************************************************
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.
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
51
struct mysql_event_general
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;
68
/*************************************************************************
69
Here we define the descriptor structure, that is referred from
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.
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.
82
class_mask is an array of bits used to indicate what event classes
83
that this plugin wants to receive.
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];