This commit is contained in:
Markus Makela
2014-09-04 10:36:59 +03:00
80 changed files with 2981 additions and 1082 deletions

View File

@ -81,7 +81,7 @@ tags:
(cd hint; touch depend.mk; make tags)
depend:
@rm -f depend.mk
@$(DEL) depend.mk
cc -M $(CFLAGS) $(SRCS) > depend.mk
(cd hint; touch depend.mk; make depend)

View File

@ -17,6 +17,9 @@
*/
/**
* @file qlafilter.c - Quary Log All Filter
* @verbatim
*
* QLA Filter - Query Log All. A primitive query logging filter, simply
* used to verify the filter mechanism for downstream filters. All queries
* that are passed through the filter will be written to file.
@ -33,6 +36,7 @@
* 11/06/2014 Mark Riddoch Addition of source and match parameters
* 19/06/2014 Mark Riddoch Addition of user parameter
*
* @endverbatim
*/
#include <stdio.h>
#include <fcntl.h>
@ -154,6 +158,7 @@ GetModuleObject()
* within MaxScale.
*
* @param options The options for this filter
* @param params The array of name/value pair parameters for the filter
*
* @return The instance data for this new instance
*/

View File

@ -27,7 +27,8 @@
extern int lm_enabled_logfiles_bitmask;
/**
* regexfilter.c - a very simple regular expression rewrite filter.
* @file regexfilter.c - a very simple regular expression rewrite filter.
* @verbatim
*
* A simple regular expression query rewrite filter.
* Two parameters should be defined in the filter configuration
@ -39,6 +40,7 @@ extern int lm_enabled_logfiles_bitmask;
*
* Date Who Description
* 19/06/2014 Mark Riddoch Addition of source and user parameters
* @endverbatim
*/
MODULE_INFO info = {
@ -132,6 +134,7 @@ GetModuleObject()
* within MaxScale.
*
* @param options The options for this filter
* @param params The array of name/value pair parameters for the filter
*
* @return The instance data for this new instance
*/

View File

@ -18,6 +18,7 @@
/**
* @file tee.c A filter that splits the processing pipeline in two
* @verbatim
*
* Conditionally duplicate requests and send the duplicates to another service
* within MaxScale.
@ -41,6 +42,7 @@
* 20/06/2014 Mark Riddoch Initial implementation
* 24/06/2014 Mark Riddoch Addition of support for multi-packet queries
*
* @endverbatim
*/
#include <stdio.h>
#include <fcntl.h>
@ -162,6 +164,7 @@ GetModuleObject()
* within MaxScale.
*
* @param options The options for this filter
* @param params The array of name/value pair parameters for the filter
*
* @return The instance data for this new instance
*/

View File

@ -396,8 +396,9 @@ void print_help()
{
printf("\nFilter Test Harness\n\n"
"List of commands:\n %-32s%s\n %-32s%s\n %-32s%s\n %-32s%s\n %-32s%s\n"
"%-32s%s\n %-32s%s\n %-32s%s\n %-32s%s\n %-32s%s\n %-32s%s\n %-32s%s\n"
"List of commands:\n %-32s%s\n %-32s%s\n %-32s%s\n %-32s%s\n %-32s%s\n "
"%-32s%s\n %-32s%s\n %-32s%s\n %-32s%s\n %-32s%s\n %-32s%s\n %-32s%s\n "
"%-32s%s\n %-32s%s\n"
,"help","Prints this help message."
,"run","Feeds the contents of the buffer to the filter chain."
,"add <filter name>","Loads a filter and appeds it to the end of the chain."
@ -407,6 +408,8 @@ void print_help()
,"config <file name>","Loads filter configurations from a file."
,"in <file name>","Source file for the SQL statements."
,"out <file name>","Destination file for the SQL statements. Defaults to stdout if no parameters were passed."
,"threads <number>","Sets the amount of threads to use"
,"sessions <number>","How many sessions to create for each filter. This clears all loaded filters."
,"quiet","Print only error messages."
,"verbose","Print everything."
,"exit","Exit the program"
@ -490,9 +493,14 @@ FILTER_PARAMETER** read_params(int* paramc)
int routeQuery(void* ins, void* session, GWBUF* queue)
{
int buffsz = (int)(queue->end - (queue->start + 5));
unsigned int buffsz = 0;
unsigned char* ptr = (void*)queue->start;
char *qstr;
buffsz += *ptr++;
buffsz += *ptr++ << 8;
buffsz += *ptr++ << 16;
if(queue->hint){
buffsz += 40;
if(queue->hint->data){
@ -506,7 +514,7 @@ int routeQuery(void* ins, void* session, GWBUF* queue)
qstr = calloc(buffsz,sizeof(char));
if(qstr){
memcpy(qstr,queue->start + 5,(int)(queue->end - 1 - (queue->start + 5)));
memcpy(qstr,queue->start + 5,buffsz - 1);
if(queue->hint){
char *ptr = qstr + (int)(queue->end - 1 - (queue->start + 5));
@ -621,9 +629,9 @@ void manual_query()
gwbuf_set_type(instance.buffer[0],GWBUF_TYPE_MYSQL);
memcpy(instance.buffer[0]->sbuf->data + 5,query,qlen);
instance.buffer[0]->sbuf->data[0] = (qlen>>0&1)|(qlen>>1&1) << 1;
instance.buffer[0]->sbuf->data[1] = (qlen>>2&1)|(qlen>>3&1) << 1;
instance.buffer[0]->sbuf->data[2] = (qlen>>4&1)|(qlen>>5&1) << 1;
instance.buffer[0]->sbuf->data[0] = (qlen);
instance.buffer[0]->sbuf->data[1] = (qlen << 8);
instance.buffer[0]->sbuf->data[2] = (qlen << 16);
instance.buffer[0]->sbuf->data[3] = 0x00;
instance.buffer[0]->sbuf->data[4] = 0x03;
@ -706,9 +714,9 @@ int load_query()
memcpy(tmpbff[i]->sbuf->data + 5,query_list[i],strnlen(query_list[i],buff_sz));
qlen = strnlen(query_list[i],buff_sz);
tmpbff[i]->sbuf->data[0] = (qlen>>0&1)|(qlen>>1&1) << 1;
tmpbff[i]->sbuf->data[1] = (qlen>>2&1)|(qlen>>3&1) << 1;
tmpbff[i]->sbuf->data[2] = (qlen>>4&1)|(qlen>>5&1) << 1;
tmpbff[i]->sbuf->data[0] = qlen;
tmpbff[i]->sbuf->data[1] = (qlen << 8);
tmpbff[i]->sbuf->data[2] = (qlen << 16);
tmpbff[i]->sbuf->data[3] = 0x00;
tmpbff[i]->sbuf->data[4] = 0x03;

View File

@ -21,13 +21,15 @@
#include <modutil.h>
/**
* testfilter.c - a very simple test filter.
* @file testfilter.c - a very simple test filter.
* @verbatim
*
* This filter is a very simple example used to test the filter API,
* it merely counts the number of statements that flow through the
* filter pipeline.
*
* Reporting is done via the diagnostics print routine.
* @endverbatim
*/
MODULE_INFO info = {
@ -114,6 +116,7 @@ GetModuleObject()
* within MaxScale.
*
* @param options The options for this filter
* @param params The array of name/value pair parameters for the filter
*
* @return The instance data for this new instance
*/

View File

@ -17,6 +17,9 @@
*/
/**
* @file topfilter.c - Top N Longest Running Queries
* @verbatim
*
* TOPN Filter - Query Log All. A primitive query logging filter, simply
* used to verify the filter mechanism for downstream filters. All queries
* that are passed through the filter will be written to file.
@ -30,6 +33,8 @@
*
* Date Who Description
* 18/06/2014 Mark Riddoch Addition of source and user filters
*
* @endverbatim
*/
#include <stdio.h>
#include <fcntl.h>
@ -172,6 +177,7 @@ GetModuleObject()
* within MaxScale.
*
* @param options The options for this filter
* @param params The array of name/value pair parameters for the filter
*
* @return The instance data for this new instance
*/