MySQL 5.6.14 Source Code Document
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
client_plugin.h
Go to the documentation of this file.
1 #ifndef MYSQL_CLIENT_PLUGIN_INCLUDED
2 /* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
3 
4  This program is free software; you can redistribute it and/or modify
5  it under the terms of the GNU General Public License as published by
6  the Free Software Foundation; version 2 of the License.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
16 
24 #define MYSQL_CLIENT_PLUGIN_INCLUDED
25 
26 #ifndef MYSQL_ABI_CHECK
27 #include <stdarg.h>
28 #include <stdlib.h>
29 #endif
30 
31 /* known plugin types */
32 #define MYSQL_CLIENT_reserved1 0
33 #define MYSQL_CLIENT_reserved2 1
34 #define MYSQL_CLIENT_AUTHENTICATION_PLUGIN 2
35 
36 #define MYSQL_CLIENT_AUTHENTICATION_PLUGIN_INTERFACE_VERSION 0x0100
37 
38 #define MYSQL_CLIENT_MAX_PLUGINS 3
39 
40 #define mysql_declare_client_plugin(X) \
41  MYSQL_PLUGIN_EXPORT struct st_mysql_client_plugin_ ## X \
42  _mysql_client_plugin_declaration_ = { \
43  MYSQL_CLIENT_ ## X ## _PLUGIN, \
44  MYSQL_CLIENT_ ## X ## _PLUGIN_INTERFACE_VERSION,
45 #define mysql_end_client_plugin }
46 
47 /* generic plugin header structure */
48 #define MYSQL_CLIENT_PLUGIN_HEADER \
49  int type; \
50  unsigned int interface_version; \
51  const char *name; \
52  const char *author; \
53  const char *desc; \
54  unsigned int version[3]; \
55  const char *license; \
56  void *mysql_api; \
57  int (*init)(char *, size_t, int, va_list); \
58  int (*deinit)(); \
59  int (*options)(const char *option, const void *);
60 
62 {
63  MYSQL_CLIENT_PLUGIN_HEADER
64 };
65 
66 struct st_mysql;
67 
68 /******** authentication plugin specific declarations *********/
70 
72 {
73  MYSQL_CLIENT_PLUGIN_HEADER
74  int (*authenticate_user)(MYSQL_PLUGIN_VIO *vio, struct st_mysql *mysql);
75 };
76 
77 /******** using plugins ************/
78 
93 mysql_load_plugin(struct st_mysql *mysql, const char *name, int type,
94  int argc, ...);
95 
112 struct st_mysql_client_plugin *
113 mysql_load_plugin_v(struct st_mysql *mysql, const char *name, int type,
114  int argc, va_list args);
115 
126 struct st_mysql_client_plugin *
127 mysql_client_find_plugin(struct st_mysql *mysql, const char *name, int type);
128 
143 struct st_mysql_client_plugin *
145  struct st_mysql_client_plugin *plugin);
146 
160  const char *option, const void *value);
161 #endif
162