1 | /* Copyright (C) 2013 by MontyProgram AB |
2 | |
3 | This library is free software; you can redistribute it and/or |
4 | modify it under the terms of the GNU Library General Public |
5 | License as published by the Free Software Foundation; either |
6 | version 2 of the License, or (at your option) any later version. |
7 | |
8 | This library 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 GNU |
11 | Library General Public License for more details. |
12 | |
13 | You should have received a copy of the GNU Library General Public |
14 | License along with this library; if not, write to the Free |
15 | Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, |
16 | MA 02111-1301, USA */ |
17 | |
18 | /* defines for the libmariadb library */ |
19 | |
20 | #ifndef _ma_common_h |
21 | #define _ma_common_h |
22 | |
23 | #include <mysql.h> |
24 | #include <ma_hash.h> |
25 | |
26 | enum enum_multi_status { |
27 | COM_MULTI_OFF= 0, |
28 | COM_MULTI_CANCEL, |
29 | COM_MULTI_ENABLED, |
30 | COM_MULTI_DISABLED, |
31 | COM_MULTI_END |
32 | }; |
33 | |
34 | |
35 | typedef enum { |
36 | ALWAYS_ACCEPT, /* heuristics is disabled, use CLIENT_LOCAL_FILES */ |
37 | WAIT_FOR_QUERY, /* heuristics is enabled, not sending files */ |
38 | ACCEPT_FILE_REQUEST /* heuristics is enabled, ready to send a file */ |
39 | } auto_local_infile_state; |
40 | |
41 | typedef struct st_mariadb_db_driver |
42 | { |
43 | struct st_mariadb_client_plugin_DB *plugin; |
44 | char *name; |
45 | void *buffer; |
46 | } MARIADB_DB_DRIVER; |
47 | |
48 | struct mysql_async_context; |
49 | |
50 | struct st_mysql_options_extension { |
51 | char *plugin_dir; |
52 | char *default_auth; |
53 | char *ssl_crl; |
54 | char *ssl_crlpath; |
55 | char *server_public_key_path; |
56 | struct mysql_async_context *async_context; |
57 | HASH connect_attrs; |
58 | size_t connect_attrs_len; |
59 | void (*report_progress)(const MYSQL *mysql, |
60 | unsigned int stage, |
61 | unsigned int max_stage, |
62 | double progress, |
63 | const char *proc_info, |
64 | unsigned int proc_info_length); |
65 | MARIADB_DB_DRIVER *db_driver; |
66 | char *tls_fp; /* finger print of server certificate */ |
67 | char *tls_fp_list; /* white list of finger prints */ |
68 | char *tls_pw; /* password for encrypted certificates */ |
69 | my_bool multi_command; /* indicates if client wants to send multiple |
70 | commands in one packet */ |
71 | char *url; /* for connection handler we need to save URL for reconnect */ |
72 | unsigned int tls_cipher_strength; |
73 | char *tls_version; |
74 | my_bool read_only; |
75 | char *connection_handler; |
76 | my_bool (*set_option)(MYSQL *mysql, const char *config_option, const char *config_value); |
77 | HASH userdata; |
78 | char *server_public_key; |
79 | char *; |
80 | size_t ; |
81 | int (*io_wait)(my_socket handle, my_bool is_read, int timeout); |
82 | }; |
83 | |
84 | typedef struct st_connection_handler |
85 | { |
86 | struct st_ma_connection_plugin *plugin; |
87 | void *data; |
88 | my_bool active; |
89 | my_bool free_data; |
90 | } MA_CONNECTION_HANDLER; |
91 | |
92 | struct st_mariadb_net_extension { |
93 | enum enum_multi_status multi_status; |
94 | }; |
95 | |
96 | struct st_mariadb_session_state |
97 | { |
98 | LIST *list, |
99 | *current; |
100 | }; |
101 | |
102 | struct st_mariadb_extension { |
103 | MA_CONNECTION_HANDLER *conn_hdlr; |
104 | struct st_mariadb_session_state session_state[SESSION_TRACK_TYPES]; |
105 | unsigned long mariadb_client_flag; /* MariaDB specific client flags */ |
106 | unsigned long mariadb_server_capabilities; /* MariaDB specific server capabilities */ |
107 | my_bool auto_local_infile; |
108 | }; |
109 | |
110 | #define OPT_EXT_VAL(a,key) \ |
111 | ((a)->options.extension && (a)->options.extension->key) ?\ |
112 | (a)->options.extension->key : 0 |
113 | |
114 | #endif |
115 | |