services.h.pp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506
  1. #include <mysql/service_srv_session.h>
  2. struct Srv_session;
  3. typedef struct Srv_session* MYSQL_SESSION;
  4. typedef void (*srv_session_error_cb)(void *ctx,
  5. unsigned int sql_errno,
  6. const char *err_msg);
  7. extern struct srv_session_service_st
  8. {
  9. int (*init_session_thread)(const void *plugin);
  10. void (*deinit_session_thread)();
  11. MYSQL_SESSION (*open_session)(srv_session_error_cb error_cb,
  12. void *plugix_ctx);
  13. int (*detach_session)(MYSQL_SESSION session);
  14. int (*close_session)(MYSQL_SESSION session);
  15. int (*server_is_available)();
  16. } *srv_session_service;
  17. int srv_session_init_thread(const void *plugin);
  18. void srv_session_deinit_thread();
  19. MYSQL_SESSION srv_session_open(srv_session_error_cb cb, void *plugix_ctx);
  20. int srv_session_detach(MYSQL_SESSION session);
  21. int srv_session_close(MYSQL_SESSION session);
  22. int srv_session_server_is_available();
  23. #include <mysql/service_srv_session_info.h>
  24. #include "mysql/service_srv_session.h"
  25. extern struct srv_session_info_service_st {
  26. MYSQL_THD (*get_thd)(MYSQL_SESSION session);
  27. my_thread_id (*get_session_id)(MYSQL_SESSION session);
  28. LEX_CSTRING (*get_current_db)(MYSQL_SESSION session);
  29. uint16_t (*get_client_port)(MYSQL_SESSION session);
  30. int (*set_client_port)(MYSQL_SESSION session, uint16_t port);
  31. int (*set_connection_type)(MYSQL_SESSION session, enum enum_vio_type type);
  32. int (*killed)(MYSQL_SESSION session);
  33. unsigned int (*session_count)();
  34. unsigned int (*thread_count)(const void *plugin);
  35. } *srv_session_info_service;
  36. MYSQL_THD srv_session_info_get_thd(MYSQL_SESSION session);
  37. my_thread_id srv_session_info_get_session_id(MYSQL_SESSION session);
  38. LEX_CSTRING srv_session_info_get_current_db(MYSQL_SESSION session);
  39. uint16_t srv_session_info_get_client_port(MYSQL_SESSION session);
  40. int srv_session_info_set_client_port(MYSQL_SESSION session, uint16_t port);
  41. int srv_session_info_set_connection_type(MYSQL_SESSION session,
  42. enum enum_vio_type type);
  43. int srv_session_info_killed(MYSQL_SESSION session);
  44. unsigned int srv_session_info_session_count();
  45. unsigned int srv_session_info_thread_count(const void *plugin);
  46. #include <mysql/service_command.h>
  47. #include "mysql/service_srv_session.h"
  48. #include "mysql/com_data.h"
  49. typedef struct st_com_init_db_data
  50. {
  51. const char *db_name;
  52. unsigned long length;
  53. } COM_INIT_DB_DATA;
  54. typedef struct st_com_refresh_data
  55. {
  56. unsigned char options;
  57. } COM_REFRESH_DATA;
  58. typedef struct st_com_shutdown_data
  59. {
  60. enum mysql_enum_shutdown_level level;
  61. } COM_SHUTDOWN_DATA;
  62. typedef struct st_com_kill_data
  63. {
  64. unsigned long id;
  65. } COM_KILL_DATA;
  66. typedef struct st_com_set_option_data
  67. {
  68. unsigned int opt_command;
  69. } COM_SET_OPTION_DATA;
  70. typedef struct st_com_stmt_execute_data
  71. {
  72. unsigned long stmt_id;
  73. unsigned long flags;
  74. unsigned char *params;
  75. unsigned long params_length;
  76. } COM_STMT_EXECUTE_DATA;
  77. typedef struct st_com_stmt_fetch_data
  78. {
  79. unsigned long stmt_id;
  80. unsigned long num_rows;
  81. } COM_STMT_FETCH_DATA;
  82. typedef struct st_com_stmt_send_long_data_data
  83. {
  84. unsigned long stmt_id;
  85. unsigned int param_number;
  86. unsigned char *longdata;
  87. unsigned long length;
  88. } COM_STMT_SEND_LONG_DATA_DATA;
  89. typedef struct st_com_stmt_prepare_data
  90. {
  91. const char *query;
  92. unsigned int length;
  93. } COM_STMT_PREPARE_DATA;
  94. typedef struct st_stmt_close_data
  95. {
  96. unsigned int stmt_id;
  97. } COM_STMT_CLOSE_DATA;
  98. typedef struct st_com_stmt_reset_data
  99. {
  100. unsigned int stmt_id;
  101. } COM_STMT_RESET_DATA;
  102. typedef struct st_com_query_data
  103. {
  104. const char *query;
  105. unsigned int length;
  106. } COM_QUERY_DATA;
  107. typedef struct st_com_field_list_data
  108. {
  109. unsigned char *table_name;
  110. unsigned int table_name_length;
  111. const unsigned char *query;
  112. unsigned int query_length;
  113. } COM_FIELD_LIST_DATA;
  114. union COM_DATA {
  115. COM_INIT_DB_DATA com_init_db;
  116. COM_REFRESH_DATA com_refresh;
  117. COM_SHUTDOWN_DATA com_shutdown;
  118. COM_KILL_DATA com_kill;
  119. COM_SET_OPTION_DATA com_set_option;
  120. COM_STMT_EXECUTE_DATA com_stmt_execute;
  121. COM_STMT_FETCH_DATA com_stmt_fetch;
  122. COM_STMT_SEND_LONG_DATA_DATA com_stmt_send_long_data;
  123. COM_STMT_PREPARE_DATA com_stmt_prepare;
  124. COM_STMT_CLOSE_DATA com_stmt_close;
  125. COM_STMT_RESET_DATA com_stmt_reset;
  126. COM_QUERY_DATA com_query;
  127. COM_FIELD_LIST_DATA com_field_list;
  128. };
  129. #include "mysql_time.h"
  130. enum enum_mysql_timestamp_type
  131. {
  132. MYSQL_TIMESTAMP_NONE= -2, MYSQL_TIMESTAMP_ERROR= -1,
  133. MYSQL_TIMESTAMP_DATE= 0, MYSQL_TIMESTAMP_DATETIME= 1, MYSQL_TIMESTAMP_TIME= 2
  134. };
  135. typedef struct st_mysql_time
  136. {
  137. unsigned int year, month, day, hour, minute, second;
  138. unsigned long second_part;
  139. my_bool neg;
  140. enum enum_mysql_timestamp_type time_type;
  141. } MYSQL_TIME;
  142. #include "decimal.h"
  143. typedef enum
  144. {TRUNCATE=0, HALF_EVEN, HALF_UP, CEILING, FLOOR}
  145. decimal_round_mode;
  146. typedef int32 decimal_digit_t;
  147. typedef struct st_decimal_t {
  148. int intg, frac, len;
  149. my_bool sign;
  150. decimal_digit_t *buf;
  151. } decimal_t;
  152. struct st_send_field
  153. {
  154. const char *db_name;
  155. const char *table_name;
  156. const char *org_table_name;
  157. const char *col_name;
  158. const char *org_col_name;
  159. unsigned long length;
  160. unsigned int charsetnr;
  161. unsigned int flags;
  162. unsigned int decimals;
  163. enum_field_types type;
  164. };
  165. struct st_command_service_cbs
  166. {
  167. int (*start_result_metadata)(void *ctx, uint num_cols, uint flags,
  168. const CHARSET_INFO *resultcs);
  169. int (*field_metadata)(void *ctx, struct st_send_field *field,
  170. const CHARSET_INFO *charset);
  171. int (*end_result_metadata)(void *ctx, uint server_status,
  172. uint warn_count);
  173. int (*start_row)(void *ctx);
  174. int (*end_row)(void *ctx);
  175. void (*abort_row)(void *ctx);
  176. ulong (*get_client_capabilities)(void *ctx);
  177. int (*get_null)(void * ctx);
  178. int (*get_integer)(void * ctx, longlong value);
  179. int (*get_longlong)(void * ctx, longlong value, uint is_unsigned);
  180. int (*get_decimal)(void * ctx, const decimal_t * value);
  181. int (*get_double)(void * ctx, double value, uint32_t decimals);
  182. int (*get_date)(void * ctx, const MYSQL_TIME * value);
  183. int (*get_time)(void * ctx, const MYSQL_TIME * value, uint decimals);
  184. int (*get_datetime)(void * ctx, const MYSQL_TIME * value, uint decimals);
  185. int (*get_string)(void * ctx, const char * value, size_t length,
  186. const CHARSET_INFO * valuecs);
  187. void (*handle_ok)(void * ctx,
  188. uint server_status, uint statement_warn_count,
  189. ulonglong affected_rows, ulonglong last_insert_id,
  190. const char * message);
  191. void (*handle_error)(void * ctx, uint sql_errno, const char * err_msg,
  192. const char * sqlstate);
  193. void (*shutdown)(void *ctx, int server_shutdown);
  194. };
  195. enum cs_text_or_binary
  196. {
  197. CS_TEXT_REPRESENTATION= 1,
  198. CS_BINARY_REPRESENTATION= 2,
  199. };
  200. extern struct command_service_st {
  201. int (*run_command)(MYSQL_SESSION session,
  202. enum enum_server_command command,
  203. const union COM_DATA * data,
  204. const CHARSET_INFO * client_cs,
  205. const struct st_command_service_cbs * callbacks,
  206. enum cs_text_or_binary text_or_binary,
  207. void * service_callbacks_ctx);
  208. } *command_service;
  209. int command_service_run_command(MYSQL_SESSION session,
  210. enum enum_server_command command,
  211. const union COM_DATA * data,
  212. const CHARSET_INFO * client_cs,
  213. const struct st_command_service_cbs * callbacks,
  214. enum cs_text_or_binary text_or_binary,
  215. void * service_callbacks_ctx);
  216. #include <mysql/service_my_snprintf.h>
  217. extern struct my_snprintf_service_st {
  218. size_t (*my_snprintf_type)(char*, size_t, const char*, ...);
  219. size_t (*my_vsnprintf_type)(char *, size_t, const char*, va_list);
  220. } *my_snprintf_service;
  221. size_t my_snprintf(char* to, size_t n, const char* fmt, ...);
  222. size_t my_vsnprintf(char *to, size_t n, const char* fmt, va_list ap);
  223. #include <mysql/service_thd_alloc.h>
  224. #include <mysql/mysql_lex_string.h>
  225. struct st_mysql_lex_string
  226. {
  227. char *str;
  228. size_t length;
  229. };
  230. typedef struct st_mysql_lex_string MYSQL_LEX_STRING;
  231. struct st_mysql_const_lex_string
  232. {
  233. const char *str;
  234. size_t length;
  235. };
  236. typedef struct st_mysql_const_lex_string MYSQL_LEX_CSTRING;
  237. extern struct thd_alloc_service_st {
  238. void *(*thd_alloc_func)(void*, size_t);
  239. void *(*thd_calloc_func)(void*, size_t);
  240. char *(*thd_strdup_func)(void*, const char *);
  241. char *(*thd_strmake_func)(void*, const char *, size_t);
  242. void *(*thd_memdup_func)(void*, const void*, size_t);
  243. MYSQL_LEX_STRING *(*thd_make_lex_string_func)(void*, MYSQL_LEX_STRING *,
  244. const char *, size_t, int);
  245. } *thd_alloc_service;
  246. void *thd_alloc(void* thd, size_t size);
  247. void *thd_calloc(void* thd, size_t size);
  248. char *thd_strdup(void* thd, const char *str);
  249. char *thd_strmake(void* thd, const char *str, size_t size);
  250. void *thd_memdup(void* thd, const void* str, size_t size);
  251. MYSQL_LEX_STRING *thd_make_lex_string(void* thd, MYSQL_LEX_STRING *lex_str,
  252. const char *str, size_t size,
  253. int allocate_lex_string);
  254. #include <mysql/service_thd_wait.h>
  255. typedef enum _thd_wait_type_e {
  256. THD_WAIT_SLEEP= 1,
  257. THD_WAIT_DISKIO= 2,
  258. THD_WAIT_ROW_LOCK= 3,
  259. THD_WAIT_GLOBAL_LOCK= 4,
  260. THD_WAIT_META_DATA_LOCK= 5,
  261. THD_WAIT_TABLE_LOCK= 6,
  262. THD_WAIT_USER_LOCK= 7,
  263. THD_WAIT_BINLOG= 8,
  264. THD_WAIT_GROUP_COMMIT= 9,
  265. THD_WAIT_SYNC= 10,
  266. THD_WAIT_LAST= 11
  267. } thd_wait_type;
  268. extern struct thd_wait_service_st {
  269. void (*thd_wait_begin_func)(void*, int);
  270. void (*thd_wait_end_func)(void*);
  271. } *thd_wait_service;
  272. void thd_wait_begin(void* thd, int wait_type);
  273. void thd_wait_end(void* thd);
  274. #include <mysql/service_thread_scheduler.h>
  275. struct Connection_handler_functions;
  276. struct THD_event_functions;
  277. extern struct my_thread_scheduler_service {
  278. int (*connection_handler_set)(struct Connection_handler_functions *,
  279. struct THD_event_functions *);
  280. int (*connection_handler_reset)();
  281. } *my_thread_scheduler_service;
  282. int my_connection_handler_set(struct Connection_handler_functions *chf,
  283. struct THD_event_functions *tef);
  284. int my_connection_handler_reset();
  285. #include <mysql/service_my_plugin_log.h>
  286. enum plugin_log_level
  287. {
  288. MY_ERROR_LEVEL,
  289. MY_WARNING_LEVEL,
  290. MY_INFORMATION_LEVEL
  291. };
  292. extern struct my_plugin_log_service
  293. {
  294. int (*my_plugin_log_message)(MYSQL_PLUGIN *, enum plugin_log_level, const char *, ...);
  295. } *my_plugin_log_service;
  296. int my_plugin_log_message(MYSQL_PLUGIN *plugin, enum plugin_log_level level,
  297. const char *format, ...);
  298. #include <mysql/service_mysql_string.h>
  299. typedef void *mysql_string_iterator_handle;
  300. typedef void *mysql_string_handle;
  301. extern struct mysql_string_service_st {
  302. int (*mysql_string_convert_to_char_ptr_type)
  303. (mysql_string_handle, const char *, char *, unsigned int, int *);
  304. mysql_string_iterator_handle (*mysql_string_get_iterator_type)
  305. (mysql_string_handle);
  306. int (*mysql_string_iterator_next_type)(mysql_string_iterator_handle);
  307. int (*mysql_string_iterator_isupper_type)(mysql_string_iterator_handle);
  308. int (*mysql_string_iterator_islower_type)(mysql_string_iterator_handle);
  309. int (*mysql_string_iterator_isdigit_type)(mysql_string_iterator_handle);
  310. mysql_string_handle (*mysql_string_to_lowercase_type)(mysql_string_handle);
  311. void (*mysql_string_free_type)(mysql_string_handle);
  312. void (*mysql_string_iterator_free_type)(mysql_string_iterator_handle);
  313. } *mysql_string_service;
  314. int mysql_string_convert_to_char_ptr(mysql_string_handle string_handle,
  315. const char *charset_name, char *buffer,
  316. unsigned int buffer_size, int *error);
  317. mysql_string_iterator_handle mysql_string_get_iterator(mysql_string_handle
  318. string_handle);
  319. int mysql_string_iterator_next(mysql_string_iterator_handle iterator_handle);
  320. int mysql_string_iterator_isupper(mysql_string_iterator_handle iterator_handle);
  321. int mysql_string_iterator_islower(mysql_string_iterator_handle iterator_handle);
  322. int mysql_string_iterator_isdigit(mysql_string_iterator_handle iterator_handle);
  323. mysql_string_handle mysql_string_to_lowercase(mysql_string_handle
  324. string_handle);
  325. void mysql_string_free(mysql_string_handle);
  326. void mysql_string_iterator_free(mysql_string_iterator_handle);
  327. #include <mysql/service_mysql_alloc.h>
  328. #include "mysql/psi/psi_memory.h"
  329. #include "psi_base.h"
  330. struct PSI_thread;
  331. typedef unsigned int PSI_memory_key;
  332. typedef int myf_t;
  333. typedef void * (*mysql_malloc_t)(PSI_memory_key key, size_t size, myf_t flags);
  334. typedef void * (*mysql_realloc_t)(PSI_memory_key key, void *ptr, size_t size, myf_t flags);
  335. typedef void (*mysql_claim_t)(void *ptr);
  336. typedef void (*mysql_free_t)(void *ptr);
  337. typedef void * (*my_memdup_t)(PSI_memory_key key, const void *from, size_t length, myf_t flags);
  338. typedef char * (*my_strdup_t)(PSI_memory_key key, const char *from, myf_t flags);
  339. typedef char * (*my_strndup_t)(PSI_memory_key key, const char *from, size_t length, myf_t flags);
  340. struct mysql_malloc_service_st
  341. {
  342. mysql_malloc_t mysql_malloc;
  343. mysql_realloc_t mysql_realloc;
  344. mysql_claim_t mysql_claim;
  345. mysql_free_t mysql_free;
  346. my_memdup_t my_memdup;
  347. my_strdup_t my_strdup;
  348. my_strndup_t my_strndup;
  349. };
  350. extern struct mysql_malloc_service_st *mysql_malloc_service;
  351. extern void * my_malloc(PSI_memory_key key, size_t size, myf_t flags);
  352. extern void * my_realloc(PSI_memory_key key, void *ptr, size_t size, myf_t flags);
  353. extern void my_claim(void *ptr);
  354. extern void my_free(void *ptr);
  355. extern void * my_memdup(PSI_memory_key key, const void *from, size_t length, myf_t flags);
  356. extern char * my_strdup(PSI_memory_key key, const char *from, myf_t flags);
  357. extern char * my_strndup(PSI_memory_key key, const char *from, size_t length, myf_t flags);
  358. #include <mysql/service_mysql_password_policy.h>
  359. extern struct mysql_password_policy_service_st {
  360. int (*my_validate_password_policy_func)(const char *, unsigned int);
  361. int (*my_calculate_password_strength_func)(const char *, unsigned int);
  362. } *mysql_password_policy_service;
  363. int my_validate_password_policy(const char *, unsigned int);
  364. int my_calculate_password_strength(const char *, unsigned int);
  365. #include <mysql/service_parser.h>
  366. #include "my_md5_size.h"
  367. #include <mysql/mysql_lex_string.h>
  368. typedef void* MYSQL_ITEM;
  369. typedef
  370. int (*parse_node_visit_function)(MYSQL_ITEM item, unsigned char* arg);
  371. typedef
  372. int (*sql_condition_handler_function)(int sql_errno,
  373. const char* sqlstate,
  374. const char* msg,
  375. void *state);
  376. struct st_my_thread_handle;
  377. extern struct mysql_parser_service_st {
  378. void* (*mysql_current_session)();
  379. void* (*mysql_open_session)();
  380. void (*mysql_start_thread)(void* thd, void *(*callback_fun)(void*),
  381. void *arg,
  382. struct st_my_thread_handle *thread_handle);
  383. void (*mysql_join_thread)(struct st_my_thread_handle *thread_handle);
  384. void (*mysql_set_current_database)(void* thd, const MYSQL_LEX_STRING db);
  385. int (*mysql_parse)(void* thd, const MYSQL_LEX_STRING query,
  386. unsigned char is_prepared,
  387. sql_condition_handler_function handle_condition,
  388. void *condition_handler_state);
  389. int (*mysql_get_statement_type)(void* thd);
  390. int (*mysql_get_statement_digest)(void* thd, unsigned char *digest);
  391. int (*mysql_get_number_params)(void* thd);
  392. int (*mysql_extract_prepared_params)(void* thd, int *positions);
  393. int (*mysql_visit_tree)(void* thd, parse_node_visit_function processor,
  394. unsigned char* arg);
  395. MYSQL_LEX_STRING (*mysql_item_string)(MYSQL_ITEM item);
  396. void (*mysql_free_string)(MYSQL_LEX_STRING string);
  397. MYSQL_LEX_STRING (*mysql_get_query)(void* thd);
  398. MYSQL_LEX_STRING (*mysql_get_normalized_query)(void* thd);
  399. } *mysql_parser_service;
  400. typedef void *(*callback_function)(void*);
  401. void* mysql_parser_current_session();
  402. void* mysql_parser_open_session();
  403. void mysql_parser_start_thread(void* thd, callback_function fun, void *arg,
  404. struct st_my_thread_handle *thread_handle);
  405. void mysql_parser_join_thread(struct st_my_thread_handle *thread_handle);
  406. void mysql_parser_set_current_database(void* thd,
  407. const MYSQL_LEX_STRING db);
  408. int mysql_parser_parse(void* thd, const MYSQL_LEX_STRING query,
  409. unsigned char is_prepared,
  410. sql_condition_handler_function handle_condition,
  411. void *condition_handler_state);
  412. int mysql_parser_get_statement_type(void* thd);
  413. int mysql_parser_get_statement_digest(void* thd, unsigned char *digest);
  414. int mysql_parser_get_number_params(void* thd);
  415. int mysql_parser_extract_prepared_params(void* thd, int *positions);
  416. int mysql_parser_visit_tree(void* thd, parse_node_visit_function processor,
  417. unsigned char* arg);
  418. MYSQL_LEX_STRING mysql_parser_item_string(MYSQL_ITEM item);
  419. void mysql_parser_free_string(MYSQL_LEX_STRING string);
  420. MYSQL_LEX_STRING mysql_parser_get_query(void* thd);
  421. MYSQL_LEX_STRING mysql_parser_get_normalized_query(void* thd);
  422. #include <mysql/service_rpl_transaction_ctx.h>
  423. struct st_transaction_termination_ctx
  424. {
  425. unsigned long m_thread_id;
  426. unsigned int m_flags;
  427. char m_rollback_transaction;
  428. char m_generated_gtid;
  429. int m_sidno;
  430. long long int m_gno;
  431. };
  432. typedef struct st_transaction_termination_ctx Transaction_termination_ctx;
  433. extern struct rpl_transaction_ctx_service_st {
  434. int (*set_transaction_ctx)(Transaction_termination_ctx transaction_termination_ctx);
  435. } *rpl_transaction_ctx_service;
  436. int set_transaction_ctx(Transaction_termination_ctx transaction_termination_ctx);
  437. #include <mysql/service_rpl_transaction_write_set.h>
  438. struct st_trans_write_set
  439. {
  440. unsigned int m_flags;
  441. unsigned long write_set_size;
  442. unsigned long long* write_set;
  443. };
  444. typedef struct st_trans_write_set Transaction_write_set;
  445. extern struct transaction_write_set_service_st {
  446. Transaction_write_set* (*get_transaction_write_set)(unsigned long m_thread_id);
  447. } *transaction_write_set_service;
  448. Transaction_write_set* get_transaction_write_set(unsigned long m_thread_id);
  449. #include <mysql/service_security_context.h>
  450. typedef char my_svc_bool;
  451. extern struct security_context_service_st {
  452. my_svc_bool (*thd_get_security_context)(void*, void* *out_ctx);
  453. my_svc_bool (*thd_set_security_context)(void*, void* in_ctx);
  454. my_svc_bool (*security_context_create)(void* *out_ctx);
  455. my_svc_bool (*security_context_destroy)(void*);
  456. my_svc_bool (*security_context_copy)(void* in_ctx, void* *out_ctx);
  457. my_svc_bool (*security_context_lookup)(void* ctx,
  458. const char *user, const char *host,
  459. const char *ip, const char *db);
  460. my_svc_bool (*security_context_get_option)(void*, const char *name, void *inout_pvalue);
  461. my_svc_bool (*security_context_set_option)(void*, const char *name, void *pvalue);
  462. } *security_context_service;
  463. my_svc_bool thd_get_security_context(void*, void* *out_ctx);
  464. my_svc_bool thd_set_security_context(void*, void* in_ctx);
  465. my_svc_bool security_context_create(void* *out_ctx);
  466. my_svc_bool security_context_destroy(void* ctx);
  467. my_svc_bool security_context_copy(void* in_ctx, void* *out_ctx);
  468. my_svc_bool security_context_lookup(void* ctx,
  469. const char *user, const char *host,
  470. const char *ip, const char *db);
  471. my_svc_bool security_context_get_option(void*, const char *name, void *inout_pvalue);
  472. my_svc_bool security_context_set_option(void*, const char *name, void *pvalue);
  473. #include <mysql/service_locking.h>
  474. enum enum_locking_service_lock_type
  475. { LOCKING_SERVICE_READ, LOCKING_SERVICE_WRITE };
  476. extern struct mysql_locking_service_st {
  477. int (*mysql_acquire_locks)(void* opaque_thd, const char* lock_namespace,
  478. const char**lock_names, size_t lock_num,
  479. enum enum_locking_service_lock_type lock_type,
  480. unsigned long lock_timeout);
  481. int (*mysql_release_locks)(void* opaque_thd, const char* lock_namespace);
  482. } *mysql_locking_service;
  483. int mysql_acquire_locking_service_locks(void* opaque_thd,
  484. const char* lock_namespace,
  485. const char**lock_names,
  486. size_t lock_num,
  487. enum enum_locking_service_lock_type lock_type,
  488. unsigned long lock_timeout);
  489. int mysql_release_locking_service_locks(void* opaque_thd,
  490. const char* lock_namespace);
  491. #include <mysql/service_mysql_keyring.h>
  492. extern struct mysql_keyring_service_st
  493. {
  494. int (*my_key_store_func)(const char *, const char *, const char *,
  495. const void *, size_t);
  496. int (*my_key_fetch_func)(const char *, char **, const char *, void **,
  497. size_t *);
  498. int (*my_key_remove_func)(const char *, const char *);
  499. int (*my_key_generate_func)(const char *, const char *, const char *,
  500. size_t);
  501. } *mysql_keyring_service;
  502. int my_key_store(const char *, const char *, const char *, const void *, size_t);
  503. int my_key_fetch(const char *, char **, const char *, void **,
  504. size_t *);
  505. int my_key_remove(const char *, const char *);
  506. int my_key_generate(const char *, const char *, const char *, size_t);