diff --git a/FlashMQTests/FlashMQTestsMeta.pro b/FlashMQTests/FlashMQTestsMeta.pro new file mode 100644 index 0000000..d70579c --- /dev/null +++ b/FlashMQTests/FlashMQTestsMeta.pro @@ -0,0 +1,9 @@ +# This is the main .pro file for the tests, which also builds plugin(s) + +TEMPLATE = subdirs + +SUBDIRS = plugins/test_plugin.pro \ + FlashMQTests.pro + +CONFIG += ordered + diff --git a/FlashMQTests/plugins/test_plugin.cpp b/FlashMQTests/plugins/test_plugin.cpp new file mode 100644 index 0000000..46b6b5a --- /dev/null +++ b/FlashMQTests/plugins/test_plugin.cpp @@ -0,0 +1,77 @@ +#include "../../flashmq_plugin.h" + +int flashmq_auth_plugin_version() +{ + return FLASHMQ_PLUGIN_VERSION; +} + +void flashmq_auth_plugin_allocate_thread_memory(void **thread_data, std::unordered_map &auth_opts) +{ + *thread_data = malloc(1024); + (void)auth_opts; +} + +void flashmq_auth_plugin_deallocate_thread_memory(void *thread_data, std::unordered_map &auth_opts) +{ + free(thread_data); + (void)auth_opts; +} + +void flashmq_auth_plugin_init(void *thread_data, std::unordered_map &auth_opts, bool reloading) +{ + (void)thread_data; + (void)auth_opts; + (void)reloading; +} + +void flashmq_auth_plugin_deinit(void *thread_data, std::unordered_map &auth_opts, bool reloading) +{ + (void)thread_data; + (void)auth_opts; + (void)reloading; + +} + +void flashmq_auth_plugin_periodic_event(void *thread_data) +{ + (void)thread_data; +} + +AuthResult flashmq_auth_plugin_login_check(void *thread_data, const std::string &username, const std::string &password, + const std::vector> *userProperties) +{ + (void)thread_data; + (void)username; + (void)password; + (void)userProperties; + + return AuthResult::success; +} + +AuthResult flashmq_auth_plugin_acl_check(void *thread_data, AclAccess access, const std::string &clientid, const std::string &username, const FlashMQMessage &msg) +{ + (void)thread_data; + (void)access; + (void)clientid; + (void)username; + (void)msg; + + return AuthResult::success; +} + +AuthResult flashmq_extended_auth(void *thread_data, const std::string &clientid, ExtendedAuthStage stage, const std::string &authMethod, + const std::string &authData, const std::vector> *userProperties, std::string &returnData, + std::string &username) +{ + (void)thread_data; + (void)stage; + (void)authMethod; + (void)authData; + (void)username; + (void)clientid; + (void)userProperties; + (void)returnData; + + return AuthResult::success; +} + diff --git a/FlashMQTests/plugins/test_plugin.pro b/FlashMQTests/plugins/test_plugin.pro new file mode 100644 index 0000000..931a5dd --- /dev/null +++ b/FlashMQTests/plugins/test_plugin.pro @@ -0,0 +1,8 @@ +QT -= gui + +TARGET = test_plugin +TEMPLATE = lib + +VERSION=0.0.1 + +SOURCES += test_plugin.cpp diff --git a/mainapp.cpp b/mainapp.cpp index 15e3eaa..4f7afc9 100644 --- a/mainapp.cpp +++ b/mainapp.cpp @@ -362,6 +362,7 @@ void MainApp::initMainApp(int argc, char *argv[]) int option_index = 0; int opt; bool testConfig = false; + optind = 1; // allow repeated calls to getopt_long. while((opt = getopt_long(argc, argv, "hc:Vltz:", long_options, &option_index)) != -1) { switch(opt)