Addition of API modinfo implementation for filters
This commit is contained in:
parent
b764745fc3
commit
1d48794963
@ -179,6 +179,16 @@ MODULE_INFO *mod_info = NULL;
|
||||
module)));
|
||||
fatal = 1;
|
||||
}
|
||||
if (strcmp(type, MODULE_FILTER) == 0
|
||||
&& mod_info->modapi != MODULE_API_FILTER)
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"Module '%s' does not implement "
|
||||
"the filter API.\n",
|
||||
module)));
|
||||
fatal = 1;
|
||||
}
|
||||
if (fatal)
|
||||
{
|
||||
dlclose(dlhandle);
|
||||
|
@ -69,6 +69,13 @@ typedef struct filter_object {
|
||||
void (*diagnostics)(FILTER *instance, void *fsession, DCB *dcb);
|
||||
} FILTER_OBJECT;
|
||||
|
||||
/**
|
||||
* The filter API version. If the FILTER_OBJECT structure or the filter API
|
||||
* is changed these values must be updated in line with the rules in the
|
||||
* file modinfo.h.
|
||||
*/
|
||||
#define FILTER_VERSION {1, 0, 0}
|
||||
|
||||
/**
|
||||
* The definition of a filter form the configuration file.
|
||||
* This is basically the link between a plugin to load and the
|
||||
|
@ -31,8 +31,16 @@
|
||||
#include <stdio.h>
|
||||
#include <fcntl.h>
|
||||
#include <filter.h>
|
||||
#include <modinfo.h>
|
||||
#include <string.h>
|
||||
|
||||
MODULE_INFO info = {
|
||||
MODULE_API_FILTER,
|
||||
MODULE_ALPHA_RELEASE,
|
||||
FILTER_VERSION,
|
||||
"A simple query logging filter"
|
||||
};
|
||||
|
||||
static char *version_str = "V1.0.0";
|
||||
|
||||
/*
|
||||
|
@ -17,6 +17,7 @@
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <filter.h>
|
||||
#include <modinfo.h>
|
||||
|
||||
/**
|
||||
* testfilter.c - a very simple test filter.
|
||||
@ -28,6 +29,13 @@
|
||||
* Reporting is done via the diagnostics print routine.
|
||||
*/
|
||||
|
||||
MODULE_INFO info = {
|
||||
MODULE_API_FILTER,
|
||||
MODULE_ALPHA_RELEASE,
|
||||
FILTER_VERSION,
|
||||
"A simple query counting filter"
|
||||
};
|
||||
|
||||
static char *version_str = "V1.0.0";
|
||||
|
||||
static FILTER *createInstance(char **options);
|
||||
|
Loading…
x
Reference in New Issue
Block a user