Format filter modules

Formatted filter modules with Astyle.
This commit is contained in:
Markus Mäkelä
2017-01-17 13:45:32 +02:00
parent 4869fd98eb
commit c25b7629f4
33 changed files with 670 additions and 528 deletions

View File

@ -42,7 +42,10 @@ public:
void show(DCB* pDcb) const; void show(DCB* pDcb) const;
const CACHE_CONFIG& config() const { return m_config; } const CACHE_CONFIG& config() const
{
return m_config;
}
virtual json_t* get_info(uint32_t what = INFO_ALL) const = 0; virtual json_t* get_info(uint32_t what = INFO_ALL) const = 0;

View File

@ -142,9 +142,9 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
{ {
{ {
"storage", "storage",
MXS_MODULE_PARAM_STRING, MXS_MODULE_PARAM_STRING,
NULL, NULL,
MXS_MODULE_OPT_REQUIRED MXS_MODULE_OPT_REQUIRED
}, },
{ {
"storage_options", "storage_options",
@ -157,44 +157,44 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
}, },
{ {
"soft_ttl", "soft_ttl",
MXS_MODULE_PARAM_COUNT, MXS_MODULE_PARAM_COUNT,
CACHE_DEFAULT_SOFT_TTL CACHE_DEFAULT_SOFT_TTL
}, },
{ {
"max_resultset_rows", "max_resultset_rows",
MXS_MODULE_PARAM_COUNT, MXS_MODULE_PARAM_COUNT,
CACHE_DEFAULT_MAX_RESULTSET_ROWS CACHE_DEFAULT_MAX_RESULTSET_ROWS
}, },
{ {
"max_resultset_size", "max_resultset_size",
MXS_MODULE_PARAM_COUNT, MXS_MODULE_PARAM_COUNT,
CACHE_DEFAULT_MAX_RESULTSET_SIZE CACHE_DEFAULT_MAX_RESULTSET_SIZE
}, },
{ {
"max_count", "max_count",
MXS_MODULE_PARAM_COUNT, MXS_MODULE_PARAM_COUNT,
CACHE_DEFAULT_MAX_COUNT CACHE_DEFAULT_MAX_COUNT
}, },
{ {
"max_size", "max_size",
MXS_MODULE_PARAM_COUNT, MXS_MODULE_PARAM_COUNT,
CACHE_DEFAULT_THREAD_MODEL CACHE_DEFAULT_THREAD_MODEL
}, },
{ {
"rules", "rules",
MXS_MODULE_PARAM_PATH MXS_MODULE_PARAM_PATH
}, },
{ {
"debug", "debug",
MXS_MODULE_PARAM_COUNT, MXS_MODULE_PARAM_COUNT,
CACHE_DEFAULT_DEBUG CACHE_DEFAULT_DEBUG
}, },
{ {
"cached_data", "cached_data",
MXS_MODULE_PARAM_ENUM, MXS_MODULE_PARAM_ENUM,
CACHE_DEFAULT_THREAD_MODEL, CACHE_DEFAULT_THREAD_MODEL,
MXS_MODULE_OPT_NONE, MXS_MODULE_OPT_NONE,
cached_data_values cached_data_values
}, },
{MXS_END_MODULE_PARAMS} {MXS_END_MODULE_PARAMS}
} }

View File

@ -31,11 +31,11 @@
#define CACHE_DEBUG_MAX (CACHE_DEBUG_RULES | CACHE_DEBUG_USAGE | CACHE_DEBUG_DECISIONS) #define CACHE_DEBUG_MAX (CACHE_DEBUG_RULES | CACHE_DEBUG_USAGE | CACHE_DEBUG_DECISIONS)
#if !defined(UINT32_MAX) #if !defined(UINT32_MAX)
#define UINT32_MAX (4294967295U) #define UINT32_MAX (4294967295U)
#endif #endif
#if !defined(UINT64_MAX) #if !defined(UINT64_MAX)
#define UINT64_MAX (18446744073709551615UL) #define UINT64_MAX (18446744073709551615UL)
#endif #endif
// Count // Count

View File

@ -24,8 +24,16 @@ public:
static CacheFilter* create(const char* zName, char** pzOptions, CONFIG_PARAMETER* ppParams); static CacheFilter* create(const char* zName, char** pzOptions, CONFIG_PARAMETER* ppParams);
Cache& cache() { ss_dassert(m_sCache.get()); return *m_sCache.get(); } Cache& cache()
const Cache& cache() const { ss_dassert(m_sCache.get()); return *m_sCache.get(); } {
ss_dassert(m_sCache.get());
return *m_sCache.get();
}
const Cache& cache() const
{
ss_dassert(m_sCache.get());
return *m_sCache.get();
}
CacheFilterSession* newSession(SESSION* pSession); CacheFilterSession* newSession(SESSION* pSession);

View File

@ -122,10 +122,22 @@ private:
remove(); remove();
} }
const CACHE_KEY* key() const { return pkey_; } const CACHE_KEY* key() const
size_t size() const { return size_; } {
Node* next() const { return pnext_; } return pkey_;
Node* prev() const { return pprev_; } }
size_t size() const
{
return size_;
}
Node* next() const
{
return pnext_;
}
Node* prev() const
{
return pprev_;
}
/** /**
* Move the node before the node provided as argument. * Move the node before the node provided as argument.

View File

@ -62,7 +62,7 @@ private:
struct Entry struct Entry
{ {
Entry() Entry()
: time(0) : time(0)
{} {}
uint32_t time; uint32_t time;

View File

@ -20,9 +20,9 @@
extern "C" extern "C"
{ {
CACHE_STORAGE_API* CacheGetStorageAPI() CACHE_STORAGE_API* CacheGetStorageAPI()
{ {
return &StorageModule<InMemoryStorage>::s_api; return &StorageModule<InMemoryStorage>::s_api;
} }
} }

View File

@ -25,7 +25,8 @@
bool RocksDBInternals::is_stale(const rocksdb::Slice& value, int32_t ttl, rocksdb::Env* pEnv) bool RocksDBInternals::is_stale(const rocksdb::Slice& value, int32_t ttl, rocksdb::Env* pEnv)
{ {
if (ttl <= 0) if (ttl <= 0)
{ // Data is fresh if TTL is non-positive {
// Data is fresh if TTL is non-positive
return false; return false;
} }

View File

@ -19,7 +19,7 @@
#if (ROCKSDB_MAJOR != 4) || (ROCKSDB_MINOR != 9) #if (ROCKSDB_MAJOR != 4) || (ROCKSDB_MINOR != 9)
#error RocksDBStorage was created with knowledge of RocksDB 4.9 internals.\ #error RocksDBStorage was created with knowledge of RocksDB 4.9 internals.\
The version used is something else. Ensure the knowledge is still applicable. The version used is something else. Ensure the knowledge is still applicable.
#endif #endif
namespace RocksDBInternals namespace RocksDBInternals

View File

@ -122,7 +122,8 @@ bool deletePath(const string& path)
// FTS_XDEV - Don't cross filesystem boundaries // FTS_XDEV - Don't cross filesystem boundaries
FTS *pFts = fts_open(files, FTS_NOCHDIR | FTS_PHYSICAL | FTS_XDEV, NULL); FTS *pFts = fts_open(files, FTS_NOCHDIR | FTS_PHYSICAL | FTS_XDEV, NULL);
if (pFts) { if (pFts)
{
FTSENT* pCurrent; FTSENT* pCurrent;
while ((pCurrent = fts_read(pFts))) while ((pCurrent = fts_read(pFts)))
{ {
@ -178,7 +179,8 @@ bool deletePath(const string& path)
MXS_NOTICE("Deleted cache storage at '%s'.", path.c_str()); MXS_NOTICE("Deleted cache storage at '%s'.", path.c_str());
} }
if (pFts) { if (pFts)
{
fts_close(pFts); fts_close(pFts);
} }
} }
@ -393,7 +395,10 @@ cache_result_t RocksDBStorage::Get_key(const char* zDefault_db, const GWBUF& que
// dbs now contain each accessed database in sorted order. Now copy them to a single string. // dbs now contain each accessed database in sorted order. Now copy them to a single string.
string tag; string tag;
for_each(dbs.begin(), dbs.end(), [&tag](const string& db) { tag.append(db); }); for_each(dbs.begin(), dbs.end(), [&tag](const string & db)
{
tag.append(db);
});
memset(pKey->data, 0, CACHE_KEY_MAXLEN); memset(pKey->data, 0, CACHE_KEY_MAXLEN);
@ -432,15 +437,16 @@ cache_result_t RocksDBStorage::get_info(uint32_t what, json_t** ppInfo) const
auto sStatistics = m_sDb->GetOptions().statistics; auto sStatistics = m_sDb->GetOptions().statistics;
for_each(rocksdb::TickersNameMap.begin(), rocksdb::TickersNameMap.end(), for_each(rocksdb::TickersNameMap.begin(), rocksdb::TickersNameMap.end(),
[pInfo, sStatistics](const std::pair<rocksdb::Tickers, string>& tickerName) { [pInfo, sStatistics](const std::pair<rocksdb::Tickers, string>& tickerName)
json_t* pValue = json_integer(sStatistics->getTickerCount(tickerName.first)); {
json_t* pValue = json_integer(sStatistics->getTickerCount(tickerName.first));
if (pValue) if (pValue)
{ {
json_object_set(pInfo, tickerName.second.c_str(), pValue); json_object_set(pInfo, tickerName.second.c_str(), pValue);
json_decref(pValue); json_decref(pValue);
} }
}); });
*ppInfo = pInfo; *ppInfo = pInfo;
} }

View File

@ -21,9 +21,9 @@
extern "C" extern "C"
{ {
CACHE_STORAGE_API* CacheGetStorageAPI() CACHE_STORAGE_API* CacheGetStorageAPI()
{ {
return &StorageModule<RocksDBStorage>::s_api; return &StorageModule<RocksDBStorage>::s_api;
} }
} }

View File

@ -31,7 +31,10 @@ public:
* *
* @return Bitmask of @c cache_storage_capabilities_t values. * @return Bitmask of @c cache_storage_capabilities_t values.
*/ */
uint32_t capabilities() const { return m_caps; } uint32_t capabilities() const
{
return m_caps;
}
/** /**
* The capabilities of storages loaded via this factory. These * The capabilities of storages loaded via this factory. These
@ -39,7 +42,10 @@ public:
* *
* @return Bitmask of @c cache_storage_capabilities_t values. * @return Bitmask of @c cache_storage_capabilities_t values.
*/ */
uint32_t storage_capabilities() const { return m_storage_caps; } uint32_t storage_capabilities() const
{
return m_storage_caps;
}
/** /**
* Create storage instance. * Create storage instance.

View File

@ -46,7 +46,10 @@ public:
return Thread(pTask); return Thread(pTask);
} }
Tester::Task* task() { return m_pTask; } Tester::Task* task()
{
return m_pTask;
}
void start() void start()
{ {

View File

@ -52,12 +52,18 @@ public:
* *
* @return True, if the task should terminate, i.e., return from @c run. * @return True, if the task should terminate, i.e., return from @c run.
*/ */
bool should_terminate() const { return m_terminate; } bool should_terminate() const
{
return m_terminate;
}
/** /**
* Tell the task to terminate. * Tell the task to terminate.
*/ */
void terminate() { m_terminate = true; } void terminate()
{
m_terminate = true;
}
/** /**
* Calls terminate on the provided task. For use in algorithms. * Calls terminate on the provided task. For use in algorithms.
@ -98,14 +104,20 @@ public:
* *
* @return The value returned by @run. * @return The value returned by @run.
*/ */
int rv() const { return m_rv; } int rv() const
{
return m_rv;
}
/** /**
* The stream to be used for user output. * The stream to be used for user output.
* *
* @return The output stream to be used. * @return The output stream to be used.
*/ */
std::ostream& out() const { return m_out; } std::ostream& out() const
{
return m_out;
}
protected: protected:
/** /**
@ -118,7 +130,10 @@ public:
private: private:
friend class Thread; friend class Thread;
void set_rv(int rv) { m_rv = rv; } void set_rv(int rv)
{
m_rv = rv;
}
private: private:
Task(const Task&); Task(const Task&);
@ -249,7 +264,10 @@ protected:
* *
* @return A stream. * @return A stream.
*/ */
std::ostream& out() const { return m_out; } std::ostream& out() const
{
return m_out;
}
/** /**
* Execute a specific number of tasks in as many threads. * Execute a specific number of tasks in as many threads.

View File

@ -243,7 +243,7 @@ int TesterLRUStorage::test_max_count_and_size(size_t n_threads, size_t n_seconds
ss_debug(cache_result_t result); ss_debug(cache_result_t result);
uint64_t items; uint64_t items;
ss_debug(result =) pStorage->get_items(&items); ss_debug(result = ) pStorage->get_items(&items);
ss_dassert(result == CACHE_RESULT_OK); ss_dassert(result == CACHE_RESULT_OK);
out() << "Max count: " << max_count << ", count: " << items << "." << endl; out() << "Max count: " << max_count << ", count: " << items << "." << endl;
@ -254,7 +254,7 @@ int TesterLRUStorage::test_max_count_and_size(size_t n_threads, size_t n_seconds
} }
uint64_t size; uint64_t size;
ss_debug(result =) pStorage->get_size(&size); ss_debug(result = ) pStorage->get_size(&size);
ss_dassert(result == CACHE_RESULT_OK); ss_dassert(result == CACHE_RESULT_OK);
out() << "Max size: " << max_size << ", size: " << size << "." << endl; out() << "Max size: " << max_size << ", size: " << size << "." << endl;

View File

@ -49,7 +49,10 @@ protected:
virtual void print_usage(const char* zProgram); virtual void print_usage(const char* zProgram);
std::ostream& out() const { return m_out; } std::ostream& out() const
{
return m_out;
}
private: private:
TestStorage(const TestStorage&); TestStorage(const TestStorage&);

View File

@ -836,26 +836,26 @@ MXS_MODULE* MXS_CREATE_MODULE()
{ {
{ {
"rules", "rules",
MXS_MODULE_PARAM_PATH, MXS_MODULE_PARAM_PATH,
NULL, NULL,
MXS_MODULE_OPT_REQUIRED | MXS_MODULE_OPT_PATH_R_OK MXS_MODULE_OPT_REQUIRED | MXS_MODULE_OPT_PATH_R_OK
}, },
{ {
"log_match", "log_match",
MXS_MODULE_PARAM_BOOL, MXS_MODULE_PARAM_BOOL,
"false" "false"
}, },
{ {
"log_no_match", "log_no_match",
MXS_MODULE_PARAM_BOOL, MXS_MODULE_PARAM_BOOL,
"false" "false"
}, },
{ {
"action", "action",
MXS_MODULE_PARAM_ENUM, MXS_MODULE_PARAM_ENUM,
"block", "block",
MXS_MODULE_OPT_ENUM_UNIQUE, MXS_MODULE_OPT_ENUM_UNIQUE,
action_values action_values
}, },
{MXS_END_MODULE_PARAMS} {MXS_END_MODULE_PARAMS}
} }
@ -901,29 +901,29 @@ char* get_regex_string(char** saved)
{ {
switch (*ptr) switch (*ptr)
{ {
case '\'': case '\'':
case '"': case '"':
if (quoted) if (quoted)
{
if (*ptr == delimiter)
{ {
if (*ptr == delimiter) *ptr = '\0';
{ *saved = ptr + 1;
*ptr = '\0'; return start;
*saved = ptr + 1;
return start;
}
} }
else }
{ else
delimiter = *ptr; {
start = ptr + 1; delimiter = *ptr;
quoted = true; start = ptr + 1;
} quoted = true;
break; }
case '\\': break;
escaped = true; case '\\':
break; escaped = true;
default: break;
break; default:
break;
} }
} }
} }
@ -1045,21 +1045,21 @@ static void rule_free_all(RULE* rule)
switch (rule->type) switch (rule->type)
{ {
case RT_COLUMN: case RT_COLUMN:
case RT_FUNCTION: case RT_FUNCTION:
strlink_free((STRLINK*) rule->data); strlink_free((STRLINK*) rule->data);
break; break;
case RT_THROTTLE: case RT_THROTTLE:
MXS_FREE(rule->data); MXS_FREE(rule->data);
break; break;
case RT_REGEX: case RT_REGEX:
pcre2_code_free((pcre2_code*) rule->data); pcre2_code_free((pcre2_code*) rule->data);
break; break;
default: default:
break; break;
} }
MXS_FREE(rule->name); MXS_FREE(rule->name);
@ -1402,20 +1402,20 @@ static bool process_user_templates(HASHTABLE *users, user_template_t *templates,
switch (templates->type) switch (templates->type)
{ {
case FWTOK_MATCH_ANY: case FWTOK_MATCH_ANY:
tail->next = user->rules_or; tail->next = user->rules_or;
user->rules_or = foundrules; user->rules_or = foundrules;
break; break;
case FWTOK_MATCH_ALL: case FWTOK_MATCH_ALL:
tail->next = user->rules_and; tail->next = user->rules_and;
user->rules_and = foundrules; user->rules_and = foundrules;
break; break;
case FWTOK_MATCH_STRICT_ALL: case FWTOK_MATCH_STRICT_ALL:
tail->next = user->rules_strict_and; tail->next = user->rules_strict_and;
user->rules_strict_and = foundrules; user->rules_strict_and = foundrules;
break; break;
} }
} }
else else
@ -2027,17 +2027,17 @@ bool rule_matches(FW_INSTANCE* my_instance,
{ {
switch (optype) switch (optype)
{ {
case QUERY_OP_SELECT: case QUERY_OP_SELECT:
case QUERY_OP_UPDATE: case QUERY_OP_UPDATE:
case QUERY_OP_INSERT: case QUERY_OP_INSERT:
case QUERY_OP_DELETE: case QUERY_OP_DELETE:
// In these cases, we have to be able to trust what qc_get_field_info // In these cases, we have to be able to trust what qc_get_field_info
// returns. Unless the query was parsed completely, we cannot do that. // returns. Unless the query was parsed completely, we cannot do that.
msg = create_parse_error(my_instance, "parsed completely", query, &matches); msg = create_parse_error(my_instance, "parsed completely", query, &matches);
goto queryresolved; goto queryresolved;
default: default:
break; break;
} }
} }
} }
@ -2051,58 +2051,58 @@ bool rule_matches(FW_INSTANCE* my_instance,
{ {
switch (rulebook->rule->type) switch (rulebook->rule->type)
{ {
case RT_UNDEFINED: case RT_UNDEFINED:
ss_dassert(false); ss_dassert(false);
MXS_ERROR("Undefined rule type found."); MXS_ERROR("Undefined rule type found.");
break; break;
case RT_REGEX: case RT_REGEX:
match_regex(rulebook, query, &matches, &msg); match_regex(rulebook, query, &matches, &msg);
break; break;
case RT_PERMISSION: case RT_PERMISSION:
matches = true;
msg = MXS_STRDUP_A("Permission denied at this time.");
MXS_NOTICE("rule '%s': query denied at this time.", rulebook->rule->name);
break;
case RT_COLUMN:
if (is_sql)
{
match_column(rulebook, queue, &matches, &msg);
}
break;
case RT_FUNCTION:
if (is_sql)
{
match_function(rulebook, queue, &matches, &msg);
}
break;
case RT_WILDCARD:
if (is_sql)
{
match_wildcard(rulebook, queue, &matches, &msg);
}
break;
case RT_THROTTLE:
matches = match_throttle(my_session, rulebook, &msg);
break;
case RT_CLAUSE:
if (is_sql && !qc_query_has_clause(queue))
{
matches = true; matches = true;
msg = MXS_STRDUP_A("Permission denied at this time."); msg = MXS_STRDUP_A("Required WHERE/HAVING clause is missing.");
MXS_NOTICE("rule '%s': query denied at this time.", rulebook->rule->name); MXS_NOTICE("rule '%s': query has no where/having "
break; "clause, query is denied.", rulebook->rule->name);
}
break;
case RT_COLUMN: default:
if (is_sql) break;
{
match_column(rulebook, queue, &matches, &msg);
}
break;
case RT_FUNCTION:
if (is_sql)
{
match_function(rulebook, queue, &matches, &msg);
}
break;
case RT_WILDCARD:
if (is_sql)
{
match_wildcard(rulebook, queue, &matches, &msg);
}
break;
case RT_THROTTLE:
matches = match_throttle(my_session, rulebook, &msg);
break;
case RT_CLAUSE:
if (is_sql && !qc_query_has_clause(queue))
{
matches = true;
msg = MXS_STRDUP_A("Required WHERE/HAVING clause is missing.");
MXS_NOTICE("rule '%s': query has no where/having "
"clause, query is denied.", rulebook->rule->name);
}
break;
default:
break;
} }
} }
@ -2374,28 +2374,28 @@ routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWBUF *queue)
switch (my_instance->action) switch (my_instance->action)
{ {
case FW_ACTION_ALLOW: case FW_ACTION_ALLOW:
if (match) if (match)
{ {
query_ok = true;
}
break;
case FW_ACTION_BLOCK:
if (!match)
{
query_ok = true;
}
break;
case FW_ACTION_IGNORE:
query_ok = true; query_ok = true;
break; }
break;
default: case FW_ACTION_BLOCK:
MXS_ERROR("Unknown dbfwfilter action: %d", my_instance->action); if (!match)
ss_dassert(false); {
break; query_ok = true;
}
break;
case FW_ACTION_IGNORE:
query_ok = true;
break;
default:
MXS_ERROR("Unknown dbfwfilter action: %d", my_instance->action);
ss_dassert(false);
break;
} }
if (my_instance->log_match != FW_LOG_NONE) if (my_instance->log_match != FW_LOG_NONE)

View File

@ -96,15 +96,15 @@ static const char* token_get_keyword(
{ {
switch (token->token) switch (token->token)
{ {
case TOK_EOL: case TOK_EOL:
return "End of line"; return "End of line";
break; break;
case TOK_STRING: case TOK_STRING:
return token->value; return token->value;
break; break;
default: default:
{ {
int i = 0; int i = 0;
while (i < TOK_EOL && keywords[i].token != token->token) while (i < TOK_EOL && keywords[i].token != token->token)
@ -276,144 +276,144 @@ hint_parser(HINT_SESSION *session, GWBUF *request)
{ {
switch (state) switch (state)
{ {
case HS_INIT: case HS_INIT:
switch (tok->token) switch (tok->token)
{ {
case TOK_ROUTE: case TOK_ROUTE:
state = HS_ROUTE; state = HS_ROUTE;
break;
case TOK_STRING:
state = HS_NAME;
lvalue = MXS_STRDUP_A(tok->value);
break;
case TOK_STOP:
/* Action: pop active hint */
hint_pop(session);
state = HS_INIT;
break;
case TOK_START:
hintname = NULL;
mode = HM_START;
state = HS_INIT;
break;
default:
/* Error: expected hint, name or STOP */
MXS_ERROR("Syntax error in hint. Expected "
"'route', 'stop' or hint name instead of "
"'%s'. Hint ignored.",
token_get_keyword(tok));
token_free(tok);
goto retblock;
}
break; break;
case HS_ROUTE: case TOK_STRING:
if (tok->token != TOK_TO) state = HS_NAME;
{ lvalue = MXS_STRDUP_A(tok->value);
/* Error, expect TO */;
MXS_ERROR("Syntax error in hint. Expected "
"'to' instead of '%s'. Hint ignored.",
token_get_keyword(tok));
token_free(tok);
goto retblock;
}
state = HS_ROUTE1;
break; break;
case HS_ROUTE1: case TOK_STOP:
switch (tok->token) /* Action: pop active hint */
{ hint_pop(session);
case TOK_MASTER:
rval = hint_create_route(rval,
HINT_ROUTE_TO_MASTER, NULL);
break;
case TOK_SLAVE:
rval = hint_create_route(rval,
HINT_ROUTE_TO_SLAVE, NULL);
break;
case TOK_SERVER:
state = HS_ROUTE_SERVER;
break;
default:
/* Error expected MASTER, SLAVE or SERVER */
MXS_ERROR("Syntax error in hint. Expected "
"'master', 'slave', or 'server' instead "
"of '%s'. Hint ignored.",
token_get_keyword(tok));
token_free(tok);
goto retblock;
}
break;
case HS_ROUTE_SERVER:
if (tok->token == TOK_STRING)
{
rval = hint_create_route(rval,
HINT_ROUTE_TO_NAMED_SERVER, tok->value);
}
else
{
/* Error: Expected server name */
MXS_ERROR("Syntax error in hint. Expected "
"server name instead of '%s'. Hint "
"ignored.",
token_get_keyword(tok));
token_free(tok);
goto retblock;
}
break;
case HS_NAME:
switch (tok->token)
{
case TOK_EQUAL:
pname = lvalue;
state = HS_PVALUE;
break;
case TOK_PREPARE:
pname = lvalue;
state = HS_PREPARE;
break;
case TOK_START:
/* Action start(lvalue) */
hintname = lvalue;
mode = HM_START;
state = HS_INIT;
break;
default:
/* Error, token tok->value not expected */
MXS_ERROR("Syntax error in hint. Expected "
"'=', 'prepare', or 'start' instead of "
"'%s'. Hint ignored.",
token_get_keyword(tok));
token_free(tok);
goto retblock;
}
break;
case HS_PVALUE:
/* Action: pname = tok->value */
rval = hint_create_parameter(rval, pname, tok->value);
state = HS_INIT; state = HS_INIT;
break; break;
case HS_PREPARE: case TOK_START:
mode = HM_PREPARE; hintname = NULL;
hintname = lvalue; mode = HM_START;
switch (tok->token) state = HS_INIT;
{
case TOK_ROUTE:
state = HS_ROUTE;
break;
case TOK_STRING:
state = HS_NAME;
lvalue = tok->value;
break;
default:
/* Error, token tok->value not expected */
MXS_ERROR("Syntax error in hint. Expected "
"'route' or hint name instead of "
"'%s'. Hint ignored.",
token_get_keyword(tok));
token_free(tok);
goto retblock;
}
break; break;
default:
/* Error: expected hint, name or STOP */
MXS_ERROR("Syntax error in hint. Expected "
"'route', 'stop' or hint name instead of "
"'%s'. Hint ignored.",
token_get_keyword(tok));
token_free(tok);
goto retblock;
}
break;
case HS_ROUTE:
if (tok->token != TOK_TO)
{
/* Error, expect TO */;
MXS_ERROR("Syntax error in hint. Expected "
"'to' instead of '%s'. Hint ignored.",
token_get_keyword(tok));
token_free(tok);
goto retblock;
}
state = HS_ROUTE1;
break;
case HS_ROUTE1:
switch (tok->token)
{
case TOK_MASTER:
rval = hint_create_route(rval,
HINT_ROUTE_TO_MASTER, NULL);
break;
case TOK_SLAVE:
rval = hint_create_route(rval,
HINT_ROUTE_TO_SLAVE, NULL);
break;
case TOK_SERVER:
state = HS_ROUTE_SERVER;
break;
default:
/* Error expected MASTER, SLAVE or SERVER */
MXS_ERROR("Syntax error in hint. Expected "
"'master', 'slave', or 'server' instead "
"of '%s'. Hint ignored.",
token_get_keyword(tok));
token_free(tok);
goto retblock;
}
break;
case HS_ROUTE_SERVER:
if (tok->token == TOK_STRING)
{
rval = hint_create_route(rval,
HINT_ROUTE_TO_NAMED_SERVER, tok->value);
}
else
{
/* Error: Expected server name */
MXS_ERROR("Syntax error in hint. Expected "
"server name instead of '%s'. Hint "
"ignored.",
token_get_keyword(tok));
token_free(tok);
goto retblock;
}
break;
case HS_NAME:
switch (tok->token)
{
case TOK_EQUAL:
pname = lvalue;
state = HS_PVALUE;
break;
case TOK_PREPARE:
pname = lvalue;
state = HS_PREPARE;
break;
case TOK_START:
/* Action start(lvalue) */
hintname = lvalue;
mode = HM_START;
state = HS_INIT;
break;
default:
/* Error, token tok->value not expected */
MXS_ERROR("Syntax error in hint. Expected "
"'=', 'prepare', or 'start' instead of "
"'%s'. Hint ignored.",
token_get_keyword(tok));
token_free(tok);
goto retblock;
}
break;
case HS_PVALUE:
/* Action: pname = tok->value */
rval = hint_create_parameter(rval, pname, tok->value);
state = HS_INIT;
break;
case HS_PREPARE:
mode = HM_PREPARE;
hintname = lvalue;
switch (tok->token)
{
case TOK_ROUTE:
state = HS_ROUTE;
break;
case TOK_STRING:
state = HS_NAME;
lvalue = tok->value;
break;
default:
/* Error, token tok->value not expected */
MXS_ERROR("Syntax error in hint. Expected "
"'route' or hint name instead of "
"'%s'. Hint ignored.",
token_get_keyword(tok));
token_free(tok);
goto retblock;
}
break;
} }
token_free(tok); token_free(tok);
} /*< while */ } /*< while */
@ -425,68 +425,68 @@ hint_parser(HINT_SESSION *session, GWBUF *request)
switch (mode) switch (mode)
{ {
case HM_START: case HM_START:
/* /*
* We are starting either a predefined set of hints, * We are starting either a predefined set of hints,
* creating a new set of hints and starting in a single * creating a new set of hints and starting in a single
* operation or starting an anonymous block of hints. * operation or starting an anonymous block of hints.
*/ */
if (hintname == NULL && rval != NULL) if (hintname == NULL && rval != NULL)
{
/* We are starting an anonymous block of hints */
hint_push(session, rval);
rval = NULL;
}
else if (hintname && rval)
{
/* We are creating and starting a block of hints */
if (lookup_named_hint(session, hintname) != NULL)
{ {
/* We are starting an anonymous block of hints */ /* Error hint with this name already exists */
hint_push(session, rval);
rval = NULL;
}
else if (hintname && rval)
{
/* We are creating and starting a block of hints */
if (lookup_named_hint(session, hintname) != NULL)
{
/* Error hint with this name already exists */
}
else
{
create_named_hint(session, hintname, rval);
hint_push(session, hint_dup(rval));
}
}
else if (hintname && rval == NULL)
{
/* We starting an already define set of named hints */
rval = lookup_named_hint(session, hintname);
hint_push(session, hint_dup(rval));
MXS_FREE(hintname);
rval = NULL;
}
else if (hintname == NULL && rval == NULL)
{
/* Error case */
}
break;
case HM_PREPARE:
/*
* We are preparing a named set of hints. Note this does
* not trigger the usage of these hints currently.
*/
if (hintname == NULL || rval == NULL)
{
/* Error case, name and hints must be defined */
} }
else else
{ {
create_named_hint(session, hintname, rval); create_named_hint(session, hintname, rval);
hint_push(session, hint_dup(rval));
} }
/* We are not starting the hints now, so return an empty }
* hint set. else if (hintname && rval == NULL)
*/ {
/* We starting an already define set of named hints */
rval = lookup_named_hint(session, hintname);
hint_push(session, hint_dup(rval));
MXS_FREE(hintname);
rval = NULL; rval = NULL;
break; }
case HM_EXECUTE: else if (hintname == NULL && rval == NULL)
/* {
* We have a one-off hint for the statement we are /* Error case */
* currently forwarding. }
*/ break;
break; case HM_PREPARE:
/*
* We are preparing a named set of hints. Note this does
* not trigger the usage of these hints currently.
*/
if (hintname == NULL || rval == NULL)
{
/* Error case, name and hints must be defined */
}
else
{
create_named_hint(session, hintname, rval);
}
/* We are not starting the hints now, so return an empty
* hint set.
*/
rval = NULL;
break;
case HM_EXECUTE:
/*
* We have a one-off hint for the statement we are
* currently forwarding.
*/
break;
} }
retblock: retblock:

View File

@ -280,46 +280,46 @@ static int32_t routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWB
{ {
switch (my_session->state) switch (my_session->state)
{ {
case DS_STREAM_CLOSED: case DS_STREAM_CLOSED:
/** We're opening a new stream */ /** We're opening a new stream */
strcpy(my_session->target, target); strcpy(my_session->target, target);
my_session->queue = queue; my_session->queue = queue;
my_session->state = DS_REQUEST_SENT; my_session->state = DS_REQUEST_SENT;
my_session->packet_num = 0; my_session->packet_num = 0;
queue = create_load_data_command(target); queue = create_load_data_command(target);
break; break;
case DS_REQUEST_ACCEPTED: case DS_REQUEST_ACCEPTED:
my_session->state = DS_STREAM_OPEN; my_session->state = DS_STREAM_OPEN;
/** Fallthrough */ /** Fallthrough */
case DS_STREAM_OPEN: case DS_STREAM_OPEN:
if (strcmp(target, my_session->target) == 0) if (strcmp(target, my_session->target) == 0)
{ {
/** /**
* Stream is open and targets match, convert the insert into * Stream is open and targets match, convert the insert into
* a data stream * a data stream
*/ */
uint8_t packet_num = ++my_session->packet_num; uint8_t packet_num = ++my_session->packet_num;
send_ok = true; send_ok = true;
queue = convert_to_stream(queue, packet_num); queue = convert_to_stream(queue, packet_num);
} }
else else
{ {
/** /**
* Target mismatch * Target mismatch
* *
* TODO: Instead of sending an error, we could just open a new stream * TODO: Instead of sending an error, we could just open a new stream
*/ */
gwbuf_free(queue); gwbuf_free(queue);
send_error = true; send_error = true;
} }
break; break;
default: default:
MXS_ERROR("Unexpected state: %d", my_session->state); MXS_ERROR("Unexpected state: %d", my_session->state);
ss_dassert(false); ss_dassert(false);
break; break;
} }
} }
else else
@ -331,22 +331,22 @@ static int32_t routeQuery(MXS_FILTER *instance, MXS_FILTER_SESSION *session, GWB
switch (my_session->state) switch (my_session->state)
{ {
case DS_STREAM_OPEN: case DS_STREAM_OPEN:
/** Stream is open, we need to close it */ /** Stream is open, we need to close it */
my_session->state = DS_CLOSING_STREAM; my_session->state = DS_CLOSING_STREAM;
send_empty = true; send_empty = true;
packet_num = ++my_session->packet_num; packet_num = ++my_session->packet_num;
my_session->queue = queue; my_session->queue = queue;
break; break;
case DS_REQUEST_ACCEPTED: case DS_REQUEST_ACCEPTED:
my_session->state = DS_STREAM_OPEN; my_session->state = DS_STREAM_OPEN;
send_ok = true; send_ok = true;
break; break;
default: default:
ss_dassert(my_session->state == DS_STREAM_CLOSED); ss_dassert(my_session->state == DS_STREAM_CLOSED);
break; break;
} }
if (send_empty) if (send_empty)

View File

@ -186,8 +186,8 @@ typedef struct
lua_State* lua_state; lua_State* lua_state;
GWBUF* current_query; GWBUF* current_query;
SPINLOCK lock; SPINLOCK lock;
MXS_DOWNSTREAM down; MXS_DOWNSTREAM down;
MXS_UPSTREAM up; MXS_UPSTREAM up;
} LUA_SESSION; } LUA_SESSION;
/** /**

View File

@ -85,9 +85,11 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE()
NULL, /* Thread finish. */ NULL, /* Thread finish. */
{ {
{ Config::rules_file_name, MXS_MODULE_PARAM_STRING, NULL, MXS_MODULE_OPT_REQUIRED }, { Config::rules_file_name, MXS_MODULE_PARAM_STRING, NULL, MXS_MODULE_OPT_REQUIRED },
{ Config::warn_type_mismatch_name, {
MXS_MODULE_PARAM_ENUM, Config::warn_type_mismatch_default, Config::warn_type_mismatch_name,
MXS_MODULE_OPT_NONE, Config::warn_type_mismatch_values }, MXS_MODULE_PARAM_ENUM, Config::warn_type_mismatch_default,
MXS_MODULE_OPT_NONE, Config::warn_type_mismatch_values
},
{ MXS_END_MODULE_PARAMS } { MXS_END_MODULE_PARAMS }
} }
}; };

View File

@ -39,7 +39,10 @@ public:
void reload(DCB* pOut); void reload(DCB* pOut);
const Config& config() const { return m_config; } const Config& config() const
{
return m_config;
}
SMaskingRules rules() const; SMaskingRules rules() const;
private: private:

View File

@ -38,12 +38,27 @@ public:
{} {}
~MaskingFilterConfig() {} ~MaskingFilterConfig() {}
const std::string& name() const { return m_name; } const std::string& name() const
const std::string& rules_file() const { return m_rules_file; } {
warn_type_mismatch_t warn_type_mismatch() const { return m_warn_type_mismatch; } return m_name;
}
const std::string& rules_file() const
{
return m_rules_file;
}
warn_type_mismatch_t warn_type_mismatch() const
{
return m_warn_type_mismatch;
}
void set_rules_file(const std::string& s) { m_rules_file = s; } void set_rules_file(const std::string& s)
void set_warn_type_mismatch(warn_type_mismatch_t w) { m_warn_type_mismatch = w; } {
m_rules_file = s;
}
void set_warn_type_mismatch(warn_type_mismatch_t w)
{
m_warn_type_mismatch = w;
}
static warn_type_mismatch_t get_warn_type_mismatch(const CONFIG_PARAMETER* pParams); static warn_type_mismatch_t get_warn_type_mismatch(const CONFIG_PARAMETER* pParams);

View File

@ -111,7 +111,7 @@ void MaskingFilterSession::handle_response(GWBUF* pPacket)
switch (response.type()) switch (response.type())
{ {
case ComPacket::OK_PACKET: // OK case ComPacket::OK_PACKET: // OK
// We'll end up here also in the case of a multi-result. // We'll end up here also in the case of a multi-result.
case 0xfb: // GET_MORE_CLIENT_DATA/SEND_MORE_CLIENT_DATA case 0xfb: // GET_MORE_CLIENT_DATA/SEND_MORE_CLIENT_DATA
m_state = EXPECTING_NOTHING; m_state = EXPECTING_NOTHING;
break; break;

View File

@ -97,11 +97,20 @@ private:
return m_sRules; return m_sRules;
} }
bool is_multi_result() const { return m_multi_result; } bool is_multi_result() const
{
return m_multi_result;
}
uint32_t total_fields() const { return m_nTotal_fields; } uint32_t total_fields() const
{
return m_nTotal_fields;
}
void set_total_fields(uint32_t n) { m_nTotal_fields = n; } void set_total_fields(uint32_t n)
{
m_nTotal_fields = n;
}
bool append_type_and_rule(enum_field_types type, const MaskingRules::Rule* pRule) bool append_type_and_rule(enum_field_types type, const MaskingRules::Rule* pRule)
{ {

View File

@ -90,13 +90,34 @@ public:
std::string match() const; std::string match() const;
const std::string& column() const { return m_column; } const std::string& column() const
const std::string& table() const { return m_table; } {
const std::string& database() const { return m_database; } return m_column;
const std::string& value() const { return m_value; } }
const std::string& fill() const { return m_fill; } const std::string& table() const
const std::vector<SAccount>& applies_to() const { return m_applies_to; } {
const std::vector<SAccount>& exempted() const { return m_exempted; } return m_table;
}
const std::string& database() const
{
return m_database;
}
const std::string& value() const
{
return m_value;
}
const std::string& fill() const
{
return m_fill;
}
const std::vector<SAccount>& applies_to() const
{
return m_applies_to;
}
const std::vector<SAccount>& exempted() const
{
return m_exempted;
}
/** /**
* Create a Rule instance * Create a Rule instance

View File

@ -116,10 +116,10 @@ public:
* A _random access iterator_ to a @c LEncString. * A _random access iterator_ to a @c LEncString.
*/ */
class iterator : public std::iterator<std::random_access_iterator_tag, class iterator : public std::iterator<std::random_access_iterator_tag,
char, char,
std::ptrdiff_t, std::ptrdiff_t,
char*, char*,
char&> char&>
{ {
public: public:
iterator(char* pS) iterator(char* pS)
@ -488,8 +488,14 @@ public:
ERR_PACKET = 0xff, ERR_PACKET = 0xff,
}; };
uint32_t packet_len() const { return m_packet_len; } uint32_t packet_len() const
uint8_t packet_no() const { return m_packet_no; } {
return m_packet_len;
}
uint8_t packet_no() const
{
return m_packet_no;
}
protected: protected:
ComPacket(GWBUF* pPacket) ComPacket(GWBUF* pPacket)
@ -624,7 +630,10 @@ public:
++m_pData; ++m_pData;
} }
uint8_t command() const { return m_command; } uint8_t command() const
{
return m_command;
}
protected: protected:
uint8_t m_command; uint8_t m_command;
@ -667,13 +676,34 @@ public:
m_pData += 1; m_pData += 1;
} }
const LEncString& catalog() const { return m_catalog; } const LEncString& catalog() const
const LEncString& schema() const { return m_schema; } {
const LEncString& table() const { return m_table; } return m_catalog;
const LEncString& org_table() const { return m_org_table; } }
const LEncString& name() const { return m_name; } const LEncString& schema() const
const LEncString& org_name() const { return m_org_name; } {
enum_field_types type() const { return m_type; } return m_schema;
}
const LEncString& table() const
{
return m_table;
}
const LEncString& org_table() const
{
return m_org_table;
}
const LEncString& name() const
{
return m_name;
}
const LEncString& org_name() const
{
return m_org_name;
}
enum_field_types type() const
{
return m_type;
}
std::string to_string() const std::string to_string() const
{ {
@ -763,9 +793,9 @@ public:
case MYSQL_TYPE_VAR_STRING: case MYSQL_TYPE_VAR_STRING:
return true; return true;
// These, although returned as length-encoded strings, also in the case of // These, although returned as length-encoded strings, also in the case of
// a binary resultset row, are not are not considered to be strings from the // a binary resultset row, are not are not considered to be strings from the
// perspective of masking. // perspective of masking.
case MYSQL_TYPE_BIT: case MYSQL_TYPE_BIT:
case MYSQL_TYPE_DECIMAL: case MYSQL_TYPE_DECIMAL:
case MYSQL_TYPE_ENUM: case MYSQL_TYPE_ENUM:
@ -826,10 +856,10 @@ typedef CQRResultsetValue CQRBinaryResultsetValue;
* typedef @c ComQueryResponse::TextResultset::iterator. * typedef @c ComQueryResponse::TextResultset::iterator.
*/ */
class CQRTextResultsetRowIterator : public std::iterator<std::forward_iterator_tag, class CQRTextResultsetRowIterator : public std::iterator<std::forward_iterator_tag,
CQRTextResultsetValue, CQRTextResultsetValue,
std::ptrdiff_t, std::ptrdiff_t,
CQRTextResultsetValue*, CQRTextResultsetValue*,
CQRTextResultsetValue> CQRTextResultsetValue>
{ {
public: public:
typedef CQRTextResultsetValue Value; typedef CQRTextResultsetValue Value;
@ -887,10 +917,10 @@ private:
* typedef @c ComQueryResponse::BinaryResultset::iterator. * typedef @c ComQueryResponse::BinaryResultset::iterator.
*/ */
class CQRBinaryResultsetRowIterator : public std::iterator<std::forward_iterator_tag, class CQRBinaryResultsetRowIterator : public std::iterator<std::forward_iterator_tag,
CQRBinaryResultsetValue, CQRBinaryResultsetValue,
std::ptrdiff_t, std::ptrdiff_t,
CQRBinaryResultsetValue*, CQRBinaryResultsetValue*,
CQRBinaryResultsetValue> CQRBinaryResultsetValue>
{ {
public: public:
typedef CQRBinaryResultsetValue Value; typedef CQRBinaryResultsetValue Value;
@ -1162,7 +1192,10 @@ public:
{ {
} }
uint64_t nFields() const { return m_nFields; } uint64_t nFields() const
{
return m_nFields;
}
private: private:
LEncInt m_nFields; LEncInt m_nFields;

View File

@ -170,7 +170,7 @@ struct expected_account
} }
}; };
const size_t nExpected_accounts = (sizeof(expected_accounts)/sizeof(expected_accounts[0])); const size_t nExpected_accounts = (sizeof(expected_accounts) / sizeof(expected_accounts[0]));
class MaskingRulesTester class MaskingRulesTester
{ {

View File

@ -96,18 +96,18 @@ MXS_MODULE* MXS_CREATE_MODULE()
{ {
{ {
"max_resultset_rows", "max_resultset_rows",
MXS_MODULE_PARAM_COUNT, MXS_MODULE_PARAM_COUNT,
MAXROWS_DEFAULT_MAX_RESULTSET_ROWS MAXROWS_DEFAULT_MAX_RESULTSET_ROWS
}, },
{ {
"max_resultset_size", "max_resultset_size",
MXS_MODULE_PARAM_COUNT, MXS_MODULE_PARAM_COUNT,
MAXROWS_DEFAULT_MAX_RESULTSET_SIZE MAXROWS_DEFAULT_MAX_RESULTSET_SIZE
}, },
{ {
"debug", "debug",
MXS_MODULE_PARAM_COUNT, MXS_MODULE_PARAM_COUNT,
MAXROWS_DEFAULT_DEBUG MAXROWS_DEFAULT_DEBUG
}, },
{MXS_END_MODULE_PARAMS} {MXS_END_MODULE_PARAMS}
} }
@ -701,11 +701,11 @@ static int handle_rows(MAXROWS_SESSION_DATA *csdata)
break; break;
} }
/* /*
* Check packet size against MYSQL_PACKET_LENGTH_MAX * Check packet size against MYSQL_PACKET_LENGTH_MAX
* If true then break as received could be not complete * If true then break as received could be not complete
* EOF or OK packet could be seen after receiving the full large packet * EOF or OK packet could be seen after receiving the full large packet
*/ */
if (packetlen == (MYSQL_PACKET_LENGTH_MAX + MYSQL_HEADER_LEN)) if (packetlen == (MYSQL_PACKET_LENGTH_MAX + MYSQL_HEADER_LEN))
{ {
// Mark the beginning of a large packet receiving // Mark the beginning of a large packet receiving
@ -906,7 +906,7 @@ static int send_upstream(MAXROWS_SESSION_DATA *csdata)
static int send_ok_upstream(MAXROWS_SESSION_DATA *csdata) static int send_ok_upstream(MAXROWS_SESSION_DATA *csdata)
{ {
/* Note: sequence id is always 01 (4th byte) */ /* Note: sequence id is always 01 (4th byte) */
uint8_t ok[MAXROWS_OK_PACKET_LEN] = {07,00,00,01,00,00,00,02,00,00,00}; uint8_t ok[MAXROWS_OK_PACKET_LEN] = {07, 00, 00, 01, 00, 00, 00, 02, 00, 00, 00};
GWBUF *packet = gwbuf_alloc(MAXROWS_OK_PACKET_LEN); GWBUF *packet = gwbuf_alloc(MAXROWS_OK_PACKET_LEN);
uint8_t *ptr = GWBUF_DATA(packet); uint8_t *ptr = GWBUF_DATA(packet);
memcpy(ptr, &ok, MAXROWS_OK_PACKET_LEN); memcpy(ptr, &ok, MAXROWS_OK_PACKET_LEN);

View File

@ -340,10 +340,10 @@ MXS_MODULE* MXS_CREATE_MODULE()
{"user", MXS_MODULE_PARAM_STRING}, {"user", MXS_MODULE_PARAM_STRING},
{ {
"options", "options",
MXS_MODULE_PARAM_ENUM, MXS_MODULE_PARAM_ENUM,
"ignorecase", "ignorecase",
MXS_MODULE_OPT_NONE, MXS_MODULE_OPT_NONE,
option_values option_values
}, },
{MXS_END_MODULE_PARAMS} {MXS_END_MODULE_PARAMS}
} }
@ -925,20 +925,20 @@ int reset_session_state(TEE_SESSION* my_session, GWBUF* buffer)
switch (command) switch (command)
{ {
case 0x1b: case 0x1b:
my_session->client_multistatement = *((unsigned char*) buffer->start + 5); my_session->client_multistatement = *((unsigned char*) buffer->start + 5);
MXS_INFO("client %s multistatements", MXS_INFO("client %s multistatements",
my_session->client_multistatement ? "enabled" : "disabled"); my_session->client_multistatement ? "enabled" : "disabled");
case 0x03: case 0x03:
case 0x16: case 0x16:
case 0x17: case 0x17:
case 0x04: case 0x04:
case 0x0a: case 0x0a:
memset(my_session->multipacket, (char) true, 2 * sizeof(bool)); memset(my_session->multipacket, (char) true, 2 * sizeof(bool));
break; break;
default: default:
memset(my_session->multipacket, (char) false, 2 * sizeof(bool)); memset(my_session->multipacket, (char) false, 2 * sizeof(bool));
break; break;
} }
memset(my_session->replies, 0, 2 * sizeof(int)); memset(my_session->replies, 0, 2 * sizeof(int));

View File

@ -173,7 +173,6 @@ static void
freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session) freeSession(MXS_FILTER *instance, MXS_FILTER_SESSION *session)
{ {
MXS_FREE(session); MXS_FREE(session);
return;
} }
/** /**

View File

@ -171,10 +171,10 @@ MXS_MODULE* MXS_CREATE_MODULE()
{"user", MXS_MODULE_PARAM_STRING}, {"user", MXS_MODULE_PARAM_STRING},
{ {
"options", "options",
MXS_MODULE_PARAM_ENUM, MXS_MODULE_PARAM_ENUM,
"ignorecase", "ignorecase",
MXS_MODULE_OPT_NONE, MXS_MODULE_OPT_NONE,
option_values option_values
}, },
{MXS_END_MODULE_PARAMS} {MXS_END_MODULE_PARAMS}
} }

View File

@ -283,7 +283,7 @@ createInstance(const char *name, char **options, CONFIG_PARAMETER *params)
} }
} }
return(MXS_FILTER *)my_instance; return (MXS_FILTER *)my_instance;
} }
/** /**