diff --git a/include/maxscale/filter.h b/include/maxscale/filter.h index 431a68f3b..5dbd06639 100644 --- a/include/maxscale/filter.h +++ b/include/maxscale/filter.h @@ -69,7 +69,7 @@ typedef void *MXS_FILTER_SESSION; typedef struct mxs_filter_object { MXS_FILTER *(*createInstance)(const char *name, char **options, CONFIG_PARAMETER *params); - MXS_FILTER_SESSION *(*newSession)(MXS_FILTER *instance, SESSION *session); + MXS_FILTER_SESSION *(*newSession)(MXS_FILTER *instance, MXS_SESSION *session); void (*closeSession)(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, MXS_DOWNSTREAM *downstream); diff --git a/include/maxscale/filter.hh b/include/maxscale/filter.hh index 4f94d2d7a..8e6c87ad1 100644 --- a/include/maxscale/filter.hh +++ b/include/maxscale/filter.hh @@ -150,10 +150,10 @@ public: void diagnostics(DCB *pDcb); protected: - FilterSession(SESSION* pSession); + FilterSession(MXS_SESSION* pSession); protected: - SESSION* m_pSession; /*< The SESSION this filter session is associated with. */ + MXS_SESSION* m_pSession; /*< The SESSION this filter session is associated with. */ Downstream m_down; /*< The downstream component. */ Upstream m_up; /*< The upstream component. */ }; @@ -212,7 +212,7 @@ public: return reinterpret_cast(pFilter); } - static MXS_FILTER_SESSION* newSession(MXS_FILTER* pInstance, SESSION* pSession) + static MXS_FILTER_SESSION* newSession(MXS_FILTER* pInstance, MXS_SESSION* pSession) { FilterType* pFilter = reinterpret_cast(pInstance); void* pFilterSession; diff --git a/include/maxscale/modulecmd.h b/include/maxscale/modulecmd.h index 152b3f61f..840a9d2d2 100644 --- a/include/maxscale/modulecmd.h +++ b/include/maxscale/modulecmd.h @@ -89,7 +89,7 @@ struct arg_node bool boolean; SERVICE *service; SERVER *server; - SESSION *session; + MXS_SESSION *session; DCB *dcb; MXS_MONITOR *monitor; MXS_FILTER_DEF *filter; diff --git a/include/maxscale/router.h b/include/maxscale/router.h index 6e7ba4dfb..86aa38966 100644 --- a/include/maxscale/router.h +++ b/include/maxscale/router.h @@ -70,7 +70,7 @@ typedef enum error_action typedef struct router_object { ROUTER *(*createInstance)(SERVICE *service, char **options); - void *(*newSession)(ROUTER *instance, SESSION *session); + void *(*newSession)(ROUTER *instance, MXS_SESSION *session); void (*closeSession)(ROUTER *instance, void *router_session); void (*freeSession)(ROUTER *instance, void *router_session); int32_t (*routeQuery)(ROUTER *instance, void *router_session, GWBUF *queue); diff --git a/include/maxscale/session.h b/include/maxscale/session.h index d14d17bc9..8b78df697 100644 --- a/include/maxscale/session.h +++ b/include/maxscale/session.h @@ -69,7 +69,7 @@ typedef enum SESSION_STATE_TO_BE_FREED, /*< ready to be freed as soon as there are no references */ SESSION_STATE_FREE, /*< for all sessions */ SESSION_STATE_DUMMY /*< dummy session for consistency */ -} session_state_t; +} mxs_session_state_t; typedef enum { @@ -89,7 +89,7 @@ typedef enum SESSION_TRX_READ_ONLY = (SESSION_TRX_ACTIVE_BIT | SESSION_TRX_READ_ONLY_BIT), /*< An explicit READ WRITE transaction is active. */ SESSION_TRX_READ_WRITE = (SESSION_TRX_ACTIVE_BIT | SESSION_TRX_READ_WRITE_BIT) -} session_trx_state_t; +} mxs_session_trx_state_t; /** * Convert transaction state to string representation. @@ -97,7 +97,7 @@ typedef enum * @param state A transaction state. * @return String representation of the state. */ -const char* session_trx_state_to_string(session_trx_state_t state); +const char* session_trx_state_to_string(mxs_session_trx_state_t state); /** * The downstream element in the filter chain. This may refer to @@ -160,30 +160,30 @@ typedef enum */ typedef struct session { - skygw_chk_t ses_chk_top; - SPINLOCK ses_lock; - session_state_t state; /*< Current descriptor state */ - size_t ses_id; /*< Unique session identifier */ - int enabled_log_priorities; /*< Bitfield of enabled syslog priorities */ - struct dcb *client_dcb; /*< The client connection */ - void *router_session; /*< The router instance data */ - SESSION_STATS stats; /*< Session statistics */ - struct service *service; /*< The service this session is using */ - int n_filters; /*< Number of filter sessions */ - SESSION_FILTER *filters; /*< The filters in use within this session */ - MXS_DOWNSTREAM head; /*< Head of the filter chain */ - MXS_UPSTREAM tail; /*< The tail of the filter chain */ - int refcount; /*< Reference count on the session */ - bool ses_is_child; /*< this is a child session */ - session_trx_state_t trx_state; /*< The current transaction state. */ - bool autocommit; /*< Whether autocommit is on. */ + skygw_chk_t ses_chk_top; + SPINLOCK ses_lock; + mxs_session_state_t state; /*< Current descriptor state */ + size_t ses_id; /*< Unique session identifier */ + int enabled_log_priorities; /*< Bitfield of enabled syslog priorities */ + struct dcb *client_dcb; /*< The client connection */ + void *router_session; /*< The router instance data */ + SESSION_STATS stats; /*< Session statistics */ + struct service *service; /*< The service this session is using */ + int n_filters; /*< Number of filter sessions */ + SESSION_FILTER *filters; /*< The filters in use within this session */ + MXS_DOWNSTREAM head; /*< Head of the filter chain */ + MXS_UPSTREAM tail; /*< The tail of the filter chain */ + int refcount; /*< Reference count on the session */ + bool ses_is_child; /*< this is a child session */ + mxs_session_trx_state_t trx_state; /*< The current transaction state. */ + bool autocommit; /*< Whether autocommit is on. */ struct { GWBUF *buffer; /**< Buffer containing the statement */ const struct server *target; /**< Where the statement was sent */ } stmt; /**< Current statement being executed */ skygw_chk_t ses_chk_tail; -} SESSION; +} MXS_SESSION; #define SESSION_INIT {.ses_chk_top = CHK_NUM_SESSION, .ses_lock = SPINLOCK_INIT, \ .stats = SESSION_STATS_INIT, .head = MXS_DOWNSTREAM_INIT, .tail = MXS_UPSTREAM_INIT, \ @@ -196,7 +196,7 @@ typedef struct session * the incoming data to the first element in the pipeline of filters and * routers. */ -#define SESSION_ROUTE_QUERY(sess, buf) \ +#define MXS_SESSION_ROUTE_QUERY(sess, buf) \ ((sess)->head.routeQuery)((sess)->head.instance, \ (sess)->head.session, (buf)) /** @@ -208,22 +208,22 @@ typedef struct session ((sess)->tail.clientReply)((sess)->tail.instance, \ (sess)->tail.session, (buf)) -SESSION *session_alloc(struct service *, struct dcb *); -SESSION *session_set_dummy(struct dcb *); -int session_isvalid(SESSION *); +MXS_SESSION *session_alloc(struct service *, struct dcb *); +MXS_SESSION *session_set_dummy(struct dcb *); +int session_isvalid(MXS_SESSION *); int session_reply(void *inst, void *session, GWBUF *data); -const char *session_get_remote(const SESSION *); -const char *session_get_user(const SESSION *); +const char *session_get_remote(const MXS_SESSION *); +const char *session_get_user(const MXS_SESSION *); void printAllSessions(); -void printSession(SESSION *); +void printSession(MXS_SESSION *); void dprintSessionList(DCB *pdcb); void dprintAllSessions(struct dcb *); -void dprintSession(struct dcb *, SESSION *); +void dprintSession(struct dcb *, MXS_SESSION *); void dListSessions(struct dcb *); -char *session_state(session_state_t); -bool session_link_dcb(SESSION *, struct dcb *); -void session_enable_log_priority(SESSION* ses, int priority); -void session_disable_log_priority(SESSION* ses, int priority); +char *session_state(mxs_session_state_t); +bool session_link_dcb(MXS_SESSION *, struct dcb *); +void session_enable_log_priority(MXS_SESSION* ses, int priority); +void session_disable_log_priority(MXS_SESSION* ses, int priority); RESULTSET *sessionGetList(SESSIONLISTFILTER); /** @@ -246,7 +246,7 @@ RESULTSET *sessionGetList(SESSIONLISTFILTER); * @param ses The SESSION object. * @return The transaction state. */ -session_trx_state_t session_get_trx_state(const SESSION* ses); +mxs_session_trx_state_t session_get_trx_state(const MXS_SESSION* ses); /** * Set the transaction state of the session. @@ -258,7 +258,7 @@ session_trx_state_t session_get_trx_state(const SESSION* ses); * * @return The previous transaction state. */ -session_trx_state_t session_set_trx_state(SESSION* ses, session_trx_state_t new_state); +mxs_session_trx_state_t session_set_trx_state(MXS_SESSION* ses, mxs_session_trx_state_t new_state); /** * Tells whether an explicit READ ONLY transaction is active. @@ -271,7 +271,7 @@ session_trx_state_t session_set_trx_state(SESSION* ses, session_trx_state_t new_ * @return True if an explicit READ ONLY transaction is active, * false otherwise. */ -static inline bool session_trx_is_read_only(const SESSION* ses) +static inline bool session_trx_is_read_only(const MXS_SESSION* ses) { return ses->trx_state == SESSION_TRX_READ_ONLY; } @@ -287,7 +287,7 @@ static inline bool session_trx_is_read_only(const SESSION* ses) * @return True if an explicit READ WRITE transaction is active, * false otherwise. */ -static inline bool session_trx_is_read_write(const SESSION* ses) +static inline bool session_trx_is_read_write(const MXS_SESSION* ses) { return ses->trx_state == SESSION_TRX_READ_WRITE; } @@ -309,7 +309,7 @@ static inline bool session_trx_is_read_write(const SESSION* ses) * * @return True if autocommit has been set ON, false otherwise. */ -static inline bool session_is_autocommit(const SESSION* ses) +static inline bool session_is_autocommit(const MXS_SESSION* ses) { return ses->autocommit; } @@ -324,7 +324,7 @@ static inline bool session_is_autocommit(const SESSION* ses) * * @return True if a transaction is active, false otherwise. */ -static inline bool session_trx_is_active(const SESSION* ses) +static inline bool session_trx_is_active(const MXS_SESSION* ses) { return !session_is_autocommit(ses) || (ses->trx_state & SESSION_TRX_ACTIVE_BIT); } @@ -337,7 +337,7 @@ static inline bool session_trx_is_active(const SESSION* ses) * @param enable True if autocommit is enabled, false otherwise. * @return The previous state. */ -static inline bool session_set_autocommit(SESSION* ses, bool autocommit) +static inline bool session_set_autocommit(MXS_SESSION* ses, bool autocommit) { bool prev_autocommit = ses->autocommit; ses->autocommit = autocommit; @@ -354,7 +354,7 @@ static inline bool session_set_autocommit(SESSION* ses, bool autocommit) * * @note The caller must free the session reference by calling session_put_ref */ -SESSION* session_get_by_id(int id); +MXS_SESSION* session_get_by_id(int id); /** * @brief Get a session reference @@ -367,14 +367,14 @@ SESSION* session_get_by_id(int id); * * @note The caller must free the session reference by calling session_put_ref */ -SESSION* session_get_ref(SESSION *sessoin); +MXS_SESSION* session_get_ref(MXS_SESSION *sessoin); /** * @brief Release a session reference * * @param session Session reference to release */ -void session_put_ref(SESSION *session); +void session_put_ref(MXS_SESSION *session); /** * @brief Store the current statement into session @@ -387,7 +387,7 @@ void session_put_ref(SESSION *session); * @param server Server where the statement is being executed * @return True if statement was successfully stored, false if the cloning of @c buf failed. */ -bool session_store_stmt(SESSION *session, GWBUF *buf, const struct server *server); +bool session_store_stmt(MXS_SESSION *session, GWBUF *buf, const struct server *server); /** * @brief Fetch stored statement @@ -399,13 +399,13 @@ bool session_store_stmt(SESSION *session, GWBUF *buf, const struct server *serve * @param target Pointer where target server is stored * @return True if a statement was stored */ -bool session_take_stmt(SESSION *session, GWBUF **buffer, const struct server **target); +bool session_take_stmt(MXS_SESSION *session, GWBUF **buffer, const struct server **target); /** * Clear the stored statement * * @param session Session to clear */ -void session_clear_stmt(SESSION *session); +void session_clear_stmt(MXS_SESSION *session); MXS_END_DECLS diff --git a/server/core/dcb.c b/server/core/dcb.c index bb5304a44..5edcf2c1c 100644 --- a/server/core/dcb.c +++ b/server/core/dcb.c @@ -130,7 +130,7 @@ static void dcb_initialize(void *dcb); static void dcb_final_free(DCB *dcb); static void dcb_call_callback(DCB *dcb, DCB_REASON reason); static int dcb_null_write(DCB *dcb, GWBUF *buf); -static int dcb_null_auth(DCB *dcb, SERVER *server, SESSION *session, GWBUF *buf); +static int dcb_null_auth(DCB *dcb, SERVER *server, MXS_SESSION *session, GWBUF *buf); static inline DCB * dcb_find_in_list(DCB *dcb); static inline void dcb_process_victim_queue(int threadid); static void dcb_stop_polling_and_shutdown (DCB *dcb); @@ -341,7 +341,7 @@ dcb_final_free(DCB *dcb) /*< * Terminate client session. */ - SESSION *local_session = dcb->session; + MXS_SESSION *local_session = dcb->session; dcb->session = NULL; CHK_SESSION(local_session); if (SESSION_STATE_DUMMY != local_session->state) @@ -634,7 +634,7 @@ dcb_stop_polling_and_shutdown(DCB *dcb) * @return The new allocated dcb or NULL if the DCB was not connected */ DCB * -dcb_connect(SERVER *server, SESSION *session, const char *protocol) +dcb_connect(SERVER *server, MXS_SESSION *session, const char *protocol) { DCB *dcb; MXS_PROTOCOL *funcs; @@ -1712,7 +1712,7 @@ dcb_maybe_add_persistent(DCB *dcb) * Terminate client session. */ { - SESSION *local_session = dcb->session; + MXS_SESSION *local_session = dcb->session; session_set_dummy(dcb); CHK_SESSION(local_session); if (SESSION_STATE_DUMMY != local_session->state) @@ -2572,7 +2572,7 @@ dcb_null_write(DCB *dcb, GWBUF *buf) * @param buf The buffer with the new auth request */ static int -dcb_null_auth(DCB *dcb, SERVER *server, SESSION *session, GWBUF *buf) +dcb_null_auth(DCB *dcb, SERVER *server, MXS_SESSION *session, GWBUF *buf) { return 0; } @@ -3524,7 +3524,7 @@ void dcb_process_idle_sessions(int thr) { if (dcb->dcb_role == DCB_ROLE_CLIENT_HANDLER) { - SESSION *session = dcb->session; + MXS_SESSION *session = dcb->session; if (session->service && session->client_dcb && session->client_dcb->state == DCB_STATE_POLLING && hkheartbeat - session->client_dcb->last_read > session->service->conn_idle_timeout * 10) diff --git a/server/core/filter.c b/server/core/filter.c index 5975001a8..5ee808037 100644 --- a/server/core/filter.c +++ b/server/core/filter.c @@ -411,7 +411,7 @@ bool filter_load(MXS_FILTER_DEF* filter) * if the filter could not be created */ MXS_DOWNSTREAM * -filter_apply(MXS_FILTER_DEF *filter, SESSION *session, MXS_DOWNSTREAM *downstream) +filter_apply(MXS_FILTER_DEF *filter, MXS_SESSION *session, MXS_DOWNSTREAM *downstream) { MXS_DOWNSTREAM *me; diff --git a/server/core/filter.cc b/server/core/filter.cc index 604540e3e..0fb5a7423 100644 --- a/server/core/filter.cc +++ b/server/core/filter.cc @@ -20,7 +20,7 @@ namespace maxscale // FilterSession // -FilterSession::FilterSession(SESSION* pSession) +FilterSession::FilterSession(MXS_SESSION* pSession) : m_pSession(pSession) { } diff --git a/server/core/maxscale/filter.h b/server/core/maxscale/filter.h index ba1afdff0..78f5cf2e7 100644 --- a/server/core/maxscale/filter.h +++ b/server/core/maxscale/filter.h @@ -40,7 +40,7 @@ struct mxs_filter_def void filter_add_option(MXS_FILTER_DEF *filter_def, const char *option); void filter_add_parameter(MXS_FILTER_DEF *filter_def, const char *name, const char *value); MXS_FILTER_DEF *filter_alloc(const char *name, const char *module_name); -MXS_DOWNSTREAM *filter_apply(MXS_FILTER_DEF *filter_def, SESSION *session, MXS_DOWNSTREAM *downstream); +MXS_DOWNSTREAM *filter_apply(MXS_FILTER_DEF *filter_def, MXS_SESSION *session, MXS_DOWNSTREAM *downstream); void filter_free(MXS_FILTER_DEF *filter_def); bool filter_load(MXS_FILTER_DEF *filter_def); int filter_standard_parameter(const char *name); diff --git a/server/core/session.c b/server/core/session.c index eaa74ef23..5b6387ea3 100644 --- a/server/core/session.c +++ b/server/core/session.c @@ -45,7 +45,7 @@ #include "maxscale/filter.h" /* A session with null values, used for initialization */ -static SESSION session_initialized = SESSION_INIT; +static MXS_SESSION session_initialized = SESSION_INIT; /** Global session id; updated safely by use of atomic_add */ static int session_id; @@ -53,11 +53,11 @@ static int session_id; static struct session session_dummy_struct; static void session_initialize(void *session); -static int session_setup_filters(SESSION *session); -static void session_simple_free(SESSION *session, DCB *dcb); -static void session_add_to_all_list(SESSION *session); -static SESSION *session_find_free(); -static void session_final_free(SESSION *session); +static int session_setup_filters(MXS_SESSION *session); +static void session_simple_free(MXS_SESSION *session, DCB *dcb); +static void session_add_to_all_list(MXS_SESSION *session); +static MXS_SESSION *session_find_free(); +static void session_final_free(MXS_SESSION *session); /** * @brief Initialize a session @@ -75,7 +75,7 @@ static void session_final_free(SESSION *session); static void session_initialize(void *session) { - *(SESSION *)session = session_initialized; + *(MXS_SESSION *)session = session_initialized; } /** @@ -89,10 +89,10 @@ session_initialize(void *session) * @param client_dcb The client side DCB * @return The newly created session or NULL if an error occured */ -SESSION * +MXS_SESSION * session_alloc(SERVICE *service, DCB *client_dcb) { - SESSION *session = (SESSION *)(MXS_MALLOC(sizeof(*session))); + MXS_SESSION *session = (MXS_SESSION *)(MXS_MALLOC(sizeof(*session))); if (NULL == session) { @@ -217,10 +217,10 @@ session_alloc(SERVICE *service, DCB *client_dcb) * @param client_dcb The client side DCB * @return The dummy created session */ -SESSION * +MXS_SESSION * session_set_dummy(DCB *client_dcb) { - SESSION *session; + MXS_SESSION *session; session = &session_dummy_struct; session->ses_chk_top = CHK_NUM_SESSION; @@ -248,7 +248,7 @@ session_set_dummy(DCB *client_dcb) * @param session session * @param priority syslog priority */ -void session_enable_log_priority(SESSION* session, int priority) +void session_enable_log_priority(MXS_SESSION* session, int priority) { session->enabled_log_priorities |= (1 << priority); atomic_add((int *)&mxs_log_session_count[priority], 1); @@ -262,7 +262,7 @@ void session_enable_log_priority(SESSION* session, int priority) * @param session session * @param priority syslog priority */ -void session_disable_log_priority(SESSION* session, int priority) +void session_disable_log_priority(MXS_SESSION* session, int priority) { if (session->enabled_log_priorities & (1 << priority)) { @@ -279,7 +279,7 @@ void session_disable_log_priority(SESSION* session, int priority) * @return True if the session was sucessfully linked to the DCB */ bool -session_link_dcb(SESSION *session, DCB *dcb) +session_link_dcb(MXS_SESSION *session, DCB *dcb) { spinlock_acquire(&session->ses_lock); ss_info_dassert(session->state != SESSION_STATE_FREE, @@ -307,7 +307,7 @@ session_link_dcb(SESSION *session, DCB *dcb) * @param session The session to deallocate */ static void -session_simple_free(SESSION *session, DCB *dcb) +session_simple_free(MXS_SESSION *session, DCB *dcb) { /* Does this possibly need a lock? */ if (dcb->data && !DCB_IS_CLONE(dcb)) @@ -339,7 +339,7 @@ session_simple_free(SESSION *session, DCB *dcb) * * @param session The session to deallocate */ -static void session_free(SESSION *session) +static void session_free(MXS_SESSION *session) { CHK_SESSION(session); ss_dassert(session->refcount == 0); @@ -396,7 +396,7 @@ static void session_free(SESSION *session) } static void -session_final_free(SESSION *session) +session_final_free(MXS_SESSION *session) { gwbuf_free(session->stmt.buffer); MXS_FREE(session); @@ -409,7 +409,7 @@ session_final_free(SESSION *session) * @return 1 if the session is valid otherwise 0 */ int -session_isvalid(SESSION *session) +session_isvalid(MXS_SESSION *session) { return session != NULL; } @@ -420,7 +420,7 @@ session_isvalid(SESSION *session) * @param session Session to print */ void -printSession(SESSION *session) +printSession(MXS_SESSION *session) { struct tm result; char timebuf[40]; @@ -501,7 +501,7 @@ dprintAllSessions(DCB *dcb) * @param print_session The session to print */ void -dprintSession(DCB *dcb, SESSION *print_session) +dprintSession(DCB *dcb, MXS_SESSION *print_session) { struct tm result; char buf[30]; @@ -546,7 +546,7 @@ bool dListSessions_cb(DCB *dcb, void *data) if (dcb->dcb_role == DCB_ROLE_CLIENT_HANDLER) { DCB *out_dcb = (DCB*)data; - SESSION *session = dcb->session; + MXS_SESSION *session = dcb->session; dcb_printf(out_dcb, "%-16lu | %-15s | %-14s | %s\n", session->ses_id, session->client_dcb && session->client_dcb->remote ? session->client_dcb->remote : "", @@ -584,7 +584,7 @@ dListSessions(DCB *dcb) * @return A string representation of the session state */ char * -session_state(session_state_t state) +session_state(mxs_session_state_t state) { switch (state) { @@ -624,7 +624,7 @@ session_state(session_state_t state) * @return 0 if filter creation fails */ static int -session_setup_filters(SESSION *session) +session_setup_filters(MXS_SESSION *session) { SERVICE *service = session->service; MXS_DOWNSTREAM *head; @@ -698,7 +698,7 @@ session_setup_filters(SESSION *session) int session_reply(void *instance, void *session, GWBUF *data) { - SESSION *the_session = (SESSION *)session; + MXS_SESSION *the_session = (MXS_SESSION *)session; return the_session->client_dcb->func.write(the_session->client_dcb, data); } @@ -709,7 +709,7 @@ session_reply(void *instance, void *session, GWBUF *data) * @param session The session whose client address to return */ const char * -session_get_remote(const SESSION *session) +session_get_remote(const MXS_SESSION *session) { if (session && session->client_dcb) { @@ -718,7 +718,7 @@ session_get_remote(const SESSION *session) return NULL; } -bool session_route_query(SESSION* ses, GWBUF* buf) +bool session_route_query(MXS_SESSION* ses, GWBUF* buf) { bool succp; @@ -751,7 +751,7 @@ return_succp: * @return The user name or NULL if it can not be determined. */ const char * -session_get_user(const SESSION *session) +session_get_user(const MXS_SESSION *session) { return (session && session->client_dcb) ? session->client_dcb->user : NULL; } @@ -784,7 +784,7 @@ bool dcb_iter_cb(DCB *dcb, void *data) else { char buf[20]; - SESSION *list_session = dcb->session; + MXS_SESSION *list_session = dcb->session; cbdata->index++; cbdata->row = resultset_make_row(cbdata->set); @@ -867,21 +867,21 @@ sessionGetList(SESSIONLISTFILTER filter) } /*lint +e429 */ -session_trx_state_t session_get_trx_state(const SESSION* ses) +mxs_session_trx_state_t session_get_trx_state(const MXS_SESSION* ses) { return ses->trx_state; } -session_trx_state_t session_set_trx_state(SESSION* ses, session_trx_state_t new_state) +mxs_session_trx_state_t session_set_trx_state(MXS_SESSION* ses, mxs_session_trx_state_t new_state) { - session_trx_state_t prev_state = ses->trx_state; + mxs_session_trx_state_t prev_state = ses->trx_state; ses->trx_state = new_state; return prev_state; } -const char* session_trx_state_to_string(session_trx_state_t state) +const char* session_trx_state_to_string(mxs_session_trx_state_t state) { switch (state) { @@ -902,7 +902,7 @@ const char* session_trx_state_to_string(session_trx_state_t state) static bool ses_find_id(DCB *dcb, void *data) { void **params = (void**)data; - SESSION **ses = (SESSION**)params[0]; + MXS_SESSION **ses = (MXS_SESSION**)params[0]; int *id = (int*)params[1]; bool rval = true; @@ -915,9 +915,9 @@ static bool ses_find_id(DCB *dcb, void *data) return rval; } -SESSION* session_get_by_id(int id) +MXS_SESSION* session_get_by_id(int id) { - SESSION *session = NULL; + MXS_SESSION *session = NULL; void *params[] = {&session, &id}; dcb_foreach(ses_find_id, params); @@ -925,13 +925,13 @@ SESSION* session_get_by_id(int id) return session; } -SESSION* session_get_ref(SESSION *session) +MXS_SESSION* session_get_ref(MXS_SESSION *session) { atomic_add(&session->refcount, 1); return session; } -void session_put_ref(SESSION *session) +void session_put_ref(MXS_SESSION *session) { if (session && session->state != SESSION_STATE_DUMMY) { @@ -943,7 +943,7 @@ void session_put_ref(SESSION *session) } } -bool session_store_stmt(SESSION *session, GWBUF *buf, const SERVER *server) +bool session_store_stmt(MXS_SESSION *session, GWBUF *buf, const SERVER *server) { bool rval = false; @@ -964,7 +964,7 @@ bool session_store_stmt(SESSION *session, GWBUF *buf, const SERVER *server) return rval; } -bool session_take_stmt(SESSION *session, GWBUF **buffer, const SERVER **target) +bool session_take_stmt(MXS_SESSION *session, GWBUF **buffer, const SERVER **target) { bool rval = false; @@ -980,7 +980,7 @@ bool session_take_stmt(SESSION *session, GWBUF **buffer, const SERVER **target) return rval; } -void session_clear_stmt(SESSION *session) +void session_clear_stmt(MXS_SESSION *session) { gwbuf_free(session->stmt.buffer); session->stmt.buffer = NULL; diff --git a/server/core/test/testservice.c b/server/core/test/testservice.c index c9aa88d9d..77a2aae14 100644 --- a/server/core/test/testservice.c +++ b/server/core/test/testservice.c @@ -46,10 +46,10 @@ static int test1() { SERVICE *service; - SESSION *session; - DCB *dcb; - int result; - int argc = 3; + MXS_SESSION *session; + DCB *dcb; + int result; + int argc = 3; mxs_log_init(NULL, "/tmp", MXS_LOG_TARGET_FS); init_test_env(NULL); diff --git a/server/modules/filter/cache/cache.cc b/server/modules/filter/cache/cache.cc index 31eef18dd..7d7ae5139 100644 --- a/server/modules/filter/cache/cache.cc +++ b/server/modules/filter/cache/cache.cc @@ -107,7 +107,7 @@ bool Cache::should_store(const char* zDefaultDb, const GWBUF* pQuery) return m_sRules->should_store(zDefaultDb, pQuery); } -bool Cache::should_use(const SESSION* pSession) +bool Cache::should_use(const MXS_SESSION* pSession) { return m_sRules->should_use(pSession); } diff --git a/server/modules/filter/cache/cache.hh b/server/modules/filter/cache/cache.hh index 4e932fb6b..de40862a1 100644 --- a/server/modules/filter/cache/cache.hh +++ b/server/modules/filter/cache/cache.hh @@ -66,7 +66,7 @@ public: * * @return True of cached results should be used. */ - bool should_use(const SESSION* pSession); + bool should_use(const MXS_SESSION* pSession); /** * Specifies whether a particular SessioCache should refresh the data. diff --git a/server/modules/filter/cache/cachefilter.cc b/server/modules/filter/cache/cachefilter.cc index 212b372f5..d43d2c081 100644 --- a/server/modules/filter/cache/cachefilter.cc +++ b/server/modules/filter/cache/cachefilter.cc @@ -260,7 +260,7 @@ CacheFilter* CacheFilter::create(const char* zName, char** pzOptions, CONFIG_PAR return pFilter; } -CacheFilterSession* CacheFilter::newSession(SESSION* pSession) +CacheFilterSession* CacheFilter::newSession(MXS_SESSION* pSession) { return CacheFilterSession::Create(m_sCache.get(), pSession); } diff --git a/server/modules/filter/cache/cachefilter.hh b/server/modules/filter/cache/cachefilter.hh index 6dd8201bb..ed32640b8 100644 --- a/server/modules/filter/cache/cachefilter.hh +++ b/server/modules/filter/cache/cachefilter.hh @@ -35,7 +35,7 @@ public: return *m_sCache.get(); } - CacheFilterSession* newSession(SESSION* pSession); + CacheFilterSession* newSession(MXS_SESSION* pSession); void diagnostics(DCB* pDcb); diff --git a/server/modules/filter/cache/cachefiltersession.cc b/server/modules/filter/cache/cachefiltersession.cc index 9f314ee81..60d560933 100644 --- a/server/modules/filter/cache/cachefiltersession.cc +++ b/server/modules/filter/cache/cachefiltersession.cc @@ -34,7 +34,7 @@ inline bool cache_max_resultset_size_exceeded(const CACHE_CONFIG& config, uint64 } -CacheFilterSession::CacheFilterSession(SESSION* pSession, Cache* pCache, char* zDefaultDb) +CacheFilterSession::CacheFilterSession(MXS_SESSION* pSession, Cache* pCache, char* zDefaultDb) : maxscale::FilterSession(pSession) , m_state(CACHE_EXPECTING_NOTHING) , m_pCache(pCache) @@ -54,7 +54,7 @@ CacheFilterSession::~CacheFilterSession() } //static -CacheFilterSession* CacheFilterSession::Create(Cache* pCache, SESSION* pSession) +CacheFilterSession* CacheFilterSession::Create(Cache* pCache, MXS_SESSION* pSession) { CacheFilterSession* pCacheFilterSession = NULL; @@ -136,7 +136,7 @@ int CacheFilterSession::routeQuery(GWBUF* pPacket) // possible. if (qc_get_operation(pPacket) == QUERY_OP_SELECT) { - SESSION *session = m_pSession; + MXS_SESSION *session = m_pSession; if ((session_is_autocommit(session) && !session_trx_is_active(session)) || session_trx_is_read_only(session)) diff --git a/server/modules/filter/cache/cachefiltersession.hh b/server/modules/filter/cache/cachefiltersession.hh index 0c54bd429..1fc160273 100644 --- a/server/modules/filter/cache/cachefiltersession.hh +++ b/server/modules/filter/cache/cachefiltersession.hh @@ -58,7 +58,7 @@ public: * * @return A new instance or NULL if memory allocation fails. */ - static CacheFilterSession* Create(Cache* pCache, SESSION* pSession); + static CacheFilterSession* Create(Cache* pCache, MXS_SESSION* pSession); /** * The session has been closed. @@ -106,7 +106,7 @@ private: void store_result(); private: - CacheFilterSession(SESSION* pSession, Cache* pCache, char* zDefaultDb); + CacheFilterSession(MXS_SESSION* pSession, Cache* pCache, char* zDefaultDb); CacheFilterSession(const CacheFilterSession&); CacheFilterSession& operator = (const CacheFilterSession&); diff --git a/server/modules/filter/cache/rules.cc b/server/modules/filter/cache/rules.cc index bcca08c1f..0f181c9d1 100644 --- a/server/modules/filter/cache/rules.cc +++ b/server/modules/filter/cache/rules.cc @@ -321,13 +321,13 @@ bool cache_rules_should_store(CACHE_RULES *self, const char *default_db, const G return should_store; } -bool cache_rules_should_use(CACHE_RULES *self, const SESSION *session) +bool cache_rules_should_use(CACHE_RULES *self, const MXS_SESSION *session) { bool should_use = false; CACHE_RULE *rule = self->use_rules; - const char *user = session_get_user((SESSION*)session); - const char *host = session_get_remote((SESSION*)session); + const char *user = session_get_user((MXS_SESSION*)session); + const char *host = session_get_remote((MXS_SESSION*)session); if (!user) { @@ -409,7 +409,7 @@ bool CacheRules::should_store(const char* zdefault_db, const GWBUF* pquery) cons return cache_rules_should_store(prules_, zdefault_db, pquery); } -bool CacheRules::should_use(const SESSION* psession) const +bool CacheRules::should_use(const MXS_SESSION* psession) const { return cache_rules_should_use(prules_, psession); } diff --git a/server/modules/filter/cache/rules.h b/server/modules/filter/cache/rules.h index ee1f9dd3b..8d4a17d1a 100644 --- a/server/modules/filter/cache/rules.h +++ b/server/modules/filter/cache/rules.h @@ -152,7 +152,7 @@ bool cache_rules_should_store(CACHE_RULES *rules, const char *default_db, const * * @return True, if the cache should be used. */ -bool cache_rules_should_use(CACHE_RULES *rules, const SESSION *session); +bool cache_rules_should_use(CACHE_RULES *rules, const MXS_SESSION *session); MXS_END_DECLS @@ -209,7 +209,7 @@ public: * * @return True, if the cache should be used. */ - bool should_use(const SESSION* psession) const; + bool should_use(const MXS_SESSION* psession) const; private: CacheRules(CACHE_RULES* prules); diff --git a/server/modules/filter/ccrfilter/ccrfilter.c b/server/modules/filter/ccrfilter/ccrfilter.c index d50769051..df04b512b 100644 --- a/server/modules/filter/ccrfilter/ccrfilter.c +++ b/server/modules/filter/ccrfilter/ccrfilter.c @@ -50,7 +50,7 @@ */ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PARAMETER *params); -static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); +static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, MXS_SESSION *session); static void closeSession(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, MXS_DOWNSTREAM *downstream); @@ -226,7 +226,7 @@ createInstance(const char *name, char **options, CONFIG_PARAMETER *params) * @return Session specific data for this session */ static MXS_FILTER_SESSION * -newSession(MXS_FILTER *instance, SESSION *session) +newSession(MXS_FILTER *instance, MXS_SESSION *session) { CCR_INSTANCE *my_instance = (CCR_INSTANCE *)instance; CCR_SESSION *my_session = MXS_MALLOC(sizeof(CCR_SESSION)); diff --git a/server/modules/filter/dbfwfilter/dbfwfilter.c b/server/modules/filter/dbfwfilter/dbfwfilter.c index ea41ce4fd..72e581bb5 100644 --- a/server/modules/filter/dbfwfilter/dbfwfilter.c +++ b/server/modules/filter/dbfwfilter/dbfwfilter.c @@ -96,7 +96,7 @@ int dbfw_yyparse(void*); * The filter entry points */ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PARAMETER *); -static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); +static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, MXS_SESSION *session); static void closeSession(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, MXS_DOWNSTREAM *downstream); @@ -261,7 +261,7 @@ typedef struct */ typedef struct { - SESSION *session; /*< Client session structure */ + MXS_SESSION *session; /*< Client session structure */ char *errmsg; /*< Rule specific error message */ QUERYSPEED *query_speed; /*< How fast the user has executed queries */ MXS_DOWNSTREAM down; /*< Next object in the downstream chain */ @@ -1599,7 +1599,7 @@ createInstance(const char *name, char **options, CONFIG_PARAMETER *params) * @return Session specific data for this session */ static MXS_FILTER_SESSION * -newSession(MXS_FILTER *instance, SESSION *session) +newSession(MXS_FILTER *instance, MXS_SESSION *session) { FW_SESSION *my_session; diff --git a/server/modules/filter/hintfilter/hintfilter.c b/server/modules/filter/hintfilter/hintfilter.c index c5ec4d64c..d373cf4dc 100644 --- a/server/modules/filter/hintfilter/hintfilter.c +++ b/server/modules/filter/hintfilter/hintfilter.c @@ -27,7 +27,7 @@ */ static MXS_FILTER *createInstance(const char* name, char **options, CONFIG_PARAMETER *params); -static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); +static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, MXS_SESSION *session); static void closeSession(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, MXS_DOWNSTREAM *downstream); @@ -110,7 +110,7 @@ createInstance(const char *name, char **options, CONFIG_PARAMETER *params) * @return Session specific data for this session */ static MXS_FILTER_SESSION * -newSession(MXS_FILTER *instance, SESSION *session) +newSession(MXS_FILTER *instance, MXS_SESSION *session) { HINT_INSTANCE *my_instance = (HINT_INSTANCE *)instance; HINT_SESSION *my_session; diff --git a/server/modules/filter/insertstream/insertstream.c b/server/modules/filter/insertstream/insertstream.c index ad4dab012..685f6428b 100644 --- a/server/modules/filter/insertstream/insertstream.c +++ b/server/modules/filter/insertstream/insertstream.c @@ -31,7 +31,7 @@ */ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PARAMETER*params); -static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); +static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, MXS_SESSION *session); static void closeSession(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, MXS_DOWNSTREAM *downstream); @@ -176,7 +176,7 @@ createInstance(const char *name, char **options, CONFIG_PARAMETER *params) * @return Session specific data for this session */ static MXS_FILTER_SESSION * -newSession(MXS_FILTER *instance, SESSION *session) +newSession(MXS_FILTER *instance, MXS_SESSION *session) { DS_INSTANCE *my_instance = (DS_INSTANCE *) instance; DS_SESSION *my_session; diff --git a/server/modules/filter/masking/maskingfilter.cc b/server/modules/filter/masking/maskingfilter.cc index 03d1a16ab..9cc179cf1 100644 --- a/server/modules/filter/masking/maskingfilter.cc +++ b/server/modules/filter/masking/maskingfilter.cc @@ -133,7 +133,7 @@ MaskingFilter* MaskingFilter::create(const char* zName, char** pzOptions, CONFIG } -MaskingFilterSession* MaskingFilter::newSession(SESSION* pSession) +MaskingFilterSession* MaskingFilter::newSession(MXS_SESSION* pSession) { return MaskingFilterSession::create(pSession, this); } diff --git a/server/modules/filter/masking/maskingfilter.hh b/server/modules/filter/masking/maskingfilter.hh index 0d83f9385..f6f56e9af 100644 --- a/server/modules/filter/masking/maskingfilter.hh +++ b/server/modules/filter/masking/maskingfilter.hh @@ -31,7 +31,7 @@ public: ~MaskingFilter(); static MaskingFilter* create(const char* zName, char** pzOptions, CONFIG_PARAMETER* ppParams); - MaskingFilterSession* newSession(SESSION* pSession); + MaskingFilterSession* newSession(MXS_SESSION* pSession); void diagnostics(DCB* pDcb); diff --git a/server/modules/filter/masking/maskingfiltersession.cc b/server/modules/filter/masking/maskingfiltersession.cc index 662d8e322..1f0695087 100644 --- a/server/modules/filter/masking/maskingfiltersession.cc +++ b/server/modules/filter/masking/maskingfiltersession.cc @@ -25,7 +25,7 @@ using std::ostream; using std::string; using std::stringstream; -MaskingFilterSession::MaskingFilterSession(SESSION* pSession, const MaskingFilter* pFilter) +MaskingFilterSession::MaskingFilterSession(MXS_SESSION* pSession, const MaskingFilter* pFilter) : maxscale::FilterSession(pSession) , m_filter(*pFilter) , m_state(IGNORING_RESPONSE) @@ -37,7 +37,7 @@ MaskingFilterSession::~MaskingFilterSession() } //static -MaskingFilterSession* MaskingFilterSession::create(SESSION* pSession, const MaskingFilter* pFilter) +MaskingFilterSession* MaskingFilterSession::create(MXS_SESSION* pSession, const MaskingFilter* pFilter) { return new MaskingFilterSession(pSession, pFilter); } diff --git a/server/modules/filter/masking/maskingfiltersession.hh b/server/modules/filter/masking/maskingfiltersession.hh index 6e953c1ff..0348512d0 100644 --- a/server/modules/filter/masking/maskingfiltersession.hh +++ b/server/modules/filter/masking/maskingfiltersession.hh @@ -29,14 +29,14 @@ public: ~MaskingFilterSession(); - static MaskingFilterSession* create(SESSION* pSession, const MaskingFilter* pFilter); + static MaskingFilterSession* create(MXS_SESSION* pSession, const MaskingFilter* pFilter); int routeQuery(GWBUF* pPacket); int clientReply(GWBUF* pPacket); private: - MaskingFilterSession(SESSION* pSession, const MaskingFilter* pFilter); + MaskingFilterSession(MXS_SESSION* pSession, const MaskingFilter* pFilter); MaskingFilterSession(const MaskingFilterSession&); MaskingFilterSession& operator = (const MaskingFilterSession&); diff --git a/server/modules/filter/maxrows/maxrows.c b/server/modules/filter/maxrows/maxrows.c index 713983bff..f3cf3b5f9 100644 --- a/server/modules/filter/maxrows/maxrows.c +++ b/server/modules/filter/maxrows/maxrows.c @@ -47,7 +47,7 @@ #include "maxrows.h" static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PARAMETER *); -static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); +static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, MXS_SESSION *session); static void closeSession(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, MXS_DOWNSTREAM *downstream); @@ -157,13 +157,13 @@ typedef struct maxrows_session_data MXS_DOWNSTREAM down; /**< The previous filter or equivalent. */ MXS_UPSTREAM up; /**< The next filter or equivalent. */ MAXROWS_RESPONSE_STATE res; /**< The response state. */ - SESSION *session; /**< The session this data is associated with. */ + MXS_SESSION *session; /**< The session this data is associated with. */ maxrows_session_state_t state; bool large_packet; /**< Large packet (> 16MB)) indicator */ bool discard_resultset; /**< Discard resultset indicator */ } MAXROWS_SESSION_DATA; -static MAXROWS_SESSION_DATA *maxrows_session_data_create(MAXROWS_INSTANCE *instance, SESSION *session); +static MAXROWS_SESSION_DATA *maxrows_session_data_create(MAXROWS_INSTANCE *instance, MXS_SESSION *session); static void maxrows_session_data_free(MAXROWS_SESSION_DATA *data); static int handle_expecting_fields(MAXROWS_SESSION_DATA *csdata); @@ -211,7 +211,7 @@ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PARAM * * @return Session specific data for this session */ -static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session) +static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, MXS_SESSION *session) { MAXROWS_INSTANCE *cinstance = (MAXROWS_INSTANCE*)instance; MAXROWS_SESSION_DATA *csdata = maxrows_session_data_create(cinstance, session); @@ -448,7 +448,7 @@ static void maxrows_response_state_reset(MAXROWS_RESPONSE_STATE *state) * @return Session data or NULL if creation fails. */ static MAXROWS_SESSION_DATA *maxrows_session_data_create(MAXROWS_INSTANCE *instance, - SESSION* session) + MXS_SESSION* session) { MAXROWS_SESSION_DATA *data = (MAXROWS_SESSION_DATA*)MXS_CALLOC(1, sizeof(MAXROWS_SESSION_DATA)); diff --git a/server/modules/filter/namedserverfilter/namedserverfilter.c b/server/modules/filter/namedserverfilter/namedserverfilter.c index c14aad511..aa0412e1d 100644 --- a/server/modules/filter/namedserverfilter/namedserverfilter.c +++ b/server/modules/filter/namedserverfilter/namedserverfilter.c @@ -43,7 +43,7 @@ */ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PARAMETER *params); -static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); +static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, MXS_SESSION *session); static void closeSession(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, MXS_DOWNSTREAM *downstream); @@ -197,7 +197,7 @@ createInstance(const char *name, char **options, CONFIG_PARAMETER *params) * @return Session specific data for this session */ static MXS_FILTER_SESSION * -newSession(MXS_FILTER *instance, SESSION *session) +newSession(MXS_FILTER *instance, MXS_SESSION *session) { REGEXHINT_INSTANCE *my_instance = (REGEXHINT_INSTANCE *) instance; REGEXHINT_SESSION *my_session; diff --git a/server/modules/filter/qlafilter/qlafilter.c b/server/modules/filter/qlafilter/qlafilter.c index d4baab7b1..ea2c3085e 100644 --- a/server/modules/filter/qlafilter/qlafilter.c +++ b/server/modules/filter/qlafilter/qlafilter.c @@ -76,7 +76,7 @@ enum log_options * The filter entry points */ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PARAMETER *); -static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); +static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, MXS_SESSION *session); static void closeSession(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, MXS_DOWNSTREAM *downstream); @@ -379,7 +379,7 @@ createInstance(const char *name, char **options, CONFIG_PARAMETER *params) * @return Session specific data for this session */ static MXS_FILTER_SESSION * -newSession(MXS_FILTER *instance, SESSION *session) +newSession(MXS_FILTER *instance, MXS_SESSION *session) { QLA_INSTANCE *my_instance = (QLA_INSTANCE *) instance; QLA_SESSION *my_session; diff --git a/server/modules/filter/regexfilter/regexfilter.c b/server/modules/filter/regexfilter/regexfilter.c index 7eec9d8b0..e7c0e6ed0 100644 --- a/server/modules/filter/regexfilter/regexfilter.c +++ b/server/modules/filter/regexfilter/regexfilter.c @@ -43,7 +43,7 @@ */ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PARAMETER *params); -static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); +static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, MXS_SESSION *session); static void closeSession(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, MXS_DOWNSTREAM *downstream); @@ -247,7 +247,7 @@ createInstance(const char *name, char **options, CONFIG_PARAMETER *params) * @return Session specific data for this session */ static MXS_FILTER_SESSION * -newSession(MXS_FILTER *instance, SESSION *session) +newSession(MXS_FILTER *instance, MXS_SESSION *session) { REGEX_INSTANCE *my_instance = (REGEX_INSTANCE *) instance; REGEX_SESSION *my_session; diff --git a/server/modules/filter/tee/tee.c b/server/modules/filter/tee/tee.c index 1495d6b61..558f31f92 100644 --- a/server/modules/filter/tee/tee.c +++ b/server/modules/filter/tee/tee.c @@ -100,7 +100,7 @@ static unsigned char required_packets[] = * The filter entry points */ static MXS_FILTER *createInstance(const char* name, char **options, CONFIG_PARAMETER *); -static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); +static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, MXS_SESSION *session); static void closeSession(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, MXS_DOWNSTREAM *downstream); @@ -147,7 +147,7 @@ typedef struct int replies[2]; /* Number of queries received */ int reply_packets[2]; /* Number of OK, ERR, LOCAL_INFILE_REQUEST or RESULT_SET packets received */ DCB *branch_dcb; /* Client DCB for "branch" service */ - SESSION *branch_session; /* The branch service session */ + MXS_SESSION *branch_session; /* The branch service session */ TEE_INSTANCE *instance; int n_duped; /* Number of duplicated queries */ int n_rejected; /* Number of rejected queries */ @@ -165,7 +165,7 @@ typedef struct typedef struct orphan_session_tt { - SESSION* session; /*< The child branch session whose parent was freed before + MXS_SESSION* session; /*< The child branch session whose parent was freed before * the child session was in a suitable state. */ struct orphan_session_tt* next; } orphan_session_t; @@ -187,7 +187,7 @@ int route_single_query(TEE_INSTANCE* my_instance, GWBUF* buffer, GWBUF* clone); int reset_session_state(TEE_SESSION* my_session, GWBUF* buffer); -void create_orphan(SESSION* ses); +void create_orphan(MXS_SESSION* ses); static void orphan_free(void* data) @@ -419,7 +419,7 @@ createInstance(const char *name, char **options, CONFIG_PARAMETER *params) * @return Session specific data for this session */ static MXS_FILTER_SESSION * -newSession(MXS_FILTER *instance, SESSION *session) +newSession(MXS_FILTER *instance, MXS_SESSION *session) { TEE_INSTANCE *my_instance = (TEE_INSTANCE *) instance; TEE_SESSION *my_session; @@ -479,7 +479,7 @@ newSession(MXS_FILTER *instance, SESSION *session) if (my_session->active) { DCB* dcb; - SESSION* ses; + MXS_SESSION* ses; if ((dcb = dcb_clone(session->client_dcb)) == NULL) { freeSession(instance, (MXS_FILTER_SESSION *) my_session); @@ -527,7 +527,7 @@ closeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session) TEE_SESSION *my_session = (TEE_SESSION *) session; ROUTER_OBJECT *router; void *router_instance, *rsession; - SESSION *bsession; + MXS_SESSION *bsession; #ifdef SS_DEBUG MXS_INFO("Tee close: %d", atomic_add(&debug_seq, 1)); #endif @@ -583,8 +583,8 @@ static void freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session) { TEE_SESSION *my_session = (TEE_SESSION *) session; - SESSION* ses = my_session->branch_session; - session_state_t state; + MXS_SESSION* ses = my_session->branch_session; + mxs_session_state_t state; #ifdef SS_DEBUG MXS_INFO("Tee free: %d", atomic_add(&debug_seq, 1)); #endif @@ -892,7 +892,7 @@ int route_single_query(TEE_INSTANCE* my_instance, TEE_SESSION* my_session, GWBUF if (my_session->branch_session->state == SESSION_STATE_ROUTER_READY) { - SESSION_ROUTE_QUERY(my_session->branch_session, clone); + MXS_SESSION_ROUTE_QUERY(my_session->branch_session, clone); } else { @@ -950,7 +950,7 @@ int reset_session_state(TEE_SESSION* my_session, GWBUF* buffer) return 1; } -void create_orphan(SESSION* ses) +void create_orphan(MXS_SESSION* ses) { orphan_session_t* orphan = MXS_MALLOC(sizeof(orphan_session_t)); if (orphan) diff --git a/server/modules/filter/testfilter/testfilter.c b/server/modules/filter/testfilter/testfilter.c index ff028ac30..8269dc2c1 100644 --- a/server/modules/filter/testfilter/testfilter.c +++ b/server/modules/filter/testfilter/testfilter.c @@ -31,7 +31,7 @@ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PARAMETER *params); -static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); +static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, MXS_SESSION *session); static void closeSession(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, MXS_DOWNSTREAM *downstream); @@ -137,7 +137,7 @@ createInstance(const char *name, char **options, CONFIG_PARAMETER *params) * @return Session specific data for this session */ static MXS_FILTER_SESSION * -newSession(MXS_FILTER *instance, SESSION *session) +newSession(MXS_FILTER *instance, MXS_SESSION *session) { TEST_INSTANCE *my_instance = (TEST_INSTANCE *)instance; TEST_SESSION *my_session; diff --git a/server/modules/filter/topfilter/topfilter.c b/server/modules/filter/topfilter/topfilter.c index 1c74310d3..f768689b4 100644 --- a/server/modules/filter/topfilter/topfilter.c +++ b/server/modules/filter/topfilter/topfilter.c @@ -51,7 +51,7 @@ * The filter entry points */ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PARAMETER *); -static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); +static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, MXS_SESSION *session); static void closeSession(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, MXS_DOWNSTREAM *downstream); @@ -266,7 +266,7 @@ createInstance(const char *name, char **options, CONFIG_PARAMETER *params) * @return Session specific data for this session */ static MXS_FILTER_SESSION * -newSession(MXS_FILTER *instance, SESSION *session) +newSession(MXS_FILTER *instance, MXS_SESSION *session) { TOPN_INSTANCE *my_instance = (TOPN_INSTANCE *) instance; TOPN_SESSION *my_session; diff --git a/server/modules/filter/tpmfilter/tpmfilter.c b/server/modules/filter/tpmfilter/tpmfilter.c index 958611654..4dd21f950 100644 --- a/server/modules/filter/tpmfilter/tpmfilter.c +++ b/server/modules/filter/tpmfilter/tpmfilter.c @@ -78,7 +78,7 @@ static const int default_sql_size = 4 * 1024; * The filter entry points */ static MXS_FILTER *createInstance(const char *name, char **options, CONFIG_PARAMETER *); -static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, SESSION *session); +static MXS_FILTER_SESSION *newSession(MXS_FILTER *instance, MXS_SESSION *session); static void closeSession(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, MXS_DOWNSTREAM *downstream); @@ -296,7 +296,7 @@ createInstance(const char *name, char **options, CONFIG_PARAMETER *params) * @return Session specific data for this session */ static MXS_FILTER_SESSION * -newSession(MXS_FILTER *instance, SESSION *session) +newSession(MXS_FILTER *instance, MXS_SESSION *session) { TPM_INSTANCE *my_instance = (TPM_INSTANCE *)instance; TPM_SESSION *my_session; diff --git a/server/modules/include/debugcli.h b/server/modules/include/debugcli.h index a46b46f76..4c4bfa4ce 100644 --- a/server/modules/include/debugcli.h +++ b/server/modules/include/debugcli.h @@ -59,7 +59,7 @@ typedef struct cli_instance typedef struct cli_session { char cmdbuf[CMDBUFLEN]; /*< The command buffer used to build up user commands */ - SESSION *session; /*< The gateway session */ + MXS_SESSION *session; /*< The gateway session */ struct cli_session *next; /*< The next pointer for the list of sessions */ } CLI_SESSION; diff --git a/server/modules/protocol/CDC/cdc.c b/server/modules/protocol/CDC/cdc.c index adbed5135..93f293c0e 100644 --- a/server/modules/protocol/CDC/cdc.c +++ b/server/modules/protocol/CDC/cdc.c @@ -117,7 +117,7 @@ MXS_MODULE* MXS_CREATE_MODULE() static int cdc_read_event(DCB* dcb) { - SESSION *session = dcb->session; + MXS_SESSION *session = dcb->session; CDC_protocol *protocol = (CDC_protocol *) dcb->protocol; int n, auth_val, rc = 0; GWBUF *head = NULL; @@ -199,7 +199,7 @@ cdc_read_event(DCB* dcb) (int)GWBUF_LENGTH(head), (char*)GWBUF_DATA(head)); // gwbuf_set_type(head, GWBUF_TYPE_CDC); - rc = SESSION_ROUTE_QUERY(session, head); + rc = MXS_SESSION_ROUTE_QUERY(session, head); } break; diff --git a/server/modules/protocol/HTTPD/httpd.c b/server/modules/protocol/HTTPD/httpd.c index 693fc9f0a..244c045a2 100644 --- a/server/modules/protocol/HTTPD/httpd.c +++ b/server/modules/protocol/HTTPD/httpd.c @@ -125,7 +125,7 @@ static char *httpd_default_auth() */ static int httpd_read_event(DCB* dcb) { - SESSION *session = dcb->session; + MXS_SESSION *session = dcb->session; int numchars = 1; char buf[HTTPD_REQUESTLINE_MAXLEN - 1] = ""; @@ -291,7 +291,7 @@ static int httpd_read_event(DCB* dcb) { strcpy((char *)GWBUF_DATA(uri), url); gwbuf_set_type(uri, GWBUF_TYPE_HTTP); - SESSION_ROUTE_QUERY(session, uri); + MXS_SESSION_ROUTE_QUERY(session, uri); } /* force the client connecton close */ diff --git a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c index 94f5d0a76..83500c052 100644 --- a/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c +++ b/server/modules/protocol/MySQL/MySQLBackend/mysql_backend.c @@ -53,7 +53,7 @@ * */ -static int gw_create_backend_connection(DCB *backend, SERVER *server, SESSION *in_session); +static int gw_create_backend_connection(DCB *backend, SERVER *server, MXS_SESSION *in_session); static int gw_read_backend_event(DCB* dcb); static int gw_write_backend_event(DCB *dcb); static int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue); @@ -62,7 +62,7 @@ static int gw_backend_close(DCB *dcb); static int gw_backend_hangup(DCB *dcb); static int backend_write_delayqueue(DCB *dcb, GWBUF *buffer); static void backend_set_delayqueue(DCB *dcb, GWBUF *queue); -static int gw_change_user(DCB *backend_dcb, SERVER *server, SESSION *in_session, GWBUF *queue); +static int gw_change_user(DCB *backend_dcb, SERVER *server, MXS_SESSION *in_session, GWBUF *queue); static char *gw_backend_default_auth(); static GWBUF* process_response_data(DCB* dcb, GWBUF** readbuf, int nbytes_to_process); extern char* create_auth_failed_msg(GWBUF* readbuf, char* hostaddr, uint8_t* sha1); @@ -168,7 +168,7 @@ static char *gw_backend_default_auth() */ static int gw_create_backend_connection(DCB *backend_dcb, SERVER *server, - SESSION *session) + MXS_SESSION *session) { MySQLProtocol *protocol = NULL; int rv = -1; @@ -614,7 +614,7 @@ gw_read_backend_event(DCB *dcb) static void gw_reply_on_error(DCB *dcb, mxs_auth_state_t state) { - SESSION *session = dcb->session; + MXS_SESSION *session = dcb->session; CHK_SESSION(session); /* Only reload the users table if authentication failed and the @@ -705,7 +705,7 @@ static int gw_read_and_write(DCB *dcb) { GWBUF *read_buffer = NULL; - SESSION *session = dcb->session; + MXS_SESSION *session = dcb->session; int nbytes_read; int return_code = 0; @@ -1119,13 +1119,13 @@ static int gw_MySQLWrite_backend(DCB *dcb, GWBUF *queue) */ static int gw_error_backend_event(DCB *dcb) { - SESSION* session; + MXS_SESSION* session; void* rsession; ROUTER_OBJECT* router; ROUTER* router_instance; GWBUF* errbuf; bool succp; - session_state_t ses_state; + mxs_session_state_t ses_state; CHK_DCB(dcb); session = dcb->session; @@ -1246,13 +1246,13 @@ retblock: */ static int gw_backend_hangup(DCB *dcb) { - SESSION* session; + MXS_SESSION* session; void* rsession; ROUTER_OBJECT* router; ROUTER* router_instance; bool succp; GWBUF* errbuf; - session_state_t ses_state; + mxs_session_state_t ses_state; CHK_DCB(dcb); if (dcb->persistentstart) @@ -1346,7 +1346,7 @@ retblock: */ static int gw_backend_close(DCB *dcb) { - SESSION* session; + MXS_SESSION* session; GWBUF* quitbuf; CHK_DCB(dcb); @@ -1450,7 +1450,7 @@ static int backend_write_delayqueue(DCB *dcb, GWBUF *buffer) if (rc == 0) { - SESSION *session = dcb->session; + MXS_SESSION *session = dcb->session; CHK_SESSION(session); ROUTER_OBJECT *router = session->service->router; ROUTER *router_instance = session->service->router_instance; @@ -1493,7 +1493,7 @@ static int backend_write_delayqueue(DCB *dcb, GWBUF *buffer) */ static int gw_change_user(DCB *backend, SERVER *server, - SESSION *in_session, + MXS_SESSION *in_session, GWBUF *queue) { MYSQL_session *current_session = NULL; diff --git a/server/modules/protocol/MySQL/MySQLClient/mysql_client.c b/server/modules/protocol/MySQL/MySQLClient/mysql_client.c index cf49f552a..43439dbe3 100644 --- a/server/modules/protocol/MySQL/MySQLClient/mysql_client.c +++ b/server/modules/protocol/MySQL/MySQLClient/mysql_client.c @@ -79,7 +79,7 @@ static int gw_client_hangup_event(DCB *dcb); static char *gw_default_auth(); static int gw_connection_limit(DCB *dcb, int limit); static int MySQLSendHandshake(DCB* dcb); -static int route_by_statement(SESSION *, uint64_t, GWBUF **); +static int route_by_statement(MXS_SESSION *, uint64_t, GWBUF **); static void mysql_client_auth_error_handling(DCB *dcb, int auth_val, int packet_number); static int gw_read_do_authentication(DCB *dcb, GWBUF *read_buffer, int nbytes_read); static int gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read); @@ -672,7 +672,7 @@ gw_read_do_authentication(DCB *dcb, GWBUF *read_buffer, int nbytes_read) * is changed so that future data will go through the * normal data handling function instead of this one. */ - SESSION *session = session_alloc(dcb->service, dcb); + MXS_SESSION *session = session_alloc(dcb->service, dcb); if (session != NULL) { @@ -864,8 +864,8 @@ static bool process_client_commands(DCB* dcb, int bytes_available, GWBUF** buffe static int gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read) { - SESSION *session; - session_state_t session_state_value; + MXS_SESSION *session; + mxs_session_state_t session_state_value; uint64_t capabilities = 0; session = dcb->session; @@ -923,7 +923,7 @@ gw_read_normal_data(DCB *dcb, GWBUF *read_buffer, int nbytes_read) static int gw_read_finish_processing(DCB *dcb, GWBUF *read_buffer, uint64_t capabilities) { - SESSION *session = dcb->session; + MXS_SESSION *session = dcb->session; uint8_t *payload = GWBUF_DATA(read_buffer); MySQLProtocol *proto = (MySQLProtocol*)dcb->protocol; CHK_PROTOCOL(proto); @@ -955,7 +955,7 @@ gw_read_finish_processing(DCB *dcb, GWBUF *read_buffer, uint64_t capabilities) /** Feed whole packet to router, which will free it * and return 1 for success, 0 for failure */ - return_code = SESSION_ROUTE_QUERY(session, read_buffer) ? 0 : 1; + return_code = MXS_SESSION_ROUTE_QUERY(session, read_buffer) ? 0 : 1; } /* else return_code is still 0 from when it was originally set */ /* Note that read_buffer has been freed or transferred by this point */ @@ -1286,7 +1286,7 @@ static void gw_process_one_new_client(DCB *client_dcb) static int gw_error_client_event(DCB* dcb) { - SESSION* session; + MXS_SESSION* session; CHK_DCB(dcb); @@ -1316,7 +1316,7 @@ retblock: static int gw_client_close(DCB *dcb) { - SESSION* session; + MXS_SESSION* session; ROUTER_OBJECT* router; void* router_instance; #if defined(SS_DEBUG) @@ -1378,7 +1378,7 @@ gw_client_close(DCB *dcb) */ static int gw_client_hangup_event(DCB *dcb) { - SESSION* session; + MXS_SESSION* session; CHK_DCB(dcb); session = dcb->session; @@ -1415,7 +1415,7 @@ retblock: * * @return 1 if succeed, */ -static int route_by_statement(SESSION* session, uint64_t capabilities, GWBUF** p_readbuf) +static int route_by_statement(MXS_SESSION* session, uint64_t capabilities, GWBUF** p_readbuf) { int rc; GWBUF* packetbuf; @@ -1496,7 +1496,7 @@ static int route_by_statement(SESSION* session, uint64_t capabilities, GWBUF** p } else { - session_trx_state_t trx_state; + mxs_session_trx_state_t trx_state; if (type & QUERY_TYPE_WRITE) { trx_state = SESSION_TRX_READ_WRITE; @@ -1527,7 +1527,7 @@ static int route_by_statement(SESSION* session, uint64_t capabilities, GWBUF** p } /** Route query */ - rc = SESSION_ROUTE_QUERY(session, packetbuf); + rc = MXS_SESSION_ROUTE_QUERY(session, packetbuf); } else { diff --git a/server/modules/protocol/maxscaled/maxscaled.c b/server/modules/protocol/maxscaled/maxscaled.c index d8ee8e110..71cf4e600 100644 --- a/server/modules/protocol/maxscaled/maxscaled.c +++ b/server/modules/protocol/maxscaled/maxscaled.c @@ -268,7 +268,7 @@ static int maxscaled_read_event(DCB* dcb) case MAXSCALED_STATE_DATA: { - SESSION_ROUTE_QUERY(dcb->session, head); + MXS_SESSION_ROUTE_QUERY(dcb->session, head); dcb_printf(dcb, "OK"); } break; diff --git a/server/modules/protocol/telnetd/telnetd.c b/server/modules/protocol/telnetd/telnetd.c index 613f92424..148c9f89b 100644 --- a/server/modules/protocol/telnetd/telnetd.c +++ b/server/modules/protocol/telnetd/telnetd.c @@ -145,7 +145,7 @@ static int telnetd_read_event(DCB* dcb) { int n; GWBUF *head = NULL; - SESSION *session = dcb->session; + MXS_SESSION *session = dcb->session; TELNETD *telnetd = (TELNETD *)dcb->protocol; char *password, *t; @@ -203,7 +203,7 @@ static int telnetd_read_event(DCB* dcb) MXS_FREE(password); break; case TELNETD_STATE_DATA: - SESSION_ROUTE_QUERY(session, head); + MXS_SESSION_ROUTE_QUERY(session, head); break; } } diff --git a/server/modules/routing/binlogrouter/blr.c b/server/modules/routing/binlogrouter/blr.c index f46fb6fc8..495823f23 100644 --- a/server/modules/routing/binlogrouter/blr.c +++ b/server/modules/routing/binlogrouter/blr.c @@ -90,7 +90,7 @@ /* The router entry points */ static ROUTER *createInstance(SERVICE *service, char **options); static void free_instance(ROUTER_INSTANCE *instance); -static void *newSession(ROUTER *instance, SESSION *session); +static void *newSession(ROUTER *instance, MXS_SESSION *session); static void closeSession(ROUTER *instance, void *router_session); static void freeSession(ROUTER *instance, void *router_session); static int routeQuery(ROUTER *instance, void *router_session, GWBUF *queue); @@ -961,7 +961,7 @@ free_instance(ROUTER_INSTANCE *instance) * @return Session specific data for this session */ static void * -newSession(ROUTER *instance, SESSION *session) +newSession(ROUTER *instance, MXS_SESSION *session) { ROUTER_INSTANCE *inst = (ROUTER_INSTANCE *)instance; ROUTER_SLAVE *slave; diff --git a/server/modules/routing/binlogrouter/blr.h b/server/modules/routing/binlogrouter/blr.h index 852574dda..630247fb9 100644 --- a/server/modules/routing/binlogrouter/blr.h +++ b/server/modules/routing/binlogrouter/blr.h @@ -529,7 +529,7 @@ typedef struct router_instance char *master_uuid; /*< Set UUID of the master, sent to slaves */ DCB *master; /*< DCB for master connection */ DCB *client; /*< DCB for dummy client */ - SESSION *session; /*< Fake session for master connection */ + MXS_SESSION *session; /*< Fake session for master connection */ unsigned int master_state; /*< State of the master FSM */ uint8_t lastEventReceived; /*< Last even received */ uint32_t lastEventTimestamp; /*< Timestamp from last event */ diff --git a/server/modules/routing/cli/cli.c b/server/modules/routing/cli/cli.c index d38adb354..5375880c8 100644 --- a/server/modules/routing/cli/cli.c +++ b/server/modules/routing/cli/cli.c @@ -45,7 +45,7 @@ /* The router entry points */ static ROUTER *createInstance(SERVICE *service, char **options); -static void *newSession(ROUTER *instance, SESSION *session); +static void *newSession(ROUTER *instance, MXS_SESSION *session); static void closeSession(ROUTER *instance, void *router_session); static void freeSession(ROUTER *instance, void *router_session); static int execute(ROUTER *instance, void *router_session, GWBUF *queue); @@ -158,7 +158,7 @@ createInstance(SERVICE *service, char **options) * @return Session specific data for this session */ static void * -newSession(ROUTER *instance, SESSION *session) +newSession(ROUTER *instance, MXS_SESSION *session) { CLI_INSTANCE *inst = (CLI_INSTANCE *)instance; CLI_SESSION *client; diff --git a/server/modules/routing/debugcli/debugcli.c b/server/modules/routing/debugcli/debugcli.c index cd5fb4a1c..016c6faad 100644 --- a/server/modules/routing/debugcli/debugcli.c +++ b/server/modules/routing/debugcli/debugcli.c @@ -44,7 +44,7 @@ /* The router entry points */ static ROUTER *createInstance(SERVICE *service, char **options); -static void *newSession(ROUTER *instance, SESSION *session); +static void *newSession(ROUTER *instance, MXS_SESSION *session); static void closeSession(ROUTER *instance, void *router_session); static void freeSession(ROUTER *instance, void *router_session); static int execute(ROUTER *instance, void *router_session, GWBUF *queue); @@ -149,7 +149,7 @@ createInstance(SERVICE *service, char **options) * @return Session specific data for this session */ static void * -newSession(ROUTER *instance, SESSION *session) +newSession(ROUTER *instance, MXS_SESSION *session) { CLI_INSTANCE *inst = (CLI_INSTANCE *)instance; CLI_SESSION *client; diff --git a/server/modules/routing/debugcli/debugcmd.c b/server/modules/routing/debugcli/debugcmd.c index 8fe83cff1..102dd8b5c 100644 --- a/server/modules/routing/debugcli/debugcmd.c +++ b/server/modules/routing/debugcli/debugcmd.c @@ -2138,7 +2138,7 @@ bool seslog_cb(DCB *dcb, void *data) struct log_action_entry *entry = ((void**)data)[0]; size_t *id = ((void**)data)[1]; bool enable = (bool)((void**)data)[2]; - SESSION *session = dcb->session; + MXS_SESSION *session = dcb->session; if (session->ses_id == *id) { @@ -2251,7 +2251,7 @@ bool sesprio_cb(DCB *dcb, void *data) int *priority = ((void**)data)[0]; size_t *id = ((void**)data)[1]; bool enable = (bool)((void**)data)[2]; - SESSION *session = dcb->session; + MXS_SESSION *session = dcb->session; if (session->ses_id == *id) { diff --git a/server/modules/routing/maxinfo/maxinfo.c b/server/modules/routing/maxinfo/maxinfo.c index f22992488..c54b3d1b6 100644 --- a/server/modules/routing/maxinfo/maxinfo.c +++ b/server/modules/routing/maxinfo/maxinfo.c @@ -63,7 +63,7 @@ static int handle_url(INFO_INSTANCE *instance, INFO_SESSION *router_session, GWB /* The router entry points */ static ROUTER *createInstance(SERVICE *service, char **options); -static void *newSession(ROUTER *instance, SESSION *session); +static void *newSession(ROUTER *instance, MXS_SESSION *session); static void closeSession(ROUTER *instance, void *router_session); static void freeSession(ROUTER *instance, void *router_session); static int execute(ROUTER *instance, void *router_session, GWBUF *queue); @@ -179,7 +179,7 @@ createInstance(SERVICE *service, char **options) * @return Session specific data for this session */ static void * -newSession(ROUTER *instance, SESSION *session) +newSession(ROUTER *instance, MXS_SESSION *session) { INFO_INSTANCE *inst = (INFO_INSTANCE *)instance; INFO_SESSION *client; @@ -275,8 +275,8 @@ static void handleError(ROUTER *instance, { DCB *client_dcb; - SESSION *session = backend_dcb->session; - session_state_t sesstate; + MXS_SESSION *session = backend_dcb->session; + mxs_session_state_t sesstate; /** Don't handle same error twice on same DCB */ if (backend_dcb->dcb_errhandle_called) diff --git a/server/modules/routing/maxinfo/maxinfo.h b/server/modules/routing/maxinfo/maxinfo.h index b891ad0e0..6f4fa9228 100644 --- a/server/modules/routing/maxinfo/maxinfo.h +++ b/server/modules/routing/maxinfo/maxinfo.h @@ -58,9 +58,9 @@ typedef struct maxinfo_instance typedef struct maxinfo_session { - SESSION *session; /*< The MaxScale session */ - DCB *dcb; /*< DCB of the client side */ - GWBUF *queue; /*< Queue for building contiguous requests */ + MXS_SESSION *session; /*< The MaxScale session */ + DCB *dcb; /*< DCB of the client side */ + GWBUF *queue; /*< Queue for building contiguous requests */ struct maxinfo_session *next; /*< The next pointer for the list of sessions */ } INFO_SESSION; diff --git a/server/modules/routing/readconnroute/readconnroute.c b/server/modules/routing/readconnroute/readconnroute.c index 36103d58a..ae6597d37 100644 --- a/server/modules/routing/readconnroute/readconnroute.c +++ b/server/modules/routing/readconnroute/readconnroute.c @@ -90,7 +90,7 @@ /* The router entry points */ static ROUTER *createInstance(SERVICE *service, char **options); -static void *newSession(ROUTER *instance, SESSION *session); +static void *newSession(ROUTER *instance, MXS_SESSION *session); static void closeSession(ROUTER *instance, void *router_session); static void freeSession(ROUTER *instance, void *router_session); static int routeQuery(ROUTER *instance, void *router_session, GWBUF *queue); @@ -268,7 +268,7 @@ createInstance(SERVICE *service, char **options) * @return Session specific data for this session */ static void * -newSession(ROUTER *instance, SESSION *session) +newSession(ROUTER *instance, MXS_SESSION *session) { ROUTER_INSTANCE *inst = (ROUTER_INSTANCE *) instance; ROUTER_CLIENT_SES *client_rses; @@ -695,8 +695,8 @@ static void handleError(ROUTER *instance, void *router_session, GWBUF *errbuf, { DCB *client_dcb; - SESSION *session = problem_dcb->session; - session_state_t sesstate; + MXS_SESSION *session = problem_dcb->session; + mxs_session_state_t sesstate; ROUTER_CLIENT_SES *router_cli_ses = (ROUTER_CLIENT_SES *) router_session; /** Don't handle same error twice on same DCB */ @@ -848,7 +848,7 @@ static SERVER_REF *get_root_master(SERVER_REF *servers) static int handle_state_switch(DCB* dcb, DCB_REASON reason, void * routersession) { ss_dassert(dcb != NULL); - SESSION* session = dcb->session; + MXS_SESSION* session = dcb->session; ROUTER_CLIENT_SES* rses = (ROUTER_CLIENT_SES*) routersession; SERVICE* service = session->service; ROUTER* router = (ROUTER *) service->router; diff --git a/server/modules/routing/readwritesplit/readwritesplit.c b/server/modules/routing/readwritesplit/readwritesplit.c index 42848f080..cc92ed0c4 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.c +++ b/server/modules/routing/readwritesplit/readwritesplit.c @@ -69,7 +69,7 @@ */ static ROUTER *createInstance(SERVICE *service, char **options); -static void *newSession(ROUTER *instance, SESSION *session); +static void *newSession(ROUTER *instance, MXS_SESSION *session); static void closeSession(ROUTER *instance, void *session); static void freeSession(ROUTER *instance, void *session); static int routeQuery(ROUTER *instance, void *session, GWBUF *queue); @@ -96,7 +96,7 @@ static uint64_t getCapabilities(void); static void free_rwsplit_instance(ROUTER_INSTANCE *router); static bool rwsplit_process_router_options(ROUTER_INSTANCE *router, char **options); -static void handle_error_reply_client(SESSION *ses, ROUTER_CLIENT_SES *rses, +static void handle_error_reply_client(MXS_SESSION *ses, ROUTER_CLIENT_SES *rses, DCB *backend_dcb, GWBUF *errmsg); static bool handle_error_new_connection(ROUTER_INSTANCE *inst, ROUTER_CLIENT_SES **rses, @@ -313,7 +313,7 @@ static ROUTER *createInstance(SERVICE *service, char **options) * @param session The MaxScale session (generic connection data) * @return Session specific data for this session, i.e. a router session */ -static void *newSession(ROUTER *router_inst, SESSION *session) +static void *newSession(ROUTER *router_inst, MXS_SESSION *session) { ROUTER_INSTANCE *router = (ROUTER_INSTANCE *)router_inst; ROUTER_CLIENT_SES *client_rses = (ROUTER_CLIENT_SES *)MXS_CALLOC(1, sizeof(ROUTER_CLIENT_SES)); @@ -1179,7 +1179,7 @@ int router_handle_state_switch(DCB *dcb, DCB_REASON reason, void *data) MXS_DEBUG("%lu [router_handle_state_switch] %s %s:%d in state %s", pthread_self(), STRDCBREASON(reason), srv->name, srv->port, STRSRVSTATUS(srv)); - CHK_SESSION(((SESSION *)dcb->session)); + CHK_SESSION(((MXS_SESSION *)dcb->session)); if (dcb->session->router_session) { CHK_CLIENT_RSES(((ROUTER_CLIENT_SES *)dcb->session->router_session)); @@ -1334,7 +1334,7 @@ static void handleError(ROUTER *instance, void *router_session, GWBUF *errmsgbuf, DCB *problem_dcb, error_action_t action, bool *succp) { - SESSION *session; + MXS_SESSION *session; ROUTER_INSTANCE *inst = (ROUTER_INSTANCE *)instance; ROUTER_CLIENT_SES *rses = (ROUTER_CLIENT_SES *)router_session; @@ -1490,10 +1490,10 @@ static void handleError(ROUTER *instance, void *router_session, * @param backend_dcb DCB for the backend server that has failed * @param errmsg GWBUF containing the error message */ -static void handle_error_reply_client(SESSION *ses, ROUTER_CLIENT_SES *rses, +static void handle_error_reply_client(MXS_SESSION *ses, ROUTER_CLIENT_SES *rses, DCB *backend_dcb, GWBUF *errmsg) { - session_state_t sesstate; + mxs_session_state_t sesstate; DCB *client_dcb; backend_ref_t *bref; @@ -1594,7 +1594,7 @@ static bool handle_error_new_connection(ROUTER_INSTANCE *inst, DCB *backend_dcb, GWBUF *errmsg) { ROUTER_CLIENT_SES *myrses; - SESSION *ses; + MXS_SESSION *ses; int max_nslaves; int max_slave_rlag; backend_ref_t *bref; diff --git a/server/modules/routing/readwritesplit/rwsplit_internal.h b/server/modules/routing/readwritesplit/rwsplit_internal.h index 3961a96bc..b68249e3b 100644 --- a/server/modules/routing/readwritesplit/rwsplit_internal.h +++ b/server/modules/routing/readwritesplit/rwsplit_internal.h @@ -133,7 +133,7 @@ bool select_connect_backend_servers(backend_ref_t **p_master_ref, int router_nservers, int max_nslaves, int max_slave_rlag, select_criteria_t select_criteria, - SESSION *session, + MXS_SESSION *session, ROUTER_INSTANCE *router, bool active_session); diff --git a/server/modules/routing/readwritesplit/rwsplit_mysql.c b/server/modules/routing/readwritesplit/rwsplit_mysql.c index 7d85c96c7..1f76aa16b 100644 --- a/server/modules/routing/readwritesplit/rwsplit_mysql.c +++ b/server/modules/routing/readwritesplit/rwsplit_mysql.c @@ -169,7 +169,7 @@ log_transaction_status(ROUTER_CLIENT_SES *rses, GWBUF *querybuf, qc_query_type_t char *data = (char *)&packet[5]; char *contentstr = strndup(data, MXS_MIN(len, RWSPLIT_TRACE_MSG_LEN)); char *qtypestr = qc_typemask_to_string(qtype); - SESSION *ses = rses->client_dcb->session; + MXS_SESSION *ses = rses->client_dcb->session; MXS_INFO("> Autocommit: %s, trx is %s, cmd: %s, type: %s, stmt: %s%s %s", (session_is_autocommit(ses) ? "[enabled]" : "[disabled]"), (session_trx_is_active(ses) ? "[open]" : "[not open]"), diff --git a/server/modules/routing/readwritesplit/rwsplit_select_backends.c b/server/modules/routing/readwritesplit/rwsplit_select_backends.c index 777366dd5..c4deca621 100644 --- a/server/modules/routing/readwritesplit/rwsplit_select_backends.c +++ b/server/modules/routing/readwritesplit/rwsplit_select_backends.c @@ -35,7 +35,7 @@ * @endverbatim */ -static bool connect_server(backend_ref_t *bref, SESSION *session, bool execute_history); +static bool connect_server(backend_ref_t *bref, MXS_SESSION *session, bool execute_history); static void log_server_connections(select_criteria_t select_criteria, backend_ref_t *backend_ref, int router_nservers); @@ -152,7 +152,7 @@ bool select_connect_backend_servers(backend_ref_t **p_master_ref, int router_nservers, int max_nslaves, int max_slave_rlag, select_criteria_t select_criteria, - SESSION *session, + MXS_SESSION *session, ROUTER_INSTANCE *router, bool active_session) { @@ -419,7 +419,7 @@ static int bref_cmp_current_load(const void *bref1, const void *bref2) * @param execute_history Execute session command history * @return True if successful, false if an error occurred */ -static bool connect_server(backend_ref_t *bref, SESSION *session, bool execute_history) +static bool connect_server(backend_ref_t *bref, MXS_SESSION *session, bool execute_history) { SERVER *serv = bref->ref->server; bool rval = false; diff --git a/server/modules/routing/schemarouter/schemarouter.c b/server/modules/routing/schemarouter/schemarouter.c index 6a513d3e8..628e5093f 100644 --- a/server/modules/routing/schemarouter/schemarouter.c +++ b/server/modules/routing/schemarouter/schemarouter.c @@ -58,7 +58,7 @@ */ static ROUTER* createInstance(SERVICE *service, char **options); -static void* newSession(ROUTER *instance, SESSION *session); +static void* newSession(ROUTER *instance, MXS_SESSION *session); static void closeSession(ROUTER *instance, void *session); static void freeSession(ROUTER *instance, void *session); static int routeQuery(ROUTER *instance, void *session, GWBUF *queue); @@ -85,7 +85,7 @@ static uint64_t getCapabilities(void); static bool connect_backend_servers(backend_ref_t* backend_ref, int router_nservers, - SESSION* session, + MXS_SESSION* session, ROUTER_INSTANCE* router); static bool get_shard_dcb(DCB** dcb, @@ -133,7 +133,7 @@ static bool handle_error_new_connection(ROUTER_INSTANCE* inst, ROUTER_CLIENT_SES* rses, DCB* backend_dcb, GWBUF* errmsg); -static void handle_error_reply_client(SESSION* ses, +static void handle_error_reply_client(MXS_SESSION* ses, ROUTER_CLIENT_SES* rses, DCB* backend_dcb, GWBUF* errmsg); @@ -847,7 +847,7 @@ enum shard_map_state shard_map_update_state(shard_map_t *self, ROUTER_INSTANCE* * @param session The session itself * @return Session specific data for this session */ -static void* newSession(ROUTER* router_inst, SESSION* session) +static void* newSession(ROUTER* router_inst, MXS_SESSION* session) { backend_ref_t* backend_ref; /*< array of backend references (DCB, BACKEND, cursor) */ ROUTER_CLIENT_SES* client_rses = NULL; @@ -2678,7 +2678,7 @@ static void bref_set_state(backend_ref_t* bref, bref_state_t state) */ static bool connect_backend_servers(backend_ref_t* backend_ref, int router_nservers, - SESSION* session, + MXS_SESSION* session, ROUTER_INSTANCE* router) { bool succp = true; @@ -3566,7 +3566,7 @@ static void handleError(ROUTER* instance, error_action_t action, bool* succp) { - SESSION* session; + MXS_SESSION* session; ROUTER_INSTANCE* inst = (ROUTER_INSTANCE *)instance; ROUTER_CLIENT_SES* rses = (ROUTER_CLIENT_SES *)router_session; @@ -3638,12 +3638,12 @@ static void handleError(ROUTER* instance, } -static void handle_error_reply_client(SESSION* ses, +static void handle_error_reply_client(MXS_SESSION* ses, ROUTER_CLIENT_SES* rses, DCB* backend_dcb, GWBUF* errmsg) { - session_state_t sesstate; + mxs_session_state_t sesstate; DCB* client_dcb; backend_ref_t* bref; @@ -3709,7 +3709,7 @@ static bool handle_error_new_connection(ROUTER_INSTANCE* inst, DCB* backend_dcb, GWBUF* errmsg) { - SESSION* ses; + MXS_SESSION* ses; unsigned char cmd = *((unsigned char*)errmsg->start + 4); backend_ref_t* bref; diff --git a/server/modules/routing/testroute/testroute.c b/server/modules/routing/testroute/testroute.c index 015651d53..57deb9602 100644 --- a/server/modules/routing/testroute/testroute.c +++ b/server/modules/routing/testroute/testroute.c @@ -16,7 +16,7 @@ #include static ROUTER *createInstance(SERVICE *service, char **options); -static void *newSession(ROUTER *instance, SESSION *session); +static void *newSession(ROUTER *instance, MXS_SESSION *session); static void closeSession(ROUTER *instance, void *session); static void freeSession(ROUTER *instance, void *session); static int routeQuery(ROUTER *instance, void *session, GWBUF *queue); @@ -105,9 +105,9 @@ createInstance(SERVICE *service, char **options) * @return Session specific data for this session */ static void * -newSession(ROUTER *instance, SESSION *session) +newSession(ROUTER *instance, MXS_SESSION *session) { - return (SESSION*)MXS_MALLOC(sizeof(TESTSESSION)); + return (MXS_SESSION*)MXS_MALLOC(sizeof(TESTSESSION)); } /**