Format all sources with Uncrustify

Formatted all sources and manually tuned some files to make the code look
neater.
This commit is contained in:
Markus Mäkelä
2018-09-10 12:40:03 +03:00
parent edd5ddcc88
commit d11c78ad80
183 changed files with 1865 additions and 1695 deletions

View File

@ -171,40 +171,40 @@ typedef enum
((s) == MXS_AUTH_STATE_INIT ? "MXS_AUTH_STATE_INIT" \
: ((s) == MXS_AUTH_STATE_PENDING_CONNECT ? "MXS_AUTH_STATE_PENDING_CONNECT" \
: ((s) \
== MXS_AUTH_STATE_CONNECTED ? \
"MXS_AUTH_STATE_CONNECTED" \
: (( \
s) \
== \
MXS_AUTH_STATE_MESSAGE_READ \
? \
"MXS_AUTH_STATE_MESSAGE_READ" \
: (( \
s) \
== \
MXS_AUTH_STATE_RESPONSE_SENT \
? \
"MXS_AUTH_STATE_RESPONSE_SENT" \
: (( \
s) \
== \
MXS_AUTH_STATE_FAILED \
? \
"MXS_AUTH_STATE_FAILED" \
: (( \
s) \
== \
MXS_AUTH_STATE_HANDSHAKE_FAILED \
? \
"MXS_AUTH_STATE_HANDSHAKE_FAILED" \
: (( \
s) \
== \
MXS_AUTH_STATE_COMPLETE \
? \
"MXS_AUTH_STATE_COMPLETE" \
: \
"UNKNOWN AUTH STATE"))))))))
== MXS_AUTH_STATE_CONNECTED \
? "MXS_AUTH_STATE_CONNECTED" \
: (( \
s) \
== \
MXS_AUTH_STATE_MESSAGE_READ \
? \
"MXS_AUTH_STATE_MESSAGE_READ" \
: (( \
s) \
== \
MXS_AUTH_STATE_RESPONSE_SENT \
? \
"MXS_AUTH_STATE_RESPONSE_SENT" \
: (( \
s) \
== \
MXS_AUTH_STATE_FAILED \
? \
"MXS_AUTH_STATE_FAILED" \
: (( \
s) \
== \
MXS_AUTH_STATE_HANDSHAKE_FAILED \
? \
"MXS_AUTH_STATE_HANDSHAKE_FAILED" \
: (( \
s) \
== \
MXS_AUTH_STATE_COMPLETE \
? \
"MXS_AUTH_STATE_COMPLETE" \
: \
"UNKNOWN AUTH STATE"))))))))
/**
* The MXS_AUTHENTICATOR version data. The following should be updated whenever

View File

@ -242,53 +242,53 @@ typedef struct config_context
*/
typedef struct
{
bool config_check; /**< Only check config */
int n_threads; /**< Number of polling threads */
size_t thread_stack_size; /**< The stack size of each worker thread */
char* version_string; /**< The version string of embedded db library */
char release_string[RELEASE_STR_LENGTH]; /**< The release name string of the system */
char sysname[SYSNAME_LEN]; /**< The OS name of the system */
uint8_t mac_sha1[SHA_DIGEST_LENGTH]; /**< The SHA1 digest of an interface MAC address
* */
unsigned int n_nbpoll; /**< Tune number of non-blocking polls */
unsigned int pollsleep; /**< Wait time in blocking polls */
int syslog; /**< Log to syslog */
int maxlog; /**< Log to MaxScale's own logs */
unsigned int auth_conn_timeout; /**< Connection timeout for the user
* authentication */
unsigned int auth_read_timeout; /**< Read timeout for the user authentication */
unsigned int auth_write_timeout; /**< Write timeout for the user authentication */
bool skip_permission_checks; /**< Skip service and monitor permission checks */
int32_t passive; /**< True if MaxScale is in passive mode */
int64_t promoted_at; /**< Time when this Maxscale instance was
* promoted from a passive to an active */
char qc_name[PATH_MAX]; /**< The name of the query classifier to load */
char* qc_args; /**< Arguments for the query classifier */
QC_CACHE_PROPERTIES qc_cache_properties; /**< The query classifier cache properties. */
qc_sql_mode_t qc_sql_mode; /**< The query classifier sql mode */
char admin_host[MAX_ADMIN_HOST_LEN]; /**< Admin interface host */
uint16_t admin_port; /**< Admin interface port */
bool admin_auth; /**< Admin interface authentication */
bool admin_enabled; /**< Admin interface is enabled */
bool admin_log_auth_failures; /**< Log admin interface authentication failures
* */
char admin_ssl_key[PATH_MAX]; /**< Admin SSL key */
char admin_ssl_cert[PATH_MAX]; /**< Admin SSL cert */
char admin_ssl_ca_cert[PATH_MAX]; /**< Admin SSL CA cert */
int query_retries; /**< Number of times a interrupted query is
* retried */
time_t query_retry_timeout; /**< Timeout for query retries */
bool substitute_variables; /**< Should environment variables be substituted
* */
char* local_address; /**< Local address to use when connecting */
time_t users_refresh_time; /**< How often the users can be refreshed */
uint64_t writeq_high_water; /**< High water mark of dcb write queue */
uint64_t writeq_low_water; /**< Low water mark of dcb write queue */
char peer_hosts[MAX_ADMIN_HOST_LEN]; /**< The protocol, address and port for peers
* (currently only one) */
char peer_user[MAX_ADMIN_HOST_LEN]; /**< Username for maxscale-to-maxscale traffic */
char peer_password[MAX_ADMIN_HOST_LEN]; /**< Password for maxscale-to-maxscale traffic */
mxb_log_target_t log_target; /**< Log type */
bool config_check; /**< Only check config */
int n_threads; /**< Number of polling threads */
size_t thread_stack_size; /**< The stack size of each worker thread */
char* version_string; /**< The version string of embedded db library */
char release_string[RELEASE_STR_LENGTH]; /**< The release name string of the system */
char sysname[SYSNAME_LEN]; /**< The OS name of the system */
uint8_t mac_sha1[SHA_DIGEST_LENGTH]; /**< The SHA1 digest of an interface MAC address
* */
unsigned int n_nbpoll; /**< Tune number of non-blocking polls */
unsigned int pollsleep; /**< Wait time in blocking polls */
int syslog; /**< Log to syslog */
int maxlog; /**< Log to MaxScale's own logs */
unsigned int auth_conn_timeout; /**< Connection timeout for the user
* authentication */
unsigned int auth_read_timeout; /**< Read timeout for the user authentication */
unsigned int auth_write_timeout; /**< Write timeout for the user authentication */
bool skip_permission_checks; /**< Skip service and monitor permission checks */
int32_t passive; /**< True if MaxScale is in passive mode */
int64_t promoted_at; /**< Time when this Maxscale instance was
* promoted from a passive to an active */
char qc_name[PATH_MAX]; /**< The name of the query classifier to load */
char* qc_args; /**< Arguments for the query classifier */
QC_CACHE_PROPERTIES qc_cache_properties; /**< The query classifier cache properties. */
qc_sql_mode_t qc_sql_mode; /**< The query classifier sql mode */
char admin_host[MAX_ADMIN_HOST_LEN]; /**< Admin interface host */
uint16_t admin_port; /**< Admin interface port */
bool admin_auth; /**< Admin interface authentication */
bool admin_enabled; /**< Admin interface is enabled */
bool admin_log_auth_failures; /**< Log admin interface authentication failures
* */
char admin_ssl_key[PATH_MAX]; /**< Admin SSL key */
char admin_ssl_cert[PATH_MAX]; /**< Admin SSL cert */
char admin_ssl_ca_cert[PATH_MAX]; /**< Admin SSL CA cert */
int query_retries; /**< Number of times a interrupted query is
* retried */
time_t query_retry_timeout; /**< Timeout for query retries */
bool substitute_variables; /**< Should environment variables be substituted
* */
char* local_address; /**< Local address to use when connecting */
time_t users_refresh_time; /**< How often the users can be refreshed */
uint64_t writeq_high_water; /**< High water mark of dcb write queue */
uint64_t writeq_low_water; /**< Low water mark of dcb write queue */
char peer_hosts[MAX_ADMIN_HOST_LEN]; /**< The protocol, address and port for peers
* (currently only one) */
char peer_user[MAX_ADMIN_HOST_LEN]; /**< Username for maxscale-to-maxscale traffic */
char peer_password[MAX_ADMIN_HOST_LEN]; /**< Password for maxscale-to-maxscale traffic */
mxb_log_target_t log_target; /**< Log type */
} MXS_CONFIG;
/**

View File

@ -102,16 +102,16 @@ typedef enum
((r) == DCB_ROLE_SERVICE_LISTENER ? "DCB_ROLE_SERVICE_LISTENER" \
: ((r) == DCB_ROLE_CLIENT_HANDLER ? "DCB_ROLE_CLIENT_HANDLER" \
: ((r) \
== DCB_ROLE_BACKEND_HANDLER ? \
"DCB_ROLE_BACKEND_HANDLER" \
: (( \
r) \
== \
DCB_ROLE_INTERNAL \
? \
"DCB_ROLE_INTERNAL" \
: \
"UNKNOWN DCB ROLE"))))
== DCB_ROLE_BACKEND_HANDLER \
? "DCB_ROLE_BACKEND_HANDLER" \
: (( \
r) \
== \
DCB_ROLE_INTERNAL \
? \
"DCB_ROLE_INTERNAL" \
: \
"UNKNOWN DCB ROLE"))))
#define DCB_STRTYPE(dcb) \
(dcb->dcb_role == DCB_ROLE_CLIENT_HANDLER ? "Client DCB" \
@ -193,14 +193,14 @@ typedef struct dcb
MXS_PROTOCOL func; /**< The protocol functions for this descriptor */
MXS_AUTHENTICATOR authfunc; /**< The authenticator functions for this descriptor
* */
uint32_t writeqlen; /**< Current number of byes in the write queue */
uint32_t high_water; /**< High water mark of write queue */
uint32_t low_water; /**< Low water mark of write queue */
GWBUF* writeq; /**< Write Data Queue */
GWBUF* delayq; /**< Delay Backend Write Data Queue */
GWBUF* readq; /**< Read queue for storing incomplete reads */
GWBUF* fakeq; /**< Fake event queue for generated events */
uint32_t fake_event; /**< Fake event to be delivered to handler */
uint32_t writeqlen; /**< Current number of byes in the write queue */
uint32_t high_water; /**< High water mark of write queue */
uint32_t low_water; /**< Low water mark of write queue */
GWBUF* writeq; /**< Write Data Queue */
GWBUF* delayq; /**< Delay Backend Write Data Queue */
GWBUF* readq; /**< Read queue for storing incomplete reads */
GWBUF* fakeq; /**< Fake event queue for generated events */
uint32_t fake_event; /**< Fake event to be delivered to handler */
DCBSTATS stats; /**< DCB related statistics */
struct dcb* nextpersistent; /**< Next DCB in the persistent pool for SERVER */

View File

@ -88,7 +88,7 @@ typedef struct mxs_filter_object
*
* @return New filter instance on NULL on error
*/
MXS_FILTER*(*createInstance)(const char* name, MXS_CONFIG_PARAMETER* params);
MXS_FILTER*(*createInstance)(const char* name, MXS_CONFIG_PARAMETER * params);
/**
* Called to create a new user session within the filter
@ -103,7 +103,7 @@ typedef struct mxs_filter_object
*
* @return New filter session or NULL on error
*/
MXS_FILTER_SESSION*(*newSession)(MXS_FILTER * instance, MXS_SESSION* session);
MXS_FILTER_SESSION*(*newSession)(MXS_FILTER * instance, MXS_SESSION * session);
/**
* @brief Called when a session is closed
@ -113,7 +113,7 @@ typedef struct mxs_filter_object
* @param instance Filter instance
* @param fsession Filter session
*/
void (* closeSession)(MXS_FILTER* instance, MXS_FILTER_SESSION* fsession);
void (* closeSession)(MXS_FILTER * instance, MXS_FILTER_SESSION * fsession);
/**
* @brief Called when a session is freed
@ -123,7 +123,7 @@ typedef struct mxs_filter_object
* @param instance Filter instance
* @param fsession Filter session
*/
void (* freeSession)(MXS_FILTER* instance, MXS_FILTER_SESSION* fsession);
void (* freeSession)(MXS_FILTER * instance, MXS_FILTER_SESSION * fsession);
/**
* @brief Sets the downstream component of the filter pipeline
@ -131,7 +131,7 @@ typedef struct mxs_filter_object
* @param instance Filter instance
* @param fsession Filter session
*/
void (* setDownstream)(MXS_FILTER* instance, MXS_FILTER_SESSION* fsession, MXS_DOWNSTREAM* downstream);
void (* setDownstream)(MXS_FILTER * instance, MXS_FILTER_SESSION * fsession, MXS_DOWNSTREAM * downstream);
/**
* @brief Sets the upstream component of the filter pipeline
@ -139,7 +139,7 @@ typedef struct mxs_filter_object
* @param instance Filter instance
* @param fsession Filter session
*/
void (* setUpstream)(MXS_FILTER* instance, MXS_FILTER_SESSION* fsession, MXS_UPSTREAM* downstream);
void (* setUpstream)(MXS_FILTER * instance, MXS_FILTER_SESSION * fsession, MXS_UPSTREAM * downstream);
/**
* @brief Called on each query that requires routing
@ -176,7 +176,7 @@ typedef struct mxs_filter_object
* @param fsession Filter session, NULL if general information about the filter is queried
* @param dcb DCB where the diagnostic information should be written
*/
void (* diagnostics)(MXS_FILTER* instance, MXS_FILTER_SESSION* fsession, DCB* dcb);
void (* diagnostics)(MXS_FILTER * instance, MXS_FILTER_SESSION * fsession, DCB * dcb);
/**
* @brief Called for diagnostic output
@ -188,7 +188,7 @@ typedef struct mxs_filter_object
*
* @see jansson.h
*/
json_t* (*diagnostics_json)(const MXS_FILTER * instance, const MXS_FILTER_SESSION* fsession);
json_t* (*diagnostics_json)(const MXS_FILTER * instance, const MXS_FILTER_SESSION * fsession);
/**
* @brief Called to obtain the capabilities of the filter
@ -204,7 +204,7 @@ typedef struct mxs_filter_object
*
* @param instance Filter instance
*/
void (* destroyInstance)(MXS_FILTER* instance);
void (* destroyInstance)(MXS_FILTER * instance);
} MXS_FILTER_OBJECT;
/**

View File

@ -38,33 +38,33 @@ typedef enum
(t == HINT_ROUTE_TO_MASTER ? "HINT_ROUTE_TO_MASTER" \
: ((t) == HINT_ROUTE_TO_SLAVE ? "HINT_ROUTE_TO_SLAVE" \
: ((t) \
== HINT_ROUTE_TO_NAMED_SERVER ? \
"HINT_ROUTE_TO_NAMED_SERVER" \
: ((t) \
== \
HINT_ROUTE_TO_UPTODATE_SERVER \
? \
"HINT_ROUTE_TO_UPTODATE_SERVER" \
: (( \
t) \
== \
HINT_ROUTE_TO_ALL \
? \
"HINT_ROUTE_TO_ALL" \
: (( \
t) \
== \
HINT_ROUTE_TO_LAST_USED \
? \
"HINT_ROUTE_TO_LAST_USED" \
: (( \
t) \
== \
HINT_PARAMETER \
? \
"HINT_PARAMETER" \
: \
"UNKNOWN HINT TYPE")))))))
== HINT_ROUTE_TO_NAMED_SERVER \
? "HINT_ROUTE_TO_NAMED_SERVER" \
: ((t) \
== \
HINT_ROUTE_TO_UPTODATE_SERVER \
? \
"HINT_ROUTE_TO_UPTODATE_SERVER" \
: (( \
t) \
== \
HINT_ROUTE_TO_ALL \
? \
"HINT_ROUTE_TO_ALL" \
: (( \
t) \
== \
HINT_ROUTE_TO_LAST_USED \
? \
"HINT_ROUTE_TO_LAST_USED" \
: (( \
t) \
== \
HINT_PARAMETER \
? \
"HINT_PARAMETER" \
: \
"UNKNOWN HINT TYPE")))))))
/**
* A generic hint.

View File

@ -34,18 +34,18 @@ struct service;
*/
typedef struct servlistener
{
char* name; /**< Name of the listener */
char* protocol; /**< Protocol module to load */
unsigned short port; /**< Port to listen on */
char* address; /**< Address to listen with */
char* authenticator;/**< Name of authenticator */
char* auth_options; /**< Authenticator options */
void* auth_instance;/**< Authenticator instance created in MXS_AUTHENTICATOR::initialize()
* */
SSL_LISTENER* ssl; /**< Structure of SSL data or NULL */
struct dcb* listener; /**< The DCB for the listener */
struct users* users; /**< The user data for this listener */
struct service* service; /**< The service which used by this listener */
char* name; /**< Name of the listener */
char* protocol; /**< Protocol module to load */
unsigned short port; /**< Port to listen on */
char* address; /**< Address to listen with */
char* authenticator; /**< Name of authenticator */
char* auth_options; /**< Authenticator options */
void* auth_instance; /**< Authenticator instance created in MXS_AUTHENTICATOR::initialize()
* */
SSL_LISTENER* ssl; /**< Structure of SSL data or NULL */
struct dcb* listener; /**< The DCB for the listener */
struct users* users; /**< The user data for this listener */
struct service* service; /**< The service which used by this listener */
SPINLOCK lock;
int active; /**< True if the port has not been deleted */
struct servlistener* next; /**< Next service protocol */

View File

@ -128,8 +128,8 @@ typedef struct mxs_module_param
enum mxs_module_param_type type; /**< Type of the parameter */
const char* default_value; /**< Default value for the parameter, NULL for no default
* value */
uint64_t options; /**< Parameter options */
const MXS_ENUM_VALUE* accepted_values; /**< Only for enum values */
uint64_t options; /**< Parameter options */
const MXS_ENUM_VALUE* accepted_values; /**< Only for enum values */
} MXS_MODULE_PARAM;
/** Maximum number of parameters that modules can declare */

View File

@ -90,7 +90,7 @@ typedef struct mxs_monitor_api
*
* @param monitor The monitor object.
*/
void (* destroyInstance)(MXS_MONITOR_INSTANCE* monitor);
void (* destroyInstance)(MXS_MONITOR_INSTANCE * monitor);
/**
* @brief Start the monitor
@ -104,8 +104,8 @@ typedef struct mxs_monitor_api
*
* @return True, if the monitor could be started, false otherwise.
*/
bool (* startMonitor)(MXS_MONITOR_INSTANCE* monitor,
const MXS_CONFIG_PARAMETER* params);
bool (* startMonitor)(MXS_MONITOR_INSTANCE * monitor,
const MXS_CONFIG_PARAMETER * params);
/**
* @brief Stop the monitor
@ -115,7 +115,7 @@ typedef struct mxs_monitor_api
*
* @param monitor The monitor object
*/
void (* stopMonitor)(MXS_MONITOR_INSTANCE* monitor);
void (* stopMonitor)(MXS_MONITOR_INSTANCE * monitor);
/**
* @brief Write diagnostic information to a DCB.
@ -123,7 +123,7 @@ typedef struct mxs_monitor_api
* @param monitor The monitor object.
* @param dcb The dcb to write to.
*/
void (* diagnostics)(const MXS_MONITOR_INSTANCE* monitor, DCB* dcb);
void (* diagnostics)(const MXS_MONITOR_INSTANCE * monitor, DCB * dcb);
/**
* @brief Return diagnostic information about the monitor
@ -244,20 +244,20 @@ struct mxs_monitor
int connect_attempts; /**< How many times a connection is attempted */
int read_timeout; /**< Timeout in seconds to read from the server.
* There are retries and the total effective
*timeout
* timeout
* value is three times the option value.
*/
int write_timeout; /**< Timeout in seconds for each attempt to write
* to the server.
* There are retries and the total effective
*timeout value is
* timeout value is
* two times the option value.
*/
MXS_MONITOR_API* api; /**< The monitor api */
char* module_name; /**< Name of the monitor module */
MXS_MONITOR_INSTANCE* instance; /**< Instance returned from startMonitor */
size_t interval; /**< The monitor interval */
int check_maintenance_flag; /**< Set when admin requests a maintenance status
MXS_MONITOR_API* api; /**< The monitor api */
char* module_name; /**< Name of the monitor module */
MXS_MONITOR_INSTANCE* instance; /**< Instance returned from startMonitor */
size_t interval; /**< The monitor interval */
int check_maintenance_flag; /**< Set when admin requests a maintenance status
* change. */
bool active; /**< True if monitor is active */
time_t journal_max_age; /**< Maximum age of journal file */
@ -268,8 +268,8 @@ struct mxs_monitor
MxsDiskSpaceThreshold* disk_space_threshold; /**< Disk space thresholds */
int64_t disk_space_check_interval; /**< How often should a disk space check be made
* at most. */
uint64_t ticks; /**< Number of performed monitoring intervals */
struct mxs_monitor* next; /**< Next monitor in the linked list */
uint64_t ticks; /**< Number of performed monitoring intervals */
struct mxs_monitor* next; /**< Next monitor in the linked list */
};
/**

View File

@ -219,37 +219,37 @@ typedef enum
GW_MYSQL_CAPABILITIES_SSL_VERIFY_SERVER_CERT = (1 << 30),
GW_MYSQL_CAPABILITIES_REMEMBER_OPTIONS = (1 << 31),
GW_MYSQL_CAPABILITIES_CLIENT = (
GW_MYSQL_CAPABILITIES_CLIENT_MYSQL
| GW_MYSQL_CAPABILITIES_FOUND_ROWS
| GW_MYSQL_CAPABILITIES_LONG_FLAG
| GW_MYSQL_CAPABILITIES_CONNECT_WITH_DB
| GW_MYSQL_CAPABILITIES_LOCAL_FILES
| GW_MYSQL_CAPABILITIES_PLUGIN_AUTH
| GW_MYSQL_CAPABILITIES_TRANSACTIONS
| GW_MYSQL_CAPABILITIES_PROTOCOL_41
| GW_MYSQL_CAPABILITIES_MULTI_STATEMENTS
| GW_MYSQL_CAPABILITIES_MULTI_RESULTS
| GW_MYSQL_CAPABILITIES_PS_MULTI_RESULTS
| GW_MYSQL_CAPABILITIES_SECURE_CONNECTION),
GW_MYSQL_CAPABILITIES_CLIENT_MYSQL
| GW_MYSQL_CAPABILITIES_FOUND_ROWS
| GW_MYSQL_CAPABILITIES_LONG_FLAG
| GW_MYSQL_CAPABILITIES_CONNECT_WITH_DB
| GW_MYSQL_CAPABILITIES_LOCAL_FILES
| GW_MYSQL_CAPABILITIES_PLUGIN_AUTH
| GW_MYSQL_CAPABILITIES_TRANSACTIONS
| GW_MYSQL_CAPABILITIES_PROTOCOL_41
| GW_MYSQL_CAPABILITIES_MULTI_STATEMENTS
| GW_MYSQL_CAPABILITIES_MULTI_RESULTS
| GW_MYSQL_CAPABILITIES_PS_MULTI_RESULTS
| GW_MYSQL_CAPABILITIES_SECURE_CONNECTION),
GW_MYSQL_CAPABILITIES_SERVER = (
GW_MYSQL_CAPABILITIES_CLIENT_MYSQL
| GW_MYSQL_CAPABILITIES_FOUND_ROWS
| GW_MYSQL_CAPABILITIES_LONG_FLAG
| GW_MYSQL_CAPABILITIES_CONNECT_WITH_DB
| GW_MYSQL_CAPABILITIES_NO_SCHEMA
| GW_MYSQL_CAPABILITIES_ODBC
| GW_MYSQL_CAPABILITIES_LOCAL_FILES
| GW_MYSQL_CAPABILITIES_IGNORE_SPACE
| GW_MYSQL_CAPABILITIES_PROTOCOL_41
| GW_MYSQL_CAPABILITIES_INTERACTIVE
| GW_MYSQL_CAPABILITIES_IGNORE_SIGPIPE
| GW_MYSQL_CAPABILITIES_TRANSACTIONS
| GW_MYSQL_CAPABILITIES_RESERVED
| GW_MYSQL_CAPABILITIES_SECURE_CONNECTION
| GW_MYSQL_CAPABILITIES_MULTI_STATEMENTS
| GW_MYSQL_CAPABILITIES_MULTI_RESULTS
| GW_MYSQL_CAPABILITIES_PS_MULTI_RESULTS
| GW_MYSQL_CAPABILITIES_PLUGIN_AUTH),
GW_MYSQL_CAPABILITIES_CLIENT_MYSQL
| GW_MYSQL_CAPABILITIES_FOUND_ROWS
| GW_MYSQL_CAPABILITIES_LONG_FLAG
| GW_MYSQL_CAPABILITIES_CONNECT_WITH_DB
| GW_MYSQL_CAPABILITIES_NO_SCHEMA
| GW_MYSQL_CAPABILITIES_ODBC
| GW_MYSQL_CAPABILITIES_LOCAL_FILES
| GW_MYSQL_CAPABILITIES_IGNORE_SPACE
| GW_MYSQL_CAPABILITIES_PROTOCOL_41
| GW_MYSQL_CAPABILITIES_INTERACTIVE
| GW_MYSQL_CAPABILITIES_IGNORE_SIGPIPE
| GW_MYSQL_CAPABILITIES_TRANSACTIONS
| GW_MYSQL_CAPABILITIES_RESERVED
| GW_MYSQL_CAPABILITIES_SECURE_CONNECTION
| GW_MYSQL_CAPABILITIES_MULTI_STATEMENTS
| GW_MYSQL_CAPABILITIES_MULTI_RESULTS
| GW_MYSQL_CAPABILITIES_PS_MULTI_RESULTS
| GW_MYSQL_CAPABILITIES_PLUGIN_AUTH),
} gw_mysql_capabilities_t;
/**
@ -332,10 +332,10 @@ typedef struct
GWBUF* stored_query; /*< Temporarily stored queries */
bool collect_result; /*< Collect the next result set as one buffer */
bool changing_user;
uint32_t num_eof_packets; /*< Encountered eof packet number, used for check
* packet type */
bool large_query; /*< Whether to ignore the command byte of the next
* packet*/
uint32_t num_eof_packets; /*< Encountered eof packet number, used for check
* packet type */
bool large_query; /*< Whether to ignore the command byte of the next
* packet*/
} MySQLProtocol;
typedef struct

View File

@ -94,7 +94,7 @@ typedef struct mxs_router_object
*
* @return New router instance on NULL on error
*/
MXS_ROUTER*(*createInstance)(SERVICE * service, MXS_CONFIG_PARAMETER* params);
MXS_ROUTER*(*createInstance)(SERVICE * service, MXS_CONFIG_PARAMETER * params);
/**
* Called to create a new user session within the router
@ -109,7 +109,7 @@ typedef struct mxs_router_object
*
* @return New router session or NULL on error
*/
MXS_ROUTER_SESSION*(*newSession)(MXS_ROUTER * instance, MXS_SESSION* session);
MXS_ROUTER_SESSION*(*newSession)(MXS_ROUTER * instance, MXS_SESSION * session);
/**
* @brief Called when a session is closed
@ -119,7 +119,7 @@ typedef struct mxs_router_object
* @param instance Router instance
* @param router_session Router session
*/
void (* closeSession)(MXS_ROUTER* instance, MXS_ROUTER_SESSION* router_session);
void (* closeSession)(MXS_ROUTER * instance, MXS_ROUTER_SESSION * router_session);
/**
* @brief Called when a session is freed
@ -129,7 +129,7 @@ typedef struct mxs_router_object
* @param instance Router instance
* @param router_session Router session
*/
void (* freeSession)(MXS_ROUTER* instance, MXS_ROUTER_SESSION* router_session);
void (* freeSession)(MXS_ROUTER * instance, MXS_ROUTER_SESSION * router_session);
/**
* @brief Called on each query that requires routing
@ -152,7 +152,7 @@ typedef struct mxs_router_object
* @param instance Router instance
* @param dcb DCB where the diagnostic information should be written
*/
void (* diagnostics)(MXS_ROUTER* instance, DCB* dcb);
void (* diagnostics)(MXS_ROUTER * instance, DCB * dcb);
/**
* @brief Called for diagnostic output
@ -175,10 +175,10 @@ typedef struct mxs_router_object
* @param queue Response from the server
* @param backend_dcb The backend DCB which responded to the query
*/
void (* clientReply)(MXS_ROUTER* instance,
MXS_ROUTER_SESSION* router_session,
GWBUF* queue,
DCB* backend_dcb);
void (* clientReply)(MXS_ROUTER * instance,
MXS_ROUTER_SESSION * router_session,
GWBUF * queue,
DCB * backend_dcb);
/**
* @brief Called when a backend DCB has failed
@ -191,10 +191,10 @@ typedef struct mxs_router_object
*
* @param succp Pointer to a `bool` which should be set to true for success or false for error
*/
void (* handleError)(MXS_ROUTER* instance,
MXS_ROUTER_SESSION* router_session,
GWBUF* errmsgbuf,
DCB* backend_dcb,
void (* handleError)(MXS_ROUTER * instance,
MXS_ROUTER_SESSION * router_session,
GWBUF * errmsgbuf,
DCB * backend_dcb,
mxs_error_action_t action,
bool* succp);
@ -212,7 +212,7 @@ typedef struct mxs_router_object
*
* @param instance Router instance
*/
void (* destroyInstance)(MXS_ROUTER* instance);
void (* destroyInstance)(MXS_ROUTER * instance);
/**
* @brief Configure router instance at runtime
@ -233,7 +233,7 @@ typedef struct mxs_router_object
* failed. If reconfiguration failed, the state of the router
* instance should not be modified.
*/
bool (* configureInstance)(MXS_ROUTER* instance, MXS_CONFIG_PARAMETER* params);
bool (* configureInstance)(MXS_ROUTER * instance, MXS_CONFIG_PARAMETER * params);
} MXS_ROUTER_OBJECT;
/**

View File

@ -195,26 +195,21 @@ typedef struct server
: (server_is_ndb(s) \
? "RUNNING NDB" \
: (( \
server_is_running( \
s) \
server_is_running(s) \
&& \
server_is_in_maint( \
s)) \
server_is_in_maint(s)) \
? \
"RUNNING MAINTENANCE" \
: ( \
server_is_relay( \
s) \
server_is_relay(s) \
? \
"RUNNING RELAY" \
: ( \
server_is_usable( \
s) \
server_is_usable(s) \
? \
"RUNNING (only)" \
: ( \
server_is_down( \
s) \
server_is_down(s) \
? \
"DOWN" \
: \
@ -524,7 +519,7 @@ extern void dprintServer(DCB*, const SERVER*);
extern void dprintPersistentDCBs(DCB*, const SERVER*);
extern void dListServers(DCB*);
int server_response_time_num_samples(const SERVER* server);
int server_response_time_num_samples(const SERVER* server);
double server_response_time_average(const SERVER* server);
MXS_END_DECLS

View File

@ -32,7 +32,7 @@ bool server_clear_status(SERVER* server, int bit, std::string* errmsg_out = NULL
*/
inline bool almost_equal_server_scores(double lhs, double rhs)
{
constexpr double div = 100; // within 1% of each other.
constexpr double div = 100; // within 1% of each other.
return std::abs((long)(lhs - rhs)) < std::abs((long)std::max(lhs, rhs)) * (1 / div);
}
}

View File

@ -100,57 +100,57 @@ typedef struct server_ref_t
*/
typedef struct service
{
const char* name; /**< The service name */
int state; /**< The service state */
int client_count; /**< Number of connected clients */
int max_connections; /**< Maximum client connections */
SERV_LISTENER* ports; /**< Linked list of ports and
* protocols
* that this service will listen on */
const char* routerModule; /**< Name of router module to use */
struct mxs_router_object* router; /**< The router we are using */
struct mxs_router* router_instance; /**< The router instance for this
* service */
char version_string[MAX_SERVICE_VERSION_LEN]; /**< version string for this service
* listeners */
SERVER_REF* dbref; /**< server references */
int n_dbref; /**< Number of server references */
char user[MAX_SERVICE_USER_LEN]; /**< The user name to use to extract
* information */
char password[MAX_SERVICE_PASSWORD_LEN]; /**< The authentication data requied
* */
SERVICE_STATS stats; /**< The service statistics */
bool enable_root; /**< Allow root user access */
bool localhost_match_wildcard_host; /**< Match localhost against wildcard
* */
MXS_CONFIG_PARAMETER* svc_config_param; /**< list of config params and values
* */
int svc_config_version; /**< Version number of configuration
* */
bool svc_do_shutdown; /**< tells the service to exit loops
* etc. */
bool users_from_all; /**< Load users from one server or all
* of them */
bool strip_db_esc; /**< Remove the '\' characters from
* database names
* when querying them from the server.
*MySQL Workbench seems
* to escape at least the underscore
*character. */
int64_t conn_idle_timeout; /**< Session timeout in seconds */
char weightby[MAX_SERVICE_WEIGHTBY_LEN]; /**< Service weighting parameter name
* */
bool retry_start; /**< If starting of the service should
* be retried later */
bool log_auth_warnings; /**< Log authentication failures and
* warnings */
uint64_t capabilities; /**< The capabilities of the service,
* @see enum routing_capability */
int max_retry_interval; /**< Maximum retry interval */
bool session_track_trx_state; /**< Get transaction state via session
* track mechanism */
int active; /**< Whether the service is still
* active */
const char* name; /**< The service name */
int state; /**< The service state */
int client_count; /**< Number of connected clients */
int max_connections; /**< Maximum client connections */
SERV_LISTENER* ports; /**< Linked list of ports and
* protocols
* that this service will listen on */
const char* routerModule; /**< Name of router module to use */
struct mxs_router_object* router; /**< The router we are using */
struct mxs_router* router_instance; /**< The router instance for this
* service */
char version_string[MAX_SERVICE_VERSION_LEN]; /**< version string for this service
* listeners */
SERVER_REF* dbref; /**< server references */
int n_dbref; /**< Number of server references */
char user[MAX_SERVICE_USER_LEN]; /**< The user name to use to extract
* information */
char password[MAX_SERVICE_PASSWORD_LEN]; /**< The authentication data requied
* */
SERVICE_STATS stats; /**< The service statistics */
bool enable_root; /**< Allow root user access */
bool localhost_match_wildcard_host; /**< Match localhost against wildcard
* */
MXS_CONFIG_PARAMETER* svc_config_param; /**< list of config params and values
* */
int svc_config_version; /**< Version number of configuration
* */
bool svc_do_shutdown; /**< tells the service to exit loops
* etc. */
bool users_from_all; /**< Load users from one server or all
* of them */
bool strip_db_esc; /**< Remove the '\' characters from
* database names
* when querying them from the server.
* MySQL Workbench seems
* to escape at least the underscore
* character. */
int64_t conn_idle_timeout; /**< Session timeout in seconds */
char weightby[MAX_SERVICE_WEIGHTBY_LEN]; /**< Service weighting parameter name
* */
bool retry_start; /**< If starting of the service should
* be retried later */
bool log_auth_warnings; /**< Log authentication failures and
* warnings */
uint64_t capabilities; /**< The capabilities of the service,
* @see enum routing_capability */
int max_retry_interval; /**< Maximum retry interval */
bool session_track_trx_state; /**< Get transaction state via session
* track mechanism */
int active; /**< Whether the service is still
* active */
} SERVICE;
typedef enum count_spec_t

View File

@ -54,45 +54,45 @@ typedef enum
((s) == SESSION_STATE_ALLOC ? "SESSION_STATE_ALLOC" \
: ((s) == SESSION_STATE_READY ? "SESSION_STATE_READY" \
: ((s) \
== SESSION_STATE_ROUTER_READY ? \
"SESSION_STATE_ROUTER_READY" \
: ((s) \
== \
SESSION_STATE_STOPPING \
? \
"SESSION_STATE_STOPPING" \
: (( \
s) \
== \
SESSION_STATE_LISTENER \
? \
"SESSION_STATE_LISTENER" \
: (( \
s) \
== \
SESSION_STATE_LISTENER_STOPPED \
? \
"SESSION_STATE_LISTENER_STOPPED" \
: (( \
s) \
== \
SESSION_STATE_TO_BE_FREED \
? \
"SESSION_STATE_TO_BE_FREED" \
: (( \
s) \
== \
SESSION_STATE_FREE \
? \
"SESSION_STATE_TO_BE_FREE" \
: (( \
s) \
== \
SESSION_STATE_DUMMY \
? \
"SESSION_STATE_DUMMY" \
: \
"SESSION_STATE_UNKNOWN")))))))))
== SESSION_STATE_ROUTER_READY \
? "SESSION_STATE_ROUTER_READY" \
: ((s) \
== \
SESSION_STATE_STOPPING \
? \
"SESSION_STATE_STOPPING" \
: (( \
s) \
== \
SESSION_STATE_LISTENER \
? \
"SESSION_STATE_LISTENER" \
: (( \
s) \
== \
SESSION_STATE_LISTENER_STOPPED \
? \
"SESSION_STATE_LISTENER_STOPPED" \
: (( \
s) \
== \
SESSION_STATE_TO_BE_FREED \
? \
"SESSION_STATE_TO_BE_FREED" \
: (( \
s) \
== \
SESSION_STATE_FREE \
? \
"SESSION_STATE_TO_BE_FREE" \
: (( \
s) \
== \
SESSION_STATE_DUMMY \
? \
"SESSION_STATE_DUMMY" \
: \
"SESSION_STATE_UNKNOWN")))))))))
typedef enum
{

View File

@ -58,17 +58,17 @@ typedef enum ssl_method_type
typedef struct ssl_listener
{
SSL_CTX* ctx;
SSL_METHOD* method; /*< SSLv3 or TLS1.0/1.1/1.2 methods
* see: https://www.openssl.org/docs/ssl/SSL_CTX_new.html
**/
int ssl_cert_verify_depth; /*< SSL certificate verification depth */
ssl_method_type_t ssl_method_type; /*< Which of the SSLv3 or TLS1.0/1.1/1.2 methods to use */
char* ssl_cert; /*< SSL certificate */
char* ssl_key; /*< SSL private key */
char* ssl_ca_cert; /*< SSL CA certificate */
bool ssl_init_done; /*< If SSL has already been initialized for this service
* */
bool ssl_verify_peer_certificate; /*< Enable peer certificate verification */
SSL_METHOD* method; /*< SSLv3 or TLS1.0/1.1/1.2 methods
* see: https://www.openssl.org/docs/ssl/SSL_CTX_new.html
**/
int ssl_cert_verify_depth;/*< SSL certificate verification depth */
ssl_method_type_t ssl_method_type; /*< Which of the SSLv3 or TLS1.0/1.1/1.2 methods to use */
char* ssl_cert; /*< SSL certificate */
char* ssl_key; /*< SSL private key */
char* ssl_ca_cert; /*< SSL CA certificate */
bool ssl_init_done; /*< If SSL has already been initialized for this service
* */
bool ssl_verify_peer_certificate; /*< Enable peer certificate verification */
struct ssl_listener
* next; /*< Next SSL configuration, currently used to store obsolete configurations */
} SSL_LISTENER;