Rename UPSTREAM to MXS_UPSTREAM

And DOWNSTREAM to MXS_DOWNSTREAM
This commit is contained in:
Johan Wikman
2017-01-13 13:40:03 +02:00
parent 356690c0e5
commit 424849a9a2
20 changed files with 100 additions and 99 deletions

View File

@ -72,8 +72,8 @@ typedef struct mxs_filter_object
MXS_FILTER_SESSION *(*newSession)(MXS_FILTER *instance, SESSION *session); MXS_FILTER_SESSION *(*newSession)(MXS_FILTER *instance, SESSION *session);
void (*closeSession)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession); void (*closeSession)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
void (*freeSession)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession); void (*freeSession)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession);
void (*setDownstream)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DOWNSTREAM *downstream); void (*setDownstream)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
void (*setUpstream)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, UPSTREAM *downstream); void (*setUpstream)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_UPSTREAM *downstream);
int32_t (*routeQuery)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue); int32_t (*routeQuery)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
int32_t (*clientReply)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue); int32_t (*clientReply)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
void (*diagnostics)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb); void (*diagnostics)(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb);

View File

@ -46,7 +46,7 @@ public:
m_data.routeQuery = NULL; m_data.routeQuery = NULL;
} }
Downstream(const DOWNSTREAM& down) Downstream(const MXS_DOWNSTREAM& down)
: m_data(down) : m_data(down)
{} {}
@ -63,7 +63,7 @@ public:
return m_data.routeQuery(m_data.instance, m_data.session, pPacket); return m_data.routeQuery(m_data.instance, m_data.session, pPacket);
} }
DOWNSTREAM m_data; MXS_DOWNSTREAM m_data;
}; };
class Upstream class Upstream
@ -81,7 +81,7 @@ public:
m_data.clientReply = NULL; m_data.clientReply = NULL;
} }
Upstream(const UPSTREAM& up) Upstream(const MXS_UPSTREAM& up)
: m_data(up) : m_data(up)
{} {}
@ -98,7 +98,7 @@ public:
return m_data.clientReply(m_data.instance, m_data.session, pPacket); return m_data.clientReply(m_data.instance, m_data.session, pPacket);
} }
UPSTREAM m_data; MXS_UPSTREAM m_data;
}; };
/** /**
@ -236,7 +236,7 @@ public:
MXS_EXCEPTION_GUARD(delete pFilterSession); MXS_EXCEPTION_GUARD(delete pFilterSession);
} }
static void setDownstream(MXS_FILTER*, MXS_FILTER_SESSION* pData, DOWNSTREAM* pDownstream) static void setDownstream(MXS_FILTER*, MXS_FILTER_SESSION* pData, MXS_DOWNSTREAM* pDownstream)
{ {
FilterSessionType* pFilterSession = reinterpret_cast<FilterSessionType*>(pData); FilterSessionType* pFilterSession = reinterpret_cast<FilterSessionType*>(pData);
@ -245,7 +245,7 @@ public:
MXS_EXCEPTION_GUARD(pFilterSession->setDownstream(down)); MXS_EXCEPTION_GUARD(pFilterSession->setDownstream(down));
} }
static void setUpstream(MXS_FILTER* pInstance, MXS_FILTER_SESSION* pData, UPSTREAM* pUpstream) static void setUpstream(MXS_FILTER* pInstance, MXS_FILTER_SESSION* pData, MXS_UPSTREAM* pUpstream)
{ {
FilterSessionType* pFilterSession = reinterpret_cast<FilterSessionType*>(pData); FilterSessionType* pFilterSession = reinterpret_cast<FilterSessionType*>(pData);

View File

@ -103,28 +103,28 @@ const char* session_trx_state_to_string(session_trx_state_t state);
* The downstream element in the filter chain. This may refer to * The downstream element in the filter chain. This may refer to
* another filter or to a router. * another filter or to a router.
*/ */
typedef struct typedef struct mxs_downstream
{ {
void *instance; void *instance;
void *session; void *session;
int (*routeQuery)(void *instance, void *session, GWBUF *request); int32_t (*routeQuery)(void *instance, void *session, GWBUF *request);
} DOWNSTREAM; } MXS_DOWNSTREAM;
#define DOWNSTREAM_INIT {0} #define MXS_DOWNSTREAM_INIT {0}
/** /**
* The upstream element in the filter chain. This may refer to * The upstream element in the filter chain. This may refer to
* another filter or to the protocol implementation. * another filter or to the protocol implementation.
*/ */
typedef struct typedef struct mxs_upstream
{ {
void *instance; void *instance;
void *session; void *session;
int (*clientReply)(void *instance, void *session, GWBUF *response); int32_t (*clientReply)(void *instance, void *session, GWBUF *response);
int (*error)(void *instance, void *session, void *); int32_t (*error)(void *instance, void *session, void *);
} UPSTREAM; } MXS_UPSTREAM;
#define UPSTREAM_INIT {0} #define MXS_UPSTREAM_INIT {0}
/** /**
* Structure used to track the filter instances and sessions of the filters * Structure used to track the filter instances and sessions of the filters
@ -171,8 +171,8 @@ typedef struct session
struct service *service; /*< The service this session is using */ struct service *service; /*< The service this session is using */
int n_filters; /*< Number of filter sessions */ int n_filters; /*< Number of filter sessions */
SESSION_FILTER *filters; /*< The filters in use within this session */ SESSION_FILTER *filters; /*< The filters in use within this session */
DOWNSTREAM head; /*< Head of the filter chain */ MXS_DOWNSTREAM head; /*< Head of the filter chain */
UPSTREAM tail; /*< The tail of the filter chain */ MXS_UPSTREAM tail; /*< The tail of the filter chain */
int refcount; /*< Reference count on the session */ int refcount; /*< Reference count on the session */
bool ses_is_child; /*< this is a child session */ bool ses_is_child; /*< this is a child session */
session_trx_state_t trx_state; /*< The current transaction state. */ session_trx_state_t trx_state; /*< The current transaction state. */
@ -186,7 +186,7 @@ typedef struct session
} SESSION; } SESSION;
#define SESSION_INIT {.ses_chk_top = CHK_NUM_SESSION, .ses_lock = SPINLOCK_INIT, \ #define SESSION_INIT {.ses_chk_top = CHK_NUM_SESSION, .ses_lock = SPINLOCK_INIT, \
.stats = SESSION_STATS_INIT, .head = DOWNSTREAM_INIT, .tail = UPSTREAM_INIT, \ .stats = SESSION_STATS_INIT, .head = MXS_DOWNSTREAM_INIT, .tail = MXS_UPSTREAM_INIT, \
.state = SESSION_STATE_ALLOC, .ses_chk_tail = CHK_NUM_SESSION} .state = SESSION_STATE_ALLOC, .ses_chk_tail = CHK_NUM_SESSION}
#define SESSION_PROTOCOL(x, type) DCB_PROTOCOL((x)->client_dcb, type) #define SESSION_PROTOCOL(x, type) DCB_PROTOCOL((x)->client_dcb, type)

View File

@ -66,6 +66,7 @@
#include <maxscale/utils.h> #include <maxscale/utils.h>
#include <maxscale/gwdirs.h> #include <maxscale/gwdirs.h>
#include "maxscale/filter.h"
#include "maxscale/service.h" #include "maxscale/service.h"
typedef struct duplicate_context typedef struct duplicate_context

View File

@ -399,12 +399,12 @@ bool filter_load(FILTER_DEF* filter)
* @return The downstream component for the next filter or NULL * @return The downstream component for the next filter or NULL
* if the filter could not be created * if the filter could not be created
*/ */
DOWNSTREAM * MXS_DOWNSTREAM *
filter_apply(FILTER_DEF *filter, SESSION *session, DOWNSTREAM *downstream) filter_apply(FILTER_DEF *filter, SESSION *session, MXS_DOWNSTREAM *downstream)
{ {
DOWNSTREAM *me; MXS_DOWNSTREAM *me;
if ((me = (DOWNSTREAM *)MXS_CALLOC(1, sizeof(DOWNSTREAM))) == NULL) if ((me = (MXS_DOWNSTREAM *)MXS_CALLOC(1, sizeof(MXS_DOWNSTREAM))) == NULL)
{ {
return NULL; return NULL;
} }
@ -434,10 +434,10 @@ filter_apply(FILTER_DEF *filter, SESSION *session, DOWNSTREAM *downstream)
* @param upstream The filter that should be upstream of this filter * @param upstream The filter that should be upstream of this filter
* @return The upstream component for the next filter * @return The upstream component for the next filter
*/ */
UPSTREAM * MXS_UPSTREAM *
filter_upstream(FILTER_DEF *filter, void *fsession, UPSTREAM *upstream) filter_upstream(FILTER_DEF *filter, void *fsession, MXS_UPSTREAM *upstream)
{ {
UPSTREAM *me = NULL; MXS_UPSTREAM *me = NULL;
/* /*
* The the filter has no setUpstream entry point then is does * The the filter has no setUpstream entry point then is does
@ -450,7 +450,7 @@ filter_upstream(FILTER_DEF *filter, void *fsession, UPSTREAM *upstream)
if (filter->obj->clientReply != NULL) if (filter->obj->clientReply != NULL)
{ {
if ((me = (UPSTREAM *)MXS_CALLOC(1, sizeof(UPSTREAM))) == NULL) if ((me = (MXS_UPSTREAM *)MXS_CALLOC(1, sizeof(MXS_UPSTREAM))) == NULL)
{ {
return NULL; return NULL;
} }

View File

@ -23,10 +23,10 @@ MXS_BEGIN_DECLS
void filter_add_option(FILTER_DEF *filter_def, const char *option); 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); 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); FILTER_DEF *filter_alloc(const char *name, const char *module_name);
DOWNSTREAM *filter_apply(FILTER_DEF *filte_def, SESSION *session, DOWNSTREAM *downstream); MXS_DOWNSTREAM *filter_apply(FILTER_DEF *filter_def, SESSION *session, MXS_DOWNSTREAM *downstream);
void filter_free(FILTER_DEF *filter_def); void filter_free(FILTER_DEF *filter_def);
bool filter_load(FILTER_DEF *filter_def); bool filter_load(FILTER_DEF *filter_def);
int filter_standard_parameter(const char *name); int filter_standard_parameter(const char *name);
UPSTREAM *filter_upstream(FILTER_DEF *filter_def, void *fsession, UPSTREAM *upstream); MXS_UPSTREAM *filter_upstream(FILTER_DEF *filter_def, void *fsession, MXS_UPSTREAM *upstream);
MXS_END_DECLS MXS_END_DECLS

View File

@ -627,8 +627,8 @@ static int
session_setup_filters(SESSION *session) session_setup_filters(SESSION *session)
{ {
SERVICE *service = session->service; SERVICE *service = session->service;
DOWNSTREAM *head; MXS_DOWNSTREAM *head;
UPSTREAM *tail; MXS_UPSTREAM *tail;
int i; int i;
if ((session->filters = MXS_CALLOC(service->n_filters, if ((session->filters = MXS_CALLOC(service->n_filters,

View File

@ -50,7 +50,7 @@ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PARA
static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session);
static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DOWNSTREAM *downstream); static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue); static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb); static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb);
static uint64_t getCapabilities(void); static uint64_t getCapabilities(void);
@ -86,7 +86,7 @@ typedef struct
*/ */
typedef struct typedef struct
{ {
DOWNSTREAM down; /*< The downstream filter */ MXS_DOWNSTREAM down; /*< The downstream filter */
int hints_left; /*< Number of hints left to add to queries*/ int hints_left; /*< Number of hints left to add to queries*/
time_t last_modification; /*< Time of the last data modifying operation */ time_t last_modification; /*< Time of the last data modifying operation */
} CCR_SESSION; } CCR_SESSION;
@ -269,7 +269,7 @@ freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session)
* @param downstream The downstream filter or router * @param downstream The downstream filter or router
*/ */
static void static void
setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, DOWNSTREAM *downstream) setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, MXS_DOWNSTREAM *downstream)
{ {
CCR_SESSION *my_session = (CCR_SESSION *)session; CCR_SESSION *my_session = (CCR_SESSION *)session;

View File

@ -98,7 +98,7 @@ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PARAM
static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session);
static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DOWNSTREAM *downstream); static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue); static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb); static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb);
static uint64_t getCapabilities(void); static uint64_t getCapabilities(void);
@ -260,11 +260,11 @@ typedef struct
*/ */
typedef struct typedef struct
{ {
SESSION* session; /*< Client session structure */ SESSION *session; /*< Client session structure */
char* errmsg; /*< Rule specific error message */ char *errmsg; /*< Rule specific error message */
QUERYSPEED* query_speed; /*< How fast the user has executed queries */ QUERYSPEED *query_speed; /*< How fast the user has executed queries */
DOWNSTREAM down; /*< Next object in the downstream chain */ MXS_DOWNSTREAM down; /*< Next object in the downstream chain */
UPSTREAM up; /*< Next object in the upstream chain */ MXS_UPSTREAM up; /*< Next object in the upstream chain */
} FW_SESSION; } FW_SESSION;
bool parse_at_times(const char** tok, char** saveptr, RULE* ruledef); bool parse_at_times(const char** tok, char** saveptr, RULE* ruledef);
@ -1638,7 +1638,7 @@ freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session)
* @param downstream The downstream filter or router. * @param downstream The downstream filter or router.
*/ */
static void static void
setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, DOWNSTREAM *downstream) setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, MXS_DOWNSTREAM *downstream)
{ {
FW_SESSION *my_session = (FW_SESSION *) session; FW_SESSION *my_session = (FW_SESSION *) session;
my_session->down = *downstream; my_session->down = *downstream;

View File

@ -27,7 +27,7 @@ static MXS_FILTER *createInstance(const char* name, char **options, CONFIG_PARAM
static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session);
static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DOWNSTREAM *downstream); static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue); static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb); static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb);
static uint64_t getCapabilities(void); static uint64_t getCapabilities(void);
@ -176,7 +176,7 @@ freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session)
* @param downstream The downstream filter or router * @param downstream The downstream filter or router
*/ */
static void static void
setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, DOWNSTREAM *downstream) setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, MXS_DOWNSTREAM *downstream)
{ {
HINT_SESSION *my_session = (HINT_SESSION *)session; HINT_SESSION *my_session = (HINT_SESSION *)session;

View File

@ -90,7 +90,7 @@ typedef struct
*/ */
typedef struct typedef struct
{ {
DOWNSTREAM down; MXS_DOWNSTREAM down;
GWBUF *request; GWBUF *request;
int query_len; int query_len;
HINTSTACK *stack; HINTSTACK *stack;

View File

@ -50,8 +50,8 @@ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PARAM
static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session);
static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata); static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata);
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata); static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata);
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata, DOWNSTREAM *downstream); static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata, MXS_DOWNSTREAM *downstream);
static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata, UPSTREAM *upstream); static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata, MXS_UPSTREAM *upstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata, GWBUF *queue); static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata, GWBUF *queue);
static int clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata, GWBUF *queue); static int clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata, GWBUF *queue);
static void diagnostics(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata, DCB *dcb); static void diagnostics(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata, DCB *dcb);
@ -154,8 +154,8 @@ static void maxrows_response_state_reset(MAXROWS_RESPONSE_STATE *state);
typedef struct maxrows_session_data typedef struct maxrows_session_data
{ {
MAXROWS_INSTANCE *instance; /**< The maxrows instance the session is associated with. */ MAXROWS_INSTANCE *instance; /**< The maxrows instance the session is associated with. */
DOWNSTREAM down; /**< The previous filter or equivalent. */ MXS_DOWNSTREAM down; /**< The previous filter or equivalent. */
UPSTREAM up; /**< The next filter or equivalent. */ MXS_UPSTREAM up; /**< The next filter or equivalent. */
MAXROWS_RESPONSE_STATE res; /**< The response state. */ MAXROWS_RESPONSE_STATE res; /**< The response state. */
SESSION *session; /**< The session this data is associated with. */ SESSION *session; /**< The session this data is associated with. */
maxrows_session_state_t state; maxrows_session_state_t state;
@ -252,7 +252,7 @@ static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata)
* @param sdata The session data of the session * @param sdata The session data of the session
* @param down The downstream filter or router * @param down The downstream filter or router
*/ */
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata, DOWNSTREAM *down) static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata, MXS_DOWNSTREAM *down)
{ {
MAXROWS_INSTANCE *cinstance = (MAXROWS_INSTANCE*)instance; MAXROWS_INSTANCE *cinstance = (MAXROWS_INSTANCE*)instance;
MAXROWS_SESSION_DATA *csdata = (MAXROWS_SESSION_DATA*)sdata; MAXROWS_SESSION_DATA *csdata = (MAXROWS_SESSION_DATA*)sdata;
@ -267,7 +267,7 @@ static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata, DOWNS
* @param sdata The session data of the session * @param sdata The session data of the session
* @param up The upstream filter or router * @param up The upstream filter or router
*/ */
static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata, UPSTREAM *up) static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *sdata, MXS_UPSTREAM *up)
{ {
MAXROWS_INSTANCE *cinstance = (MAXROWS_INSTANCE*)instance; MAXROWS_INSTANCE *cinstance = (MAXROWS_INSTANCE*)instance;
MAXROWS_SESSION_DATA *csdata = (MAXROWS_SESSION_DATA*)sdata; MAXROWS_SESSION_DATA *csdata = (MAXROWS_SESSION_DATA*)sdata;

View File

@ -87,8 +87,8 @@ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PARAM
static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session);
static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DOWNSTREAM *downstream); static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, UPSTREAM *upstream); static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_UPSTREAM *upstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue); static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static int clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue); static int clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb); static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb);
@ -229,8 +229,8 @@ typedef struct
{ {
char* uid; /**Unique identifier used to tag messages*/ char* uid; /**Unique identifier used to tag messages*/
char* db; /**The currently active database*/ char* db; /**The currently active database*/
DOWNSTREAM down; MXS_DOWNSTREAM down;
UPSTREAM up; MXS_UPSTREAM up;
SESSION* session; SESSION* session;
bool was_query; /**True if the previous routeQuery call had valid content*/ bool was_query; /**True if the previous routeQuery call had valid content*/
} MQ_SESSION; } MQ_SESSION;
@ -873,13 +873,13 @@ freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session)
* @param downstream The downstream filter or router. * @param downstream The downstream filter or router.
*/ */
static void static void
setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, DOWNSTREAM *downstream) setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, MXS_DOWNSTREAM *downstream)
{ {
MQ_SESSION *my_session = (MQ_SESSION *) session; MQ_SESSION *my_session = (MQ_SESSION *) session;
my_session->down = *downstream; my_session->down = *downstream;
} }
static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, UPSTREAM *upstream) static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, MXS_UPSTREAM *upstream)
{ {
MQ_SESSION *my_session = (MQ_SESSION *) session; MQ_SESSION *my_session = (MQ_SESSION *) session;
my_session->up = *upstream; my_session->up = *upstream;

View File

@ -44,7 +44,7 @@ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PARAM
static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session);
static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DOWNSTREAM *downstream); static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue); static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb); static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb);
static uint64_t getCapabilities(void); static uint64_t getCapabilities(void);
@ -66,7 +66,7 @@ typedef struct
*/ */
typedef struct typedef struct
{ {
DOWNSTREAM down; /* The downstream filter */ MXS_DOWNSTREAM down; /* The downstream filter */
int n_diverted; /* No. of statements diverted */ int n_diverted; /* No. of statements diverted */
int n_undiverted; /* No. of statements not diverted */ int n_undiverted; /* No. of statements not diverted */
int active; /* Is filter active */ int active; /* Is filter active */
@ -258,7 +258,7 @@ freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session)
* @param downstream The downstream filter or router * @param downstream The downstream filter or router
*/ */
static void static void
setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, DOWNSTREAM *downstream) setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, MXS_DOWNSTREAM *downstream)
{ {
REGEXHINT_SESSION *my_session = (REGEXHINT_SESSION *) session; REGEXHINT_SESSION *my_session = (REGEXHINT_SESSION *) session;
my_session->down = *downstream; my_session->down = *downstream;

View File

@ -77,7 +77,7 @@ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PARAM
static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session);
static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DOWNSTREAM *downstream); static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue); static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb); static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb);
static uint64_t getCapabilities(void); static uint64_t getCapabilities(void);
@ -121,7 +121,7 @@ typedef struct
typedef struct typedef struct
{ {
int active; int active;
DOWNSTREAM down; MXS_DOWNSTREAM down;
char *filename; /* The session-specific log file name */ char *filename; /* The session-specific log file name */
FILE *fp; /* The session-specific log file */ FILE *fp; /* The session-specific log file */
const char *remote; const char *remote;
@ -483,7 +483,7 @@ freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session)
* @param downstream The downstream filter or router. * @param downstream The downstream filter or router.
*/ */
static void static void
setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, DOWNSTREAM *downstream) setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, MXS_DOWNSTREAM *downstream)
{ {
QLA_SESSION *my_session = (QLA_SESSION *) session; QLA_SESSION *my_session = (QLA_SESSION *) session;

View File

@ -44,7 +44,7 @@ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PARAM
static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session);
static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DOWNSTREAM *downstream); static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue); static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb); static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb);
static uint64_t getCapabilities(void); static uint64_t getCapabilities(void);
@ -72,7 +72,7 @@ typedef struct
*/ */
typedef struct typedef struct
{ {
DOWNSTREAM down; /* The downstream filter */ MXS_DOWNSTREAM down; /* The downstream filter */
SPINLOCK lock; SPINLOCK lock;
int no_change; /* No. of unchanged requests */ int no_change; /* No. of unchanged requests */
int replacements; /* No. of changed requests */ int replacements; /* No. of changed requests */
@ -308,7 +308,7 @@ freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session)
* @param downstream The downstream filter or router * @param downstream The downstream filter or router
*/ */
static void static void
setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, DOWNSTREAM *downstream) setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, MXS_DOWNSTREAM *downstream)
{ {
REGEX_SESSION *my_session = (REGEX_SESSION *) session; REGEX_SESSION *my_session = (REGEX_SESSION *) session;
my_session->down = *downstream; my_session->down = *downstream;

View File

@ -101,8 +101,8 @@ static MXS_FILTER *createInstance(const char* name, char **options, CONFIG_PARAM
static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session);
static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DOWNSTREAM *downstream); static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, UPSTREAM *upstream); static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_UPSTREAM *upstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue); static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static int clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue); static int clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb); static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb);
@ -133,8 +133,8 @@ typedef struct
*/ */
typedef struct typedef struct
{ {
DOWNSTREAM down; /* The downstream filter */ MXS_DOWNSTREAM down; /* The downstream filter */
UPSTREAM up; /* The upstream filter */ MXS_UPSTREAM up; /* The upstream filter */
int active; /* filter is active? */ int active; /* filter is active? */
bool use_ok; bool use_ok;
int client_multistatement; int client_multistatement;
@ -631,7 +631,7 @@ freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session)
* @param downstream The downstream filter or router. * @param downstream The downstream filter or router.
*/ */
static void static void
setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, DOWNSTREAM *downstream) setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, MXS_DOWNSTREAM *downstream)
{ {
TEE_SESSION *my_session = (TEE_SESSION *) session; TEE_SESSION *my_session = (TEE_SESSION *) session;
my_session->down = *downstream; my_session->down = *downstream;
@ -646,7 +646,7 @@ setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, DOWNSTREAM *dow
* @param downstream The downstream filter or router. * @param downstream The downstream filter or router.
*/ */
static void static void
setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, UPSTREAM *upstream) setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, MXS_UPSTREAM *upstream)
{ {
TEE_SESSION *my_session = (TEE_SESSION *) session; TEE_SESSION *my_session = (TEE_SESSION *) session;
my_session->up = *upstream; my_session->up = *upstream;

View File

@ -34,7 +34,7 @@ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PAR
static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session);
static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DOWNSTREAM *downstream); static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue); static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb); static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb);
static uint64_t getCapabilities(void); static uint64_t getCapabilities(void);
@ -57,7 +57,7 @@ typedef struct
*/ */
typedef struct typedef struct
{ {
DOWNSTREAM down; MXS_DOWNSTREAM down;
int count; int count;
} TEST_SESSION; } TEST_SESSION;
@ -184,7 +184,7 @@ freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session)
* @param downstream The downstream filter or router * @param downstream The downstream filter or router
*/ */
static void static void
setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, DOWNSTREAM *downstream) setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, MXS_DOWNSTREAM *downstream)
{ {
TEST_SESSION *my_session = (TEST_SESSION *)session; TEST_SESSION *my_session = (TEST_SESSION *)session;

View File

@ -52,8 +52,8 @@ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PARAM
static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session);
static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DOWNSTREAM *downstream); static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, UPSTREAM *upstream); static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_UPSTREAM *upstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue); static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static int clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue); static int clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb); static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb);
@ -99,8 +99,8 @@ typedef struct topnq
*/ */
typedef struct typedef struct
{ {
DOWNSTREAM down; MXS_DOWNSTREAM down;
UPSTREAM up; MXS_UPSTREAM up;
int active; int active;
char *clientHost; char *clientHost;
char *userName; char *userName;
@ -426,7 +426,7 @@ freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session)
* @param downstream The downstream filter or router. * @param downstream The downstream filter or router.
*/ */
static void static void
setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, DOWNSTREAM *downstream) setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, MXS_DOWNSTREAM *downstream)
{ {
TOPN_SESSION *my_session = (TOPN_SESSION *) session; TOPN_SESSION *my_session = (TOPN_SESSION *) session;
@ -442,7 +442,7 @@ setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, DOWNSTREAM *dow
* @param upstream The upstream filter or session. * @param upstream The upstream filter or session.
*/ */
static void static void
setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, UPSTREAM *upstream) setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, MXS_UPSTREAM *upstream)
{ {
TOPN_SESSION *my_session = (TOPN_SESSION *) session; TOPN_SESSION *my_session = (TOPN_SESSION *) session;

View File

@ -79,8 +79,8 @@ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PAR
static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session);
static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session); static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session);
static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DOWNSTREAM *downstream); static void setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_DOWNSTREAM *downstream);
static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, UPSTREAM *upstream); static void setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, MXS_UPSTREAM *upstream);
static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue); static int routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static int clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue); static int clientReply(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, GWBUF *queue);
static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb); static void diagnostic(MXS_FILTER *instance, MXS_FILTER_SESSION *fsession, DCB *dcb);
@ -116,8 +116,8 @@ typedef struct
*/ */
typedef struct typedef struct
{ {
DOWNSTREAM down; MXS_DOWNSTREAM down;
UPSTREAM up; MXS_UPSTREAM up;
int active; int active;
char *clientHost; char *clientHost;
char *userName; char *userName;
@ -392,7 +392,7 @@ freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session)
* @param downstream The downstream filter or router. * @param downstream The downstream filter or router.
*/ */
static void static void
setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, DOWNSTREAM *downstream) setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, MXS_DOWNSTREAM *downstream)
{ {
TPM_SESSION *my_session = (TPM_SESSION *)session; TPM_SESSION *my_session = (TPM_SESSION *)session;
@ -408,7 +408,7 @@ setDownstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, DOWNSTREAM *dow
* @param upstream The upstream filter or session. * @param upstream The upstream filter or session.
*/ */
static void static void
setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, UPSTREAM *upstream) setUpstream(MXS_FILTER *instance, MXS_FILTER_SESSION *session, MXS_UPSTREAM *upstream)
{ {
TPM_SESSION *my_session = (TPM_SESSION *)session; TPM_SESSION *my_session = (TPM_SESSION *)session;