From 6b94663b2455e212009a544ae23bb6a8c55407f8 Mon Sep 17 00:00:00 2001 From: Luca Muscariello Date: Thu, 9 Jun 2022 21:34:09 +0200 Subject: refactor(lib, hicn-light, vpp, hiperf): HICN-723 - move infra data structure into the shared lib - new packet cache using double hashing and lookup on prefix suffix - testing updates - authenticated requests using interest manifests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Mauro Sardara Co-authored-by: Jordan Augé Co-authored-by: Michele Papalini Co-authored-by: Olivier Roques Co-authored-by: Enrico Loparco Change-Id: Iaddebfe6aa5279ea8553433b0f519578f6b9ccd9 Signed-off-by: Luca Muscariello --- libtransport/src/core/io_module.cc | 43 ++++++++------------------------------ 1 file changed, 9 insertions(+), 34 deletions(-) (limited to 'libtransport/src/core/io_module.cc') diff --git a/libtransport/src/core/io_module.cc b/libtransport/src/core/io_module.cc index 69e4e8bcf..0f92cc47c 100644 --- a/libtransport/src/core/io_module.cc +++ b/libtransport/src/core/io_module.cc @@ -16,6 +16,7 @@ #ifndef _WIN32 #include #endif +#include #include #include @@ -38,54 +39,28 @@ IoModule *IoModule::load(const char *module_name) { #ifdef ANDROID return new HicnForwarderModule(); #else - void *handle = 0; - IoModule *module = 0; - IoModule *(*creator)(void) = 0; - const char *error = 0; + IoModule *iomodule = nullptr; + IoModule *(*creator)(void) = nullptr; + const char *error = nullptr; - // open module - handle = dlopen(module_name, RTLD_NOW); - if (!handle) { - if ((error = dlerror()) != 0) { - LOG(ERROR) << error; - } - return 0; - } + auto handle = GlobalModuleManager::getInstance().loadModule(module_name); // get factory method creator = (IoModule * (*)(void)) dlsym(handle, "create_module"); if (!creator) { - if ((error = dlerror()) != 0) { + if ((error = dlerror()) != nullptr) { LOG(ERROR) << error; } - return 0; + return nullptr; } // create object and return it - module = (*creator)(); - module->handle_ = handle; + iomodule = (*creator)(); - return module; + return iomodule; #endif } -bool IoModule::unload(IoModule *module) { - if (!module) { - return false; - } - -#ifdef ANDROID - delete module; -#else - // destroy object and close module - void *handle = module->handle_; - delete module; - dlclose(handle); -#endif - - return true; -} - } // namespace core } // namespace transport -- cgit 1.2.3-korg