00001 /* Copyright (C) 2005 MySQL AB 00002 00003 This program is free software; you can redistribute it and/or modify 00004 it under the terms of the GNU General Public License as published by 00005 the Free Software Foundation; either version 2 of the License, or 00006 (at your option) any later version. 00007 00008 This program is distributed in the hope that it will be useful, 00009 but WITHOUT ANY WARRANTY; without even the implied warranty of 00010 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00011 GNU General Public License for more details. 00012 00013 You should have received a copy of the GNU General Public License 00014 along with this program; if not, write to the Free Software 00015 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ 00016 00017 #ifndef _sql_plugin_h 00018 #define _sql_plugin_h 00019 00020 /* 00021 the following #define adds server-only members to enum_mysql_show_type, 00022 that is defined in plugin.h 00023 */ 00024 #define SHOW_FUNC SHOW_FUNC, SHOW_KEY_CACHE_LONG, SHOW_KEY_CACHE_LONGLONG, \ 00025 SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS, SHOW_HAVE, \ 00026 SHOW_MY_BOOL, SHOW_HA_ROWS, SHOW_SYS, SHOW_LONG_NOFLUSH 00027 #include <mysql/plugin.h> 00028 #undef SHOW_FUNC 00029 typedef enum enum_mysql_show_type SHOW_TYPE; 00030 typedef struct st_mysql_show_var SHOW_VAR; 00031 00032 #define MYSQL_ANY_PLUGIN -1 00033 00034 enum enum_plugin_state 00035 { 00036 PLUGIN_IS_FREED= 0, 00037 PLUGIN_IS_DELETED, 00038 PLUGIN_IS_UNINITIALIZED, 00039 PLUGIN_IS_READY 00040 }; 00041 00042 /* A handle for the dynamic library containing a plugin or plugins. */ 00043 00044 struct st_plugin_dl 00045 { 00046 LEX_STRING dl; 00047 void *handle; 00048 struct st_mysql_plugin *plugins; 00049 int version; 00050 uint ref_count; /* number of plugins loaded from the library */ 00051 }; 00052 00053 /* A handle of a plugin */ 00054 00055 struct st_plugin_int 00056 { 00057 LEX_STRING name; 00058 struct st_mysql_plugin *plugin; 00059 struct st_plugin_dl *plugin_dl; 00060 enum enum_plugin_state state; 00061 uint ref_count; /* number of threads using the plugin */ 00062 void *data; /* plugin type specific, e.g. handlerton */ 00063 }; 00064 00065 typedef int (*plugin_type_init)(struct st_plugin_int *); 00066 00067 extern char *opt_plugin_dir_ptr; 00068 extern char opt_plugin_dir[FN_REFLEN]; 00069 extern const LEX_STRING plugin_type_names[]; 00070 extern int plugin_init(void); 00071 extern void plugin_load(void); 00072 extern void plugin_free(void); 00073 extern my_bool plugin_is_ready(const LEX_STRING *name, int type); 00074 extern st_plugin_int *plugin_lock(const LEX_STRING *name, int type); 00075 extern void plugin_unlock(struct st_plugin_int *plugin); 00076 extern my_bool mysql_install_plugin(THD *thd, const LEX_STRING *name, const LEX_STRING *dl); 00077 extern my_bool mysql_uninstall_plugin(THD *thd, const LEX_STRING *name); 00078 00079 extern my_bool plugin_register_builtin(struct st_mysql_plugin *plugin); 00080 00081 typedef my_bool (plugin_foreach_func)(THD *thd, 00082 st_plugin_int *plugin, 00083 void *arg); 00084 extern my_bool plugin_foreach(THD *thd, plugin_foreach_func *func, 00085 int type, void *arg); 00086 #endif
1.4.7

