Rename GWPROTOCOL to MXS_PROTOCOL
This commit is contained in:
@ -236,7 +236,7 @@ typedef struct dcb
|
|||||||
size_t protocol_bytes_processed; /**< How many bytes of a packet have been read */
|
size_t protocol_bytes_processed; /**< How many bytes of a packet have been read */
|
||||||
struct session *session; /**< The owning session */
|
struct session *session; /**< The owning session */
|
||||||
struct servlistener *listener; /**< For a client DCB, the listener data */
|
struct servlistener *listener; /**< For a client DCB, the listener data */
|
||||||
GWPROTOCOL func; /**< The protocol functions for this descriptor */
|
MXS_PROTOCOL func; /**< The protocol functions for this descriptor */
|
||||||
GWAUTHENTICATOR authfunc; /**< The authenticator functions for this descriptor */
|
GWAUTHENTICATOR authfunc; /**< The authenticator functions for this descriptor */
|
||||||
|
|
||||||
int writeqlen; /**< Current number of byes in the write queue */
|
int writeqlen; /**< Current number of byes in the write queue */
|
||||||
|
@ -15,16 +15,7 @@
|
|||||||
/**
|
/**
|
||||||
* @file protocol.h
|
* @file protocol.h
|
||||||
*
|
*
|
||||||
* The listener definitions for MaxScale
|
* The protocol module interface definition.
|
||||||
*
|
|
||||||
* @verbatim
|
|
||||||
* Revision History
|
|
||||||
*
|
|
||||||
* Date Who Description
|
|
||||||
* 22/01/16 Martin Brampton Initial implementation
|
|
||||||
* 31/05/16 Martin Brampton Add API entry for connection limit
|
|
||||||
*
|
|
||||||
* @endverbatim
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <maxscale/cdefs.h>
|
#include <maxscale/cdefs.h>
|
||||||
@ -59,7 +50,7 @@ struct session;
|
|||||||
*
|
*
|
||||||
* @see load_module
|
* @see load_module
|
||||||
*/
|
*/
|
||||||
typedef struct gw_protocol
|
typedef struct mxs_protocol
|
||||||
{
|
{
|
||||||
int (*read)(struct dcb *);
|
int (*read)(struct dcb *);
|
||||||
int (*write)(struct dcb *, GWBUF *);
|
int (*write)(struct dcb *, GWBUF *);
|
||||||
@ -74,13 +65,13 @@ typedef struct gw_protocol
|
|||||||
int (*session)(struct dcb *, void *);
|
int (*session)(struct dcb *, void *);
|
||||||
char *(*auth_default)();
|
char *(*auth_default)();
|
||||||
int (*connlimit)(struct dcb *, int limit);
|
int (*connlimit)(struct dcb *, int limit);
|
||||||
} GWPROTOCOL;
|
} MXS_PROTOCOL;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The GWPROTOCOL version data. The following should be updated whenever
|
* The MXS_PROTOCOL version data. The following should be updated whenever
|
||||||
* the GWPROTOCOL structure is changed. See the rules defined in modinfo.h
|
* the MXS_PROTOCOL structure is changed. See the rules defined in modinfo.h
|
||||||
* that define how these numbers should change.
|
* that define how these numbers should change.
|
||||||
*/
|
*/
|
||||||
#define GWPROTOCOL_VERSION {1, 1, 0}
|
#define MXS_PROTOCOL_VERSION {1, 1, 0}
|
||||||
|
|
||||||
MXS_END_DECLS
|
MXS_END_DECLS
|
||||||
|
@ -92,7 +92,7 @@ bool authenticator_init(void** dest, const char *authenticator, const char *opti
|
|||||||
const char* get_default_authenticator(const char *protocol)
|
const char* get_default_authenticator(const char *protocol)
|
||||||
{
|
{
|
||||||
char *rval = NULL;
|
char *rval = NULL;
|
||||||
GWPROTOCOL *protofuncs = (GWPROTOCOL*)load_module(protocol, MODULE_PROTOCOL);
|
MXS_PROTOCOL *protofuncs = (MXS_PROTOCOL*)load_module(protocol, MODULE_PROTOCOL);
|
||||||
|
|
||||||
if (protofuncs && protofuncs->auth_default)
|
if (protofuncs && protofuncs->auth_default)
|
||||||
{
|
{
|
||||||
|
@ -637,7 +637,7 @@ DCB *
|
|||||||
dcb_connect(SERVER *server, SESSION *session, const char *protocol)
|
dcb_connect(SERVER *server, SESSION *session, const char *protocol)
|
||||||
{
|
{
|
||||||
DCB *dcb;
|
DCB *dcb;
|
||||||
GWPROTOCOL *funcs;
|
MXS_PROTOCOL *funcs;
|
||||||
int fd;
|
int fd;
|
||||||
int rc;
|
int rc;
|
||||||
const char *user;
|
const char *user;
|
||||||
@ -679,7 +679,7 @@ dcb_connect(SERVER *server, SESSION *session, const char *protocol)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((funcs = (GWPROTOCOL *)load_module(protocol,
|
if ((funcs = (MXS_PROTOCOL *)load_module(protocol,
|
||||||
MODULE_PROTOCOL)) == NULL)
|
MODULE_PROTOCOL)) == NULL)
|
||||||
{
|
{
|
||||||
dcb->state = DCB_STATE_DISCONNECTED;
|
dcb->state = DCB_STATE_DISCONNECTED;
|
||||||
@ -689,7 +689,7 @@ dcb_connect(SERVER *server, SESSION *session, const char *protocol)
|
|||||||
dcb);
|
dcb);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
memcpy(&(dcb->func), funcs, sizeof(GWPROTOCOL));
|
memcpy(&(dcb->func), funcs, sizeof(MXS_PROTOCOL));
|
||||||
dcb->protoname = MXS_STRDUP_A(protocol);
|
dcb->protoname = MXS_STRDUP_A(protocol);
|
||||||
|
|
||||||
const char *authenticator = server->authenticator ?
|
const char *authenticator = server->authenticator ?
|
||||||
@ -2915,7 +2915,7 @@ DCB *
|
|||||||
dcb_accept(DCB *listener)
|
dcb_accept(DCB *listener)
|
||||||
{
|
{
|
||||||
DCB *client_dcb = NULL;
|
DCB *client_dcb = NULL;
|
||||||
GWPROTOCOL *protocol_funcs = &listener->func;
|
MXS_PROTOCOL *protocol_funcs = &listener->func;
|
||||||
int c_sock;
|
int c_sock;
|
||||||
int sendbuf;
|
int sendbuf;
|
||||||
struct sockaddr_storage client_conn;
|
struct sockaddr_storage client_conn;
|
||||||
@ -2987,7 +2987,7 @@ dcb_accept(DCB *listener)
|
|||||||
INET_ADDRSTRLEN);
|
INET_ADDRSTRLEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
memcpy(&client_dcb->func, protocol_funcs, sizeof(GWPROTOCOL));
|
memcpy(&client_dcb->func, protocol_funcs, sizeof(MXS_PROTOCOL));
|
||||||
if (listener->listener->authenticator)
|
if (listener->listener->authenticator)
|
||||||
{
|
{
|
||||||
authenticator_name = listener->listener->authenticator;
|
authenticator_name = listener->listener->authenticator;
|
||||||
|
@ -237,7 +237,7 @@ serviceStartPort(SERVICE *service, SERV_LISTENER *port)
|
|||||||
size_t config_bind_len =
|
size_t config_bind_len =
|
||||||
(port->address ? strlen(port->address) : ANY_IPV4_ADDRESS_LEN) + 1 + UINTLEN(port->port);
|
(port->address ? strlen(port->address) : ANY_IPV4_ADDRESS_LEN) + 1 + UINTLEN(port->port);
|
||||||
char config_bind[config_bind_len + 1]; // +1 for NULL
|
char config_bind[config_bind_len + 1]; // +1 for NULL
|
||||||
GWPROTOCOL *funcs;
|
MXS_PROTOCOL *funcs;
|
||||||
|
|
||||||
if (service == NULL || service->router == NULL || service->router_instance == NULL)
|
if (service == NULL || service->router == NULL || service->router_instance == NULL)
|
||||||
{
|
{
|
||||||
@ -264,7 +264,7 @@ serviceStartPort(SERVICE *service, SERV_LISTENER *port)
|
|||||||
listener_init_SSL(port->ssl);
|
listener_init_SSL(port->ssl);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((funcs = (GWPROTOCOL *)load_module(port->protocol, MODULE_PROTOCOL)) == NULL)
|
if ((funcs = (MXS_PROTOCOL *)load_module(port->protocol, MODULE_PROTOCOL)) == NULL)
|
||||||
{
|
{
|
||||||
MXS_ERROR("Unable to load protocol module %s. Listener for service %s not started.",
|
MXS_ERROR("Unable to load protocol module %s. Listener for service %s not started.",
|
||||||
port->protocol, service->name);
|
port->protocol, service->name);
|
||||||
@ -272,7 +272,7 @@ serviceStartPort(SERVICE *service, SERV_LISTENER *port)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&(port->listener->func), funcs, sizeof(GWPROTOCOL));
|
memcpy(&(port->listener->func), funcs, sizeof(MXS_PROTOCOL));
|
||||||
|
|
||||||
const char *authenticator_name = "NullAuthDeny";
|
const char *authenticator_name = "NullAuthDeny";
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ static char* cdc_default_auth()
|
|||||||
*/
|
*/
|
||||||
MXS_MODULE* MXS_CREATE_MODULE()
|
MXS_MODULE* MXS_CREATE_MODULE()
|
||||||
{
|
{
|
||||||
static GWPROTOCOL MyObject =
|
static MXS_PROTOCOL MyObject =
|
||||||
{
|
{
|
||||||
cdc_read_event, /* Read - EPOLLIN handler */
|
cdc_read_event, /* Read - EPOLLIN handler */
|
||||||
cdc_write, /* Write - data from gateway */
|
cdc_write, /* Write - data from gateway */
|
||||||
@ -90,7 +90,7 @@ MXS_MODULE* MXS_CREATE_MODULE()
|
|||||||
{
|
{
|
||||||
MXS_MODULE_API_PROTOCOL,
|
MXS_MODULE_API_PROTOCOL,
|
||||||
MXS_MODULE_IN_DEVELOPMENT,
|
MXS_MODULE_IN_DEVELOPMENT,
|
||||||
GWPROTOCOL_VERSION,
|
MXS_PROTOCOL_VERSION,
|
||||||
"A Change Data Capture Listener implementation for use in binlog events retrieval",
|
"A Change Data Capture Listener implementation for use in binlog events retrieval",
|
||||||
"V1.0.0"
|
"V1.0.0"
|
||||||
};
|
};
|
||||||
|
@ -65,7 +65,7 @@ static char *httpd_default_auth();
|
|||||||
*/
|
*/
|
||||||
MXS_MODULE* MXS_CREATE_MODULE()
|
MXS_MODULE* MXS_CREATE_MODULE()
|
||||||
{
|
{
|
||||||
static GWPROTOCOL MyObject =
|
static MXS_PROTOCOL MyObject =
|
||||||
{
|
{
|
||||||
httpd_read_event, /**< Read - EPOLLIN handler */
|
httpd_read_event, /**< Read - EPOLLIN handler */
|
||||||
httpd_write, /**< Write - data from gateway */
|
httpd_write, /**< Write - data from gateway */
|
||||||
@ -86,7 +86,7 @@ MXS_MODULE* MXS_CREATE_MODULE()
|
|||||||
{
|
{
|
||||||
MXS_MODULE_API_PROTOCOL,
|
MXS_MODULE_API_PROTOCOL,
|
||||||
MXS_MODULE_IN_DEVELOPMENT,
|
MXS_MODULE_IN_DEVELOPMENT,
|
||||||
GWPROTOCOL_VERSION,
|
MXS_PROTOCOL_VERSION,
|
||||||
"An experimental HTTPD implementation for use in administration",
|
"An experimental HTTPD implementation for use in administration",
|
||||||
"V1.2.0",
|
"V1.2.0",
|
||||||
&MyObject
|
&MyObject
|
||||||
|
@ -87,7 +87,7 @@ static int gw_send_change_user_to_backend(char *dbname,
|
|||||||
*/
|
*/
|
||||||
MXS_MODULE* MXS_CREATE_MODULE()
|
MXS_MODULE* MXS_CREATE_MODULE()
|
||||||
{
|
{
|
||||||
static GWPROTOCOL MyObject =
|
static MXS_PROTOCOL MyObject =
|
||||||
{
|
{
|
||||||
gw_read_backend_event, /* Read - EPOLLIN handler */
|
gw_read_backend_event, /* Read - EPOLLIN handler */
|
||||||
gw_MySQLWrite_backend, /* Write - data from gateway */
|
gw_MySQLWrite_backend, /* Write - data from gateway */
|
||||||
@ -108,7 +108,7 @@ MXS_MODULE* MXS_CREATE_MODULE()
|
|||||||
{
|
{
|
||||||
MXS_MODULE_API_PROTOCOL,
|
MXS_MODULE_API_PROTOCOL,
|
||||||
MXS_MODULE_GA,
|
MXS_MODULE_GA,
|
||||||
GWPROTOCOL_VERSION,
|
MXS_PROTOCOL_VERSION,
|
||||||
"The MySQL to backend server protocol",
|
"The MySQL to backend server protocol",
|
||||||
"V2.0.0",
|
"V2.0.0",
|
||||||
&MyObject
|
&MyObject
|
||||||
|
@ -95,7 +95,7 @@ static void gw_process_one_new_client(DCB *client_dcb);
|
|||||||
*/
|
*/
|
||||||
MXS_MODULE* MXS_CREATE_MODULE()
|
MXS_MODULE* MXS_CREATE_MODULE()
|
||||||
{
|
{
|
||||||
static GWPROTOCOL MyObject =
|
static MXS_PROTOCOL MyObject =
|
||||||
{
|
{
|
||||||
gw_read_client_event, /* Read - EPOLLIN handler */
|
gw_read_client_event, /* Read - EPOLLIN handler */
|
||||||
gw_MySQLWrite_client, /* Write - data from gateway */
|
gw_MySQLWrite_client, /* Write - data from gateway */
|
||||||
@ -116,7 +116,7 @@ MXS_MODULE* MXS_CREATE_MODULE()
|
|||||||
{
|
{
|
||||||
MXS_MODULE_API_PROTOCOL,
|
MXS_MODULE_API_PROTOCOL,
|
||||||
MXS_MODULE_GA,
|
MXS_MODULE_GA,
|
||||||
GWPROTOCOL_VERSION,
|
MXS_PROTOCOL_VERSION,
|
||||||
"The client to MaxScale MySQL protocol implementation",
|
"The client to MaxScale MySQL protocol implementation",
|
||||||
"V1.1.0",
|
"V1.1.0",
|
||||||
&MyObject
|
&MyObject
|
||||||
|
@ -168,7 +168,7 @@ MXS_MODULE* MXS_CREATE_MODULE()
|
|||||||
{
|
{
|
||||||
MXS_INFO("Initialise MaxScaled Protocol module.");
|
MXS_INFO("Initialise MaxScaled Protocol module.");
|
||||||
|
|
||||||
static GWPROTOCOL MyObject =
|
static MXS_PROTOCOL MyObject =
|
||||||
{
|
{
|
||||||
maxscaled_read_event, /**< Read - EPOLLIN handler */
|
maxscaled_read_event, /**< Read - EPOLLIN handler */
|
||||||
maxscaled_write, /**< Write - data from gateway */
|
maxscaled_write, /**< Write - data from gateway */
|
||||||
@ -189,7 +189,7 @@ MXS_MODULE* MXS_CREATE_MODULE()
|
|||||||
{
|
{
|
||||||
MXS_MODULE_API_PROTOCOL,
|
MXS_MODULE_API_PROTOCOL,
|
||||||
MXS_MODULE_GA,
|
MXS_MODULE_GA,
|
||||||
GWPROTOCOL_VERSION,
|
MXS_PROTOCOL_VERSION,
|
||||||
"A maxscale protocol for the administration interface",
|
"A maxscale protocol for the administration interface",
|
||||||
"V2.0.0",
|
"V2.0.0",
|
||||||
&MyObject
|
&MyObject
|
||||||
|
@ -85,7 +85,7 @@ MXS_MODULE* MXS_CREATE_MODULE()
|
|||||||
{
|
{
|
||||||
MXS_INFO("Initialise Telnetd Protocol module.");
|
MXS_INFO("Initialise Telnetd Protocol module.");
|
||||||
|
|
||||||
static GWPROTOCOL MyObject =
|
static MXS_PROTOCOL MyObject =
|
||||||
{
|
{
|
||||||
telnetd_read_event, /**< Read - EPOLLIN handler */
|
telnetd_read_event, /**< Read - EPOLLIN handler */
|
||||||
telnetd_write, /**< Write - data from gateway */
|
telnetd_write, /**< Write - data from gateway */
|
||||||
@ -106,7 +106,7 @@ MXS_MODULE* MXS_CREATE_MODULE()
|
|||||||
{
|
{
|
||||||
MXS_MODULE_API_PROTOCOL,
|
MXS_MODULE_API_PROTOCOL,
|
||||||
MXS_MODULE_GA,
|
MXS_MODULE_GA,
|
||||||
GWPROTOCOL_VERSION,
|
MXS_PROTOCOL_VERSION,
|
||||||
"A telnet deamon protocol for simple administration interface",
|
"A telnet deamon protocol for simple administration interface",
|
||||||
"V1.1.1",
|
"V1.1.1",
|
||||||
&MyObject
|
&MyObject
|
||||||
|
@ -54,7 +54,7 @@ static int test_connection_limit(DCB *dcb, int limit){return 0;}
|
|||||||
*/
|
*/
|
||||||
MXS_MODULE* MXS_CREATE_MODULE()
|
MXS_MODULE* MXS_CREATE_MODULE()
|
||||||
{
|
{
|
||||||
static GWPROTOCOL MyObject =
|
static MXS_PROTOCOL MyObject =
|
||||||
{
|
{
|
||||||
test_read, /**< Read - EPOLLIN handler */
|
test_read, /**< Read - EPOLLIN handler */
|
||||||
test_write, /**< Write - data from gateway */
|
test_write, /**< Write - data from gateway */
|
||||||
@ -75,7 +75,7 @@ MXS_MODULE* MXS_CREATE_MODULE()
|
|||||||
{
|
{
|
||||||
MXS_MODULE_API_PROTOCOL,
|
MXS_MODULE_API_PROTOCOL,
|
||||||
MXS_MODULE_IN_DEVELOPMENT,
|
MXS_MODULE_IN_DEVELOPMENT,
|
||||||
GWPROTOCOL_VERSION,
|
MXS_PROTOCOL_VERSION,
|
||||||
"Test protocol",
|
"Test protocol",
|
||||||
"V1.1.0",
|
"V1.1.0",
|
||||||
&MyObject
|
&MyObject
|
||||||
|
Reference in New Issue
Block a user