🦄 refactor(stellar_module to module): simplify stellar module to module
This commit is contained in:
@@ -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 ;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user