1#include "plugin.h"
2typedef void * MYSQL_PLUGIN;
3#include <mysql/services.h>
4#include <mysql/service_my_snprintf.h>
5extern struct my_snprintf_service_st {
6  size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
7  size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
8} *my_snprintf_service;
9size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
10size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
11#include <mysql/service_thd_alloc.h>
12struct st_mysql_lex_string
13{
14  char *str;
15  size_t length;
16};
17typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
18extern struct thd_alloc_service_st {
19  void *(*thd_alloc_func)(void*, unsigned int);
20  void *(*thd_calloc_func)(void*, unsigned int);
21  char *(*thd_strdup_func)(void*, const char *);
22  char *(*thd_strmake_func)(void*, const char *, unsigned int);
23  void *(*thd_memdup_func)(void*, const void*, unsigned int);
24  MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
25                                        const char *, unsigned int, int);
26} *thd_alloc_service;
27void *thd_alloc(void* thd, unsigned int size);
28void *thd_calloc(void* thd, unsigned int size);
29char *thd_strdup(void* thd, const char *str);
30char *thd_strmake(void* thd, const char *str, unsigned int size);
31void *thd_memdup(void* thd, const void* str, unsigned int size);
32MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
33                                      const char *str, unsigned int size,
34                                      int allocate_lex_string);
35#include <mysql/service_thd_wait.h>
36typedef enum _thd_wait_type_e {
37  THD_WAIT_SLEEP= 1,
38  THD_WAIT_DISKIO= 2,
39  THD_WAIT_ROW_LOCK= 3,
40  THD_WAIT_GLOBAL_LOCK= 4,
41  THD_WAIT_META_DATA_LOCK= 5,
42  THD_WAIT_TABLE_LOCK= 6,
43  THD_WAIT_USER_LOCK= 7,
44  THD_WAIT_BINLOG= 8,
45  THD_WAIT_GROUP_COMMIT= 9,
46  THD_WAIT_SYNC= 10,
47  THD_WAIT_NET= 11,
48  THD_WAIT_LAST= 12
49} thd_wait_type;
50extern struct thd_wait_service_st {
51  void (*thd_wait_begin_func)(void*, int);
52  void (*thd_wait_end_func)(void*);
53} *thd_wait_service;
54void thd_wait_begin(void* thd, int wait_type);
55void thd_wait_end(void* thd);
56#include <mysql/service_thread_scheduler.h>
57struct scheduler_functions;
58extern struct my_thread_scheduler_service {
59  int (*set)(struct scheduler_functions *scheduler);
60  int (*reset)();
61} *my_thread_scheduler_service;
62int my_thread_scheduler_set(struct scheduler_functions *scheduler);
63int my_thread_scheduler_reset();
64#include <mysql/service_my_plugin_log.h>
65enum plugin_log_level
66{
67  MY_ERROR_LEVEL,
68  MY_WARNING_LEVEL,
69  MY_INFORMATION_LEVEL
70};
71extern struct my_plugin_log_service
72{
73  int (*my_plugin_log_message)(MYSQL_PLUGIN *, enum plugin_log_level, const char *, ...);
74} *my_plugin_log_service;
75int my_plugin_log_message(MYSQL_PLUGIN *plugin, enum plugin_log_level level,
76                          const char *format, ...);
77#include <mysql/service_mysql_string.h>
78typedef void *mysql_string_iterator_handle;
79typedef void *mysql_string_handle;
80extern struct mysql_string_service_st {
81  int (*mysql_string_convert_to_char_ptr_type)
82       (mysql_string_handle, const char *, char *, unsigned int, int *);
83  mysql_string_iterator_handle (*mysql_string_get_iterator_type)
84                                (mysql_string_handle);
85  int (*mysql_string_iterator_next_type)(mysql_string_iterator_handle);
86  int (*mysql_string_iterator_isupper_type)(mysql_string_iterator_handle);
87  int (*mysql_string_iterator_islower_type)(mysql_string_iterator_handle);
88  int (*mysql_string_iterator_isdigit_type)(mysql_string_iterator_handle);
89  mysql_string_handle (*mysql_string_to_lowercase_type)(mysql_string_handle);
90  void (*mysql_string_free_type)(mysql_string_handle);
91  void (*mysql_string_iterator_free_type)(mysql_string_iterator_handle);
92} *mysql_string_service;
93int mysql_string_convert_to_char_ptr(mysql_string_handle string_handle,
94                                     const char *charset_name, char *buffer,
95                                     unsigned int buffer_size, int *error);
96mysql_string_iterator_handle mysql_string_get_iterator(mysql_string_handle
97                                                       string_handle);
98int mysql_string_iterator_next(mysql_string_iterator_handle iterator_handle);
99int mysql_string_iterator_isupper(mysql_string_iterator_handle iterator_handle);
100int mysql_string_iterator_islower(mysql_string_iterator_handle iterator_handle);
101int mysql_string_iterator_isdigit(mysql_string_iterator_handle iterator_handle);
102mysql_string_handle mysql_string_to_lowercase(mysql_string_handle
103                                              string_handle);
104void mysql_string_free(mysql_string_handle);
105void mysql_string_iterator_free(mysql_string_iterator_handle);
106struct st_mysql_xid {
107  long formatID;
108  long gtrid_length;
109  long bqual_length;
110  char data[128];
111};
112typedef struct st_mysql_xid MYSQL_XID;
113enum enum_mysql_show_type
114{
115  SHOW_UNDEF, SHOW_BOOL,
116  SHOW_INT,
117  SHOW_LONG,
118  SHOW_LONGLONG,
119  SHOW_CHAR, SHOW_CHAR_PTR,
120  SHOW_ARRAY, SHOW_FUNC, SHOW_DOUBLE,
121  SHOW_always_last
122};
123struct st_mysql_show_var {
124  const char *name;
125  char *value;
126  enum enum_mysql_show_type type;
127};
128typedef int (*mysql_show_var_func)(void*, struct st_mysql_show_var*, char *);
129struct st_mysql_sys_var;
130struct st_mysql_value;
131typedef int (*mysql_var_check_func)(void* thd,
132                                    struct st_mysql_sys_var *var,
133                                    void *save, struct st_mysql_value *value);
134typedef void (*mysql_var_update_func)(void* thd,
135                                      struct st_mysql_sys_var *var,
136                                      void *var_ptr, const void *save);
137struct st_mysql_plugin
138{
139  int type;
140  void *info;
141  const char *name;
142  const char *author;
143  const char *descr;
144  int license;
145  int (*init)(MYSQL_PLUGIN);
146  int (*deinit)(MYSQL_PLUGIN);
147  unsigned int version;
148  struct st_mysql_show_var *status_vars;
149  struct st_mysql_sys_var **system_vars;
150  void * __reserved1;
151  unsigned long flags;
152};
153#include "plugin_ftparser.h"
154struct st_mysql_daemon
155{
156  int interface_version;
157};
158struct st_mysql_information_schema
159{
160  int interface_version;
161};
162struct st_mysql_storage_engine
163{
164  int interface_version;
165};
166struct handlerton;
167 struct Mysql_replication {
168   int interface_version;
169 };
170struct st_mysql_value
171{
172  int (*value_type)(struct st_mysql_value *);
173  const char *(*val_str)(struct st_mysql_value *, char *buffer, int *length);
174  int (*val_real)(struct st_mysql_value *, double *realbuf);
175  int (*val_int)(struct st_mysql_value *, long long *intbuf);
176  int (*is_unsigned)(struct st_mysql_value *);
177};
178int thd_in_lock_tables(const void* thd);
179int thd_tablespace_op(const void* thd);
180long long thd_test_options(const void* thd, long long test_options);
181int thd_sql_command(const void* thd);
182const char *thd_proc_info(void* thd, const char *info);
183void **thd_ha_data(const void* thd, const struct handlerton *hton);
184void thd_storage_lock_wait(void* thd, long long value);
185int thd_tx_isolation(const void* thd);
186int thd_tx_is_read_only(const void* thd);
187char *thd_security_context(void* thd, char *buffer, unsigned int length,
188                           unsigned int max_query_len);
189void thd_inc_row_count(void* thd);
190int thd_allow_batch(void* thd);
191void increment_thd_innodb_stats(void* thd,
192                    unsigned long long trx_id,
193                    long io_reads,
194                    long long io_read,
195                    uint64_t io_reads_wait_timer,
196                    uint64_t lock_que_wait_timer,
197                    uint64_t que_wait_timer,
198                    long page_access);
199unsigned long thd_log_slow_verbosity(const void* thd);
200int thd_opt_slow_log();
201int mysql_tmpfile(const char *prefix);
202int thd_killed(const void* thd);
203void thd_binlog_pos(const void* thd,
204                    const char **file_var,
205                    unsigned long long *pos_var);
206void thd_set_kill_status(const void* thd);
207unsigned long thd_get_thread_id(const void* thd);
208int64_t thd_get_query_id(const void* thd);
209void thd_get_xid(const void* thd, MYSQL_XID *xid);
210void mysql_query_cache_invalidate4(void* thd,
211                                   const char *key, unsigned int key_length,
212                                   int using_trx);
213void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
214void thd_set_ha_data(void* thd, const struct handlerton *hton,
215                     const void *ha_data);
216int thd_command(const void* thd);
217long long thd_start_time(const void* thd);
218void thd_kill(unsigned long id);
219enum enum_ftparser_mode
220{
221  MYSQL_FTPARSER_SIMPLE_MODE= 0,
222  MYSQL_FTPARSER_WITH_STOPWORDS= 1,
223  MYSQL_FTPARSER_FULL_BOOLEAN_INFO= 2
224};
225enum enum_ft_token_type
226{
227  FT_TOKEN_EOF= 0,
228  FT_TOKEN_WORD= 1,
229  FT_TOKEN_LEFT_PAREN= 2,
230  FT_TOKEN_RIGHT_PAREN= 3,
231  FT_TOKEN_STOPWORD= 4
232};
233typedef struct st_mysql_ftparser_boolean_info
234{
235  enum enum_ft_token_type type;
236  int yesno;
237  int weight_adjust;
238  char wasign;
239  char trunc;
240  char prev;
241  char *quot;
242} MYSQL_FTPARSER_BOOLEAN_INFO;
243typedef struct st_mysql_ftparser_param
244{
245  int (*mysql_parse)(struct st_mysql_ftparser_param *,
246                     char *doc, int doc_len);
247  int (*mysql_add_word)(struct st_mysql_ftparser_param *,
248                        char *word, int word_len,
249                        MYSQL_FTPARSER_BOOLEAN_INFO *boolean_info);
250  void *ftparser_state;
251  void *mysql_ftparam;
252  const struct charset_info_st *cs;
253  char *doc;
254  int length;
255  int flags;
256  enum enum_ftparser_mode mode;
257} MYSQL_FTPARSER_PARAM;
258struct st_mysql_ftparser
259{
260  int interface_version;
261  int (*parse)(MYSQL_FTPARSER_PARAM *param);
262  int (*init)(MYSQL_FTPARSER_PARAM *param);
263  int (*deinit)(MYSQL_FTPARSER_PARAM *param);
264};
265