From 9a8838474c47bf30eacc785363939e64d01984ee Mon Sep 17 00:00:00 2001 From: Johan Wikman Date: Tue, 26 Jan 2016 10:38:31 +0200 Subject: [PATCH] Add query classifier plugin. Basic infrastructure added for being able to load query classifier plugins using the same mechanism other plugins are loaded with. --- server/core/load_utils.c | 6 ++++++ server/include/modinfo.h | 3 ++- server/include/modules.h | 9 +++++---- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/server/core/load_utils.c b/server/core/load_utils.c index ce367ed32..4b0160ce3 100644 --- a/server/core/load_utils.c +++ b/server/core/load_utils.c @@ -198,6 +198,12 @@ load_module(const char *module, const char *type) MXS_ERROR("Module '%s' does not implement the filter API.", module); fatal = 1; } + 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 = 1; + } if (fatal) { dlclose(dlhandle); diff --git a/server/include/modinfo.h b/server/include/modinfo.h index 759cea0fb..f5e1f2d12 100644 --- a/server/include/modinfo.h +++ b/server/include/modinfo.h @@ -50,7 +50,8 @@ typedef enum { MODULE_API_ROUTER, MODULE_API_MONITOR, MODULE_API_FILTER, - MODULE_API_AUTHENTICATION + MODULE_API_AUTHENTICATION, + MODULE_API_QUERY_CLASSIFIER, } MODULE_API; /** diff --git a/server/include/modules.h b/server/include/modules.h index 96d322402..08c15cf2f 100644 --- a/server/include/modules.h +++ b/server/include/modules.h @@ -56,10 +56,11 @@ typedef struct modules { /** * Module types */ -#define MODULE_PROTOCOL "Protocol" /**< A protocol module type */ -#define MODULE_ROUTER "Router" /**< A router module type */ -#define MODULE_MONITOR "Monitor" /**< A database monitor module type */ -#define MODULE_FILTER "Filter" /**< A filter module type */ +#define MODULE_PROTOCOL "Protocol" /**< A protocol module type */ +#define MODULE_ROUTER "Router" /**< A router module type */ +#define MODULE_MONITOR "Monitor" /**< A database monitor module type */ +#define MODULE_FILTER "Filter" /**< A filter module type */ +#define MODULE_QUERY_CLASSIFIER "QueryClassifier" /**< A query classifier module type */ extern void *load_module(const char *module, const char *type);