diff --git a/server/modules/filter/cache/cache.cc b/server/modules/filter/cache/cache.cc index daab3121e..1a2355336 100644 --- a/server/modules/filter/cache/cache.cc +++ b/server/modules/filter/cache/cache.cc @@ -124,7 +124,7 @@ json_t* Cache::show_json() const cache_result_t Cache::get_key(const char* zDefault_db, const GWBUF* pQuery, - CACHE_KEY* pKey) const + CACHE_KEY* pKey) const { // TODO: Take config into account. return get_default_key(zDefault_db, pQuery, pKey); @@ -133,7 +133,7 @@ cache_result_t Cache::get_key(const char* zDefault_db, // static cache_result_t Cache::get_default_key(const char* zDefault_db, const GWBUF* pQuery, - CACHE_KEY* pKey) + CACHE_KEY* pKey) { mxb_assert(GWBUF_IS_CONTIGUOUS(pQuery)); @@ -211,7 +211,7 @@ json_t* Cache::do_get_info(uint32_t what) const } -//static +// static uint64_t Cache::time_ms() { timespec t; @@ -219,7 +219,7 @@ uint64_t Cache::time_ms() int rv = clock_gettime(CLOCK_MONOTONIC_COARSE, &t); if (rv != 0) { - mxb_assert(errno == EINVAL); // CLOCK_MONOTONIC_COARSE not supported. + mxb_assert(errno == EINVAL); // CLOCK_MONOTONIC_COARSE not supported. rv = clock_gettime(CLOCK_MONOTONIC, &t); mxb_assert(rv == 0); } diff --git a/server/modules/filter/cache/cache.hh b/server/modules/filter/cache/cache.hh index 5143c5956..a9193d86f 100644 --- a/server/modules/filter/cache/cache.hh +++ b/server/modules/filter/cache/cache.hh @@ -112,7 +112,7 @@ public: */ cache_result_t get_key(const char* zDefault_db, const GWBUF* pQuery, - CACHE_KEY* pKey) const; + CACHE_KEY* pKey) const; /** * Returns a key for the statement. Does not take the current config @@ -126,7 +126,7 @@ public: */ static cache_result_t get_default_key(const char* zDefault_db, const GWBUF* pQuery, - CACHE_KEY* pKey); + CACHE_KEY* pKey); /** * See @Storage::get_value @@ -135,7 +135,7 @@ public: uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppValue) const = 0; + GWBUF** ppValue) const = 0; /** * See @Storage::put_value diff --git a/server/modules/filter/cache/cache_storage_api.hh b/server/modules/filter/cache/cache_storage_api.hh index f2520ea48..56ed57da0 100644 --- a/server/modules/filter/cache/cache_storage_api.hh +++ b/server/modules/filter/cache/cache_storage_api.hh @@ -231,7 +231,7 @@ typedef struct cache_storage_api uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** result); + GWBUF** result); /** * Put a value to the cache. diff --git a/server/modules/filter/cache/cacheconfig.cc b/server/modules/filter/cache/cacheconfig.cc index 10aeb62f4..0b86735bb 100644 --- a/server/modules/filter/cache/cacheconfig.cc +++ b/server/modules/filter/cache/cacheconfig.cc @@ -41,7 +41,7 @@ config::ParamDuration CacheConfig::s_hard_ttl( "used before it is discarded and the result is fetched from the backend. " "See also 'soft_ttl'.", mxs::config::INTERPRET_AS_SECONDS, - std::chrono::milliseconds { 0 } + std::chrono::milliseconds {0} ); config::ParamDuration CacheConfig::s_soft_ttl( @@ -51,7 +51,7 @@ config::ParamDuration CacheConfig::s_soft_ttl( "used before the first client querying for the result is used for refreshing " "the cached data from the backend. See also 'hard_ttl'.", mxs::config::INTERPRET_AS_SECONDS, - std::chrono::milliseconds { 0 } + std::chrono::milliseconds {0} ); config::ParamCount CacheConfig::s_max_resultset_rows( @@ -107,10 +107,10 @@ config::ParamEnum CacheConfig::s_thread_model( &s_specification, "cached_data", "An enumeration option specifying how data is shared between threads.", - { - { CACHE_THREAD_MODEL_MT, "shared" }, - { CACHE_THREAD_MODEL_ST, "thread_specific" } - }, +{ + {CACHE_THREAD_MODEL_MT, "shared"}, + {CACHE_THREAD_MODEL_ST, "thread_specific"} +}, CACHE_THREAD_MODEL_ST ); @@ -119,10 +119,10 @@ config::ParamEnum CacheConfig::s_selects( "selects", "An enumeration option specifying what approach the cache should take with " "respect to SELECT statements.", - { - { CACHE_SELECTS_ASSUME_CACHEABLE, "assume_cacheable" }, - { CACHE_SELECTS_VERIFY_CACHEABLE, "verify_cacheable" } - }, +{ + {CACHE_SELECTS_ASSUME_CACHEABLE, "assume_cacheable"}, + {CACHE_SELECTS_VERIFY_CACHEABLE, "verify_cacheable"} +}, CACHE_SELECTS_ASSUME_CACHEABLE ); @@ -131,11 +131,11 @@ config::ParamEnum CacheConfig::s_cache_in_trxs( "cache_in_transactions", "An enumeration option specifying how the cache should behave when there " "are active transactions.", - { - { CACHE_IN_TRXS_NEVER, "never" }, - { CACHE_IN_TRXS_READ_ONLY, "read_only_transactions" }, - { CACHE_IN_TRXS_ALL, "all_transactions" } - }, +{ + {CACHE_IN_TRXS_NEVER, "never"}, + {CACHE_IN_TRXS_READ_ONLY, "read_only_transactions"}, + {CACHE_IN_TRXS_ALL, "all_transactions"} +}, CACHE_IN_TRXS_ALL ); @@ -224,7 +224,7 @@ bool CacheConfig::configure() if (this->soft_ttl > this->hard_ttl) { MXS_WARNING("The value of 'soft_ttl' must be less than or equal to that of 'hard_ttl'. " - "Setting 'soft_ttl' to the same value as 'hard_ttl'."); + "Setting 'soft_ttl' to the same value as 'hard_ttl'."); this->soft_ttl = this->hard_ttl; } diff --git a/server/modules/filter/cache/cacheconfig.hh b/server/modules/filter/cache/cacheconfig.hh index d606c894d..b64da6e79 100644 --- a/server/modules/filter/cache/cacheconfig.hh +++ b/server/modules/filter/cache/cacheconfig.hh @@ -42,7 +42,7 @@ public: ~CacheConfig(); CacheConfig(const CacheConfig&) = delete; - CacheConfig& operator = (const CacheConfig&) = delete; + CacheConfig& operator=(const CacheConfig&) = delete; using milliseconds = std::chrono::milliseconds; @@ -60,9 +60,9 @@ public: config::Enum selects; config::Enum cache_in_trxs; config::Bool enabled; - char* zStorage_options { nullptr}; /**< Raw options for storage module. */ - char** storage_argv { nullptr }; /**< Cooked options for storage module. */ - int storage_argc { 0 }; /**< Number of cooked options. */ + char* zStorage_options {nullptr}; /**< Raw options for storage module. */ + char** storage_argv {nullptr}; /**< Cooked options for storage module. */ + int storage_argc {0}; /**< Number of cooked options. */ static const config::Specification& specification() { @@ -73,7 +73,7 @@ private: bool configure() override; private: - static config::Specification s_specification; + static config::Specification s_specification; static config::ParamString s_storage; static config::ParamString s_storage_options; diff --git a/server/modules/filter/cache/cachept.cc b/server/modules/filter/cache/cachept.cc index 6d0e0e599..760c09dd5 100644 --- a/server/modules/filter/cache/cachept.cc +++ b/server/modules/filter/cache/cachept.cc @@ -50,7 +50,7 @@ CachePT::CachePT(const std::string& name, const CacheConfig* pConfig, const std::vector& rules, SStorageFactory sFactory, - const Caches& caches) + const Caches& caches) : Cache(name, pConfig, rules, sFactory) , m_caches(caches) { @@ -131,7 +131,7 @@ cache_result_t CachePT::get_value(const CACHE_KEY& key, uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppValue) const + GWBUF** ppValue) const { return thread_cache().get_value(key, flags, soft_ttl, hard_ttl, ppValue); } diff --git a/server/modules/filter/cache/cachept.hh b/server/modules/filter/cache/cachept.hh index c23e068d0..6aeeb4e47 100644 --- a/server/modules/filter/cache/cachept.hh +++ b/server/modules/filter/cache/cachept.hh @@ -36,7 +36,7 @@ public: uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppValue) const; + GWBUF** ppValue) const; cache_result_t put_value(const CACHE_KEY& key, const GWBUF* pValue); @@ -50,7 +50,7 @@ private: const CacheConfig* pConfig, const std::vector& rules, SStorageFactory sFactory, - const Caches& caches); + const Caches& caches); static CachePT* Create(const std::string& name, const CacheConfig* pConfig, diff --git a/server/modules/filter/cache/cachesimple.cc b/server/modules/filter/cache/cachesimple.cc index d4d2ee7c9..acd3338c3 100644 --- a/server/modules/filter/cache/cachesimple.cc +++ b/server/modules/filter/cache/cachesimple.cc @@ -56,7 +56,7 @@ cache_result_t CacheSimple::get_value(const CACHE_KEY& key, uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppValue) const + GWBUF** ppValue) const { return m_pStorage->get_value(key, flags, soft_ttl, hard_ttl, ppValue); } diff --git a/server/modules/filter/cache/cachesimple.hh b/server/modules/filter/cache/cachesimple.hh index ba5930de7..afa57fbc6 100644 --- a/server/modules/filter/cache/cachesimple.hh +++ b/server/modules/filter/cache/cachesimple.hh @@ -28,7 +28,7 @@ public: uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppValue) const; + GWBUF** ppValue) const; cache_result_t put_value(const CACHE_KEY& key, const GWBUF* pValue); diff --git a/server/modules/filter/cache/lrustorage.cc b/server/modules/filter/cache/lrustorage.cc index 149c2d66a..b7ef97119 100644 --- a/server/modules/filter/cache/lrustorage.cc +++ b/server/modules/filter/cache/lrustorage.cc @@ -76,7 +76,7 @@ cache_result_t LRUStorage::do_get_value(const CACHE_KEY& key, uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppValue) const + GWBUF** ppValue) const { return access_value(APPROACH_GET, key, flags, soft_ttl, hard_ttl, ppValue); } @@ -220,11 +220,11 @@ cache_result_t LRUStorage::do_get_items(uint64_t* pItems) const } cache_result_t LRUStorage::access_value(access_approach_t approach, - const CACHE_KEY& key, + const CACHE_KEY& key, uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppValue) const + GWBUF** ppValue) const { cache_result_t result = CACHE_RESULT_NOT_FOUND; diff --git a/server/modules/filter/cache/lrustorage.hh b/server/modules/filter/cache/lrustorage.hh index d7235868e..bbb9310a1 100644 --- a/server/modules/filter/cache/lrustorage.hh +++ b/server/modules/filter/cache/lrustorage.hh @@ -43,7 +43,7 @@ protected: uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppValue) const; + GWBUF** ppValue) const; /** * @see Storage::put_value @@ -89,15 +89,15 @@ private: }; cache_result_t access_value(access_approach_t approach, - const CACHE_KEY& key, + const CACHE_KEY& key, uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppValue) const; + GWBUF** ppValue) const; cache_result_t peek_value(const CACHE_KEY& key, uint32_t flags, - GWBUF** ppValue) const + GWBUF** ppValue) const { return access_value(APPROACH_PEEK, key, flags, CACHE_USE_CONFIG_TTL, CACHE_USE_CONFIG_TTL, ppValue); } diff --git a/server/modules/filter/cache/lrustoragemt.cc b/server/modules/filter/cache/lrustoragemt.cc index 63c04de25..abd6b0ff7 100644 --- a/server/modules/filter/cache/lrustoragemt.cc +++ b/server/modules/filter/cache/lrustoragemt.cc @@ -45,7 +45,7 @@ cache_result_t LRUStorageMT::get_value(const CACHE_KEY& key, uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppValue) const + GWBUF** ppValue) const { std::lock_guard guard(m_lock); diff --git a/server/modules/filter/cache/lrustoragemt.hh b/server/modules/filter/cache/lrustoragemt.hh index 1af0363d2..875805b71 100644 --- a/server/modules/filter/cache/lrustoragemt.hh +++ b/server/modules/filter/cache/lrustoragemt.hh @@ -32,7 +32,7 @@ public: uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppValue) const; + GWBUF** ppValue) const; cache_result_t put_value(const CACHE_KEY& key, const GWBUF* pValue); diff --git a/server/modules/filter/cache/lrustoragest.cc b/server/modules/filter/cache/lrustoragest.cc index 2fcd17bc6..b24e57596 100644 --- a/server/modules/filter/cache/lrustoragest.cc +++ b/server/modules/filter/cache/lrustoragest.cc @@ -43,7 +43,7 @@ cache_result_t LRUStorageST::get_value(const CACHE_KEY& key, uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppValue) const + GWBUF** ppValue) const { return LRUStorage::do_get_value(key, flags, soft_ttl, hard_ttl, ppValue); } diff --git a/server/modules/filter/cache/lrustoragest.hh b/server/modules/filter/cache/lrustoragest.hh index e6d6eb6f0..fbda3bdfb 100644 --- a/server/modules/filter/cache/lrustoragest.hh +++ b/server/modules/filter/cache/lrustoragest.hh @@ -29,7 +29,7 @@ public: uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppValue) const; + GWBUF** ppValue) const; cache_result_t put_value(const CACHE_KEY& key, const GWBUF* pValue); diff --git a/server/modules/filter/cache/storage.hh b/server/modules/filter/cache/storage.hh index e7a157a55..64f3addea 100644 --- a/server/modules/filter/cache/storage.hh +++ b/server/modules/filter/cache/storage.hh @@ -68,11 +68,11 @@ public: uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppValue) const = 0; + GWBUF** ppValue) const = 0; cache_result_t get_value(const CACHE_KEY& key, uint32_t flags, - GWBUF** ppValue) const + GWBUF** ppValue) const { return get_value(key, flags, CACHE_USE_CONFIG_TTL, CACHE_USE_CONFIG_TTL, ppValue); } diff --git a/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.cc b/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.cc index 3b95c61ae..104b277b4 100644 --- a/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.cc +++ b/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.cc @@ -32,7 +32,6 @@ const size_t INMEMORY_KEY_LENGTH = 2 * SHA512_DIGEST_LENGTH; #if INMEMORY_KEY_LENGTH > CACHE_KEY_MAXLEN #error storage_inmemory key is too long. #endif - } InMemoryStorage::InMemoryStorage(const string& name, const CACHE_STORAGE_CONFIG& config) @@ -137,7 +136,7 @@ cache_result_t InMemoryStorage::do_get_value(const CACHE_KEY& key, uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppResult) + GWBUF** ppResult) { cache_result_t result = CACHE_RESULT_NOT_FOUND; diff --git a/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.hh b/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.hh index 89408646a..b81584d47 100644 --- a/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.hh +++ b/server/modules/filter/cache/storage/storage_inmemory/inmemorystorage.hh @@ -37,7 +37,7 @@ public: uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppResult) = 0; + GWBUF** ppResult) = 0; virtual cache_result_t put_value(const CACHE_KEY& key, const GWBUF& value) = 0; virtual cache_result_t del_value(const CACHE_KEY& key) = 0; @@ -55,7 +55,7 @@ protected: uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppResult); + GWBUF** ppResult); cache_result_t do_put_value(const CACHE_KEY& key, const GWBUF& value); cache_result_t do_del_value(const CACHE_KEY& key); diff --git a/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragemt.cc b/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragemt.cc index 893569301..64e0d12b9 100644 --- a/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragemt.cc +++ b/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragemt.cc @@ -45,7 +45,7 @@ cache_result_t InMemoryStorageMT::get_value(const CACHE_KEY& key, uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppResult) + GWBUF** ppResult) { std::lock_guard guard(m_lock); diff --git a/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragemt.hh b/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragemt.hh index 3370e7448..f1ba0ae03 100644 --- a/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragemt.hh +++ b/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragemt.hh @@ -35,7 +35,7 @@ public: uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppResult); + GWBUF** ppResult); cache_result_t put_value(const CACHE_KEY& key, const GWBUF& value); cache_result_t del_value(const CACHE_KEY& key); diff --git a/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragest.cc b/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragest.cc index aac46065b..e2174fdff 100644 --- a/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragest.cc +++ b/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragest.cc @@ -43,7 +43,7 @@ cache_result_t InMemoryStorageST::get_value(const CACHE_KEY& key, uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppResult) + GWBUF** ppResult) { return do_get_value(key, flags, soft_ttl, hard_ttl, ppResult); } diff --git a/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragest.hh b/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragest.hh index b62d40eb8..6b2e95c2e 100644 --- a/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragest.hh +++ b/server/modules/filter/cache/storage/storage_inmemory/inmemorystoragest.hh @@ -32,7 +32,7 @@ public: uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppResult); + GWBUF** ppResult); cache_result_t put_value(const CACHE_KEY& key, const GWBUF& pValue); cache_result_t del_value(const CACHE_KEY& key); diff --git a/server/modules/filter/cache/storage/storage_inmemory/storage_inmemory.cc b/server/modules/filter/cache/storage/storage_inmemory/storage_inmemory.cc index 25706559c..ceb12c6db 100644 --- a/server/modules/filter/cache/storage/storage_inmemory/storage_inmemory.cc +++ b/server/modules/filter/cache/storage/storage_inmemory/storage_inmemory.cc @@ -20,8 +20,8 @@ extern "C" { - CACHE_STORAGE_API* CacheGetStorageAPI() - { - return &StorageModule::s_api; - } +CACHE_STORAGE_API* CacheGetStorageAPI() +{ + return &StorageModule::s_api; +} } diff --git a/server/modules/filter/cache/storage/storagemodule.hh b/server/modules/filter/cache/storage/storagemodule.hh index 0f385b356..fa0dea9c4 100644 --- a/server/modules/filter/cache/storage/storagemodule.hh +++ b/server/modules/filter/cache/storage/storagemodule.hh @@ -74,7 +74,7 @@ public: uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppResult) + GWBUF** ppResult) { mxb_assert(pCache_storage); mxb_assert(pKey); diff --git a/server/modules/filter/cache/storagereal.cc b/server/modules/filter/cache/storagereal.cc index d74030040..61804e13a 100644 --- a/server/modules/filter/cache/storagereal.cc +++ b/server/modules/filter/cache/storagereal.cc @@ -42,7 +42,7 @@ cache_result_t StorageReal::get_value(const CACHE_KEY& key, uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppValue) const + GWBUF** ppValue) const { return m_pApi->getValue(m_pStorage, &key, flags, soft_ttl, hard_ttl, ppValue); } diff --git a/server/modules/filter/cache/storagereal.hh b/server/modules/filter/cache/storagereal.hh index 19d462ecb..6e1398dd1 100644 --- a/server/modules/filter/cache/storagereal.hh +++ b/server/modules/filter/cache/storagereal.hh @@ -29,7 +29,7 @@ public: uint32_t flags, uint32_t soft_ttl, uint32_t hard_ttl, - GWBUF** ppValue) const; + GWBUF** ppValue) const; cache_result_t put_value(const CACHE_KEY& key, const GWBUF* pValue); diff --git a/server/modules/filter/cache/test/testerstorage.cc b/server/modules/filter/cache/test/testerstorage.cc index 1831172c0..d4d31adc4 100644 --- a/server/modules/filter/cache/test/testerstorage.cc +++ b/server/modules/filter/cache/test/testerstorage.cc @@ -26,14 +26,14 @@ unsigned int millisleep(unsigned int milliseconds) unsigned int seconds = milliseconds / 1000; milliseconds -= (seconds * 1000); - timespec req = { seconds, milliseconds * 1000000 }; - timespec rem = { 0, 0 }; + // Parentheses required by uncrustify, otherwise it'll think it's a pointer + timespec req = {seconds, (milliseconds * 1000000)}; + timespec rem = {0, 0}; nanosleep(&req, &rem); return rem.tv_sec * 1000 + rem.tv_nsec / 1000000; } - } // diff --git a/server/modules/filter/cache/test/teststorage.cc b/server/modules/filter/cache/test/teststorage.cc index 1bad3fb3f..ebbb034f8 100644 --- a/server/modules/filter/cache/test/teststorage.cc +++ b/server/modules/filter/cache/test/teststorage.cc @@ -27,11 +27,11 @@ using namespace std; TestStorage::TestStorage(ostream* pOut, - size_t threads, - size_t seconds, - size_t items, - size_t min_size, - size_t max_size) + size_t threads, + size_t seconds, + size_t items, + size_t min_size, + size_t max_size) : m_out(*pOut) , m_threads(threads) , m_seconds(seconds) diff --git a/server/modules/filter/ccrfilter/ccrfilter.cc b/server/modules/filter/ccrfilter/ccrfilter.cc index c6af4eb82..1b77808f8 100644 --- a/server/modules/filter/ccrfilter/ccrfilter.cc +++ b/server/modules/filter/ccrfilter/ccrfilter.cc @@ -39,7 +39,6 @@ const MXS_ENUM_VALUE option_values[] = {"extended", PCRE2_EXTENDED}, {NULL} }; - } class CCRFilter; @@ -62,7 +61,7 @@ private: CCRFilter& m_instance; int m_hints_left = 0; /* Number of hints left to add to queries */ time_t m_last_modification = 0; /* Time of the last data modifying operation */ - pcre2_match_data* m_md = nullptr; /* PCRE2 match data */ + pcre2_match_data* m_md = nullptr; /* PCRE2 match data */ enum CcrHintValue { @@ -183,8 +182,8 @@ private: int m_count = 0; /* Number of hints to add after each operation that modifies data. */ LagStats m_stats; - pcre2_code* re = nullptr; /* Compiled regex text of match */ - pcre2_code* nore = nullptr; /* Compiled regex text of ignore */ + pcre2_code* re = nullptr; /* Compiled regex text of match */ + pcre2_code* nore = nullptr; /* Compiled regex text of ignore */ uint32_t ovector_size = 0; /* PCRE2 match data ovector size */ }; @@ -343,16 +342,22 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() "V1.1.0", RCAP_TYPE_CONTIGUOUS_INPUT, &CCRFilter::s_object, - NULL, /* Process init. */ - NULL, /* Process finish. */ - NULL, /* Thread init. */ - NULL, /* Thread finish. */ + NULL, + NULL, + NULL, + NULL, { - {"count", MXS_MODULE_PARAM_COUNT, "0"}, - {"time", MXS_MODULE_PARAM_DURATION, "60s"}, - {PARAM_MATCH, MXS_MODULE_PARAM_REGEX}, - {PARAM_IGNORE, MXS_MODULE_PARAM_REGEX}, - {"options", MXS_MODULE_PARAM_ENUM, "ignorecase", MXS_MODULE_OPT_NONE, option_values}, + {"count", MXS_MODULE_PARAM_COUNT, "0" }, + {"time", MXS_MODULE_PARAM_DURATION, "60s"}, + {PARAM_MATCH, MXS_MODULE_PARAM_REGEX}, + {PARAM_IGNORE, MXS_MODULE_PARAM_REGEX}, + { + "options", + MXS_MODULE_PARAM_ENUM, + "ignorecase", + MXS_MODULE_OPT_NONE, + option_values + }, {MXS_END_MODULE_PARAMS} } }; diff --git a/server/modules/filter/comment/commentfilter.cc b/server/modules/filter/comment/commentfilter.cc index eb5dc1a67..8e581c46b 100644 --- a/server/modules/filter/comment/commentfilter.cc +++ b/server/modules/filter/comment/commentfilter.cc @@ -50,7 +50,8 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() return &info; } -CommentFilter::CommentFilter(std::string comment) : m_comment(comment) +CommentFilter::CommentFilter(std::string comment) + : m_comment(comment) { MXS_INFO("Comment filter with comment [%s] created.", m_comment.c_str()); } diff --git a/server/modules/filter/dbfwfilter/dbfwfilter.cc b/server/modules/filter/dbfwfilter/dbfwfilter.cc index 6dcdc2367..0e2e36b30 100644 --- a/server/modules/filter/dbfwfilter/dbfwfilter.cc +++ b/server/modules/filter/dbfwfilter/dbfwfilter.cc @@ -148,7 +148,7 @@ public: if (!(m_options & m_option)) { uint32_t options = (m_options | m_option); - MXB_AT_DEBUG(bool rv = )qc_set_options(options); + MXB_AT_DEBUG(bool rv = ) qc_set_options(options); mxb_assert(rv); m_disable = true; } @@ -159,7 +159,7 @@ public: { if (m_disable) { - MXB_AT_DEBUG(bool rv = )qc_set_options(m_options); + MXB_AT_DEBUG(bool rv = ) qc_set_options(m_options); mxb_assert(rv); } } @@ -169,7 +169,6 @@ private: uint32_t m_options; bool m_disable; }; - } bool parse_at_times(const char** tok, char** saveptr, Rule* ruledef); @@ -1799,8 +1798,8 @@ static char* create_parse_error(Dbfw* my_instance, bool rule_matches(Dbfw* my_instance, DbfwSession* my_session, GWBUF* queue, - SRule rule, - char* query) + SRule rule, + char* query) { mxb_assert(GWBUF_IS_CONTIGUOUS(queue)); char* msg = NULL; diff --git a/server/modules/filter/dbfwfilter/dbfwfilter.hh b/server/modules/filter/dbfwfilter/dbfwfilter.hh index cf03ea772..7db83f678 100644 --- a/server/modules/filter/dbfwfilter/dbfwfilter.hh +++ b/server/modules/filter/dbfwfilter/dbfwfilter.hh @@ -313,6 +313,6 @@ char* create_error(const char* format, ...); bool rule_matches(Dbfw* my_instance, DbfwSession* my_session, GWBUF* queue, - SRule rule, - char* query); + SRule rule, + char* query); bool rule_is_active(SRule rule); diff --git a/server/modules/filter/hintfilter/hintfilter.cc b/server/modules/filter/hintfilter/hintfilter.cc index 7c20d9c30..a005c8404 100644 --- a/server/modules/filter/hintfilter/hintfilter.cc +++ b/server/modules/filter/hintfilter/hintfilter.cc @@ -87,26 +87,26 @@ extern "C" * * @return The module object */ - MXS_MODULE* MXS_CREATE_MODULE() +MXS_MODULE* MXS_CREATE_MODULE() +{ + static MXS_MODULE info = { - static MXS_MODULE info = + MXS_MODULE_API_FILTER, + MXS_MODULE_ALPHA_RELEASE, + MXS_FILTER_VERSION, + "A hint parsing filter", + "V1.0.0", + RCAP_TYPE_CONTIGUOUS_INPUT, + &HintInstance::s_object, + NULL, /* Process init. */ + NULL, /* Process finish. */ + NULL, /* Thread init. */ + NULL, /* Thread finish. */ { - MXS_MODULE_API_FILTER, - MXS_MODULE_ALPHA_RELEASE, - MXS_FILTER_VERSION, - "A hint parsing filter", - "V1.0.0", - RCAP_TYPE_CONTIGUOUS_INPUT, - &HintInstance::s_object, - NULL, /* Process init. */ - NULL, /* Process finish. */ - NULL, /* Thread init. */ - NULL, /* Thread finish. */ - { - {MXS_END_MODULE_PARAMS} - } - }; + {MXS_END_MODULE_PARAMS} + } + }; - return &info; - } + return &info; +} } diff --git a/server/modules/filter/hintfilter/test/test_hintparser.cc b/server/modules/filter/hintfilter/test/test_hintparser.cc index 0da2ebdb6..36d9e61e6 100644 --- a/server/modules/filter/hintfilter/test/test_hintparser.cc +++ b/server/modules/filter/hintfilter/test/test_hintparser.cc @@ -36,7 +36,7 @@ void test(const std::string& input, std::initializer_list expected) if (it == expected.end()) { std::cout << "Too much output: " << std::string(output.first, output.second) << std::endl; - errors++;; + errors++; break; } @@ -46,12 +46,12 @@ void test(const std::string& input, std::initializer_list expected) if (have != need) { std::cout << "Need " << need << " bytes but only have " << have << std::endl; - errors++;; + errors++; } else if (!std::equal(output.first, output.second, it->begin())) { std::cout << "Output not equal to expected output" << std::endl; - errors++;; + errors++; } if (!rval) @@ -69,7 +69,7 @@ void test(const std::string& input, std::initializer_list expected) { std::cout << "Not enough output, need " << std::distance(it, expected.end()) << " more comments" << std::endl; - errors++;; + errors++; } } @@ -93,7 +93,7 @@ void test_parse(const std::string& input, int expected_type) else if (hint && hint->type != expected_type) { std::cout << "Expected hint of type " << expected_type << " but got type " - << (int)hint->type << ": " << input << std::endl; + << (int)hint->type << ": " << input << std::endl; errors++; } diff --git a/server/modules/filter/insertstream/insertstream.cc b/server/modules/filter/insertstream/insertstream.cc index 1df55be5f..8033f8966 100644 --- a/server/modules/filter/insertstream/insertstream.cc +++ b/server/modules/filter/insertstream/insertstream.cc @@ -97,47 +97,47 @@ extern "C" * * @return The module object */ - MXS_MODULE* MXS_CREATE_MODULE() +MXS_MODULE* MXS_CREATE_MODULE() +{ + + static MXS_FILTER_OBJECT MyObject = { + createInstance, + newSession, + closeSession, + freeSession, + setDownstream, + setUpstream, + routeQuery, + clientReply, + diagnostic, + diagnostic_json, + getCapabilities, + NULL, + }; - static MXS_FILTER_OBJECT MyObject = + static MXS_MODULE info = + { + MXS_MODULE_API_FILTER, + MXS_MODULE_EXPERIMENTAL, + MXS_FILTER_VERSION, + "Data streaming filter", + "1.0.0", + RCAP_TYPE_TRANSACTION_TRACKING, + &MyObject, + NULL, + NULL, + NULL, + NULL, { - createInstance, - newSession, - closeSession, - freeSession, - setDownstream, - setUpstream, - routeQuery, - clientReply, - diagnostic, - diagnostic_json, - getCapabilities, - NULL, - }; + {"source", MXS_MODULE_PARAM_STRING }, + {"user", MXS_MODULE_PARAM_STRING }, + {MXS_END_MODULE_PARAMS} + } + }; - static MXS_MODULE info = - { - MXS_MODULE_API_FILTER, - MXS_MODULE_EXPERIMENTAL, - MXS_FILTER_VERSION, - "Data streaming filter", - "1.0.0", - RCAP_TYPE_TRANSACTION_TRACKING, - &MyObject, - NULL, - NULL, - NULL, - NULL, - { - {"source", MXS_MODULE_PARAM_STRING }, - {"user", MXS_MODULE_PARAM_STRING }, - {MXS_END_MODULE_PARAMS} - } - }; - - return &info; - } + return &info; +} } /** diff --git a/server/modules/filter/luafilter/luafilter.cc b/server/modules/filter/luafilter/luafilter.cc index d955631c7..4079b7cac 100644 --- a/server/modules/filter/luafilter/luafilter.cc +++ b/server/modules/filter/luafilter/luafilter.cc @@ -47,7 +47,6 @@ extern "C" #include #include #include - } #include @@ -87,46 +86,46 @@ extern "C" * * @return The module object */ - MXS_MODULE* MXS_CREATE_MODULE() +MXS_MODULE* MXS_CREATE_MODULE() +{ + static MXS_FILTER_OBJECT MyObject = { - static MXS_FILTER_OBJECT MyObject = - { - createInstance, - newSession, - closeSession, - freeSession, - setDownstream, - setUpstream, - routeQuery, - clientReply, - diagnostic, - diagnostic_json, - getCapabilities, - NULL, // No destroyInstance - }; + createInstance, + newSession, + closeSession, + freeSession, + setDownstream, + setUpstream, + routeQuery, + clientReply, + diagnostic, + diagnostic_json, + getCapabilities, + NULL, // No destroyInstance + }; - static MXS_MODULE info = + static MXS_MODULE info = + { + MXS_MODULE_API_FILTER, + MXS_MODULE_EXPERIMENTAL, + MXS_FILTER_VERSION, + "Lua Filter", + "V1.0.0", + RCAP_TYPE_CONTIGUOUS_INPUT, + &MyObject, + NULL, /* Process init. */ + NULL, /* Process finish. */ + NULL, /* Thread init. */ + NULL, /* Thread finish. */ { - MXS_MODULE_API_FILTER, - MXS_MODULE_EXPERIMENTAL, - MXS_FILTER_VERSION, - "Lua Filter", - "V1.0.0", - RCAP_TYPE_CONTIGUOUS_INPUT, - &MyObject, - NULL, /* Process init. */ - NULL, /* Process finish. */ - NULL, /* Thread init. */ - NULL, /* Thread finish. */ - { - {"global_script", MXS_MODULE_PARAM_PATH, NULL, MXS_MODULE_OPT_PATH_R_OK}, - {"session_script", MXS_MODULE_PARAM_PATH, NULL, MXS_MODULE_OPT_PATH_R_OK}, - {MXS_END_MODULE_PARAMS} - } - }; + {"global_script", MXS_MODULE_PARAM_PATH, NULL, MXS_MODULE_OPT_PATH_R_OK}, + {"session_script", MXS_MODULE_PARAM_PATH, NULL, MXS_MODULE_OPT_PATH_R_OK}, + {MXS_END_MODULE_PARAMS} + } + }; - return &info; - } + return &info; +} } static int id_pool = 0; diff --git a/server/modules/filter/masking/maskingfilter.cc b/server/modules/filter/masking/maskingfilter.cc index 85e4c4fca..c0c639eab 100644 --- a/server/modules/filter/masking/maskingfilter.cc +++ b/server/modules/filter/masking/maskingfilter.cc @@ -90,10 +90,10 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() "V1.0.0", RCAP_TYPE_CONTIGUOUS_INPUT | RCAP_TYPE_CONTIGUOUS_OUTPUT, &MaskingFilter::s_object, - NULL, /* Process init. */ - NULL, /* Process finish. */ - NULL, /* Thread init. */ - NULL, /* Thread finish. */ + NULL, /* Process init. */ + NULL, /* Process finish. */ + NULL, /* Thread init. */ + NULL, /* Thread finish. */ { { Config::rules_name, diff --git a/server/modules/filter/masking/maskingfilterconfig.cc b/server/modules/filter/masking/maskingfilterconfig.cc index e885e7897..2894eb162 100644 --- a/server/modules/filter/masking/maskingfilterconfig.cc +++ b/server/modules/filter/masking/maskingfilterconfig.cc @@ -17,24 +17,23 @@ namespace { -const char config_name_check_subqueries[] = "check_subqueries"; -const char config_name_check_unions[] = "check_unions"; -const char config_name_check_user_variables[] = "check_user_variables"; -const char config_name_large_payload[] = "large_payload"; -const char config_name_prevent_function_usage[] = "prevent_function_usage"; -const char config_name_require_fully_parsed[] = "require_fully_parsed"; -const char config_name_rules[] = "rules"; -const char config_name_warn_type_mismatch[] = "warn_type_mismatch"; +const char config_name_check_subqueries[] = "check_subqueries"; +const char config_name_check_unions[] = "check_unions"; +const char config_name_check_user_variables[] = "check_user_variables"; +const char config_name_large_payload[] = "large_payload"; +const char config_name_prevent_function_usage[] = "prevent_function_usage"; +const char config_name_require_fully_parsed[] = "require_fully_parsed"; +const char config_name_rules[] = "rules"; +const char config_name_warn_type_mismatch[] = "warn_type_mismatch"; const char config_name_treat_string_arg_as_field[] = "treat_string_arg_as_field"; -const char config_value_abort[] = "abort"; +const char config_value_abort[] = "abort"; const char config_value_always[] = "always"; const char config_value_ignore[] = "ignore"; -const char config_value_never[] = "never"; +const char config_value_never[] = "never"; const char config_value_true[] = "true"; - } /* diff --git a/server/modules/filter/masking/maskingfiltersession.cc b/server/modules/filter/masking/maskingfiltersession.cc index e1c212ed6..f75698e16 100644 --- a/server/modules/filter/masking/maskingfiltersession.cc +++ b/server/modules/filter/masking/maskingfiltersession.cc @@ -67,7 +67,7 @@ public: if (!(m_options & m_option)) { uint32_t options = (m_options | m_option); - MXB_AT_DEBUG(bool rv = )qc_set_options(options); + MXB_AT_DEBUG(bool rv = ) qc_set_options(options); mxb_assert(rv); m_disable = true; } @@ -78,7 +78,7 @@ public: { if (m_disable) { - MXB_AT_DEBUG(bool rv = )qc_set_options(m_options); + MXB_AT_DEBUG(bool rv = ) qc_set_options(m_options); mxb_assert(rv); } } @@ -88,7 +88,6 @@ private: uint32_t m_options; bool m_disable; }; - } MaskingFilterSession::MaskingFilterSession(MXS_SESSION* pSession, const MaskingFilter* pFilter) @@ -580,19 +579,19 @@ bool MaskingFilterSession::is_function_used(GWBUF* pPacket, const char* zUser, c SMaskingRules sRules = m_filter.rules(); auto pred1 = [&sRules, zUser, zHost](const QC_FIELD_INFO& field_info) { - const MaskingRules::Rule* pRule = sRules->get_rule_for(field_info, zUser, zHost); + const MaskingRules::Rule* pRule = sRules->get_rule_for(field_info, zUser, zHost); - return pRule ? true : false; - }; + return pRule ? true : false; + }; auto pred2 = [&sRules, zUser, zHost, &pred1](const QC_FUNCTION_INFO& function_info) { - const QC_FIELD_INFO* begin = function_info.fields; - const QC_FIELD_INFO* end = begin + function_info.n_fields; + const QC_FIELD_INFO* begin = function_info.fields; + const QC_FIELD_INFO* end = begin + function_info.n_fields; - auto i = std::find_if(begin, end, pred1); + auto i = std::find_if(begin, end, pred1); - return i != end; - }; + return i != end; + }; const QC_FUNCTION_INFO* pInfos; size_t nInfos; @@ -627,20 +626,20 @@ bool MaskingFilterSession::is_variable_defined(GWBUF* pPacket, const char* zUser SMaskingRules sRules = m_filter.rules(); auto pred = [&sRules, zUser, zHost](const QC_FIELD_INFO& field_info) { - bool rv = false; + bool rv = false; - if (strcmp(field_info.column, "*") == 0) - { - // If "*" is used, then we must block if there is any rule for the current user. - rv = sRules->has_rule_for(zUser, zHost); - } - else - { - rv = sRules->get_rule_for(field_info, zUser, zHost) ? true : false; - } + if (strcmp(field_info.column, "*") == 0) + { + // If "*" is used, then we must block if there is any rule for the current user. + rv = sRules->has_rule_for(zUser, zHost); + } + else + { + rv = sRules->get_rule_for(field_info, zUser, zHost) ? true : false; + } - return rv; - }; + return rv; + }; const QC_FIELD_INFO* pInfos; size_t nInfos; @@ -701,23 +700,23 @@ bool MaskingFilterSession::is_union_or_subquery_used(GWBUF* pPacket, const char* } auto pred = [&sRules, mask, zUser, zHost](const QC_FIELD_INFO& field_info) { - bool rv = false; + bool rv = false; - if (field_info.context & mask) - { - if (strcmp(field_info.column, "*") == 0) + if (field_info.context & mask) { - // If "*" is used, then we must block if there is any rule for the current user. - rv = sRules->has_rule_for(zUser, zHost); + if (strcmp(field_info.column, "*") == 0) + { + // If "*" is used, then we must block if there is any rule for the current user. + rv = sRules->has_rule_for(zUser, zHost); + } + else + { + rv = sRules->get_rule_for(field_info, zUser, zHost) ? true : false; + } } - else - { - rv = sRules->get_rule_for(field_info, zUser, zHost) ? true : false; - } - } - return rv; - }; + return rv; + }; const QC_FIELD_INFO* pInfos; size_t nInfos; diff --git a/server/modules/filter/masking/maskingrules.cc b/server/modules/filter/masking/maskingrules.cc index 5489770cd..b7a1acca8 100644 --- a/server/modules/filter/masking/maskingrules.cc +++ b/server/modules/filter/masking/maskingrules.cc @@ -187,7 +187,7 @@ public: private: AccountRegexp(const string& user, const string& host, - pcre2_code* pCode) + pcre2_code* pCode) : m_user(user) , m_host(host) , m_pCode(pCode) @@ -692,7 +692,7 @@ static bool rule_get_common_values(json_t* pRule, std::string* column, std::string* table, std::string* database, - const char* rule_type) + const char* rule_type) { // Get database, table && column json_t* pDatabase = json_object_get(pRule, KEY_DATABASE); @@ -745,7 +745,7 @@ bool rule_get_values(json_t* pRule, std::string* column, std::string* table, std::string* database, - const char* rule_type) + const char* rule_type) { json_t* pKeyObj; // Get Key object based on 'rule_type' param @@ -1174,8 +1174,8 @@ bool MaskingRules::Rule::matches_account(const char* zUser, template inline void fill_buffer(FillIter f_first, FillIter f_last, - OutIter o_first, - OutIter o_last) + OutIter o_first, + OutIter o_last) { FillIter pFill = f_first; while (o_first != o_last) @@ -1471,8 +1471,8 @@ const MaskingRules::Rule* MaskingRules::get_rule_for(const QC_FIELD_INFO& field_ bool MaskingRules::has_rule_for(const char* zUser, const char* zHost) const { auto i = std::find_if(m_rules.begin(), m_rules.end(), [zUser, zHost](SRule sRule) { - return sRule->matches_account(zUser, zHost); - }); + return sRule->matches_account(zUser, zHost); + }); return i != m_rules.end(); } diff --git a/server/modules/filter/maxrows/maxrows.cc b/server/modules/filter/maxrows/maxrows.cc index 94c88ba2a..a8965c0cc 100644 --- a/server/modules/filter/maxrows/maxrows.cc +++ b/server/modules/filter/maxrows/maxrows.cc @@ -83,66 +83,66 @@ extern "C" * * @return The module object. */ - MXS_MODULE* MXS_CREATE_MODULE() +MXS_MODULE* MXS_CREATE_MODULE() +{ + static MXS_FILTER_OBJECT object = { - static MXS_FILTER_OBJECT object = - { - createInstance, - newSession, - closeSession, - freeSession, - setDownstream, - setUpstream, - routeQuery, - clientReply, - diagnostics, - diagnostics_json, - getCapabilities, - NULL, // No destroyInstance - }; + createInstance, + newSession, + closeSession, + freeSession, + setDownstream, + setUpstream, + routeQuery, + clientReply, + diagnostics, + diagnostics_json, + getCapabilities, + NULL, // No destroyInstance + }; - static MXS_MODULE info = + static MXS_MODULE info = + { + MXS_MODULE_API_FILTER, + MXS_MODULE_IN_DEVELOPMENT, + MXS_FILTER_VERSION, + "A filter that is capable of limiting the resultset number of rows.", + "V1.0.0", + RCAP_TYPE_STMT_INPUT | RCAP_TYPE_STMT_OUTPUT, + &object, + NULL, /* Process init. */ + NULL, /* Process finish. */ + NULL, /* Thread init. */ + NULL, /* Thread finish. */ { - MXS_MODULE_API_FILTER, - MXS_MODULE_IN_DEVELOPMENT, - MXS_FILTER_VERSION, - "A filter that is capable of limiting the resultset number of rows.", - "V1.0.0", - RCAP_TYPE_STMT_INPUT | RCAP_TYPE_STMT_OUTPUT, - &object, - NULL, /* Process init. */ - NULL, /* Process finish. */ - NULL, /* Thread init. */ - NULL, /* Thread finish. */ { - { - "max_resultset_rows", - MXS_MODULE_PARAM_COUNT, - MAXROWS_DEFAULT_MAX_RESULTSET_ROWS - }, - { - "max_resultset_size", - MXS_MODULE_PARAM_SIZE, - MAXROWS_DEFAULT_MAX_RESULTSET_SIZE - }, - { - "debug", - MXS_MODULE_PARAM_COUNT, - MAXROWS_DEFAULT_DEBUG - }, - { - "max_resultset_return", - MXS_MODULE_PARAM_ENUM, - "empty", - MXS_MODULE_OPT_ENUM_UNIQUE, - return_option_values - }, - {MXS_END_MODULE_PARAMS} - } - }; + "max_resultset_rows", + MXS_MODULE_PARAM_COUNT, + MAXROWS_DEFAULT_MAX_RESULTSET_ROWS + }, + { + "max_resultset_size", + MXS_MODULE_PARAM_SIZE, + MAXROWS_DEFAULT_MAX_RESULTSET_SIZE + }, + { + "debug", + MXS_MODULE_PARAM_COUNT, + MAXROWS_DEFAULT_DEBUG + }, + { + "max_resultset_return", + MXS_MODULE_PARAM_ENUM, + "empty", + MXS_MODULE_OPT_ENUM_UNIQUE, + return_option_values + }, + {MXS_END_MODULE_PARAMS} + } + }; - return &info; - } + return &info; +} } /* Implementation */ diff --git a/server/modules/filter/mqfilter/mqfilter.cc b/server/modules/filter/mqfilter/mqfilter.cc index fab0771d6..fbec37cf1 100644 --- a/server/modules/filter/mqfilter/mqfilter.cc +++ b/server/modules/filter/mqfilter/mqfilter.cc @@ -263,78 +263,84 @@ extern "C" * * @return The module object */ - MXS_MODULE* MXS_CREATE_MODULE() +MXS_MODULE* MXS_CREATE_MODULE() +{ + static MXS_FILTER_OBJECT MyObject = { - static MXS_FILTER_OBJECT MyObject = - { - createInstance, - newSession, - closeSession, - freeSession, - setDownstream, - setUpstream, - routeQuery, - clientReply, - diagnostic, - diagnostic_json, - getCapabilities, - NULL, // No destroyInstance - }; + createInstance, + newSession, + closeSession, + freeSession, + setDownstream, + setUpstream, + routeQuery, + clientReply, + diagnostic, + diagnostic_json, + getCapabilities, + NULL, // No destroyInstance + }; - static MXS_MODULE info = + static MXS_MODULE info = + { + MXS_MODULE_API_FILTER, + MXS_MODULE_ALPHA_RELEASE, + MXS_FILTER_VERSION, + "A RabbitMQ query logging filter", + "V1.0.2", + RCAP_TYPE_CONTIGUOUS_INPUT, + &MyObject, + NULL, + NULL, + NULL, + NULL, { - MXS_MODULE_API_FILTER, - MXS_MODULE_ALPHA_RELEASE, - MXS_FILTER_VERSION, - "A RabbitMQ query logging filter", - "V1.0.2", - RCAP_TYPE_CONTIGUOUS_INPUT, - &MyObject, - NULL, /* Process init. */ - NULL, /* Process finish. */ - NULL, /* Thread init. */ - NULL, /* Thread finish. */ + {"hostname", MXS_MODULE_PARAM_STRING, "localhost" }, + {"username", MXS_MODULE_PARAM_STRING, "guest" }, + {"password", MXS_MODULE_PARAM_STRING, "guest" }, + {"vhost", MXS_MODULE_PARAM_STRING, "/" }, + {"port", MXS_MODULE_PARAM_COUNT, "5672" }, + {"exchange", MXS_MODULE_PARAM_STRING, "default_exchange"}, + {"key", MXS_MODULE_PARAM_STRING, "key" }, + {"queue", MXS_MODULE_PARAM_STRING}, + {"exchange_type", MXS_MODULE_PARAM_STRING, "direct" }, + {"logging_source_user", MXS_MODULE_PARAM_STRING}, + {"logging_source_host", MXS_MODULE_PARAM_STRING}, + {"logging_schema", MXS_MODULE_PARAM_STRING}, + {"logging_object", MXS_MODULE_PARAM_STRING}, + {"logging_log_all", MXS_MODULE_PARAM_BOOL, "false" }, + {"logging_strict", MXS_MODULE_PARAM_BOOL, "true" }, { - {"hostname", MXS_MODULE_PARAM_STRING, - "localhost"}, - {"username", MXS_MODULE_PARAM_STRING, - "guest"}, - {"password", MXS_MODULE_PARAM_STRING, - "guest"}, - {"vhost", MXS_MODULE_PARAM_STRING, - "/"}, - {"port", MXS_MODULE_PARAM_COUNT, - "5672"}, - {"exchange", MXS_MODULE_PARAM_STRING, - "default_exchange"}, - {"key", MXS_MODULE_PARAM_STRING, - "key"}, - {"queue", MXS_MODULE_PARAM_STRING}, - {"ssl_client_certificate", MXS_MODULE_PARAM_PATH, NULL, - MXS_MODULE_OPT_PATH_R_OK}, - {"ssl_client_key", MXS_MODULE_PARAM_PATH, NULL, - MXS_MODULE_OPT_PATH_R_OK}, - {"ssl_CA_cert", MXS_MODULE_PARAM_PATH, NULL, - MXS_MODULE_OPT_PATH_R_OK}, - {"exchange_type", MXS_MODULE_PARAM_STRING, - "direct"}, - {"logging_trigger", MXS_MODULE_PARAM_ENUM, "all", - MXS_MODULE_OPT_NONE, - trigger_values}, - {"logging_source_user", MXS_MODULE_PARAM_STRING}, - {"logging_source_host", MXS_MODULE_PARAM_STRING}, - {"logging_schema", MXS_MODULE_PARAM_STRING}, - {"logging_object", MXS_MODULE_PARAM_STRING}, - {"logging_log_all", MXS_MODULE_PARAM_BOOL, - "false"}, - {"logging_strict", MXS_MODULE_PARAM_BOOL, - "true"}, - {MXS_END_MODULE_PARAMS} - } - }; + "ssl_client_certificate", + MXS_MODULE_PARAM_PATH, + NULL, + MXS_MODULE_OPT_PATH_R_OK + }, + { + "ssl_client_key", + MXS_MODULE_PARAM_PATH, + NULL, + MXS_MODULE_OPT_PATH_R_OK + }, + { + "ssl_CA_cert", + MXS_MODULE_PARAM_PATH, + NULL, + MXS_MODULE_OPT_PATH_R_OK}, - return &info; - } + { + "logging_trigger", + MXS_MODULE_PARAM_ENUM, + "all", + MXS_MODULE_OPT_NONE, + trigger_values + }, + {MXS_END_MODULE_PARAMS} + } + }; + + return &info; +} } /** diff --git a/server/modules/filter/namedserverfilter/namedserverfilter.cc b/server/modules/filter/namedserverfilter/namedserverfilter.cc index 9edcd66d1..6bd8ca7d5 100644 --- a/server/modules/filter/namedserverfilter/namedserverfilter.cc +++ b/server/modules/filter/namedserverfilter/namedserverfilter.cc @@ -878,7 +878,7 @@ bool RegexHintFilter::add_source_address(const char* input_host, SourceHostVecto } void RegexHintFilter::set_source_addresses(const std::string& input_host_names, - SourceHostVector& source_hosts, + SourceHostVector& source_hosts, StringVector& hostnames) { std::string host_names(input_host_names); diff --git a/server/modules/filter/qlafilter/qlafilter.cc b/server/modules/filter/qlafilter/qlafilter.cc index a8fdaea7d..d02d015b3 100644 --- a/server/modules/filter/qlafilter/qlafilter.cc +++ b/server/modules/filter/qlafilter/qlafilter.cc @@ -204,7 +204,7 @@ QlaInstance* QlaInstance::create(const std::string name, MXS_CONFIG_PARAMETER* p QlaFilterSession* QlaInstance::newSession(MXS_SESSION* session) { - auto my_session = new (std::nothrow) QlaFilterSession(*this, session); + auto my_session = new(std::nothrow) QlaFilterSession(*this, session); if (my_session) { if (!my_session->prepare()) @@ -311,7 +311,7 @@ void QlaInstance::diagnostics(DCB* dcb) const } if (!m_settings.exclude.empty()) { - output += string_printf("\t\tExclude queries that match %s\n", m_settings.exclude.c_str()); + output += string_printf("\t\tExclude queries that match %s\n", m_settings.exclude.c_str()); } output += string_printf("\t\tColumn separator %s\n", m_settings.separator.c_str()); @@ -878,7 +878,6 @@ void diagnostic(MXS_FILTER* instance, MXS_FILTER_SESSION* fsession, DCB* dcb) { auto my_instance = static_cast(instance); my_instance->diagnostics(dcb); - } } @@ -910,7 +909,6 @@ bool cb_log(const MODULECMD_ARG* argv, json_t** output) return instance->read_to_json(start, end, output); } - } /** diff --git a/server/modules/filter/qlafilter/qlafilter.hh b/server/modules/filter/qlafilter/qlafilter.hh index 8748b7104..52fcca6f8 100644 --- a/server/modules/filter/qlafilter/qlafilter.hh +++ b/server/modules/filter/qlafilter/qlafilter.hh @@ -42,15 +42,15 @@ public: ~QlaInstance(); /* Log file save mode flags. */ - static const int64_t LOG_FILE_SESSION = (1 << 0); /**< Default value, session specific files */ - static const int64_t LOG_FILE_UNIFIED = (1 << 1); /**< One file shared by all sessions */ + static const int64_t LOG_FILE_SESSION = (1 << 0); /**< Default value, session specific files */ + static const int64_t LOG_FILE_UNIFIED = (1 << 1); /**< One file shared by all sessions */ /* Flags for controlling extra log entry contents */ - static const int64_t LOG_DATA_SERVICE = (1 << 0); - static const int64_t LOG_DATA_SESSION = (1 << 1); - static const int64_t LOG_DATA_DATE = (1 << 2); - static const int64_t LOG_DATA_USER = (1 << 3); - static const int64_t LOG_DATA_QUERY = (1 << 4); + static const int64_t LOG_DATA_SERVICE = (1 << 0); + static const int64_t LOG_DATA_SESSION = (1 << 1); + static const int64_t LOG_DATA_DATE = (1 << 2); + static const int64_t LOG_DATA_USER = (1 << 3); + static const int64_t LOG_DATA_QUERY = (1 << 4); static const int64_t LOG_DATA_REPLY_TIME = (1 << 5); /** @@ -80,15 +80,15 @@ public: */ bool read_to_json(int start, int end, json_t** output) const; - void diagnostics(DCB* dcb) const; + void diagnostics(DCB* dcb) const; json_t* diagnostics_json() const; std::string generate_log_header(uint64_t data_flags) const; FILE* open_session_log_file(const std::string& filename) const; - void check_reopen_session_file(const std::string& filename, FILE** ppFile) const; - void write_unified_log_entry(const std::string& contents); - bool write_to_logfile(FILE* fp, const std::string& contents) const; + void check_reopen_session_file(const std::string& filename, FILE** ppFile) const; + void write_unified_log_entry(const std::string& contents); + bool write_to_logfile(FILE* fp, const std::string& contents) const; class Settings { @@ -97,39 +97,38 @@ public: bool write_unified_log {false}; bool write_session_log {false}; - uint32_t log_file_data_flags {0}; /* What data is saved to the files */ - std::string filebase; /* The filename base */ - bool flush_writes {false}; /* Flush log file after every write? */ - bool append {false}; /* Open files in append-mode? */ - std::string query_newline; /* Character(s) used to replace a newline within a query */ - std::string separator; /* Character(s) used to separate elements */ - std::string user_name; /* The user name to filter on */ - std::string source; /* The source of the client connection to filter on */ - std::string match; /* Optional text to match against */ - std::string exclude; /* Optional text to match against for exclusion */ + uint32_t log_file_data_flags {0}; /* What data is saved to the files */ + std::string filebase; /* The filename base */ + bool flush_writes {false}; /* Flush log file after every write? */ + bool append {false}; /* Open files in append-mode? */ + std::string query_newline; /* Character(s) used to replace a newline within a query */ + std::string separator; /* Character(s) used to separate elements */ + std::string user_name; /* The user name to filter on */ + std::string source; /* The source of the client connection to filter on */ + std::string match; /* Optional text to match against */ + std::string exclude; /* Optional text to match against for exclusion */ }; Settings m_settings; const std::string m_name; /* Filter definition name */ - pcre2_code* m_re_match {nullptr}; /* Compiled regex text */ - pcre2_code* m_re_exclude {nullptr}; /* Compiled regex nomatch text */ - uint32_t m_ovec_size {0}; /* PCRE2 match data ovector size */ + pcre2_code* m_re_match {nullptr}; /* Compiled regex text */ + pcre2_code* m_re_exclude {nullptr}; /* Compiled regex nomatch text */ + uint32_t m_ovec_size {0}; /* PCRE2 match data ovector size */ - uint64_t m_session_data_flags {0}; /* What data is printed to session files */ + uint64_t m_session_data_flags {0}; /* What data is printed to session files */ private: - bool open_unified_logfile(); + bool open_unified_logfile(); FILE* open_log_file(uint64_t data_flags, const std::string& filename) const; - void check_reopen_file(const std::string& filename, uint64_t data_flags, FILE** ppFile) const; - - std::mutex m_file_lock; /* Protects access to the unified log file */ - std::string m_unified_filename; /* Filename of the unified log file */ - FILE* m_unified_fp {nullptr}; /* Unified log file. */ - int m_rotation_count {0}; /* Log rotation counter */ - bool m_write_error_logged {false}; /* Avoid repeatedly printing some errors/warnings. */ + void check_reopen_file(const std::string& filename, uint64_t data_flags, FILE** ppFile) const; + std::mutex m_file_lock; /* Protects access to the unified log file */ + std::string m_unified_filename; /* Filename of the unified log file */ + FILE* m_unified_fp {nullptr}; /* Unified log file. */ + int m_rotation_count {0}; /* Log rotation counter */ + bool m_write_error_logged {false}; /* Avoid repeatedly printing some errors/warnings. */ }; /* The session structure for this QLA filter. */ @@ -172,26 +171,26 @@ public: MXS_UPSTREAM up; MXS_DOWNSTREAM down; - std::string m_filename; /* The session-specific log file name */ + std::string m_filename; /* The session-specific log file name */ private: - QlaInstance& m_instance; + QlaInstance& m_instance; - const std::string m_user; /* Client username */ - const std::string m_remote; /* Client address */ - const std::string m_service; /* The service name this filter is attached to. */ - const uint64_t m_ses_id {0}; /* The session this filter session serves. */ + const std::string m_user; /* Client username */ + const std::string m_remote; /* Client address */ + const std::string m_service; /* The service name this filter is attached to. */ + const uint64_t m_ses_id {0}; /* The session this filter session serves. */ bool m_active {false}; /* Is session active? */ pcre2_match_data* m_mdata {nullptr}; /* Regex match data */ - FILE* m_logfile {nullptr}; /* The session-specific log file */ - int m_rotation_count {0}; /* Log rotation counter */ - bool m_write_error_logged {false}; /* Has write error been logged */ + FILE* m_logfile {nullptr}; /* The session-specific log file */ + int m_rotation_count {0}; /* Log rotation counter */ + bool m_write_error_logged {false}; /* Has write error been logged */ /** - * Helper struct for holding data before it's written to file. - */ + * Helper struct for holding data before it's written to file. + */ class LogEventData { public: @@ -224,10 +223,10 @@ private: timespec begin_time {0, 0}; // Timer value at the moment of receiving query. }; - LogEventData m_event_data; /* Information about the latest event, used if logging execution time. */ + LogEventData m_event_data; /* Information about the latest event, used if logging execution time. */ - void write_log_entries(const LogEventElems& elems); - void write_session_log_entry(const std::string& entry); + void write_log_entries(const LogEventElems& elems); + void write_session_log_entry(const std::string& entry); std::string generate_log_entry(uint64_t data_flags, const LogEventElems& elems) const; }; @@ -237,15 +236,16 @@ private: */ struct LogEventElems { - const char* date_string {nullptr}; /**< Formatted date */ - const char* query {nullptr}; /**< Query. Not necessarily 0-terminated */ - int querylen {0}; /**< Length of query */ - int elapsed_ms {0}; /**< Processing time on backend */ + const char* date_string {nullptr}; /**< Formatted date */ + const char* query {nullptr}; /**< Query. Not necessarily 0-terminated */ + int querylen {0}; /**< Length of query */ + int elapsed_ms {0}; /**< Processing time on backend */ LogEventElems(const char* date_string, const char* query, int querylen, int elapsed_ms = -1) - : date_string(date_string) - , query(query) - , querylen(querylen) - , elapsed_ms(elapsed_ms) - {} + : date_string(date_string) + , query(query) + , querylen(querylen) + , elapsed_ms(elapsed_ms) + { + } }; diff --git a/server/modules/filter/regexfilter/regexfilter.cc b/server/modules/filter/regexfilter/regexfilter.cc index 591d166c1..f682b29eb 100644 --- a/server/modules/filter/regexfilter/regexfilter.cc +++ b/server/modules/filter/regexfilter/regexfilter.cc @@ -58,13 +58,13 @@ static char* regex_replace(const char* sql, */ struct RegexInstance { - char* source; /*< Source address to restrict matches */ - char* user; /*< User name to restrict matches */ - char* match; /*< Regular expression to match */ - char* replace; /*< Replacement text */ - pcre2_code* re; /*< Compiled regex text */ - FILE* logfile; /*< Log file */ - bool log_trace; /*< Whether messages should be printed to tracelog */ + char* source; /*< Source address to restrict matches */ + char* user; /*< User name to restrict matches */ + char* match; /*< Regular expression to match */ + char* replace; /*< Replacement text */ + pcre2_code* re; /*< Compiled regex text */ + FILE* logfile; /*< Log file */ + bool log_trace; /*< Whether messages should be printed to tracelog */ }; /** @@ -72,10 +72,10 @@ struct RegexInstance */ struct RegexSession { - MXS_DOWNSTREAM down; /* The downstream filter */ - pthread_mutex_t lock; - int no_change; /* No. of unchanged requests */ - int replacements; /* No. of changed requests */ + MXS_DOWNSTREAM down; /* The downstream filter */ + pthread_mutex_t lock; + int no_change; /* No. of unchanged requests */ + int replacements; /* No. of changed requests */ pcre2_match_data* match_data; /*< Matching data used by the compiled regex */ }; @@ -100,73 +100,73 @@ extern "C" * * @return The module object */ - MXS_MODULE* MXS_CREATE_MODULE() +MXS_MODULE* MXS_CREATE_MODULE() +{ + static MXS_FILTER_OBJECT MyObject = { - static MXS_FILTER_OBJECT MyObject = - { - createInstance, - newSession, - closeSession, - freeSession, - setDownstream, - NULL, // No Upstream requirement - routeQuery, - NULL, // No clientReply - diagnostic, - diagnostic_json, - getCapabilities, - NULL, // No destroyInstance - }; + createInstance, + newSession, + closeSession, + freeSession, + setDownstream, + NULL, // No Upstream requirement + routeQuery, + NULL, // No clientReply + diagnostic, + diagnostic_json, + getCapabilities, + NULL, // No destroyInstance + }; - static const char description[] = "A query rewrite filter that uses regular " - "expressions to rewrite queries"; - static MXS_MODULE info = + static const char description[] = "A query rewrite filter that uses regular " + "expressions to rewrite queries"; + static MXS_MODULE info = + { + MXS_MODULE_API_FILTER, + MXS_MODULE_GA, + MXS_FILTER_VERSION, + description, + "V1.1.0", + RCAP_TYPE_CONTIGUOUS_INPUT, + &MyObject, + NULL, + NULL, + NULL, + NULL, { - MXS_MODULE_API_FILTER, - MXS_MODULE_GA, - MXS_FILTER_VERSION, - description, - "V1.1.0", - RCAP_TYPE_CONTIGUOUS_INPUT, - &MyObject, - NULL, - NULL, - NULL, - NULL, { - { - "match", - MXS_MODULE_PARAM_STRING, - NULL, - MXS_MODULE_OPT_REQUIRED - }, - { - "replace", - MXS_MODULE_PARAM_STRING, - NULL, - MXS_MODULE_OPT_REQUIRED - }, - { - "options", - MXS_MODULE_PARAM_ENUM, - "ignorecase", - MXS_MODULE_OPT_NONE, - option_values - }, - { - "log_trace", - MXS_MODULE_PARAM_BOOL, - "false" - }, - {"source", MXS_MODULE_PARAM_STRING }, - {"user", MXS_MODULE_PARAM_STRING }, - {"log_file", MXS_MODULE_PARAM_STRING }, - {MXS_END_MODULE_PARAMS} - } - }; + "match", + MXS_MODULE_PARAM_STRING, + NULL, + MXS_MODULE_OPT_REQUIRED + }, + { + "replace", + MXS_MODULE_PARAM_STRING, + NULL, + MXS_MODULE_OPT_REQUIRED + }, + { + "options", + MXS_MODULE_PARAM_ENUM, + "ignorecase", + MXS_MODULE_OPT_NONE, + option_values + }, + { + "log_trace", + MXS_MODULE_PARAM_BOOL, + "false" + }, + {"source", MXS_MODULE_PARAM_STRING }, + {"user", MXS_MODULE_PARAM_STRING }, + {"log_file", MXS_MODULE_PARAM_STRING }, + {MXS_END_MODULE_PARAMS} + } + }; - return &info; - } + return &info; +} } /** @@ -247,7 +247,7 @@ bool matching_connection(RegexInstance* my_instance, MXS_SESSION* session) { rval = false; } - else if (my_instance->user && strcmp(session_get_user(session), my_instance->user) != 0) + else if (my_instance->user && strcmp(session_get_user(session), my_instance->user) != 0) { rval = false; } diff --git a/server/modules/filter/tee/teesession.cc b/server/modules/filter/tee/teesession.cc index 3320ed43a..89246fcc0 100644 --- a/server/modules/filter/tee/teesession.cc +++ b/server/modules/filter/tee/teesession.cc @@ -21,7 +21,7 @@ TeeSession::TeeSession(MXS_SESSION* session, LocalClient* client, - pcre2_code* match, + pcre2_code* match, pcre2_match_data* md_match, pcre2_code* exclude, pcre2_match_data* md_exclude) diff --git a/server/modules/filter/tee/teesession.hh b/server/modules/filter/tee/teesession.hh index 2952829af..016dc0cd9 100644 --- a/server/modules/filter/tee/teesession.hh +++ b/server/modules/filter/tee/teesession.hh @@ -39,7 +39,7 @@ public: private: TeeSession(MXS_SESSION* session, LocalClient* client, - pcre2_code* match, + pcre2_code* match, pcre2_match_data* md_match, pcre2_code* exclude, pcre2_match_data* md_exclude); diff --git a/server/modules/filter/test/maxscale/mock/dcb.hh b/server/modules/filter/test/maxscale/mock/dcb.hh index d659ef54d..37f67caf8 100644 --- a/server/modules/filter/test/maxscale/mock/dcb.hh +++ b/server/modules/filter/test/maxscale/mock/dcb.hh @@ -46,8 +46,8 @@ public: * @param pHandler Optional handler. */ Dcb(MXS_SESSION* pSession, - const char* zUser, - const char* zHost, + const char* zUser, + const char* zHost, Handler* pHandler = NULL); ~Dcb(); diff --git a/server/modules/filter/test/maxscale/mock/routersession.hh b/server/modules/filter/test/maxscale/mock/routersession.hh index 7087c84d0..eee77e2bb 100644 --- a/server/modules/filter/test/maxscale/mock/routersession.hh +++ b/server/modules/filter/test/maxscale/mock/routersession.hh @@ -107,7 +107,7 @@ private: Backend* m_pBackend; FilterModule::Session* m_pUpstream_filter_session; - maxscale::mock::Session* m_pSession; + maxscale::mock::Session* m_pSession; }; } } diff --git a/server/modules/filter/test/mock_dcb.cc b/server/modules/filter/test/mock_dcb.cc index ee445bb16..8dd698cba 100644 --- a/server/modules/filter/test/mock_dcb.cc +++ b/server/modules/filter/test/mock_dcb.cc @@ -31,8 +31,8 @@ namespace mock { Dcb::Dcb(MXS_SESSION* pSession, - const char* zUser, - const char* zHost, + const char* zUser, + const char* zHost, Handler* pHandler) : DCB(DCB::Role::CLIENT, pSession) , m_user(zUser) diff --git a/server/modules/filter/throttlefilter/throttlefilter.cc b/server/modules/filter/throttlefilter/throttlefilter.cc index 546b45fd1..efc6cbc3b 100644 --- a/server/modules/filter/throttlefilter/throttlefilter.cc +++ b/server/modules/filter/throttlefilter/throttlefilter.cc @@ -43,7 +43,7 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() NULL, /* Thread init. */ NULL, /* Thread finish. */ { - {MAX_QPS_CFG, MXS_MODULE_PARAM_INT }, + {MAX_QPS_CFG, MXS_MODULE_PARAM_INT }, {SAMPLING_DURATION_CFG, MXS_MODULE_PARAM_DURATION, "250ms"}, {THROTTLE_DURATION_CFG, MXS_MODULE_PARAM_DURATION }, {CONTINUOUS_DURATION_CFG, MXS_MODULE_PARAM_DURATION, "2000ms"}, @@ -57,7 +57,8 @@ extern "C" MXS_MODULE* MXS_CREATE_MODULE() namespace throttle { -ThrottleFilter::ThrottleFilter(const ThrottleConfig& config) : m_config(config) +ThrottleFilter::ThrottleFilter(const ThrottleConfig& config) + : m_config(config) { } diff --git a/server/modules/filter/topfilter/topfilter.cc b/server/modules/filter/topfilter/topfilter.cc index 2521abdbf..53f870076 100644 --- a/server/modules/filter/topfilter/topfilter.cc +++ b/server/modules/filter/topfilter/topfilter.cc @@ -141,58 +141,58 @@ extern "C" * * @return The module object */ - MXS_MODULE* MXS_CREATE_MODULE() +MXS_MODULE* MXS_CREATE_MODULE() +{ + static MXS_FILTER_OBJECT MyObject = { - static MXS_FILTER_OBJECT MyObject = - { - createInstance, - newSession, - closeSession, - freeSession, - setDownstream, - setUpstream, - routeQuery, - clientReply, - diagnostic, - diagnostic_json, - getCapabilities, - NULL, // No destroyInstance - }; + createInstance, + newSession, + closeSession, + freeSession, + setDownstream, + setUpstream, + routeQuery, + clientReply, + diagnostic, + diagnostic_json, + getCapabilities, + NULL, // No destroyInstance + }; - static MXS_MODULE info = + static MXS_MODULE info = + { + MXS_MODULE_API_FILTER, + MXS_MODULE_GA, + MXS_FILTER_VERSION, + "A top N query " + "logging filter", + "V1.0.1", + RCAP_TYPE_CONTIGUOUS_INPUT, + &MyObject, + NULL, + NULL, + NULL, + NULL, { - MXS_MODULE_API_FILTER, - MXS_MODULE_GA, - MXS_FILTER_VERSION, - "A top N query " - "logging filter", - "V1.0.1", - RCAP_TYPE_CONTIGUOUS_INPUT, - &MyObject, - NULL, - NULL, - NULL, - NULL, + {"count", MXS_MODULE_PARAM_COUNT, "10" }, + {"filebase", MXS_MODULE_PARAM_STRING, NULL, MXS_MODULE_OPT_REQUIRED}, + {"match", MXS_MODULE_PARAM_STRING}, + {"exclude", MXS_MODULE_PARAM_STRING}, + {"source", MXS_MODULE_PARAM_STRING}, + {"user", MXS_MODULE_PARAM_STRING}, { - {"count", MXS_MODULE_PARAM_COUNT, "10" }, - {"filebase", MXS_MODULE_PARAM_STRING, NULL, MXS_MODULE_OPT_REQUIRED}, - {"match", MXS_MODULE_PARAM_STRING}, - {"exclude", MXS_MODULE_PARAM_STRING}, - {"source", MXS_MODULE_PARAM_STRING}, - {"user", MXS_MODULE_PARAM_STRING}, - { - "options", - MXS_MODULE_PARAM_ENUM, - "ignorecase", - MXS_MODULE_OPT_NONE, - option_values - }, - {MXS_END_MODULE_PARAMS} - } - }; + "options", + MXS_MODULE_PARAM_ENUM, + "ignorecase", + MXS_MODULE_OPT_NONE, + option_values + }, + {MXS_END_MODULE_PARAMS} + } + }; - return &info; - } + return &info; +} } /** diff --git a/server/modules/filter/tpmfilter/tpmfilter.cc b/server/modules/filter/tpmfilter/tpmfilter.cc index 0d2725084..8ec06e755 100644 --- a/server/modules/filter/tpmfilter/tpmfilter.cc +++ b/server/modules/filter/tpmfilter/tpmfilter.cc @@ -160,51 +160,51 @@ extern "C" * * @return The module object */ - MXS_MODULE* MXS_CREATE_MODULE() +MXS_MODULE* MXS_CREATE_MODULE() +{ + static const char description[] = "Transaction Performance Monitoring filter"; + static MXS_FILTER_OBJECT MyObject = { - static const char description[] = "Transaction Performance Monitoring filter"; - static MXS_FILTER_OBJECT MyObject = - { - createInstance, - newSession, - closeSession, - freeSession, - setDownstream, - setUpstream, - routeQuery, - clientReply, - diagnostic, - diagnostic_json, - getCapabilities, - destroyInstance - }; + createInstance, + newSession, + closeSession, + freeSession, + setDownstream, + setUpstream, + routeQuery, + clientReply, + diagnostic, + diagnostic_json, + getCapabilities, + destroyInstance + }; - static MXS_MODULE info = + static MXS_MODULE info = + { + MXS_MODULE_API_FILTER, + MXS_MODULE_GA, + MXS_FILTER_VERSION, + description, + "V1.0.1", + RCAP_TYPE_CONTIGUOUS_INPUT, + &MyObject, + NULL, + NULL, + NULL, + NULL, { - MXS_MODULE_API_FILTER, - MXS_MODULE_GA, - MXS_FILTER_VERSION, - description, - "V1.0.1", - RCAP_TYPE_CONTIGUOUS_INPUT, - &MyObject, - NULL, - NULL, - NULL, - NULL, - { - {"named_pipe", MXS_MODULE_PARAM_STRING, DEFAULT_NAMED_PIPE }, - {"filename", MXS_MODULE_PARAM_STRING, DEFAULT_FILE_NAME }, - {"delimiter", MXS_MODULE_PARAM_STRING, DEFAULT_LOG_DELIMITER }, - {"query_delimiter", MXS_MODULE_PARAM_STRING, DEFAULT_QUERY_DELIMITER}, - {"source", MXS_MODULE_PARAM_STRING}, - {"user", MXS_MODULE_PARAM_STRING}, - {MXS_END_MODULE_PARAMS} - } - }; + {"named_pipe", MXS_MODULE_PARAM_STRING, DEFAULT_NAMED_PIPE }, + {"filename", MXS_MODULE_PARAM_STRING, DEFAULT_FILE_NAME }, + {"delimiter", MXS_MODULE_PARAM_STRING, DEFAULT_LOG_DELIMITER }, + {"query_delimiter", MXS_MODULE_PARAM_STRING, DEFAULT_QUERY_DELIMITER}, + {"source", MXS_MODULE_PARAM_STRING}, + {"user", MXS_MODULE_PARAM_STRING}, + {MXS_END_MODULE_PARAMS} + } + }; - return &info; - } + return &info; +} } /**