~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_plugin.h

  • Committer: Monty Taylor
  • Date: 2009-07-15 21:00:16 UTC
  • mto: (1093.1.18 captain)
  • mto: This revision was merged to the branch mainline in revision 1098.
  • Revision ID: mordred@inaugust.com-20090715210016-r1p52ne1xs4jxu3g
Rename of plugin classes.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
class Session;
46
46
 
47
47
 
 
48
namespace drizzled {
 
49
namespace plugin {
 
50
 
 
51
typedef int (*plugin_type_init)(PluginRegistry &);
 
52
 
 
53
/*
 
54
  Plugin description structure.
 
55
*/
 
56
 
 
57
struct Manifest
 
58
{
 
59
  /* Hide these - we will not use them */
 
60
/*  Manifest(const Manifest&);
 
61
  Manifest operator=(const Manifest&);
 
62
public:*/
 
63
  const char *name;          /* plugin name (for SHOW PLUGINS)               */
 
64
  const char *version;       /* plugin version (for SHOW PLUGINS)            */
 
65
  const char *author;        /* plugin author (for SHOW PLUGINS)             */
 
66
  const char *descr;         /* general descriptive text (for SHOW PLUGINS ) */
 
67
  plugin_license_type license; /* plugin license (PLUGIN_LICENSE_XXX)          */
 
68
  plugin_type_init init;     /* function to invoke when plugin is loaded     */
 
69
  plugin_type_init deinit;   /* function to invoke when plugin is unloaded   */
 
70
  st_mysql_show_var *status_vars;
 
71
  st_mysql_sys_var **system_vars;
 
72
  void* reserved1;
 
73
/*  Manifest(name)
 
74
    : name(NULL), version(NULL), author(NULL), descr(NULL),
 
75
      license(PLUGIN_LICENSE_GPL), init(NULL), deinit(NULL),
 
76
      status_vars(NULL), system_vars(NULL) {} */
 
77
};
 
78
 
48
79
/* A handle for the dynamic library containing a plugin or plugins. */
49
 
struct drizzled_plugin_manifest;
50
 
 
51
 
struct st_plugin_dl
 
80
class Library
52
81
{
 
82
public:
53
83
  LEX_STRING dl;
54
84
  void *handle;
55
 
  struct drizzled_plugin_manifest *plugins;
 
85
  Manifest *plugins;
 
86
  Library() : dl(), handle(NULL), plugins(NULL) {}
56
87
};
57
88
 
58
89
/* A handle of a plugin */
59
 
 
60
 
struct st_plugin_int
 
90
class Handle
61
91
{
 
92
public:
62
93
  LEX_STRING name;
63
 
  struct drizzled_plugin_manifest *plugin;
64
 
  struct st_plugin_dl *plugin_dl;
 
94
  Manifest *plugin;
 
95
  Library *plugin_dl;
65
96
  bool isInited;
66
97
  MEM_ROOT mem_root;            /* memory for dynamic plugin structures */
67
98
  sys_var *system_vars;         /* server variables for this plugin */
 
99
  Handle()
 
100
    : name(), plugin(NULL), plugin_dl(NULL), isInited(false), 
 
101
      mem_root(), system_vars(NULL) {}
68
102
};
69
103
 
 
104
} /* namespace plugin */
 
105
} /* namespace drizzled */
70
106
 
71
107
#define plugin_decl(pi) ((pi)->plugin)
72
108
#define plugin_data(pi,cast) (static_cast<cast>((pi)->data))
74
110
#define plugin_equals(p1,p2) ((p1) && (p2) && (p1) == (p2))
75
111
 
76
112
 
77
 
typedef int (*plugin_type_init)(PluginRegistry &);
78
 
 
79
 
/*
80
 
  Plugin description structure.
81
 
*/
82
 
 
83
 
struct drizzled_plugin_manifest
84
 
{
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             */
95
 
};
96
 
 
97
113
extern char *opt_plugin_load;
98
114
extern char *opt_plugin_dir_ptr;
99
115
extern char opt_plugin_dir[FN_REFLEN];
105
121
extern bool mysql_install_plugin(Session *session, const LEX_STRING *name,
106
122
                                 const LEX_STRING *dl);
107
123
extern bool mysql_uninstall_plugin(Session *session, const LEX_STRING *name);
108
 
extern bool plugin_register_builtin(struct drizzled_plugin_manifest *plugin);
 
124
extern bool plugin_register_builtin(drizzled::plugin::Manifest *plugin);
109
125
extern void plugin_sessionvar_init(Session *session);
110
126
extern void plugin_sessionvar_cleanup(Session *session);
111
127
extern sys_var *intern_find_sys_var(const char *str, uint32_t, bool no_error);