Filter.h split into public and private parts

- include/maxscale/filter.h
- server/core/maxscale/filter.h
This commit is contained in:
Johan Wikman
2017-01-13 12:53:43 +02:00
parent 3e5e1bda6a
commit 356690c0e5
5 changed files with 76 additions and 58 deletions

View File

@ -13,22 +13,16 @@
*/ */
/** /**
* @file filter.h - The filter interface mechanisms * @file include/maxscale/filter.h - The public filter interface
*
* Revision History
*
* Date Who Description
* 27/05/2014 Mark Riddoch Initial implementation
*
*/ */
#include <maxscale/cdefs.h> #include <maxscale/cdefs.h>
#include <maxscale/config.h>
#include <maxscale/routing.h>
#include <maxscale/dcb.h>
#include <maxscale/session.h>
#include <maxscale/buffer.h>
#include <stdint.h> #include <stdint.h>
#include <maxscale/buffer.h>
#include <maxscale/config.h>
#include <maxscale/dcb.h>
#include <maxscale/routing.h>
#include <maxscale/session.h>
MXS_BEGIN_DECLS MXS_BEGIN_DECLS
@ -56,19 +50,17 @@ typedef void *MXS_FILTER_SESSION;
* The "module object" structure for a query router module * The "module object" structure for a query router module
* *
* The entry points are: * The entry points are:
* createInstance Called by the service to create a new * createInstance Called by the service to create a new instance of the filter
* instance of the filter * newSession Called to create a new user session within the filter
* newSession Called to create a new user session * closeSession Called when a session is closed
* within the filter * freeSession Called when a session is freed
* closeSession Called when a session is closed * setDownstream Sets the downstream component of the filter pipline
* freeSession Called when a session is freed * setUpstream Sets the upstream component of the filter pipline
* setDownstream Sets the downstream component of the * routeQuery Called on each query that requires routing
* filter pipline * clientReply Called for each reply packet
* routeQuery Called on each query that requires * diagnostics Called for diagnostic output
* routing * getCapabilities Called to obtain the capabilities of the filter
* clientReply Called for each reply packet * destroyInstance Called for destroying a filter instance
* diagnostics Called to force the filter to print
* diagnostic output
* *
* @endverbatim * @endverbatim
* *
@ -112,15 +104,8 @@ typedef struct filter_def
struct filter_def *next; /**< Next filter in the chain of all filters */ struct filter_def *next; /**< Next filter in the chain of all filters */
} FILTER_DEF; } FILTER_DEF;
FILTER_DEF *filter_alloc(const char *, const char *);
void filter_free(FILTER_DEF *);
bool filter_load(FILTER_DEF* filter);
FILTER_DEF *filter_find(const char *); FILTER_DEF *filter_find(const char *);
void filter_add_option(FILTER_DEF *, const char *);
void filter_add_parameter(FILTER_DEF *, const char *, const char *);
DOWNSTREAM *filter_apply(FILTER_DEF *, SESSION *, DOWNSTREAM *);
UPSTREAM *filter_upstream(FILTER_DEF *, void *, UPSTREAM *);
int filter_standard_parameter(const char *);
void dprintAllFilters(DCB *); void dprintAllFilters(DCB *);
void dprintFilter(DCB *, const FILTER_DEF *); void dprintFilter(DCB *, const FILTER_DEF *);
void dListFilters(DCB *); void dListFilters(DCB *);

View File

@ -0,0 +1,32 @@
#pragma once
/*
* Copyright (c) 2016 MariaDB Corporation Ab
*
* Use of this software is governed by the Business Source License included
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
*
* Change Date: 2019-07-01
*
* On the date above, in accordance with the Business Source License, use
* of this software will be governed by version 2 or later of the General
* Public License.
*/
/**
* @file core/maxscale/filter.h - The private filter interface
*/
#include <maxscale/filter.h>
MXS_BEGIN_DECLS
void filter_add_option(FILTER_DEF *filter_def, const char *option);
void filter_add_parameter(FILTER_DEF *filter_def, const char *name, const char *value);
FILTER_DEF *filter_alloc(const char *name, const char *module_name);
DOWNSTREAM *filter_apply(FILTER_DEF *filte_def, SESSION *session, DOWNSTREAM *downstream);
void filter_free(FILTER_DEF *filter_def);
bool filter_load(FILTER_DEF *filter_def);
int filter_standard_parameter(const char *name);
UPSTREAM *filter_upstream(FILTER_DEF *filter_def, void *fsession, UPSTREAM *upstream);
MXS_END_DECLS

View File

@ -38,6 +38,7 @@
* *
* @endverbatim * @endverbatim
*/ */
#include <maxscale/service.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -47,26 +48,25 @@
#include <sys/types.h> #include <sys/types.h>
#include <math.h> #include <math.h>
#include <fcntl.h> #include <fcntl.h>
#include <maxscale/session.h>
#include <maxscale/protocol.h>
#include <maxscale/listener.h>
#include <maxscale/server.h>
#include <maxscale/router.h>
#include <maxscale/spinlock.h>
#include <maxscale/modules.h>
#include <maxscale/dcb.h>
#include <maxscale/users.h>
#include <maxscale/filter.h>
#include <maxscale/poll.h>
#include <maxscale/log_manager.h>
#include <maxscale/housekeeper.h>
#include <maxscale/resultset.h>
#include <maxscale/gwdirs.h>
#include <maxscale/version.h>
#include <maxscale/queuemanager.h>
#include <maxscale/alloc.h> #include <maxscale/alloc.h>
#include <maxscale/dcb.h>
#include <maxscale/gwdirs.h>
#include <maxscale/housekeeper.h>
#include <maxscale/listener.h>
#include <maxscale/log_manager.h>
#include <maxscale/modules.h>
#include <maxscale/poll.h>
#include <maxscale/protocol.h>
#include <maxscale/queuemanager.h>
#include <maxscale/resultset.h>
#include <maxscale/router.h>
#include <maxscale/server.h>
#include <maxscale/session.h>
#include <maxscale/spinlock.h>
#include <maxscale/users.h>
#include <maxscale/utils.h> #include <maxscale/utils.h>
#include <maxscale/version.h>
#include "maxscale/filter.h"
#include "maxscale/service.h" #include "maxscale/service.h"
/** Base value for server weights */ /** Base value for server weights */

View File

@ -27,21 +27,22 @@
* *
* @endverbatim * @endverbatim
*/ */
#include <maxscale/session.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <unistd.h> #include <unistd.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <maxscale/alloc.h> #include <maxscale/alloc.h>
#include <maxscale/session.h>
#include <maxscale/service.h>
#include <maxscale/router.h>
#include <maxscale/dcb.h>
#include <maxscale/spinlock.h>
#include <maxscale/atomic.h> #include <maxscale/atomic.h>
#include <maxscale/log_manager.h> #include <maxscale/dcb.h>
#include <maxscale/housekeeper.h> #include <maxscale/housekeeper.h>
#include <maxscale/log_manager.h>
#include <maxscale/poll.h> #include <maxscale/poll.h>
#include <maxscale/router.h>
#include <maxscale/service.h>
#include <maxscale/spinlock.h>
#include "maxscale/filter.h"
/* A session with null values, used for initialization */ /* A session with null values, used for initialization */
static SESSION session_initialized = SESSION_INIT; static SESSION session_initialized = SESSION_INIT;

View File

@ -33,7 +33,7 @@
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <maxscale/filter.h> #include "../maxscale/filter.h"
/** /**