Commit 5c47eca39cafc21863177c606ae42d8da52b50d2
1 parent
a7a79b3c
Add infrastructure to build plugins to test
Showing
4 changed files
with
95 additions
and
0 deletions
FlashMQTests/FlashMQTestsMeta.pro
0 โ 100644
FlashMQTests/plugins/test_plugin.cpp
0 โ 100644
| 1 | +#include "../../flashmq_plugin.h" | |
| 2 | + | |
| 3 | +int flashmq_auth_plugin_version() | |
| 4 | +{ | |
| 5 | + return FLASHMQ_PLUGIN_VERSION; | |
| 6 | +} | |
| 7 | + | |
| 8 | +void flashmq_auth_plugin_allocate_thread_memory(void **thread_data, std::unordered_map<std::string, std::string> &auth_opts) | |
| 9 | +{ | |
| 10 | + *thread_data = malloc(1024); | |
| 11 | + (void)auth_opts; | |
| 12 | +} | |
| 13 | + | |
| 14 | +void flashmq_auth_plugin_deallocate_thread_memory(void *thread_data, std::unordered_map<std::string, std::string> &auth_opts) | |
| 15 | +{ | |
| 16 | + free(thread_data); | |
| 17 | + (void)auth_opts; | |
| 18 | +} | |
| 19 | + | |
| 20 | +void flashmq_auth_plugin_init(void *thread_data, std::unordered_map<std::string, std::string> &auth_opts, bool reloading) | |
| 21 | +{ | |
| 22 | + (void)thread_data; | |
| 23 | + (void)auth_opts; | |
| 24 | + (void)reloading; | |
| 25 | +} | |
| 26 | + | |
| 27 | +void flashmq_auth_plugin_deinit(void *thread_data, std::unordered_map<std::string, std::string> &auth_opts, bool reloading) | |
| 28 | +{ | |
| 29 | + (void)thread_data; | |
| 30 | + (void)auth_opts; | |
| 31 | + (void)reloading; | |
| 32 | + | |
| 33 | +} | |
| 34 | + | |
| 35 | +void flashmq_auth_plugin_periodic_event(void *thread_data) | |
| 36 | +{ | |
| 37 | + (void)thread_data; | |
| 38 | +} | |
| 39 | + | |
| 40 | +AuthResult flashmq_auth_plugin_login_check(void *thread_data, const std::string &username, const std::string &password, | |
| 41 | + const std::vector<std::pair<std::string, std::string>> *userProperties) | |
| 42 | +{ | |
| 43 | + (void)thread_data; | |
| 44 | + (void)username; | |
| 45 | + (void)password; | |
| 46 | + (void)userProperties; | |
| 47 | + | |
| 48 | + return AuthResult::success; | |
| 49 | +} | |
| 50 | + | |
| 51 | +AuthResult flashmq_auth_plugin_acl_check(void *thread_data, AclAccess access, const std::string &clientid, const std::string &username, const FlashMQMessage &msg) | |
| 52 | +{ | |
| 53 | + (void)thread_data; | |
| 54 | + (void)access; | |
| 55 | + (void)clientid; | |
| 56 | + (void)username; | |
| 57 | + (void)msg; | |
| 58 | + | |
| 59 | + return AuthResult::success; | |
| 60 | +} | |
| 61 | + | |
| 62 | +AuthResult flashmq_extended_auth(void *thread_data, const std::string &clientid, ExtendedAuthStage stage, const std::string &authMethod, | |
| 63 | + const std::string &authData, const std::vector<std::pair<std::string, std::string>> *userProperties, std::string &returnData, | |
| 64 | + std::string &username) | |
| 65 | +{ | |
| 66 | + (void)thread_data; | |
| 67 | + (void)stage; | |
| 68 | + (void)authMethod; | |
| 69 | + (void)authData; | |
| 70 | + (void)username; | |
| 71 | + (void)clientid; | |
| 72 | + (void)userProperties; | |
| 73 | + (void)returnData; | |
| 74 | + | |
| 75 | + return AuthResult::success; | |
| 76 | +} | |
| 77 | + | ... | ... |
FlashMQTests/plugins/test_plugin.pro
0 โ 100644
mainapp.cpp
| ... | ... | @@ -362,6 +362,7 @@ void MainApp::initMainApp(int argc, char *argv[]) |
| 362 | 362 | int option_index = 0; |
| 363 | 363 | int opt; |
| 364 | 364 | bool testConfig = false; |
| 365 | + optind = 1; // allow repeated calls to getopt_long. | |
| 365 | 366 | while((opt = getopt_long(argc, argv, "hc:Vltz:", long_options, &option_index)) != -1) |
| 366 | 367 | { |
| 367 | 368 | switch(opt) | ... | ... |