1 /* Copyright (c) 2015, 2021, Oracle and/or its affiliates.
2 
3    This program is free software; you can redistribute it and/or modify
4    it under the terms of the GNU General Public License, version 2.0,
5    as published by the Free Software Foundation.
6 
7    This program is also distributed with certain software (including
8    but not limited to OpenSSL) that is licensed under separate terms,
9    as designated in a particular file or component or in included license
10    documentation.  The authors of MySQL hereby grant you an additional
11    permission to link the program and your derivative works with the
12    separately licensed software that they have included with MySQL.
13 
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License, version 2.0, for more details.
18 
19    You should have received a copy of the GNU General Public License along
20    with this program; if not, write to the Free Software Foundation, Inc., 51
21    Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
22 #ifndef PLUGIN_PROTOCOL_INCLUDED
23 #define PLUGIN_PROTOCOL_INCLUDED
24 
25 #ifndef MYSQL_ABI_CHECK
26 #include "my_global.h" /* Needed for my_bool in mysql_com.h */
27 #include "mysql_com.h" /* mysql_enum_shutdown_level */
28 #endif
29 
30 
31 /**
32 @file
33   Definition of COM_DATA to be used with the Command service as data input
34   structure.
35 */
36 
37 
38 typedef struct st_com_init_db_data
39 {
40   const char *db_name;
41   unsigned long length;
42 } COM_INIT_DB_DATA;
43 
44 typedef struct st_com_refresh_data
45 {
46   unsigned char options;
47 } COM_REFRESH_DATA;
48 
49 typedef struct st_com_shutdown_data
50 {
51   enum mysql_enum_shutdown_level level;
52 } COM_SHUTDOWN_DATA;
53 
54 typedef struct st_com_kill_data
55 {
56   unsigned long id;
57 } COM_KILL_DATA;
58 
59 typedef struct st_com_set_option_data
60 {
61   unsigned int opt_command;
62 } COM_SET_OPTION_DATA;
63 
64 typedef struct st_com_stmt_execute_data
65 {
66   unsigned long stmt_id;
67   unsigned long flags;
68   unsigned char *params;
69   unsigned long params_length;
70 } COM_STMT_EXECUTE_DATA;
71 
72 typedef struct st_com_stmt_fetch_data
73 {
74   unsigned long stmt_id;
75   unsigned long num_rows;
76 } COM_STMT_FETCH_DATA;
77 
78 typedef struct st_com_stmt_send_long_data_data
79 {
80   unsigned long stmt_id;
81   unsigned int  param_number;
82   unsigned char *longdata;
83   unsigned long length;
84 } COM_STMT_SEND_LONG_DATA_DATA;
85 
86 typedef struct st_com_stmt_prepare_data
87 {
88   const char *query;
89   unsigned int length;
90 } COM_STMT_PREPARE_DATA;
91 
92 typedef struct st_stmt_close_data
93 {
94   unsigned int stmt_id;
95 } COM_STMT_CLOSE_DATA;
96 
97 typedef struct st_com_stmt_reset_data
98 {
99   unsigned int stmt_id;
100 } COM_STMT_RESET_DATA;
101 
102 typedef struct st_com_query_data
103 {
104   const char *query;
105   unsigned int length;
106 } COM_QUERY_DATA;
107 
108 typedef struct st_com_field_list_data
109 {
110   unsigned char   *table_name;
111   unsigned int    table_name_length;
112   const unsigned char *query;
113   unsigned int        query_length;
114 } COM_FIELD_LIST_DATA;
115 
116 union COM_DATA {
117   COM_INIT_DB_DATA com_init_db;
118   COM_REFRESH_DATA com_refresh;
119   COM_SHUTDOWN_DATA com_shutdown;
120   COM_KILL_DATA com_kill;
121   COM_SET_OPTION_DATA com_set_option;
122   COM_STMT_EXECUTE_DATA com_stmt_execute;
123   COM_STMT_FETCH_DATA com_stmt_fetch;
124   COM_STMT_SEND_LONG_DATA_DATA com_stmt_send_long_data;
125   COM_STMT_PREPARE_DATA com_stmt_prepare;
126   COM_STMT_CLOSE_DATA com_stmt_close;
127   COM_STMT_RESET_DATA com_stmt_reset;
128   COM_QUERY_DATA com_query;
129   COM_FIELD_LIST_DATA com_field_list;
130 };
131 
132 #endif /* PLUGIN_PROTOCOL_INCLUDED */
133