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:
@ -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 */
|
||||
|
@ -203,7 +203,7 @@ template<class FilterType, class FilterSessionType>
|
||||
class Filter
|
||||
{
|
||||
public:
|
||||
static FILTER* createInstance(const char* zName, char** pzOptions, FILTER_PARAMETER** ppParams)
|
||||
static FILTER* createInstance(const char* zName, char** pzOptions, CONFIG_PARAMETER* ppParams)
|
||||
{
|
||||
FilterType* pFilter = NULL;
|
||||
|
||||
|
Reference in New Issue
Block a user