Give parameters as CONFIG_PARAMETER for FILTER::createInstance

The filters should use the same configuration parameters as other modules
use. This allows them to use the common configuration management functions
to get values from it.
This commit is contained in:
Markus Mäkelä
2017-01-05 16:22:34 +02:00
parent e75cdb2ceb
commit 2611f9a701
20 changed files with 206 additions and 257 deletions

View File

@ -23,6 +23,7 @@
*/
#include <maxscale/cdefs.h>
#include <maxscale/config.h>
#include <maxscale/routing.h>
#include <maxscale/dcb.h>
#include <maxscale/session.h>
@ -37,15 +38,6 @@ MXS_BEGIN_DECLS
*/
typedef void *FILTER;
/**
* The structure used to pass name, value pairs to the filter instances
*/
typedef struct
{
char *name; /**< Name of the parameter */
char *value; /**< Value of the parameter */
} FILTER_PARAMETER;
/**
* @verbatim
* The "module object" structure for a query router module
@ -73,7 +65,7 @@ typedef struct filter_object
{
FILTER *(*createInstance)(const char *name,
char **options,
FILTER_PARAMETER **params);
CONFIG_PARAMETER *params);
void *(*newSession)(FILTER *instance, SESSION *session);
void (*closeSession)(FILTER *instance, void *fsession);
void (*freeSession)(FILTER *instance, void *fsession);
@ -102,7 +94,7 @@ typedef struct filter_def
char *name; /**< The Filter name */
char *module; /**< The module to load */
char **options; /**< The options set for this filter */
FILTER_PARAMETER **parameters; /**< The filter parameters */
CONFIG_PARAMETER *parameters; /**< The filter parameters */
FILTER filter; /**< The runtime filter */
FILTER_OBJECT *obj; /**< The "MODULE_OBJECT" for the filter */
SPINLOCK spin; /**< Spinlock to protect the filter definition */