Yes, I could have created a "base class" with this code with function pointers and casting, etc.
BUT, in the end it probably would not be any cleaner (in this case) than macros...I think...
This is where C++ templates would work well.
Maybe I'll change it later. -RRL
#include "monitor.h"
#include "regexmatch.h"
Go to the source code of this file.
Data Structures | |
| struct | aw_db_cevents_t |
| Events generated for connect() and sql completion. More... | |
| struct | aw_db_counter_t |
| Event to generate w/count match. More... | |
| struct | aw_db_regex_t |
| Specifies a regex and associated events. More... | |
| struct | aw_db_revents_t |
| Events generated for regex matching. More... | |
| struct | aw_db_rwatcher_t |
| Compiled regex, associated events and state. More... | |
Defines | |
| #define | AW_DB_CONNECT(CONN_TYPE, PREFIX) |
| #define | AW_DB_DISCONNECT(PREFIX) |
| #define | AW_DB_DISCONNECT_ALL(PREFIX) |
| #define | AW_DB_DISCONNECT_POOL(CONN_TYPE) |
| #define | MAX_CONNECTION_DELAY 60 |
Functions | |
| void | aw_db_handler_rmatch (aw_handler_args_t *args, aw_event_t *event, byte_t *row_as_string, u_int32_t nwatchers, aw_db_rwatcher_t *watchers, u_int32_t *match_markers) |
| Match each cell in row, if match send string event. | |
|
|
|
|
|
|
|
|
Value: do { \ byte_t \ key[128]; \ \ /* close this one */ \ aw_ ## PREFIX ## _disconnect (cinfo, state, logger, 1); \ \ /* close the pool */ \ make_connection_key(key, sizeof(key), cinfo); \ \ disconnect_all(key); \ } while(0); |
|
|
Value: do { \ CONN_TYPE \ *conn; \ while( (conn = aw_llt_getobj(key, dbpool)) != NULL ) free_connection(conn); \ } while(0); |
|
|
|
|
||||||||||||||||||||||||||||
|
Match each cell in row, if match send string event. aw_db_handler_rmatch
|