Commit 1519e5d0 authored by tonu@hundin.mysql.fi's avatar tonu@hundin.mysql.fi

Support for VIO library

parent 776dea81
#! /bin/sh
path=`dirname $0`
. "$path/SETUP.sh"
extra_flags="$pentium_cflags $debug_cflags"
c_warnings="$c_warnings $debug_extra_warnings"
cxx_warnings="$cxx_warnings $debug_extra_warnings"
extra_configs="$pentium_configs $debug_configs"
extra_configs="$extra_configs --with-debug=full --with-vio --with-openssl"
. "$path/FINISH.sh"
......@@ -22,7 +22,7 @@ TAR = gtar
EXTRA_DIST = INSTALL-SOURCE README \
COPYING COPYING.LIB MIRRORS
SUBDIRS = include @docs_dirs@ @readline_dir@ \
@thread_dirs@ @pstack_dirs@ @sql_client_dirs@ \
@thread_dirs@ @pstack_dirs@ vio @sql_client_dirs@ \
@sql_server_dirs@ @libmysqld_dirs@ scripts tests man \
@bench_dirs@ support-files @fs_dirs@
......
......@@ -100,15 +100,8 @@ enum enum_server_command {COM_SLEEP,COM_QUIT,COM_INIT_DB,COM_QUERY,
#define NET_WRITE_TIMEOUT 60 /* Timeout on write */
#define NET_WAIT_TIMEOUT 8*60*60 /* Wait for new query */
#ifndef Vio_defined
#define Vio_defined
#ifdef HAVE_VIO
class Vio; /* Fill Vio class in C++ */
#else
struct st_vio; /* Only C */
typedef struct st_vio Vio;
#endif
#endif
typedef struct st_net {
Vio* vio;
......
......@@ -25,9 +25,6 @@
#include "my_net.h" /* needed because of struct in_addr */
#ifdef HAVE_VIO
#include <Vio.h> /* Full VIO interface */
#else
/* Simple vio interface in C; The functions are implemented in violite.c */
......@@ -35,14 +32,8 @@
extern "C" {
#endif /* __cplusplus */
#ifndef Vio_defined
#define Vio_defined
struct st_vio; /* Only C */
typedef struct st_vio Vio;
#endif
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* vio_new(my_socket sd,
enum enum_vio_type type,
......@@ -87,7 +78,7 @@ my_bool vio_should_retry( Vio* vio);
/*
* When the workday is over...
*/
int vio_close( Vio* vio);
int vio_close(Vio* vio);
/*
* Short text description of the socket for those, who are curious..
*/
......@@ -97,15 +88,15 @@ const char* vio_description( Vio* vio);
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);
my_socket vio_fd(Vio*vio);
/*
* Remote peer's address and name in text form.
*/
my_bool vio_peer_addr(Vio * vio, char *buf);
my_bool vio_peer_addr(Vio* vio, char *buf);
/* Remotes in_addr */
......@@ -117,5 +108,154 @@ my_bool vio_poll_read(Vio *vio,uint timeout);
#ifdef __cplusplus
}
#endif
#endif /* HAVE_VIO */
#endif /* vio_violite_h_ */
#ifdef HAVE_VIO
#ifndef DONT_MAP_VIO
#define vio_delete(vio) (vio)->viodelete(vio)
#define vio_errno(vio) (vio)->vioerrno(vio)
#define vio_read(vio, buf, size) (vio)->read(vio,buf,size)
#define vio_write(vio, buf, size) (vio)->write(vio, buf, size)
#define vio_blocking(vio, set_blocking_mode) (vio)->vioblocking(vio, set_blocking_mode)
#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)
#define vio_close(vio) ((vio)->vioclose)(vio)
#define vio_peer_addr(vio, buf) (vio)->peer_addr(vio, buf)
#define vio_in_addr(vio, in) (vio)->in_addr(vio, in)
#define vio_poll_read(vio,timeout) (vio)->poll_read(vio,timeout)
#endif /* !DONT_MAP_VIO */
#endif /* HAVE_VIO */
#ifdef HAVE_OPENSSL
#include <openssl/x509.h>
#include <openssl/ssl.h>
#include <openssl/err.h>
#include <openssl/pem.h>
#include <openssl/asn1.h>
#include "my_net.h" /* needed because of struct in_addr */
#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */
void vio_ssl_delete(Vio* vio);
#ifdef EMBEDDED_LIBRARY
void vio_reset(Vio *vio);
#endif
int vio_ssl_read(Vio* vio,gptr buf, int size);
int vio_ssl_write(Vio* vio,const gptr buf,int size);
int vio_ssl_blocking(Vio* vio,my_bool onoff);
my_bool vio_ssl_is_blocking(Vio* vio);
/* 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);
void vio_ssl_in_addr(Vio *vio, struct in_addr *in);
/* Return 1 if there is data to be read */
my_bool vio_ssl_poll_read(Vio *vio,uint timeout);
#ifdef HAVE_OPENSSL
/* Single copy for server */
struct st_VioSSLAcceptorFd
{
SSL_CTX* ssl_context_;
SSL_METHOD* ssl_method_;
struct st_VioSSLAcceptorFd* session_id_context_;
enum {
state_connect = 1,
state_accept = 2
};
BIO* bio_;
char *ssl_cip_;
char desc_[100];
Vio* sd_;
/* function pointers which are only once for SSL server
Vio*(*sslaccept)(struct st_VioSSLAcceptorFd*,Vio*); */
};
/* One copy for client */
struct st_VioSSLConnectorFd
{
BIO* bio_;
gptr ssl_;
SSL_CTX* ssl_context_;
SSL_METHOD* ssl_method_;
/* function pointers which are only once for SSL client */
};
Vio *sslaccept(struct st_VioSSLAcceptorFd*, Vio*);
Vio *sslconnect(struct st_VioSSLConnectorFd*, Vio*);
#else /* HAVE_OPENSSL */
/* This dummy is required to maintain proper size of st_mysql in mysql.h */
struct st_VioSSLConnectorFd {};
#endif /* HAVE_OPENSSL */
struct st_VioSSLConnectorFd *new_VioSSLConnectorFd(
const char* key_file,const char* cert_file,const char* ca_file,const char* ca_path);
struct st_VioSSLAcceptorFd *new_VioSSLAcceptorFd(
const char* key_file,const char* cert_file,const char* ca_file,const char* ca_path);
Vio* new_VioSSL(struct st_VioSSLAcceptorFd* fd, Vio* sd,int state);
//static int
//init_bio_(struct st_VioSSLAcceptorFd* fd, Vio* sd, int state, int bio_flags);
//void report_errors();
#ifdef __cplusplus
}
#endif
#endif /* HAVE_OPENSSL */
#ifndef __WIN__
#define HANDLE void *
#endif
/* 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) */
struct sockaddr_in local; /* Local internet address */
struct sockaddr_in remote; /* Remote internet address */
enum enum_vio_type type; /* Type of connection */
char desc[30]; /* String description */
#ifdef HAVE_VIO
/* function pointers. They are similar for socket/SSL/whatever */
void (*viodelete)(Vio*);
int(*vioerrno)(Vio*);
int(*read)(Vio*, gptr, int);
int(*write)(Vio*, gptr, int);
int(*vioblocking)(Vio*, my_bool);
my_bool(*is_blocking)(Vio*);
int(*viokeepalive)(Vio*, my_bool);
int(*fastsend)(Vio*);
my_bool(*peer_addr)(Vio*, gptr);
void(*in_addr)(Vio*, struct in_addr*);
my_bool(*should_retry)(Vio*);
int(*vioclose)(Vio*);
my_bool(*poll_read)(Vio*,uint);
#ifdef HAVE_OPENSSL
BIO* bio_;
SSL* ssl_;
my_bool open_;
#endif /* HAVE_OPENSSL */
#endif /* HAVE_VIO */
};
......@@ -34,9 +34,6 @@ LTCHARSET_OBJS= ${CHARSET_OBJS:.o=.lo}
target_sources = libmysql.c net.c password.c \
get_password.c errmsg.c
#quick easy dirty hack to make it work after Tonu's changes
#In my opinion, violite.c really belongs into mysys - Sasha
sqlobjects = violite.lo
mystringsobjects = strmov.lo strxmov.lo strnmov.lo strmake.lo strend.lo \
strnlen.lo strfill.lo is_prefix.lo \
int2str.lo str2int.lo strinstr.lo strcont.lo \
......
......@@ -1070,13 +1070,15 @@ mysql_ssl_set(MYSQL *mysql, const char *key, const char *cert,
mysql->options.ssl_cert = cert==0 ? 0 : my_strdup(cert,MYF(0));
mysql->options.ssl_ca = ca==0 ? 0 : my_strdup(ca,MYF(0));
mysql->options.ssl_capath = capath==0 ? 0 : my_strdup(capath,MYF(0));
mysql->options.use_ssl = true;
mysql->connector_fd = new_VioSSLConnectorFd(key, cert, ca, capath);
mysql->options.use_ssl = TRUE;
mysql->connector_fd = (gptr)new_VioSSLConnectorFd(key, cert, ca, capath);
DBUG_PRINT("info",("mysql_ssl_set, context: %p",((struct st_VioSSLConnectorFd *)(mysql->connector_fd))->ssl_context_));
return 0;
}
/**************************************************************************
**************************************************************************/
**************************************************************************
char * STDCALL
mysql_ssl_cipher(MYSQL *mysql)
......@@ -1085,10 +1087,10 @@ mysql_ssl_cipher(MYSQL *mysql)
}
/**************************************************************************
**************************************************************************
** Free strings in the SSL structure and clear 'use_ssl' flag.
** NB! Errors are not reported until you do mysql_real_connect.
**************************************************************************/
**************************************************************************
int STDCALL
mysql_ssl_clear(MYSQL *mysql)
......@@ -1105,7 +1107,7 @@ mysql_ssl_clear(MYSQL *mysql)
mysql->connector_fd->delete();
mysql->connector_fd = 0;
return 0;
}
}*/
#endif /* HAVE_OPENSSL */
/**************************************************************************
......@@ -1496,11 +1498,9 @@ mysql_real_connect(MYSQL *mysql,const char *host, const char *user,
goto error;
/* Do the SSL layering. */
DBUG_PRINT("info", ("IO layer change in progress..."));
VioSSLConnectorFd* connector_fd = (VioSSLConnectorFd*)
(mysql->connector_fd);
VioSocket* vio_socket = (VioSocket*)(mysql->net.vio);
VioSSL* vio_ssl = connector_fd->connect(vio_socket);
mysql->net.vio = (NetVio*)(vio_ssl);
DBUG_PRINT("info", ("IO context %p",((struct st_VioSSLConnectorFd*)mysql->connector_fd)->ssl_context_));
mysql->net.vio = sslconnect((struct st_VioSSLConnectorFd*)(mysql->connector_fd),mysql->net.vio);
DBUG_PRINT("info", ("IO layer change done!"));
}
#endif /* HAVE_OPENSSL */
......@@ -1680,8 +1680,8 @@ mysql_close(MYSQL *mysql)
bzero((char*) &mysql->options,sizeof(mysql->options));
mysql->net.vio = 0;
#ifdef HAVE_OPENSSL
((VioConnectorFd*)(mysql->connector_fd))->delete();
mysql->connector_fd = 0;
/* ((VioConnectorFd*)(mysql->connector_fd))->delete();
mysql->connector_fd = 0;*/
#endif /* HAVE_OPENSSL */
if (mysql->free_me)
my_free((gptr) mysql,MYF(0));
......
......@@ -39,8 +39,8 @@ LDADD = ../isam/libnisam.a \
../mysys/libmysys.a \
../dbug/libdbug.a \
../regex/libregex.a \
../strings/libmystrings.a
#../vio/libvio.a
../strings/libmystrings.a \
../vio/libvio.a
mysqld_LDADD = @MYSQLD_EXTRA_LDFLAGS@ \
@bdb_libs@ @innodb_libs@ @pstack_libs@ \
......@@ -64,7 +64,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
item_cmpfunc.cc item_strfunc.cc item_timefunc.cc \
thr_malloc.cc item_create.cc \
field.cc key.cc sql_class.cc sql_list.cc \
net_serv.cc violite.c net_pkg.cc lock.cc my_lock.c \
net_serv.cc net_pkg.cc lock.cc my_lock.c \
sql_string.cc sql_manager.cc sql_map.cc \
mysqld.cc password.c hash_filo.cc hostname.cc \
convert.cc sql_parse.cc sql_yacc.yy \
......@@ -86,7 +86,7 @@ mysqld_SOURCES = sql_lex.cc sql_handler.cc \
md5.c stacktrace.c
gen_lex_hash_SOURCES = gen_lex_hash.cc
gen_lex_hash_LDADD = $(LDADD) $(CXXLDFLAGS)
mysqlbinlog_SOURCES = mysqlbinlog.cc mini_client.cc net_serv.cc violite.c \
mysqlbinlog_SOURCES = mysqlbinlog.cc mini_client.cc net_serv.cc \
mini_client_errors.c password.c
mysqlbinlog_LDADD = $(LDADD) $(CXXLDFLAGS) $(mysqld_LDADD)
......
......@@ -28,6 +28,7 @@
#include <odbcinst.h>
#endif
#include <global.h>
#include <violite.h>
#include <my_sys.h>
#include <mysys_err.h>
#include <m_string.h>
......@@ -37,7 +38,6 @@
#include "mysql_version.h"
#include "mysqld_error.h"
#include "errmsg.h"
#include <violite.h>
extern "C" { // Because of SCO 3.2V4.2
#include <sys/stat.h>
......@@ -748,18 +748,18 @@ mc_mysql_connect(MYSQL *mysql,const char *host, const char *user,
#ifdef HAVE_OPENSSL
/* Oops.. are we careful enough to not send ANY information */
/* without encryption? */
if (client_flag & CLIENT_SSL)
/* if (client_flag & CLIENT_SSL)
{
if (my_net_write(net,buff,(uint) (2)) || net_flush(net))
goto error;
goto error;*/
/* Do the SSL layering. */
DBUG_PRINT("info", ("IO layer change in progress..."));
/* DBUG_PRINT("info", ("IO layer change in progress..."));
VioSSLConnectorFd* connector_fd = (VioSSLConnectorFd*)
(mysql->connector_fd);
VioSocket* vio_socket = (VioSocket*)(mysql->net.vio);
VioSSL* vio_ssl = connector_fd->connect(vio_socket);
mysql->net.vio = (NetVio*)(vio_ssl);
}
}*/
#endif /* HAVE_OPENSSL */
int3store(buff+2,max_allowed_packet);
......@@ -829,8 +829,8 @@ mc_mysql_close(MYSQL *mysql)
bzero((char*) &mysql->options,sizeof(mysql->options));
mysql->net.vio = 0;
#ifdef HAVE_OPENSSL
((VioConnectorFd*)(mysql->connector_fd))->delete();
mysql->connector_fd = 0;
/* ((VioConnectorFd*)(mysql->connector_fd))->delete();
mysql->connector_fd = 0;*/
#endif /* HAVE_OPENSSL */
if (mysql->free_me)
my_free((gptr) mysql,MYF(0));
......
......@@ -34,7 +34,6 @@
#include <nisam.h>
#include <thr_alarm.h>
#include <ft_global.h>
#include "vio.h"
#ifndef DBUG_OFF
#define ONE_THREAD
......@@ -244,7 +243,7 @@ static char *opt_ssl_key = 0;
static char *opt_ssl_cert = 0;
static char *opt_ssl_ca = 0;
static char *opt_ssl_capath = 0;
static struct st_VioSSLAcceptorFd * ssl_acceptor_fd = 0;
struct st_VioSSLAcceptorFd * ssl_acceptor_fd = 0;
#endif /* HAVE_OPENSSL */
......
......@@ -39,7 +39,6 @@
#include <signal.h>
#include <errno.h>
#include <sys/types.h>
#include <violite.h>
#include <assert.h>
extern "C" {
......
......@@ -59,7 +59,7 @@ const char *command_name[]={
bool volatile abort_slave = 0;
#ifdef HAVE_OPENSSL
extern VioSSLAcceptorFd* ssl_acceptor_fd;
extern struct st_VioSSLAcceptorFd * ssl_acceptor_fd;
#endif /* HAVE_OPENSSL */
#ifdef __WIN__
......@@ -423,9 +423,7 @@ check_connections(THD *thd)
DBUG_PRINT("info", ("Agreed to change IO layer to SSL") );
/* Do the SSL layering. */
DBUG_PRINT("info", ("IO layer change in progress..."));
VioSocket* vio_socket = my_reinterpret_cast(VioSocket*)(net->vio);
VioSSL* vio_ssl = ssl_acceptor_fd->accept(vio_socket);
net->vio = my_reinterpret_cast(NetVio*) (vio_ssl);
net->vio = sslaccept(ssl_acceptor_fd, net->vio);
DBUG_PRINT("info", ("Reading user information over SSL layer"));
if ((pkt_len=my_net_read(net)) == packet_error ||
pkt_len < NORMAL_HANDSHAKE_SIZE)
......
......@@ -14,20 +14,12 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
INCLUDES = -I$(srcdir)/../include -I../include \
@OPENSSL_INCLUDES@
LDADD = libvio.la
pkglib_LTLIBRARIES = libvio.la
INCLUDES = -I$(srcdir)/../include -I../include $(openssl_includes)
LDADD = libvio.a $(openssl_libs)
pkglib_LIBRARIES = libvio.a
noinst_PROGRAMS =
noinst_HEADERS =
libvio_la_SOURCES = \
Vio.cc VioAcceptorFd.cc \
VioConnectorFd.cc VioFd.cc \
VioHandle.cc VioSSL.cc \
VioSSLFactoriesFd.cc VioSocket.cc \
auto.cc hostnamexx.cc \
vdbug.cc version.cc \
vmem.cc violitexx.cc
libvio_a_SOURCES = vio.c viosocket.c viossl.c viosslfactories.c
OMIT_DEPENDENCIES = pthread.h stdio.h __stdio.h stdlib.h __stdlib.h math.h\
__math.h time.h __time.h unistd.h __unistd.h types.h \
......
......@@ -23,10 +23,11 @@
#define DONT_MAP_VIO
#include <global.h>
#include <mysql_com.h>
#include <violite.h>
#include <errno.h>
#include <assert.h>
#include <vio.h>
#include <my_sys.h>
#include <my_net.h>
#include <m_string.h>
......@@ -58,14 +59,14 @@
/*
* Helper to fill most of the st_vio* with defaults.
* Helper to fill most of the Vio* with defaults.
*/
void vio_reset(st_vio* vio, enum enum_vio_type type,
void vio_reset(Vio* vio, enum enum_vio_type type,
my_socket sd, HANDLE hPipe,
my_bool localhost)
{
bzero((char*) vio, sizeof(st_vio));
bzero((char*) vio, sizeof(Vio));
vio->type = type;
vio->sd = sd;
vio->hPipe = hPipe;
......@@ -102,12 +103,12 @@ if(type == VIO_TYPE_SSL){
/* Open the socket or TCP/IP connection and read the fnctl() status */
st_vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost)
Vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost)
{
st_vio *vio;
Vio *vio;
DBUG_ENTER("vio_new");
DBUG_PRINT("enter", ("sd=%d", sd));
if ((vio = (st_vio*) my_malloc(sizeof(*vio),MYF(MY_WME))))
if ((vio = (Vio*) my_malloc(sizeof(*vio),MYF(MY_WME))))
{
vio_reset(vio, type, sd, 0, localhost);
sprintf(vio->desc,
......@@ -134,11 +135,11 @@ st_vio *vio_new(my_socket sd, enum enum_vio_type type, my_bool localhost)
#ifdef __WIN__
st_vio *vio_new_win32pipe(HANDLE hPipe)
Vio *vio_new_win32pipe(HANDLE hPipe)
{
st_vio *vio;
Vio *vio;
DBUG_ENTER("vio_new_handle");
if ((vio = (st_vio*) my_malloc(sizeof(st_vio),MYF(MY_WME))))
if ((vio = (Vio*) my_malloc(sizeof(Vio),MYF(MY_WME))))
{
vio_reset(vio, VIO_TYPE_NAMEDPIPE, 0, hPipe, TRUE);
strmov(vio->desc, "named pipe");
......
......@@ -24,10 +24,11 @@
#define DONT_MAP_VIO
#include <global.h>
#include <mysql_com.h>
#include <errno.h>
#include <assert.h>
#include <vio.h>
#include <violite.h>
#include <my_sys.h>
#include <my_net.h>
#include <m_string.h>
......@@ -61,7 +62,7 @@
#define HANDLE void *
#endif
void vio_delete(st_vio* vio)
void vio_delete(Vio* vio)
{
/* It must be safe to delete null pointers. */
/* This matches the semantics of C++'s delete operator. */
......@@ -73,13 +74,13 @@ void vio_delete(st_vio* vio)
}
}
int vio_errno(st_vio *vio __attribute__((unused)))
int vio_errno(Vio *vio __attribute__((unused)))
{
return errno; /* On Win32 this mapped to WSAGetLastError() */
}
int vio_read(st_vio * vio, gptr buf, int size)
int vio_read(Vio * vio, gptr buf, int size)
{
int r;
DBUG_ENTER("vio_read");
......@@ -108,7 +109,7 @@ int vio_read(st_vio * vio, gptr buf, int size)
}
int vio_write(st_vio * vio, const gptr buf, int size)
int vio_write(Vio * vio, const gptr buf, int size)
{
int r;
DBUG_ENTER("vio_write");
......@@ -136,7 +137,7 @@ int vio_write(st_vio * vio, const gptr buf, int size)
}
int vio_blocking(st_vio * vio, my_bool set_blocking_mode)
int vio_blocking(Vio * vio, my_bool set_blocking_mode)
{
int r=0;
DBUG_ENTER("vio_blocking");
......@@ -181,7 +182,7 @@ int vio_blocking(st_vio * vio, my_bool set_blocking_mode)
}
my_bool
vio_is_blocking(st_vio * vio)
vio_is_blocking(Vio * vio)
{
my_bool r;
DBUG_ENTER("vio_is_blocking");
......@@ -191,7 +192,7 @@ vio_is_blocking(st_vio * vio)
}
int vio_fastsend(st_vio * vio __attribute__((unused)))
int vio_fastsend(Vio * vio __attribute__((unused)))
{
int r=0;
DBUG_ENTER("vio_fastsend");
......@@ -217,7 +218,7 @@ int vio_fastsend(st_vio * vio __attribute__((unused)))
DBUG_RETURN(r);
}
int vio_keepalive(st_vio* vio, my_bool set_keep_alive)
int vio_keepalive(Vio* vio, my_bool set_keep_alive)
{
int r=0;
uint opt = 0;
......@@ -236,14 +237,14 @@ int vio_keepalive(st_vio* vio, my_bool set_keep_alive)
my_bool
vio_should_retry(st_vio * vio __attribute__((unused)))
vio_should_retry(Vio * vio __attribute__((unused)))
{
int en = errno;
return en == EAGAIN || en == EINTR || en == EWOULDBLOCK;
}
int vio_close(st_vio * vio)
int vio_close(Vio * vio)
{
int r;
DBUG_ENTER("vio_close");
......@@ -276,23 +277,23 @@ int vio_close(st_vio * vio)
}
const char *vio_description(st_vio * vio)
const char *vio_description(Vio * vio)
{
return vio->desc;
}
enum enum_vio_type vio_type(st_vio* vio)
enum enum_vio_type vio_type(Vio* vio)
{
return vio->type;
}
my_socket vio_fd(st_vio* vio)
my_socket vio_fd(Vio* vio)
{
return vio->sd;
}
my_bool vio_peer_addr(st_vio * vio, char *buf)
my_bool vio_peer_addr(Vio * vio, char *buf)
{
DBUG_ENTER("vio_peer_addr");
DBUG_PRINT("enter", ("sd=%d", vio->sd));
......@@ -317,7 +318,7 @@ my_bool vio_peer_addr(st_vio * vio, char *buf)
}
void vio_in_addr(st_vio *vio, struct in_addr *in)
void vio_in_addr(Vio *vio, struct in_addr *in)
{
DBUG_ENTER("vio_in_addr");
if (vio->localhost)
......@@ -330,7 +331,7 @@ void vio_in_addr(st_vio *vio, struct in_addr *in)
/* Return 0 if there is data to be read */
my_bool vio_poll_read(st_vio *vio,uint timeout)
my_bool vio_poll_read(Vio *vio,uint timeout)
{
#ifndef HAVE_POLL
return 0;
......
......@@ -23,10 +23,11 @@
*/
#include <global.h>
#include <mysql_com.h>
#include <errno.h>
#include <assert.h>
#include <vio.h>
#include <violite.h>
#include <my_sys.h>
#include <my_net.h>
#include <m_string.h>
......@@ -62,7 +63,7 @@
#ifdef HAVE_OPENSSL
void vio_ssl_delete(st_vio * vio)
void vio_ssl_delete(Vio * vio)
{
/* It must be safe to delete null pointers. */
/* This matches the semantics of C++'s delete operator. */
......@@ -74,13 +75,13 @@ void vio_ssl_delete(st_vio * vio)
}
}
int vio_ssl_errno(st_vio *vio __attribute__((unused)))
int vio_ssl_errno(Vio *vio __attribute__((unused)))
{
return errno; /* On Win32 this mapped to WSAGetLastError() */
}
int vio_ssl_read(st_vio * vio, gptr buf, int size)
int vio_ssl_read(Vio * vio, gptr buf, int size)
{
int r;
DBUG_ENTER("vio_ssl_read");
......@@ -96,7 +97,7 @@ int vio_ssl_read(st_vio * vio, gptr buf, int size)
}
int vio_ssl_write(st_vio * vio, const gptr buf, int size)
int vio_ssl_write(Vio * vio, const gptr buf, int size)
{
int r;
DBUG_ENTER("vio_ssl_write");
......@@ -112,7 +113,7 @@ int vio_ssl_write(st_vio * vio, const gptr buf, int size)
}
int vio_ssl_fastsend(st_vio * vio __attribute__((unused)))
int vio_ssl_fastsend(Vio * vio __attribute__((unused)))
{
int r=0;
DBUG_ENTER("vio_ssl_fastsend");
......@@ -138,7 +139,7 @@ int vio_ssl_fastsend(st_vio * vio __attribute__((unused)))
DBUG_RETURN(r);
}
int vio_ssl_keepalive(st_vio* vio, my_bool set_keep_alive)
int vio_ssl_keepalive(Vio* vio, my_bool set_keep_alive)
{
int r=0;
uint opt = 0;
......@@ -157,14 +158,14 @@ int vio_ssl_keepalive(st_vio* vio, my_bool set_keep_alive)
my_bool
vio_ssl_should_retry(st_vio * vio __attribute__((unused)))
vio_ssl_should_retry(Vio * vio __attribute__((unused)))
{
int en = errno;
return en == EAGAIN || en == EINTR || en == EWOULDBLOCK;
}
int vio_ssl_close(st_vio * vio)
int vio_ssl_close(Vio * vio)
{
int r;
DBUG_ENTER("vio_ssl_close");
......@@ -191,23 +192,23 @@ int vio_ssl_close(st_vio * vio)
}
const char *vio_ssl_description(st_vio * vio)
const char *vio_ssl_description(Vio * vio)
{
return vio->desc;
}
enum enum_vio_type vio_ssl_type(st_vio* vio)
enum enum_vio_type vio_ssl_type(Vio* vio)
{
return vio->type;
}
my_socket vio_ssl_fd(st_vio* vio)
my_socket vio_ssl_fd(Vio* vio)
{
return vio->sd;
}
my_bool vio_ssl_peer_addr(st_vio * vio, char *buf)
my_bool vio_ssl_peer_addr(Vio * vio, char *buf)
{
DBUG_ENTER("vio_ssl_peer_addr");
DBUG_PRINT("enter", ("sd=%d", vio->sd));
......@@ -232,7 +233,7 @@ my_bool vio_ssl_peer_addr(st_vio * vio, char *buf)
}
void vio_ssl_in_addr(st_vio *vio, struct in_addr *in)
void vio_ssl_in_addr(Vio *vio, struct in_addr *in)
{
DBUG_ENTER("vio_ssl_in_addr");
if (vio->localhost)
......@@ -245,7 +246,7 @@ void vio_ssl_in_addr(st_vio *vio, struct in_addr *in)
/* Return 0 if there is data to be read */
my_bool vio_ssl_poll_read(st_vio *vio,uint timeout)
my_bool vio_ssl_poll_read(Vio *vio,uint timeout)
{
#ifndef HAVE_POLL
return 0;
......@@ -286,7 +287,7 @@ report_errors()
/* FIXME: There are some duplicate code in
* sslaccept()/sslconnect() which maybe can be eliminated
*/
struct st_vio *sslaccept(struct st_VioSSLAcceptorFd* ptr, struct st_vio* sd)
Vio *sslaccept(struct st_VioSSLAcceptorFd* ptr, Vio* sd)
{
DBUG_ENTER("sslaccept");
DBUG_PRINT("enter", ("sd=%s ptr=%p", sd->desc,ptr));
......@@ -319,7 +320,7 @@ struct st_vio *sslaccept(struct st_VioSSLAcceptorFd* ptr, struct st_vio* sd)
DBUG_RETURN(sd);
}
struct st_vio *sslconnect(struct st_VioSSLConnectorFd* ptr, struct st_vio* sd)
Vio *sslconnect(struct st_VioSSLConnectorFd* ptr, Vio* sd)
{
DBUG_ENTER("sslconnect");
DBUG_PRINT("enter", ("sd=%s ptr=%p ctx: %p", sd->desc,ptr,ptr->ssl_context_));
......
......@@ -2,7 +2,8 @@
#include <global.h>
#include <my_sys.h>
#include <vio.h>
#include <mysql_com.h>
#include <violite.h>
#ifdef HAVE_OPENSSL
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment