Make lines of mqfilter.c less that 110 characters long.

Untabified as well.
This commit is contained in:
Johan Wikman
2016-01-08 11:23:42 +02:00
parent cba190f84c
commit 97282fca97

View File

@ -29,13 +29,15 @@
* The filter makes no attempt to deal with queries that do not fit
* in a single GWBUF or result sets that span multiple GWBUFs.
*
* To use a SSL connection the CA certificate, the client certificate and the client public key must be provided.
* To use a SSL connection the CA certificate, the client certificate and the client public
* key must be provided.
* By default this filter uses a TCP connection.
*@verbatim
* The options for this filter are:
*
* logging_trigger Set the logging level
* logging_strict Sets whether to trigger when any of the parameters match or only if all parameters match
* logging_strict Sets whether to trigger when any of the parameters match or only if
* all parameters match
* logging_log_all Log only SELECT, UPDATE, DELETE and INSERT or all possible queries
* hostname The server hostname where the messages are sent
* port Port to send the messages to
@ -52,7 +54,8 @@
*
* The logging trigger levels are:
* all Log everything
* source Trigger on statements originating from a particular source (database user and host combination)
* source Trigger on statements originating from a particular source (database user and
* host combination)
* schema Trigger on a certain schema
* object Trigger on a particular database object (table or view)
*@endverbatim
@ -313,8 +316,8 @@ init_conn(MQ_INSTANCE *my_instance)
if ((my_instance->sock = amqp_ssl_socket_new(my_instance->conn)) != NULL)
{
if ((amqp_ok = amqp_ssl_socket_set_cacert(my_instance->sock, my_instance->ssl_CA_cert)) != AMQP_STATUS_OK)
amqp_ok = amqp_ssl_socket_set_cacert(my_instance->sock, my_instance->ssl_CA_cert);
if (amqp_ok != AMQP_STATUS_OK)
{
MXS_ERROR("Failed to set CA certificate: %s", amqp_error_string2(amqp_ok));
goto cleanup;
@ -345,13 +348,15 @@ init_conn(MQ_INSTANCE *my_instance)
}
/**Socket creation was successful, trying to open the socket*/
if ((amqp_ok = amqp_socket_open(my_instance->sock, my_instance->hostname, my_instance->port)) != AMQP_STATUS_OK)
amqp_ok = amqp_socket_open(my_instance->sock, my_instance->hostname, my_instance->port);
if (amqp_ok != AMQP_STATUS_OK)
{
MXS_ERROR("Failed to open socket: %s", amqp_error_string2(amqp_ok));
goto cleanup;
}
amqp_rpc_reply_t reply;
reply = amqp_login(my_instance->conn, my_instance->vhost, 0, AMQP_DEFAULT_FRAME_SIZE, 0, AMQP_SASL_METHOD_PLAIN, my_instance->username, my_instance->password);
reply = amqp_login(my_instance->conn, my_instance->vhost, 0, AMQP_DEFAULT_FRAME_SIZE, 0,
AMQP_SASL_METHOD_PLAIN, my_instance->username, my_instance->password);
if (reply.reply_type != AMQP_RESPONSE_NORMAL)
{
MXS_ERROR("Login to RabbitMQ server failed.");
@ -383,17 +388,20 @@ init_conn(MQ_INSTANCE *my_instance)
{
if (reply.reply.id == AMQP_CHANNEL_CLOSE_METHOD)
{
amqp_send_method(my_instance->conn, my_instance->channel, AMQP_CHANNEL_CLOSE_OK_METHOD, NULL);
amqp_send_method(my_instance->conn, my_instance->channel,
AMQP_CHANNEL_CLOSE_OK_METHOD, NULL);
}
else if (reply.reply.id == AMQP_CONNECTION_CLOSE_METHOD)
{
amqp_send_method(my_instance->conn, my_instance->channel, AMQP_CONNECTION_CLOSE_OK_METHOD, NULL);
amqp_send_method(my_instance->conn, my_instance->channel,
AMQP_CONNECTION_CLOSE_OK_METHOD, NULL);
}
my_instance->channel++;
amqp_channel_open(my_instance->conn, my_instance->channel);
amqp_exchange_delete(my_instance->conn, my_instance->channel, amqp_cstring_bytes(my_instance->exchange), 0);
amqp_exchange_delete(my_instance->conn, my_instance->channel,
amqp_cstring_bytes(my_instance->exchange), 0);
amqp_exchange_declare(my_instance->conn, my_instance->channel,
amqp_cstring_bytes(my_instance->exchange),
amqp_cstring_bytes(my_instance->exchange_type),
@ -775,7 +783,8 @@ createInstance(char **options, FILTER_PARAMETER **params)
if (my_instance->use_ssl)
{
amqp_set_initialize_ssl_library(0); /**Assume the underlying SSL library is already initialized*/
/**Assume the underlying SSL library is already initialized*/
amqp_set_initialize_ssl_library(0);
}
/**Connect to the server*/
@ -1161,7 +1170,8 @@ routeQuery(FILTER *instance, void *session, GWBUF *queue)
{
if (strcmp(my_instance->src_trg->user[i], sessusr) == 0)
{
MXS_INFO("Trigger is TRG_SOURCE: user: %s = %s", my_instance->src_trg->user[i], sessusr);
MXS_INFO("Trigger is TRG_SOURCE: user: %s = %s",
my_instance->src_trg->user[i], sessusr);
src_ok = true;
break;
}
@ -1178,7 +1188,8 @@ routeQuery(FILTER *instance, void *session, GWBUF *queue)
if (strcmp(my_instance->src_trg->host[i], sesshost) == 0)
{
MXS_INFO("Trigger is TRG_SOURCE: host: %s = %s", my_instance->src_trg->host[i], sesshost);
MXS_INFO("Trigger is TRG_SOURCE: host: %s = %s",
my_instance->src_trg->host[i], sesshost);
src_ok = true;
break;
}
@ -1217,7 +1228,8 @@ routeQuery(FILTER *instance, void *session, GWBUF *queue)
if (strcmp(tmp, my_instance->shm_trg->objects[i]) == 0)
{
MXS_INFO("Trigger is TRG_SCHEMA: %s = %s", tmp, my_instance->shm_trg->objects[i]);
MXS_INFO("Trigger is TRG_SCHEMA: %s = %s",
tmp, my_instance->shm_trg->objects[i]);
schema_ok = true;
break;
@ -1241,7 +1253,8 @@ routeQuery(FILTER *instance, void *session, GWBUF *queue)
if (strcmp(my_session->db, my_instance->shm_trg->objects[i]) == 0)
{
MXS_INFO("Trigger is TRG_SCHEMA: %s = %s", my_session->db, my_instance->shm_trg->objects[i]);
MXS_INFO("Trigger is TRG_SCHEMA: %s = %s",
my_session->db, my_instance->shm_trg->objects[i]);
schema_ok = true;
break;
@ -1291,7 +1304,8 @@ routeQuery(FILTER *instance, void *session, GWBUF *queue)
if (!strcmp(tbnm, my_instance->obj_trg->objects[i]))
{
obj_ok = true;
MXS_INFO("Trigger is TRG_OBJECT: %s = %s", my_instance->obj_trg->objects[i], sesstbls[j]);
MXS_INFO("Trigger is TRG_OBJECT: %s = %s",
my_instance->obj_trg->objects[i], sesstbls[j]);
break;
}
@ -1479,7 +1493,8 @@ unsigned int consume_leitoi(unsigned char** c)
}
/**
* Converts length-encoded strings to character strings and advanced the pointer to the next unrelated byte.
* Converts length-encoded strings to character strings and advanced
* the pointer to the next unrelated byte.
* The caller is responsible for freeing the allocated memory.
* @param c Pointer to the first byte of a valid packet.
* @return The newly allocated string or NULL of an error occurred