summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/config-win.h2
-rw-r--r--include/errmsg.h1
-rw-r--r--include/hash.h2
-rw-r--r--include/m_ctype.h27
-rw-r--r--include/m_string.h10
-rw-r--r--include/my_pthread.h2
-rw-r--r--include/my_sys.h19
-rw-r--r--include/myisam.h2
-rw-r--r--include/mysql.h51
-rw-r--r--include/mysql_com.h64
-rw-r--r--include/mysqld_error.h8
-rw-r--r--include/sql_common.h9
-rw-r--r--include/thr_alarm.h2
-rw-r--r--include/violite.h202
14 files changed, 208 insertions, 193 deletions
diff --git a/include/config-win.h b/include/config-win.h
index 6b40a0f2ed3..884b2edfb63 100644
--- a/include/config-win.h
+++ b/include/config-win.h
@@ -280,9 +280,9 @@ inline double ulonglong2double(ulonglong value)
#define HAVE_CREATESEMAPHORE
#define HAVE_ISNAN
#define HAVE_FINITE
-#define HAVE_ISAM /* We want to have support for ISAM in 4.0 */
#define HAVE_QUERY_CACHE
#define SPRINTF_RETURNS_INT
+#define HAVE_SETFILEPOINTER
#define HAVE_VIO
#ifdef NOT_USED
diff --git a/include/errmsg.h b/include/errmsg.h
index 1f4e6e12f00..a354c125e36 100644
--- a/include/errmsg.h
+++ b/include/errmsg.h
@@ -86,3 +86,4 @@ extern const char *client_errors[]; /* Error messages */
#define CR_SHARED_MEMORY_CONNECT_SET_ERROR 2045
#define CR_CONN_UNKNOW_PROTOCOL 2046
#define CR_INVALID_CONN_HANDLE 2047
+#define CR_MYSQL_SERVER_INIT_MISSED 2048
diff --git a/include/hash.h b/include/hash.h
index 6c805bc2da7..3c2ae32c70e 100644
--- a/include/hash.h
+++ b/include/hash.h
@@ -49,7 +49,7 @@ void hash_free(HASH *tree);
byte *hash_element(HASH *hash,uint idx);
gptr hash_search(HASH *info,const byte *key,uint length);
gptr hash_next(HASH *info,const byte *key,uint length);
-my_bool hash_insert(HASH *info,const byte *data);
+my_bool my_hash_insert(HASH *info,const byte *data);
my_bool hash_delete(HASH *hash,byte *record);
my_bool hash_update(HASH *hash,byte *record,byte *old_key,uint old_key_length);
void hash_replace(HASH *hash, uint idx, byte *new_row);
diff --git a/include/m_ctype.h b/include/m_ctype.h
index 4ae6734a48c..b1557e5293b 100644
--- a/include/m_ctype.h
+++ b/include/m_ctype.h
@@ -63,6 +63,7 @@ typedef struct unicase_info_st
#define MY_CS_STRNXFRM 64 /* if strnxfrm is used for sort */
#define MY_CS_UNICODE 128 /* is a charset is full unicode */
#define MY_CS_NONTEXT 256 /* if a charset is not sprintf() compatible */
+#define MY_CS_AVAILABLE 512 /* If either compiled-in or loaded*/
#define MY_CHARSET_UNDEFINED 0
@@ -74,6 +75,12 @@ typedef struct my_uni_idx_st
uchar *tab;
} MY_UNI_IDX;
+typedef struct
+{
+ uint beg;
+ uint end;
+ uint mblen;
+} my_match_t;
enum my_lex_states
{
@@ -115,12 +122,18 @@ typedef struct my_collation_handler_st
int (*strcasecmp)(struct charset_info_st *, const char *, const char *);
+ uint (*instr)(struct charset_info_st *,
+ const char *big, uint b_length,
+ const char *small, uint s_length,
+ my_match_t *match, uint nmatch);
+
/* Hash calculation */
void (*hash_sort)(struct charset_info_st *cs, const uchar *key, uint len,
ulong *nr1, ulong *nr2);
} MY_COLLATION_HANDLER;
-extern MY_COLLATION_HANDLER my_collation_bin_handler;
+extern MY_COLLATION_HANDLER my_collation_mb_bin_handler;
+extern MY_COLLATION_HANDLER my_collation_8bit_bin_handler;
extern MY_COLLATION_HANDLER my_collation_8bit_simple_ci_handler;
@@ -131,6 +144,7 @@ typedef struct my_charset_handler_st
int (*mbcharlen)(struct charset_info_st *, uint);
uint (*numchars)(struct charset_info_st *, const char *b, const char *e);
uint (*charpos)(struct charset_info_st *, const char *b, const char *e, uint pos);
+ uint (*lengthsp)(struct charset_info_st *, const char *ptr, uint length);
/* Unicode convertion */
int (*mb_wc)(struct charset_info_st *cs,my_wc_t *wc,
@@ -240,6 +254,13 @@ extern void my_hash_sort_simple(CHARSET_INFO *cs,
const uchar *key, uint len,
ulong *nr1, ulong *nr2);
+extern uint my_lengthsp_8bit(CHARSET_INFO *cs, const char *ptr, uint length);
+
+extern uint my_instr_simple(struct charset_info_st *,
+ const char *big, uint b_length,
+ const char *small, uint s_length,
+ my_match_t *match, uint nmatch);
+
/* Functions for 8bit */
extern void my_caseup_str_8bit(CHARSET_INFO *, char *);
@@ -304,6 +325,10 @@ int my_wildcmp_mb(CHARSET_INFO *,
int escape, int w_one, int w_many);
uint my_numchars_mb(CHARSET_INFO *, const char *b, const char *e);
uint my_charpos_mb(CHARSET_INFO *, const char *b, const char *e, uint pos);
+uint my_instr_mb(struct charset_info_st *,
+ const char *big, uint b_length,
+ const char *small, uint s_length,
+ my_match_t *match, uint nmatch);
extern my_bool my_parse_charset_xml(const char *bug, uint len,
diff --git a/include/m_string.h b/include/m_string.h
index 5863bb51b73..062d0b4cf65 100644
--- a/include/m_string.h
+++ b/include/m_string.h
@@ -122,6 +122,16 @@ extern void bmove_align(gptr dst,const gptr src,uint len);
#define bmove512(A,B,C) memcpy(A,B,C)
#endif
+#ifdef HAVE_purify
+#include <assert.h>
+#define memcpy_overlap(A,B,C) \
+DBUG_ASSERT((A) == (B) || ((A)+(C)) <= (B) || ((B)+(C)) <= (A)); \
+bmove((byte*) key,(byte*) from,(size_t) length);
+#else
+#define memcpy_overlap(A,B,C) memcpy((A), (B), (C))
+#endif /* HAVE_purify */
+
+
/* Prototypes for string functions */
#if !defined(bfill) && !defined(HAVE_BFILL)
diff --git a/include/my_pthread.h b/include/my_pthread.h
index d8374cad314..424452a9298 100644
--- a/include/my_pthread.h
+++ b/include/my_pthread.h
@@ -1,4 +1,3 @@
-
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
@@ -111,7 +110,6 @@ void pthread_exit(void *a); /* was #define pthread_exit(A) ExitThread(A)*/
#endif
#define pthread_self() win_pthread_self
#define HAVE_LOCALTIME_R 1
-#define HAVE_GMTIME_R 1
#define _REENTRANT 1
#define HAVE_PTHREAD_ATTR_SETSTACKSIZE 1
diff --git a/include/my_sys.h b/include/my_sys.h
index d80390fbbde..8047c5f3e47 100644
--- a/include/my_sys.h
+++ b/include/my_sys.h
@@ -207,11 +207,13 @@ extern CHARSET_INFO *default_charset_info;
extern CHARSET_INFO *all_charsets[256];
extern CHARSET_INFO compiled_charsets[];
-extern uint get_charset_number(const char *cs_name);
+extern uint get_charset_number(const char *cs_name, uint cs_flags);
+extern uint get_collation_number(const char *name);
extern const char *get_charset_name(uint cs_number);
+
extern CHARSET_INFO *get_charset(uint cs_number, myf flags);
extern CHARSET_INFO *get_charset_by_name(const char *cs_name, myf flags);
-extern CHARSET_INFO *get_charset_by_csname(const char *cs_name,
+extern CHARSET_INFO *get_charset_by_csname(const char *cs_name,
uint cs_flags, myf my_flags);
extern void free_charsets(void);
extern char *get_charsets_dir(char *buf);
@@ -500,6 +502,8 @@ my_off_t my_b_append_tell(IO_CACHE* info);
#define my_b_bytes_in_cache(info) (uint) (*(info)->current_end - \
*(info)->current_pos)
+typedef uint32 ha_checksum;
+
/* Pointer to a key cache data structure (see the key cache module) */
typedef struct st_key_cache* KEY_CACHE_HANDLE;
@@ -722,6 +726,8 @@ extern int _my_b_get(IO_CACHE *info);
extern int _my_b_async_read(IO_CACHE *info,byte *Buffer,uint Count);
extern int _my_b_write(IO_CACHE *info,const byte *Buffer,uint Count);
extern int my_b_append(IO_CACHE *info,const byte *Buffer,uint Count);
+extern int my_b_safe_write(IO_CACHE *info,const byte *Buffer,uint Count);
+
extern int my_block_write(IO_CACHE *info, const byte *Buffer,
uint Count, my_off_t pos);
extern int _flush_io_cache(IO_CACHE *info, int need_append_buffer_lock);
@@ -783,17 +789,18 @@ extern void set_prealloc_root(MEM_ROOT *root, char *ptr);
extern char *strdup_root(MEM_ROOT *root,const char *str);
extern char *strmake_root(MEM_ROOT *root,const char *str,uint len);
extern char *memdup_root(MEM_ROOT *root,const char *str,uint len);
-extern void load_defaults(const char *conf_file, const char **groups,
- int *argc, char ***argv);
+extern int load_defaults(const char *conf_file, const char **groups,
+ int *argc, char ***argv);
extern void free_defaults(char **argv);
extern void print_defaults(const char *conf_file, const char **groups);
extern my_bool my_compress(byte *, ulong *, ulong *);
extern my_bool my_uncompress(byte *, ulong *, ulong *);
extern byte *my_compress_alloc(const byte *packet, ulong *len, ulong *complen);
-extern ulong checksum(const byte *mem, uint count);
+extern ha_checksum my_checksum(ha_checksum crc, const byte *mem, uint count);
extern uint my_bit_log2(ulong value);
-uint my_count_bits(ulonglong v);
+extern uint my_count_bits(ulonglong v);
extern void my_sleep(ulong m_seconds);
+extern ulong crc32(ulong crc, const uchar *buf, uint len);
#ifdef __WIN__
extern my_bool have_tcpip; /* Is set if tcpip is used */
diff --git a/include/myisam.h b/include/myisam.h
index 5be64d2212f..bf28168b7d7 100644
--- a/include/myisam.h
+++ b/include/myisam.h
@@ -53,8 +53,6 @@ extern "C" {
#define mi_portable_sizeof_char_ptr 8
-typedef uint32 ha_checksum;
-
/* Param to/from mi_info */
typedef struct st_mi_isaminfo /* Struct from h_info */
diff --git a/include/mysql.h b/include/mysql.h
index 8e8ffc2b788..95f480b41c1 100644
--- a/include/mysql.h
+++ b/include/mysql.h
@@ -142,7 +142,7 @@ enum mysql_option
MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME, MYSQL_OPT_READ_TIMEOUT,
MYSQL_OPT_WRITE_TIMEOUT, MYSQL_OPT_USE_RESULT,
MYSQL_OPT_USE_REMOTE_CONNECTION, MYSQL_OPT_USE_EMBEDDED_CONNECTION,
- MYSQL_OPT_GUESS_CONNECTION
+ MYSQL_OPT_GUESS_CONNECTION, MYSQL_SET_CLIENT_IP
};
struct st_mysql_options {
@@ -180,6 +180,7 @@ struct st_mysql_options {
my_bool separate_thread;
#endif
enum mysql_option methods_to_use;
+ char *client_ip;
};
enum mysql_status
@@ -229,7 +230,9 @@ typedef struct st_mysql
enum mysql_status status;
my_bool free_me; /* If free in mysql_close */
my_bool reconnect; /* set to 1 if automatic reconnect */
- char scramble_buff[21]; /* New protocol requires longer scramble*/
+
+ /* session-wide random string */
+ char scramble[SCRAMBLE_LENGTH+1];
/*
Set if this is the original connection, not a master or a slave we have
@@ -248,7 +251,6 @@ typedef struct st_mysql
LIST *stmts; /* list of all statements */
const struct st_mysql_methods *methods;
- struct st_mysql_res *result;
void *thd;
} MYSQL;
@@ -357,6 +359,9 @@ int STDCALL mysql_send_query(MYSQL *mysql, const char *q,
unsigned long length);
int STDCALL mysql_real_query(MYSQL *mysql, const char *q,
unsigned long length);
+MYSQL_RES * STDCALL mysql_store_result(MYSQL *mysql);
+MYSQL_RES * STDCALL mysql_use_result(MYSQL *mysql);
+
/* perform query on master */
my_bool STDCALL mysql_master_query(MYSQL *mysql, const char *q,
unsigned long length);
@@ -412,8 +417,6 @@ const char * STDCALL mysql_get_host_info(MYSQL *mysql);
unsigned int STDCALL mysql_get_proto_info(MYSQL *mysql);
MYSQL_RES * STDCALL mysql_list_dbs(MYSQL *mysql,const char *wild);
MYSQL_RES * STDCALL mysql_list_tables(MYSQL *mysql,const char *wild);
-MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
- const char *wild);
MYSQL_RES * STDCALL mysql_list_processes(MYSQL *mysql);
int STDCALL mysql_options(MYSQL *mysql,enum mysql_option option,
const char *arg);
@@ -427,6 +430,8 @@ MYSQL_FIELD_OFFSET STDCALL mysql_field_seek(MYSQL_RES *result,
MYSQL_ROW STDCALL mysql_fetch_row(MYSQL_RES *result);
unsigned long * STDCALL mysql_fetch_lengths(MYSQL_RES *result);
MYSQL_FIELD * STDCALL mysql_fetch_field(MYSQL_RES *result);
+MYSQL_RES * STDCALL mysql_list_fields(MYSQL *mysql, const char *table,
+ const char *wild);
unsigned long STDCALL mysql_escape_string(char *to,const char *from,
unsigned long from_length);
unsigned long STDCALL mysql_real_escape_string(MYSQL *mysql,
@@ -457,6 +462,7 @@ int STDCALL mysql_manager_command(MYSQL_MANAGER* con,
int STDCALL mysql_manager_fetch_line(MYSQL_MANAGER* con,
char* res_buf,
int res_buf_size);
+my_bool STDCALL mysql_read_query_result(MYSQL *mysql);
/*
@@ -497,10 +503,12 @@ typedef struct st_mysql_bind
/* Following are for internal use. Set by mysql_bind_param */
unsigned char *inter_buffer; /* for the current data position */
unsigned long offset; /* offset position for char/binary fetch */
+ unsigned long internal_length; /* Used if length is 0 */
unsigned int param_number; /* For null count and error messages */
my_bool long_data_used; /* If used with mysql_send_long_data */
my_bool binary_data; /* data buffer is binary */
my_bool null_field; /* NULL data cache flag */
+ my_bool internal_is_null; /* Used if is_null is 0 */
void (*store_param_func)(NET *net, struct st_mysql_bind *param);
void (*fetch_result)(struct st_mysql_bind *, unsigned char **row);
} MYSQL_BIND;
@@ -535,22 +543,29 @@ typedef struct st_mysql_stmt
} MYSQL_STMT;
-#define mysql_read_query_result(mysql) (*(mysql)->methods->read_query_result)(mysql)
-#define mysql_store_result(mysql) (*(mysql)->methods->store_result)(mysql)
-#define mysql_use_result(mysql) (*(mysql)->methods->use_result)(mysql)
-
typedef struct st_mysql_methods
{
- my_bool STDCALL (*read_query_result)(MYSQL *mysql);
- my_bool STDCALL (*advanced_command)(MYSQL *mysql,
+ my_bool (STDCALL *read_query_result)(MYSQL *mysql);
+ my_bool (STDCALL *advanced_command)(MYSQL *mysql,
enum enum_server_command command,
const char *header,
unsigned long header_length,
const char *arg,
- unsigned long arg_length, my_bool skip_check);
- MYSQL_RES * STDCALL (*store_result)(MYSQL *mysql);
- MYSQL_RES * STDCALL (*use_result)(MYSQL *mysql);
- void STDCALL (*fetch_lengths)(unsigned long *to, MYSQL_ROW column, uint field_count);
+ unsigned long arg_length,
+ my_bool skip_check);
+ MYSQL_DATA *(STDCALL *read_rows)(MYSQL *mysql,MYSQL_FIELD *mysql_fields,
+ unsigned int fields);
+ MYSQL_RES * (STDCALL *use_result)(MYSQL *mysql);
+ void (STDCALL *fetch_lengths)(unsigned long *to,
+ MYSQL_ROW column, unsigned int field_count);
+#if !defined(MYSQL_SERVER) || defined(EMBEDDED_LIBRARY)
+ MYSQL_FIELD * (STDCALL *list_fields)(MYSQL *mysql);
+ my_bool (STDCALL *read_prepare_result)(MYSQL *mysql, MYSQL_STMT *stmt);
+ int (STDCALL *stmt_execute)(MYSQL_STMT *stmt);
+ MYSQL_DATA *(STDCALL *read_binary_rows)(MYSQL_STMT *stmt);
+ int (STDCALL *unbuffered_fetch)(MYSQL *mysql, char **row);
+ void (STDCALL *free_embedded_thd)(MYSQL *mysql);
+#endif
} MYSQL_METHODS;
MYSQL_STMT * STDCALL mysql_prepare(MYSQL * mysql, const char *query,
@@ -570,13 +585,13 @@ my_bool STDCALL mysql_rollback(MYSQL * mysql);
my_bool STDCALL mysql_autocommit(MYSQL * mysql, my_bool auto_mode);
int STDCALL mysql_fetch(MYSQL_STMT *stmt);
int STDCALL mysql_fetch_column(MYSQL_STMT *stmt, MYSQL_BIND *bind,
- my_ulonglong column,
+ unsigned int column,
unsigned long offset);
my_bool STDCALL mysql_send_long_data(MYSQL_STMT *stmt,
unsigned int param_number,
const char *data,
unsigned long length);
-MYSQL_RES *STDCALL mysql_prepare_result(MYSQL_STMT *stmt);
+MYSQL_RES *STDCALL mysql_get_metadata(MYSQL_STMT *stmt);
MYSQL_RES *STDCALL mysql_param_result(MYSQL_STMT *stmt);
my_ulonglong STDCALL mysql_stmt_affected_rows(MYSQL_STMT *stmt);
int STDCALL mysql_stmt_store_result(MYSQL_STMT *stmt);
@@ -615,6 +630,8 @@ int STDCALL mysql_drop_db(MYSQL *mysql, const char *DB);
unsigned long net_safe_read(MYSQL* mysql);
void mysql_once_init(void);
+extern my_bool server_inited;
+
#ifdef __NETWARE__
#pragma pack(pop) /* restore alignment */
#endif
diff --git a/include/mysql_com.h b/include/mysql_com.h
index b1c94e5c735..d5a70e4dfe8 100644
--- a/include/mysql_com.h
+++ b/include/mysql_com.h
@@ -49,8 +49,15 @@ enum enum_server_command
};
-#define SCRAMBLE_LENGTH 8
-#define SCRAMBLE41_LENGTH 20
+/*
+ Length of random string sent by server on handshake; this is also length of
+ obfuscated password, recieved from client
+*/
+#define SCRAMBLE_LENGTH 20
+#define SCRAMBLE_LENGTH_323 8
+/* length of password stored in the db: new passwords are preceeded with '*' */
+#define SCRAMBLED_PASSWORD_CHAR_LENGTH (SCRAMBLE_LENGTH*2+1)
+#define SCRAMBLED_PASSWORD_CHAR_LENGTH_323 (SCRAMBLE_LENGTH_323*2)
#define NOT_NULL_FLAG 1 /* Field can't be NULL */
@@ -302,38 +309,41 @@ extern "C" {
extern unsigned long max_allowed_packet;
extern unsigned long net_buffer_length;
-void randominit(struct rand_struct *,unsigned long seed1,
- unsigned long seed2);
+/*
+ These functions are used for authentication by client and server and
+ implemented in sql/password.c
+*/
+
+void randominit(struct rand_struct *, unsigned long seed1,
+ unsigned long seed2);
double my_rnd(struct rand_struct *);
-void make_scrambled_password(char *to,const char *password,
- my_bool force_old_scramble,struct rand_struct *rand_st);
-int get_password_length(my_bool force_old_scramble);
-char get_password_version(const char* password);
-void create_random_string(int length,struct rand_struct *rand_st,char* target);
-my_bool validate_password(const char* password, const char* message,
- unsigned long* salt);
-void password_hash_stage1(char *to, const char *password);
-void password_hash_stage2(char *to,const char *salt);
-void password_crypt(const char* from,char* to, const char* password,int length);
-void get_hash_and_password(unsigned long* salt, unsigned char pversion,char* hash,
- unsigned char* bin_password);
-void get_salt_from_password(unsigned long *res,const char *password);
-void create_key_from_old_password(const char* password,char* key);
-void make_password_from_salt(char *to, unsigned long *hash_res,
- unsigned char password_version);
-char *scramble(char *to,const char *message,const char *password,
- my_bool old_ver);
-my_bool check_scramble(const char *, const char *message,
- unsigned long *salt,my_bool old_ver);
+void create_random_string(char *to, uint length, struct rand_struct *rand_st);
+
+void hash_password(unsigned long *to, const char *password, uint password_len);
+void make_scrambled_password_323(char *to, const char *password);
+void scramble_323(char *to, const char *message, const char *password);
+my_bool check_scramble_323(const char *, const char *message,
+ unsigned long *salt);
+void get_salt_from_password_323(unsigned long *res, const char *password);
+void make_password_from_salt_323(char *to, const unsigned long *salt);
+
+void make_scrambled_password(char *to, const char *password);
+void scramble(char *to, const char *message, const char *password);
+my_bool check_scramble(const char *reply, const char *message,
+ const unsigned char *hash_stage2);
+void get_salt_from_password(unsigned char *res, const char *password);
+void make_password_from_salt(char *to, const unsigned char *hash_stage2);
+
+/* end of password.c */
+
char *get_tty_password(char *opt_message);
-void hash_password(unsigned long *result, const char *password);
const char *mysql_errno_to_sqlstate(unsigned int mysql_errno);
/* Some other useful functions */
void my_init(void);
-void load_defaults(const char *conf_file, const char **groups,
- int *argc, char ***argv);
+int load_defaults(const char *conf_file, const char **groups,
+ int *argc, char ***argv);
my_bool my_thread_init(void);
void my_thread_end(void);
diff --git a/include/mysqld_error.h b/include/mysqld_error.h
index d2240b7a28e..7646d3e7494 100644
--- a/include/mysqld_error.h
+++ b/include/mysqld_error.h
@@ -289,4 +289,10 @@
#define ER_CANT_AGGREGATE_NCOLLATIONS 1270
#define ER_VARIABLE_IS_NOT_STRUCT 1271
#define ER_UNKNOWN_COLLATION 1272
-#define ER_ERROR_MESSAGES 273
+#define ER_SLAVE_IGNORED_SSL_PARAMS 1273
+#define ER_SERVER_IS_IN_SECURE_AUTH_MODE 1274
+#define ER_WARN_FIELD_RESOLVED 1275
+#define ER_BAD_SLAVE_UNTIL_COND 1276
+#define ER_MISSING_SKIP_SLAVE 1277
+#define ER_UNTIL_COND_IGNORED 1278
+#define ER_ERROR_MESSAGES 279
diff --git a/include/sql_common.h b/include/sql_common.h
index 9fea46be298..1f442339c4f 100644
--- a/include/sql_common.h
+++ b/include/sql_common.h
@@ -28,14 +28,19 @@ my_ulonglong net_field_length_ll(uchar **packet);
MYSQL_FIELD *unpack_fields(MYSQL_DATA *data,MEM_ROOT *alloc,uint fields,
my_bool default_value, uint server_capabilities);
void free_rows(MYSQL_DATA *cur);
-MYSQL_DATA *read_rows (MYSQL *mysql,MYSQL_FIELD *fields,
- uint field_count);
my_bool mysql_autenticate(MYSQL *mysql, const char *passwd);
void free_old_query(MYSQL *mysql);
void end_server(MYSQL *mysql);
my_bool mysql_reconnect(MYSQL *mysql);
void mysql_read_default_options(struct st_mysql_options *options,
const char *filename,const char *group);
+my_bool STDCALL
+cli_advanced_command(MYSQL *mysql, enum enum_server_command command,
+ const char *header, ulong header_length,
+ const char *arg, ulong arg_length, my_bool skip_check);
+
+void set_stmt_errmsg(MYSQL_STMT * stmt, const char *err, int errcode,
+ const char *sqlstate);
#ifdef __cplusplus
}
#endif
diff --git a/include/thr_alarm.h b/include/thr_alarm.h
index 439f046252f..8ff4472f700 100644
--- a/include/thr_alarm.h
+++ b/include/thr_alarm.h
@@ -100,7 +100,7 @@ typedef struct st_alarm {
#define thr_alarm_init(A) (*(A))=0
#define thr_alarm_in_use(A) (*(A)!= 0)
void init_thr_alarm(uint max_alarm);
-bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff);
+my_bool thr_alarm(thr_alarm_t *alarmed, uint sec, ALARM *buff);
void thr_alarm_kill(pthread_t thread_id);
void thr_end_alarm(thr_alarm_t *alarmed);
void end_thr_alarm(my_bool free_structures);
diff --git a/include/violite.h b/include/violite.h
index 9205f5b799a..37c5abbbe67 100644
--- a/include/violite.h
+++ b/include/violite.h
@@ -37,18 +37,24 @@ enum enum_vio_type
VIO_TYPE_SSL, VIO_TYPE_SHARED_MEMORY
};
-#ifndef __WIN__
-#define HANDLE void *
-#endif
-
Vio* vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost);
#ifdef __WIN__
Vio* vio_new_win32pipe(HANDLE hPipe);
-Vio* vio_new_win32shared_memory(NET *net,HANDLE handle_file_map, HANDLE handle_map,
- HANDLE event_server_wrote, HANDLE event_server_read,
- HANDLE event_client_wrote, HANDLE event_client_read);
-#endif
+Vio* vio_new_win32shared_memory(NET *net,HANDLE handle_file_map,
+ HANDLE handle_map,
+ HANDLE event_server_wrote,
+ HANDLE event_server_read,
+ HANDLE event_client_wrote,
+ HANDLE event_client_read);
+int vio_read_pipe(Vio *vio, gptr buf, int size);
+int vio_write_pipe(Vio *vio, const gptr buf, int size);
+int vio_close_pipe(Vio * vio);
+#else
+#define HANDLE void *
+#endif /* __WIN__ */
+
void vio_delete(Vio* vio);
+int vio_close(Vio* vio);
#ifdef EMBEDDED_LIBRARY
void vio_reset(Vio *vio);
@@ -57,71 +63,73 @@ void vio_reset(Vio* vio, enum enum_vio_type type,
my_socket sd, HANDLE hPipe, my_bool localhost);
#endif
-/*
- * vio_read and vio_write should have the same semantics
- * as read(2) and write(2).
- */
int vio_read(Vio *vio, gptr buf, int size);
int vio_write(Vio *vio, const gptr buf, int size);
-/*
- * Whenever the socket is set to blocking mode or not.
- */
int vio_blocking(Vio *vio, my_bool onoff, my_bool *old_mode);
my_bool vio_is_blocking(Vio *vio);
-/*
- * setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible.
- */
+/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible */
int vio_fastsend(Vio *vio);
-/*
- * setsockopt SO_KEEPALIVE at SOL_SOCKET level, when possible.
- */
+/* setsockopt SO_KEEPALIVE at SOL_SOCKET level, when possible */
int vio_keepalive(Vio *vio, my_bool onoff);
-/*
- * Whenever we should retry the last read/write operation.
- */
+/* Whenever we should retry the last read/write operation. */
my_bool vio_should_retry(Vio *vio);
-/*
- * When the workday is over...
- */
-int vio_close(Vio* vio);
-/*
- * Short text description of the socket for those, who are curious..
- */
+/* Short text description of the socket for those, who are curious.. */
const char* vio_description(Vio *vio);
-
/* Return the type of the connection */
enum enum_vio_type vio_type(Vio* vio);
-
/* Return last error number */
-int vio_errno(Vio*vio);
-
+int vio_errno(Vio*vio);
/* Get socket number */
my_socket vio_fd(Vio*vio);
+/* Remote peer's address and name in text form */
+my_bool vio_peer_addr(Vio* vio, char *buf, uint16 *port);
+/* Remotes in_addr */
+void vio_in_addr(Vio *vio, struct in_addr *in);
+my_bool vio_poll_read(Vio *vio,uint timeout);
+void vio_timeout(Vio *vio,uint timeout);
-/*
- * Remote peer's address and name in text form.
- */
-my_bool vio_peer_addr(Vio* vio, char *buf, uint16 *port);
+#ifdef HAVE_OPENSSL
+#define HEADER_DES_LOCL_H dummy_something
+#include <openssl/ssl.h>
+#include <openssl/err.h>
-/* Remotes in_addr */
+struct st_VioSSLAcceptorFd
+{
+ SSL_CTX *ssl_context;
+ SSL_METHOD *ssl_method;
+ struct st_VioSSLAcceptorFd *session_id_context;
+};
-void vio_in_addr(Vio *vio, struct in_addr *in);
+/* One copy for client */
+struct st_VioSSLConnectorFd
+{
+ SSL_CTX *ssl_context;
+ /* function pointers which are only once for SSL client */
+ SSL_METHOD *ssl_method;
+};
-my_bool vio_poll_read(Vio *vio,uint timeout);
+int sslaccept(struct st_VioSSLAcceptorFd*, Vio *, long timeout);
+int sslconnect(struct st_VioSSLConnectorFd*, Vio *, long timeout);
-#ifdef __cplusplus
-}
-#endif
+struct st_VioSSLConnectorFd
+*new_VioSSLConnectorFd(const char *key_file, const char *cert_file,
+ const char *ca_file, const char *ca_path,
+ const char *cipher);
+struct st_VioSSLAcceptorFd
+*new_VioSSLAcceptorFd(const char *key_file, const char *cert_file,
+ const char *ca_file,const char *ca_path,
+ const char *cipher);
+Vio *new_VioSSL(struct st_VioSSLAcceptorFd *fd, Vio *sd, int state);
+#endif /* HAVE_OPENSSL */
#ifdef HAVE_SMEM
int vio_read_shared_memory(Vio *vio, gptr buf, int size);
int vio_write_shared_memory(Vio *vio, const gptr buf, int size);
int vio_close_shared_memory(Vio * vio);
#endif
-#ifdef __WIN__
-int vio_read_pipe(Vio *vio, gptr buf, int size);
-int vio_write_pipe(Vio *vio, const gptr buf, int size);
-int vio_close_pipe(Vio * vio);
+
+#ifdef __cplusplus
+}
#endif
#if defined(HAVE_VIO) && !defined(DONT_MAP_VIO)
@@ -138,77 +146,9 @@ int vio_close_pipe(Vio * vio);
#define vio_close(vio) ((vio)->vioclose)(vio)
#define vio_peer_addr(vio, buf, prt) (vio)->peer_addr(vio, buf, prt)
#define vio_in_addr(vio, in) (vio)->in_addr(vio, in)
+#define vio_timeout(vio, seconds) (vio)->timeout(vio, seconds)
#endif /* defined(HAVE_VIO) && !defined(DONT_MAP_VIO) */
-#ifdef HAVE_OPENSSL
-#define HEADER_DES_LOCL_H dummy_something
-#include <openssl/ssl.h>
-#include <openssl/err.h>
-#include "my_net.h" /* needed because of struct in_addr */
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-void vio_ssl_delete(Vio* vio);
-
-int vio_ssl_read(Vio* vio,gptr buf, int size);
-int vio_ssl_write(Vio* vio,const gptr buf,int size);
-
-/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible. */
- int vio_ssl_fastsend(Vio* vio);
-/* setsockopt SO_KEEPALIVE at SOL_SOCKET level, when possible. */
-int vio_ssl_keepalive(Vio* vio, my_bool onoff);
-/* Whenever we should retry the last read/write operation. */
-my_bool vio_ssl_should_retry(Vio* vio);
-/* When the workday is over... */
-int vio_ssl_close(Vio* vio);
-/* Return last error number */
-int vio_ssl_errno(Vio *vio);
-my_bool vio_ssl_peer_addr(Vio* vio, char *buf, uint16 *port);
-void vio_ssl_in_addr(Vio *vio, struct in_addr *in);
-int vio_ssl_blocking(Vio * vio, my_bool set_blocking_mode, my_bool *old_mode);
-
-/* Single copy for server */
-enum vio_ssl_acceptorfd_state
-{
- state_connect = 1,
- state_accept = 2
-};
-
-struct st_VioSSLAcceptorFd
-{
- SSL_CTX* ssl_context_;
- SSL_METHOD* ssl_method_;
- struct st_VioSSLAcceptorFd* session_id_context_;
-};
-
-/* One copy for client */
-struct st_VioSSLConnectorFd
-{
- SSL_CTX* ssl_context_;
- /* function pointers which are only once for SSL client */
- SSL_METHOD* ssl_method_;
-};
-
-int sslaccept(struct st_VioSSLAcceptorFd*, Vio*, long timeout);
-int sslconnect(struct st_VioSSLConnectorFd*, Vio*, long timeout);
-
-struct st_VioSSLConnectorFd
-*new_VioSSLConnectorFd(const char* key_file, const char* cert_file,
- const char* ca_file, const char* ca_path,
- const char* cipher);
-struct st_VioSSLAcceptorFd
-*new_VioSSLAcceptorFd(const char* key_file, const char* cert_file,
- const char* ca_file,const char* ca_path,
- const char* cipher);
-Vio* new_VioSSL(struct st_VioSSLAcceptorFd* fd, Vio* sd,int state);
-
-#ifdef __cplusplus
-}
-#endif
-#endif /* HAVE_OPENSSL */
-
/* This enumerator is used in parser - should be always visible */
enum SSL_type
{
@@ -237,7 +177,7 @@ struct st_vio
void (*viodelete)(Vio*);
int (*vioerrno)(Vio*);
int (*read)(Vio*, gptr, int);
- int (*write)(Vio*, const gptr, int);
+ int (*write)(Vio*, gptr, int);
int (*vioblocking)(Vio*, my_bool, my_bool *);
my_bool (*is_blocking)(Vio*);
int (*viokeepalive)(Vio*, my_bool);
@@ -246,20 +186,18 @@ struct st_vio
void (*in_addr)(Vio*, struct in_addr*);
my_bool (*should_retry)(Vio*);
int (*vioclose)(Vio*);
-
-#ifdef HAVE_OPENSSL
- SSL* ssl_;
-#endif /* HAVE_OPENSSL */
+ void (*timeout)(Vio*, unsigned int timeout);
+ void *ssl_arg;
#ifdef HAVE_SMEM
- HANDLE handle_file_map;
- char *handle_map;
- HANDLE event_server_wrote;
- HANDLE event_server_read;
- HANDLE event_client_wrote;
- HANDLE event_client_read;
- long shared_memory_remain;
- char *shared_memory_pos;
- NET *net;
+ HANDLE handle_file_map;
+ char *handle_map;
+ HANDLE event_server_wrote;
+ HANDLE event_server_read;
+ HANDLE event_client_wrote;
+ HANDLE event_client_read;
+ long shared_memory_remain;
+ char *shared_memory_pos;
+ NET *net;
#endif /* HAVE_SMEM */
#endif /* HAVE_VIO */
};