Uncrustify maxscale
See script directory for method. The script to run in the top level MaxScale directory is called maxscale-uncrustify.sh, which uses another script, list-src, from the same directory (so you need to set your PATH). The uncrustify version was 0.66.
This commit is contained in:
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <maxscale/ccdefs.hh>
|
||||
|
||||
@ -37,9 +37,9 @@ public:
|
||||
*
|
||||
* @param connection The connection handle for this client
|
||||
*/
|
||||
Client(MHD_Connection *connection):
|
||||
m_connection(connection),
|
||||
m_state(INIT)
|
||||
Client(MHD_Connection* connection)
|
||||
: m_connection(connection)
|
||||
, m_state(INIT)
|
||||
{
|
||||
}
|
||||
|
||||
@ -60,7 +60,7 @@ public:
|
||||
*
|
||||
* @return MHD_YES on success, MHD_NO on error
|
||||
*/
|
||||
int process(std::string url, std::string method, const char* data, size_t *size);
|
||||
int process(std::string url, std::string method, const char* data, size_t* size);
|
||||
|
||||
/**
|
||||
* @brief Authenticate the client
|
||||
@ -94,9 +94,9 @@ public:
|
||||
}
|
||||
|
||||
private:
|
||||
MHD_Connection* m_connection; /**< Connection handle */
|
||||
std::string m_data; /**< Uploaded data */
|
||||
state m_state; /**< Client state */
|
||||
MHD_Connection* m_connection; /**< Connection handle */
|
||||
std::string m_data; /**< Uploaded data */
|
||||
state m_state; /**< Client state */
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file core/maxscale/config.h - The private config interface
|
||||
@ -25,13 +25,13 @@
|
||||
#include <maxbase/jansson.h>
|
||||
#include <maxscale/ssl.h>
|
||||
|
||||
#define DEFAULT_NBPOLLS 3 /**< Default number of non block polls before we block */
|
||||
#define DEFAULT_POLLSLEEP 1000 /**< Default poll wait time (milliseconds) */
|
||||
#define DEFAULT_NTHREADS 1 /**< Default number of polling threads */
|
||||
#define DEFAULT_QUERY_RETRIES 1 /**< Number of retries for interrupted queries */
|
||||
#define DEFAULT_QUERY_RETRY_TIMEOUT 5 /**< Timeout for query retries */
|
||||
#define MIN_WRITEQ_HIGH_WATER 4096UL /**< Min high water mark of dcb write queue */
|
||||
#define MIN_WRITEQ_LOW_WATER 512UL /**< Min low water mark of dcb write queue */
|
||||
#define DEFAULT_NBPOLLS 3 /**< Default number of non block polls before we block */
|
||||
#define DEFAULT_POLLSLEEP 1000 /**< Default poll wait time (milliseconds) */
|
||||
#define DEFAULT_NTHREADS 1 /**< Default number of polling threads */
|
||||
#define DEFAULT_QUERY_RETRIES 1 /**< Number of retries for interrupted queries */
|
||||
#define DEFAULT_QUERY_RETRY_TIMEOUT 5 /**< Timeout for query retries */
|
||||
#define MIN_WRITEQ_HIGH_WATER 4096UL /**< Min high water mark of dcb write queue */
|
||||
#define MIN_WRITEQ_LOW_WATER 512UL /**< Min low water mark of dcb write queue */
|
||||
|
||||
// Default version string sent to clients
|
||||
#define DEFAULT_VERSION_STRING "5.5.5-10.2.12 " MAXSCALE_VERSION "-maxscale"
|
||||
@ -75,12 +75,12 @@ void config_set_global_defaults();
|
||||
* @param ctx Configuration context where the parameters are added
|
||||
* @param params Module parameters
|
||||
*/
|
||||
void config_add_defaults(CONFIG_CONTEXT *ctx, const MXS_MODULE_PARAM *params);
|
||||
void config_add_defaults(CONFIG_CONTEXT* ctx, const MXS_MODULE_PARAM* params);
|
||||
|
||||
char* config_clean_string_list(const char* str);
|
||||
MXS_CONFIG_PARAMETER* config_clone_param(const MXS_CONFIG_PARAMETER* param);
|
||||
bool config_load(const char *);
|
||||
bool config_load_global(const char *filename);
|
||||
bool config_load(const char*);
|
||||
bool config_load_global(const char* filename);
|
||||
void config_parameter_free(MXS_CONFIG_PARAMETER* p1);
|
||||
|
||||
/**
|
||||
@ -89,14 +89,14 @@ void config_parameter_free(MXS_CONFIG_PARAMETER* p1);
|
||||
* @param section Context name
|
||||
* @return New context or NULL on memory allocation failure
|
||||
*/
|
||||
CONFIG_CONTEXT* config_context_create(const char *section);
|
||||
CONFIG_CONTEXT* config_context_create(const char* section);
|
||||
|
||||
/**
|
||||
* @brief Free a configuration context
|
||||
*
|
||||
* @param context The context to free
|
||||
*/
|
||||
void config_context_free(CONFIG_CONTEXT *context);
|
||||
void config_context_free(CONFIG_CONTEXT* context);
|
||||
|
||||
/**
|
||||
* @brief Add a parameter to a configuration context
|
||||
@ -148,8 +148,10 @@ void config_remove_param(CONFIG_CONTEXT* obj, const char* name);
|
||||
*
|
||||
* @return True on success, false on error
|
||||
*/
|
||||
bool config_create_ssl(const char* name, MXS_CONFIG_PARAMETER* params,
|
||||
bool require_cert, SSL_LISTENER** dest);
|
||||
bool config_create_ssl(const char* name,
|
||||
MXS_CONFIG_PARAMETER* params,
|
||||
bool require_cert,
|
||||
SSL_LISTENER** dest);
|
||||
|
||||
/**
|
||||
* @brief Check if all SSL parameters are defined
|
||||
@ -162,7 +164,7 @@ bool config_create_ssl(const char* name, MXS_CONFIG_PARAMETER* params,
|
||||
* @param obj Configuration context
|
||||
* @return True if all required parameters are present
|
||||
*/
|
||||
bool config_have_required_ssl_params(CONFIG_CONTEXT *obj);
|
||||
bool config_have_required_ssl_params(CONFIG_CONTEXT* obj);
|
||||
|
||||
/**
|
||||
* @brief Add non-standard configuration parameters to a JSON object
|
||||
@ -187,7 +189,7 @@ void config_add_module_params_json(const MXS_CONFIG_PARAMETER* parameters,
|
||||
*
|
||||
* @param name Object name to fix
|
||||
*/
|
||||
void fix_object_name(char *name);
|
||||
void fix_object_name(char* name);
|
||||
void fix_object_name(std::string& name);
|
||||
|
||||
/**
|
||||
@ -206,7 +208,7 @@ bool config_global_serialize();
|
||||
*/
|
||||
bool export_config_file(const char* filename);
|
||||
|
||||
bool is_normal_server_parameter(const char *param);
|
||||
bool is_normal_server_parameter(const char* param);
|
||||
|
||||
/**
|
||||
* Converts a string into the corresponding value, interpreting
|
||||
@ -223,7 +225,8 @@ bool is_normal_server_parameter(const char *param);
|
||||
bool get_suffixed_size(const char* value, uint64_t* dest);
|
||||
|
||||
// Dump a parameter list into a file as `key=value` pairs
|
||||
void dump_param_list(int file, MXS_CONFIG_PARAMETER* list,
|
||||
void dump_param_list(int file,
|
||||
MXS_CONFIG_PARAMETER* list,
|
||||
const std::unordered_set<std::string>& ignored,
|
||||
const MXS_MODULE_PARAM* common_params,
|
||||
const MXS_MODULE_PARAM* module_params);
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file config_runtime.h - Functions for runtime configuration modifications
|
||||
@ -53,9 +53,11 @@ void config_runtime_error(const char* fmt, ...) mxs_attribute((format (printf, 1
|
||||
* @param authenticator Authenticator module name
|
||||
* @return True on success, false if an error occurred
|
||||
*/
|
||||
bool runtime_create_server(const char *name, const char *address,
|
||||
const char *port, const char *protocol,
|
||||
const char *authenticator);
|
||||
bool runtime_create_server(const char* name,
|
||||
const char* address,
|
||||
const char* port,
|
||||
const char* protocol,
|
||||
const char* authenticator);
|
||||
|
||||
/**
|
||||
* @brief Destroy a server
|
||||
@ -66,7 +68,7 @@ bool runtime_create_server(const char *name, const char *address,
|
||||
* @param server Server to destroy
|
||||
* @return True if server was destroyed
|
||||
*/
|
||||
bool runtime_destroy_server(SERVER *server);
|
||||
bool runtime_destroy_server(SERVER* server);
|
||||
|
||||
/**
|
||||
* @brief Link a server to an object
|
||||
@ -79,7 +81,7 @@ bool runtime_destroy_server(SERVER *server);
|
||||
* @return True if the object was found and the server was linked to it, false
|
||||
* if no object matching @c target was found
|
||||
*/
|
||||
bool runtime_link_server(SERVER *server, const char *target);
|
||||
bool runtime_link_server(SERVER* server, const char* target);
|
||||
|
||||
/**
|
||||
* @brief Unlink a server from an object
|
||||
@ -92,7 +94,7 @@ bool runtime_link_server(SERVER *server, const char *target);
|
||||
* @return True if the object was found and the server was unlinked from it, false
|
||||
* if no object matching @c target was found
|
||||
*/
|
||||
bool runtime_unlink_server(SERVER *server, const char *target);
|
||||
bool runtime_unlink_server(SERVER* server, const char* target);
|
||||
|
||||
/**
|
||||
* @brief Alter server parameters
|
||||
@ -102,7 +104,7 @@ bool runtime_unlink_server(SERVER *server, const char *target);
|
||||
* @param value New value
|
||||
* @return True if @c key was one of the supported parameters
|
||||
*/
|
||||
bool runtime_alter_server(SERVER *server, const char *key, const char *value);
|
||||
bool runtime_alter_server(SERVER* server, const char* key, const char* value);
|
||||
|
||||
/**
|
||||
* @brief Enable SSL for a server
|
||||
@ -122,9 +124,13 @@ bool runtime_alter_server(SERVER *server, const char *key, const char *value);
|
||||
*
|
||||
* @return True if SSL was successfully enabled
|
||||
*/
|
||||
bool runtime_enable_server_ssl(SERVER *server, const char *key, const char *cert,
|
||||
const char *ca, const char *version, const char *depth,
|
||||
const char *verify);
|
||||
bool runtime_enable_server_ssl(SERVER* server,
|
||||
const char* key,
|
||||
const char* cert,
|
||||
const char* ca,
|
||||
const char* version,
|
||||
const char* depth,
|
||||
const char* verify);
|
||||
|
||||
/**
|
||||
* @brief Alter monitor parameters
|
||||
@ -134,7 +140,7 @@ bool runtime_enable_server_ssl(SERVER *server, const char *key, const char *cert
|
||||
* @param value New value
|
||||
* @return True if @c key was one of the supported parameters
|
||||
*/
|
||||
bool runtime_alter_monitor(MXS_MONITOR *monitor, const char *key, const char *value);
|
||||
bool runtime_alter_monitor(MXS_MONITOR* monitor, const char* key, const char* value);
|
||||
|
||||
/**
|
||||
* @brief Alter service parameters
|
||||
@ -145,7 +151,7 @@ bool runtime_alter_monitor(MXS_MONITOR *monitor, const char *key, const char *va
|
||||
*
|
||||
* @return True if @c key was one of the supported parameters
|
||||
*/
|
||||
bool runtime_alter_service(Service *service, const char* zKey, const char* zValue);
|
||||
bool runtime_alter_service(Service* service, const char* zKey, const char* zValue);
|
||||
|
||||
/**
|
||||
* @brief Alter MaxScale parameters
|
||||
@ -178,12 +184,19 @@ bool runtime_alter_maxscale(const char* name, const char* value);
|
||||
*
|
||||
* @return True if the listener was successfully created and started
|
||||
*/
|
||||
bool runtime_create_listener(Service *service, const char *name, const char *addr,
|
||||
const char *port, const char *proto, const char *auth,
|
||||
const char *auth_opt, const char *ssl_key,
|
||||
const char *ssl_cert, const char *ssl_ca,
|
||||
const char *ssl_version, const char *ssl_depth,
|
||||
const char *verify_ssl);
|
||||
bool runtime_create_listener(Service* service,
|
||||
const char* name,
|
||||
const char* addr,
|
||||
const char* port,
|
||||
const char* proto,
|
||||
const char* auth,
|
||||
const char* auth_opt,
|
||||
const char* ssl_key,
|
||||
const char* ssl_cert,
|
||||
const char* ssl_ca,
|
||||
const char* ssl_version,
|
||||
const char* ssl_depth,
|
||||
const char* verify_ssl);
|
||||
|
||||
/**
|
||||
* @brief Destroy a listener
|
||||
@ -196,7 +209,7 @@ bool runtime_create_listener(Service *service, const char *name, const char *add
|
||||
*
|
||||
* @return True if the listener was successfully destroyed
|
||||
*/
|
||||
bool runtime_destroy_listener(Service *service, const char *name);
|
||||
bool runtime_destroy_listener(Service* service, const char* name);
|
||||
|
||||
/**
|
||||
* @brief Create a new monitor
|
||||
@ -205,7 +218,7 @@ bool runtime_destroy_listener(Service *service, const char *name);
|
||||
* @param module Monitor module
|
||||
* @return True if new monitor was created and persisted
|
||||
*/
|
||||
bool runtime_create_monitor(const char *name, const char *module);
|
||||
bool runtime_create_monitor(const char* name, const char* module);
|
||||
|
||||
/**
|
||||
* @brief Create a new filter
|
||||
@ -216,7 +229,7 @@ bool runtime_create_monitor(const char *name, const char *module);
|
||||
*
|
||||
* @return True if a new filter was created and persisted
|
||||
*/
|
||||
bool runtime_create_filter(const char *name, const char *module, MXS_CONFIG_PARAMETER* params);
|
||||
bool runtime_create_filter(const char* name, const char* module, MXS_CONFIG_PARAMETER* params);
|
||||
|
||||
/**
|
||||
* Destroy a filter
|
||||
@ -238,7 +251,7 @@ bool runtime_destroy_filter(const SFilterDef& filter);
|
||||
* @param monitor Monitor to destroy
|
||||
* @return True if monitor was destroyed
|
||||
*/
|
||||
bool runtime_destroy_monitor(MXS_MONITOR *monitor);
|
||||
bool runtime_destroy_monitor(MXS_MONITOR* monitor);
|
||||
|
||||
/**
|
||||
* Destroy a service
|
||||
|
||||
@ -10,13 +10,13 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <maxscale/dcb.h>
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
void dcb_free_all_memory(DCB *dcb);
|
||||
void dcb_final_close(DCB *dcb);
|
||||
void dcb_free_all_memory(DCB* dcb);
|
||||
void dcb_final_close(DCB* dcb);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <maxscale/ccdefs.hh>
|
||||
#include <maxscale/event.hh>
|
||||
@ -23,9 +23,9 @@ namespace event
|
||||
|
||||
enum result_t
|
||||
{
|
||||
IGNORED, /**< The configuration was ignored, it does not affect events. */
|
||||
INVALID, /**< The configuration was invalid. */
|
||||
ACCEPTED /**< The configuration was accepted. */
|
||||
IGNORED, /**< The configuration was ignored, it does not affect events. */
|
||||
INVALID, /**< The configuration was invalid. */
|
||||
ACCEPTED /**< The configuration was accepted. */
|
||||
};
|
||||
|
||||
/**
|
||||
@ -40,7 +40,5 @@ enum result_t
|
||||
* ACCEPTED, if @c zName and @c zValue are valid.
|
||||
*/
|
||||
result_t configure(const char* zName, const char* zValue);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <maxscale/cdefs.h>
|
||||
|
||||
@ -22,11 +22,11 @@ MXS_BEGIN_DECLS
|
||||
|
||||
typedef struct extern_cmd_t
|
||||
{
|
||||
char** argv; /**< Argument vector for the command, first being the
|
||||
* actual command being executed */
|
||||
int n_exec; /**< Number of times executed */
|
||||
pid_t child; /**< PID of the child process */
|
||||
uint32_t timeout; /**< Command timeout in seconds */
|
||||
char** argv; /**< Argument vector for the command, first being the
|
||||
* actual command being executed */
|
||||
int n_exec; /**< Number of times executed */
|
||||
pid_t child; /**< PID of the child process */
|
||||
uint32_t timeout; /**< Command timeout in seconds */
|
||||
} EXTERNCMD;
|
||||
|
||||
char* externcmd_extract_command(const char* argstr);
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file core/maxscale/filter.h - The private filter interface
|
||||
@ -27,33 +27,36 @@
|
||||
* options to pass to that plugin.
|
||||
*/
|
||||
// TODO: Make this a class
|
||||
struct FilterDef: public MXS_FILTER_DEF
|
||||
struct FilterDef : public MXS_FILTER_DEF
|
||||
{
|
||||
FilterDef(std::string name, std::string module, MXS_FILTER_OBJECT* object,
|
||||
MXS_FILTER* instance, MXS_CONFIG_PARAMETER* params);
|
||||
FilterDef(std::string name,
|
||||
std::string module,
|
||||
MXS_FILTER_OBJECT* object,
|
||||
MXS_FILTER* instance,
|
||||
MXS_CONFIG_PARAMETER* params);
|
||||
~FilterDef();
|
||||
|
||||
std::string name; /**< The Filter name */
|
||||
std::string module; /**< The module to load */
|
||||
MXS_CONFIG_PARAMETER *parameters; /**< The filter parameters */
|
||||
MXS_FILTER* filter; /**< The runtime filter */
|
||||
MXS_FILTER_OBJECT *obj; /**< The "MODULE_OBJECT" for the filter */
|
||||
mutable std::mutex lock;
|
||||
std::string name; /**< The Filter name */
|
||||
std::string module; /**< The module to load */
|
||||
MXS_CONFIG_PARAMETER* parameters; /**< The filter parameters */
|
||||
MXS_FILTER* filter; /**< The runtime filter */
|
||||
MXS_FILTER_OBJECT* obj; /**< The "MODULE_OBJECT" for the filter */
|
||||
mutable std::mutex lock;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<FilterDef> SFilterDef;
|
||||
|
||||
void filter_add_parameter(SFilterDef& filter_def, const char *name, const char *value);
|
||||
SFilterDef filter_alloc(const char *name, const char *module, MXS_CONFIG_PARAMETER* params);
|
||||
MXS_DOWNSTREAM* filter_apply(const SFilterDef& filter_def, MXS_SESSION *session, MXS_DOWNSTREAM *downstream);
|
||||
void filter_free(const SFilterDef& filter);
|
||||
int filter_standard_parameter(const char *name);
|
||||
MXS_UPSTREAM *filter_upstream(const SFilterDef& filter_def,
|
||||
MXS_FILTER_SESSION *fsession,
|
||||
MXS_UPSTREAM *upstream);
|
||||
void filter_add_parameter(SFilterDef& filter_def, const char* name, const char* value);
|
||||
SFilterDef filter_alloc(const char* name, const char* module, MXS_CONFIG_PARAMETER* params);
|
||||
MXS_DOWNSTREAM* filter_apply(const SFilterDef& filter_def, MXS_SESSION* session, MXS_DOWNSTREAM* downstream);
|
||||
void filter_free(const SFilterDef& filter);
|
||||
int filter_standard_parameter(const char* name);
|
||||
MXS_UPSTREAM* filter_upstream(const SFilterDef& filter_def,
|
||||
MXS_FILTER_SESSION* fsession,
|
||||
MXS_UPSTREAM* upstream);
|
||||
|
||||
// Find the internal filter representation
|
||||
SFilterDef filter_find(const char *name);
|
||||
SFilterDef filter_find(const char* name);
|
||||
|
||||
/**
|
||||
* Check if filter can be destroyed
|
||||
@ -89,9 +92,9 @@ void filter_destroy_instances();
|
||||
*/
|
||||
bool filter_serialize(const SFilterDef& filter);
|
||||
|
||||
void dprintAllFilters(DCB *);
|
||||
void dprintFilter(DCB *, const SFilterDef&);
|
||||
void dListFilters(DCB *);
|
||||
void dprintAllFilters(DCB*);
|
||||
void dprintFilter(DCB*, const SFilterDef&);
|
||||
void dListFilters(DCB*);
|
||||
|
||||
/**
|
||||
* @brief Convert a filter to JSON
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <maxscale/ccdefs.hh>
|
||||
|
||||
@ -28,10 +28,10 @@
|
||||
// The API version part of the URL
|
||||
#define MXS_REST_API_VERSION "v1"
|
||||
|
||||
static int value_iterator(void *cls,
|
||||
static int value_iterator(void* cls,
|
||||
enum MHD_ValueKind kind,
|
||||
const char *key,
|
||||
const char *value)
|
||||
const char* key,
|
||||
const char* value)
|
||||
{
|
||||
std::pair<std::string, std::string>* cmp = (std::pair<std::string, std::string>*)cls;
|
||||
|
||||
@ -44,20 +44,20 @@ static int value_iterator(void *cls,
|
||||
return MHD_YES;
|
||||
}
|
||||
|
||||
static int value_sum_iterator(void *cls,
|
||||
static int value_sum_iterator(void* cls,
|
||||
enum MHD_ValueKind kind,
|
||||
const char *key,
|
||||
const char *value)
|
||||
const char* key,
|
||||
const char* value)
|
||||
{
|
||||
size_t& count = *(size_t*)cls;
|
||||
count++;
|
||||
return MHD_YES;
|
||||
}
|
||||
|
||||
static int value_copy_iterator(void *cls,
|
||||
static int value_copy_iterator(void* cls,
|
||||
enum MHD_ValueKind kind,
|
||||
const char *key,
|
||||
const char *value)
|
||||
const char* key,
|
||||
const char* value)
|
||||
{
|
||||
std::string k = key;
|
||||
if (value)
|
||||
@ -76,7 +76,7 @@ static int value_copy_iterator(void *cls,
|
||||
class HttpRequest
|
||||
{
|
||||
HttpRequest(const HttpRequest&);
|
||||
HttpRequest& operator = (const HttpRequest);
|
||||
HttpRequest& operator=(const HttpRequest);
|
||||
public:
|
||||
/**
|
||||
* @brief Parse a request
|
||||
@ -85,7 +85,7 @@ public:
|
||||
*
|
||||
* @return Parsed statement or NULL if request is not valid
|
||||
*/
|
||||
HttpRequest(struct MHD_Connection *connection, std::string url, std::string method, json_t* data);
|
||||
HttpRequest(struct MHD_Connection* connection, std::string url, std::string method, json_t* data);
|
||||
|
||||
~HttpRequest();
|
||||
|
||||
@ -111,8 +111,10 @@ public:
|
||||
std::pair<std::string, std::string> p;
|
||||
p.first = header;
|
||||
|
||||
MHD_get_connection_values(m_connection, MHD_HEADER_KIND,
|
||||
value_iterator, &p);
|
||||
MHD_get_connection_values(m_connection,
|
||||
MHD_HEADER_KIND,
|
||||
value_iterator,
|
||||
&p);
|
||||
|
||||
return p.second;
|
||||
}
|
||||
@ -129,8 +131,10 @@ public:
|
||||
std::pair<std::string, std::string> p;
|
||||
p.first = option;
|
||||
|
||||
MHD_get_connection_values(m_connection, MHD_GET_ARGUMENT_KIND,
|
||||
value_iterator, &p);
|
||||
MHD_get_connection_values(m_connection,
|
||||
MHD_GET_ARGUMENT_KIND,
|
||||
value_iterator,
|
||||
&p);
|
||||
|
||||
return p.second;
|
||||
}
|
||||
@ -143,8 +147,10 @@ public:
|
||||
size_t get_option_count() const
|
||||
{
|
||||
size_t rval = 0;
|
||||
MHD_get_connection_values(m_connection, MHD_GET_ARGUMENT_KIND,
|
||||
value_sum_iterator, &rval);
|
||||
MHD_get_connection_values(m_connection,
|
||||
MHD_GET_ARGUMENT_KIND,
|
||||
value_sum_iterator,
|
||||
&rval);
|
||||
|
||||
return rval;
|
||||
}
|
||||
@ -159,8 +165,10 @@ public:
|
||||
*/
|
||||
void copy_options(char** dest) const
|
||||
{
|
||||
MHD_get_connection_values(m_connection, MHD_GET_ARGUMENT_KIND,
|
||||
value_copy_iterator, &dest);
|
||||
MHD_get_connection_values(m_connection,
|
||||
MHD_GET_ARGUMENT_KIND,
|
||||
value_copy_iterator,
|
||||
&dest);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -250,7 +258,7 @@ public:
|
||||
*/
|
||||
std::string last_uri_part() const
|
||||
{
|
||||
return m_resource_parts.size() > 0 ? m_resource_parts[m_resource_parts.size() - 1] : "";
|
||||
return m_resource_parts.size() > 0 ? m_resource_parts[m_resource_parts.size() - 1] : "";
|
||||
}
|
||||
|
||||
/**
|
||||
@ -285,12 +293,12 @@ private:
|
||||
static const std::string HTTP_PREFIX;
|
||||
static const std::string HTTPS_PREFIX;
|
||||
|
||||
std::map<std::string, std::string> m_options; /**< Request options */
|
||||
std::unique_ptr<json_t> m_json; /**< Request body */
|
||||
std::string m_json_string; /**< String version of @c m_json */
|
||||
std::string m_resource; /**< Requested resource */
|
||||
std::deque<std::string> m_resource_parts; /**< @c m_resource split into parts */
|
||||
std::string m_verb; /**< Request method */
|
||||
std::string m_hostname; /**< The value of the Host header */
|
||||
std::map<std::string, std::string> m_options; /**< Request options */
|
||||
std::unique_ptr<json_t> m_json; /**< Request body */
|
||||
std::string m_json_string; /**< String version of @c m_json */
|
||||
std::string m_resource; /**< Requested resource */
|
||||
std::deque<std::string> m_resource_parts;/**< @c m_resource split into parts */
|
||||
std::string m_verb; /**< Request method */
|
||||
std::string m_hostname; /**< The value of the Host header */
|
||||
struct MHD_Connection* m_connection;
|
||||
};
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <maxscale/ccdefs.hh>
|
||||
|
||||
@ -44,7 +44,7 @@ public:
|
||||
*/
|
||||
HttpResponse(int code = MHD_HTTP_OK, json_t* response = NULL);
|
||||
HttpResponse(const HttpResponse& response);
|
||||
HttpResponse& operator = (const HttpResponse& response);
|
||||
HttpResponse& operator=(const HttpResponse& response);
|
||||
|
||||
~HttpResponse();
|
||||
|
||||
@ -85,7 +85,7 @@ public:
|
||||
const Headers& get_headers() const;
|
||||
|
||||
private:
|
||||
json_t* m_body; /**< Message body */
|
||||
int m_code; /**< The HTTP code for the response */
|
||||
Headers m_headers; /**< Extra headers */
|
||||
json_t* m_body; /**< Message body */
|
||||
int m_code; /**< The HTTP code for the response */
|
||||
Headers m_headers; /**< Extra headers */
|
||||
};
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file core/maxscale/maxscale.h - The private maxscale general definitions
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file modules.h Utilities for loading modules
|
||||
@ -25,12 +25,12 @@ MXS_BEGIN_DECLS
|
||||
/**
|
||||
* Module types
|
||||
*/
|
||||
#define MODULE_PROTOCOL "Protocol" /**< A protocol module type */
|
||||
#define MODULE_AUTHENTICATOR "Authenticator" /**< An authenticator module type */
|
||||
#define MODULE_ROUTER "Router" /**< A router module type */
|
||||
#define MODULE_MONITOR "Monitor" /**< A database monitor module type */
|
||||
#define MODULE_FILTER "Filter" /**< A filter module type */
|
||||
#define MODULE_QUERY_CLASSIFIER "QueryClassifier" /**< A query classifier module type */
|
||||
#define MODULE_PROTOCOL "Protocol" /**< A protocol module type */
|
||||
#define MODULE_AUTHENTICATOR "Authenticator" /**< An authenticator module type */
|
||||
#define MODULE_ROUTER "Router" /**< A router module type */
|
||||
#define MODULE_MONITOR "Monitor" /**< A database monitor module type */
|
||||
#define MODULE_FILTER "Filter" /**< A filter module type */
|
||||
#define MODULE_QUERY_CLASSIFIER "QueryClassifier" /**< A query classifier module type */
|
||||
|
||||
|
||||
/**
|
||||
@ -40,7 +40,7 @@ MXS_BEGIN_DECLS
|
||||
* @param type Type of module, used purely for registration
|
||||
* @return The module specific entry point structure or NULL
|
||||
*/
|
||||
void *load_module(const char *module, const char *type);
|
||||
void* load_module(const char* module, const char* type);
|
||||
|
||||
/**
|
||||
* @brief Get a module
|
||||
@ -49,7 +49,7 @@ void *load_module(const char *module, const char *type);
|
||||
* @param type The module type or NULL for any type
|
||||
* @return The loaded module or NULL if the module is not loaded
|
||||
*/
|
||||
const MXS_MODULE *get_module(const char *name, const char *type);
|
||||
const MXS_MODULE* get_module(const char* name, const char* type);
|
||||
|
||||
/**
|
||||
* @brief Unload a module.
|
||||
@ -59,7 +59,7 @@ const MXS_MODULE *get_module(const char *name, const char *type);
|
||||
*
|
||||
* @param module The name of the module
|
||||
*/
|
||||
void unload_module(const char *module);
|
||||
void unload_module(const char* module);
|
||||
|
||||
/**
|
||||
* @brief Unload all modules
|
||||
@ -81,12 +81,12 @@ void printModules();
|
||||
*
|
||||
* Diagnostic routine to display all the loaded modules
|
||||
*/
|
||||
void dprintAllModules(DCB *);
|
||||
void dprintAllModules(DCB*);
|
||||
|
||||
typedef struct mxs_module_iterator
|
||||
{
|
||||
const char* type;
|
||||
void* position;
|
||||
void* position;
|
||||
} MXS_MODULE_ITERATOR;
|
||||
|
||||
/**
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include "modules.h"
|
||||
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file core/maxscale/monitor.h - The private monitor interface
|
||||
@ -23,12 +23,12 @@ MXS_BEGIN_DECLS
|
||||
|
||||
#define MON_ARG_MAX 8192
|
||||
|
||||
#define DEFAULT_CONNECT_TIMEOUT 3
|
||||
#define DEFAULT_READ_TIMEOUT 1
|
||||
#define DEFAULT_WRITE_TIMEOUT 2
|
||||
#define DEFAULT_CONNECT_TIMEOUT 3
|
||||
#define DEFAULT_READ_TIMEOUT 1
|
||||
#define DEFAULT_WRITE_TIMEOUT 2
|
||||
#define DEFAULT_CONNECTION_ATTEMPTS 1
|
||||
|
||||
#define DEFAULT_MONITOR_INTERVAL 2000 // in milliseconds
|
||||
#define DEFAULT_MONITOR_INTERVAL 2000 // in milliseconds
|
||||
|
||||
/** Default maximum journal age in seconds */
|
||||
#define DEFAULT_JOURNAL_MAX_AGE 28800
|
||||
@ -41,9 +41,9 @@ MXS_BEGIN_DECLS
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
MONITOR_CONNECT_TIMEOUT = 0,
|
||||
MONITOR_READ_TIMEOUT = 1,
|
||||
MONITOR_WRITE_TIMEOUT = 2,
|
||||
MONITOR_CONNECT_TIMEOUT = 0,
|
||||
MONITOR_READ_TIMEOUT = 1,
|
||||
MONITOR_WRITE_TIMEOUT = 2,
|
||||
MONITOR_CONNECT_ATTEMPTS = 3
|
||||
} monitor_timeouts_t;
|
||||
|
||||
@ -53,36 +53,36 @@ static const MXS_ENUM_VALUE mxs_monitor_event_default_enum = {"all", ~0ULL};
|
||||
static const MXS_ENUM_VALUE mxs_monitor_event_enum_values[] =
|
||||
{
|
||||
mxs_monitor_event_default_enum,
|
||||
{"master_down", MASTER_DOWN_EVENT},
|
||||
{"master_up", MASTER_UP_EVENT},
|
||||
{"slave_down", SLAVE_DOWN_EVENT},
|
||||
{"slave_up", SLAVE_UP_EVENT},
|
||||
{"server_down", SERVER_DOWN_EVENT},
|
||||
{"server_up", SERVER_UP_EVENT},
|
||||
{"synced_down", SYNCED_DOWN_EVENT},
|
||||
{"synced_up", SYNCED_UP_EVENT},
|
||||
{"donor_down", DONOR_DOWN_EVENT},
|
||||
{"donor_up", DONOR_UP_EVENT},
|
||||
{"ndb_down", NDB_DOWN_EVENT},
|
||||
{"ndb_up", NDB_UP_EVENT},
|
||||
{"lost_master", LOST_MASTER_EVENT},
|
||||
{"lost_slave", LOST_SLAVE_EVENT},
|
||||
{"lost_synced", LOST_SYNCED_EVENT},
|
||||
{"lost_donor", LOST_DONOR_EVENT},
|
||||
{"lost_ndb", LOST_NDB_EVENT},
|
||||
{"new_master", NEW_MASTER_EVENT},
|
||||
{"new_slave", NEW_SLAVE_EVENT},
|
||||
{"new_synced", NEW_SYNCED_EVENT},
|
||||
{"new_donor", NEW_DONOR_EVENT},
|
||||
{"new_ndb", NEW_NDB_EVENT},
|
||||
{"master_down", MASTER_DOWN_EVENT },
|
||||
{"master_up", MASTER_UP_EVENT },
|
||||
{"slave_down", SLAVE_DOWN_EVENT },
|
||||
{"slave_up", SLAVE_UP_EVENT },
|
||||
{"server_down", SERVER_DOWN_EVENT },
|
||||
{"server_up", SERVER_UP_EVENT },
|
||||
{"synced_down", SYNCED_DOWN_EVENT },
|
||||
{"synced_up", SYNCED_UP_EVENT },
|
||||
{"donor_down", DONOR_DOWN_EVENT },
|
||||
{"donor_up", DONOR_UP_EVENT },
|
||||
{"ndb_down", NDB_DOWN_EVENT },
|
||||
{"ndb_up", NDB_UP_EVENT },
|
||||
{"lost_master", LOST_MASTER_EVENT },
|
||||
{"lost_slave", LOST_SLAVE_EVENT },
|
||||
{"lost_synced", LOST_SYNCED_EVENT },
|
||||
{"lost_donor", LOST_DONOR_EVENT },
|
||||
{"lost_ndb", LOST_NDB_EVENT },
|
||||
{"new_master", NEW_MASTER_EVENT },
|
||||
{"new_slave", NEW_SLAVE_EVENT },
|
||||
{"new_synced", NEW_SYNCED_EVENT },
|
||||
{"new_donor", NEW_DONOR_EVENT },
|
||||
{"new_ndb", NEW_NDB_EVENT },
|
||||
{NULL}
|
||||
};
|
||||
|
||||
MXS_MONITOR *monitor_create(const char *, const char *, MXS_CONFIG_PARAMETER* params);
|
||||
void monitor_destroy(MXS_MONITOR *);
|
||||
MXS_MONITOR* monitor_create(const char*, const char*, MXS_CONFIG_PARAMETER* params);
|
||||
void monitor_destroy(MXS_MONITOR*);
|
||||
|
||||
void monitor_start(MXS_MONITOR *, const MXS_CONFIG_PARAMETER*);
|
||||
void monitor_stop(MXS_MONITOR *);
|
||||
void monitor_start(MXS_MONITOR*, const MXS_CONFIG_PARAMETER*);
|
||||
void monitor_stop(MXS_MONITOR*);
|
||||
|
||||
/**
|
||||
* @brief Mark monitor as deactivated
|
||||
@ -105,25 +105,25 @@ void monitor_start_all();
|
||||
*/
|
||||
void monitor_destroy_all();
|
||||
|
||||
MXS_MONITOR *monitor_find(const char *);
|
||||
MXS_MONITOR* monitor_find(const char*);
|
||||
MXS_MONITOR* monitor_repurpose_destroyed(const char* name, const char* module);
|
||||
|
||||
void monitor_show(DCB *, MXS_MONITOR *);
|
||||
void monitor_show_all(DCB *);
|
||||
void monitor_show(DCB*, MXS_MONITOR*);
|
||||
void monitor_show_all(DCB*);
|
||||
|
||||
void monitor_list(DCB *);
|
||||
void monitor_list(DCB*);
|
||||
|
||||
bool monitor_add_server(MXS_MONITOR *mon, SERVER *server);
|
||||
void monitor_remove_server(MXS_MONITOR *mon, SERVER *server);
|
||||
void monitor_add_user(MXS_MONITOR *, const char *, const char *);
|
||||
void monitor_add_parameters(MXS_MONITOR *monitor, MXS_CONFIG_PARAMETER *params);
|
||||
bool monitor_remove_parameter(MXS_MONITOR *monitor, const char *key);
|
||||
void monitor_set_parameter(MXS_MONITOR *monitor, const char* key, const char* value);
|
||||
bool monitor_add_server(MXS_MONITOR* mon, SERVER* server);
|
||||
void monitor_remove_server(MXS_MONITOR* mon, SERVER* server);
|
||||
void monitor_add_user(MXS_MONITOR*, const char*, const char*);
|
||||
void monitor_add_parameters(MXS_MONITOR* monitor, MXS_CONFIG_PARAMETER* params);
|
||||
bool monitor_remove_parameter(MXS_MONITOR* monitor, const char* key);
|
||||
void monitor_set_parameter(MXS_MONITOR* monitor, const char* key, const char* value);
|
||||
|
||||
void monitor_set_interval (MXS_MONITOR *, unsigned long);
|
||||
bool monitor_set_network_timeout(MXS_MONITOR *, int, int, const char*);
|
||||
void monitor_set_journal_max_age(MXS_MONITOR *mon, time_t value);
|
||||
void monitor_set_script_timeout(MXS_MONITOR *mon, uint32_t value);
|
||||
void monitor_set_interval(MXS_MONITOR*, unsigned long);
|
||||
bool monitor_set_network_timeout(MXS_MONITOR*, int, int, const char*);
|
||||
void monitor_set_journal_max_age(MXS_MONITOR* mon, time_t value);
|
||||
void monitor_set_script_timeout(MXS_MONITOR* mon, uint32_t value);
|
||||
|
||||
/**
|
||||
* @brief Serialize a monitor to a file
|
||||
@ -133,14 +133,14 @@ void monitor_set_script_timeout(MXS_MONITOR *mon, uint32_t value);
|
||||
* @param monitor Monitor to serialize
|
||||
* @return True if serialization was successful
|
||||
*/
|
||||
bool monitor_serialize(const MXS_MONITOR *monitor);
|
||||
bool monitor_serialize(const MXS_MONITOR* monitor);
|
||||
|
||||
/**
|
||||
* Check if a server is being monitored and return the monitor.
|
||||
* @param server Server that is queried
|
||||
* @return The monitor watching this server, or NULL if not monitored
|
||||
*/
|
||||
MXS_MONITOR* monitor_server_in_use(const SERVER *server);
|
||||
MXS_MONITOR* monitor_server_in_use(const SERVER* server);
|
||||
|
||||
/**
|
||||
* Launch a script
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* Internal header for the monitor type
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* The private poll header
|
||||
@ -27,15 +27,15 @@ enum poll_message
|
||||
POLL_MSG_CLEAN_PERSISTENT = 0x01
|
||||
};
|
||||
|
||||
void poll_init();
|
||||
//void poll_finish(); // TODO: Add this.
|
||||
void poll_init();
|
||||
// void poll_finish(); // TODO: Add this.
|
||||
|
||||
void poll_set_maxwait(unsigned int);
|
||||
void poll_set_nonblocking_polls(unsigned int);
|
||||
void poll_set_maxwait(unsigned int);
|
||||
void poll_set_nonblocking_polls(unsigned int);
|
||||
|
||||
void dprintPollStats(DCB *);
|
||||
void dShowThreads(DCB *dcb);
|
||||
void dShowEventQ(DCB *dcb);
|
||||
void dShowEventStats(DCB *dcb);
|
||||
void dprintPollStats(DCB*);
|
||||
void dShowThreads(DCB* dcb);
|
||||
void dShowEventQ(DCB* dcb);
|
||||
void dShowEventStats(DCB* dcb);
|
||||
|
||||
std::unique_ptr<ResultSet> eventTimesGetList();
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <maxscale/ccdefs.hh>
|
||||
#include <maxscale/query_classifier.h>
|
||||
@ -20,8 +20,8 @@ MXS_BEGIN_DECLS
|
||||
|
||||
typedef enum qc_trx_parse_using
|
||||
{
|
||||
QC_TRX_PARSE_USING_QC, /**< Use the query classifier. */
|
||||
QC_TRX_PARSE_USING_PARSER, /**< Use custom parser. */
|
||||
QC_TRX_PARSE_USING_QC, /**< Use the query classifier. */
|
||||
QC_TRX_PARSE_USING_PARSER, /**< Use custom parser. */
|
||||
} qc_trx_parse_using_t;
|
||||
|
||||
/**
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
/** @file REST API resources */
|
||||
|
||||
@ -29,12 +29,12 @@
|
||||
#include "filter.hh"
|
||||
#include "session.h"
|
||||
|
||||
typedef HttpResponse (*ResourceCallback)(const HttpRequest& request);
|
||||
typedef HttpResponse (* ResourceCallback)(const HttpRequest& request);
|
||||
|
||||
class Resource
|
||||
{
|
||||
Resource(const Resource&);
|
||||
Resource& operator = (const Resource&);
|
||||
Resource& operator=(const Resource&);
|
||||
public:
|
||||
|
||||
enum resource_constraint
|
||||
@ -82,10 +82,10 @@ private:
|
||||
|
||||
bool matching_variable_path(const std::string& path, const std::string& target) const;
|
||||
|
||||
ResourceCallback m_cb; /**< Resource handler callback */
|
||||
std::deque<std::string> m_path; /**< Path components */
|
||||
bool m_is_glob; /**< Does this path glob? */
|
||||
uint32_t m_constraints; /**< Resource constraints */
|
||||
ResourceCallback m_cb; /**< Resource handler callback */
|
||||
std::deque<std::string> m_path; /**< Path components */
|
||||
bool m_is_glob; /**< Does this path glob? */
|
||||
uint32_t m_constraints; /**< Resource constraints */
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file core/maxscale/secrets.h - MaxScale config file password encryption/decryption
|
||||
@ -37,7 +37,7 @@ enum
|
||||
MXS_PASSWORD_MAXLEN = 79
|
||||
};
|
||||
|
||||
int secrets_write_keys(const char *directory);
|
||||
char *encrypt_password(const char*, const char *);
|
||||
int secrets_write_keys(const char* directory);
|
||||
char* encrypt_password(const char*, const char*);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* Internal header for the server type
|
||||
@ -22,9 +22,9 @@
|
||||
std::unique_ptr<ResultSet> serverGetList();
|
||||
|
||||
// Private server implementation
|
||||
class Server: public SERVER
|
||||
class Server : public SERVER
|
||||
{
|
||||
// TODO: Move everything here
|
||||
};
|
||||
|
||||
void server_free(Server *server);
|
||||
void server_free(Server* server);
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <maxscale/service.h>
|
||||
#include <maxscale/resultset.hh>
|
||||
@ -27,12 +27,12 @@
|
||||
|
||||
struct LastUserLoad
|
||||
{
|
||||
time_t last = 0; // The last time the users were loaded
|
||||
bool warned = false; // Has a warning been logged
|
||||
time_t last = 0; // The last time the users were loaded
|
||||
bool warned = false; // Has a warning been logged
|
||||
};
|
||||
|
||||
// The internal service representation
|
||||
class Service: public SERVICE
|
||||
class Service : public SERVICE
|
||||
{
|
||||
public:
|
||||
using FilterList = std::vector<SFilterDef>;
|
||||
@ -95,24 +95,24 @@ public:
|
||||
*
|
||||
* @return True on success
|
||||
*/
|
||||
bool dump_config(const char *filename) const;
|
||||
bool dump_config(const char* filename) const;
|
||||
|
||||
// TODO: Make JSON output internal (could iterate over get_filters() but that takes the service lock)
|
||||
json_t* json_relationships(const char* host) const;
|
||||
|
||||
// TODO: Make these private
|
||||
mutable std::mutex lock;
|
||||
mutable std::mutex lock;
|
||||
|
||||
private:
|
||||
FilterList m_filters; /**< Ordered list of filters */
|
||||
std::string m_name; /**< Name of the service */
|
||||
std::string m_router_name; /**< Router module */
|
||||
std::string m_user; /**< Username */
|
||||
std::string m_password; /**< Password */
|
||||
std::string m_weightby; /**< Weighting parameter name */
|
||||
std::string m_version_string; /**< Version string sent to clients */
|
||||
RateLimits m_rate_limits; /**< The refresh rate limits for users of each thread */
|
||||
uint64_t m_wkey; /**< Key for worker local data */
|
||||
FilterList m_filters; /**< Ordered list of filters */
|
||||
std::string m_name; /**< Name of the service */
|
||||
std::string m_router_name; /**< Router module */
|
||||
std::string m_user; /**< Username */
|
||||
std::string m_password; /**< Password */
|
||||
std::string m_weightby; /**< Weighting parameter name */
|
||||
std::string m_version_string; /**< Version string sent to clients */
|
||||
RateLimits m_rate_limits; /**< The refresh rate limits for users of each thread */
|
||||
uint64_t m_wkey; /**< Key for worker local data */
|
||||
|
||||
// Get the worker local filter list
|
||||
FilterList* get_local_filters() const;
|
||||
@ -143,7 +143,7 @@ private:
|
||||
*
|
||||
* @return The newly created service or NULL if an error occurred
|
||||
*/
|
||||
Service* service_alloc(const char *name, const char *router, MXS_CONFIG_PARAMETER* params);
|
||||
Service* service_alloc(const char* name, const char* router, MXS_CONFIG_PARAMETER* params);
|
||||
|
||||
/**
|
||||
* Free a service
|
||||
@ -162,7 +162,7 @@ void service_free(Service* service);
|
||||
*
|
||||
* @param service Service to destroy
|
||||
*/
|
||||
void service_destroy(Service *service);
|
||||
void service_destroy(Service* service);
|
||||
|
||||
/**
|
||||
* Check whether a service can be destroyed
|
||||
@ -171,7 +171,7 @@ void service_destroy(Service *service);
|
||||
*
|
||||
* @return True if service can be destroyed
|
||||
*/
|
||||
bool service_can_be_destroyed(Service *service);
|
||||
bool service_can_be_destroyed(Service* service);
|
||||
|
||||
/**
|
||||
* @brief Shut all services down
|
||||
@ -211,10 +211,14 @@ bool service_thread_init();
|
||||
/**
|
||||
* Creating and adding new components to services
|
||||
*/
|
||||
SERV_LISTENER* serviceCreateListener(Service *service, const char *name,
|
||||
const char *protocol, const char *address,
|
||||
unsigned short port, const char *authenticator,
|
||||
const char *options, SSL_LISTENER *ssl);
|
||||
SERV_LISTENER* serviceCreateListener(Service* service,
|
||||
const char* name,
|
||||
const char* protocol,
|
||||
const char* address,
|
||||
unsigned short port,
|
||||
const char* authenticator,
|
||||
const char* options,
|
||||
SSL_LISTENER* ssl);
|
||||
|
||||
/**
|
||||
* @brief Remove a listener from use
|
||||
@ -226,9 +230,9 @@ SERV_LISTENER* serviceCreateListener(Service *service, const char *name,
|
||||
*
|
||||
* @return True if listener was found and removed
|
||||
*/
|
||||
bool service_remove_listener(Service *service, const char* target);
|
||||
bool service_remove_listener(Service* service, const char* target);
|
||||
|
||||
void serviceRemoveBackend(Service *service, const SERVER *server);
|
||||
void serviceRemoveBackend(Service* service, const SERVER* server);
|
||||
|
||||
/**
|
||||
* @brief Serialize a service to a file
|
||||
@ -241,20 +245,20 @@ void serviceRemoveBackend(Service *service, const SERVER *server);
|
||||
* @param service Service to serialize
|
||||
* @return False if the serialization of the service fails, true if it was successful
|
||||
*/
|
||||
bool service_serialize(const Service *service);
|
||||
bool service_serialize(const Service* service);
|
||||
|
||||
/**
|
||||
* Internal utility functions
|
||||
*/
|
||||
bool service_all_services_have_listeners(void);
|
||||
bool service_isvalid(Service *service);
|
||||
bool service_isvalid(Service* service);
|
||||
|
||||
/**
|
||||
* Check if a service uses @c servers
|
||||
* @param server Server that is queried
|
||||
* @return True if server is used by at least one service
|
||||
*/
|
||||
bool service_server_in_use(const SERVER *server);
|
||||
bool service_server_in_use(const SERVER* server);
|
||||
|
||||
/**
|
||||
* Check if filter is used by any service
|
||||
@ -276,7 +280,7 @@ void service_update_weights();
|
||||
* @param service Service where the parameters are added
|
||||
* @param param Parameters to add
|
||||
*/
|
||||
void service_add_parameters(Service *service, const MXS_CONFIG_PARAMETER *param);
|
||||
void service_add_parameters(Service* service, const MXS_CONFIG_PARAMETER* param);
|
||||
|
||||
/**
|
||||
* @brief Add parameters to a service
|
||||
@ -287,7 +291,7 @@ void service_add_parameters(Service *service, const MXS_CONFIG_PARAMETER *param)
|
||||
* @param key Parameter name
|
||||
* @param value Parameter value
|
||||
*/
|
||||
void service_add_parameter(Service *service, const char* key, const char* value);
|
||||
void service_add_parameter(Service* service, const char* key, const char* value);
|
||||
|
||||
/**
|
||||
* @brief Remove service parameter
|
||||
@ -295,7 +299,7 @@ void service_add_parameter(Service *service, const char* key, const char* value)
|
||||
* @param service Service to modify
|
||||
* @param key Parameter to remove
|
||||
*/
|
||||
void service_remove_parameter(Service *service, const char* key);
|
||||
void service_remove_parameter(Service* service, const char* key);
|
||||
|
||||
/**
|
||||
* @brief Replace service parameter
|
||||
@ -304,10 +308,10 @@ void service_remove_parameter(Service *service, const char* key);
|
||||
* @param key Parameter name
|
||||
* @param value Parameter value
|
||||
*/
|
||||
void service_replace_parameter(Service *service, const char* key, const char* value);
|
||||
void service_replace_parameter(Service* service, const char* key, const char* value);
|
||||
|
||||
// Internal search function
|
||||
Service* service_internal_find(const char *name);
|
||||
Service* service_internal_find(const char* name);
|
||||
|
||||
/**
|
||||
* @brief Check if a service uses a server
|
||||
@ -315,7 +319,7 @@ Service* service_internal_find(const char *name);
|
||||
* @param server Server being used
|
||||
* @return True if service uses the server
|
||||
*/
|
||||
bool serviceHasBackend(Service *service, SERVER *server);
|
||||
bool serviceHasBackend(Service* service, SERVER* server);
|
||||
|
||||
/**
|
||||
* @brief Start new a listener for a service
|
||||
@ -324,7 +328,7 @@ bool serviceHasBackend(Service *service, SERVER *server);
|
||||
* @param port Listener to start
|
||||
* @return True if listener was started
|
||||
*/
|
||||
bool serviceLaunchListener(Service *service, SERV_LISTENER *port);
|
||||
bool serviceLaunchListener(Service* service, SERV_LISTENER* port);
|
||||
|
||||
/**
|
||||
* @brief Find listener with specified properties.
|
||||
@ -353,8 +357,11 @@ SERV_LISTENER* service_find_listener(Service* service,
|
||||
* @param port Listener port
|
||||
* @return True if service has the listener
|
||||
*/
|
||||
bool serviceHasListener(Service* service, const char* name, const char* protocol,
|
||||
const char* address, unsigned short port);
|
||||
bool serviceHasListener(Service* service,
|
||||
const char* name,
|
||||
const char* protocol,
|
||||
const char* address,
|
||||
unsigned short port);
|
||||
|
||||
/**
|
||||
* @brief Check if a MaxScale service listens on a port
|
||||
@ -372,10 +379,10 @@ bool service_port_is_used(unsigned short port);
|
||||
*
|
||||
* @return True if the service has a listener with a matching name
|
||||
*/
|
||||
bool service_has_named_listener(Service *service, const char *name);
|
||||
bool service_has_named_listener(Service* service, const char* name);
|
||||
|
||||
// Required by MaxAdmin
|
||||
int service_enable_root(Service *service, int action);
|
||||
int service_enable_root(Service* service, int action);
|
||||
|
||||
/**
|
||||
* @brief Convert a service to JSON
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file core/maxscale/session.h - The private session interface
|
||||
@ -20,16 +20,17 @@
|
||||
|
||||
MXS_BEGIN_DECLS
|
||||
|
||||
#define SESSION_STATS_INIT {0}
|
||||
#define SESSION_STATS_INIT {0}
|
||||
#define MXS_DOWNSTREAM_INIT {0}
|
||||
#define MXS_UPSTREAM_INIT {0}
|
||||
#define MXS_UPSTREAM_INIT {0}
|
||||
#define SESSION_FILTER_INIT {0}
|
||||
|
||||
#define SESSION_INIT {.ses_chk_top = CHK_NUM_SESSION, \
|
||||
.stats = SESSION_STATS_INIT, .head = MXS_DOWNSTREAM_INIT, .tail = MXS_UPSTREAM_INIT, \
|
||||
.state = SESSION_STATE_ALLOC, .client_protocol_data = 0, .ses_chk_tail = CHK_NUM_SESSION}
|
||||
#define SESSION_INIT \
|
||||
{.ses_chk_top = CHK_NUM_SESSION, \
|
||||
.stats = SESSION_STATS_INIT, .head = MXS_DOWNSTREAM_INIT, .tail = MXS_UPSTREAM_INIT, \
|
||||
.state = SESSION_STATE_ALLOC, .client_protocol_data = 0, .ses_chk_tail = CHK_NUM_SESSION}
|
||||
|
||||
#define SESSION_PROTOCOL(x, type) DCB_PROTOCOL((x)->client_dcb, type)
|
||||
#define SESSION_PROTOCOL(x, type) DCB_PROTOCOL((x)->client_dcb, type)
|
||||
|
||||
/**
|
||||
* Filter type for the sessionGetList call
|
||||
@ -40,8 +41,8 @@ typedef enum
|
||||
SESSION_LIST_CONNECTION
|
||||
} SESSIONLISTFILTER;
|
||||
|
||||
int session_isvalid(MXS_SESSION *);
|
||||
const char *session_state(mxs_session_state_t);
|
||||
int session_isvalid(MXS_SESSION*);
|
||||
const char* session_state(mxs_session_state_t);
|
||||
|
||||
/**
|
||||
* Link a session to a backend DCB.
|
||||
@ -49,7 +50,7 @@ const char *session_state(mxs_session_state_t);
|
||||
* @param session The session to link with the dcb
|
||||
* @param dcb The backend DCB to be linked
|
||||
*/
|
||||
void session_link_backend_dcb(MXS_SESSION *session, struct dcb *dcb);
|
||||
void session_link_backend_dcb(MXS_SESSION* session, struct dcb* dcb);
|
||||
|
||||
/**
|
||||
* Unlink a session to a backend DCB.
|
||||
@ -57,15 +58,15 @@ void session_link_backend_dcb(MXS_SESSION *session, struct dcb *dcb);
|
||||
* @param session The session to unlink with the dcb
|
||||
* @param dcb The backend DCB to be unlinked
|
||||
*/
|
||||
void session_unlink_backend_dcb(MXS_SESSION *session, struct dcb *dcb);
|
||||
void session_unlink_backend_dcb(MXS_SESSION* session, struct dcb* dcb);
|
||||
|
||||
void printAllSessions();
|
||||
void printSession(MXS_SESSION *);
|
||||
void printSession(MXS_SESSION*);
|
||||
|
||||
void dprintSessionList(DCB *pdcb);
|
||||
void dprintAllSessions(struct dcb *);
|
||||
void dprintSession(struct dcb *, MXS_SESSION *);
|
||||
void dListSessions(struct dcb *);
|
||||
void dprintSessionList(DCB* pdcb);
|
||||
void dprintAllSessions(struct dcb*);
|
||||
void dprintSession(struct dcb*, MXS_SESSION*);
|
||||
void dListSessions(struct dcb*);
|
||||
|
||||
/**
|
||||
* @brief Get a session reference
|
||||
@ -78,6 +79,6 @@ void dListSessions(struct dcb *);
|
||||
*
|
||||
* @note The caller must free the session reference by calling session_put_ref
|
||||
*/
|
||||
MXS_SESSION* session_get_ref(MXS_SESSION *sessoin);
|
||||
MXS_SESSION* session_get_ref(MXS_SESSION* sessoin);
|
||||
|
||||
MXS_END_DECLS
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <maxscale/ccdefs.hh>
|
||||
|
||||
@ -38,18 +38,18 @@ typedef struct SESSION_VARIABLE
|
||||
} SESSION_VARIABLE;
|
||||
|
||||
typedef std::unordered_map<std::string, SESSION_VARIABLE> SessionVarsByName;
|
||||
typedef std::deque<std::vector<uint8_t>> SessionStmtQueue;
|
||||
typedef std::unordered_set<DCB*> DCBSet;
|
||||
typedef std::deque<std::vector<uint8_t>> SessionStmtQueue;
|
||||
typedef std::unordered_set<DCB*> DCBSet;
|
||||
|
||||
// Class that holds the session specific filter data
|
||||
class SessionFilter
|
||||
{
|
||||
public:
|
||||
|
||||
SessionFilter(const SFilterDef& f):
|
||||
filter(f),
|
||||
instance(nullptr),
|
||||
session(nullptr)
|
||||
SessionFilter(const SFilterDef& f)
|
||||
: filter(f)
|
||||
, instance(nullptr)
|
||||
, session(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@ -58,7 +58,7 @@ public:
|
||||
MXS_FILTER_SESSION* session;
|
||||
};
|
||||
|
||||
class Session: public MXS_SESSION
|
||||
class Session : public MXS_SESSION
|
||||
{
|
||||
public:
|
||||
using FilterList = std::vector<SessionFilter>;
|
||||
@ -72,9 +72,11 @@ public:
|
||||
return m_filters;
|
||||
}
|
||||
|
||||
bool add_variable(const char* name, session_variable_handler_t handler, void* context);
|
||||
char* set_variable_value(const char* name_begin, const char* name_end,
|
||||
const char* value_begin, const char* value_end);
|
||||
bool add_variable(const char* name, session_variable_handler_t handler, void* context);
|
||||
char* set_variable_value(const char* name_begin,
|
||||
const char* name_end,
|
||||
const char* value_begin,
|
||||
const char* value_end);
|
||||
bool remove_variable(const char* name, void** context);
|
||||
void retain_statement(GWBUF* pBuffer);
|
||||
void dump_statements() const;
|
||||
@ -99,10 +101,9 @@ public:
|
||||
private:
|
||||
FilterList m_filters;
|
||||
SessionVarsByName m_variables;
|
||||
SessionStmtQueue m_last_statements; /*< The N last statements by the client */
|
||||
DCBSet m_dcb_set; /*< Set of associated backend DCBs */
|
||||
SessionStmtQueue m_last_statements;/*< The N last statements by the client */
|
||||
DCBSet m_dcb_set; /*< Set of associated backend DCBs */
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
std::unique_ptr<ResultSet> sessionGetList();
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
/**
|
||||
* @file
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <maxscale/ccdefs.hh>
|
||||
#include <ctype.h>
|
||||
@ -40,7 +40,7 @@ namespace maxscale
|
||||
class TrxBoundaryParser : public maxscale::CustomParser
|
||||
{
|
||||
TrxBoundaryParser(const TrxBoundaryParser&);
|
||||
TrxBoundaryParser& operator = (const TrxBoundaryParser&);
|
||||
TrxBoundaryParser& operator=(const TrxBoundaryParser&);
|
||||
|
||||
public:
|
||||
enum token_t
|
||||
@ -154,7 +154,10 @@ private:
|
||||
{
|
||||
#ifdef TBP_LOG_UNEXPECTED_AND_EXHAUSTED
|
||||
MXS_NOTICE("Transaction tracking: In statement '%.*s', unexpected token at '%.*s'.",
|
||||
(int)m_len, m_pSql, (int)(m_pEnd - m_pI), m_pI);
|
||||
(int)m_len,
|
||||
m_pSql,
|
||||
(int)(m_pEnd - m_pI),
|
||||
m_pI);
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -564,7 +567,8 @@ private:
|
||||
|
||||
if (zWord == pEnd)
|
||||
{
|
||||
if ((pI == m_pEnd) || (!isalpha(*pI))) // Handwritten isalpha not faster than library version.
|
||||
if ((pI == m_pEnd) || (!isalpha(*pI))) // Handwritten isalpha not faster than library
|
||||
// version.
|
||||
{
|
||||
m_pI = pI;
|
||||
}
|
||||
@ -608,7 +612,8 @@ private:
|
||||
if (m_pI != m_pEnd)
|
||||
{
|
||||
MXS_INFO("Non-space data found after semi-colon: '%.*s'.",
|
||||
(int)(m_pEnd - m_pI), m_pI);
|
||||
(int)(m_pEnd - m_pI),
|
||||
m_pI);
|
||||
}
|
||||
|
||||
token = PARSER_EXHAUSTED;
|
||||
@ -802,5 +807,4 @@ private:
|
||||
return token;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -10,7 +10,7 @@
|
||||
* of this software will be governed by version 2 or later of the General
|
||||
* Public License.
|
||||
*/
|
||||
#pragma once
|
||||
#pragma once
|
||||
|
||||
#include <maxscale/worker.h>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user