Commit these files, fixing bzr merge message

This commit is contained in:
Massimiliano Pinto
2013-06-14 17:35:14 +02:00
7 changed files with 409 additions and 15 deletions

View File

@ -22,28 +22,41 @@
#define MYSQL_SCRAMBLE_LEN GW_MYSQL_SCRAMBLE_SIZE
#endif
#define MYSQL_USER_MAXLEN 128
#define MYSQL_DATABASE_MAXLEN 128
struct dcb;
/*
* MySQL Protocol specific state data
*/
typedef struct {
int fd;
struct dcb *descriptor; /* The DCB of the socket we are running on */
int state; /* Current descriptor state */
char scramble[MYSQL_SCRAMBLE_LEN];
uint32_t server_capabilities; /* server capabilities */
uint32_t client_capabilities; /* client capabilities */
unsigned long tid; /* MySQL Thread ID */
int fd; / * The socket descriptor */
struct dcb *descriptor; /* The DCB of the socket we are running on */
int state; /* Current descriptor state */
char scramble[MYSQL_SCRAMBLE_LEN]; /* server scramble, created or received */
uint32_t server_capabilities; /* server capabilities, created or received */
uint32_t client_capabilities; /* client capabilities, created or received */
unsigned long tid; /* MySQL Thread ID, in handshake */
} MySQLProtocol;
/*
* MySQL session specific data
*
*/
typedef struct mysql_session {
uint8_t client_sha1[MYSQL_SCRAMBLE_LEN]; /* SHA1(passowrd) */
char user[MYSQL_USER_MAXLEN]; /* username */
char db[MYSQL_DATABASE_MAXLEN]; /* database */
} MYSQL_session;
/* MySQL Protocol States */
#define MYSQL_ALLOC 0 /* Allocate data */
#define MYSQL_AUTH_SENT 1 /* Authentication handshake has been sent */
#define MYSQL_AUTH_RECV 2 /* Received user, password, db and capabilities */
#define MYSQL_AUTH_FAILED 3 /* Auth failed, return error packet */
#define MYSQL_IDLE 4 /* Auth done. Protocol is idle, waiting for statements */
#define MYSQL_ROUTING 5
#define MYSQL_WAITING_RESULT 6
#define MYSQL_IDLE 4 /* Auth done. Protocol is idle, waiting for statements */
#define MYSQL_ROUTING 5 /* The received command has been routed to backend(s) */
#define MYSQL_WAITING_RESULT 6 /* Waiting for result set */
#endif

View File

@ -53,7 +53,7 @@ typedef void *ROUTER;
typedef struct {
ROUTER *(*createInstance)(SERVICE *service);
void *(*newSession)(ROUTER *instance, SESSION *session);
void (*closeSession)(ROUTER *instance, SESSION *session);
int (*routeQuery)(ROUTER *instance, SESSION *session, GWBUF *queue);
void (*closeSession)(ROUTER *instance, void *router_session);
int (*routeQuery)(ROUTER *instance, void *router_session, GWBUF *queue);
} ROUTER_OBJECT;
#endif

35
include/server.h Normal file
View File

@ -0,0 +1,35 @@
#ifndef _SERVER_H
#define _SERVER_H
/*
* This file is distributed as part of the SkySQL Gateway. It 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,
* version 2.
*
* 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., 51
* Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Copyright SkySQL Ab 2013
*/
/*
* The servER level definitions within the gateway
*
* Revision History
*
* Date Who Description
* 14/06/13 Mark Riddoch Initial implementation
*
*/
typedef struct server {
char *name; /* Server name/IP address*/
int port; /* Port to listen on */
struct server *next; /* Next service protocol */
} SERVER;
#endif

View File

@ -27,6 +27,7 @@ typedef struct session {
int state; /* Current descriptor state */
struct dcb *client; /* The client connection */
struct dcb *backends; /* The set of backend servers */
void *data; /* The session data */
} SESSION;
#define SESSION_STATE_ALLOC 0