2012-05-07 22:20:42 +02:00
|
|
|
/* Copyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.
|
2001-12-06 13:10:51 +01:00
|
|
|
|
|
|
|
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
|
2006-12-23 20:17:15 +01:00
|
|
|
the Free Software Foundation; version 2 of the License.
|
2001-12-06 13:10:51 +01:00
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
2000-07-31 21:29:14 +02:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2001-12-06 13:10:51 +01:00
|
|
|
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
|
2012-05-07 22:20:42 +02:00
|
|
|
along with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
|
2000-07-31 21:29:14 +02:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Vio Lite.
|
|
|
|
* Purpose: include file for Vio that will work with C and C++
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef vio_violite_h_
|
|
|
|
#define vio_violite_h_
|
|
|
|
|
|
|
|
#include "my_net.h" /* needed because of struct in_addr */
|
|
|
|
|
|
|
|
|
|
|
|
/* Simple vio interface in C; The functions are implemented in violite.c */
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2010-03-31 16:05:33 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
typedef struct st_vio Vio;
|
|
|
|
#endif /* __cplusplus */
|
|
|
|
|
2003-02-04 05:44:29 +01:00
|
|
|
enum enum_vio_type
|
|
|
|
{
|
|
|
|
VIO_CLOSED, VIO_TYPE_TCPIP, VIO_TYPE_SOCKET, VIO_TYPE_NAMEDPIPE,
|
|
|
|
VIO_TYPE_SSL, VIO_TYPE_SHARED_MEMORY
|
|
|
|
};
|
2000-07-31 21:29:14 +02:00
|
|
|
|
2005-03-05 22:10:08 +01:00
|
|
|
|
|
|
|
#define VIO_LOCALHOST 1 /* a localhost connection */
|
|
|
|
#define VIO_BUFFERED_READ 2 /* use buffered read */
|
|
|
|
#define VIO_READ_BUFFER_SIZE 16384 /* size of read buffer */
|
|
|
|
|
|
|
|
Vio* vio_new(my_socket sd, enum enum_vio_type type, uint flags);
|
2000-07-31 21:29:14 +02:00
|
|
|
#ifdef __WIN__
|
2004-12-23 12:04:40 +01:00
|
|
|
Vio* vio_new_win32pipe(HANDLE hPipe);
|
2009-11-02 23:19:58 +01:00
|
|
|
Vio* vio_new_win32shared_memory(HANDLE handle_file_map,
|
2004-12-23 12:04:40 +01:00
|
|
|
HANDLE handle_map,
|
|
|
|
HANDLE event_server_wrote,
|
|
|
|
HANDLE event_server_read,
|
|
|
|
HANDLE event_client_wrote,
|
|
|
|
HANDLE event_client_read,
|
|
|
|
HANDLE event_conn_closed);
|
2003-08-29 12:44:35 +02:00
|
|
|
#else
|
|
|
|
#define HANDLE void *
|
|
|
|
#endif /* __WIN__ */
|
|
|
|
|
2012-02-17 20:02:17 +01:00
|
|
|
/* backport from 5.6 where it is part of PSI, not vio_*() */
|
|
|
|
int mysql_socket_shutdown(my_socket mysql_socket, int how);
|
|
|
|
|
2001-09-22 16:40:57 +02:00
|
|
|
void vio_delete(Vio* vio);
|
2003-08-27 01:51:39 +02:00
|
|
|
int vio_close(Vio* vio);
|
2004-05-10 16:37:38 +02:00
|
|
|
void vio_reset(Vio* vio, enum enum_vio_type type,
|
2005-03-05 22:10:08 +01:00
|
|
|
my_socket sd, HANDLE hPipe, uint flags);
|
WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:
- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t
Removed declaration of byte, gptr, my_string, my_size_t and size_s.
Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
as this requires fewer casts in the code and is more in line with how the
standard functions work.
- Added extra length argument to dirname_part() to return the length of the
created string.
- Changed (at least) following functions to take uchar* as argument:
- db_dump()
- my_net_write()
- net_write_command()
- net_store_data()
- DBUG_DUMP()
- decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
argument to my_uncompress() from a pointer to a value as we only return
one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.
Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
explicitely as this conflict was often hided by casting the function to
hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
size_t. This was needed to properly detect errors (which are
returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
(portability fix)
- Removed windows specific code to restore cursor position as this
causes slowdown on windows and we should not mix read() and pread()
calls anyway as this is not thread safe. Updated function comment to
reflect this. Changed function that depended on original behavior of
my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
m_size is the number of elements in the array, not a string/memory
length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
- Replaced some calls to alloc_root + memcpy to use
strmake_root()/strdup_root().
- Changed some calls from memdup() to strmake() (Safety fix)
- Simpler loops in client-simple.c
2007-05-10 11:59:39 +02:00
|
|
|
size_t vio_read(Vio *vio, uchar * buf, size_t size);
|
|
|
|
size_t vio_read_buff(Vio *vio, uchar * buf, size_t size);
|
|
|
|
size_t vio_write(Vio *vio, const uchar * buf, size_t size);
|
2002-08-08 02:12:02 +02:00
|
|
|
int vio_blocking(Vio *vio, my_bool onoff, my_bool *old_mode);
|
2001-09-22 16:40:57 +02:00
|
|
|
my_bool vio_is_blocking(Vio *vio);
|
2003-08-27 01:51:39 +02:00
|
|
|
/* setsockopt TCP_NODELAY at IPPROTO_TCP level, when possible */
|
2001-09-22 16:40:57 +02:00
|
|
|
int vio_fastsend(Vio *vio);
|
2003-08-27 01:51:39 +02:00
|
|
|
/* setsockopt SO_KEEPALIVE at SOL_SOCKET level, when possible */
|
2001-09-22 16:40:57 +02:00
|
|
|
int vio_keepalive(Vio *vio, my_bool onoff);
|
2003-08-27 01:51:39 +02:00
|
|
|
/* Whenever we should retry the last read/write operation. */
|
2001-09-22 16:40:57 +02:00
|
|
|
my_bool vio_should_retry(Vio *vio);
|
2005-08-30 17:19:28 +02:00
|
|
|
/* Check that operation was timed out */
|
|
|
|
my_bool vio_was_interrupted(Vio *vio);
|
2003-08-27 01:51:39 +02:00
|
|
|
/* Short text description of the socket for those, who are curious.. */
|
2001-09-22 16:40:57 +02:00
|
|
|
const char* vio_description(Vio *vio);
|
2000-07-31 21:29:14 +02:00
|
|
|
/* Return the type of the connection */
|
2001-09-22 16:40:57 +02:00
|
|
|
enum enum_vio_type vio_type(Vio* vio);
|
2000-07-31 21:29:14 +02:00
|
|
|
/* Return last error number */
|
2003-08-29 12:44:35 +02:00
|
|
|
int vio_errno(Vio*vio);
|
2000-07-31 21:29:14 +02:00
|
|
|
/* Get socket number */
|
2001-05-31 16:18:25 +02:00
|
|
|
my_socket vio_fd(Vio*vio);
|
2003-08-27 01:51:39 +02:00
|
|
|
/* Remote peer's address and name in text form */
|
2009-11-25 11:53:23 +01:00
|
|
|
my_bool vio_peer_addr(Vio *vio, char *buf, uint16 *port, size_t buflen);
|
2009-11-10 20:36:38 +01:00
|
|
|
my_bool vio_poll_read(Vio *vio, uint timeout);
|
|
|
|
my_bool vio_is_connected(Vio *vio);
|
2009-11-21 00:12:23 +01:00
|
|
|
ssize_t vio_pending(Vio *vio);
|
2000-07-31 21:29:14 +02:00
|
|
|
|
2009-11-25 11:53:23 +01:00
|
|
|
my_bool vio_get_normalized_ip_string(const struct sockaddr *addr, int addr_length,
|
|
|
|
char *ip_string, size_t ip_string_size);
|
|
|
|
|
2011-04-08 12:23:36 +02:00
|
|
|
my_bool vio_is_no_name_error(int err_code);
|
|
|
|
|
2009-11-25 11:53:23 +01:00
|
|
|
int vio_getnameinfo(const struct sockaddr *sa,
|
|
|
|
char *hostname, size_t hostname_size,
|
|
|
|
char *port, size_t port_size,
|
|
|
|
int flags);
|
|
|
|
|
2001-05-31 16:18:25 +02:00
|
|
|
#ifdef HAVE_OPENSSL
|
2004-06-09 18:02:08 +02:00
|
|
|
#include <openssl/opensslv.h>
|
|
|
|
#if OPENSSL_VERSION_NUMBER < 0x0090700f
|
|
|
|
#define DES_cblock des_cblock
|
|
|
|
#define DES_key_schedule des_key_schedule
|
|
|
|
#define DES_set_key_unchecked(k,ks) des_set_key_unchecked((k),*(ks))
|
2004-06-17 13:01:54 +02:00
|
|
|
#define DES_ede3_cbc_encrypt(i,o,l,k1,k2,k3,iv,e) des_ede3_cbc_encrypt((i),(o),(l),*(k1),*(k2),*(k3),(iv),(e))
|
2004-06-09 18:02:08 +02:00
|
|
|
#endif
|
|
|
|
|
2001-07-24 08:07:46 +02:00
|
|
|
#define HEADER_DES_LOCL_H dummy_something
|
2005-04-28 15:23:27 +02:00
|
|
|
#define YASSL_MYSQL_COMPATIBLE
|
2007-06-15 11:28:15 +02:00
|
|
|
#ifndef YASSL_PREFIX
|
2006-06-06 13:21:07 +02:00
|
|
|
#define YASSL_PREFIX
|
2007-06-15 11:28:15 +02:00
|
|
|
#endif
|
2007-03-28 15:34:52 +02:00
|
|
|
/* Set yaSSL to use same type as MySQL do for socket handles */
|
|
|
|
typedef my_socket YASSL_SOCKET_T;
|
|
|
|
#define YASSL_SOCKET_T_DEFINED
|
2001-05-31 16:18:25 +02:00
|
|
|
#include <openssl/ssl.h>
|
|
|
|
#include <openssl/err.h>
|
2000-07-31 21:29:14 +02:00
|
|
|
|
Backport of:
ChangeSet@1.2703, 2007-12-07 09:35:28-05:00, cmiller@zippy.cornsilk.net +40 -0
Bug#13174: SHA2 function
Patch contributed from Bill Karwin, paper unnumbered CLA in Seattle
Implement SHA2 functions.
Chad added code to make it work with YaSSL. Also, he removed the
(probable) bug of embedded server never using SSL-dependent
functions. (libmysqld/Makefile.am didn't read ANY autoconf defs.)
Function specification:
SHA2( string cleartext, integer hash_length )
-> string hash, or NULL
where hash_length is one of 224, 256, 384, or 512. If either is
NULL or a length is unsupported, then the result is NULL. The
resulting string is always the length of the hash_length parameter
or is NULL.
Include the canonical hash examples from the NIST in the test
results.
---
Polish and address concerns of reviewers.
2010-04-13 17:04:45 +02:00
|
|
|
#ifndef EMBEDDED_LIBRARY
|
2009-07-23 13:38:11 +02:00
|
|
|
enum enum_ssl_init_error
|
|
|
|
{
|
|
|
|
SSL_INITERR_NOERROR= 0, SSL_INITERR_CERT, SSL_INITERR_KEY,
|
|
|
|
SSL_INITERR_NOMATCH, SSL_INITERR_BAD_PATHS, SSL_INITERR_CIPHERS,
|
|
|
|
SSL_INITERR_MEMFAIL, SSL_INITERR_LASTERR
|
|
|
|
};
|
|
|
|
const char* sslGetErrString(enum enum_ssl_init_error err);
|
|
|
|
|
2006-03-10 16:41:14 +01:00
|
|
|
struct st_VioSSLFd
|
2001-05-31 16:18:25 +02:00
|
|
|
{
|
2003-08-27 01:51:39 +02:00
|
|
|
SSL_CTX *ssl_context;
|
2001-05-31 16:18:25 +02:00
|
|
|
};
|
2000-07-31 21:29:14 +02:00
|
|
|
|
2011-05-19 11:47:43 +02:00
|
|
|
int sslaccept(struct st_VioSSLFd*, Vio *, long timeout, unsigned long *errptr);
|
|
|
|
int sslconnect(struct st_VioSSLFd*, Vio *, long timeout, unsigned long *errptr);
|
2001-11-05 00:04:08 +01:00
|
|
|
|
2006-03-10 16:41:14 +01:00
|
|
|
struct st_VioSSLFd
|
2003-08-27 01:51:39 +02:00
|
|
|
*new_VioSSLConnectorFd(const char *key_file, const char *cert_file,
|
|
|
|
const char *ca_file, const char *ca_path,
|
2011-05-19 11:47:43 +02:00
|
|
|
const char *cipher, enum enum_ssl_init_error* error);
|
2006-03-10 16:41:14 +01:00
|
|
|
struct st_VioSSLFd
|
2003-08-27 01:51:39 +02:00
|
|
|
*new_VioSSLAcceptorFd(const char *key_file, const char *cert_file,
|
|
|
|
const char *ca_file,const char *ca_path,
|
2009-07-23 13:38:11 +02:00
|
|
|
const char *cipher, enum enum_ssl_init_error* error);
|
2006-05-11 03:11:50 +02:00
|
|
|
void free_vio_ssl_acceptor_fd(struct st_VioSSLFd *fd);
|
Backport of:
ChangeSet@1.2703, 2007-12-07 09:35:28-05:00, cmiller@zippy.cornsilk.net +40 -0
Bug#13174: SHA2 function
Patch contributed from Bill Karwin, paper unnumbered CLA in Seattle
Implement SHA2 functions.
Chad added code to make it work with YaSSL. Also, he removed the
(probable) bug of embedded server never using SSL-dependent
functions. (libmysqld/Makefile.am didn't read ANY autoconf defs.)
Function specification:
SHA2( string cleartext, integer hash_length )
-> string hash, or NULL
where hash_length is one of 224, 256, 384, or 512. If either is
NULL or a length is unsupported, then the result is NULL. The
resulting string is always the length of the hash_length parameter
or is NULL.
Include the canonical hash examples from the NIST in the test
results.
---
Polish and address concerns of reviewers.
2010-04-13 17:04:45 +02:00
|
|
|
#endif /* ! EMBEDDED_LIBRARY */
|
2003-08-29 12:44:35 +02:00
|
|
|
#endif /* HAVE_OPENSSL */
|
2001-09-22 16:40:57 +02:00
|
|
|
|
2006-05-08 17:14:06 +02:00
|
|
|
void vio_end(void);
|
|
|
|
|
2001-05-31 16:18:25 +02:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2002-11-14 20:16:30 +01:00
|
|
|
#endif
|
|
|
|
|
2005-03-05 22:10:08 +01:00
|
|
|
#if !defined(DONT_MAP_VIO)
|
2001-05-31 16:18:25 +02:00
|
|
|
#define vio_delete(vio) (vio)->viodelete(vio)
|
|
|
|
#define vio_errno(vio) (vio)->vioerrno(vio)
|
2005-03-29 23:31:56 +02:00
|
|
|
#define vio_read(vio, buf, size) ((vio)->read)(vio,buf,size)
|
|
|
|
#define vio_write(vio, buf, size) ((vio)->write)(vio, buf, size)
|
2002-08-08 02:12:02 +02:00
|
|
|
#define vio_blocking(vio, set_blocking_mode, old_mode)\
|
|
|
|
(vio)->vioblocking(vio, set_blocking_mode, old_mode)
|
2001-05-31 16:18:25 +02:00
|
|
|
#define vio_is_blocking(vio) (vio)->is_blocking(vio)
|
|
|
|
#define vio_fastsend(vio) (vio)->fastsend(vio)
|
|
|
|
#define vio_keepalive(vio, set_keep_alive) (vio)->viokeepalive(vio, set_keep_alive)
|
|
|
|
#define vio_should_retry(vio) (vio)->should_retry(vio)
|
2005-08-30 17:19:28 +02:00
|
|
|
#define vio_was_interrupted(vio) (vio)->was_interrupted(vio)
|
2001-05-31 16:18:25 +02:00
|
|
|
#define vio_close(vio) ((vio)->vioclose)(vio)
|
2009-11-25 11:53:23 +01:00
|
|
|
#define vio_peer_addr(vio, buf, prt, buflen) (vio)->peer_addr(vio, buf, prt, buflen)
|
2005-05-05 17:17:57 +02:00
|
|
|
#define vio_timeout(vio, which, seconds) (vio)->timeout(vio, which, seconds)
|
2009-11-10 20:36:38 +01:00
|
|
|
#define vio_poll_read(vio, timeout) (vio)->poll_read(vio, timeout)
|
|
|
|
#define vio_is_connected(vio) (vio)->is_connected(vio)
|
2005-03-05 22:10:08 +01:00
|
|
|
#endif /* !defined(DONT_MAP_VIO) */
|
2001-05-31 16:18:25 +02:00
|
|
|
|
2001-09-30 04:46:20 +02:00
|
|
|
/* This enumerator is used in parser - should be always visible */
|
2002-09-05 15:17:08 +02:00
|
|
|
enum SSL_type
|
|
|
|
{
|
|
|
|
SSL_TYPE_NOT_SPECIFIED= -1,
|
|
|
|
SSL_TYPE_NONE,
|
|
|
|
SSL_TYPE_ANY,
|
|
|
|
SSL_TYPE_X509,
|
|
|
|
SSL_TYPE_SPECIFIED
|
|
|
|
};
|
2001-09-30 04:46:20 +02:00
|
|
|
|
2003-01-21 20:07:59 +01:00
|
|
|
|
2003-07-04 08:40:10 +02:00
|
|
|
/* HFTODO - hide this if we don't want client in embedded server */
|
2001-05-31 16:18:25 +02:00
|
|
|
/* This structure is for every connection on both sides */
|
|
|
|
struct st_vio
|
|
|
|
{
|
|
|
|
my_socket sd; /* my_socket - real or imaginary */
|
|
|
|
HANDLE hPipe;
|
|
|
|
my_bool localhost; /* Are we from localhost? */
|
|
|
|
int fcntl_mode; /* Buffered fcntl(sd,F_GETFL) */
|
2009-11-25 11:53:23 +01:00
|
|
|
struct sockaddr_storage local; /* Local internet address */
|
|
|
|
struct sockaddr_storage remote; /* Remote internet address */
|
|
|
|
int addrLen; /* Length of remote address */
|
2001-05-31 16:18:25 +02:00
|
|
|
enum enum_vio_type type; /* Type of connection */
|
|
|
|
char desc[30]; /* String description */
|
2005-03-05 22:10:08 +01:00
|
|
|
char *read_buffer; /* buffer for vio_read_buff */
|
|
|
|
char *read_pos; /* start of unfetched data in the
|
|
|
|
read buffer */
|
|
|
|
char *read_end; /* end of unfetched data */
|
2001-05-31 16:18:25 +02:00
|
|
|
/* function pointers. They are similar for socket/SSL/whatever */
|
2001-09-22 16:40:57 +02:00
|
|
|
void (*viodelete)(Vio*);
|
|
|
|
int (*vioerrno)(Vio*);
|
WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:
- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t
Removed declaration of byte, gptr, my_string, my_size_t and size_s.
Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
as this requires fewer casts in the code and is more in line with how the
standard functions work.
- Added extra length argument to dirname_part() to return the length of the
created string.
- Changed (at least) following functions to take uchar* as argument:
- db_dump()
- my_net_write()
- net_write_command()
- net_store_data()
- DBUG_DUMP()
- decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
argument to my_uncompress() from a pointer to a value as we only return
one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.
Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
explicitely as this conflict was often hided by casting the function to
hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
size_t. This was needed to properly detect errors (which are
returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
(portability fix)
- Removed windows specific code to restore cursor position as this
causes slowdown on windows and we should not mix read() and pread()
calls anyway as this is not thread safe. Updated function comment to
reflect this. Changed function that depended on original behavior of
my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
m_size is the number of elements in the array, not a string/memory
length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
- Replaced some calls to alloc_root + memcpy to use
strmake_root()/strdup_root().
- Changed some calls from memdup() to strmake() (Safety fix)
- Simpler loops in client-simple.c
2007-05-10 11:59:39 +02:00
|
|
|
size_t (*read)(Vio*, uchar *, size_t);
|
|
|
|
size_t (*write)(Vio*, const uchar *, size_t);
|
2002-08-08 02:12:02 +02:00
|
|
|
int (*vioblocking)(Vio*, my_bool, my_bool *);
|
2001-09-22 16:40:57 +02:00
|
|
|
my_bool (*is_blocking)(Vio*);
|
|
|
|
int (*viokeepalive)(Vio*, my_bool);
|
|
|
|
int (*fastsend)(Vio*);
|
2009-11-25 11:53:23 +01:00
|
|
|
my_bool (*peer_addr)(Vio*, char *, uint16*, size_t);
|
|
|
|
void (*in_addr)(Vio*, struct sockaddr_storage*);
|
2001-09-22 16:40:57 +02:00
|
|
|
my_bool (*should_retry)(Vio*);
|
2005-08-30 17:19:28 +02:00
|
|
|
my_bool (*was_interrupted)(Vio*);
|
2001-09-22 16:40:57 +02:00
|
|
|
int (*vioclose)(Vio*);
|
2005-05-05 17:17:57 +02:00
|
|
|
void (*timeout)(Vio*, unsigned int which, unsigned int timeout);
|
2009-11-10 20:36:38 +01:00
|
|
|
my_bool (*poll_read)(Vio *vio, uint timeout);
|
|
|
|
my_bool (*is_connected)(Vio*);
|
2010-06-07 16:01:39 +02:00
|
|
|
my_bool (*has_data) (Vio*);
|
2006-05-08 17:14:06 +02:00
|
|
|
#ifdef HAVE_OPENSSL
|
2003-08-27 01:51:39 +02:00
|
|
|
void *ssl_arg;
|
2006-05-08 17:14:06 +02:00
|
|
|
#endif
|
2002-11-14 20:16:30 +01:00
|
|
|
#ifdef HAVE_SMEM
|
2003-08-29 12:44:35 +02:00
|
|
|
HANDLE handle_file_map;
|
|
|
|
char *handle_map;
|
|
|
|
HANDLE event_server_wrote;
|
|
|
|
HANDLE event_server_read;
|
|
|
|
HANDLE event_client_wrote;
|
|
|
|
HANDLE event_client_read;
|
2004-12-14 15:24:19 +01:00
|
|
|
HANDLE event_conn_closed;
|
WL#3817: Simplify string / memory area types and make things more consistent (first part)
The following type conversions was done:
- Changed byte to uchar
- Changed gptr to uchar*
- Change my_string to char *
- Change my_size_t to size_t
- Change size_s to size_t
Removed declaration of byte, gptr, my_string, my_size_t and size_s.
Following function parameter changes was done:
- All string functions in mysys/strings was changed to use size_t
instead of uint for string lengths.
- All read()/write() functions changed to use size_t (including vio).
- All protocoll functions changed to use size_t instead of uint
- Functions that used a pointer to a string length was changed to use size_t*
- Changed malloc(), free() and related functions from using gptr to use void *
as this requires fewer casts in the code and is more in line with how the
standard functions work.
- Added extra length argument to dirname_part() to return the length of the
created string.
- Changed (at least) following functions to take uchar* as argument:
- db_dump()
- my_net_write()
- net_write_command()
- net_store_data()
- DBUG_DUMP()
- decimal2bin() & bin2decimal()
- Changed my_compress() and my_uncompress() to use size_t. Changed one
argument to my_uncompress() from a pointer to a value as we only return
one value (makes function easier to use).
- Changed type of 'pack_data' argument to packfrm() to avoid casts.
- Changed in readfrm() and writefrom(), ha_discover and handler::discover()
the type for argument 'frmdata' to uchar** to avoid casts.
- Changed most Field functions to use uchar* instead of char* (reduced a lot of
casts).
- Changed field->val_xxx(xxx, new_ptr) to take const pointers.
Other changes:
- Removed a lot of not needed casts
- Added a few new cast required by other changes
- Added some cast to my_multi_malloc() arguments for safety (as string lengths
needs to be uint, not size_t).
- Fixed all calls to hash-get-key functions to use size_t*. (Needed to be done
explicitely as this conflict was often hided by casting the function to
hash_get_key).
- Changed some buffers to memory regions to uchar* to avoid casts.
- Changed some string lengths from uint to size_t.
- Changed field->ptr to be uchar* instead of char*. This allowed us to
get rid of a lot of casts.
- Some changes from true -> TRUE, false -> FALSE, unsigned char -> uchar
- Include zlib.h in some files as we needed declaration of crc32()
- Changed MY_FILE_ERROR to be (size_t) -1.
- Changed many variables to hold the result of my_read() / my_write() to be
size_t. This was needed to properly detect errors (which are
returned as (size_t) -1).
- Removed some very old VMS code
- Changed packfrm()/unpackfrm() to not be depending on uint size
(portability fix)
- Removed windows specific code to restore cursor position as this
causes slowdown on windows and we should not mix read() and pread()
calls anyway as this is not thread safe. Updated function comment to
reflect this. Changed function that depended on original behavior of
my_pwrite() to itself restore the cursor position (one such case).
- Added some missing checking of return value of malloc().
- Changed definition of MOD_PAD_CHAR_TO_FULL_LENGTH to avoid 'long' overflow.
- Changed type of table_def::m_size from my_size_t to ulong to reflect that
m_size is the number of elements in the array, not a string/memory
length.
- Moved THD::max_row_length() to table.cc (as it's not depending on THD).
Inlined max_row_length_blob() into this function.
- More function comments
- Fixed some compiler warnings when compiled without partitions.
- Removed setting of LEX_STRING() arguments in declaration (portability fix).
- Some trivial indentation/variable name changes.
- Some trivial code simplifications:
- Replaced some calls to alloc_root + memcpy to use
strmake_root()/strdup_root().
- Changed some calls from memdup() to strmake() (Safety fix)
- Simpler loops in client-simple.c
2007-05-10 11:59:39 +02:00
|
|
|
size_t shared_memory_remain;
|
2003-08-29 12:44:35 +02:00
|
|
|
char *shared_memory_pos;
|
2002-11-14 20:16:30 +01:00
|
|
|
#endif /* HAVE_SMEM */
|
2009-11-02 23:19:58 +01:00
|
|
|
#ifdef _WIN32
|
|
|
|
OVERLAPPED pipe_overlapped;
|
2009-11-20 13:09:50 +01:00
|
|
|
DWORD read_timeout_ms;
|
|
|
|
DWORD write_timeout_ms;
|
2009-11-02 23:19:58 +01:00
|
|
|
#endif
|
2001-05-31 16:18:25 +02:00
|
|
|
};
|
2001-09-30 04:47:34 +02:00
|
|
|
#endif /* vio_violite_h_ */
|