39
39
#include <drizzled/lex_string.h>
40
40
#include <mysys/my_alloc.h>
41
#include <drizzled/plugin_registry.h>
42
#include <drizzled/plugin.h>
46
the following flags are valid for plugin_init()
48
#define PLUGIN_INIT_SKIP_DYNAMIC_LOADING 1
49
#define PLUGIN_INIT_SKIP_PLUGIN_TABLE 2
50
#define PLUGIN_INIT_SKIP_INITIALIZATION 4
52
#define INITIAL_LEX_PLUGIN_LIST_SIZE 16
55
the following #define adds server-only members to enum_mysql_show_type,
56
that is defined in plugin.h
58
#define SHOW_FUNC SHOW_FUNC, SHOW_KEY_CACHE_LONG, SHOW_KEY_CACHE_LONGLONG, \
59
SHOW_LONG_STATUS, SHOW_DOUBLE_STATUS, SHOW_HAVE, \
60
SHOW_MY_BOOL, SHOW_HA_ROWS, SHOW_SYS, SHOW_INT_NOFLUSH, \
62
#include <drizzled/plugin.h>
64
typedef enum enum_mysql_show_type SHOW_TYPE;
65
typedef struct st_mysql_show_var SHOW_VAR;
67
#define DRIZZLE_ANY_PLUGIN -1
69
48
/* A handle for the dynamic library containing a plugin or plugins. */
49
struct drizzled_plugin_manifest;
71
51
struct st_plugin_dl
75
struct st_mysql_plugin *plugins;
55
struct drizzled_plugin_manifest *plugins;
78
58
/* A handle of a plugin */
80
60
struct st_plugin_int
83
struct st_mysql_plugin *plugin;
63
struct drizzled_plugin_manifest *plugin;
84
64
struct st_plugin_dl *plugin_dl;
86
void *data; /* plugin type specific, e.g. StorageEngine */
87
66
MEM_ROOT mem_root; /* memory for dynamic plugin structures */
88
67
sys_var *system_vars; /* server variables for this plugin */
92
71
#define plugin_decl(pi) ((pi)->plugin)
93
#define plugin_dlib(pi) ((pi)->plugin_dl)
94
72
#define plugin_data(pi,cast) (static_cast<cast>((pi)->data))
95
73
#define plugin_name(pi) (&((pi)->name))
96
74
#define plugin_equals(p1,p2) ((p1) && (p2) && (p1) == (p2))
98
typedef int (*plugin_type_init)(struct st_plugin_int *);
77
typedef int (*plugin_type_init)(PluginRegistry &);
80
Plugin description structure.
83
struct drizzled_plugin_manifest
85
const char *name; /* plugin name (for SHOW PLUGINS) */
86
const char *version; /* plugin version (for SHOW PLUGINS) */
87
const char *author; /* plugin author (for SHOW PLUGINS) */
88
const char *descr; /* general descriptive text (for SHOW PLUGINS ) */
89
int license; /* plugin license (PLUGIN_LICENSE_XXX) */
90
plugin_type_init init; /* function to invoke when plugin is loaded */
91
plugin_type_init deinit; /* function to invoke when plugin is unloaded */
92
struct st_mysql_show_var *status_vars;
93
struct st_mysql_sys_var **system_vars;
94
void *reserved1; /* reserved for dependency checking */
100
97
extern char *opt_plugin_load;
101
98
extern char *opt_plugin_dir_ptr;
102
99
extern char opt_plugin_dir[FN_REFLEN];
103
extern const LEX_STRING plugin_type_names[];
105
101
extern int plugin_init(int *argc, char **argv, int init_flags);
106
102
extern void plugin_shutdown(void);
107
103
extern void my_print_help_inc_plugins(struct my_option *options, uint32_t size);
108
104
extern bool plugin_is_ready(const LEX_STRING *name, int type);
109
extern st_plugin_int *plugin_lock_by_name(const LEX_STRING *name, int type);
110
105
extern bool mysql_install_plugin(Session *session, const LEX_STRING *name,
111
106
const LEX_STRING *dl);
112
107
extern bool mysql_uninstall_plugin(Session *session, const LEX_STRING *name);
113
extern bool plugin_register_builtin(struct st_mysql_plugin *plugin);
108
extern bool plugin_register_builtin(struct drizzled_plugin_manifest *plugin);
114
109
extern void plugin_sessionvar_init(Session *session);
115
110
extern void plugin_sessionvar_cleanup(Session *session);
117
typedef bool (plugin_foreach_func)(Session *session, st_plugin_int *plugin, void *arg);
118
bool plugin_foreach(Session *session, plugin_foreach_func *func,
119
int type, void *arg, bool all= false);
121
112
#endif /* DRIZZLE_SERVER_PLUGIN_H */