MySQL 8.4.0
Source Code Documentation
client_plugin.h File Reference

MySQL Client Plugin API. More...

#include <stdarg.h>
#include <stdlib.h>
#include "plugin_auth_common.h"

Go to the source code of this file.

Classes

struct  st_mysql_client_plugin
 
struct  auth_plugin_t
 

Macros

#define MYSQL_CLIENT_PLUGIN_INCLUDED
 
#define MYSQL_CLIENT_PLUGIN_EXPORT
 
#define MYSQL_CLIENT_reserved1   0
 
#define MYSQL_CLIENT_reserved2   1
 
#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN   2
 
#define MYSQL_CLIENT_TRACE_PLUGIN   3
 
#define MYSQL_CLIENT_TELEMETRY_PLUGIN   4
 
#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION   0x0200
 
#define MYSQL_CLIENT_TRACE_PLUGIN_INTERFACE_VERSION   0x0200
 
#define MYSQL_CLIENT_TELEMETRY_PLUGIN_INTERFACE_VERSION   0x0200
 
#define MYSQL_CLIENT_MAX_PLUGINS   5
 
#define MYSQL_CLIENT_PLUGIN_AUTHOR_ORACLE   "Oracle Corporation"
 
#define mysql_declare_client_plugin(X)
 
#define mysql_end_client_plugin   }
 
#define MYSQL_CLIENT_PLUGIN_HEADER
 

Typedefs

typedef struct auth_plugin_t st_mysql_client_plugin_AUTHENTICATION
 

Functions

struct st_mysql_client_pluginmysql_load_plugin (struct MYSQL *mysql, const char *name, int type, int argc,...)
 loads a plugin and initializes it More...
 
struct st_mysql_client_pluginmysql_load_plugin_v (struct MYSQL *mysql, const char *name, int type, int argc, va_list args)
 loads a plugin and initializes it, taking va_list as an argument More...
 
struct st_mysql_client_pluginmysql_client_find_plugin (struct MYSQL *mysql, const char *name, int type)
 finds an already loaded plugin by name, or loads it, if necessary More...
 
struct st_mysql_client_pluginmysql_client_register_plugin (struct MYSQL *mysql, struct st_mysql_client_plugin *plugin)
 adds a plugin structure to the list of loaded plugins More...
 
int mysql_plugin_options (struct st_mysql_client_plugin *plugin, const char *option, const void *value)
 set plugin options More...
 
int mysql_plugin_get_option (struct st_mysql_client_plugin *plugin, const char *option, void *value)
 get plugin options More...
 

Detailed Description

MySQL Client Plugin API.

This file defines the API for plugins that work on the client side

Macro Definition Documentation

◆ MYSQL_CLIENT_AUTHENTICATION_PLUGIN

#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN   2

◆ MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION

#define MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION   0x0200

◆ MYSQL_CLIENT_MAX_PLUGINS

#define MYSQL_CLIENT_MAX_PLUGINS   5

◆ MYSQL_CLIENT_PLUGIN_AUTHOR_ORACLE

#define MYSQL_CLIENT_PLUGIN_AUTHOR_ORACLE   "Oracle Corporation"

◆ MYSQL_CLIENT_PLUGIN_EXPORT

#define MYSQL_CLIENT_PLUGIN_EXPORT

◆ MYSQL_CLIENT_PLUGIN_HEADER

#define MYSQL_CLIENT_PLUGIN_HEADER
Value:
int type; \
unsigned int interface_version; \
const char *name; \
const char *author; \
const char *desc; \
unsigned int version[3]; \
const char *license; \
void *mysql_api; \
int (*init)(char *, size_t, int, va_list); \
int (*deinit)(void); \
int (*options)(const char *option, const void *); \
int (*get_options)(const char *option, void *);
static mysql_service_status_t deinit()
Component deinitialization.
Definition: audit_api_message_emit.cc:580
static mysql_service_status_t init()
Component initialization.
Definition: audit_api_message_emit.cc:571
static int get_options(int *argc, char ***argv, MEM_ROOT *alloc)
Definition: mysqlcheck.cc:383
Definition: options.cc:57
required uint64 version
Definition: replication_group_member_actions.proto:41
required string type
Definition: replication_group_member_actions.proto:34
case opt name
Definition: sslopt-case.h:29
static char * license
Definition: sys_vars.cc:5609

◆ MYSQL_CLIENT_PLUGIN_INCLUDED

#define MYSQL_CLIENT_PLUGIN_INCLUDED

◆ MYSQL_CLIENT_reserved1

#define MYSQL_CLIENT_reserved1   0

◆ MYSQL_CLIENT_reserved2

#define MYSQL_CLIENT_reserved2   1

◆ MYSQL_CLIENT_TELEMETRY_PLUGIN

#define MYSQL_CLIENT_TELEMETRY_PLUGIN   4

◆ MYSQL_CLIENT_TELEMETRY_PLUGIN_INTERFACE_VERSION

#define MYSQL_CLIENT_TELEMETRY_PLUGIN_INTERFACE_VERSION   0x0200

◆ MYSQL_CLIENT_TRACE_PLUGIN

#define MYSQL_CLIENT_TRACE_PLUGIN   3

◆ MYSQL_CLIENT_TRACE_PLUGIN_INTERFACE_VERSION

#define MYSQL_CLIENT_TRACE_PLUGIN_INTERFACE_VERSION   0x0200

◆ mysql_declare_client_plugin

#define mysql_declare_client_plugin (   X)
Value:
MYSQL_CLIENT_PLUGIN_EXPORT st_mysql_client_plugin_##X \
_mysql_client_plugin_declaration_ = { \
MYSQL_CLIENT_##X##_PLUGIN, \
MYSQL_CLIENT_##X##_PLUGIN_INTERFACE_VERSION,
#define MYSQL_CLIENT_PLUGIN_EXPORT
Definition: client_plugin.h:68
#define X(b)
Definition: xcom_base.cc:9161

◆ mysql_end_client_plugin

#define mysql_end_client_plugin   }

Typedef Documentation

◆ st_mysql_client_plugin_AUTHENTICATION

Function Documentation

◆ mysql_client_find_plugin()

struct st_mysql_client_plugin * mysql_client_find_plugin ( struct MYSQL mysql,
const char *  name,
int  type 
)

finds an already loaded plugin by name, or loads it, if necessary

Parameters
mysqlMYSQL structure.
namea name of the plugin to load
typetype of plugin that should be loaded
Return values
apointer to the plugin, or NULL in case of a failure

◆ mysql_client_register_plugin()

struct st_mysql_client_plugin * mysql_client_register_plugin ( struct MYSQL mysql,
struct st_mysql_client_plugin plugin 
)

adds a plugin structure to the list of loaded plugins

This is useful if an application has the necessary functionality (for example, a special load data handler) statically linked into the application binary. It can use this function to register the plugin directly, avoiding the need to factor it out into a shared object.

Parameters
mysqlMYSQL structure. It is only used for error reporting
pluginan st_mysql_client_plugin structure to register
Return values
apointer to the plugin, or NULL in case of a failure

◆ mysql_load_plugin()

struct st_mysql_client_plugin * mysql_load_plugin ( struct MYSQL mysql,
const char *  name,
int  type,
int  argc,
  ... 
)

loads a plugin and initializes it

Parameters
mysqlMYSQL structure.
namea name of the plugin to load
typetype of plugin that should be loaded, -1 to disable type check
argcnumber of arguments to pass to the plugin initialization function
...arguments for the plugin initialization function
Return values
apointer to the loaded plugin, or NULL in case of a failure

◆ mysql_load_plugin_v()

struct st_mysql_client_plugin * mysql_load_plugin_v ( struct MYSQL mysql,
const char *  name,
int  type,
int  argc,
va_list  args 
)

loads a plugin and initializes it, taking va_list as an argument

This is the same as mysql_load_plugin, but take va_list instead of a list of arguments.

Parameters
mysqlMYSQL structure.
namea name of the plugin to load
typetype of plugin that should be loaded, -1 to disable type check
argcnumber of arguments to pass to the plugin initialization function
argsarguments for the plugin initialization function
Return values
apointer to the loaded plugin, or NULL in case of a failure

◆ mysql_plugin_get_option()

int mysql_plugin_get_option ( struct st_mysql_client_plugin plugin,
const char *  option,
void *  value 
)

get plugin options

Can be used to get options from a plugin. This function may be called multiple times to get several options

Parameters
pluginan st_mysql_client_plugin structure
optiona string which specifies the option to get
[out]valuevalue for the option.
Return values
0on success, 1 in case of failure

◆ mysql_plugin_options()

int mysql_plugin_options ( struct st_mysql_client_plugin plugin,
const char *  option,
const void *  value 
)

set plugin options

Can be used to set extra options and affect behavior for a plugin. This function may be called multiple times to set several options

Parameters
pluginan st_mysql_client_plugin structure
optiona string which specifies the option to set
valuevalue for the option.
Return values
0on success, 1 in case of failure