Every plugin must have a general descriptor that provides
          information to the plugin API. The structure of the general
          descriptor is the same for all plugin types. This descriptor
          is defined by the st_mysql_plugin structure
          in the plugin.h file:
        
struct st_mysql_plugin
{
  int type;             /* the plugin type (a MYSQL_XXX_PLUGIN value)   */
  void *info;           /* pointer to type-specific plugin descriptor   */
  const char *name;     /* plugin name                                  */
  const char *author;   /* plugin author (for SHOW PLUGINS)             */
  const char *descr;    /* general descriptive text (for SHOW PLUGINS ) */
  int license;          /* the plugin license (PLUGIN_LICENSE_XXX)      */
  int (*init)(void *);  /* the function to invoke when plugin is loaded */
  int (*deinit)(void *);/* the function to invoke when plugin is unloaded */
  unsigned int version; /* plugin version (for SHOW PLUGINS)            */
  struct st_mysql_show_var *status_vars;
  struct st_mysql_sys_var **system_vars; 
  void * __reserved1;   /* reserved for dependency checking             */
};
          The st_mysql_plugin descriptor structure is
          common to every type of plugin. Its members should be filled
          in as follows:
        
              type
            
              The plugin type. This must be one of the plugin-type
              values from plugin.h:
            
/* The allowable types of plugins */ #define MYSQL_UDF_PLUGIN 0 /* User-defined function */ #define MYSQL_STORAGE_ENGINE_PLUGIN 1 /* Storage Engine */ #define MYSQL_FTPARSER_PLUGIN 2 /* Full-text parser plugin */ #define MYSQL_DAEMON_PLUGIN 3 /* The daemon/raw plugin type */ #define MYSQL_INFORMATION_SCHEMA_PLUGIN 4 /* The I_S plugin type */ ...
              Thus, for a full-text parser plugin, the
              type value is
              MYSQL_FTPARSER_PLUGIN.
            
              info
            
A pointer to the type-specific descriptor for the plugin. This descriptor's structure depends on the particular type of plugin, unlike that of the general plugin descriptor structure. Each type-specific descriptor has a version number that indicates the API version for that type of plugin, plus any other members needed. The descriptor for full-text plugins is described in Section 22.2.4.2.1, “Full-Text Parser Plugin Data Structures and Functions”.
              name
            
              A string that gives the plugin name. This is the name that
              will be listed in the plugin table and
              by which you refer to the plugin in SQL statements such as
              INSTALL PLUGIN and
              UNINSTALL PLUGIN, or with
              the --plugin-load option.
              The name is also visible in the
              INFORMATION_SCHEMA.PLUGINS
              table or the output from SHOW
              PLUGINS.
            
              author
            
A string naming the plugin author. This can be whatever you like.
              desc
            
A string that provides a general description of the plugin. This can be whatever you like.
              The plugin license type. The value can be one of
              PLUGIN_LICENSE_PROPRIETARY,
              PLUGIN_LICENSE_GPL, or
              PLUGIN_LICENSE_BSD.
            
              init
            
              A once-only initialization function. The server executes
              this function when it loads the plugin, which happens for
              INSTALL PLUGIN or, for
              plugins listed in the plugin table, at
              server startup. The function takes no arguments. It
              returns zero for success and nonzero for failure. If an
              init function is unneeded for a plugin,
              it can be specified as 0.
            
              deinit
            
              A once-only deinitialization function. The server executes
              this function when it unloads the plugin, which happens
              for UNINSTALL PLUGIN or,
              for plugins listed in the plugin table,
              at server shutdown. The function takes no arguments. It
              returns zero for success and nonzero for failure. If a
              deinit function is unneeded for a
              plugin, it can be specified as 0.
            
              version
            
              The plugin version number. When the plugin is installed,
              this value can be retrieved from the
              INFORMATION_SCHEMA.PLUGINS
              table. The value includes major and minor numbers. If you
              write the value as a hex constant, the format is
              0x,
              where MMNNMM and
              NN are the major and minor numbers,
              respectively. For example, 0x0302
              represents version 3.2.
            
              status_vars
            
              A pointer to a structure for status variables associated
              with the plugin, or 0 if there are no such variables. When
              the plugin is installed, these variables are displayed in
              the output of the SHOW
              STATUS statement.
            
              system_vars
            
A pointer to a structure for system variables associated with the plugin, or 0 if there are no such variables. These options and system variables can be used to help initialize variables within the plugin.
              __reserved1
            
              A placeholder for the future. Currently, it should be set
              to NULL.
            
          The init and deinit
          functions in the general plugin descriptor are invoked only
          when loading and unloading the plugin. They have nothing to do
          with use of the plugin such as happens when an SQL statement
          causes the plugin to be invoked.
        
          The status_vars member, if not 0, points to
          an array of st_mysql_show_var structures
          that describe status variables. See
          Section 22.2.4.3, “Plugin Status and System Variables”.
        
          The system_vars member, if not 0, points to
          an array of st_mysql_sys_var structures
          that describe sytem variables. See
          Section 22.2.4.3, “Plugin Status and System Variables”.
        

User Comments
Add your own comment.