diff options
author | unknown <wax@mysql.com> | 2002-11-15 00:16:30 +0500 |
---|---|---|
committer | unknown <wax@mysql.com> | 2002-11-15 00:16:30 +0500 |
commit | 64dd949c419898111c673eed4efadf32acd3e435 (patch) | |
tree | f80131afae1725b283113608c4f38e9e43ace61b /include | |
parent | ccf7226c2759bf6549c2cdd615ef55e95318520b (diff) | |
download | mariadb-git-64dd949c419898111c673eed4efadf32acd3e435.tar.gz |
Add shared memory protocol and option --protocol
client/client_priv.h:
Add OPT_MYSQL_PROTOCOL and OPT_SHARED_MEMORY_BASE_NAME
include/config-win.h:
Add shared memory protocol
include/errmsg.h:
Add error codes of shared memory protocol
include/my_sys.h:
Delete TYPELIB, moved to typelib.h
include/mysql.h:
Add shared memory protocol
include/violite.h:
Add shared memory protocol
libmysql/errmsg.c:
Add texts of errors of shared memory protocol
sql/mysqld.cc:
Add shared memory protocol and option --shared-memory, correct option --named-pipe
sql/set_var.cc:
Add shared memory protocol variables
vio/vio.c:
Add shared memory protocol
vio/viosocket.c:
Add shared memory protocol
BitKeeper/etc/logging_ok:
Logging to logging@openlogging.org accepted
Diffstat (limited to 'include')
-rw-r--r-- | include/config-win.h | 5 | ||||
-rw-r--r-- | include/errmsg.h | 12 | ||||
-rw-r--r-- | include/my_sys.h | 11 | ||||
-rw-r--r-- | include/mysql.h | 31 | ||||
-rw-r--r-- | include/typelib.h | 33 | ||||
-rw-r--r-- | include/violite.h | 27 |
6 files changed, 100 insertions, 19 deletions
diff --git a/include/config-win.h b/include/config-win.h index 5bdede86a9e..9c1c1ae4830 100644 --- a/include/config-win.h +++ b/include/config-win.h @@ -23,6 +23,8 @@ #include <io.h> #include <malloc.h> +#define HAVE_SMEM 1 + #if defined(__NT__) #define SYSTEM_TYPE "NT" #elif defined(__WIN2000__) @@ -311,3 +313,6 @@ inline double ulonglong2double(ulonglong value) #define statistic_add(V,C,L) (V)+=(C) #endif #define statistic_increment(V,L) thread_safe_increment((V),(L)) + +#define shared_memory_buffer_length 16000 +#define default_shared_memory_base_name "MYSQL"; diff --git a/include/errmsg.h b/include/errmsg.h index d97522f0972..5ac5ef9a4a7 100644 --- a/include/errmsg.h +++ b/include/errmsg.h @@ -72,3 +72,15 @@ extern const char *client_errors[]; /* Error messages */ #define CR_INVALID_PARAMETER_NO 2032 #define CR_INVALID_BUFFER_USE 2033 #define CR_UNSUPPORTED_PARAM_TYPE 2034 + +#define CR_SHARED_MEMORY_CONNECTION 2035 +#define CR_SHARED_MEMORY_CONNECT_REQUEST_ERROR 2036 +#define CR_SHARED_MEMORY_CONNECT_ANSWER_ERROR 2037 +#define CR_SHARED_MEMORY_CONNECT_FILE_MAP_ERROR 2038 +#define CR_SHARED_MEMORY_CONNECT_MAP_ERROR 2039 +#define CR_SHARED_MEMORY_FILE_MAP_ERROR 2040 +#define CR_SHARED_MEMORY_MAP_ERROR 2041 +#define CR_SHARED_MEMORY_EVENT_ERROR 2042 +#define CR_SHARED_MEMORY_CONNECT_ABANDODED_ERROR 2043 +#define CR_SHARED_MEMORY_CONNECT_SET_ERROR 2046 +#define CR_CONN_UNKNOW_PROTOCOL 2048 diff --git a/include/my_sys.h b/include/my_sys.h index f1b4841adb3..ab5dedc0ba1 100644 --- a/include/my_sys.h +++ b/include/my_sys.h @@ -37,6 +37,7 @@ extern int NEAR my_errno; /* Last error in mysys */ #endif #include <stdarg.h> +#include <typelib.h> #define MYSYS_PROGRAM_USES_CURSES() { error_handler_hook = my_message_curses; mysys_uses_curses=1; } #define MYSYS_PROGRAM_DONT_USE_CURSES() { error_handler_hook = my_message_no_curses; mysys_uses_curses=0;} @@ -247,12 +248,6 @@ typedef struct wild_file_pack /* Struct to hold info when selecting files */ my_string *wild; /* Pointer to wildcards */ } WF_PACK; -typedef struct st_typelib { /* Different types saved here */ - uint count; /* How many types */ - const char *name; /* Name of typelib */ - const char **type_names; -} TYPELIB; - enum cache_type { READ_CACHE,WRITE_CACHE, @@ -558,6 +553,7 @@ extern char *_my_strdup_with_length(const byte *from, uint length, const char *sFile, uint uLine, myf MyFlag); + #ifndef TERMINATE extern void TERMINATE(FILE *file); #endif @@ -706,9 +702,6 @@ extern void freeze_size(DYNAMIC_ARRAY *array); #define dynamic_element(array,array_index,type) ((type)((array)->buffer) +(array_index)) #define push_dynamic(A,B) insert_dynamic(A,B) -extern int find_type(my_string x,TYPELIB *typelib,uint full_name); -extern void make_type(my_string to,uint nr,TYPELIB *typelib); -extern const char *get_type(TYPELIB *typelib,uint nr); extern my_bool init_dynamic_string(DYNAMIC_STRING *str, const char *init_str, uint init_alloc,uint alloc_increment); extern my_bool dynstr_append(DYNAMIC_STRING *str, const char *append); diff --git a/include/mysql.h b/include/mysql.h index 710f5006724..ad369988084 100644 --- a/include/mysql.h +++ b/include/mysql.h @@ -56,6 +56,7 @@ typedef int my_socket; #include "mysql_com.h" #include "mysql_version.h" +#include "typelib.h" extern unsigned int mysql_port; extern char *mysql_unix_port; @@ -137,24 +138,36 @@ struct st_mysql_options { a read that is replication-aware */ my_bool no_master_reads; + char *shared_memory_base_name; + unsigned int protocol; }; -enum mysql_option { MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, - MYSQL_OPT_NAMED_PIPE, MYSQL_INIT_COMMAND, - MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP, - MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, - MYSQL_OPT_LOCAL_INFILE}; +enum mysql_option +{ + MYSQL_OPT_CONNECT_TIMEOUT, MYSQL_OPT_COMPRESS, MYSQL_OPT_NAMED_PIPE, MYSQL_INIT_COMMAND, + MYSQL_READ_DEFAULT_FILE, MYSQL_READ_DEFAULT_GROUP,MYSQL_SET_CHARSET_DIR, MYSQL_SET_CHARSET_NAME, + MYSQL_OPT_LOCAL_INFILE, MYSQL_OPT_PROTOCOL, MYSQL_SHARED_MEMORY_BASE_NAME +}; -enum mysql_status { MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT, - MYSQL_STATUS_USE_RESULT}; +enum mysql_status +{ + MYSQL_STATUS_READY,MYSQL_STATUS_GET_RESULT,MYSQL_STATUS_USE_RESULT +}; +enum mysql_protocol_type +{ + MYSQL_PROTOCOL_DEFAULT, MYSQL_PROTOCOL_TCP, MYSQL_PROTOCOL_SOCKET, MYSQL_PROTOCOL_PIPE, + MYSQL_PROTOCOL_MEMORY +}; /* There are three types of queries - the ones that have to go to the master, the ones that go to a slave, and the adminstrative type which must happen on the pivot connectioin */ -enum mysql_rpl_type { MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, - MYSQL_RPL_ADMIN }; +enum mysql_rpl_type +{ + MYSQL_RPL_MASTER, MYSQL_RPL_SLAVE, MYSQL_RPL_ADMIN +}; typedef struct st_mysql diff --git a/include/typelib.h b/include/typelib.h new file mode 100644 index 00000000000..8de94aba553 --- /dev/null +++ b/include/typelib.h @@ -0,0 +1,33 @@ +/* Copyright (C) 2000 MySQL AB
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+
+
+#ifndef _typelib_h
+#define _typelib_h
+ +typedef struct st_typelib { /* Different types saved here */
+ uint count; /* How many types */
+ const char *name; /* Name of typelib */
+ const char **type_names;
+} TYPELIB;
+ +extern int find_type(char *x,TYPELIB *typelib,uint full_name);
+extern void make_type(char *to,uint nr,TYPELIB *typelib);
+extern const char *get_type(TYPELIB *typelib,uint nr);
+ +extern TYPELIB sql_protocol_typelib;
+ +#endif /* _typelib_h */ diff --git a/include/violite.h b/include/violite.h index f4f40dcb64b..d73328b72be 100644 --- a/include/violite.h +++ b/include/violite.h @@ -32,7 +32,7 @@ extern "C" { #endif /* __cplusplus */ enum enum_vio_type { VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET, - VIO_TYPE_NAMEDPIPE, VIO_TYPE_SSL}; + VIO_TYPE_NAMEDPIPE, VIO_TYPE_SSL,VIO_TYPE_SHARED_MEMORY}; #ifndef __WIN__ #define HANDLE void * @@ -41,6 +41,9 @@ enum enum_vio_type { VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET, 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 void vio_delete(Vio* vio); @@ -107,6 +110,17 @@ my_bool vio_poll_read(Vio *vio,uint timeout); } #endif +#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); +#endif + #if defined(HAVE_VIO) && !defined(DONT_MAP_VIO) #define vio_delete(vio) (vio)->viodelete(vio) #define vio_errno(vio) (vio)->vioerrno(vio) @@ -233,6 +247,17 @@ struct st_vio SSL* ssl_; my_bool open_; #endif /* HAVE_OPENSSL */ +#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; +#endif /* HAVE_SMEM */ #endif /* HAVE_VIO */ }; #endif /* EMBEDDED_LIBRARY */ |