diff options
| author | yangwei <[email protected]> | 2024-11-05 09:39:10 +0800 |
|---|---|---|
| committer | yangwei <[email protected]> | 2024-11-05 10:22:22 +0800 |
| commit | 7f81e465226e60caa516ae82556c9411339e77cd (patch) | |
| tree | 550872b92d7ac79f8dc9175fe12d42c167a62fc0 /test | |
| parent | a4157944287874d60378e4e48b9415eb44f0b0e2 (diff) | |
🦄 refactor(stellar_module to module): simplify stellar module to module
Diffstat (limited to 'test')
| -rw-r--r-- | test/lpi_plus/gtest_lpip_module.c | 21 | ||||
| -rw-r--r-- | test/session_debugger/session_debugger.c | 20 |
2 files changed, 21 insertions, 20 deletions
diff --git a/test/lpi_plus/gtest_lpip_module.c b/test/lpi_plus/gtest_lpip_module.c index 5897108..854c270 100644 --- a/test/lpi_plus/gtest_lpip_module.c +++ b/test/lpi_plus/gtest_lpip_module.c @@ -7,7 +7,7 @@ #include <assert.h> #include "stellar/appid.h" -#include "stellar/module_manager.h" +#include "stellar/module.h" #include "stellar/session.h" #include "stellar/utils.h" @@ -18,7 +18,7 @@ struct test_lpip_env { - struct stellar_module_manager *mod_mgr; + struct module_manager *mod_mgr; struct lpi_plus_mapper *lpi_mapper; int l7_exdata_idx; int session_num; @@ -152,12 +152,13 @@ static void on_session(struct session *sess, enum session_state state, struct pa return; } -struct stellar_module *gtest_lpip_module_init(struct stellar_module_manager *mod_mgr) +struct module *gtest_lpip_module_init(struct module_manager *mod_mgr) { struct test_lpip_env *env = (struct test_lpip_env *)calloc(1, sizeof(struct test_lpip_env)); - - env->lpi_mapper=stellar_module_get_lpip(mod_mgr); - struct session_manager *sess_mgr = stellar_module_get_session_manager(mod_mgr); + struct module *lpip_mod = module_manager_get_module(mod_mgr, LPI_PLUS_MODULE_NAME); + env->lpi_mapper=module_to_lpip_mapper(lpip_mod); + struct module *sess_mgr_mod=module_manager_get_module(mod_mgr, SESSION_MANAGER_MODULE_NAME); + struct session_manager *sess_mgr = module_to_session_manager(sess_mgr_mod); if(sess_mgr == NULL) { perror("gtest_lpi_plugin_load:stellar_module_get_session_manager failed !!!\n"); @@ -172,15 +173,15 @@ struct stellar_module *gtest_lpip_module_init(struct stellar_module_manager *mod stellar_appid_subscribe(mod_mgr, gtest_lpip_on_appid_msg, env); printf("gtest_lpip_module_init OK!\n"); - return stellar_module_new("TEST_LPIP", env); + return module_new("TEST_LPIP", env); } -void gtest_lpip_module_exit(struct stellar_module_manager *mod_mgr, struct stellar_module *mod) +void gtest_lpip_module_exit(struct module_manager *mod_mgr, struct module *mod) { assert(mod_mgr!=NULL); - struct test_lpip_env *env = (struct test_lpip_env *)stellar_module_get_ctx(mod); + struct test_lpip_env *env = (struct test_lpip_env *)module_get_ctx(mod); free(env); printf("gtest_lpip_module_exit OK!\n"); - stellar_module_free(mod); + module_free(mod); return ; } diff --git a/test/session_debugger/session_debugger.c b/test/session_debugger/session_debugger.c index cb9c833..cad4316 100644 --- a/test/session_debugger/session_debugger.c +++ b/test/session_debugger/session_debugger.c @@ -11,7 +11,7 @@ #include "session_internal.h" #include "stellar/log.h" -#include "stellar/module_manager.h" +#include "stellar/module.h" #include "stellar/session.h" #pragma GCC diagnostic ignored "-Wunused-parameter" @@ -431,13 +431,13 @@ error_out: * Plugin API ******************************************************************************/ -struct stellar_module *session_debugger_on_init(struct stellar_module_manager *mod_mgr) +struct module *session_debugger_on_init(struct module_manager *mod_mgr) { assert(mod_mgr); - - struct session_manager *sess_mgr = stellar_module_get_session_manager(mod_mgr); + struct module *sess_mgr_mod=module_manager_get_module(mod_mgr, SESSION_MANAGER_MODULE_NAME); + struct session_manager *sess_mgr = module_to_session_manager(sess_mgr_mod); assert(sess_mgr); - struct logger *logger = stellar_module_manager_get_logger(mod_mgr); + struct logger *logger = module_manager_get_logger(mod_mgr); assert(logger); struct session_debugger *dbg = session_debugger_new(sess_mgr, logger); @@ -446,29 +446,29 @@ struct stellar_module *session_debugger_on_init(struct stellar_module_manager *m return NULL; } - struct stellar_module *dbg_mod = stellar_module_new("session_debugger", NULL); + struct module *dbg_mod = module_new("session_debugger", NULL); if (dbg_mod == NULL) { session_debugger_free(dbg); return NULL; } - stellar_module_set_ctx(dbg_mod, dbg); + module_set_ctx(dbg_mod, dbg); STELLAR_LOG_FATAL(dbg->logger, "session debugger", "session_debugger init") return dbg_mod; } -void session_debugger_on_exit(struct stellar_module_manager *mod_mgr, struct stellar_module *mod) +void session_debugger_on_exit(struct module_manager *mod_mgr, struct module *mod) { if (mod) { - struct session_debugger *dbg = stellar_module_get_ctx(mod); + struct session_debugger *dbg = module_get_ctx(mod); if (dbg) { STELLAR_LOG_FATAL(dbg->logger, "session debugger", "session_debugger exit") session_debugger_free(dbg); } - stellar_module_free(mod); + module_free(mod); } }
\ No newline at end of file |
