Move module object inside MODULE_INFO

This allows modules to only expose one entry point with a consistent
signature. In the future, this could be used to implement declarations of
module parameters.
This commit is contained in:
Markus Mäkelä 2017-01-03 14:04:20 +02:00
parent 6c53999c97
commit ae0577c695
53 changed files with 1346 additions and 1483 deletions

View File

@ -326,7 +326,7 @@ typedef enum
void dcb_global_init();
int dcb_write(DCB *, GWBUF *);
DCB *dcb_accept(DCB *listener, GWPROTOCOL *protocol_funcs);
DCB *dcb_accept(DCB *listener);
DCB *dcb_alloc(dcb_role_t, struct servlistener *);
void dcb_free(DCB *);
void dcb_free_all_memory(DCB *dcb);

View File

@ -193,7 +193,7 @@ protected:
* The plugin function @c GetModuleObject is then implemented as follows:
*
* @code
* extern "C" FILTER_OBJECT *GetModuleObject()
* extern "C" MODULE_INFO* GetModuleObject()
* {
* return &MyFilter::s_object;
* };

View File

@ -86,6 +86,7 @@ typedef struct
MODULE_VERSION api_version;
const char *description;
const char *version;
void *module_object;
} MODULE_INFO;
MXS_END_DECLS

View File

@ -97,44 +97,39 @@ void qc_thread_end(void)
extern "C"
{
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
MODULE_INFO info =
MODULE_INFO* GetModuleObject()
{
MODULE_API_QUERY_CLASSIFIER,
MODULE_IN_DEVELOPMENT,
QUERY_CLASSIFIER_VERSION,
"Dummy Query Classifier",
"V1.0.0"
};
static QUERY_CLASSIFIER qc =
{
qc_init,
qc_end,
qc_thread_init,
qc_thread_end,
qc_parse,
qc_get_type,
qc_get_operation,
qc_get_created_table_name,
qc_is_drop_table_query,
qc_is_real_query,
qc_get_table_names,
NULL,
qc_query_has_clause,
qc_get_database_names,
qc_get_prepare_name,
qc_get_prepare_operation,
qc_get_field_info,
};
static QUERY_CLASSIFIER qc =
{
qc_init,
qc_end,
qc_thread_init,
qc_thread_end,
qc_parse,
qc_get_type,
qc_get_operation,
qc_get_created_table_name,
qc_is_drop_table_query,
qc_is_real_query,
qc_get_table_names,
NULL,
qc_query_has_clause,
qc_get_database_names,
qc_get_prepare_name,
qc_get_prepare_operation,
qc_get_field_info,
};
static MODULE_INFO info =
{
MODULE_API_QUERY_CLASSIFIER,
MODULE_IN_DEVELOPMENT,
QUERY_CLASSIFIER_VERSION,
"Dummy Query Classifier",
"V1.0.0",
&qc
};
QUERY_CLASSIFIER* GetModuleObject()
{
return &qc;
return &info;
}
/*lint +e14 */
}

View File

@ -2557,44 +2557,40 @@ void qc_thread_end(void)
extern "C"
{
static QUERY_CLASSIFIER qc =
MODULE_INFO* GetModuleObject()
{
qc_init,
qc_end,
qc_thread_init,
qc_thread_end,
qc_parse,
qc_get_type,
qc_get_operation,
qc_get_created_table_name,
qc_is_drop_table_query,
qc_is_real_query,
qc_get_table_names,
NULL,
qc_query_has_clause,
qc_get_database_names,
qc_get_prepare_name,
qc_get_prepare_operation,
qc_get_field_info,
};
static QUERY_CLASSIFIER qc =
{
qc_init,
qc_end,
qc_thread_init,
qc_thread_end,
qc_parse,
qc_get_type,
qc_get_operation,
qc_get_created_table_name,
qc_is_drop_table_query,
qc_is_real_query,
qc_get_table_names,
NULL,
qc_query_has_clause,
qc_get_database_names,
qc_get_prepare_name,
qc_get_prepare_operation,
qc_get_field_info,
};
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
MODULE_INFO info =
{
MODULE_API_QUERY_CLASSIFIER,
MODULE_IN_DEVELOPMENT,
QUERY_CLASSIFIER_VERSION,
"Query classifier based upon MySQL Embedded",
"V1.0.0"
};
static MODULE_INFO info =
{
MODULE_API_QUERY_CLASSIFIER,
MODULE_IN_DEVELOPMENT,
QUERY_CLASSIFIER_VERSION,
"Query classifier based upon MySQL Embedded",
"V1.0.0",
&qc
};
QUERY_CLASSIFIER* GetModuleObject()
{
return &qc;
return &info;
}
/*lint +e14 */
}

View File

@ -3172,38 +3172,38 @@ void qc_sqlite_get_field_info(GWBUF* query, const QC_FIELD_INFO** infos, size_t*
* EXPORTS
*/
static QUERY_CLASSIFIER qc =
MODULE_INFO* GetModuleObject()
{
qc_sqlite_init,
qc_sqlite_end,
qc_sqlite_thread_init,
qc_sqlite_thread_end,
qc_sqlite_parse,
qc_sqlite_get_type,
qc_sqlite_get_operation,
qc_sqlite_get_created_table_name,
qc_sqlite_is_drop_table_query,
qc_sqlite_is_real_query,
qc_sqlite_get_table_names,
NULL,
qc_sqlite_query_has_clause,
qc_sqlite_get_database_names,
qc_sqlite_get_prepare_name,
qc_sqlite_get_prepare_operation,
qc_sqlite_get_field_info,
};
static QUERY_CLASSIFIER qc =
{
qc_sqlite_init,
qc_sqlite_end,
qc_sqlite_thread_init,
qc_sqlite_thread_end,
qc_sqlite_parse,
qc_sqlite_get_type,
qc_sqlite_get_operation,
qc_sqlite_get_created_table_name,
qc_sqlite_is_drop_table_query,
qc_sqlite_is_real_query,
qc_sqlite_get_table_names,
NULL,
qc_sqlite_query_has_clause,
qc_sqlite_get_database_names,
qc_sqlite_get_prepare_name,
qc_sqlite_get_prepare_operation,
qc_sqlite_get_field_info,
};
static MODULE_INFO info =
{
MODULE_API_QUERY_CLASSIFIER,
MODULE_BETA_RELEASE,
QUERY_CLASSIFIER_VERSION,
"Query classifier using sqlite.",
"V1.0.0",
&qc
};
MODULE_INFO info =
{
MODULE_API_QUERY_CLASSIFIER,
MODULE_BETA_RELEASE,
QUERY_CLASSIFIER_VERSION,
"Query classifier using sqlite.",
"V1.0.0"
};
QUERY_CLASSIFIER* GetModuleObject()
{
return &qc;
return &info;
}

View File

@ -2912,9 +2912,10 @@ int dcb_connect_SSL(DCB* dcb)
* @return DCB - The new client DCB for the new connection, or NULL if failed
*/
DCB *
dcb_accept(DCB *listener, GWPROTOCOL *protocol_funcs)
dcb_accept(DCB *listener)
{
DCB *client_dcb = NULL;
GWPROTOCOL *protocol_funcs = &listener->func;
int c_sock;
int sendbuf;
struct sockaddr_storage client_conn;

View File

@ -48,11 +48,10 @@
static MODULES *registered = NULL;
static MODULES *find_module(const char *module);
static void register_module(const char *module,
const char *type,
void *dlhandle,
void *modobj,
MODULE_INFO *info);
static MODULES* register_module(const char *module,
const char *type,
void *dlhandle,
MODULE_INFO *mod_info);
static void unregister_module(const char *module);
int module_create_feedback_report(GWBUF **buffer, MODULES *modules, FEEDBACK_CONF *cfg);
int do_http_post(GWBUF *buffer, void *cfg);
@ -94,6 +93,61 @@ WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp)
return realsize;
}
static bool check_module(MODULE_INFO *mod_info, const char *type, const char *module)
{
bool success = true;
if (strcmp(type, MODULE_PROTOCOL) == 0
&& mod_info->modapi != MODULE_API_PROTOCOL)
{
MXS_ERROR("Module '%s' does not implement the protocol API.", module);
success = false;
}
if (strcmp(type, MODULE_AUTHENTICATOR) == 0
&& mod_info->modapi != MODULE_API_AUTHENTICATOR)
{
MXS_ERROR("Module '%s' does not implement the authenticator API.", module);
success = false;
}
if (strcmp(type, MODULE_ROUTER) == 0
&& mod_info->modapi != MODULE_API_ROUTER)
{
MXS_ERROR("Module '%s' does not implement the router API.", module);
success = false;
}
if (strcmp(type, MODULE_MONITOR) == 0
&& mod_info->modapi != MODULE_API_MONITOR)
{
MXS_ERROR("Module '%s' does not implement the monitor API.", module);
success = false;
}
if (strcmp(type, MODULE_FILTER) == 0
&& mod_info->modapi != MODULE_API_FILTER)
{
MXS_ERROR("Module '%s' does not implement the filter API.", module);
success = false;
}
if (strcmp(type, MODULE_QUERY_CLASSIFIER) == 0
&& mod_info->modapi != MODULE_API_QUERY_CLASSIFIER)
{
MXS_ERROR("Module '%s' does not implement the query classifier API.", module);
success = false;
}
if (mod_info->version == NULL)
{
MXS_ERROR("Module '%s' does not define a version string", module);
success = false;
}
if (mod_info->module_object == NULL)
{
MXS_ERROR("Module '%s' does not define a module object", module);
success = false;
}
return success;
}
/**
* Load the dynamic library related to a gateway module. The routine
* will look for library files in the current directory,
@ -113,7 +167,6 @@ WriteMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp)
void *load_module(const char *module, const char *type)
{
ss_dassert(module && type);
void *modobj;
MODULES *mod;
if ((mod = find_module(module)) == NULL)
@ -130,95 +183,42 @@ void *load_module(const char *module, const char *type)
return NULL;
}
void *dlhandle;
void *dlhandle = dlopen(fname, RTLD_NOW | RTLD_LOCAL);
if ((dlhandle = dlopen(fname, RTLD_NOW | RTLD_LOCAL)) == NULL)
if (dlhandle == NULL)
{
MXS_ERROR("Unable to load library for module: "
"%s\n\n\t\t %s."
"\n\n",
module,
dlerror());
module, dlerror());
return NULL;
}
MODULE_INFO *mod_info = NULL;
void *sym;
void *sym = dlsym(dlhandle, "GetModuleObject");
if ((sym = dlsym(dlhandle, "info")) != NULL)
{
mod_info = sym;
bool fatal = false;
if (strcmp(type, MODULE_PROTOCOL) == 0
&& mod_info->modapi != MODULE_API_PROTOCOL)
{
MXS_ERROR("Module '%s' does not implement the protocol API.", module);
fatal = true;
}
if (strcmp(type, MODULE_AUTHENTICATOR) == 0
&& mod_info->modapi != MODULE_API_AUTHENTICATOR)
{
MXS_ERROR("Module '%s' does not implement the authenticator API.", module);
fatal = true;
}
if (strcmp(type, MODULE_ROUTER) == 0
&& mod_info->modapi != MODULE_API_ROUTER)
{
MXS_ERROR("Module '%s' does not implement the router API.", module);
fatal = true;
}
if (strcmp(type, MODULE_MONITOR) == 0
&& mod_info->modapi != MODULE_API_MONITOR)
{
MXS_ERROR("Module '%s' does not implement the monitor API.", module);
fatal = true;
}
if (strcmp(type, MODULE_FILTER) == 0
&& mod_info->modapi != MODULE_API_FILTER)
{
MXS_ERROR("Module '%s' does not implement the filter API.", module);
fatal = true;
}
if (strcmp(type, MODULE_QUERY_CLASSIFIER) == 0
&& mod_info->modapi != MODULE_API_QUERY_CLASSIFIER)
{
MXS_ERROR("Module '%s' does not implement the query classifier API.", module);
fatal = true;
}
if (fatal)
{
dlclose(dlhandle);
return NULL;
}
}
if ((sym = dlsym(dlhandle, "GetModuleObject")) == NULL)
if (sym == NULL)
{
MXS_ERROR("Expected entry point interface missing "
"from module: %s\n\t\t\t %s.",
module,
dlerror());
module, dlerror());
dlclose(dlhandle);
return NULL;
}
void *(*entry_point)() = sym;
modobj = entry_point();
MODULE_INFO *mod_info = entry_point();
if (!check_module(mod_info, type, module) ||
(mod = register_module(module, type, dlhandle, mod_info)) == NULL)
{
dlclose(dlhandle);
return NULL;
}
MXS_NOTICE("Loaded module %s: %s from %s", module, mod_info->version, fname);
register_module(module, type, dlhandle, modobj, mod_info);
}
else
{
/*
* The module is already loaded, get the entry points again and
* return a reference to the already loaded module.
*/
modobj = mod->modobj;
}
return modobj;
return mod->modobj;
}
/**
@ -281,13 +281,12 @@ find_module(const char *module)
* @param version The version string returned by the module
* @param modobj The module object
* @param mod_info The module information
* @return The new registered module or NULL on memory allocation failure
*/
static void
register_module(const char *module,
const char *type,
void *dlhandle,
void *modobj,
MODULE_INFO *mod_info)
static MODULES* register_module(const char *module,
const char *type,
void *dlhandle,
MODULE_INFO *mod_info)
{
module = MXS_STRDUP(module);
type = MXS_STRDUP(type);
@ -301,17 +300,18 @@ register_module(const char *module,
MXS_FREE((void*)type);
MXS_FREE(version);
MXS_FREE(mod);
return;
return NULL;
}
mod->module = (char*)module;
mod->type = (char*)type;
mod->handle = dlhandle;
mod->version = version;
mod->modobj = modobj;
mod->modobj = mod_info->module_object;
mod->next = registered;
mod->info = mod_info;
registered = mod;
return mod;
}
/**

View File

@ -42,15 +42,6 @@
const char CDC_USERS_FILENAME[] = "cdcusers";
MODULE_INFO info =
{
MODULE_API_AUTHENTICATOR,
MODULE_GA,
GWAUTHENTICATOR_VERSION,
"The CDC client to MaxScale authenticator implementation",
"V1.1.0"
};
static int cdc_auth_set_protocol_data(DCB *dcb, GWBUF *buf);
static bool cdc_auth_is_client_ssl_capable(DCB *dcb);
static int cdc_auth_authenticate(DCB *dcb);
@ -59,21 +50,6 @@ static void cdc_auth_free_client_data(DCB *dcb);
static int cdc_set_service_user(SERV_LISTENER *listener);
static int cdc_replace_users(SERV_LISTENER *listener);
/*
* The "module object" for mysql client authenticator module.
*/
static GWAUTHENTICATOR MyObject =
{
NULL, /* No initialize entry point */
NULL, /* No create entry point */
cdc_auth_set_protocol_data, /* Extract data into structure */
cdc_auth_is_client_ssl_capable, /* Check if client supports SSL */
cdc_auth_authenticate, /* Authenticate user credentials */
cdc_auth_free_client_data, /* Free the client data held in DCB */
NULL, /* No destroy entry point */
cdc_replace_users /* Load CDC users */
};
static int cdc_auth_check(
DCB *dcb,
CDC_protocol *protocol,
@ -167,9 +143,9 @@ static bool cdc_add_new_user(const MODULECMD_ARG *args)
*
* @return The module object
*/
GWAUTHENTICATOR* GetModuleObject()
MODULE_INFO* GetModuleObject()
{
modulecmd_arg_type_t args[] =
static modulecmd_arg_type_t args[] =
{
{ MODULECMD_ARG_SERVICE, "Service where the user is added"},
{ MODULECMD_ARG_STRING, "User to add"},
@ -177,7 +153,30 @@ GWAUTHENTICATOR* GetModuleObject()
};
modulecmd_register_command("cdc", "add_user", cdc_add_new_user, 3, args);
return &MyObject;
static GWAUTHENTICATOR MyObject =
{
NULL, /* No initialize entry point */
NULL, /* No create entry point */
cdc_auth_set_protocol_data, /* Extract data into structure */
cdc_auth_is_client_ssl_capable, /* Check if client supports SSL */
cdc_auth_authenticate, /* Authenticate user credentials */
cdc_auth_free_client_data, /* Free the client data held in DCB */
NULL, /* No destroy entry point */
cdc_replace_users /* Load CDC users */
};
static MODULE_INFO info =
{
MODULE_API_AUTHENTICATOR,
MODULE_GA,
GWAUTHENTICATOR_VERSION,
"The CDC client to MaxScale authenticator implementation",
"V1.1.0",
&MyObject
};
return &info;
}
/**

View File

@ -596,34 +596,32 @@ int gssapi_auth_load_users(SERV_LISTENER *listener)
return rval;
}
/**
* Implementation of the authenticator module interface
*/
static GWAUTHENTICATOR MyObject =
{
gssapi_auth_init, /* Initialize authenticator */
gssapi_auth_alloc, /* Allocate authenticator data */
gssapi_auth_extract, /* Extract data into structure */
gssapi_auth_connectssl, /* Check if client supports SSL */
gssapi_auth_authenticate, /* Authenticate user credentials */
gssapi_auth_free_data, /* Free the client data held in DCB */
gssapi_auth_free, /* Free authenticator data */
gssapi_auth_load_users /* Load database users */
};
MODULE_INFO info =
{
MODULE_API_AUTHENTICATOR,
MODULE_GA,
GWAUTHENTICATOR_VERSION,
"GSSAPI authenticator",
"V1.0.0"
};
/**
* Module handle entry point
*/
GWAUTHENTICATOR* GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static GWAUTHENTICATOR MyObject =
{
gssapi_auth_init, /* Initialize authenticator */
gssapi_auth_alloc, /* Allocate authenticator data */
gssapi_auth_extract, /* Extract data into structure */
gssapi_auth_connectssl, /* Check if client supports SSL */
gssapi_auth_authenticate, /* Authenticate user credentials */
gssapi_auth_free_data, /* Free the client data held in DCB */
gssapi_auth_free, /* Free authenticator data */
gssapi_auth_load_users /* Load database users */
};
static MODULE_INFO info =
{
MODULE_API_AUTHENTICATOR,
MODULE_GA,
GWAUTHENTICATOR_VERSION,
"GSSAPI authenticator",
"V1.0.0",
&MyObject
};
return &info;
}

View File

@ -260,34 +260,32 @@ static int gssapi_backend_auth_authenticate(DCB *dcb)
return rval;
}
/**
* Implementation of the authenticator module interface
*/
static GWAUTHENTICATOR MyObject =
{
NULL, /* No initialize entry point */
gssapi_backend_auth_alloc, /* Allocate authenticator data */
gssapi_backend_auth_extract, /* Extract data into structure */
gssapi_backend_auth_connectssl, /* Check if client supports SSL */
gssapi_backend_auth_authenticate, /* Authenticate user credentials */
NULL, /* Client plugin will free shared data */
gssapi_backend_auth_free, /* Free authenticator data */
NULL /* Load users from backend databases */
};
MODULE_INFO info =
{
MODULE_API_AUTHENTICATOR,
MODULE_GA,
GWAUTHENTICATOR_VERSION,
"GSSAPI backend authenticator",
"V1.0.0"
};
/**
* Module handle entry point
*/
GWAUTHENTICATOR* GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static GWAUTHENTICATOR MyObject =
{
NULL, /* No initialize entry point */
gssapi_backend_auth_alloc, /* Allocate authenticator data */
gssapi_backend_auth_extract, /* Extract data into structure */
gssapi_backend_auth_connectssl, /* Check if client supports SSL */
gssapi_backend_auth_authenticate, /* Authenticate user credentials */
NULL, /* Client plugin will free shared data */
gssapi_backend_auth_free, /* Free authenticator data */
NULL /* Load users from backend databases */
};
static MODULE_INFO info =
{
MODULE_API_AUTHENTICATOR,
MODULE_GA,
GWAUTHENTICATOR_VERSION,
"GSSAPI backend authenticator",
"V1.0.0",
&MyObject
};
return &info;
}

View File

@ -34,40 +34,11 @@
#include <maxscale/secrets.h>
#include <maxscale/users.h>
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
MODULE_INFO info =
{
MODULE_API_AUTHENTICATOR,
MODULE_GA,
GWAUTHENTICATOR_VERSION,
"The MaxScale HTTP BA authenticator",
"V1.1.0"
};
/*lint +e14 */
static int http_auth_set_protocol_data(DCB *dcb, GWBUF *buf);
static bool http_auth_is_client_ssl_capable(DCB *dcb);
static int http_auth_authenticate(DCB *dcb);
static void http_auth_free_client_data(DCB *dcb);
/*
* The "module object" for mysql client authenticator module.
*/
static GWAUTHENTICATOR MyObject =
{
NULL, /* No initialize entry point */
NULL, /* No create entry point */
http_auth_set_protocol_data, /* Extract data into structure */
http_auth_is_client_ssl_capable, /* Check if client supports SSL */
http_auth_authenticate, /* Authenticate user credentials */
http_auth_free_client_data, /* Free the client data held in DCB */
NULL, /* No destroy entry point */
users_default_loadusers /* Load generic users */
};
typedef struct http_auth
{
char* user;
@ -82,9 +53,31 @@ typedef struct http_auth
*
* @return The module object
*/
GWAUTHENTICATOR* GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static GWAUTHENTICATOR MyObject =
{
NULL, /* No initialize entry point */
NULL, /* No create entry point */
http_auth_set_protocol_data, /* Extract data into structure */
http_auth_is_client_ssl_capable, /* Check if client supports SSL */
http_auth_authenticate, /* Authenticate user credentials */
http_auth_free_client_data, /* Free the client data held in DCB */
NULL, /* No destroy entry point */
users_default_loadusers /* Load generic users */
};
static MODULE_INFO info =
{
MODULE_API_AUTHENTICATOR,
MODULE_GA,
GWAUTHENTICATOR_VERSION,
"The MaxScale HTTP BA authenticator",
"V1.1.0",
&MyObject
};
return &info;
}
/*lint +e14 */

View File

@ -34,40 +34,11 @@
#include <maxscale/adminusers.h>
#include <maxscale/users.h>
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
MODULE_INFO info =
{
MODULE_API_AUTHENTICATOR,
MODULE_GA,
GWAUTHENTICATOR_VERSION,
"The MaxScale Admin client authenticator implementation",
"V2.1.0"
};
/*lint +e14 */
static int max_admin_auth_set_protocol_data(DCB *dcb, GWBUF *buf);
static bool max_admin_auth_is_client_ssl_capable(DCB *dcb);
static int max_admin_auth_authenticate(DCB *dcb);
static void max_admin_auth_free_client_data(DCB *dcb);
/*
* The "module object" for mysql client authenticator module.
*/
static GWAUTHENTICATOR MyObject =
{
NULL, /* No initialize entry point */
NULL, /* No create entry point */
max_admin_auth_set_protocol_data, /* Extract data into structure */
max_admin_auth_is_client_ssl_capable, /* Check if client supports SSL */
max_admin_auth_authenticate, /* Authenticate user credentials */
max_admin_auth_free_client_data, /* Free the client data held in DCB */
NULL, /* No destroy entry point */
users_default_loadusers /* Load generic users */
};
/**
* The module entry point routine. It is this routine that
* must populate the structure that is referred to as the
@ -76,9 +47,31 @@ static GWAUTHENTICATOR MyObject =
*
* @return The module object
*/
GWAUTHENTICATOR* GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static GWAUTHENTICATOR MyObject =
{
NULL, /* No initialize entry point */
NULL, /* No create entry point */
max_admin_auth_set_protocol_data, /* Extract data into structure */
max_admin_auth_is_client_ssl_capable, /* Check if client supports SSL */
max_admin_auth_authenticate, /* Authenticate user credentials */
max_admin_auth_free_client_data, /* Free the client data held in DCB */
NULL, /* No destroy entry point */
users_default_loadusers /* Load generic users */
};
static MODULE_INFO info =
{
MODULE_API_AUTHENTICATOR,
MODULE_GA,
GWAUTHENTICATOR_VERSION,
"The MaxScale Admin client authenticator implementation",
"V2.1.0",
&MyObject
};
return &info;
}
/*lint +e14 */

View File

@ -42,21 +42,6 @@ typedef struct mysql_auth
bool skip_auth; /**< Authentication will always be successful */
} MYSQL_AUTH;
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
MODULE_INFO info =
{
MODULE_API_AUTHENTICATOR,
MODULE_GA,
GWAUTHENTICATOR_VERSION,
"The MySQL client to MaxScale authenticator implementation",
"V1.1.0"
};
/*lint +e14 */
static void* mysql_auth_init(char **options);
static int mysql_auth_set_protocol_data(DCB *dcb, GWBUF *buf);
static bool mysql_auth_is_client_ssl_capable(DCB *dcb);
@ -64,21 +49,6 @@ static int mysql_auth_authenticate(DCB *dcb);
static void mysql_auth_free_client_data(DCB *dcb);
static int mysql_auth_load_users(SERV_LISTENER *port);
/*
* The "module object" for mysql client authenticator module.
*/
static GWAUTHENTICATOR MyObject =
{
mysql_auth_init, /* Initialize the authenticator */
NULL, /* No create entry point */
mysql_auth_set_protocol_data, /* Extract data into structure */
mysql_auth_is_client_ssl_capable, /* Check if client supports SSL */
mysql_auth_authenticate, /* Authenticate user credentials */
mysql_auth_free_client_data, /* Free the client data held in DCB */
NULL, /* No destroy entry point */
mysql_auth_load_users /* Load users from backend databases */
};
static int combined_auth_check(
DCB *dcb,
uint8_t *auth_token,
@ -101,11 +71,32 @@ static int mysql_auth_set_client_data(
*
* @return The module object
*/
GWAUTHENTICATOR* GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static GWAUTHENTICATOR MyObject =
{
mysql_auth_init, /* Initialize the authenticator */
NULL, /* No create entry point */
mysql_auth_set_protocol_data, /* Extract data into structure */
mysql_auth_is_client_ssl_capable, /* Check if client supports SSL */
mysql_auth_authenticate, /* Authenticate user credentials */
mysql_auth_free_client_data, /* Free the client data held in DCB */
NULL, /* No destroy entry point */
mysql_auth_load_users /* Load users from backend databases */
};
static MODULE_INFO info =
{
MODULE_API_AUTHENTICATOR,
MODULE_GA,
GWAUTHENTICATOR_VERSION,
"The MySQL client to MaxScale authenticator implementation",
"V1.1.0",
&MyObject
};
return &info;
}
/*lint +e14 */
/**
* @brief Initialize the authenticator instance

View File

@ -148,35 +148,6 @@ static bool auth_backend_ssl(DCB *dcb)
return dcb->server->server_ssl != NULL;
}
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
MODULE_INFO info =
{
MODULE_API_AUTHENTICATOR,
MODULE_GA,
GWAUTHENTICATOR_VERSION,
"The MySQL MaxScale to backend server authenticator",
"V1.0.0"
};
/*lint +e14 */
/*
* The "module object" for mysql client authenticator module.
*/
static GWAUTHENTICATOR MyObject =
{
NULL, /* No initialize entry point */
auth_backend_create, /* Create authenticator */
auth_backend_extract, /* Extract data into structure */
auth_backend_ssl, /* Check if client supports SSL */
auth_backend_authenticate, /* Authenticate user credentials */
NULL, /* The shared data is freed by the client DCB */
auth_backend_destroy, /* Destroy authenticator */
NULL /* We don't need to load users */
};
/**
* The module entry point routine. It is this routine that
* must populate the structure that is referred to as the
@ -185,8 +156,30 @@ static GWAUTHENTICATOR MyObject =
*
* @return The module object
*/
GWAUTHENTICATOR* GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static GWAUTHENTICATOR MyObject =
{
NULL, /* No initialize entry point */
auth_backend_create, /* Create authenticator */
auth_backend_extract, /* Extract data into structure */
auth_backend_ssl, /* Check if client supports SSL */
auth_backend_authenticate, /* Authenticate user credentials */
NULL, /* The shared data is freed by the client DCB */
auth_backend_destroy, /* Destroy authenticator */
NULL /* We don't need to load users */
};
static MODULE_INFO info =
{
MODULE_API_AUTHENTICATOR,
MODULE_GA,
GWAUTHENTICATOR_VERSION,
"The MySQL MaxScale to backend server authenticator",
"V1.0.0",
&MyObject
};
return &info;
}
/*lint +e14 */

View File

@ -36,40 +36,11 @@
/** MXS-1026: Without MySQL protocol data structures, the NullAuth authenticator will crash. */
#include <maxscale/protocol/mysql.h>
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
MODULE_INFO info =
{
MODULE_API_AUTHENTICATOR,
MODULE_GA,
GWAUTHENTICATOR_VERSION,
"The Null client authenticator implementation",
"V1.1.0"
};
/*lint +e14 */
static int null_auth_set_protocol_data(DCB *dcb, GWBUF *buf);
static bool null_auth_is_client_ssl_capable(DCB *dcb);
static int null_auth_authenticate(DCB *dcb);
static void null_auth_free_client_data(DCB *dcb);
/*
* The "module object" for mysql client authenticator module.
*/
static GWAUTHENTICATOR MyObject =
{
NULL, /* No initialize entry point */
NULL, /* No create entry point */
null_auth_set_protocol_data, /* Extract data into structure */
null_auth_is_client_ssl_capable, /* Check if client supports SSL */
null_auth_authenticate, /* Authenticate user credentials */
null_auth_free_client_data, /* Free the client data held in DCB */
NULL, /* No destroy entry point */
users_default_loadusers /* Load generic users */
};
/**
* The module entry point routine. It is this routine that
* must populate the structure that is referred to as the
@ -78,9 +49,31 @@ static GWAUTHENTICATOR MyObject =
*
* @return The module object
*/
GWAUTHENTICATOR* GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static GWAUTHENTICATOR MyObject =
{
NULL, /* No initialize entry point */
NULL, /* No create entry point */
null_auth_set_protocol_data, /* Extract data into structure */
null_auth_is_client_ssl_capable, /* Check if client supports SSL */
null_auth_authenticate, /* Authenticate user credentials */
null_auth_free_client_data, /* Free the client data held in DCB */
NULL, /* No destroy entry point */
users_default_loadusers /* Load generic users */
};
static MODULE_INFO info =
{
MODULE_API_AUTHENTICATOR,
MODULE_GA,
GWAUTHENTICATOR_VERSION,
"The Null client authenticator implementation",
"V1.1.0",
&MyObject
};
return &info;
}
/*lint +e14 */

View File

@ -33,40 +33,11 @@
#include <maxscale/buffer.h>
#include <maxscale/users.h>
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
MODULE_INFO info =
{
MODULE_API_AUTHENTICATOR,
MODULE_GA,
GWAUTHENTICATOR_VERSION,
"The Null client authenticator implementation",
"V1.1.0"
};
/*lint +e14 */
static int null_auth_set_protocol_data(DCB *dcb, GWBUF *buf);
static bool null_auth_is_client_ssl_capable(DCB *dcb);
static int null_auth_authenticate(DCB *dcb);
static void null_auth_free_client_data(DCB *dcb);
/*
* The "module object" for mysql client authenticator module.
*/
static GWAUTHENTICATOR MyObject =
{
NULL, /* No initialize entry point */
NULL, /* No create entry point */
null_auth_set_protocol_data, /* Extract data into structure */
null_auth_is_client_ssl_capable, /* Check if client supports SSL */
null_auth_authenticate, /* Authenticate user credentials */
null_auth_free_client_data, /* Free the client data held in DCB */
NULL, /* No destroy entry point */
users_default_loadusers /* Load generic users */
};
/**
* The module entry point routine. It is this routine that
* must populate the structure that is referred to as the
@ -75,9 +46,31 @@ static GWAUTHENTICATOR MyObject =
*
* @return The module object
*/
GWAUTHENTICATOR* GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static GWAUTHENTICATOR MyObject =
{
NULL, /* No initialize entry point */
NULL, /* No create entry point */
null_auth_set_protocol_data, /* Extract data into structure */
null_auth_is_client_ssl_capable, /* Check if client supports SSL */
null_auth_authenticate, /* Authenticate user credentials */
null_auth_free_client_data, /* Free the client data held in DCB */
NULL, /* No destroy entry point */
users_default_loadusers /* Load generic users */
};
static MODULE_INFO info =
{
MODULE_API_AUTHENTICATOR,
MODULE_GA,
GWAUTHENTICATOR_VERSION,
"The Null client authenticator implementation",
"V1.1.0",
&MyObject
};
return &info;
}
/*lint +e14 */

View File

@ -193,16 +193,7 @@ bool config_get_uint64(const FILTER_PARAMETER& param, uint64_t* pValue)
// Global symbols of the Module
//
MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_IN_DEVELOPMENT,
FILTER_VERSION,
"A caching filter that is capable of caching and returning cached data.",
VERSION_STRING
};
extern "C" FILTER_OBJECT *GetModuleObject()
extern "C" MODULE_INFO* GetModuleObject()
{
static modulecmd_arg_type_t show_argv[] =
{
@ -214,7 +205,18 @@ extern "C" FILTER_OBJECT *GetModuleObject()
MXS_ARRAY_NELEMS(show_argv), show_argv);
MXS_NOTICE("Initialized cache module %s.\n", VERSION_STRING);
return &CacheFilter::s_object;
static MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_IN_DEVELOPMENT,
FILTER_VERSION,
"A caching filter that is capable of caching and returning cached data.",
VERSION_STRING,
&CacheFilter::s_object
};
return &info;
};
//

View File

@ -46,15 +46,6 @@
* @endverbatim
*/
MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_GA,
FILTER_VERSION,
"A routing hint filter that send queries to the master after data modification",
"V1.1.0"
};
static FILTER *createInstance(const char *name, char **options, FILTER_PARAMETER **params);
static void *newSession(FILTER *instance, SESSION *session);
static void closeSession(FILTER *instance, void *session);
@ -64,22 +55,6 @@ static int routeQuery(FILTER *instance, void *fsession, GWBUF *queue);
static void diagnostic(FILTER *instance, void *fsession, DCB *dcb);
static uint64_t getCapabilities(void);
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
NULL, // No Upstream requirement
routeQuery,
NULL, // No clientReply
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
#define CCR_DEFAULT_TIME 60
typedef struct lagstats
@ -124,10 +99,34 @@ typedef struct
*
* @return The module object
*/
FILTER_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
NULL, // No Upstream requirement
routeQuery,
NULL, // No clientReply
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
static MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_GA,
FILTER_VERSION,
"A routing hint filter that send queries to the master after data modification",
"V1.1.0",
&MyObject
};
return &info;
}
/**

View File

@ -91,15 +91,6 @@
int dbfw_yyparse(void*);
#endif
MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_GA,
FILTER_VERSION,
"Firewall Filter",
"V1.2.0"
};
/*
* The filter entry points
*/
@ -112,21 +103,6 @@ static int routeQuery(FILTER *instance, void *fsession, GWBUF *queue);
static void diagnostic(FILTER *instance, void *fsession, DCB *dcb);
static uint64_t getCapabilities(void);
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
NULL, // No setUpStream
routeQuery,
NULL, // No clientReply
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
/**
* Rule types
*/
@ -801,7 +777,7 @@ bool dbfw_show_rules(const MODULECMD_ARG *argv)
*
* @return The module object
*/
FILTER_OBJECT * GetModuleObject()
MODULE_INFO* GetModuleObject()
{
modulecmd_arg_type_t args_rules_reload[] =
{
@ -818,7 +794,33 @@ FILTER_OBJECT * GetModuleObject()
};
modulecmd_register_command("dbfwfilter", "rules", dbfw_show_rules, 2, args_rules_show);
return &MyObject;
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
NULL, // No setUpStream
routeQuery,
NULL, // No clientReply
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
static MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_GA,
FILTER_VERSION,
"Firewall Filter",
"V1.2.0",
&MyObject
};
return &info;
}
/**

View File

@ -23,15 +23,6 @@
*
*/
MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_ALPHA_RELEASE,
FILTER_VERSION,
"A hint parsing filter",
"V1.0.0"
};
static FILTER *createInstance(const char* name, char **options, FILTER_PARAMETER **params);
static void *newSession(FILTER *instance, SESSION *session);
static void closeSession(FILTER *instance, void *session);
@ -41,22 +32,6 @@ static int routeQuery(FILTER *instance, void *fsession, GWBUF *queue);
static void diagnostic(FILTER *instance, void *fsession, DCB *dcb);
static uint64_t getCapabilities(void);
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
NULL, // No upstream requirement
routeQuery,
NULL, // No clientReply
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
/**
* The module entry point routine. It is this routine that
* must populate the structure that is referred to as the
@ -65,10 +40,34 @@ static FILTER_OBJECT MyObject =
*
* @return The module object
*/
FILTER_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
NULL, // No upstream requirement
routeQuery,
NULL, // No clientReply
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
static MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_ALPHA_RELEASE,
FILTER_VERSION,
"A hint parsing filter",
"V1.0.0",
&MyObject
};
return &info;
}
/**

View File

@ -50,15 +50,6 @@
#include <maxscale/session.h>
#include <maxscale/spinlock.h>
MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_EXPERIMENTAL,
FILTER_VERSION,
"Lua Filter",
"V1.0.0"
};
/*
* The filter entry points
*/
@ -73,22 +64,6 @@ static int clientReply(FILTER *instance, void *fsession, GWBUF *queue);
static void diagnostic(FILTER *instance, void *fsession, DCB *dcb);
static uint64_t getCapabilities(void);
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
setUpstream,
routeQuery,
clientReply,
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
/**
* The module entry point routine. It is this routine that
* must populate the structure that is referred to as the
@ -97,10 +72,34 @@ static FILTER_OBJECT MyObject =
*
* @return The module object
*/
FILTER_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
setUpstream,
routeQuery,
clientReply,
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
static MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_EXPERIMENTAL,
FILTER_VERSION,
"Lua Filter",
"V1.0.0",
&MyObject
};
return &info;
}
static int id_pool = 0;

View File

@ -18,19 +18,21 @@
// Global symbols of the Module
//
MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_IN_DEVELOPMENT,
FILTER_VERSION,
"A masking filter that is capable of masking/obfuscating returned column values.",
"V1.0.0"
};
extern "C" FILTER_OBJECT *GetModuleObject()
extern "C" MODULE_INFO* GetModuleObject()
{
MXS_NOTICE("Initialized masking module.");
return &MaskingFilter::s_object;
static MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_IN_DEVELOPMENT,
FILTER_VERSION,
"A masking filter that is capable of masking/obfuscating returned column values.",
"V1.0.0",
&MaskingFilter::s_object
};
return &info;
}
//

View File

@ -59,38 +59,39 @@ static uint64_t getCapabilities(void);
/* Global symbols of the Module */
MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_IN_DEVELOPMENT,
FILTER_VERSION,
"A filter that is capable of limiting the resultset number of rows.",
"V1.0.0"
};
/**
* The module entry point function, called when the module is loaded.
*
* @return The module object.
*/
FILTER_OBJECT *GetModuleObject()
MODULE_INFO* GetModuleObject()
{
static FILTER_OBJECT object =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
setUpstream,
routeQuery,
clientReply,
diagnostics,
getCapabilities,
NULL, // No destroyInstance
};
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
setUpstream,
routeQuery,
clientReply,
diagnostics,
getCapabilities,
NULL, // No destroyInstance
};
return &object;
static MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_IN_DEVELOPMENT,
FILTER_VERSION,
"A filter that is capable of limiting the resultset number of rows.",
"V1.0.0",
&object
};
return &info;
};
/* Implementation */

View File

@ -78,15 +78,6 @@
#include <maxscale/housekeeper.h>
#include <maxscale/alloc.h>
MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_ALPHA_RELEASE,
FILTER_VERSION,
"A RabbitMQ query logging filter",
"V1.0.2"
};
static int uid_gen;
static int hktask_id = 0;
/*
@ -103,22 +94,6 @@ static int clientReply(FILTER *instance, void *fsession, GWBUF *queue);
static void diagnostic(FILTER *instance, void *fsession, DCB *dcb);
static uint64_t getCapabilities(void);
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
setUpstream,
routeQuery,
clientReply,
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
/**
*Structure used to store messages and their properties.
*/
@ -270,10 +245,34 @@ void sendMessage(void* data);
*
* @return The module object
*/
FILTER_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
setUpstream,
routeQuery,
clientReply,
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
static MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_ALPHA_RELEASE,
FILTER_VERSION,
"A RabbitMQ query logging filter",
"V1.0.2",
&MyObject
};
return &info;
}
/**

View File

@ -40,15 +40,6 @@
* @endverbatim
*/
MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_GA,
FILTER_VERSION,
"A routing hint filter that uses regular expressions to direct queries",
"V1.1.0"
};
static FILTER *createInstance(const char *name, char **options, FILTER_PARAMETER **params);
static void *newSession(FILTER *instance, SESSION *session);
static void closeSession(FILTER *instance, void *session);
@ -58,22 +49,6 @@ static int routeQuery(FILTER *instance, void *fsession, GWBUF *queue);
static void diagnostic(FILTER *instance, void *fsession, DCB *dcb);
static uint64_t getCapabilities(void);
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
NULL, // No Upstream requirement
routeQuery,
NULL, // No clientReply
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
/**
* Instance structure
*/
@ -105,10 +80,34 @@ typedef struct
*
* @return The module object
*/
FILTER_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
NULL, // No Upstream requirement
routeQuery,
NULL, // No clientReply
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
static MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_GA,
FILTER_VERSION,
"A routing hint filter that uses regular expressions to direct queries",
"V1.1.0",
&MyObject
};
return &info;
}
/**

View File

@ -50,15 +50,6 @@
#include <maxscale/alloc.h>
#include <maxscale/service.h>
MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_GA,
FILTER_VERSION,
"A simple query logging filter",
"V1.1.1"
};
/** Date string buffer size */
#define QLA_DATE_BUFFER_SIZE 20
@ -88,22 +79,6 @@ static int routeQuery(FILTER *instance, void *fsession, GWBUF *queue);
static void diagnostic(FILTER *instance, void *fsession, DCB *dcb);
static uint64_t getCapabilities(void);
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
NULL, // No Upstream requirement
routeQuery,
NULL, // No client reply
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
/**
* A instance structure, the assumption is that the option passed
* to the filter is simply a base for the filename to which the queries
@ -164,10 +139,34 @@ static int write_log_entry(uint32_t, FILE*, QLA_INSTANCE*, QLA_SESSION*, const c
*
* @return The module object
*/
FILTER_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
NULL, // No Upstream requirement
routeQuery,
NULL, // No client reply
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
static MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_GA,
FILTER_VERSION,
"A simple query logging filter",
"V1.1.1",
&MyObject
};
return &info;
}
/**

View File

@ -40,15 +40,6 @@
* @endverbatim
*/
MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_GA,
FILTER_VERSION,
"A query rewrite filter that uses regular expressions to rewrite queries",
"V1.1.0"
};
static FILTER *createInstance(const char *name, char **options, FILTER_PARAMETER **params);
static void *newSession(FILTER *instance, SESSION *session);
static void closeSession(FILTER *instance, void *session);
@ -61,21 +52,6 @@ static uint64_t getCapabilities(void);
static char *regex_replace(const char *sql, pcre2_code *re, pcre2_match_data *study,
const char *replace);
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
NULL, // No Upstream requirement
routeQuery,
NULL, // No clientReply
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
/**
* Instance structure
*/
@ -114,10 +90,34 @@ void log_nomatch(REGEX_INSTANCE* inst, char* re, char* old);
*
* @return The module object
*/
FILTER_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
NULL, // No Upstream requirement
routeQuery,
NULL, // No clientReply
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
static MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_GA,
FILTER_VERSION,
"A query rewrite filter that uses regular expressions to rewrite queries",
"V1.1.0",
&MyObject
};
return &info;
}
/**

View File

@ -94,15 +94,6 @@ static unsigned char required_packets[] =
0
};
MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_GA,
FILTER_VERSION,
"A tee piece in the filter plumbing",
"V1.0.0"
};
/*
* The filter entry points
*/
@ -117,21 +108,6 @@ static int clientReply(FILTER *instance, void *fsession, GWBUF *queue);
static void diagnostic(FILTER *instance, void *fsession, DCB *dcb);
static uint64_t getCapabilities(void);
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
setUpstream,
routeQuery,
clientReply,
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
/**
* The instance structure for the TEE filter - this holds the configuration
* information for the filter.
@ -313,14 +289,39 @@ orphan_free(void* data)
*
* @return The module object
*/
FILTER_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
spinlock_init(&orphanLock);
#ifdef SS_DEBUG
spinlock_init(&debug_lock);
#endif
return &MyObject;
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
setUpstream,
routeQuery,
clientReply,
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
static MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_GA,
FILTER_VERSION,
"A tee piece in the filter plumbing",
"V1.0.0",
&MyObject
};
return &info;
}
/**

View File

@ -29,14 +29,6 @@
* @endverbatim
*/
MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_BETA_RELEASE,
FILTER_VERSION,
"A simple query counting filter",
"V2.0.0"
};
static FILTER *createInstance(const char *name, char **options, FILTER_PARAMETER **params);
static void *newSession(FILTER *instance, SESSION *session);
@ -49,20 +41,7 @@ static uint64_t getCapabilities(void);
static void destroyInstance(FILTER *instance);
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
NULL, // No upstream requirement
routeQuery,
NULL, // No clientReply
diagnostic,
getCapabilities,
destroyInstance,
};
/**
* A dummy instance structure
@ -90,10 +69,34 @@ typedef struct
*
* @return The module object
*/
FILTER_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
NULL, // No upstream requirement
routeQuery,
NULL, // No clientReply
diagnostic,
getCapabilities,
destroyInstance,
};
static MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_BETA_RELEASE,
FILTER_VERSION,
"A simple query counting filter",
"V2.0.0",
&MyObject
};
return &info;
}
/**

View File

@ -45,15 +45,6 @@
#include <maxscale/atomic.h>
#include <maxscale/alloc.h>
MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_GA,
FILTER_VERSION,
"A top N query logging filter",
"V1.0.1"
};
/*
* The filter entry points
*/
@ -68,22 +59,6 @@ static int clientReply(FILTER *instance, void *fsession, GWBUF *queue);
static void diagnostic(FILTER *instance, void *fsession, DCB *dcb);
static uint64_t getCapabilities(void);
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
setUpstream,
routeQuery,
clientReply,
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
/**
* A instance structure, the assumption is that the option passed
* to the filter is simply a base for the filename to which the queries
@ -148,10 +123,34 @@ typedef struct
*
* @return The module object
*/
FILTER_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
setUpstream,
routeQuery,
clientReply,
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
static MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_GA,
FILTER_VERSION,
"A top N query logging filter",
"V1.0.1",
&MyObject
};
return &info;
}
/**
* Create an instance of the filter for a particular service

View File

@ -64,15 +64,6 @@
extern int lm_enabled_logfiles_bitmask;
extern size_t log_ses_count[];
MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_GA,
FILTER_VERSION,
"Transaction Performance Monitoring filter",
"V1.0.1"
};
static size_t buf_size = 10;
static size_t sql_size_limit = 64 * 1024 *
1024; /* The maximum size for query statements in a transaction (64MB) */
@ -97,21 +88,6 @@ static void diagnostic(FILTER *instance, void *fsession, DCB *dcb);
static uint64_t getCapabilities(void);
static void checkNamedPipe(void *args);
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
setUpstream,
routeQuery,
clientReply,
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
/**
* A instance structure, every instance will write to a same file.
*/
@ -166,10 +142,34 @@ typedef struct
*
* @return The module object
*/
FILTER_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static FILTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
setDownstream,
setUpstream,
routeQuery,
clientReply,
diagnostic,
getCapabilities,
NULL, // No destroyInstance
};
static MODULE_INFO info =
{
MODULE_API_FILTER,
MODULE_GA,
FILTER_VERSION,
"Transaction Performance Monitoring filter",
"V1.0.1",
&MyObject
};
return &info;
}
/**

View File

@ -22,17 +22,6 @@
#include <maxscale/alloc.h>
#include <maxscale/debug.h>
/*lint -e14 */
MODULE_INFO info =
{
MODULE_API_MONITOR,
MODULE_BETA_RELEASE,
MONITOR_VERSION,
"Aurora monitor",
"V1.0.0"
};
/*lint +e14 */
typedef struct aurora_monitor
{
bool shutdown; /**< True if the monitor is stopped */
@ -348,13 +337,6 @@ diagnostics(DCB *dcb, const MONITOR *mon)
{
}
static MONITOR_OBJECT MyObject =
{
startMonitor,
stopMonitor,
diagnostics
};
/**
* The module entry point routine. It is this routine that must populate the
* structure that is referred to as the "module object", this is a structure
@ -362,9 +344,24 @@ static MONITOR_OBJECT MyObject =
*
* @return The module object
*/
MONITOR_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static MONITOR_OBJECT MyObject =
{
startMonitor,
stopMonitor,
diagnostics
};
static MODULE_INFO info =
{
MODULE_API_MONITOR,
MODULE_BETA_RELEASE,
MONITOR_VERSION,
"Aurora monitor",
"V1.0.0",
&MyObject
};
return &info;
}
/*lint +e14 */

View File

@ -43,20 +43,6 @@ static void monitorMain(void *);
/** Log a warning when a bad 'wsrep_local_index' is found */
static bool warn_erange_on_local_index = true;
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
MODULE_INFO info =
{
MODULE_API_MONITOR,
MODULE_GA,
MONITOR_VERSION,
"A Galera cluster monitor",
"V2.0.0"
};
/*lint +e14 */
static void *startMonitor(MONITOR *, const CONFIG_PARAMETER *params);
static void stopMonitor(MONITOR *);
static void diagnostics(DCB *, const MONITOR *);
@ -65,26 +51,6 @@ static MONITOR_SERVERS *set_cluster_master(MONITOR_SERVERS *, MONITOR_SERVERS *,
static void disableMasterFailback(void *, int);
bool isGaleraEvent(monitor_event_t event);
static MONITOR_OBJECT MyObject =
{
startMonitor,
stopMonitor,
diagnostics
};
/**
* The module initialisation routine, called when the module
* is first loaded.
* @see function load_module in load_utils.c for explanation of lint
*/
/*lint -e14 */
void
ModuleInit()
{
MXS_NOTICE("Initialise the MySQL Galera Monitor module.");
}
/*lint +e14 */
/**
* The module entry point routine. It is this routine that
* must populate the structure that is referred to as the
@ -93,12 +59,29 @@ ModuleInit()
*
* @return The module object
*/
MONITOR_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
MXS_NOTICE("Initialise the MySQL Galera Monitor module.");
static MONITOR_OBJECT MyObject =
{
startMonitor,
stopMonitor,
diagnostics
};
static MODULE_INFO info =
{
MODULE_API_MONITOR,
MODULE_GA,
MONITOR_VERSION,
"A Galera cluster monitor",
"V2.0.0",
&MyObject
};
return &info;
}
/*lint +e14 */
/**
* Start the instance of the monitor, returning a handle on the monitor.

View File

@ -52,13 +52,6 @@ static void detectStaleMaster(void *, int);
static MONITOR_SERVERS *get_current_master(MONITOR *);
static bool isMySQLEvent(monitor_event_t event);
static MONITOR_OBJECT MyObject =
{
startMonitor,
stopMonitor,
diagnostics
};
/**
* The module entry point routine. It is this routine that
* must populate the structure that is referred to as the
@ -67,11 +60,28 @@ static MONITOR_OBJECT MyObject =
*
* @return The module object
*/
MONITOR_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
MXS_NOTICE("Initialise the Multi-Master Monitor module.");
return &MyObject;
static MONITOR_OBJECT MyObject =
{
startMonitor,
stopMonitor,
diagnostics
};
static MODULE_INFO info =
{
MODULE_API_MONITOR,
MODULE_BETA_RELEASE,
MONITOR_VERSION,
"A Multi-Master Multi Master monitor",
"V1.1.1",
&MyObject
};
return &info;
}
/*lint +e14 */

View File

@ -72,20 +72,6 @@
static void monitorMain(void *);
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
MODULE_INFO info =
{
MODULE_API_MONITOR,
MODULE_GA,
MONITOR_VERSION,
"A MySQL Master/Slave replication monitor",
"V1.5.0"
};
/*lint +e14 */
static void *startMonitor(MONITOR *, const CONFIG_PARAMETER*);
static void stopMonitor(MONITOR *);
static void diagnostics(DCB *, const MONITOR *);
@ -100,13 +86,6 @@ void check_maxscale_schema_replication(MONITOR *monitor);
static bool report_version_err = true;
static const char* hb_table_name = "maxscale_schema.replication_heartbeat";
static MONITOR_OBJECT MyObject =
{
startMonitor,
stopMonitor,
diagnostics
};
/**
* The module entry point routine. It is this routine that
* must populate the structure that is referred to as the
@ -115,11 +94,28 @@ static MONITOR_OBJECT MyObject =
*
* @return The module object
*/
MONITOR_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
MXS_NOTICE("Initialise the MySQL Monitor module.");
return &MyObject;
static MONITOR_OBJECT MyObject =
{
startMonitor,
stopMonitor,
diagnostics
};
static MODULE_INFO info =
{
MODULE_API_MONITOR,
MODULE_GA,
MONITOR_VERSION,
"A MySQL Master/Slave replication monitor",
"V1.5.0",
&MyObject
};
return &info;
}
/**

View File

@ -35,14 +35,7 @@ static void monitorMain(void *);
* lint directives.
*/
/*lint -e14 */
MODULE_INFO info =
{
MODULE_API_MONITOR,
MODULE_BETA_RELEASE,
MONITOR_VERSION,
"A MySQL cluster SQL node monitor",
"V2.1.0"
};
/*lint +e14 */
static void *startMonitor(MONITOR *, const CONFIG_PARAMETER *params);
@ -50,12 +43,7 @@ static void stopMonitor(MONITOR *);
static void diagnostics(DCB *, const MONITOR *);
bool isNdbEvent(monitor_event_t event);
static MONITOR_OBJECT MyObject =
{
startMonitor,
stopMonitor,
diagnostics
};
/**
* The module entry point routine. It is this routine that
@ -65,11 +53,28 @@ static MONITOR_OBJECT MyObject =
*
* @return The module object
*/
MONITOR_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
MXS_NOTICE("Initialise the MySQL Cluster Monitor module.");
return &MyObject;
static MONITOR_OBJECT MyObject =
{
startMonitor,
stopMonitor,
diagnostics
};
static MODULE_INFO info =
{
MODULE_API_MONITOR,
MODULE_BETA_RELEASE,
MONITOR_VERSION,
"A MySQL cluster SQL node monitor",
"V2.1.0",
&MyObject
};
return &info;
}
/*lint +e14 */

View File

@ -38,15 +38,6 @@
#include <maxscale/modinfo.h>
#include <maxscale/poll.h>
MODULE_INFO info =
{
MODULE_API_PROTOCOL,
MODULE_IN_DEVELOPMENT,
GWPROTOCOL_VERSION,
"A Change Data Capture Listener implementation for use in binlog events retrieval",
"V1.0.0"
};
#define ISspace(x) isspace((int)(x))
#define CDC_SERVER_STRING "MaxScale(c) v.1.0.0"
@ -69,25 +60,6 @@ static char* cdc_default_auth()
return "CDCPlainAuth";
}
/**
* The "module object" for the CDC protocol module.
*/
static GWPROTOCOL MyObject =
{
cdc_read_event, /* Read - EPOLLIN handler */
cdc_write, /* Write - data from gateway */
cdc_write_event, /* WriteReady - EPOLLOUT handler */
cdc_error, /* Error - EPOLLERR handler */
cdc_hangup, /* HangUp - EPOLLHUP handler */
cdc_accept, /* Accept */
NULL, /* Connect */
cdc_close, /* Close */
cdc_listen, /* Create a listener */
NULL, /* Authentication */
NULL, /* Session */
cdc_default_auth /* default authentication */
};
/**
* The module entry point routine. It is this routine that
* must populate the structure that is referred to as the
@ -96,10 +68,34 @@ static GWPROTOCOL MyObject =
*
* @return The module object
*/
GWPROTOCOL *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static GWPROTOCOL MyObject =
{
cdc_read_event, /* Read - EPOLLIN handler */
cdc_write, /* Write - data from gateway */
cdc_write_event, /* WriteReady - EPOLLOUT handler */
cdc_error, /* Error - EPOLLERR handler */
cdc_hangup, /* HangUp - EPOLLHUP handler */
cdc_accept, /* Accept */
NULL, /* Connect */
cdc_close, /* Close */
cdc_listen, /* Create a listener */
NULL, /* Authentication */
NULL, /* Session */
cdc_default_auth /* default authentication */
};
static MODULE_INFO info =
{
MODULE_API_PROTOCOL,
MODULE_IN_DEVELOPMENT,
GWPROTOCOL_VERSION,
"A Change Data Capture Listener implementation for use in binlog events retrieval",
"V1.0.0"
};
return &info;
}
/**
@ -274,7 +270,7 @@ cdc_accept(DCB *listener)
int n_connect = 0;
DCB *client_dcb;
while ((client_dcb = dcb_accept(listener, &MyObject)) != NULL)
while ((client_dcb = dcb_accept(listener)) != NULL)
{
CDC_session *client_data = NULL;
CDC_protocol *protocol = NULL;

View File

@ -40,20 +40,6 @@
#include <maxscale/log_manager.h>
#include <maxscale/resultset.h>
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
MODULE_INFO info =
{
MODULE_API_PROTOCOL,
MODULE_IN_DEVELOPMENT,
GWPROTOCOL_VERSION,
"An experimental HTTPD implementation for use in administration",
"V1.2.0"
};
/*lint +e14 */
#define ISspace(x) isspace((int)(x))
#define HTTP_SERVER_STRING "MaxScale(c) v.1.0.0"
@ -69,26 +55,6 @@ static int httpd_get_line(int sock, char *buf, int size);
static void httpd_send_headers(DCB *dcb, int final, bool auth_ok);
static char *httpd_default_auth();
/**
* The "module object" for the httpd protocol module.
*/
static GWPROTOCOL MyObject =
{
httpd_read_event, /**< Read - EPOLLIN handler */
httpd_write, /**< Write - data from gateway */
httpd_write_event, /**< WriteReady - EPOLLOUT handler */
httpd_error, /**< Error - EPOLLERR handler */
httpd_hangup, /**< HangUp - EPOLLHUP handler */
httpd_accept, /**< Accept */
NULL, /**< Connect */
httpd_close, /**< Close */
httpd_listen, /**< Create a listener */
NULL, /**< Authentication */
NULL, /**< Session */
httpd_default_auth, /**< Default authenticator */
NULL /**< Connection limit reached */
};
/**
* The module entry point routine. It is this routine that
* must populate the structure that is referred to as the
@ -97,9 +63,36 @@ static GWPROTOCOL MyObject =
*
* @return The module object
*/
GWPROTOCOL* GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static GWPROTOCOL MyObject =
{
httpd_read_event, /**< Read - EPOLLIN handler */
httpd_write, /**< Write - data from gateway */
httpd_write_event, /**< WriteReady - EPOLLOUT handler */
httpd_error, /**< Error - EPOLLERR handler */
httpd_hangup, /**< HangUp - EPOLLHUP handler */
httpd_accept, /**< Accept */
NULL, /**< Connect */
httpd_close, /**< Close */
httpd_listen, /**< Create a listener */
NULL, /**< Authentication */
NULL, /**< Session */
httpd_default_auth, /**< Default authenticator */
NULL /**< Connection limit reached */
};
static MODULE_INFO info =
{
MODULE_API_PROTOCOL,
MODULE_IN_DEVELOPMENT,
GWPROTOCOL_VERSION,
"An experimental HTTPD implementation for use in administration",
"V1.2.0",
&MyObject
};
return &info;
}
/*lint +e14 */
@ -358,7 +351,7 @@ static int httpd_accept(DCB *listener)
int n_connect = 0;
DCB *client_dcb;
while ((client_dcb = dcb_accept(listener, &MyObject)) != NULL)
while ((client_dcb = dcb_accept(listener)) != NULL)
{
HTTPD_session *client_data = NULL;

View File

@ -17,6 +17,10 @@
#include <maxscale/utils.h>
#include <netinet/tcp.h>
#include <mysqld_error.h>
#include <maxscale/alloc.h>
#include <maxscale/modinfo.h>
#include <maxscale/gw_protocol.h>
#include <mysql_auth.h>
/*
* MySQL Protocol module for handling the protocol between the gateway
@ -46,24 +50,6 @@
* 23/05/2016 Martin Brampton Provide for backend SSL
*
*/
#include <maxscale/alloc.h>
#include <maxscale/modinfo.h>
#include <maxscale/gw_protocol.h>
#include <mysql_auth.h>
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
MODULE_INFO info =
{
MODULE_API_PROTOCOL,
MODULE_GA,
GWPROTOCOL_VERSION,
"The MySQL to backend server protocol",
"V2.0.0"
};
/*lint +e14 */
static int gw_create_backend_connection(DCB *backend, SERVER *server, SESSION *in_session);
static int gw_read_backend_event(DCB* dcb);
@ -91,27 +77,6 @@ static int gw_send_change_user_to_backend(char *dbname,
uint8_t *passwd,
MySQLProtocol *conn);
#if defined(NOT_USED)
static int gw_session(DCB *backend_dcb, void *data);
#endif
static GWPROTOCOL MyObject =
{
gw_read_backend_event, /* Read - EPOLLIN handler */
gw_MySQLWrite_backend, /* Write - data from gateway */
gw_write_backend_event, /* WriteReady - EPOLLOUT handler */
gw_error_backend_event, /* Error - EPOLLERR handler */
gw_backend_hangup, /* HangUp - EPOLLHUP handler */
NULL, /* Accept */
gw_create_backend_connection, /* Connect */
gw_backend_close, /* Close */
NULL, /* Listen */
gw_change_user, /* Authentication */
NULL, /* Session */
gw_backend_default_auth, /* Default authenticator */
NULL /* Connection limit reached */
};
/*
* The module entry point routine. It is this routine that
* must populate the structure that is referred to as the
@ -120,9 +85,36 @@ static GWPROTOCOL MyObject =
*
* @return The module object
*/
GWPROTOCOL* GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static GWPROTOCOL MyObject =
{
gw_read_backend_event, /* Read - EPOLLIN handler */
gw_MySQLWrite_backend, /* Write - data from gateway */
gw_write_backend_event, /* WriteReady - EPOLLOUT handler */
gw_error_backend_event, /* Error - EPOLLERR handler */
gw_backend_hangup, /* HangUp - EPOLLHUP handler */
NULL, /* Accept */
gw_create_backend_connection, /* Connect */
gw_backend_close, /* Close */
NULL, /* Listen */
gw_change_user, /* Authentication */
NULL, /* Session */
gw_backend_default_auth, /* Default authenticator */
NULL /* Connection limit reached */
};
static MODULE_INFO info =
{
MODULE_API_PROTOCOL,
MODULE_GA,
GWPROTOCOL_VERSION,
"The MySQL to backend server protocol",
"V2.0.0",
&MyObject
};
return &info;
}
/**

View File

@ -60,20 +60,6 @@
#include <maxscale/gw_authenticator.h>
#include <maxscale/session.h>
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
MODULE_INFO info =
{
MODULE_API_PROTOCOL,
MODULE_GA,
GWPROTOCOL_VERSION,
"The client to MaxScale MySQL protocol implementation",
"V1.1.0"
};
/*lint +e14*/
static int gw_MySQLAccept(DCB *listener);
static int gw_MySQLListener(DCB *listener, char *config_bind);
static int gw_read_client_event(DCB* dcb);
@ -97,22 +83,7 @@ static void gw_process_one_new_client(DCB *client_dcb);
/*
* The "module object" for the mysqld client protocol module.
*/
static GWPROTOCOL MyObject =
{
gw_read_client_event, /* Read - EPOLLIN handler */
gw_MySQLWrite_client, /* Write - data from gateway */
gw_write_client_event, /* WriteReady - EPOLLOUT handler */
gw_error_client_event, /* Error - EPOLLERR handler */
gw_client_hangup_event, /* HangUp - EPOLLHUP handler */
gw_MySQLAccept, /* Accept */
NULL, /* Connect */
gw_client_close, /* Close */
gw_MySQLListener, /* Listen */
NULL, /* Authentication */
NULL, /* Session */
gw_default_auth, /* Default authenticator */
gw_connection_limit /* Send error connection limit */
};
/**
* The module entry point routine. It is this routine that
@ -122,9 +93,36 @@ static GWPROTOCOL MyObject =
*
* @return The module object
*/
GWPROTOCOL* GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static GWPROTOCOL MyObject =
{
gw_read_client_event, /* Read - EPOLLIN handler */
gw_MySQLWrite_client, /* Write - data from gateway */
gw_write_client_event, /* WriteReady - EPOLLOUT handler */
gw_error_client_event, /* Error - EPOLLERR handler */
gw_client_hangup_event, /* HangUp - EPOLLHUP handler */
gw_MySQLAccept, /* Accept */
NULL, /* Connect */
gw_client_close, /* Close */
gw_MySQLListener, /* Listen */
NULL, /* Authentication */
NULL, /* Session */
gw_default_auth, /* Default authenticator */
gw_connection_limit /* Send error connection limit */
};
static MODULE_INFO info =
{
MODULE_API_PROTOCOL,
MODULE_GA,
GWPROTOCOL_VERSION,
"The client to MaxScale MySQL protocol implementation",
"V1.1.0",
&MyObject
};
return &info;
}
/*lint +e14 */
@ -1142,7 +1140,7 @@ int gw_MySQLAccept(DCB *listener)
}
else
{
while ((client_dcb = dcb_accept(listener, &MyObject)) != NULL)
while ((client_dcb = dcb_accept(listener)) != NULL)
{
gw_process_one_new_client(client_dcb);
} /**< while client_dcb != NULL */

View File

@ -37,20 +37,6 @@
#include <maxscale/maxadmin.h>
#include <maxscale/alloc.h>
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
MODULE_INFO info =
{
MODULE_API_PROTOCOL,
MODULE_GA,
GWPROTOCOL_VERSION,
"A maxscale protocol for the administration interface",
"V2.0.0"
};
/*lint +e14 */
/**
* @file maxscaled.c - MaxScale administration protocol
*
@ -170,27 +156,6 @@ static bool authenticate_socket(MAXSCALED *protocol, DCB *dcb)
return authenticated;
}
/**
* The "module object" for the maxscaled protocol module.
*/
static GWPROTOCOL MyObject =
{
maxscaled_read_event, /**< Read - EPOLLIN handler */
maxscaled_write, /**< Write - data from gateway */
maxscaled_write_event, /**< WriteReady - EPOLLOUT handler */
maxscaled_error, /**< Error - EPOLLERR handler */
maxscaled_hangup, /**< HangUp - EPOLLHUP handler */
maxscaled_accept, /**< Accept */
NULL, /**< Connect */
maxscaled_close, /**< Close */
maxscaled_listen, /**< Create a listener */
NULL, /**< Authentication */
NULL, /**< Session */
mxsd_default_auth, /**< Default authenticator */
NULL /**< Connection limit reached */
};
/**
* The module entry point routine. It is this routine that
* must populate the structure that is referred to as the
@ -199,10 +164,38 @@ static GWPROTOCOL MyObject =
*
* @return The module object
*/
GWPROTOCOL* GetModuleObject()
MODULE_INFO* GetModuleObject()
{
MXS_INFO("Initialise MaxScaled Protocol module.");
return &MyObject;
static GWPROTOCOL MyObject =
{
maxscaled_read_event, /**< Read - EPOLLIN handler */
maxscaled_write, /**< Write - data from gateway */
maxscaled_write_event, /**< WriteReady - EPOLLOUT handler */
maxscaled_error, /**< Error - EPOLLERR handler */
maxscaled_hangup, /**< HangUp - EPOLLHUP handler */
maxscaled_accept, /**< Accept */
NULL, /**< Connect */
maxscaled_close, /**< Close */
maxscaled_listen, /**< Create a listener */
NULL, /**< Authentication */
NULL, /**< Session */
mxsd_default_auth, /**< Default authenticator */
NULL /**< Connection limit reached */
};
static MODULE_INFO info =
{
MODULE_API_PROTOCOL,
MODULE_GA,
GWPROTOCOL_VERSION,
"A maxscale protocol for the administration interface",
"V2.0.0",
&MyObject
};
return &info;
}
/*lint +e14 */
@ -343,7 +336,7 @@ static int maxscaled_accept(DCB *listener)
socklen_t len = sizeof(struct ucred);
struct ucred ucred;
while ((client_dcb = dcb_accept(listener, &MyObject)) != NULL)
while ((client_dcb = dcb_accept(listener)) != NULL)
{
MAXSCALED *maxscaled_protocol = (MAXSCALED *)calloc(1, sizeof(MAXSCALED));

View File

@ -33,20 +33,6 @@
#include <maxscale/log_manager.h>
#include <maxscale/modinfo.h>
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
MODULE_INFO info =
{
MODULE_API_PROTOCOL,
MODULE_GA,
GWPROTOCOL_VERSION,
"A telnet deamon protocol for simple administration interface",
"V1.1.1"
};
/*lint +e14 */
/**
* @file telnetd.c - telnet daemon protocol module
*
@ -82,22 +68,7 @@ static char *telnetd_default_auth();
/**
* The "module object" for the telnetd protocol module.
*/
static GWPROTOCOL MyObject =
{
telnetd_read_event, /**< Read - EPOLLIN handler */
telnetd_write, /**< Write - data from gateway */
telnetd_write_event, /**< WriteReady - EPOLLOUT handler */
telnetd_error, /**< Error - EPOLLERR handler */
telnetd_hangup, /**< HangUp - EPOLLHUP handler */
telnetd_accept, /**< Accept */
NULL, /**< Connect */
telnetd_close, /**< Close */
telnetd_listen, /**< Create a listener */
NULL, /**< Authentication */
NULL, /**< Session */
telnetd_default_auth, /**< Default authenticator */
NULL /**< Connection limit reached */
};
static void telnetd_command(DCB *, unsigned char *cmd);
static void telnetd_echo(DCB *dcb, int enable);
@ -110,10 +81,37 @@ static void telnetd_echo(DCB *dcb, int enable);
*
* @return The module object
*/
GWPROTOCOL* GetModuleObject()
MODULE_INFO* GetModuleObject()
{
MXS_INFO("Initialise Telnetd Protocol module.");
return &MyObject;
static GWPROTOCOL MyObject =
{
telnetd_read_event, /**< Read - EPOLLIN handler */
telnetd_write, /**< Write - data from gateway */
telnetd_write_event, /**< WriteReady - EPOLLOUT handler */
telnetd_error, /**< Error - EPOLLERR handler */
telnetd_hangup, /**< HangUp - EPOLLHUP handler */
telnetd_accept, /**< Accept */
NULL, /**< Connect */
telnetd_close, /**< Close */
telnetd_listen, /**< Create a listener */
NULL, /**< Authentication */
NULL, /**< Session */
telnetd_default_auth, /**< Default authenticator */
NULL /**< Connection limit reached */
};
static MODULE_INFO info =
{
MODULE_API_PROTOCOL,
MODULE_GA,
GWPROTOCOL_VERSION,
"A telnet deamon protocol for simple administration interface",
"V1.1.1",
&MyObject
};
return &info;
}
/*lint +e14 */
@ -268,7 +266,7 @@ static int telnetd_accept(DCB *listener)
int n_connect = 0;
DCB *client_dcb;
while ((client_dcb = dcb_accept(listener, &MyObject)) != NULL)
while ((client_dcb = dcb_accept(listener)) != NULL)
{
TELNETD* telnetd_protocol = NULL;

View File

@ -30,20 +30,6 @@
#include <maxscale/buffer.h>
#include <maxscale/gw_protocol.h>
/* @see function load_module in load_utils.c for explanation of the following
* lint directives.
*/
/*lint -e14 */
MODULE_INFO info =
{
MODULE_API_PROTOCOL,
MODULE_IN_DEVELOPMENT,
GWPROTOCOL_VERSION,
"Test protocol",
"V1.1.0"
};
/*lint +e14 */
static int test_read(DCB* dcb){ return 1;}
static int test_write(DCB *dcb, GWBUF* buf){ return 1;}
static int test_write_ready(DCB *dcb){ return 1;}
@ -57,25 +43,6 @@ static int test_auth(DCB* dcb, struct server *srv, struct session *ses, GWBUF *b
static int test_session(DCB *dcb, void* data){ return 1;}
static char *test_default_auth(){return "NullAuthAllow";}
static int test_connection_limit(DCB *dcb, int limit){return 0;}
/**
* The "module object" for the httpd protocol module.
*/
static GWPROTOCOL MyObject =
{
test_read, /**< Read - EPOLLIN handler */
test_write, /**< Write - data from gateway */
test_write_ready, /**< WriteReady - EPOLLOUT handler */
test_error, /**< Error - EPOLLERR handler */
test_hangup, /**< HangUp - EPOLLHUP handler */
test_accept, /**< Accept */
test_connect, /**< Connect */
test_close, /**< Close */
test_listen, /**< Create a listener */
test_auth, /**< Authentication */
test_session, /**< Session */
test_default_auth, /**< Default authenticator */
test_connection_limit /**< Connection limit */
};
/**
* The module entry point routine. It is this routine that
@ -85,8 +52,34 @@ static GWPROTOCOL MyObject =
*
* @return The module object
*/
GWPROTOCOL* GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static GWPROTOCOL MyObject =
{
test_read, /**< Read - EPOLLIN handler */
test_write, /**< Write - data from gateway */
test_write_ready, /**< WriteReady - EPOLLOUT handler */
test_error, /**< Error - EPOLLERR handler */
test_hangup, /**< HangUp - EPOLLHUP handler */
test_accept, /**< Accept */
test_connect, /**< Connect */
test_close, /**< Close */
test_listen, /**< Create a listener */
test_auth, /**< Authentication */
test_session, /**< Session */
test_default_auth, /**< Default authenticator */
test_connection_limit /**< Connection limit */
};
static MODULE_INFO info =
{
MODULE_API_PROTOCOL,
MODULE_IN_DEVELOPMENT,
GWPROTOCOL_VERSION,
"Test protocol",
"V1.1.0",
&MyObject
};
return &info;
}
/*lint +e14 */

View File

@ -58,7 +58,6 @@
#define AVRO_TASK_DELAY_MAX 15
static char *version_str = "V1.0.0";
static const char* avro_task_name = "binlog_to_avro";
static const char* index_task_name = "avro_indexing";
static const char* avro_index_name = "avro.index";
@ -96,35 +95,9 @@ void avro_index_file(AVRO_INSTANCE *router, const char* path);
void avro_update_index(AVRO_INSTANCE* router);
static bool conversion_task_ctl(AVRO_INSTANCE *inst, bool start);
/** The module object definition */
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
routeQuery,
diagnostics,
clientReply,
errorReply,
getCapabilities,
NULL
};
static SPINLOCK instlock;
static AVRO_INSTANCE *instances;
/**
* Implementation of the mandatory version entry point
*
* @return version string of the module
*/
char *
version()
{
return version_str;
}
bool avro_handle_convert(const MODULECMD_ARG *args)
{
bool rval = false;
@ -145,25 +118,6 @@ bool avro_handle_convert(const MODULECMD_ARG *args)
return rval;
}
/**
* The module initialisation routine, called when the module
* is first loaded.
*/
void
ModuleInit()
{
MXS_NOTICE("Initialized avrorouter module %s.\n", version_str);
spinlock_init(&instlock);
instances = NULL;
modulecmd_arg_type_t args[] =
{
{ MODULECMD_ARG_SERVICE, "The avrorouter service" },
{ MODULECMD_ARG_STRING, "Action, whether to 'start' or 'stop' the conversion process" }
};
modulecmd_register_command("avrorouter", "convert", avro_handle_convert, 2, args);
}
/**
* The module entry point routine. It is this routine that
* must populate the structure that is referred to as the
@ -172,10 +126,43 @@ ModuleInit()
*
* @return The module object
*/
ROUTER_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
spinlock_init(&instlock);
instances = NULL;
static modulecmd_arg_type_t args[] =
{
{ MODULECMD_ARG_SERVICE, "The avrorouter service" },
{ MODULECMD_ARG_STRING, "Action, whether to 'start' or 'stop' the conversion process" }
};
modulecmd_register_command("avrorouter", "convert", avro_handle_convert, 2, args);
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
routeQuery,
diagnostics,
clientReply,
errorReply,
getCapabilities,
NULL
};
static MODULE_INFO info =
{
MODULE_API_ROUTER,
MODULE_GA,
ROUTER_VERSION,
"Binlogrouter",
"V1.0.0",
&MyObject
};
return &info;
}
/**

View File

@ -85,8 +85,6 @@
#include <uuid/uuid.h>
#include <maxscale/alloc.h>
static char *version_str = "V2.1.0";
/* The router entry points */
static ROUTER *createInstance(SERVICE *service, char **options);
static void free_instance(ROUTER_INSTANCE *instance);
@ -119,21 +117,6 @@ bool blr_extract_key(const char *linebuf, int nline, ROUTER_INSTANCE *router);
bool blr_get_encryption_key(ROUTER_INSTANCE *router);
int blr_parse_key_file(ROUTER_INSTANCE *router);
/** The module object definition */
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
routeQuery,
diagnostics,
clientReply,
errorReply,
getCapabilities,
destroyInstance
};
static void stats_func(void *);
static bool rses_begin_locked_router_action(ROUTER_SLAVE *);
@ -143,29 +126,6 @@ GWBUF *blr_cache_read_response(ROUTER_INSTANCE *router, char *response);
static SPINLOCK instlock;
static ROUTER_INSTANCE *instances;
/**
* Implementation of the mandatory version entry point
*
* @return version string of the module
*/
char *
version()
{
return version_str;
}
/**
* The module initialisation routine, called when the module
* is first loaded.
*/
void
ModuleInit()
{
MXS_NOTICE("Initialise binlog router module %s.\n", version_str);
spinlock_init(&instlock);
instances = NULL;
}
/**
* The module entry point routine. It is this routine that
* must populate the structure that is referred to as the
@ -174,10 +134,37 @@ ModuleInit()
*
* @return The module object
*/
ROUTER_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
MXS_NOTICE("Initialise binlog router module.");
spinlock_init(&instlock);
instances = NULL;
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
routeQuery,
diagnostics,
clientReply,
errorReply,
getCapabilities,
destroyInstance
};
static MODULE_INFO info =
{
MODULE_API_ROUTER,
MODULE_GA,
ROUTER_VERSION,
"Binlogrouter",
"V2.1.0",
&MyObject
};
return &info;
}
/**

View File

@ -40,16 +40,6 @@
#include <debugcli.h>
#include <maxscale/log_manager.h>
MODULE_INFO info =
{
MODULE_API_ROUTER,
MODULE_GA,
ROUTER_VERSION,
"The admin user interface",
"V1.0.0"
};
/* The router entry points */
static ROUTER *createInstance(SERVICE *service, char **options);
static void *newSession(ROUTER *instance, SESSION *session);
@ -59,38 +49,11 @@ static int execute(ROUTER *instance, void *router_session, GWBUF *queue);
static void diagnostics(ROUTER *instance, DCB *dcb);
static uint64_t getCapabilities(void);
/** The module object definition */
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
execute,
diagnostics,
NULL,
NULL,
getCapabilities,
NULL
};
extern int execute_cmd(CLI_SESSION *cli);
static SPINLOCK instlock;
static CLI_INSTANCE *instances;
/**
* The module initialisation routine, called when the module
* is first loaded.
*/
void
ModuleInit()
{
MXS_NOTICE("Initialise CLI router module");
spinlock_init(&instlock);
instances = NULL;
}
/**
* The module entry point routine. It is this routine that
* must populate the structure that is referred to as the
@ -99,10 +62,37 @@ ModuleInit()
*
* @return The module object
*/
ROUTER_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
MXS_NOTICE("Initialise CLI router module");
spinlock_init(&instlock);
instances = NULL;
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
execute,
diagnostics,
NULL,
NULL,
getCapabilities,
NULL
};
static MODULE_INFO info =
{
MODULE_API_ROUTER,
MODULE_GA,
ROUTER_VERSION,
"The admin user interface",
"V1.0.0",
&MyObject
};
return &info;
}
/**

View File

@ -39,16 +39,6 @@
#include <debugcli.h>
#include <maxscale/log_manager.h>
MODULE_INFO info =
{
MODULE_API_ROUTER,
MODULE_GA,
ROUTER_VERSION,
"The debug user interface",
"V1.1.1"
};
/* The router entry points */
static ROUTER *createInstance(SERVICE *service, char **options);
static void *newSession(ROUTER *instance, SESSION *session);
@ -58,21 +48,6 @@ static int execute(ROUTER *instance, void *router_session, GWBUF *queue);
static void diagnostics(ROUTER *instance, DCB *dcb);
static uint64_t getCapabilities ();
/** The module object definition */
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
execute,
diagnostics,
NULL,
NULL,
getCapabilities,
NULL
};
extern int execute_cmd(CLI_SESSION *cli);
static SPINLOCK instlock;
@ -86,13 +61,37 @@ static CLI_INSTANCE *instances;
*
* @return The module object
*/
ROUTER_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
MXS_NOTICE("Initialise debug CLI router module.");
spinlock_init(&instlock);
instances = NULL;
return &MyObject;
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
execute,
diagnostics,
NULL,
NULL,
getCapabilities,
NULL
};
static MODULE_INFO info =
{
MODULE_API_ROUTER,
MODULE_GA,
ROUTER_VERSION,
"The debug user interface",
"V1.1.1",
&MyObject
};
return &info;
}
/**

View File

@ -51,16 +51,6 @@
#include <maxscale/secrets.h>
#include <maxscale/users.h>
MODULE_INFO info =
{
MODULE_API_ROUTER,
MODULE_ALPHA_RELEASE,
ROUTER_VERSION,
"The MaxScale Information Schema",
"V1.0.0"
};
extern char *create_hex_sha1_sha1_passwd(char *passwd);
static int maxinfo_statistics(INFO_INSTANCE *, INFO_SESSION *, GWBUF *);
@ -84,21 +74,6 @@ static void handleError(ROUTER *instance,
error_action_t action,
bool *succp);
/** The module object definition */
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
execute,
diagnostics,
NULL,
handleError,
getCapabilities,
NULL
};
static SPINLOCK instlock;
static INFO_INSTANCE *instances;
@ -110,13 +85,37 @@ static INFO_INSTANCE *instances;
*
* @return The module object
*/
ROUTER_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
MXS_NOTICE("Initialise MaxInfo router module.");
spinlock_init(&instlock);
instances = NULL;
return &MyObject;
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
execute,
diagnostics,
NULL,
handleError,
getCapabilities,
NULL
};
static MODULE_INFO info =
{
MODULE_API_ROUTER,
MODULE_ALPHA_RELEASE,
ROUTER_VERSION,
"The MaxScale Information Schema",
"V1.0.0",
&MyObject
};
return &info;
}
/**

View File

@ -90,15 +90,6 @@
#include <maxscale/modutil.h>
MODULE_INFO info =
{
MODULE_API_ROUTER,
MODULE_GA,
ROUTER_VERSION,
"A connection based router to load balance based on connections",
"V1.1.0"
};
/* The router entry points */
static ROUTER *createInstance(SERVICE *service, char **options);
static void *newSession(ROUTER *instance, SESSION *session);
@ -111,29 +102,11 @@ static void clientReply(ROUTER *instance, void *router_session, GWBUF *queue,
static void handleError(ROUTER *instance, void *router_session, GWBUF *errbuf,
DCB *problem_dcb, error_action_t action, bool *succp);
static uint64_t getCapabilities(void);
/** The module object definition */
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
routeQuery,
diagnostics,
clientReply,
handleError,
getCapabilities,
NULL
};
static bool rses_begin_locked_router_action(ROUTER_CLIENT_SES* rses);
static void rses_end_locked_router_action(ROUTER_CLIENT_SES* rses);
static SERVER_REF *get_root_master(SERVER_REF *servers);
static int handle_state_switch(DCB* dcb, DCB_REASON reason, void * routersession);
static SPINLOCK instlock;
static ROUTER_INSTANCE *instances;
@ -145,13 +118,37 @@ static ROUTER_INSTANCE *instances;
*
* @return The module object
*/
ROUTER_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
MXS_NOTICE("Initialise readconnroute router module.");
spinlock_init(&instlock);
instances = NULL;
return &MyObject;
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
routeQuery,
diagnostics,
clientReply,
handleError,
getCapabilities,
NULL
};
static MODULE_INFO info =
{
MODULE_API_ROUTER,
MODULE_GA,
ROUTER_VERSION,
"A connection based router to load balance based on connections",
"V1.1.0",
&MyObject
};
return &info;
}
static inline void free_readconn_instance(ROUTER_INSTANCE *router)

View File

@ -28,13 +28,6 @@
#include <maxscale/modutil.h>
#include <maxscale/alloc.h>
MODULE_INFO info =
{
MODULE_API_ROUTER, MODULE_GA, ROUTER_VERSION,
"A Read/Write splitting router for enhancement read scalability",
"V1.1.0"
};
/**
* @file readwritesplit.c The entry points for the read/write query splitting
* router module.
@ -93,20 +86,6 @@ static uint64_t getCapabilities(void);
* make it easier to track the connection between calls and functions.
*/
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
routeQuery,
diagnostics,
clientReply,
handleError,
getCapabilities,
NULL
};
/*
* Declaration of functions that are used only within this module, and are
* not part of the API.
@ -134,10 +113,32 @@ static bool create_backends(ROUTER_CLIENT_SES *rses, backend_ref_t** dest, int*
*
* @return The module object
*/
ROUTER_OBJECT *GetModuleObject()
MODULE_INFO *GetModuleObject()
{
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
routeQuery,
diagnostics,
clientReply,
handleError,
getCapabilities,
NULL
};
static MODULE_INFO info =
{
MODULE_API_ROUTER, MODULE_GA, ROUTER_VERSION,
"A Read/Write splitting router for enhancement read scalability",
"V1.1.0",
&MyObject
};
MXS_NOTICE("Initializing statement-based read/write split router module.");
return &MyObject;
return &info;
}
/*

View File

@ -40,16 +40,6 @@
/** Hashtable size for the per user shard maps */
#define SCHEMAROUTER_USERHASH_SIZE 10
MODULE_INFO info =
{
MODULE_API_ROUTER,
MODULE_BETA_RELEASE,
ROUTER_VERSION,
"A database sharding router for simple sharding",
"V1.0.0"
};
/**
* @file schemarouter.c The entry points for the simple sharding
* router module.
@ -100,20 +90,6 @@ static bool get_shard_dcb(DCB** dcb,
ROUTER_CLIENT_SES* rses,
char* name);
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
routeQuery,
diagnostic,
clientReply,
handleError,
getCapabilities,
NULL
};
static bool rses_begin_locked_router_action(ROUTER_CLIENT_SES* rses);
static void rses_end_locked_router_action(ROUTER_CLIENT_SES* rses);
static void mysql_sescmd_done(mysql_sescmd_t* sescmd);
@ -615,12 +591,37 @@ bool check_shard_status(ROUTER_INSTANCE* router, char* shard)
*
* @return The module object
*/
ROUTER_OBJECT* GetModuleObject()
MODULE_INFO* GetModuleObject()
{
MXS_NOTICE("Initializing Schema Sharding Router.");
spinlock_init(&instlock);
instances = NULL;
return &MyObject;
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
routeQuery,
diagnostic,
clientReply,
handleError,
getCapabilities,
NULL
};
static MODULE_INFO info =
{
MODULE_API_ROUTER,
MODULE_BETA_RELEASE,
ROUTER_VERSION,
"A database sharding router for simple sharding",
"V1.0.0",
&MyObject
};
return &info;
}
/**

View File

@ -15,15 +15,6 @@
#include <maxscale/router.h>
#include <maxscale/modinfo.h>
MODULE_INFO info =
{
MODULE_API_ROUTER,
MODULE_IN_DEVELOPMENT,
ROUTER_VERSION,
"A test router - not for use in real systems",
"V1.0.0"
};
static ROUTER *createInstance(SERVICE *service, char **options);
static void *newSession(ROUTER *instance, SESSION *session);
static void closeSession(ROUTER *instance, void *session);
@ -39,20 +30,6 @@ static void handleError(ROUTER *instance,
error_action_t action,
bool *succp);
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
routeQuery,
diagnostic,
clientReply,
handleError,
getCapabilities,
NULL
};
typedef struct
{
} TESTROUTER;
@ -69,10 +46,33 @@ typedef struct
*
* @return The module object
*/
ROUTER_OBJECT *
GetModuleObject()
MODULE_INFO* GetModuleObject()
{
return &MyObject;
static ROUTER_OBJECT MyObject =
{
createInstance,
newSession,
closeSession,
freeSession,
routeQuery,
diagnostic,
clientReply,
handleError,
getCapabilities,
NULL
};
static MODULE_INFO info =
{
MODULE_API_ROUTER,
MODULE_IN_DEVELOPMENT,
ROUTER_VERSION,
"A test router - not for use in real systems",
"V1.0.0",
&MyObject
};
return &info;
}
/**