1 | /* Copyright (C) 2000 MySQL AB |
---|
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 as published by |
---|
5 | the Free Software Foundation; either version 2 of the License, or |
---|
6 | (at your option) any later version. |
---|
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ |
---|
16 | |
---|
17 | /* |
---|
18 | ** Common definition between mysql server & client |
---|
19 | */ |
---|
20 | |
---|
21 | #ifndef _mysql_com_h |
---|
22 | #define _mysql_com_h |
---|
23 | |
---|
24 | #define NAME_LEN 64 /* Field/table name length */ |
---|
25 | #define HOSTNAME_LENGTH 60 |
---|
26 | #define USERNAME_LENGTH 16 |
---|
27 | #define SERVER_VERSION_LENGTH 60 |
---|
28 | #define SQLSTATE_LENGTH 5 |
---|
29 | |
---|
30 | /* |
---|
31 | USER_HOST_BUFF_SIZE -- length of string buffer, that is enough to contain |
---|
32 | username and hostname parts of the user identifier with trailing zero in |
---|
33 | MySQL standard format: |
---|
34 | user_name_part@host_name_part\0 |
---|
35 | */ |
---|
36 | #define USER_HOST_BUFF_SIZE HOSTNAME_LENGTH + USERNAME_LENGTH + 2 |
---|
37 | |
---|
38 | #define LOCAL_HOST "localhost" |
---|
39 | #define LOCAL_HOST_NAMEDPIPE "." |
---|
40 | |
---|
41 | |
---|
42 | #if defined(__WIN__) && !defined( _CUSTOMCONFIG_) |
---|
43 | #define MYSQL_NAMEDPIPE "MySQL" |
---|
44 | #define MYSQL_SERVICENAME "MySQL" |
---|
45 | #endif /* __WIN__ */ |
---|
46 | |
---|
47 | /* |
---|
48 | You should add new commands to the end of this list, otherwise old |
---|
49 | servers won't be able to handle them as 'unsupported'. |
---|
50 | */ |
---|
51 | |
---|
52 | enum enum_server_command |
---|
53 | { |
---|
54 | COM_SLEEP, COM_QUIT, COM_INIT_DB, COM_QUERY, COM_FIELD_LIST, |
---|
55 | COM_CREATE_DB, COM_DROP_DB, COM_REFRESH, COM_SHUTDOWN, COM_STATISTICS, |
---|
56 | COM_PROCESS_INFO, COM_CONNECT, COM_PROCESS_KILL, COM_DEBUG, COM_PING, |
---|
57 | COM_TIME, COM_DELAYED_INSERT, COM_CHANGE_USER, COM_BINLOG_DUMP, |
---|
58 | COM_TABLE_DUMP, COM_CONNECT_OUT, COM_REGISTER_SLAVE, |
---|
59 | COM_STMT_PREPARE, COM_STMT_EXECUTE, COM_STMT_SEND_LONG_DATA, COM_STMT_CLOSE, |
---|
60 | COM_STMT_RESET, COM_SET_OPTION, COM_STMT_FETCH, |
---|
61 | /* don't forget to update const char *command_name[] in sql_parse.cc */ |
---|
62 | |
---|
63 | /* Must be last */ |
---|
64 | COM_END |
---|
65 | }; |
---|
66 | |
---|
67 | |
---|
68 | /* |
---|
69 | Length of random string sent by server on handshake; this is also length of |
---|
70 | obfuscated password, recieved from client |
---|
71 | */ |
---|
72 | #define SCRAMBLE_LENGTH 20 |
---|
73 | #define SCRAMBLE_LENGTH_323 8 |
---|
74 | /* length of password stored in the db: new passwords are preceeded with '*' */ |
---|
75 | #define SCRAMBLED_PASSWORD_CHAR_LENGTH (SCRAMBLE_LENGTH*2+1) |
---|
76 | #define SCRAMBLED_PASSWORD_CHAR_LENGTH_323 (SCRAMBLE_LENGTH_323*2) |
---|
77 | |
---|
78 | |
---|
79 | #define NOT_NULL_FLAG 1 /* Field can't be NULL */ |
---|
80 | #define PRI_KEY_FLAG 2 /* Field is part of a primary key */ |
---|
81 | #define UNIQUE_KEY_FLAG 4 /* Field is part of a unique key */ |
---|
82 | #define MULTIPLE_KEY_FLAG 8 /* Field is part of a key */ |
---|
83 | #define BLOB_FLAG 16 /* Field is a blob */ |
---|
84 | #define UNSIGNED_FLAG 32 /* Field is unsigned */ |
---|
85 | #define ZEROFILL_FLAG 64 /* Field is zerofill */ |
---|
86 | #define BINARY_FLAG 128 /* Field is binary */ |
---|
87 | |
---|
88 | /* The following are only sent to new clients */ |
---|
89 | #define ENUM_FLAG 256 /* field is an enum */ |
---|
90 | #define AUTO_INCREMENT_FLAG 512 /* field is a autoincrement field */ |
---|
91 | #define TIMESTAMP_FLAG 1024 /* Field is a timestamp */ |
---|
92 | #define SET_FLAG 2048 /* field is a set */ |
---|
93 | #define NO_DEFAULT_VALUE_FLAG 4096 /* Field doesn't have default value */ |
---|
94 | #define NUM_FLAG 32768 /* Field is num (for clients) */ |
---|
95 | #define PART_KEY_FLAG 16384 /* Intern; Part of some key */ |
---|
96 | #define GROUP_FLAG 32768 /* Intern: Group field */ |
---|
97 | #define UNIQUE_FLAG 65536 /* Intern: Used by sql_yacc */ |
---|
98 | #define BINCMP_FLAG 131072 /* Intern: Used by sql_yacc */ |
---|
99 | |
---|
100 | #define REFRESH_GRANT 1 /* Refresh grant tables */ |
---|
101 | #define REFRESH_LOG 2 /* Start on new log file */ |
---|
102 | #define REFRESH_TABLES 4 /* close all tables */ |
---|
103 | #define REFRESH_HOSTS 8 /* Flush host cache */ |
---|
104 | #define REFRESH_STATUS 16 /* Flush status variables */ |
---|
105 | #define REFRESH_THREADS 32 /* Flush thread cache */ |
---|
106 | #define REFRESH_SLAVE 64 /* Reset master info and restart slave |
---|
107 | thread */ |
---|
108 | #define REFRESH_MASTER 128 /* Remove all bin logs in the index |
---|
109 | and truncate the index */ |
---|
110 | |
---|
111 | /* The following can't be set with mysql_refresh() */ |
---|
112 | #define REFRESH_READ_LOCK 16384 /* Lock tables for read */ |
---|
113 | #define REFRESH_FAST 32768 /* Intern flag */ |
---|
114 | |
---|
115 | /* RESET (remove all queries) from query cache */ |
---|
116 | #define REFRESH_QUERY_CACHE 65536 |
---|
117 | #define REFRESH_QUERY_CACHE_FREE 0x20000L /* pack query cache */ |
---|
118 | #define REFRESH_DES_KEY_FILE 0x40000L |
---|
119 | #define REFRESH_USER_RESOURCES 0x80000L |
---|
120 | |
---|
121 | #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */ |
---|
122 | #define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */ |
---|
123 | #define CLIENT_LONG_FLAG 4 /* Get all column flags */ |
---|
124 | #define CLIENT_CONNECT_WITH_DB 8 /* One can specify db on connect */ |
---|
125 | #define CLIENT_NO_SCHEMA 16 /* Don't allow database.table.column */ |
---|
126 | #define CLIENT_COMPRESS 32 /* Can use compression protocol */ |
---|
127 | #define CLIENT_ODBC 64 /* Odbc client */ |
---|
128 | #define CLIENT_LOCAL_FILES 128 /* Can use LOAD DATA LOCAL */ |
---|
129 | #define CLIENT_IGNORE_SPACE 256 /* Ignore spaces before '(' */ |
---|
130 | #define CLIENT_PROTOCOL_41 512 /* New 4.1 protocol */ |
---|
131 | #define CLIENT_INTERACTIVE 1024 /* This is an interactive client */ |
---|
132 | #define CLIENT_SSL 2048 /* Switch to SSL after handshake */ |
---|
133 | #define CLIENT_IGNORE_SIGPIPE 4096 /* IGNORE sigpipes */ |
---|
134 | #define CLIENT_TRANSACTIONS 8192 /* Client knows about transactions */ |
---|
135 | #define CLIENT_RESERVED 16384 /* Old flag for 4.1 protocol */ |
---|
136 | #define CLIENT_SECURE_CONNECTION 32768 /* New 4.1 authentication */ |
---|
137 | #define CLIENT_MULTI_STATEMENTS 65536 /* Enable/disable multi-stmt support */ |
---|
138 | #define CLIENT_MULTI_RESULTS 131072 /* Enable/disable multi-results */ |
---|
139 | #define CLIENT_REMEMBER_OPTIONS (((ulong) 1) << 31) |
---|
140 | |
---|
141 | #define SERVER_STATUS_IN_TRANS 1 /* Transaction has started */ |
---|
142 | #define SERVER_STATUS_AUTOCOMMIT 2 /* Server in auto_commit mode */ |
---|
143 | #define SERVER_STATUS_MORE_RESULTS 4 /* More results on server */ |
---|
144 | #define SERVER_MORE_RESULTS_EXISTS 8 /* Multi query - next query exists */ |
---|
145 | #define SERVER_QUERY_NO_GOOD_INDEX_USED 16 |
---|
146 | #define SERVER_QUERY_NO_INDEX_USED 32 |
---|
147 | /* |
---|
148 | The server was able to fulfill the clients request and opened a |
---|
149 | read-only non-scrollable cursor for a query. This flag comes |
---|
150 | in reply to COM_STMT_EXECUTE and COM_STMT_FETCH commands. |
---|
151 | */ |
---|
152 | #define SERVER_STATUS_CURSOR_EXISTS 64 |
---|
153 | /* |
---|
154 | This flag is sent when a read-only cursor is exhausted, in reply to |
---|
155 | COM_STMT_FETCH command. |
---|
156 | */ |
---|
157 | #define SERVER_STATUS_LAST_ROW_SENT 128 |
---|
158 | #define SERVER_STATUS_DB_DROPPED 256 /* A database was dropped */ |
---|
159 | #define SERVER_STATUS_NO_BACKSLASH_ESCAPES 512 |
---|
160 | |
---|
161 | #define MYSQL_ERRMSG_SIZE 512 |
---|
162 | #define NET_READ_TIMEOUT 30 /* Timeout on read */ |
---|
163 | #define NET_WRITE_TIMEOUT 60 /* Timeout on write */ |
---|
164 | #define NET_WAIT_TIMEOUT 8*60*60 /* Wait for new query */ |
---|
165 | |
---|
166 | #define ONLY_KILL_QUERY 1 |
---|
167 | |
---|
168 | struct st_vio; /* Only C */ |
---|
169 | typedef struct st_vio Vio; |
---|
170 | |
---|
171 | #define MAX_TINYINT_WIDTH 3 /* Max width for a TINY w.o. sign */ |
---|
172 | #define MAX_SMALLINT_WIDTH 5 /* Max width for a SHORT w.o. sign */ |
---|
173 | #define MAX_MEDIUMINT_WIDTH 8 /* Max width for a INT24 w.o. sign */ |
---|
174 | #define MAX_INT_WIDTH 10 /* Max width for a LONG w.o. sign */ |
---|
175 | #define MAX_BIGINT_WIDTH 20 /* Max width for a LONGLONG */ |
---|
176 | #define MAX_CHAR_WIDTH 255 /* Max length for a CHAR colum */ |
---|
177 | #define MAX_BLOB_WIDTH 8192 /* Default width for blob */ |
---|
178 | |
---|
179 | typedef struct st_net { |
---|
180 | #if !defined(CHECK_EMBEDDED_DIFFERENCES) || !defined(EMBEDDED_LIBRARY) |
---|
181 | Vio* vio; |
---|
182 | unsigned char *buff,*buff_end,*write_pos,*read_pos; |
---|
183 | my_socket fd; /* For Perl DBI/dbd */ |
---|
184 | unsigned long max_packet,max_packet_size; |
---|
185 | unsigned int pkt_nr,compress_pkt_nr; |
---|
186 | unsigned int write_timeout, read_timeout, retry_count; |
---|
187 | int fcntl; |
---|
188 | my_bool compress; |
---|
189 | /* |
---|
190 | The following variable is set if we are doing several queries in one |
---|
191 | command ( as in LOAD TABLE ... FROM MASTER ), |
---|
192 | and do not want to confuse the client with OK at the wrong time |
---|
193 | */ |
---|
194 | unsigned long remain_in_buf,length, buf_length, where_b; |
---|
195 | unsigned int *return_status; |
---|
196 | unsigned char reading_or_writing; |
---|
197 | char save_char; |
---|
198 | my_bool no_send_ok; /* For SPs and other things that do multiple stmts */ |
---|
199 | my_bool no_send_eof; /* For SPs' first version read-only cursors */ |
---|
200 | /* |
---|
201 | Set if OK packet is already sent, and we do not need to send error |
---|
202 | messages |
---|
203 | */ |
---|
204 | my_bool no_send_error; |
---|
205 | /* |
---|
206 | Pointer to query object in query cache, do not equal NULL (0) for |
---|
207 | queries in cache that have not stored its results yet |
---|
208 | */ |
---|
209 | #endif |
---|
210 | char last_error[MYSQL_ERRMSG_SIZE], sqlstate[SQLSTATE_LENGTH+1]; |
---|
211 | unsigned int last_errno; |
---|
212 | unsigned char error; |
---|
213 | gptr query_cache_query; |
---|
214 | my_bool report_error; /* We should report error (we have unreported error) */ |
---|
215 | my_bool return_errno; |
---|
216 | } NET; |
---|
217 | |
---|
218 | #define packet_error (~(unsigned long) 0) |
---|
219 | |
---|
220 | enum enum_field_types { MYSQL_TYPE_DECIMAL, MYSQL_TYPE_TINY, |
---|
221 | MYSQL_TYPE_SHORT, MYSQL_TYPE_LONG, |
---|
222 | MYSQL_TYPE_FLOAT, MYSQL_TYPE_DOUBLE, |
---|
223 | MYSQL_TYPE_NULL, MYSQL_TYPE_TIMESTAMP, |
---|
224 | MYSQL_TYPE_LONGLONG,MYSQL_TYPE_INT24, |
---|
225 | MYSQL_TYPE_DATE, MYSQL_TYPE_TIME, |
---|
226 | MYSQL_TYPE_DATETIME, MYSQL_TYPE_YEAR, |
---|
227 | MYSQL_TYPE_NEWDATE, MYSQL_TYPE_VARCHAR, |
---|
228 | MYSQL_TYPE_BIT, |
---|
229 | MYSQL_TYPE_NEWDECIMAL=246, |
---|
230 | MYSQL_TYPE_ENUM=247, |
---|
231 | MYSQL_TYPE_SET=248, |
---|
232 | MYSQL_TYPE_TINY_BLOB=249, |
---|
233 | MYSQL_TYPE_MEDIUM_BLOB=250, |
---|
234 | MYSQL_TYPE_LONG_BLOB=251, |
---|
235 | MYSQL_TYPE_BLOB=252, |
---|
236 | MYSQL_TYPE_VAR_STRING=253, |
---|
237 | MYSQL_TYPE_STRING=254, |
---|
238 | MYSQL_TYPE_GEOMETRY=255 |
---|
239 | |
---|
240 | }; |
---|
241 | |
---|
242 | /* For backward compatibility */ |
---|
243 | #define CLIENT_MULTI_QUERIES CLIENT_MULTI_STATEMENTS |
---|
244 | #define FIELD_TYPE_DECIMAL MYSQL_TYPE_DECIMAL |
---|
245 | #define FIELD_TYPE_NEWDECIMAL MYSQL_TYPE_NEWDECIMAL |
---|
246 | #define FIELD_TYPE_TINY MYSQL_TYPE_TINY |
---|
247 | #define FIELD_TYPE_SHORT MYSQL_TYPE_SHORT |
---|
248 | #define FIELD_TYPE_LONG MYSQL_TYPE_LONG |
---|
249 | #define FIELD_TYPE_FLOAT MYSQL_TYPE_FLOAT |
---|
250 | #define FIELD_TYPE_DOUBLE MYSQL_TYPE_DOUBLE |
---|
251 | #define FIELD_TYPE_NULL MYSQL_TYPE_NULL |
---|
252 | #define FIELD_TYPE_TIMESTAMP MYSQL_TYPE_TIMESTAMP |
---|
253 | #define FIELD_TYPE_LONGLONG MYSQL_TYPE_LONGLONG |
---|
254 | #define FIELD_TYPE_INT24 MYSQL_TYPE_INT24 |
---|
255 | #define FIELD_TYPE_DATE MYSQL_TYPE_DATE |
---|
256 | #define FIELD_TYPE_TIME MYSQL_TYPE_TIME |
---|
257 | #define FIELD_TYPE_DATETIME MYSQL_TYPE_DATETIME |
---|
258 | #define FIELD_TYPE_YEAR MYSQL_TYPE_YEAR |
---|
259 | #define FIELD_TYPE_NEWDATE MYSQL_TYPE_NEWDATE |
---|
260 | #define FIELD_TYPE_ENUM MYSQL_TYPE_ENUM |
---|
261 | #define FIELD_TYPE_SET MYSQL_TYPE_SET |
---|
262 | #define FIELD_TYPE_TINY_BLOB MYSQL_TYPE_TINY_BLOB |
---|
263 | #define FIELD_TYPE_MEDIUM_BLOB MYSQL_TYPE_MEDIUM_BLOB |
---|
264 | #define FIELD_TYPE_LONG_BLOB MYSQL_TYPE_LONG_BLOB |
---|
265 | #define FIELD_TYPE_BLOB MYSQL_TYPE_BLOB |
---|
266 | #define FIELD_TYPE_VAR_STRING MYSQL_TYPE_VAR_STRING |
---|
267 | #define FIELD_TYPE_STRING MYSQL_TYPE_STRING |
---|
268 | #define FIELD_TYPE_CHAR MYSQL_TYPE_TINY |
---|
269 | #define FIELD_TYPE_INTERVAL MYSQL_TYPE_ENUM |
---|
270 | #define FIELD_TYPE_GEOMETRY MYSQL_TYPE_GEOMETRY |
---|
271 | #define FIELD_TYPE_BIT MYSQL_TYPE_BIT |
---|
272 | |
---|
273 | |
---|
274 | /* Shutdown/kill enums and constants */ |
---|
275 | |
---|
276 | /* Bits for THD::killable. */ |
---|
277 | #define MYSQL_SHUTDOWN_KILLABLE_CONNECT (unsigned char)(1 << 0) |
---|
278 | #define MYSQL_SHUTDOWN_KILLABLE_TRANS (unsigned char)(1 << 1) |
---|
279 | #define MYSQL_SHUTDOWN_KILLABLE_LOCK_TABLE (unsigned char)(1 << 2) |
---|
280 | #define MYSQL_SHUTDOWN_KILLABLE_UPDATE (unsigned char)(1 << 3) |
---|
281 | |
---|
282 | enum mysql_enum_shutdown_level { |
---|
283 | /* |
---|
284 | We want levels to be in growing order of hardness (because we use number |
---|
285 | comparisons). Note that DEFAULT does not respect the growing property, but |
---|
286 | it's ok. |
---|
287 | */ |
---|
288 | SHUTDOWN_DEFAULT = 0, |
---|
289 | /* wait for existing connections to finish */ |
---|
290 | SHUTDOWN_WAIT_CONNECTIONS= MYSQL_SHUTDOWN_KILLABLE_CONNECT, |
---|
291 | /* wait for existing trans to finish */ |
---|
292 | SHUTDOWN_WAIT_TRANSACTIONS= MYSQL_SHUTDOWN_KILLABLE_TRANS, |
---|
293 | /* wait for existing updates to finish (=> no partial MyISAM update) */ |
---|
294 | SHUTDOWN_WAIT_UPDATES= MYSQL_SHUTDOWN_KILLABLE_UPDATE, |
---|
295 | /* flush InnoDB buffers and other storage engines' buffers*/ |
---|
296 | SHUTDOWN_WAIT_ALL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1), |
---|
297 | /* don't flush InnoDB buffers, flush other storage engines' buffers*/ |
---|
298 | SHUTDOWN_WAIT_CRITICAL_BUFFERS= (MYSQL_SHUTDOWN_KILLABLE_UPDATE << 1) + 1, |
---|
299 | /* Now the 2 levels of the KILL command */ |
---|
300 | #if MYSQL_VERSION_ID >= 50000 |
---|
301 | KILL_QUERY= 254, |
---|
302 | #endif |
---|
303 | KILL_CONNECTION= 255 |
---|
304 | }; |
---|
305 | |
---|
306 | |
---|
307 | enum enum_cursor_type |
---|
308 | { |
---|
309 | CURSOR_TYPE_NO_CURSOR= 0, |
---|
310 | CURSOR_TYPE_READ_ONLY= 1, |
---|
311 | CURSOR_TYPE_FOR_UPDATE= 2, |
---|
312 | CURSOR_TYPE_SCROLLABLE= 4 |
---|
313 | }; |
---|
314 | |
---|
315 | |
---|
316 | /* options for mysql_set_option */ |
---|
317 | enum enum_mysql_set_option |
---|
318 | { |
---|
319 | MYSQL_OPTION_MULTI_STATEMENTS_ON, |
---|
320 | MYSQL_OPTION_MULTI_STATEMENTS_OFF |
---|
321 | }; |
---|
322 | |
---|
323 | #define net_new_transaction(net) ((net)->pkt_nr=0) |
---|
324 | |
---|
325 | #ifdef __cplusplus |
---|
326 | extern "C" { |
---|
327 | #endif |
---|
328 | |
---|
329 | my_bool my_net_init(NET *net, Vio* vio); |
---|
330 | void my_net_local_init(NET *net); |
---|
331 | void net_end(NET *net); |
---|
332 | void net_clear(NET *net); |
---|
333 | my_bool net_realloc(NET *net, unsigned long length); |
---|
334 | my_bool net_flush(NET *net); |
---|
335 | my_bool my_net_write(NET *net,const char *packet,unsigned long len); |
---|
336 | my_bool net_write_command(NET *net,unsigned char command, |
---|
337 | const char *header, unsigned long head_len, |
---|
338 | const char *packet, unsigned long len); |
---|
339 | int net_real_write(NET *net,const char *packet,unsigned long len); |
---|
340 | unsigned long my_net_read(NET *net); |
---|
341 | |
---|
342 | /* |
---|
343 | The following function is not meant for normal usage |
---|
344 | Currently it's used internally by manager.c |
---|
345 | */ |
---|
346 | struct sockaddr; |
---|
347 | int my_connect(my_socket s, const struct sockaddr *name, unsigned int namelen, |
---|
348 | unsigned int timeout); |
---|
349 | |
---|
350 | struct rand_struct { |
---|
351 | unsigned long seed1,seed2,max_value; |
---|
352 | double max_value_dbl; |
---|
353 | }; |
---|
354 | |
---|
355 | #ifdef __cplusplus |
---|
356 | } |
---|
357 | #endif |
---|
358 | |
---|
359 | /* The following is for user defined functions */ |
---|
360 | |
---|
361 | enum Item_result {STRING_RESULT=0, REAL_RESULT, INT_RESULT, ROW_RESULT, |
---|
362 | DECIMAL_RESULT}; |
---|
363 | |
---|
364 | typedef struct st_udf_args |
---|
365 | { |
---|
366 | unsigned int arg_count; /* Number of arguments */ |
---|
367 | enum Item_result *arg_type; /* Pointer to item_results */ |
---|
368 | char **args; /* Pointer to argument */ |
---|
369 | unsigned long *lengths; /* Length of string arguments */ |
---|
370 | char *maybe_null; /* Set to 1 for all maybe_null args */ |
---|
371 | char **attributes; /* Pointer to attribute name */ |
---|
372 | unsigned long *attribute_lengths; /* Length of attribute arguments */ |
---|
373 | } UDF_ARGS; |
---|
374 | |
---|
375 | /* This holds information about the result */ |
---|
376 | |
---|
377 | typedef struct st_udf_init |
---|
378 | { |
---|
379 | my_bool maybe_null; /* 1 if function can return NULL */ |
---|
380 | unsigned int decimals; /* for real functions */ |
---|
381 | unsigned long max_length; /* For string functions */ |
---|
382 | char *ptr; /* free pointer for function data */ |
---|
383 | my_bool const_item; /* 0 if result is independent of arguments */ |
---|
384 | } UDF_INIT; |
---|
385 | |
---|
386 | /* Constants when using compression */ |
---|
387 | #define NET_HEADER_SIZE 4 /* standard header size */ |
---|
388 | #define COMP_HEADER_SIZE 3 /* compression header extra size */ |
---|
389 | |
---|
390 | /* Prototypes to password functions */ |
---|
391 | |
---|
392 | #ifdef __cplusplus |
---|
393 | extern "C" { |
---|
394 | #endif |
---|
395 | |
---|
396 | /* |
---|
397 | These functions are used for authentication by client and server and |
---|
398 | implemented in sql/password.c |
---|
399 | */ |
---|
400 | |
---|
401 | void randominit(struct rand_struct *, unsigned long seed1, |
---|
402 | unsigned long seed2); |
---|
403 | double my_rnd(struct rand_struct *); |
---|
404 | void create_random_string(char *to, unsigned int length, struct rand_struct *rand_st); |
---|
405 | |
---|
406 | void hash_password(unsigned long *to, const char *password, unsigned int password_len); |
---|
407 | void make_scrambled_password_323(char *to, const char *password); |
---|
408 | void scramble_323(char *to, const char *message, const char *password); |
---|
409 | my_bool check_scramble_323(const char *, const char *message, |
---|
410 | unsigned long *salt); |
---|
411 | void get_salt_from_password_323(unsigned long *res, const char *password); |
---|
412 | void make_password_from_salt_323(char *to, const unsigned long *salt); |
---|
413 | |
---|
414 | void make_scrambled_password(char *to, const char *password); |
---|
415 | void scramble(char *to, const char *message, const char *password); |
---|
416 | my_bool check_scramble(const char *reply, const char *message, |
---|
417 | const unsigned char *hash_stage2); |
---|
418 | void get_salt_from_password(unsigned char *res, const char *password); |
---|
419 | void make_password_from_salt(char *to, const unsigned char *hash_stage2); |
---|
420 | char *octet2hex(char *to, const char *str, unsigned int len); |
---|
421 | |
---|
422 | /* end of password.c */ |
---|
423 | |
---|
424 | char *get_tty_password(char *opt_message); |
---|
425 | const char *mysql_errno_to_sqlstate(unsigned int mysql_errno); |
---|
426 | |
---|
427 | /* Some other useful functions */ |
---|
428 | |
---|
429 | my_bool my_init(void); |
---|
430 | extern int modify_defaults_file(const char *file_location, const char *option, |
---|
431 | const char *option_value, |
---|
432 | const char *section_name, int remove_option); |
---|
433 | int load_defaults(const char *conf_file, const char **groups, |
---|
434 | int *argc, char ***argv); |
---|
435 | my_bool my_thread_init(void); |
---|
436 | void my_thread_end(void); |
---|
437 | |
---|
438 | #ifdef _global_h |
---|
439 | ulong STDCALL net_field_length(uchar **packet); |
---|
440 | my_ulonglong net_field_length_ll(uchar **packet); |
---|
441 | char *net_store_length(char *pkg, ulonglong length); |
---|
442 | #endif |
---|
443 | |
---|
444 | #ifdef __cplusplus |
---|
445 | } |
---|
446 | #endif |
---|
447 | |
---|
448 | #define NULL_LENGTH ((unsigned long) ~0) /* For net_store_length */ |
---|
449 | #define MYSQL_STMT_HEADER 4 |
---|
450 | #define MYSQL_LONG_DATA_HEADER 6 |
---|
451 | |
---|
452 | #endif |
---|