1
/* -*- mode: c++; c-basic-offset: 2; indent-tabs-mode: nil; -*-
2
* vim:expandtab:shiftwidth=2:tabstop=2:smarttab:
4
* Copyright (C) 2008 Sun Microsystems
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; version 2 of the License.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
21
* @TODO There is plugin.h and also sql_plugin.h. Ostensibly,
22
* it seems that the two files exist so that plugin.h can provide an
23
* external API for plugin developers and sql_plugin.h will provide
24
* and internal server API for dealing with those plugins.
26
* However, there are parts of plugin.h marked "INTERNAL USE ONLY" which
27
* seems to contradict the above...
29
* Let's figure out a better way of dividing the public and internal API
30
* and name the files more appropriately.
32
* Also, less #defines, more enums and bitmaps...
36
#ifndef DRIZZLE_SERVER_PLUGIN_H
37
#define DRIZZLE_SERVER_PLUGIN_H
1
/* Copyright (C) 2005 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 */
55
35
SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS, SHOW_HAVE, \
56
36
SHOW_MY_BOOL, SHOW_HA_ROWS, SHOW_SYS, SHOW_LONG_NOFLUSH, \
57
37
SHOW_LONGLONG_STATUS
58
#include <drizzled/plugin.h>
38
#include <mysql/plugin.h>
60
40
typedef enum enum_mysql_show_type SHOW_TYPE;
61
41
typedef struct st_mysql_show_var SHOW_VAR;
63
#define DRIZZLE_ANY_PLUGIN -1
43
#define MYSQL_ANY_PLUGIN -1
66
46
different values of st_plugin_int::state
93
74
struct st_mysql_plugin *plugin;
94
75
struct st_plugin_dl *plugin_dl;
96
uint32_t ref_count; /* number of threads using the plugin */
77
uint ref_count; /* number of threads using the plugin */
97
78
void *data; /* plugin type specific, e.g. handlerton */
98
79
MEM_ROOT mem_root; /* memory for dynamic plugin structures */
99
80
sys_var *system_vars; /* server variables for this plugin */
104
85
See intern_plugin_lock() for the explanation for the
105
86
conditionally defined plugin_ref type
89
typedef struct st_plugin_int *plugin_ref;
90
#define plugin_decl(pi) ((pi)->plugin)
91
#define plugin_dlib(pi) ((pi)->plugin_dl)
92
#define plugin_data(pi,cast) ((cast)((pi)->data))
93
#define plugin_name(pi) (&((pi)->name))
94
#define plugin_state(pi) ((pi)->state)
95
#define plugin_equals(p1,p2) ((p1) == (p2))
107
97
typedef struct st_plugin_int **plugin_ref;
108
98
#define plugin_decl(pi) ((pi)[0]->plugin)
109
99
#define plugin_dlib(pi) ((pi)[0]->plugin_dl)
122
113
extern int plugin_init(int *argc, char **argv, int init_flags);
123
114
extern void plugin_shutdown(void);
124
extern void my_print_help_inc_plugins(struct my_option *options, uint32_t size);
115
extern void my_print_help_inc_plugins(struct my_option *options, uint size);
125
116
extern bool plugin_is_ready(const LEX_STRING *name, int type);
126
117
#define my_plugin_lock_by_name(A,B,C) plugin_lock_by_name(A,B,C CALLER_INFO)
127
118
#define my_plugin_lock_by_name_ci(A,B,C) plugin_lock_by_name(A,B,C ORIG_CALLER_INFO)
131
122
extern plugin_ref plugin_lock_by_name(THD *thd, const LEX_STRING *name,
132
123
int type CALLER_INFO_PROTO);
133
124
extern void plugin_unlock(THD *thd, plugin_ref plugin);
134
extern void plugin_unlock_list(THD *thd, plugin_ref *list, uint32_t count);
125
extern void plugin_unlock_list(THD *thd, plugin_ref *list, uint count);
135
126
extern bool mysql_install_plugin(THD *thd, const LEX_STRING *name,
136
127
const LEX_STRING *dl);
137
128
extern bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name);
139
130
extern void plugin_thdvar_init(THD *thd);
140
131
extern void plugin_thdvar_cleanup(THD *thd);
142
typedef bool (plugin_foreach_func)(THD *thd,
133
typedef my_bool (plugin_foreach_func)(THD *thd,
145
136
#define plugin_foreach(A,B,C,D) plugin_foreach_with_mask(A,B,C,PLUGIN_IS_READY,D)
146
137
extern bool plugin_foreach_with_mask(THD *thd, plugin_foreach_func *func,
147
int type, uint32_t state_mask, void *arg);
148
#endif /* DRIZZLE_SERVER_PLUGIN_H */
138
int type, uint state_mask, void *arg);