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
39
#include <drizzled/lex_string.h>
40
#include <mysys/my_alloc.h>
41
#include <drizzled/plugin_registry.h>
42
#include <drizzled/plugin.h>
48
/* A handle for the dynamic library containing a plugin or plugins. */
49
struct drizzled_plugin_manifest;
55
struct drizzled_plugin_manifest *plugins;
58
/* A handle of a plugin */
63
struct drizzled_plugin_manifest *plugin;
64
struct st_plugin_dl *plugin_dl;
66
MEM_ROOT mem_root; /* memory for dynamic plugin structures */
67
sys_var *system_vars; /* server variables for this plugin */
71
#define plugin_decl(pi) ((pi)->plugin)
72
#define plugin_data(pi,cast) (static_cast<cast>((pi)->data))
73
#define plugin_name(pi) (&((pi)->name))
74
#define plugin_equals(p1,p2) ((p1) && (p2) && (p1) == (p2))
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 */
97
extern char *opt_plugin_load;
98
extern char *opt_plugin_dir_ptr;
99
extern char opt_plugin_dir[FN_REFLEN];
101
extern int plugin_init(int *argc, char **argv, int init_flags);
102
extern void plugin_shutdown(void);
103
extern void my_print_help_inc_plugins(struct my_option *options, uint32_t size);
104
extern bool plugin_is_ready(const LEX_STRING *name, int type);
105
extern bool mysql_install_plugin(Session *session, const LEX_STRING *name,
106
const LEX_STRING *dl);
107
extern bool mysql_uninstall_plugin(Session *session, const LEX_STRING *name);
108
extern bool plugin_register_builtin(struct drizzled_plugin_manifest *plugin);
109
extern void plugin_sessionvar_init(Session *session);
110
extern void plugin_sessionvar_cleanup(Session *session);
112
#endif /* DRIZZLE_SERVER_PLUGIN_H */