
973b983 Merge branch 'release-2.0.0' into develop 255dd23 Make spinlock functions take const argument 6e23bab Fix bitmask reallocation 338c189 Rename and clean up slavelag filter 3ea8f28 Fix possible NULL pointer dereference bfe6738 MXS-830: Add module information to logged messages 1fad962 Fix strncat usage d38997a Adjust log throttling policy 0be4e4b Add hashtable_item_strcasecmp 726100e Take hashtable convenience functions into use 5e7744a Fix typo in maxadmin.md c5778c8 Merge branch 'release-2.0.0' into develop b5762af Move from tmpnam to mkstemp d6f2c71 Add convenience functions to hashtable 359058a MXS-825: Add support for --execdir 636347c Enable runtime reconfiguration of log throttling ef9fba9 Improve log throttling documentation aef917a Implement log throttling e3a5349 Remove shardrouter.c 8051e80 Remove custom qc_sqlite allocation functions fd34d60 Initial implementation of the learning firewall a8752a8 Removed "filestem option" from example 1ef2519 Removed "filestem option" from example 0815cc8 Cleanup spinlock.h ab4dc99 Clean up hashtable.h ef2c078 Add prototypes for hashtable copy and free functions fb5cfaf Add 'log_throttling' configuration entry 300d823 Add proper prototypes for hashtable hash and cmp functions 1c649aa qc_mysqlembedded: Include skygw_...h without path. d276160 Add missing RPM scripts e70e644 Fix HTTPAuth installation 1b2b389 Combine utils into the server directory 3ff9913 Add missing utils headers to devel package 407efb2 Fix minor packaging problems 99aa6ad Split MaxScale into core, experimental and devel packages 1290386 Merge branch 'develop' of ssh://github.com/mariadb-corporation/maxscale-new into develop e59f148 Make scripts POSIX sh compatible 7319266 Fixed SHOW SLAVE STATUS in bonlog router f8d760a Update Binlogrouter.md 0a904ed Update Replication-Proxy-Binlog-Router-Tutorial.md 75d4202 Update Replication-Proxy-Binlog-Router-Tutorial.md b8651fc Add missing newline in listmanager.h c7ad047 Add note about user data caches to release notes 70ccc2b Merge branch 'release-2.0.0' into develop 575d1b6 Mistake - dummy session needs list markers set. 8364508 Merge branch 'develop' into binlog_server_semisync 868b902 Update MaxScale limitations 2c8b327 Store listener caches in separate directories 6e183ec Create unique user data caches for each listeners f643685 Don't free orphaned tee filter sessions 4179afa Allow binlogrouter to be used without a listener 7ad79af Add function for freeing a listener 677a0a2 Move authentication data from services to listeners 4f12af7 Merge remote-tracking branch 'origin/MXS-677' into develop 1419b81 Semi-Sync support to binlog server: code review updtate 0ea0f01 Semi-Sync support to binlog server: added missing routine 4aad909 Semi-Sync support to binlog server b824e1e Add authenticator support to httpd.c 705a688 Change tabs to spaces d0c419e Change method of adding list fields to e.g. DCB 25504fc Document the changed routing priority of hints 41666d1 Remove use_ssl_if_enabled global option a3584e9 Make routing hints have highest priority 34a1d24 Updated document with new binlog router option 01eedc5 Updated documentation with SSL usage 8a4c0f6 Update Replication-Proxy-Binlog-Router-Tutorial.md 4e374aa Update Replication-Proxy-Binlog-Router-Tutorial.md f3f3c57 Update Replication-Proxy-Binlog-Router-Tutorial.md 617b79f Binlog Server: error messages typo fix fa8dfae Binlog Server: error messages review 1b8819c Fix freeing of schemarouter session memory 07f49e1 MXS-788: new code review fix 1fd3b09 MXS-788: show services now displays SSL info 6ca2584 MXS-788 code review fix ae6a7d0 MXS-788 code review 43d3474 Master server SSL connection 90b2377 Use correct variable in listmanager pre-allocation 9a5b238 Fix listmanager pre-allocation 9c78625 Fix a memory leak when backend authentication fails e59a966 Fix hang in list_find_free ff30223 Fix freeing of shared data in schemarouter fc8f9d3 Add missing include in luafilter ecf7f53 Add missing NULL value to filter parameter array 636d849 Update memory allocation approach f0d1d38 Add new allocation functions 97d00a0 Fix writing of uninitialized data to logs e72c9b2 Merge branch 'release-2.0.0' into develop cf2b712 Merge branch 'release-2.0.0' into develop 8917c5c Change the logic behind valid list entry checks c10deff Improve documentation about version_string f59f1f7 Merge branch 'develop' of ssh://github.com/mariadb-corporation/maxscale-new into develop c88edb3 Backend authentication failure improvement abd5bee Revert "Backend authentication failure improvement" 5bb3107 Backend authentication failure improvement b7f434a Add new allocation functions 3f022fa Fix stupid mistake 99c4317 Merge remote-tracking branch 'origin/MXS-677' into develop 3c1ded6 Added connection/authentication failure error reporting in SHOW SLAVE STATUS 0a60f7b Tidy up and deal with review points. ba103ff blr_slave.c: Update strncpy usage 467331e blr_master.c: Strncpy usage updates d2b7c0c Merge remote-tracking branch 'origin/develop-nullauth-merge' into develop 5a8c1d0 qc: Measure execution time at the right place. bccdb93 Merge branch 'NullAuthDeny' into develop 2e6511c Add 5.5.5 prefix to all version strings that lack it 314655a Improve DCB and session initialization and list handling e1c43f0 MXS-655: Make MaxScale logging logrotate(8) compatible ce36afd MXS-626: Don't log a header unless maxlog enabled dcd47a7 blr_file.c: Replace uses of strncpy 6b8f576 bls_slave.c: Replace strncpy with memcpy 68a0039 Add list preallocation, tidy up, simplify init. cb37d1b Fix copyright etc headers. 11a400d Tidy; comment; fix bad copies and mistakes. 7e36ec4 Add list manager files. c4794e3 Initial code for list manager. 1b42e25 Merge remote-tracking branch 'origin/MXS-765' into develop d50f617 Fix problems, extend tests, respond to review. dcb4a91 Filter test folder removed 0b60dbe Add a couple of comments. 83cdba0 Fix overwriting problem. ba5d353 Fix overwriting problem. 53671cb Small fixes in response to review. 173d049 blr.c: Review strncpy usage 4ff6ef2 binlog_common.c: Replace strncpy with memcpy f238e03 maxbinlogcheck.s: Replace strncpy 9807f8d harness: Replace unnecessary use of strncpy 8c7fe6a avro: Modify strncpy usage 9b8008e Small improvements. b7f784f Fix mistakes in testqueuemanager.c cc26962 Restore missing poll.c code; add testqueuemanager.c. 2e91806 Format the filter harness 22059e6 Initial implementation connection queueing. c604dc2 readwritesplit.c: Improve COM_INIT_DB handling 454d920 schemarouter.c: Replace strncpy with strcpy 8e85d66 sharding_common.c: Too long a database name handled explicitly 77f4446 Astyle schemarouter 491f7c2 maxinfo.c: Replace strncpy with memcpy 6b98105 maxinfo: Reformat with astyle c1dbf08 Handle oversize user and database names 5fa4a0f Merge branch 'develop' of ssh://github.com/mariadb-corporation/maxscale-new into develop 706963b BLR_DBUSERS_TAIL new var in blr.h d75b9af Tweak comments, remove trailing blanks. ab2400a Optimise statistics gathering by inline & simpler fns. fb59ddc Remove unnecessary strncpy/strncat usage in Binlog Server bdcd551 resultset.c: Change strncpy to memcpy c6b1c5e Reject rather than cut too long a path 6d8f112 Remove unnecessary strncpy/strncat usage 18bf5ed Remove unnecessary strncpy usage dc0e2db Make maxpasswd more userfriendly c9c8695 Fix calculation of padded_len in encryptPassword 2cfd2c6 dbusers.c: Check strncpy usage 7ab9342 Make more thorough checks in secrets_readKeys be7d593 Format cli.c debugcli.c testroute.c webserver.c 1ee5efb config.c: Check usage of strncpy 3043b12 gq_utils.c: Unnecessary use of strncpy removed 77874ac Add help to maxkeys 38392a3 Update secrets_writeKeys documentation 2d1325c Make SSL optional in MaxScale's own communication bda00da Fix avro build failures b2cb31a Add more OOM macros 41ccf17 Fix strdup usage a48f732 Fix realloc calls 20771f6 Add forgotten extern "C" block 8faf35a Add maxscale allocation functions bb47890 Add macros for OOM logging afea388 Fix silly mistakes. 6dafd22 Make deny default for null auth; move code from common to auth.
366 lines
16 KiB
C
366 lines
16 KiB
C
#ifndef _DCB_H
|
|
#define _DCB_H
|
|
/*
|
|
* Copyright (c) 2016 MariaDB Corporation Ab
|
|
*
|
|
* Use of this software is governed by the Business Source License included
|
|
* in the LICENSE.TXT file and at www.mariadb.com/bsl.
|
|
*
|
|
* Change Date: 2019-07-01
|
|
*
|
|
* On the date above, in accordance with the Business Source License, use
|
|
* of this software will be governed by version 2 or later of the General
|
|
* Public License.
|
|
*/
|
|
#include <spinlock.h>
|
|
#include <buffer.h>
|
|
#include <listmanager.h>
|
|
#include <gw_protocol.h>
|
|
#include <gw_authenticator.h>
|
|
#include <gw_ssl.h>
|
|
#include <modinfo.h>
|
|
#include <gwbitmask.h>
|
|
#include <skygw_utils.h>
|
|
#include <netinet/in.h>
|
|
|
|
#define ERRHANDLE
|
|
|
|
struct session;
|
|
struct server;
|
|
struct service;
|
|
struct servlistener;
|
|
|
|
/**
|
|
* @file dcb.h The Descriptor Control Block
|
|
*
|
|
* The function pointer table used by descriptors to call relevant functions
|
|
* within the protocol specific code.
|
|
*
|
|
* @verbatim
|
|
* Revision History
|
|
*
|
|
* Date Who Description
|
|
* 01/06/2013 Mark Riddoch Initial implementation
|
|
* 11/06/2013 Mark Riddoch Updated GWPROTOCOL structure with new
|
|
* entry points
|
|
* 18/06/2013 Mark Riddoch Addition of the listener entry point
|
|
* 02/07/2013 Massimiliano Pinto Addition of delayqlock, delayq and authlock
|
|
* for handling backend asynchronous protocol connection
|
|
* and a generic lock for backend authentication
|
|
* 12/07/2013 Massimiliano Pinto Added auth entry point
|
|
* 15/07/2013 Massimiliano Pinto Added session entry point
|
|
* 16/07/2013 Massimiliano Pinto Added command type for dcb
|
|
* 07/02/2014 Massimiliano Pinto Added ipv4 data struct into for dcb
|
|
* 07/05/2014 Mark Riddoch Addition of callback mechanism
|
|
* 08/05/2014 Mark Riddoch Addition of writeq high and low watermarks
|
|
* 27/08/2014 Mark Riddoch Addition of write event queuing
|
|
* 23/09/2014 Mark Riddoch New poll processing queue
|
|
* 19/06/2015 Martin Brampton Provision of persistent connections
|
|
* 20/01/2016 Martin Brampton Moved GWPROTOCOL to gw_protocol.h
|
|
* 01/02/2016 Martin Brampton Added fields for SSL and authentication
|
|
* 27/06/2016 Martin Brampton Changed DCB to conform to list manager
|
|
*
|
|
* @endverbatim
|
|
*/
|
|
|
|
struct dcb;
|
|
|
|
/**
|
|
* The event queue structure used in the polling loop to maintain a queue
|
|
* of events that need to be processed for the DCB.
|
|
*
|
|
* next The next DCB in the event queue
|
|
* prev The previous DCB in the event queue
|
|
* pending_events The events that are pending processing
|
|
* processing_events The evets currently being processed
|
|
* processing Flag to indicate the processing status of the DCB
|
|
* eventqlock Spinlock to protect this structure
|
|
* inserted Insertion time for logging purposes
|
|
* started Time that the processign started
|
|
*/
|
|
typedef struct
|
|
{
|
|
struct dcb *next;
|
|
struct dcb *prev;
|
|
uint32_t pending_events;
|
|
uint32_t processing_events;
|
|
int processing;
|
|
SPINLOCK eventqlock;
|
|
unsigned long inserted;
|
|
unsigned long started;
|
|
} DCBEVENTQ;
|
|
|
|
#define DCBEVENTQ_INIT {NULL, NULL, 0, 0, 0, SPINLOCK_INIT, 0, 0}
|
|
|
|
#define DCBFD_CLOSED -1
|
|
|
|
/**
|
|
* The statistics gathered on a descriptor control block
|
|
*/
|
|
typedef struct dcbstats
|
|
{
|
|
int n_reads; /*< Number of reads on this descriptor */
|
|
int n_writes; /*< Number of writes on this descriptor */
|
|
int n_accepts; /*< Number of accepts on this descriptor */
|
|
int n_buffered; /*< Number of buffered writes */
|
|
int n_high_water; /*< Number of crosses of high water mark */
|
|
int n_low_water; /*< Number of crosses of low water mark */
|
|
} DCBSTATS;
|
|
|
|
#define DCBSTATS_INIT {0}
|
|
|
|
/**
|
|
* The data structure that is embedded witin a DCB and manages the complex memory
|
|
* management issues of a DCB.
|
|
*
|
|
* The DCB structures are used as the user data within the polling loop. This means that
|
|
* polling threads may aschronously wake up and access these structures. It is not possible
|
|
* to simple remove the DCB from the epoll system and then free the data, as every thread
|
|
* that is currently running an epoll call must wake up and re-issue the epoll_wait system
|
|
* call, the is the only way we can be sure that no polling thread is pending a wakeup or
|
|
* processing an event that will access the DCB.
|
|
*
|
|
* We solve this issue by making the dcb_free routine merely mark a DCB as a zombie and
|
|
* place it on a special zombie list. Before placing the DCB on the zombie list we create
|
|
* a bitmask with a bit set in it for each active polling thread. Each thread will call
|
|
* a routine to process the zombie list at the end of the polling loop. This routine
|
|
* will clear the bit value that corresponds to the calling thread. Once the bitmask
|
|
* is completely cleared the DCB can finally be freed and removed from the zombie list.
|
|
*/
|
|
typedef struct
|
|
{
|
|
GWBITMASK bitmask; /*< The bitmask of threads */
|
|
struct dcb *next; /*< Next pointer for the zombie list */
|
|
} DCBMM;
|
|
|
|
#define DCBMM_INIT {GWBITMASK_INIT}
|
|
|
|
/* DCB states */
|
|
typedef enum
|
|
{
|
|
DCB_STATE_UNDEFINED, /*< State variable with no state */
|
|
DCB_STATE_ALLOC, /*< Memory allocated but not populated */
|
|
DCB_STATE_POLLING, /*< Waiting in the poll loop */
|
|
DCB_STATE_WAITING, /*< Client wanting a connection */
|
|
DCB_STATE_LISTENING, /*< The DCB is for a listening socket */
|
|
DCB_STATE_DISCONNECTED, /*< The socket is now closed */
|
|
DCB_STATE_NOPOLLING, /*< Removed from poll mask */
|
|
DCB_STATE_ZOMBIE, /*< DCB is no longer active, waiting to free it */
|
|
} dcb_state_t;
|
|
|
|
typedef enum
|
|
{
|
|
DCB_ROLE_SERVICE_LISTENER, /*< Receives initial connect requests from clients */
|
|
DCB_ROLE_CLIENT_HANDLER, /*< Serves dedicated client */
|
|
DCB_ROLE_BACKEND_HANDLER, /*< Serves back end connection */
|
|
DCB_ROLE_INTERNAL /*< Internal DCB not connected to the outside */
|
|
} dcb_role_t;
|
|
|
|
/**
|
|
* Callback reasons for the DCB callback mechanism.
|
|
*/
|
|
typedef enum
|
|
{
|
|
DCB_REASON_CLOSE, /*< The DCB is closing */
|
|
DCB_REASON_DRAINED, /*< The write delay queue has drained */
|
|
DCB_REASON_HIGH_WATER, /*< Cross high water mark */
|
|
DCB_REASON_LOW_WATER, /*< Cross low water mark */
|
|
DCB_REASON_ERROR, /*< An error was flagged on the connection */
|
|
DCB_REASON_HUP, /*< A hangup was detected */
|
|
DCB_REASON_NOT_RESPONDING /*< Server connection was lost */
|
|
} DCB_REASON;
|
|
|
|
/**
|
|
* Callback structure - used to track callbacks registered on a DCB
|
|
*/
|
|
typedef struct dcb_callback
|
|
{
|
|
DCB_REASON reason; /*< The reason for the callback */
|
|
int (*cb)(struct dcb *dcb, DCB_REASON reason, void *userdata);
|
|
void *userdata; /*< User data to be sent in the callback */
|
|
struct dcb_callback *next; /*< Next callback for this DCB */
|
|
} DCB_CALLBACK;
|
|
|
|
/**
|
|
* State of SSL connection
|
|
*/
|
|
typedef enum
|
|
{
|
|
SSL_HANDSHAKE_UNKNOWN, /*< The DCB has unknown SSL status */
|
|
SSL_HANDSHAKE_REQUIRED, /*< SSL handshake is needed */
|
|
SSL_HANDSHAKE_DONE, /*< The SSL handshake completed OK */
|
|
SSL_ESTABLISHED, /*< The SSL connection is in use */
|
|
SSL_HANDSHAKE_FAILED /*< The SSL handshake failed */
|
|
} SSL_STATE;
|
|
|
|
/**
|
|
* Descriptor Control Block
|
|
*
|
|
* A wrapper for a network descriptor within the gateway, it contains all the
|
|
* state information necessary to allow for the implementation of the asynchronous
|
|
* operation of the protocol and gateway functions. It also provides links to the service
|
|
* and session data that is required to route the information within the gateway.
|
|
*
|
|
* It is important to hold the state information here such that any thread within the
|
|
* gateway may be selected to execute the required actions when a network event occurs.
|
|
*
|
|
* Note that the first few fields (up to and including "entry_is_ready") must
|
|
* precisely match the LIST_ENTRY structure defined in the list manager.
|
|
*/
|
|
typedef struct dcb
|
|
{
|
|
LIST_ENTRY_FIELDS
|
|
skygw_chk_t dcb_chk_top;
|
|
bool dcb_errhandle_called; /*< this can be called only once */
|
|
bool dcb_is_zombie; /**< Whether the DCB is in the zombie list */
|
|
bool draining_flag; /**< Set while write queue is drained */
|
|
bool drain_called_while_busy; /**< Set as described */
|
|
dcb_role_t dcb_role;
|
|
SPINLOCK dcb_initlock;
|
|
DCBEVENTQ evq; /**< The event queue for this DCB */
|
|
int fd; /**< The descriptor */
|
|
dcb_state_t state; /**< Current descriptor state */
|
|
SSL_STATE ssl_state; /**< Current state of SSL if in use */
|
|
int flags; /**< DCB flags */
|
|
char *remote; /**< Address of remote end */
|
|
char *user; /**< User name for connection */
|
|
struct sockaddr_in ipv4; /**< remote end IPv4 address */
|
|
char *protoname; /**< Name of the protocol */
|
|
void *protocol; /**< The protocol specific state */
|
|
size_t protocol_packet_length; /**< How long the protocol specific packet is */
|
|
size_t protocol_bytes_processed; /**< How many bytes of a packet have been read */
|
|
struct session *session; /**< The owning session */
|
|
struct servlistener *listener; /**< For a client DCB, the listener data */
|
|
GWPROTOCOL func; /**< The protocol functions for this descriptor */
|
|
GWAUTHENTICATOR authfunc; /**< The authenticator functions for this descriptor */
|
|
|
|
int writeqlen; /**< Current number of byes in the write queue */
|
|
SPINLOCK writeqlock; /**< Write Queue spinlock */
|
|
GWBUF *writeq; /**< Write Data Queue */
|
|
SPINLOCK delayqlock; /**< Delay Backend Write Queue spinlock */
|
|
GWBUF *delayq; /**< Delay Backend Write Data Queue */
|
|
GWBUF *dcb_readqueue; /**< read queue for storing incomplete reads */
|
|
SPINLOCK authlock; /**< Generic Authorization spinlock */
|
|
|
|
DCBSTATS stats; /**< DCB related statistics */
|
|
unsigned int dcb_server_status; /*< the server role indicator from SERVER */
|
|
struct dcb *nextpersistent; /**< Next DCB in the persistent pool for SERVER */
|
|
time_t persistentstart; /**< Time when DCB placed in persistent pool */
|
|
struct service *service; /**< The related service */
|
|
void *data; /**< Specific client data */
|
|
DCBMM memdata; /**< The data related to DCB memory management */
|
|
SPINLOCK cb_lock; /**< The lock for the callbacks linked list */
|
|
DCB_CALLBACK *callbacks; /**< The list of callbacks for the DCB */
|
|
SPINLOCK pollinlock;
|
|
int pollinbusy;
|
|
int readcheck;
|
|
|
|
SPINLOCK polloutlock;
|
|
int polloutbusy;
|
|
int writecheck;
|
|
long last_read; /*< Last time the DCB received data */
|
|
int high_water; /**< High water mark */
|
|
int low_water; /**< Low water mark */
|
|
struct server *server; /**< The associated backend server */
|
|
SSL* ssl; /*< SSL struct for connection */
|
|
bool ssl_read_want_read; /*< Flag */
|
|
bool ssl_read_want_write; /*< Flag */
|
|
bool ssl_write_want_read; /*< Flag */
|
|
bool ssl_write_want_write; /*< Flag */
|
|
int dcb_port; /**< port of target server */
|
|
skygw_chk_t dcb_chk_tail;
|
|
} DCB;
|
|
|
|
#define DCB_INIT {.dcb_chk_top = CHK_NUM_DCB, .dcb_initlock = SPINLOCK_INIT, \
|
|
.evq = DCBEVENTQ_INIT, .ipv4 = {0}, .func = {0}, .authfunc = {0}, \
|
|
.writeqlock = SPINLOCK_INIT, .delayqlock = SPINLOCK_INIT, \
|
|
.authlock = SPINLOCK_INIT, .stats = {0}, .memdata = DCBMM_INIT, \
|
|
.cb_lock = SPINLOCK_INIT, .pollinlock = SPINLOCK_INIT, \
|
|
.fd = DCBFD_CLOSED, .stats = DCBSTATS_INIT, .ssl_state = SSL_HANDSHAKE_UNKNOWN, \
|
|
.state = DCB_STATE_ALLOC, .polloutlock = SPINLOCK_INIT, .dcb_chk_tail = CHK_NUM_DCB}
|
|
|
|
/**
|
|
* The DCB usage filer used for returning DCB's in use for a certain reason
|
|
*/
|
|
typedef enum
|
|
{
|
|
DCB_USAGE_CLIENT,
|
|
DCB_USAGE_LISTENER,
|
|
DCB_USAGE_BACKEND,
|
|
DCB_USAGE_INTERNAL,
|
|
DCB_USAGE_ZOMBIE,
|
|
DCB_USAGE_ALL
|
|
} DCB_USAGE;
|
|
|
|
#if defined(FAKE_CODE)
|
|
unsigned char dcb_fake_write_errno[10240];
|
|
__int32_t dcb_fake_write_ev[10240];
|
|
bool fail_next_backend_fd;
|
|
bool fail_next_client_fd;
|
|
int fail_next_accept;
|
|
int fail_accept_errno;
|
|
#endif /* FAKE_CODE */
|
|
|
|
/* A few useful macros */
|
|
#define DCB_SESSION(x) (x)->session
|
|
#define DCB_PROTOCOL(x, type) (type *)((x)->protocol)
|
|
#define DCB_ISZOMBIE(x) ((x)->state == DCB_STATE_ZOMBIE)
|
|
#define DCB_WRITEQLEN(x) (x)->writeqlen
|
|
#define DCB_SET_LOW_WATER(x, lo) (x)->low_water = (lo);
|
|
#define DCB_SET_HIGH_WATER(x, hi) (x)->low_water = (hi);
|
|
#define DCB_BELOW_LOW_WATER(x) ((x)->low_water && (x)->writeqlen < (x)->low_water)
|
|
#define DCB_ABOVE_HIGH_WATER(x) ((x)->high_water && (x)->writeqlen > (x)->high_water)
|
|
|
|
#define DCB_POLL_BUSY(x) ((x)->evq.next != NULL)
|
|
|
|
DCB *dcb_get_zombies(void);
|
|
int dcb_write(DCB *, GWBUF *);
|
|
DCB *dcb_accept(DCB *listener, GWPROTOCOL *protocol_funcs);
|
|
bool dcb_pre_alloc(int number);
|
|
DCB *dcb_alloc(dcb_role_t, struct servlistener *);
|
|
void dcb_free(DCB *);
|
|
void dcb_free_all_memory(DCB *dcb);
|
|
DCB *dcb_connect(struct server *, struct session *, const char *);
|
|
DCB *dcb_clone(DCB *);
|
|
int dcb_read(DCB *, GWBUF **, int);
|
|
int dcb_drain_writeq(DCB *);
|
|
void dcb_close(DCB *);
|
|
DCB *dcb_process_zombies(int); /* Process Zombies except the one behind the pointer */
|
|
void printAllDCBs(); /* Debug to print all DCB in the system */
|
|
void printDCB(DCB *); /* Debug print routine */
|
|
void dprintDCBList(DCB *); /* Debug print DCB list statistics */
|
|
void dprintAllDCBs(DCB *); /* Debug to print all DCB in the system */
|
|
void dprintOneDCB(DCB *, DCB *); /* Debug to print one DCB */
|
|
void dprintDCB(DCB *, DCB *); /* Debug to print a DCB in the system */
|
|
void dListDCBs(DCB *); /* List all DCBs in the system */
|
|
void dListClients(DCB *); /* List al the client DCBs */
|
|
const char *gw_dcb_state2string(dcb_state_t); /* DCB state to string */
|
|
void dcb_printf(DCB *, const char *, ...) __attribute__((format(printf, 2, 3))); /* DCB version of printf */
|
|
void dcb_hashtable_stats(DCB *, void *); /**< Print statisitics */
|
|
int dcb_add_callback(DCB *, DCB_REASON, int (*)(struct dcb *, DCB_REASON, void *), void *);
|
|
int dcb_remove_callback(DCB *, DCB_REASON, int (*)(struct dcb *, DCB_REASON, void *), void *);
|
|
int dcb_isvalid(DCB *); /* Check the DCB is in the linked list */
|
|
int dcb_count_by_usage(DCB_USAGE); /* Return counts of DCBs */
|
|
int dcb_persistent_clean_count(DCB *, bool); /* Clean persistent and return count */
|
|
|
|
void dcb_call_foreach (struct server* server, DCB_REASON reason);
|
|
void dcb_hangup_foreach (struct server* server);
|
|
size_t dcb_get_session_id(DCB* dcb);
|
|
bool dcb_get_ses_log_info(DCB* dcb, size_t* sesid, int* enabled_logs);
|
|
char *dcb_role_name(DCB *); /* Return the name of a role */
|
|
int dcb_accept_SSL(DCB* dcb);
|
|
int dcb_connect_SSL(DCB* dcb);
|
|
int dcb_listen(DCB *listener, const char *config, const char *protocol_name);
|
|
void dcb_append_readqueue(DCB *dcb, GWBUF *buffer);
|
|
|
|
/**
|
|
* DCB flags values
|
|
*/
|
|
#define DCBF_CLONE 0x0001 /*< DCB is a clone */
|
|
#define DCBF_HUNG 0x0002 /*< Hangup has been dispatched */
|
|
#define DCBF_REPLIED 0x0004 /*< DCB was written to */
|
|
|
|
#define DCB_IS_CLONE(d) ((d)->flags & DCBF_CLONE)
|
|
#define DCB_REPLIED(d) ((d)->flags & DCBF_REPLIED)
|
|
#endif /* _DCB_H */
|