From 2abe956056d5e24680d2fa26d916dfaed8622cb7 Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Thu, 5 Jan 2017 10:28:24 +0200 Subject: [PATCH] Rename GWPROTOCOL to MXS_PROTOCOL --- include/maxscale/dcb.h | 2 +- include/maxscale/protocol.h | 21 ++++++------------- server/core/authenticator.c | 2 +- server/core/dcb.c | 10 ++++----- server/core/service.c | 6 +++--- server/modules/protocol/CDC/cdc.c | 4 ++-- server/modules/protocol/HTTPD/httpd.c | 4 ++-- .../MySQL/MySQLBackend/mysql_backend.c | 4 ++-- .../protocol/MySQL/MySQLClient/mysql_client.c | 4 ++-- server/modules/protocol/maxscaled/maxscaled.c | 4 ++-- server/modules/protocol/telnetd/telnetd.c | 4 ++-- .../protocol/testprotocol/testprotocol.c | 4 ++-- 12 files changed, 30 insertions(+), 39 deletions(-) diff --git a/include/maxscale/dcb.h b/include/maxscale/dcb.h index 444014203..973db409f 100644 --- a/include/maxscale/dcb.h +++ b/include/maxscale/dcb.h @@ -236,7 +236,7 @@ typedef struct dcb size_t protocol_bytes_processed; /**< How many bytes of a packet have been read */ struct session *session; /**< The owning session */ 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 */ int writeqlen; /**< Current number of byes in the write queue */ diff --git a/include/maxscale/protocol.h b/include/maxscale/protocol.h index e0f8b774e..91eb3b93c 100644 --- a/include/maxscale/protocol.h +++ b/include/maxscale/protocol.h @@ -15,16 +15,7 @@ /** * @file protocol.h * - * The listener definitions for MaxScale - * - * @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 + * The protocol module interface definition. */ #include @@ -59,7 +50,7 @@ struct session; * * @see load_module */ -typedef struct gw_protocol +typedef struct mxs_protocol { int (*read)(struct dcb *); int (*write)(struct dcb *, GWBUF *); @@ -74,13 +65,13 @@ typedef struct gw_protocol int (*session)(struct dcb *, void *); char *(*auth_default)(); int (*connlimit)(struct dcb *, int limit); -} GWPROTOCOL; +} MXS_PROTOCOL; /** - * The GWPROTOCOL version data. The following should be updated whenever - * the GWPROTOCOL structure is changed. See the rules defined in modinfo.h + * The MXS_PROTOCOL version data. The following should be updated whenever + * the MXS_PROTOCOL structure is changed. See the rules defined in modinfo.h * that define how these numbers should change. */ -#define GWPROTOCOL_VERSION {1, 1, 0} +#define MXS_PROTOCOL_VERSION {1, 1, 0} MXS_END_DECLS diff --git a/server/core/authenticator.c b/server/core/authenticator.c index 761103a1d..22d32cd28 100644 --- a/server/core/authenticator.c +++ b/server/core/authenticator.c @@ -92,7 +92,7 @@ bool authenticator_init(void** dest, const char *authenticator, const char *opti const char* get_default_authenticator(const char *protocol) { 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) { diff --git a/server/core/dcb.c b/server/core/dcb.c index 746a7e793..4ab16bc13 100644 --- a/server/core/dcb.c +++ b/server/core/dcb.c @@ -637,7 +637,7 @@ DCB * dcb_connect(SERVER *server, SESSION *session, const char *protocol) { DCB *dcb; - GWPROTOCOL *funcs; + MXS_PROTOCOL *funcs; int fd; int rc; const char *user; @@ -679,7 +679,7 @@ dcb_connect(SERVER *server, SESSION *session, const char *protocol) return NULL; } - if ((funcs = (GWPROTOCOL *)load_module(protocol, + if ((funcs = (MXS_PROTOCOL *)load_module(protocol, MODULE_PROTOCOL)) == NULL) { dcb->state = DCB_STATE_DISCONNECTED; @@ -689,7 +689,7 @@ dcb_connect(SERVER *server, SESSION *session, const char *protocol) dcb); return NULL; } - memcpy(&(dcb->func), funcs, sizeof(GWPROTOCOL)); + memcpy(&(dcb->func), funcs, sizeof(MXS_PROTOCOL)); dcb->protoname = MXS_STRDUP_A(protocol); const char *authenticator = server->authenticator ? @@ -2915,7 +2915,7 @@ DCB * dcb_accept(DCB *listener) { DCB *client_dcb = NULL; - GWPROTOCOL *protocol_funcs = &listener->func; + MXS_PROTOCOL *protocol_funcs = &listener->func; int c_sock; int sendbuf; struct sockaddr_storage client_conn; @@ -2987,7 +2987,7 @@ dcb_accept(DCB *listener) INET_ADDRSTRLEN); } } - memcpy(&client_dcb->func, protocol_funcs, sizeof(GWPROTOCOL)); + memcpy(&client_dcb->func, protocol_funcs, sizeof(MXS_PROTOCOL)); if (listener->listener->authenticator) { authenticator_name = listener->listener->authenticator; diff --git a/server/core/service.c b/server/core/service.c index e492ec5dd..63c56be99 100644 --- a/server/core/service.c +++ b/server/core/service.c @@ -237,7 +237,7 @@ serviceStartPort(SERVICE *service, SERV_LISTENER *port) size_t config_bind_len = (port->address ? strlen(port->address) : ANY_IPV4_ADDRESS_LEN) + 1 + UINTLEN(port->port); 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) { @@ -264,7 +264,7 @@ serviceStartPort(SERVICE *service, SERV_LISTENER *port) 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.", port->protocol, service->name); @@ -272,7 +272,7 @@ serviceStartPort(SERVICE *service, SERV_LISTENER *port) return 0; } - memcpy(&(port->listener->func), funcs, sizeof(GWPROTOCOL)); + memcpy(&(port->listener->func), funcs, sizeof(MXS_PROTOCOL)); const char *authenticator_name = "NullAuthDeny"; diff --git a/server/modules/protocol/CDC/cdc.c b/server/modules/protocol/CDC/cdc.c index 89c153dd7..ac5b6529e 100644 --- a/server/modules/protocol/CDC/cdc.c +++ b/server/modules/protocol/CDC/cdc.c @@ -70,7 +70,7 @@ static char* cdc_default_auth() */ MXS_MODULE* MXS_CREATE_MODULE() { - static GWPROTOCOL MyObject = + static MXS_PROTOCOL MyObject = { cdc_read_event, /* Read - EPOLLIN handler */ cdc_write, /* Write - data from gateway */ @@ -90,7 +90,7 @@ MXS_MODULE* MXS_CREATE_MODULE() { MXS_MODULE_API_PROTOCOL, MXS_MODULE_IN_DEVELOPMENT, - GWPROTOCOL_VERSION, + MXS_PROTOCOL_VERSION, "A Change Data Capture Listener implementation for use in binlog events retrieval", "V1.0.0" }; diff --git a/server/modules/protocol/HTTPD/httpd.c b/server/modules/protocol/HTTPD/httpd.c index d8fbe2838..04882ed22 100644 --- a/server/modules/protocol/HTTPD/httpd.c +++ b/server/modules/protocol/HTTPD/httpd.c @@ -65,7 +65,7 @@ static char *httpd_default_auth(); */ MXS_MODULE* MXS_CREATE_MODULE() { - static GWPROTOCOL MyObject = + static MXS_PROTOCOL MyObject = { httpd_read_event, /**< Read - EPOLLIN handler */ httpd_write, /**< Write - data from gateway */ @@ -86,7 +86,7 @@ MXS_MODULE* MXS_CREATE_MODULE() { MXS_MODULE_API_PROTOCOL, MXS_MODULE_IN_DEVELOPMENT, - GWPROTOCOL_VERSION, + MXS_PROTOCOL_VERSION, "An experimental HTTPD implementation for use in administration", "V1.2.0", &MyObject diff --git a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c index 83da73ccd..31e5efc7b 100644 --- a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c +++ b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c @@ -87,7 +87,7 @@ static int gw_send_change_user_to_backend(char *dbname, */ MXS_MODULE* MXS_CREATE_MODULE() { - static GWPROTOCOL MyObject = + static MXS_PROTOCOL MyObject = { gw_read_backend_event, /* Read - EPOLLIN handler */ gw_MySQLWrite_backend, /* Write - data from gateway */ @@ -108,7 +108,7 @@ MXS_MODULE* MXS_CREATE_MODULE() { MXS_MODULE_API_PROTOCOL, MXS_MODULE_GA, - GWPROTOCOL_VERSION, + MXS_PROTOCOL_VERSION, "The MySQL to backend server protocol", "V2.0.0", &MyObject diff --git a/server/modules/protocol/MySQL/MySQLClient/mysql_client.c b/server/modules/protocol/MySQL/MySQLClient/mysql_client.c index 1ab47f8cd..2ad2e41f5 100644 --- a/server/modules/protocol/MySQL/MySQLClient/mysql_client.c +++ b/server/modules/protocol/MySQL/MySQLClient/mysql_client.c @@ -95,7 +95,7 @@ static void gw_process_one_new_client(DCB *client_dcb); */ MXS_MODULE* MXS_CREATE_MODULE() { - static GWPROTOCOL MyObject = + static MXS_PROTOCOL MyObject = { gw_read_client_event, /* Read - EPOLLIN handler */ gw_MySQLWrite_client, /* Write - data from gateway */ @@ -116,7 +116,7 @@ MXS_MODULE* MXS_CREATE_MODULE() { MXS_MODULE_API_PROTOCOL, MXS_MODULE_GA, - GWPROTOCOL_VERSION, + MXS_PROTOCOL_VERSION, "The client to MaxScale MySQL protocol implementation", "V1.1.0", &MyObject diff --git a/server/modules/protocol/maxscaled/maxscaled.c b/server/modules/protocol/maxscaled/maxscaled.c index 4132f2887..e5665d0ec 100644 --- a/server/modules/protocol/maxscaled/maxscaled.c +++ b/server/modules/protocol/maxscaled/maxscaled.c @@ -168,7 +168,7 @@ MXS_MODULE* MXS_CREATE_MODULE() { MXS_INFO("Initialise MaxScaled Protocol module."); - static GWPROTOCOL MyObject = + static MXS_PROTOCOL MyObject = { maxscaled_read_event, /**< Read - EPOLLIN handler */ maxscaled_write, /**< Write - data from gateway */ @@ -189,7 +189,7 @@ MXS_MODULE* MXS_CREATE_MODULE() { MXS_MODULE_API_PROTOCOL, MXS_MODULE_GA, - GWPROTOCOL_VERSION, + MXS_PROTOCOL_VERSION, "A maxscale protocol for the administration interface", "V2.0.0", &MyObject diff --git a/server/modules/protocol/telnetd/telnetd.c b/server/modules/protocol/telnetd/telnetd.c index 197a5b648..3c2d292de 100644 --- a/server/modules/protocol/telnetd/telnetd.c +++ b/server/modules/protocol/telnetd/telnetd.c @@ -85,7 +85,7 @@ MXS_MODULE* MXS_CREATE_MODULE() { MXS_INFO("Initialise Telnetd Protocol module."); - static GWPROTOCOL MyObject = + static MXS_PROTOCOL MyObject = { telnetd_read_event, /**< Read - EPOLLIN handler */ telnetd_write, /**< Write - data from gateway */ @@ -106,7 +106,7 @@ MXS_MODULE* MXS_CREATE_MODULE() { MXS_MODULE_API_PROTOCOL, MXS_MODULE_GA, - GWPROTOCOL_VERSION, + MXS_PROTOCOL_VERSION, "A telnet deamon protocol for simple administration interface", "V1.1.1", &MyObject diff --git a/server/modules/protocol/testprotocol/testprotocol.c b/server/modules/protocol/testprotocol/testprotocol.c index e2e9c17f7..df2e0cbab 100644 --- a/server/modules/protocol/testprotocol/testprotocol.c +++ b/server/modules/protocol/testprotocol/testprotocol.c @@ -54,7 +54,7 @@ static int test_connection_limit(DCB *dcb, int limit){return 0;} */ MXS_MODULE* MXS_CREATE_MODULE() { - static GWPROTOCOL MyObject = + static MXS_PROTOCOL MyObject = { test_read, /**< Read - EPOLLIN handler */ test_write, /**< Write - data from gateway */ @@ -75,7 +75,7 @@ MXS_MODULE* MXS_CREATE_MODULE() { MXS_MODULE_API_PROTOCOL, MXS_MODULE_IN_DEVELOPMENT, - GWPROTOCOL_VERSION, + MXS_PROTOCOL_VERSION, "Test protocol", "V1.1.0", &MyObject