Rebase dev 2.0

This commit is contained in:
杨威
2024-10-11 06:08:50 +00:00
parent 2e35a79528
commit 70d21f28c3
671 changed files with 1490 additions and 1770 deletions

View File

@@ -2,6 +2,8 @@
add_subdirectory(packet_tool)
add_subdirectory(session_debugger)
#add_subdirectory(lpi_plugin)
#add_subdirectory(debug_plugin)
add_subdirectory(lpi_plus)
#add_subdirectory(decoders/http)
#add_subdirectory(decoders/socks)
#add_subdirectory(decoders/stratum)

View File

@@ -1,176 +0,0 @@
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <assert.h>
#include "lpi_plugin.h"
#include "stellar/stellar.h"
#include "stellar/session.h"
#include "stellar/stellar_exdata.h"
#include "stellar/stellar_mq.h"
#include "cjson/cJSON.h"
#define MAX_APP_ID_VALUE 10000
struct lpi_test_plugin_env
{
int test_exdata_idx;
int l7_exdata_idx;
int test_app_plugin_id;
int expect_json_topic_id;
struct stellar *st;
char *g_proto_id2name[MAX_APP_ID_VALUE];
};
static int load_l7_protocol_mapper(const char *filename, struct lpi_test_plugin_env *env)
{
memset(env->g_proto_id2name, 0, sizeof(env->g_proto_id2name));
int ret=0, proto_id=0;;
FILE *fp=NULL;
char line[1024]={0};
char type_name[32]={0};
char proto_name[32]={0};
fp=fopen(filename, "r");
if(fp==NULL)
{
printf("Open %s failed ...", filename);
return -1;
}
memset(line, 0, sizeof(line));
while((fgets(line, sizeof(line), fp))!=NULL)
{
if(line[0]=='#' || line[0]=='\n' || line[0]=='\r' ||line[0]=='\0')
{
continue;
}
ret=sscanf(line, "%31s %31s %d", type_name, proto_name, &proto_id);
env->g_proto_id2name[proto_id] = (char*)calloc(strlen(proto_name)+1, 1);
strcpy(env->g_proto_id2name[proto_id], proto_name);
memset(line, 0, sizeof(line));
}
fclose(fp);
fp=NULL;
return ret;
}
static void publish_session_test_result(struct lpi_test_plugin_env *env, cJSON *ctx, struct session *sess)
{
assert(env->l7_exdata_idx >= 0 && ctx != NULL);
struct l7_protocol_label *label = (struct l7_protocol_label *)session_exdata_get(sess, env->l7_exdata_idx);;
if(label != NULL)
{
int proto_ids[8];
const char* proto_names[8];
for(int i = 0; i < label->protocol_id_num; i++)
{
proto_ids[i] = (int)(label->protocol_id[i]);
proto_names[i] = env->g_proto_id2name[proto_ids[i]];
}
cJSON *label_ids = cJSON_CreateIntArray(proto_ids, label->protocol_id_num);
cJSON_AddItemToObject(ctx, "l7_label_id", label_ids);
cJSON *label_names = cJSON_CreateStringArray(proto_names, label->protocol_id_num);
cJSON_AddItemToObject(ctx, "l7_label_name", label_names);
}
else
{
cJSON_AddStringToObject(ctx, "l7_label_id", "UNKNOWN");
}
unsigned char dir_flag;
int is_symmetric=session_is_symmetric(sess, &dir_flag);
if(is_symmetric)
{
cJSON_AddStringToObject(ctx, "STREAM_DIR", "DOUBLE");
}
else if(dir_flag == SESSION_SEEN_C2S_FLOW)
{
cJSON_AddStringToObject(ctx, "STREAM_DIR", "C2S");
}
else if(dir_flag == SESSION_SEEN_S2C_FLOW)
{
cJSON_AddStringToObject(ctx, "STREAM_DIR", "S2C");
}
else
{
assert(0);
}
session_mq_publish_message(sess, env->expect_json_topic_id, cJSON_Print(ctx));
cJSON_Delete(ctx);
return;
}
static void gtest_lpi_on_session_free(struct session *sess, void *per_session_ctx, void *plugin_env)
{
cJSON *ctx =cJSON_CreateObject();
cJSON_AddStringToObject(ctx, "Tuple4", session_get0_readable_addr(sess));
enum session_type type= session_get_type(sess);
if (type == SESSION_TYPE_TCP)
{
cJSON_AddStringToObject(ctx, "STREAM_TYPE", "TCP");
}
if (type == SESSION_TYPE_UDP)
{
cJSON_AddStringToObject(ctx, "STREAM_TYPE", "UDP");
}
publish_session_test_result((struct lpi_test_plugin_env*)plugin_env, ctx, sess);
}
extern "C" void *gtest_lpi_plugin_load(struct stellar *st)
{
struct lpi_test_plugin_env *env = (struct lpi_test_plugin_env *)calloc(1, sizeof(struct lpi_test_plugin_env));
env->st=st;
const char *l7_proto_name=(const char*)"./tsgconf/tsg_l7_protocol.conf";
env->l7_exdata_idx= stellar_exdata_new_index(st, "L7_PROTOCOL", stellar_exdata_free_default, NULL);
env->test_exdata_idx= stellar_exdata_new_index(st, "APP_PROTO_TEST", stellar_exdata_free_default, NULL);
if(env->l7_exdata_idx<0 || env->test_exdata_idx<0)
{
perror("gtest_lpi_plugin_load:stellar_session_get_ex_new_index faild!!!\n");
exit(-1);
}
if(load_l7_protocol_mapper(l7_proto_name, env)<0)
{
perror("gtest_lpi_plugin_load:l7_protocol_mapper failed !!!\n");
exit(-1);
}
env->test_app_plugin_id=stellar_plugin_register(st, NULL, NULL, NULL, gtest_lpi_on_session_free, env);
if(env->test_app_plugin_id < 0)
{
perror("gtest_lpi_plugin_load:stellar_plugin_register failed !!!\n");
exit(-1);
}
int tcp_topic_id=stellar_mq_get_topic_id(st, TOPIC_TCP_INPUT);
int udp_topic_id=stellar_mq_get_topic_id(st, TOPIC_UDP_INPUT);
if(tcp_topic_id < 0 || udp_topic_id < 0)
{
perror("gtest_lpi_plugin_load get tcp or udp topic id failed\n");
exit(-1);
}
env->expect_json_topic_id = stellar_mq_create_topic(st, "EXPECT_JSON", stellar_msg_free_default, NULL);
printf("gtest_lpi_plugin_load OK!\n");
return env;
}
extern "C" void gtest_lpi_plugin_unload(void *plugin_env)
{
struct lpi_test_plugin_env *env = (struct lpi_test_plugin_env *)plugin_env;
for(int i = 0; i < MAX_APP_ID_VALUE; i++)
{
if(env->g_proto_id2name[i])free(env->g_proto_id2name[i]);
}
free(env);
printf("gtest_lpi_plugin_unload OK!\n");
return ;
}

View File

@@ -1,11 +0,0 @@
# stellar_plugin.toml
#
[[plugin]]
path = ""
init = "lpi_plugin_load"
exit = "lpi_plugin_unload"
[[plugin]]
path = ""
init = "gtest_lpi_plugin_load"
exit = "gtest_lpi_plugin_unload"

View File

@@ -1,10 +1,10 @@
add_executable(gtest_lpi gtest_lpi_main.cpp gtest_lpi_plugin.cpp)
add_executable(gtest_lpip gtest_lpip_main.cpp gtest_lpip_module.c)
target_include_directories(gtest_lpi PRIVATE ${CMAKE_SOURCE_DIR}/deps/)
target_include_directories(gtest_lpi PRIVATE ${CMAKE_SOURCE_DIR}/decoders/lpi)
target_include_directories(gtest_lpip PRIVATE ${CMAKE_SOURCE_DIR}/deps/)
target_include_directories(gtest_lpip PRIVATE ${CMAKE_SOURCE_DIR}/decoders/)
target_link_libraries(
gtest_lpi PRIVATE stellar_lib cjson-static
gtest_lpip PRIVATE stellar_lib cjson-static lpi_plus
dl "-rdynamic"
gtest gmock
)
@@ -12,7 +12,7 @@ target_link_libraries(
#target_link_libraries(gtest_lpi PRIVATE -Wl,--whole-archive lpi -Wl,--no-whole-archive)
set(TEST_NAME "LPI_TEST")
set(TEST_MAIN ${CMAKE_CURRENT_BINARY_DIR}/gtest_lpi)
set(TEST_MAIN ${CMAKE_CURRENT_BINARY_DIR}/gtest_lpip)
add_test(NAME ${TEST_NAME}.SETUP COMMAND sh -c "
mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/conf &&
@@ -20,8 +20,7 @@ add_test(NAME ${TEST_NAME}.SETUP COMMAND sh -c "
mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/log &&
mkdir -p ${CMAKE_CURRENT_BINARY_DIR}/tsgconf &&
cp ${CMAKE_SOURCE_DIR}/conf/stellar.toml ${CMAKE_CURRENT_BINARY_DIR}/conf/ &&
cp ${CMAKE_CURRENT_SOURCE_DIR}/test_config/spec.toml ${CMAKE_CURRENT_BINARY_DIR}/plugin/ &&
cp ${CMAKE_SOURCE_DIR}/conf/log.toml ${CMAKE_CURRENT_BINARY_DIR}/conf/ &&
cat ${CMAKE_CURRENT_SOURCE_DIR}/test_config/spec.toml >> ${CMAKE_CURRENT_BINARY_DIR}/conf/stellar.toml &&
cp ${CMAKE_CURRENT_SOURCE_DIR}/test_config/tsg_l7_protocol.conf ${CMAKE_CURRENT_BINARY_DIR}/tsgconf/ &&
tomlq -t -i '.packet_io.pcap_path=\"-\"' ${CMAKE_CURRENT_BINARY_DIR}/conf/stellar.toml &&
tomlq -t -i '.packet_io.mode=\"pcaplist\"' ${CMAKE_CURRENT_BINARY_DIR}/conf/stellar.toml
@@ -55,4 +54,5 @@ set_tests_properties(${TEST_NAME}.APP
${TEST_NAME}.OPENVPN
${TEST_NAME}.PPP
${TEST_NAME}.SOCKS
PROPERTIES FIXTURES_REQUIRED ${TEST_NAME}.SETUP)
PROPERTIES FIXTURES_REQUIRED ${TEST_NAME}.SETUP
)

View File

@@ -0,0 +1,16 @@
#pragma once
#ifdef __cplusplus
extern "C"
{
#endif
int stellar_test_result_setup();
char *stellar_test_result_json_export();
void stellar_test_result_cleanup();
#ifdef __cplusplus
}
#endif

View File

@@ -14,10 +14,9 @@
#include <gtest/gtest.h>
#include "stellar/stellar.h"
#include "stellar/session.h"
#include "stellar/stellar_mq.h"
#include "cJSON.h"
#include "gtest_lpip.h"
struct gtest_json_result
@@ -30,7 +29,11 @@ struct gtest_json_result
static struct gtest_json_result *gtest_result_new(const char *expect_json_path)
{
struct gtest_json_result *para = (struct gtest_json_result *)calloc(1, sizeof(struct gtest_json_result));
para->test_json_root = cJSON_CreateArray();
if(expect_json_path==NULL)
{
para->expect_json_root=cJSON_CreateArray();
return para;
}
FILE *file = fopen(expect_json_path, "rb");
if(file)
@@ -105,22 +108,6 @@ static void gtest_result_free(struct gtest_json_result *para)
return;
}
void gtest_on_session_msg_expect_json(struct session *sess, int topic_id, const void *msg, void *per_session_ctx,
void *plugin_env)
{
struct gtest_json_result *g_test_para = (struct gtest_json_result *)plugin_env;
cJSON *per_session_json = cJSON_Parse((const char *)msg);
if (g_test_para->test_json_root)
{
char result_name[128] = "";
sprintf(result_name, "APP_PROTO_IDENTIFY_RESULT_%d", g_test_para->result_count);
cJSON_AddStringToObject(per_session_json, "name", result_name);
cJSON_AddItemToArray(g_test_para->test_json_root, per_session_json);
}
g_test_para->result_count += 1;
}
/**********************************************
* GTEST MAIN *
@@ -130,35 +117,33 @@ int main(int argc, char ** argv)
{
::testing::InitGoogleTest(&argc, argv);
EXPECT_EQ(argc, 2);
//EXPECT_EQ(argc, 2);
if(argc != 2)
{
printf("Invalid Argument!!!\n Usage: ./[gtest_main] [/path/to/expect_json]\n");
return -1;
}
printf("Usage: ./[gtest_main] [/path/to/expect_json]\n");
char *expect_json_path=argv[1];
struct gtest_json_result *g_test_para = gtest_result_new(expect_json_path);
struct stellar *st=stellar_new("./conf/stellar.toml", "./plugin/spec.toml", "./conf/log.toml");
struct stellar *st=stellar_new("./conf/stellar.toml");
stellar_test_result_setup();
EXPECT_TRUE(st!=NULL);
int plugin_id=stellar_session_plugin_register(st, NULL, NULL, g_test_para);
EXPECT_TRUE(plugin_id>=0);
int expect_json_topic_id = stellar_mq_get_topic_id(st, "EXPECT_JSON");
EXPECT_TRUE(expect_json_topic_id>=0);
stellar_session_mq_subscribe(st, expect_json_topic_id, gtest_on_session_msg_expect_json, plugin_id);
stellar_run(st);
stellar_free(st);
char *test_result_json=stellar_test_result_json_export();
g_test_para->test_json_root=cJSON_Parse(test_result_json);
free(test_result_json);
EXPECT_TRUE(g_test_para->expect_json_root != NULL && g_test_para->test_json_root != NULL);
EXPECT_EQ(gtest_result_compare(g_test_para), 1);
gtest_result_free(g_test_para);
stellar_test_result_cleanup();
return ::testing::Test::HasFailure() ? 1 : 0;
}

View File

@@ -0,0 +1,182 @@
#include <stdlib.h>
#pragma GCC diagnostic ignored "-Wunused-parameter"
#include <stdio.h>
#include <time.h>
#include <unistd.h>
#include <assert.h>
#include "stellar/appid.h"
#include "stellar/module_manager.h"
#include "stellar/session_manager.h"
#include "stellar/session.h"
#include "stellar/utils.h"
#include "cjson/cJSON.h"
#include "lpi_plus/lpi_plus.h"
#include "appid/appid_internal.h"
struct test_lpip_env
{
struct stellar_module_manager *mod_mgr;
struct lpi_plus_mapper *lpi_mapper;
int l7_exdata_idx;
int session_num;
};
struct test_lpip_exdata
{
int appid[MAX_APPID_NUM];
size_t appid_num;
struct session *sess;
};
cJSON *g_result_json=NULL;
void stellar_test_result_setup()
{
if(g_result_json!=NULL)return;
g_result_json=cJSON_CreateArray();
}
char *stellar_test_result_json_export()
{
if(g_result_json==NULL)return NULL;
return cJSON_Print(g_result_json);
}
void stellar_test_result_cleanup()
{
if(g_result_json)cJSON_Delete(g_result_json);
}
static void gtest_lpip_exdata_free(int idx __attribute__((unused)), void *ex_ptr, void *arg)
{
struct test_lpip_env *env = (struct test_lpip_env *)arg;
struct test_lpip_exdata *test_appid_exdata=(struct test_lpip_exdata *)ex_ptr;
if(env==NULL || test_appid_exdata ==NULL)return;
cJSON *ctx = cJSON_CreateObject();
cJSON_AddStringToObject(ctx, "Tuple4", session_get0_readable_addr(test_appid_exdata->sess));
enum session_type type = session_get_type(test_appid_exdata->sess);
if (type == SESSION_TYPE_TCP)
{
cJSON_AddStringToObject(ctx, "STREAM_TYPE", "TCP");
}
if (type == SESSION_TYPE_UDP)
{
cJSON_AddStringToObject(ctx, "STREAM_TYPE", "UDP");
}
if (test_appid_exdata->appid_num > 0)
{
const char *proto_names[MAX_APPID_NUM] = {};
for (unsigned int i = 0; i < test_appid_exdata->appid_num; i++)
{
proto_names[i] = lpi_plus_appid2name(env->lpi_mapper ,test_appid_exdata->appid[i]);
}
cJSON *label_ids = cJSON_CreateIntArray(test_appid_exdata->appid, test_appid_exdata->appid_num);
cJSON_AddItemToObject(ctx, "l7_label_id", label_ids);
cJSON *label_names = cJSON_CreateStringArray(proto_names, test_appid_exdata->appid_num);
cJSON_AddItemToObject(ctx, "l7_label_name", label_names);
}
else
{
cJSON_AddStringToObject(ctx, "l7_label_id", "UNKNOWN");
}
unsigned char dir_flag;
int is_symmetric = session_is_symmetric(test_appid_exdata->sess, &dir_flag);
if (is_symmetric)
{
cJSON_AddStringToObject(ctx, "STREAM_DIR", "DOUBLE");
}
else if (dir_flag == SESSION_SEEN_C2S_FLOW)
{
cJSON_AddStringToObject(ctx, "STREAM_DIR", "C2S");
}
else if (dir_flag == SESSION_SEEN_S2C_FLOW)
{
cJSON_AddStringToObject(ctx, "STREAM_DIR", "S2C");
}
else
{
assert(0);
}
char result_name[128] = "";
env->session_num++;
sprintf(result_name, "APP_PROTO_IDENTIFY_RESULT_%d", env->session_num);
cJSON_AddStringToObject(ctx, "name", result_name);
if(g_result_json)cJSON_AddItemToArray(g_result_json, ctx);
free(test_appid_exdata);
return;
}
static void gtest_lpip_on_appid_msg(struct session *sess, enum APPID_ORIGIN origin, int appid[], size_t appid_num, void *args)
{
if(sess==NULL || appid==NULL || args==NULL)return;
struct test_lpip_env *env = (struct test_lpip_env *)args;
struct test_lpip_exdata *test_appid_exdata=session_get_exdata(sess, env->l7_exdata_idx);
if(test_appid_exdata==NULL)
{
test_appid_exdata = CALLOC(struct test_lpip_exdata, 1);
test_appid_exdata->sess=sess;
}
memcpy(test_appid_exdata->appid, appid, appid_num*sizeof(appid[0]));
test_appid_exdata->appid_num=appid_num;
session_set_exdata(sess, env->l7_exdata_idx, test_appid_exdata);
return;
}
static void on_session(struct session *sess, struct packet *pkt, void *args)
{
if(sess==NULL || pkt==NULL || args==NULL)return;
struct test_lpip_env *env = (struct test_lpip_env *)args;
if (session_get_current_state(sess) == SESSION_STATE_OPENING)
{
struct test_lpip_exdata *test_appid_exdata = session_get_exdata(sess, env->l7_exdata_idx);
if (test_appid_exdata == NULL)
{
test_appid_exdata = CALLOC(struct test_lpip_exdata, 1);
test_appid_exdata->sess=sess;
session_set_exdata(sess, env->l7_exdata_idx, test_appid_exdata);
}
}
return;
}
struct stellar_module *gtest_lpip_module_init(struct stellar_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);
if(sess_mgr == NULL)
{
perror("gtest_lpi_plugin_load:stellar_module_get_session_manager failed !!!\n");
exit(-1);
}
session_manager_subscribe_udp(sess_mgr, on_session, env);
session_manager_subscribe_tcp(sess_mgr, on_session, env);
env->l7_exdata_idx = session_manager_new_session_exdata_index(sess_mgr, "EXDATA_L7", gtest_lpip_exdata_free, env);
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);
}
void gtest_lpip_module_exit(struct stellar_module_manager *mod_mgr, struct stellar_module *mod)
{
assert(mod_mgr!=NULL);
struct test_lpip_env *env = (struct test_lpip_env *)stellar_module_get_ctx(mod);
free(env);
printf("gtest_lpip_module_exit OK!\n");
stellar_module_free(mod);
return ;
}

View File

@@ -0,0 +1,11 @@
# stellar_plugin.toml
#
[[module]]
path = ""
init = "lpi_plus_init"
exit = "lpi_plus_exit"
[[module]]
path = ""
init = "gtest_lpip_module_init"
exit = "gtest_lpip_module_exit"

View File

@@ -1,12 +1,15 @@
#TYPE1:UCHAR,2:USHORT,3:USTRING,4:ULOG,5:USTRING,6:FILE,7:UBASE64,8:PACKET
#TYPE FIELD VALUE
#TYPE LPI_NAME APPID APP_NAME
STRING UNCATEGORIZED 8000
#STRING UNCATEGORIZED 8001
#STRING UNKNOWN_OTHER 8002
STRING DNS 32
STRING DNS_TCP 32 DNS
STRING FTP 45
STRING FTP_Control 45 FTP
STRING FTP_Data 45 FTP
STRING FTPS 751
STRING HTTP 67
STRING HTTP_443 67 HTTP
STRING HTTP_Tunnel 67 HTTP
STRING HTTP_NonStandard 67 HTTP
STRING HTTPS 68
STRING ICMP 70
STRING IKE 8003
@@ -14,6 +17,7 @@ STRING MAIL 8004
STRING IMAP 75
STRING IMAPS 76
STRING IPSEC 85
STRING ESP_UDP 85 IPSEC
STRING XMPP 94
STRING L2TP 98
STRING NTP 137
@@ -22,25 +26,36 @@ STRING POP3S 148
STRING PPTP 153
STRING QUIC 2521
STRING SIP 182
STRING SIP_UDP 182 SIP
STRING SMB 185
STRING SMTP 186
STRING SMTPS 187
STRING SPDY 1469
STRING SSH 198
STRING SSL 199
STRING SSL/TLS 199 SSL
STRING SOCKS 8005
STRING SOCKS4 8005 SOCKS
STRING SOCKS5 8005 SOCKS
STRING TELNET 209
STRING Telnet 209 TELNET
STRING DHCP 29
STRING RADIUS 158
STRING OPENVPN 336
STRING Radius 158 RADIUS
STRING OpenVPN 336 OPENVPN
STRING OpenVPN_UDP 336 OPENVPN
STRING STUN 201
STRING STUN_TCP 201 STUN
STRING TEREDO 555
STRING Teredo 555 TEREDO
STRING DTLS 1291
STRING DoH 8006
STRING ISAKMP 92
STRING MDNS 3835
STRING NETBIOS 129
STRING mDNS 3835 MDNS
STRING NetBIOS 129 NETBIOS
STRING NetBIOS_UDP 129 NETBIOS
STRING NETFLOW 130
STRING NetFlow 130 NETFLOW
STRING RDP 159
STRING RTCP 174
STRING RTP 175
@@ -49,13 +64,17 @@ STRING SNMP 190
STRING SSDP 197
STRING TFTP 211
STRING BJNP 2481
STRING Canon_BJNP 2481 BJNP
STRING LDAP 100
STRING LDAP_AD 100 LDAP
STRING RTMP 337
STRING RTSP 176
STRING ESNI 8008
STRING Stratum 8169
STRING QQ 156
STRING WeChat 1296
STRING WIREGUARD 3700
STRING WeChat_UDP 1296 WeChat
STRING WireGuard 3700 WIREGUARD
STRING MMS 115
STRING RSYNC 173
STRING Rsync 173 RSYNC

View File

@@ -15,8 +15,8 @@
}, {
"Tuple4": "10.0.0.1:1637-10.0.0.2:21477-6-0",
"STREAM_TYPE": "TCP",
"l7_label_id": [8005, 67],
"l7_label_name": ["SOCKS", "HTTP"],
"l7_label_id": [8005],
"l7_label_name": ["SOCKS"],
"STREAM_DIR": "DOUBLE",
"name": "APP_PROTO_IDENTIFY_RESULT_3"
}, {

View File

@@ -287,9 +287,8 @@ struct stellar_module *session_debugger_on_init(struct stellar_module_manager *m
{
assert(mod_mgr);
struct stellar_module *sess_mgr_mod = stellar_module_manager_get_module(mod_mgr, SESSION_MANAGER_MODULE_NAME);
assert(sess_mgr_mod);
struct session_manager *sess_mgr = stellar_module_get_ctx(sess_mgr_mod);
struct session_manager *sess_mgr = stellar_module_get_session_manager(mod_mgr);
assert(sess_mgr);
struct logger *logger = stellar_module_manager_get_logger(mod_mgr);
assert(logger);