diff --git a/build_gateway.inc b/build_gateway.inc index 83ffaf762..0e1d6b75f 100644 --- a/build_gateway.inc +++ b/build_gateway.inc @@ -12,7 +12,7 @@ # # Set debug flags # -DEBUG := +DEBUG := ${MAXSCALE_DEBUG} # # Set build env @@ -22,7 +22,7 @@ UNIX := Y # # Set MaxScale branch directory # -ROOT_PATH := $(HOME)/src/bazaar/tmp/maxscale +ROOT_PATH := $(HOME)/${MAXSCALE_SOURCE} INC_PATH := $(HOME)/usr/include # @@ -38,7 +38,7 @@ MYSQL_HEADERS := -I$(INC_PATH) -I$(MYSQL_ROOT)/ -I$(MYSQL_ROOT)/private/ -I$(MYS # # Set DYNLIB=Y if you want to link MaxScale with dynamic embedded lib # -DYNLIB := +DYNLIB := ${MAXSCALE_DYNLIB} # # Set path to Embedded MySQL Server @@ -51,3 +51,4 @@ endif # Set path to MySQL errors file # ERRMSG := $(HOME)/usr/share/mysql + diff --git a/server/core/buffer.c b/server/core/buffer.c index d3278a505..26c2c1439 100644 --- a/server/core/buffer.c +++ b/server/core/buffer.c @@ -298,11 +298,13 @@ int rval = 0; } /** - * Trim bytes form the end of a GWBUF structure + * Trim bytes form the end of a GWBUF structure. If the + * buffer has n_bytes or less then it will be freed and + * NULL will be returned. * * @param buf The buffer to trim - * @param nbytes The number of bytes to trim off - * @return The buffer chain + * @param n_bytes The number of bytes to trim off + * @return The buffer chain or NULL if buffer has <= n_bytes */ GWBUF * gwbuf_trim(GWBUF *buf, unsigned int n_bytes) diff --git a/server/core/dcb.c b/server/core/dcb.c index 5a280c3b0..382940626 100644 --- a/server/core/dcb.c +++ b/server/core/dcb.c @@ -1706,14 +1706,15 @@ int gw_write( /** * Add a callback * - * Duplicate registrations are not allowed, therefore an error will be returned if - * the specific function, reason and userdata triple are already registered. + * Duplicate registrations are not allowed, therefore an error will be + * returned if the specific function, reason and userdata triple + * are already registered. * An error will also be returned if the is insufficient memeory available to * create the registration. * * @param dcb The DCB to add the callback to * @param reason The callback reason - * @param cb The callback function to call + * @param callback The callback function to call * @param userdata User data to send in the call * @return Non-zero (true) if the callback was added */ @@ -1769,7 +1770,7 @@ int rval = 1; * * @param dcb The DCB to add the callback to * @param reason The callback reason - * @param cb The callback function to call + * @param callback The callback function to call * @param userdata User data to send in the call * @return Non-zero (true) if the callback was removed */ @@ -1842,7 +1843,7 @@ DCB_CALLBACK *cb, *nextcb; /** * Check the passed DCB to ensure it is in the list of allDCBS * - * @param DCB The DCB to check + * @param dcb The DCB to check * @return 1 if the DCB is in the list, otherwise 0 */ int @@ -1939,8 +1940,8 @@ void dcb_call_foreach ( * Null protocol write routine used for cloned dcb's. It merely consumes * buffers written on the cloned DCB. * - * @params dcb The descriptor control block - * @params buf The buffer beign written + * @param dcb The descriptor control block + * @param buf The buffer being written * @return Always returns a good write operation result */ static int diff --git a/server/core/filter.c b/server/core/filter.c index baeea21d7..405a01470 100644 --- a/server/core/filter.c +++ b/server/core/filter.c @@ -39,8 +39,8 @@ extern int lm_enabled_logfiles_bitmask; -static SPINLOCK filter_spin = SPINLOCK_INIT; -static FILTER_DEF *allFilters = NULL; +static SPINLOCK filter_spin = SPINLOCK_INIT; /**< Protects the list of all filters */ +static FILTER_DEF *allFilters = NULL; /**< The list of all filters */ /** * Allocate a new filter within MaxScale @@ -79,7 +79,7 @@ FILTER_DEF *filter; /** * Deallocate the specified filter * - * @param server The service to deallocate + * @param filter The filter to deallocate * @return Returns true if the server was freed */ void @@ -243,8 +243,8 @@ int i; /** * Add a router option to a service * - * @param service The service to add the router option to - * @param option The option string + * @param filter The filter to add the option to + * @param option The option string */ void filterAddOption(FILTER_DEF *filter, char *option) @@ -273,7 +273,7 @@ int i; /** * Add a router parameter to a service * - * @param service The service to add the router option to + * @param filter The filter to add the parameter to * @param name The parameter name * @param value The parameter value */ diff --git a/server/core/load_utils.c b/server/core/load_utils.c index 93cdf95f6..cba0c6533 100644 --- a/server/core/load_utils.c +++ b/server/core/load_utils.c @@ -281,6 +281,7 @@ MODULES *mod = registered; * @param dlhandle The handle returned by dlopen * @param version The version string returned by the module * @param modobj The module object + * @param mod_info The module information */ static void register_module(const char *module, const char *type, void *dlhandle, char *version, void *modobj, MODULE_INFO *mod_info) diff --git a/server/core/maxpasswd.c b/server/core/maxpasswd.c index ac8b0a042..d11980ba3 100644 --- a/server/core/maxpasswd.c +++ b/server/core/maxpasswd.c @@ -34,7 +34,7 @@ * Encrypt a password for storing in the MaxScale.cnf file * * @param argc Argument count - * @param arv Argument vector + * @param argv Argument vector */ int main(int argc, char **argv) diff --git a/server/core/monitor.c b/server/core/monitor.c index d7b53f5b7..85ff878d7 100644 --- a/server/core/monitor.c +++ b/server/core/monitor.c @@ -207,7 +207,8 @@ MONITOR *ptr; /** * Show a single monitor * - * @param dcb DCB for printing output + * @param dcb DCB for printing output + * @param monitor The monitor to print information regarding */ void monitorShow(DCB *dcb, MONITOR *monitor) @@ -303,7 +304,7 @@ monitorSetInterval (MONITOR *mon, unsigned long interval) * Enable Replication Heartbeat support in monitor. * * @param mon The monitor instance - * @param interval The sampling interval in milliseconds + * @param replication_heartbeat The replication heartbeat */ void monitorSetReplicationHeartbeat(MONITOR *mon, int replication_heartbeat) diff --git a/server/core/server.c b/server/core/server.c index bfe5e4d04..5a75756ed 100644 --- a/server/core/server.c +++ b/server/core/server.c @@ -148,8 +148,7 @@ server_set_unique_name(SERVER *server, char *name) * Find an existing server using the unique section name in * configuration file * - * @param servname The Server name or address - * @param port The server port + * @param name The Server name defined in the header file * @return The server or NULL if not found */ SERVER * diff --git a/server/core/test/makefile b/server/core/test/makefile index d3948575d..7f6831082 100644 --- a/server/core/test/makefile +++ b/server/core/test/makefile @@ -8,7 +8,20 @@ include ../../../makefile.inc include ../../../test.inc CC=cc -TESTLOG := $(shell pwd)/testhash.log +TESTLOG := $(shell pwd)/testcore.log + +LOGPATH := $(ROOT_PATH)/log_manager +UTILSPATH := $(ROOT_PATH)/utils + +LDFLAGS=-rdynamic -L$(LOGPATH) \ + -Wl,-rpath,$(DEST)/lib \ + -Wl,-rpath,$(LOGPATH) -Wl,-rpath,$(UTILSPATH) \ + -Wl,-rpath,$(EMBEDDED_LIB) + +LIBS= -lz -lm -lcrypt -lcrypto -ldl -laio -lrt -pthread -llog_manager \ + -L../../inih/extra -linih -lssl -lstdc++ + +TESTS=testhash testspinlock testfilter testadminusers cleantests: - $(DEL) *.o @@ -20,23 +33,41 @@ testall: $(MAKE) DEBUG=Y buildtests $(MAKE) runtests -buildtests : +buildtests : $(TESTS) + +testhash: testhash.c $(CC) $(CFLAGS) \ -I$(ROOT_PATH)/server/include \ -I$(ROOT_PATH)/utils \ testhash.c ../hashtable.o ../atomic.o ../spinlock.o -o testhash -runtests: +testspinlock: testspinlock.c + $(CC) $(CFLAGS) \ + -I$(ROOT_PATH)/server/include \ + -I$(ROOT_PATH)/utils \ + testspinlock.c ../spinlock.o ../atomic.o ../thread.o -o testspinlock + +testfilter: testfilter.c libcore.a + $(CC) $(CFLAGS) $(LDFLAGS) \ + -I$(ROOT_PATH)/server/include \ + -I$(ROOT_PATH)/utils \ + testfilter.c libcore.a $(UTILSPATH)/skygw_utils.o $(LIBS) -o testfilter + +testadminusers: testadminusers.c libcore.a + $(CC) $(CFLAGS) $(LDFLAGS) \ + -I$(ROOT_PATH)/server/include \ + -I$(ROOT_PATH)/utils \ + testadminusers.c libcore.a $(UTILSPATH)/skygw_utils.o $(LIBS) -o testadminusers + +libcore.a: ../*.o + ar rv libcore.a ../*.o + +runtests: $(TESTS) @echo "" > $(TESTLOG) @echo "-------------------------------" >> $(TESTLOG) @echo $(shell date) >> $(TESTLOG) @echo "Test MaxScale core" >> $(TESTLOG) @echo "-------------------------------" >> $(TESTLOG) - @ -./testhash 2>> $(TESTLOG) -ifeq ($?,0) - @echo "MaxScale core PASSED" >> $(TESTLOG) -else - @echo "MaxScale core FAILED" >> $(TESTLOG) -endif + $(foreach var,$(TESTS),./runtest.sh $(var) $(TESTLOG);) @echo "" >> $(TESTLOG) - @cat $(TESTLOG) >> $(TEST_MAXSCALE_LOG) \ No newline at end of file + @cat $(TESTLOG) >> $(TEST_MAXSCALE_LOG) diff --git a/server/core/test/runtest.sh b/server/core/test/runtest.sh new file mode 100755 index 000000000..434d45701 --- /dev/null +++ b/server/core/test/runtest.sh @@ -0,0 +1,10 @@ +#!/bin/bash +test=$1 +log=$2 +echo Running test $test >> $log +./$test 2>> $log +if [ $? -ne 0 ]; then + echo $test " " FAILED >> $log +else + echo $test " " PASSED >> $log +fi diff --git a/server/core/test/testadminusers.c b/server/core/test/testadminusers.c new file mode 100644 index 000000000..00ec3a452 --- /dev/null +++ b/server/core/test/testadminusers.c @@ -0,0 +1,278 @@ +/* + * This file is distributed as part of MaxScale. It is free + * software: you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation, + * version 2. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright SkySQL Ab 2014 + */ + +/** + * + * @verbatim + * Revision History + * + * Date Who Description + * 20-08-2014 Mark Riddoch Initial implementation + * + * @endverbatim + */ + +#include +#include +#include + +#include + + +/** + * test1 default user + * + * Test that the username password admin/skysql is accepted if no users + * have been created and that no other users are accepted + * + * WARNING: $MAXSCALE_HOME/etc/passwd must be removed before this test is run + */ +static int +test1() +{ + if (admin_verify("admin", "skysql") == 0) + { + fprintf(stderr, "admin_verify: test 1.1 (default user) failed.\n"); + return 1; + } + if (admin_verify("bad", "user")) + { + fprintf(stderr, "admin_verify: test 1.2 (wrong user) failed.\n"); + return 1; + } + + return 0; +} + +/** + * test2 creating users + * + * Create a user + * Try to create a duplicate user - expects a failure + * Remove that user - expected to fail as one user must always remain + */ +static int +test2() +{ +char *err; + + if ((err = admin_add_user("user0", "passwd0")) != NULL) + { + fprintf(stderr, "admin_add_user: test 2.1 (add user) failed, %s.\n", err); + + return 1; + } + if (admin_add_user("user0", "passwd0") == NULL) + { + fprintf(stderr, "admin_add_user: test 2.2 (add user) failed, du;plicate.\n"); + + return 1; + } + + /* Deleting the last user is forbidden so we expect this to fail */ + if ((err = admin_remove_user("user0", "passwd0")) == NULL) + { + fprintf(stderr, "admin_remove_user: test 2.3 (add user) failed, %s.\n", err); + + return 1; + } + return 0; +} + +/** + * test3 search/verify users + * + * Create a user + * Search for that user + * Search for a non-existant user + * Remove the user + * Search for the user that was removed + */ +static int +test3() +{ +char *err; + + if ((err = admin_add_user("user1", "passwd1")) != NULL) + { + fprintf(stderr, "admin_add_user: test 3.1 (add user) failed, %s.\n", err); + + return 1; + } + + if (admin_search_user("user1") == 0) + { + fprintf(stderr, "admin_search_user: test 3.2 (search user) failed.\n"); + + return 1; + } + if (admin_search_user("user2") != 0) + { + fprintf(stderr, "admin_search_user: test 3.3 (search user) failed, unexpeted user found.\n"); + + return 1; + } + + if ((err = admin_remove_user("user1", "passwd1")) != NULL) + { + fprintf(stderr, "admin_remove_user: test 3.4 (add user) failed, %s.\n", err); + + return 1; + } + + if (admin_search_user("user1")) + { + fprintf(stderr, "admin_search_user: test 3.5 (search user) failed - user was deleted.\n"); + + return 1; + } + return 0; +} + +/** + * test4 verify users + * + * Create a numebr of users + * search for each user in turn + * verify each user in turn (password verification) + * Verify each user in turn with incorrect password + * Randomly verify each user + * Remove each user + */ +static int +test4() +{ +char *err, user[40], passwd[40]; +int i, n_users = 50; + + for (i = 1; i < n_users; i++) + { + sprintf(user, "user%d", i); + sprintf(passwd, "passwd%d", i); + if ((err = admin_add_user(user, passwd)) != NULL) + { + fprintf(stderr, "admin_add_user: test 4.1 (add user) failed, %s.\n", err); + + return 1; + } + } + + for (i = 1; i < n_users; i++) + { + sprintf(user, "user%d", i); + if (admin_search_user(user) == 0) + { + fprintf(stderr, "admin_search_user: test 4.2 (search user) failed.\n"); + + return 1; + } + } + for (i = 1; i < n_users; i++) + { + sprintf(user, "user%d", i); + sprintf(passwd, "passwd%d", i); + if (admin_verify(user, passwd) == 0) + { + fprintf(stderr, "admin_verify: test 4.3 (search user) failed.\n"); + + return 1; + } + } + + for (i = 1; i < n_users; i++) + { + sprintf(user, "user%d", i); + sprintf(passwd, "badpasswd%d", i); + if (admin_verify(user, passwd) != 0) + { + fprintf(stderr, "admin_verify: test 4.4 (search user) failed.\n"); + + return 1; + } + } + srand(time(0)); + for (i = 1; i < 1000; i++) + { + int j; + j = rand() % n_users; + if (j == 0) + j = 1; + sprintf(user, "user%d", j); + sprintf(passwd, "passwd%d", j); + if (admin_verify(user, passwd) == 0) + { + fprintf(stderr, "admin_verify: test 4.5 (random) failed.\n"); + + return 1; + } + } + + for (i = 1; i < n_users; i++) + { + sprintf(user, "user%d", i); + sprintf(passwd, "passwd%d", i); + if ((err = admin_remove_user(user, passwd)) != NULL) + { + fprintf(stderr, "admin_remove_user: test 4.6 (add user) failed, %s.\n", err); + + return 1; + } + } + return 0; +} + +/** + * test5 remove first user + * + * Create a user so that user0 may be removed + * Remove the first user created (user0) + */ +static int +test5() +{ +char *err; + + if ((err = admin_add_user("user", "passwd")) != NULL) + { + fprintf(stderr, "admin_add_user: test 5.1 (add user) failed, %s.\n", err); + + return 1; + } + if ((err = admin_remove_user("user0", "passwd0")) != NULL) + { + fprintf(stderr, "admin_remove_user: test 5.2 (add user) failed, %s.\n", err); + + return 1; + } + return 0; +} + +int +main(int argc, char **argv) +{ +int result = 0; + + result += test1(); + result += test2(); + result += test3(); + result += test4(); + result += test5(); + + exit(result); +} + diff --git a/server/core/test/testfilter.c b/server/core/test/testfilter.c new file mode 100644 index 000000000..55f7fadf3 --- /dev/null +++ b/server/core/test/testfilter.c @@ -0,0 +1,155 @@ +/* + * This file is distributed as part of MaxScale. It is free + * software: you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation, + * version 2. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright SkySQL Ab 2014 + */ + +/** + * + * @verbatim + * Revision History + * + * Date Who Description + * 19-08-2014 Mark Riddoch Initial implementation + * + * @endverbatim + */ + +#include +#include +#include + +#include + + +/** + * test1 Filter creation, finding and deletion + * + */ +static int +test1() +{ +FILTER_DEF *f1, *f2; + + if ((f1 = filter_alloc("test1", "module")) == NULL) + { + fprintf(stderr, "filter_alloc: test 1 failed.\n"); + return 1; + } + if ((f2 = filter_find("test1")) == NULL) + { + fprintf(stderr, "filter_find: test 2 failed.\n"); + return 1; + } + filter_free(f1); + if ((f2 = filter_find("test1")) != NULL) + { + fprintf(stderr, "filter_find: test 3 failed delete.\n"); + return 1; + } + + return 0; +} + + +/** + * Passive tests for filter_add_option and filter_add_parameter + * + * These tests add options and parameters to a filter, the only failure + * is related hard crashes, such as SIGSEGV etc. as there are no good hooks + * to check the creation of parameters and options currently. + */ +static int +test2() +{ +FILTER_DEF *f1; + + if ((f1 = filter_alloc("test1", "module")) == NULL) + { + fprintf(stderr, "filter_alloc: test 1 failed.\n"); + return 1; + } + filterAddOption(f1, "option1"); + filterAddOption(f1, "option2"); + filterAddOption(f1, "option3"); + filterAddParameter(f1, "name1", "value1"); + filterAddParameter(f1, "name2", "value2"); + filterAddParameter(f1, "name3", "value3"); + return 0; +} + + +/** + * test3 Filter creation, finding and deletion soak test + * + */ +static int +test3() +{ +FILTER_DEF *f1; +char name[40]; +int i, n_filters = 1000; + + for (i = 0; i < n_filters; i++) + { + sprintf(name, "filter%d", i); + if ((f1 = filter_alloc(name, "module")) == NULL) + { + fprintf(stderr, + "filter_alloc: test 3 failed with %s.\n", name); + return 1; + } + } + for (i = 0; i < n_filters; i++) + { + sprintf(name, "filter%d", i); + if ((f1 = filter_find(name)) == NULL) + { + fprintf(stderr, "filter_find: test 3 failed.\n"); + return 1; + } + } + for (i = 0; i < n_filters; i++) + { + sprintf(name, "filter%d", i); + if ((f1 = filter_find(name)) == NULL) + { + fprintf(stderr, "filter_find: test 3 failed.\n"); + return 1; + } + filter_free(f1); + if ((f1 = filter_find(name)) != NULL) + { + fprintf(stderr, + "filter_find: test 3 failed - found deleted filter.\n"); + return 1; + } + } + + return 0; +} + +int +main(int argc, char **argv) +{ +int result = 0; + + result += test1(); + result += test2(); + result += test3(); + + exit(result); +} + diff --git a/server/core/test/testspinlock.c b/server/core/test/testspinlock.c new file mode 100644 index 000000000..bcbfa2a3f --- /dev/null +++ b/server/core/test/testspinlock.c @@ -0,0 +1,132 @@ +/* + * This file is distributed as part of MaxScale. It is free + * software: you can redistribute it and/or modify it under the terms of the + * GNU General Public License as published by the Free Software Foundation, + * version 2. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS + * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more + * details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 51 + * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Copyright SkySQL Ab 2014 + */ + +/** + * + * @verbatim + * Revision History + * + * Date Who Description + * 18/08-2014 Mark Riddoch Initial implementation + * + * @endverbatim + */ + +#include +#include +#include + +#include +#include + + +/** + * test1 spinlock_acquire_nowait tests + * + * Test that spinlock_acquire_nowait returns false if the spinlock + * is already taken. + * + * Test that spinlock_acquire_nowait returns true if the spinlock + * is not taken. + * + * Test that spinlock_acquire_nowait does hold the spinlock. + */ +static int +test1() +{ +SPINLOCK lck; + + spinlock_init(&lck); + spinlock_acquire(&lck); + if (spinlock_acquire_nowait(&lck)) + { + fprintf(stderr, "spinlock_acquire_nowait: test 1 failed.\n"); + return 1; + } + spinlock_release(&lck); + if (!spinlock_acquire_nowait(&lck)) + { + fprintf(stderr, "spinlock_acquire_nowait: test 2 failed.\n"); + return 1; + } + if (spinlock_acquire_nowait(&lck)) + { + fprintf(stderr, "spinlock_acquire_nowait: test 3 failed.\n"); + return 1; + } + spinlock_release(&lck); + + return 0; +} + +static int acquire_time; + +static void +test2_helper(void *data) +{ +SPINLOCK *lck = (SPINLOCK *)data; +unsigned long t1 = time(0); + + spinlock_acquire(lck); + acquire_time = time(0) - t1; + spinlock_release(lck); + return; +} + +/** + * Check that spinlock correctly blocks another thread whilst the spinlock + * is held. + * + * Take out a lock. + * Start a second thread to take the same lock + * sleep for 10 seconds + * release lock + * verify that second thread took at least 8 seconds to obtain the lock + */ +static int +test2() +{ +SPINLOCK lck; +void *handle; + + acquire_time = 0; + spinlock_init(&lck); + spinlock_acquire(&lck); + handle = thread_start(test2_helper, (void *)&lck); + sleep(10); + spinlock_release(&lck); + thread_wait(handle); + + if (acquire_time < 8) + { + fprintf(stderr, "spinlock: test 1 failed.\n"); + return 1; + } + return 0; +} + +main(int argc, char **argv) +{ +int result = 0; + + result += test1(); + result += test2(); + + exit(result); +} + diff --git a/server/core/utils.c b/server/core/utils.c index c7e42dda1..1b8c6b5fe 100644 --- a/server/core/utils.c +++ b/server/core/utils.c @@ -204,7 +204,7 @@ void gw_sha1_2_str(const uint8_t *in, int in_len, const uint8_t *in2, int in2_le /** - * @node Gets errno corresponding to latest socket error + * node Gets errno corresponding to latest socket error * * Parameters: * @param fd - in, use diff --git a/server/include/adminusers.h b/server/include/adminusers.h index d46570e38..07afa5390 100644 --- a/server/include/adminusers.h +++ b/server/include/adminusers.h @@ -29,6 +29,8 @@ * * @endverbatim */ +#include + #define ADMIN_SALT "MS" extern int admin_verify(char *, char *); diff --git a/server/include/filter.h b/server/include/filter.h index 568df291a..3076587e6 100644 --- a/server/include/filter.h +++ b/server/include/filter.h @@ -61,7 +61,7 @@ typedef struct { * filter pipline * routeQuery Called on each query that requires * routing - * clientReply + * clientReply Called for each reply packet * diagnostics Called to force the filter to print * diagnostic output * @@ -88,21 +88,21 @@ typedef struct filter_object { */ #define FILTER_VERSION {1, 1, 0} /** - * The definition of a filter form the configuration file. + * The definition of a filter from the configuration file. * This is basically the link between a plugin to load and the * optons to pass to that plugin. */ typedef struct filter_def { - char *name; /*< The Filter name */ - char *module; /*< The module to load */ - char **options; /*< The options set for this filter */ + char *name; /**< The Filter name */ + char *module; /**< The module to load */ + char **options; /**< The options set for this filter */ FILTER_PARAMETER - **parameters; /*< The filter parameters */ - FILTER filter; - FILTER_OBJECT *obj; - SPINLOCK spin; + **parameters; /**< The filter parameters */ + FILTER filter; /**< The runtime filter */ + FILTER_OBJECT *obj; /**< The "MODULE_OBJECT" for the filter */ + SPINLOCK spin; /**< Spinlock to protect the filter definition */ struct filter_def - *next; /*< Next filter in the chain of all filters */ + *next; /**< Next filter in the chain of all filters */ } FILTER_DEF; FILTER_DEF *filter_alloc(char *, char *); diff --git a/server/modules/filter/qlafilter.c b/server/modules/filter/qlafilter.c index da78713d2..b3accfbf8 100644 --- a/server/modules/filter/qlafilter.c +++ b/server/modules/filter/qlafilter.c @@ -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 #include @@ -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 */ diff --git a/server/modules/filter/regexfilter.c b/server/modules/filter/regexfilter.c index 5c4f1e7df..79cf70c09 100644 --- a/server/modules/filter/regexfilter.c +++ b/server/modules/filter/regexfilter.c @@ -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 */ diff --git a/server/modules/filter/tee.c b/server/modules/filter/tee.c index 34efbb65b..f8e22c7eb 100644 --- a/server/modules/filter/tee.c +++ b/server/modules/filter/tee.c @@ -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 #include @@ -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 */ diff --git a/server/modules/filter/testfilter.c b/server/modules/filter/testfilter.c index f72471a36..289ccf4a2 100644 --- a/server/modules/filter/testfilter.c +++ b/server/modules/filter/testfilter.c @@ -21,13 +21,15 @@ #include /** - * 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 */ diff --git a/server/modules/filter/topfilter.c b/server/modules/filter/topfilter.c index d4d594e6d..9ca281ef1 100644 --- a/server/modules/filter/topfilter.c +++ b/server/modules/filter/topfilter.c @@ -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 #include @@ -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 */ diff --git a/server/modules/routing/readwritesplit/readwritesplit.c b/server/modules/routing/readwritesplit/readwritesplit.c index a0c241920..1c22d4979 100644 --- a/server/modules/routing/readwritesplit/readwritesplit.c +++ b/server/modules/routing/readwritesplit/readwritesplit.c @@ -2025,7 +2025,7 @@ static bool select_connect_backend_servers( session, b->backend_server->protocol); - if (backend_ref[i].bref_dcb != NULL) + if (backend_ref[i].bref_dcb != NULL) { master_connected = true; /**