Merge branch 'develop' into MAX-99
Conflicts: server/modules/routing/readwritesplit/readwritesplit.c
This commit is contained in:
@ -97,9 +97,9 @@ typedef struct gwbuf {
|
||||
#define GWBUF_EMPTY(b) ((b)->start == (b)->end)
|
||||
|
||||
/*< Consume a number of bytes in the buffer */
|
||||
#define GWBUF_CONSUME(b, bytes) (b)->start += bytes
|
||||
#define GWBUF_CONSUME(b, bytes) (b)->start += (bytes)
|
||||
|
||||
#define GWBUF_RTRIM(b, bytes) (b)->end -= bytes
|
||||
#define GWBUF_RTRIM(b, bytes) (b)->end -= (bytes)
|
||||
|
||||
#define GWBUF_TYPE(b) (b)->gwbuf_type
|
||||
/*<
|
||||
@ -110,6 +110,7 @@ extern void gwbuf_free(GWBUF *buf);
|
||||
extern GWBUF *gwbuf_clone(GWBUF *buf);
|
||||
extern GWBUF *gwbuf_append(GWBUF *head, GWBUF *tail);
|
||||
extern GWBUF *gwbuf_consume(GWBUF *head, unsigned int length);
|
||||
extern GWBUF *gwbuf_trim(GWBUF *head, unsigned int length);
|
||||
extern unsigned int gwbuf_length(GWBUF *head);
|
||||
extern GWBUF *gwbuf_clone_portion(GWBUF *head, size_t offset, size_t len);
|
||||
extern GWBUF *gwbuf_clone_transform(GWBUF *head, gwbuf_type_t type);
|
||||
|
||||
@ -207,7 +207,9 @@ typedef struct dcb {
|
||||
#endif
|
||||
int fd; /**< The descriptor */
|
||||
dcb_state_t state; /**< Current descriptor state */
|
||||
int flags; /**< DCB flags */
|
||||
char *remote; /**< Address of remote end */
|
||||
char *user; /**< User name for connection */
|
||||
struct sockaddr_in ipv4; /**< remote end IPv4 address */
|
||||
void *protocol; /**< The protocol specific state */
|
||||
struct session *session; /**< The owning session */
|
||||
@ -269,6 +271,7 @@ int dcb_write(DCB *, GWBUF *);
|
||||
DCB *dcb_alloc(dcb_role_t);
|
||||
void dcb_free(DCB *);
|
||||
DCB *dcb_connect(struct server *, struct session *, const char *);
|
||||
DCB *dcb_clone(DCB *);
|
||||
int dcb_read(DCB *, GWBUF **);
|
||||
int dcb_drain_writeq(DCB *);
|
||||
void dcb_close(DCB *);
|
||||
@ -293,4 +296,8 @@ bool dcb_set_state(
|
||||
DCB* dcb,
|
||||
dcb_state_t new_state,
|
||||
dcb_state_t* old_state);
|
||||
|
||||
|
||||
/* DCB flags values */
|
||||
#define DCBF_CLONE 0x0001 /* DCB is a clone */
|
||||
#endif /* _DCB_H */
|
||||
|
||||
@ -61,6 +61,7 @@ typedef struct {
|
||||
* filter pipline
|
||||
* routeQuery Called on each query that requires
|
||||
* routing
|
||||
* clientReply
|
||||
* diagnostics Called to force the filter to print
|
||||
* diagnostic output
|
||||
*
|
||||
@ -74,7 +75,9 @@ typedef struct filter_object {
|
||||
void (*closeSession)(FILTER *instance, void *fsession);
|
||||
void (*freeSession)(FILTER *instance, void *fsession);
|
||||
void (*setDownstream)(FILTER *instance, void *fsession, DOWNSTREAM *downstream);
|
||||
void (*setUpstream)(FILTER *instance, void *fsession, UPSTREAM *downstream);
|
||||
int (*routeQuery)(FILTER *instance, void *fsession, GWBUF *queue);
|
||||
int (*clientReply)(FILTER *instance, void *fsession, GWBUF *queue);
|
||||
void (*diagnostics)(FILTER *instance, void *fsession, DCB *dcb);
|
||||
} FILTER_OBJECT;
|
||||
|
||||
@ -83,7 +86,7 @@ typedef struct filter_object {
|
||||
* is changed these values must be updated in line with the rules in the
|
||||
* file modinfo.h.
|
||||
*/
|
||||
#define FILTER_VERSION {1, 0, 0}
|
||||
#define FILTER_VERSION {1, 1, 0}
|
||||
/**
|
||||
* The definition of a filter form the configuration file.
|
||||
* This is basically the link between a plugin to load and the
|
||||
@ -108,6 +111,8 @@ FILTER_DEF *filter_find(char *);
|
||||
void filterAddOption(FILTER_DEF *, char *);
|
||||
void filterAddParameter(FILTER_DEF *, char *, char *);
|
||||
DOWNSTREAM *filterApply(FILTER_DEF *, SESSION *, DOWNSTREAM *);
|
||||
UPSTREAM *filterUpstream(FILTER_DEF *, void *, UPSTREAM *);
|
||||
int filter_standard_parameter(char *);
|
||||
void dprintAllFilters(DCB *);
|
||||
void dprintFilter(DCB *, FILTER_DEF *);
|
||||
void dListFilters(DCB *);
|
||||
|
||||
@ -26,6 +26,7 @@
|
||||
*
|
||||
* Date Who Description
|
||||
* 04/06/14 Mark Riddoch Initial implementation
|
||||
* 24/06/14 Mark Riddoch Add modutil_MySQL_Query to enable multipacket queries
|
||||
*
|
||||
* @endverbatim
|
||||
*/
|
||||
@ -33,5 +34,6 @@
|
||||
|
||||
extern int modutil_is_SQL(GWBUF *);
|
||||
extern int modutil_extract_SQL(GWBUF *, char **, int *);
|
||||
extern int modutil_MySQL_Query(GWBUF *, char **, int *, int *);
|
||||
extern GWBUF *modutil_replace_SQL(GWBUF *, char *);
|
||||
#endif
|
||||
|
||||
@ -70,8 +70,8 @@ typedef enum {
|
||||
typedef struct {
|
||||
void *instance;
|
||||
void *session;
|
||||
int (*routeQuery)(void *instance,
|
||||
void *router_session, GWBUF *queue);
|
||||
int (*routeQuery)(void *instance, void *session,
|
||||
GWBUF *request);
|
||||
} DOWNSTREAM;
|
||||
|
||||
/**
|
||||
@ -81,8 +81,9 @@ typedef struct {
|
||||
typedef struct {
|
||||
void *instance;
|
||||
void *session;
|
||||
int (*write)(void *, void *, GWBUF *);
|
||||
int (*error)(void *);
|
||||
int (*clientReply)(void *instance,
|
||||
void *session, GWBUF *response);
|
||||
int (*error)(void *instance, void *session, void *);
|
||||
} UPSTREAM;
|
||||
|
||||
/**
|
||||
@ -117,6 +118,7 @@ typedef struct session {
|
||||
int n_filters; /**< Number of filter sessions */
|
||||
SESSION_FILTER *filters; /**< The filters in use within this session */
|
||||
DOWNSTREAM head; /**< Head of the filter chain */
|
||||
UPSTREAM tail; /**< The tail of the filter chain */
|
||||
struct session *next; /**< Linked list of all sessions */
|
||||
int refcount; /**< Reference count on the session */
|
||||
#if defined(SS_DEBUG)
|
||||
@ -131,13 +133,24 @@ typedef struct session {
|
||||
* the incoming data to the first element in the pipeline of filters and
|
||||
* routers.
|
||||
*/
|
||||
#define SESSION_ROUTE_QUERY(session, buf) \
|
||||
((session)->head.routeQuery)((session)->head.instance, \
|
||||
(session)->head.session, (buf))
|
||||
#define SESSION_ROUTE_QUERY(sess, buf) \
|
||||
((sess)->head.routeQuery)((sess)->head.instance, \
|
||||
(sess)->head.session, (buf))
|
||||
/**
|
||||
* A convenience macro that can be used by the router modules to route
|
||||
* the replies to the first element in the pipeline of filters and
|
||||
* the protocol.
|
||||
*/
|
||||
#define SESSION_ROUTE_REPLY(sess, buf) \
|
||||
((sess)->tail.clientReply)((sess)->tail.instance, \
|
||||
(sess)->tail.session, (buf))
|
||||
|
||||
SESSION *session_alloc(struct service *, struct dcb *);
|
||||
bool session_free(SESSION *);
|
||||
int session_isvalid(SESSION *);
|
||||
int session_reply(void *inst, void *session, GWBUF *data);
|
||||
char *session_get_remote(SESSION *);
|
||||
char *session_getUser(SESSION *);
|
||||
void printAllSessions();
|
||||
void printSession(SESSION *);
|
||||
void dprintAllSessions(struct dcb *);
|
||||
|
||||
Reference in New Issue
Block a user