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)
25
#define MYSQL_AUDIT_CLASS_MASK_SIZE 1
27
#define MYSQL_AUDIT_INTERFACE_VERSION ( 0x010000 | MYSQL_AUDIT_CLASS_MASK_SIZE )
31
The first word in every event class struct indicates the specific
40
/*************************************************************************
43
LOG events occurs before emitting to the general query log.
44
ERROR events occur before transmitting errors to the user.
45
RESULT events occur after transmitting a resultset to the user.
48
#define MYSQL_AUDIT_GENERAL_CLASS 0
49
#define MYSQL_AUDIT_GENERAL_CLASSMASK (1 << MYSQL_AUDIT_GENERAL_CLASS)
50
#define MYSQL_AUDIT_GENERAL_LOG 0
51
#define MYSQL_AUDIT_GENERAL_ERROR 1
52
#define MYSQL_AUDIT_GENERAL_RESULT 2
54
struct mysql_event_general
57
int general_error_code;
58
unsigned long general_thread_id;
59
const char *general_user;
60
unsigned int general_user_length;
61
const char *general_command;
62
unsigned int general_command_length;
63
const char *general_query;
64
unsigned int general_query_length;
65
struct charset_info_st *general_charset;
66
unsigned long long general_time;
67
unsigned long long general_rows;
71
/*************************************************************************
72
Here we define the descriptor structure, that is referred from
75
release_thd() event occurs when the event class consumer is to be
76
disassociated from the specified THD. This would typically occur
77
before some operation which may require sleeping - such as when
78
waiting for the next query from the client.
80
event_notify() is invoked whenever an event occurs which is of any
81
class for which the plugin has interest. The first word of the
82
mysql_event argument indicates the specific event class and the
83
remainder of the structure is as required for that class.
85
class_mask is an array of bits used to indicate what event classes
86
that this plugin wants to receive.
91
int interface_version;
92
void (*release_thd)(MYSQL_THD);
93
void (*event_notify)(MYSQL_THD, const struct mysql_event *);
94
unsigned long class_mask[MYSQL_AUDIT_CLASS_MASK_SIZE];