summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author贺岚风 <[email protected]>2024-08-30 16:55:13 +0800
committer贺岚风 <[email protected]>2024-09-11 14:33:55 +0800
commit6133ef5cc56fec10a83cab7250178792de5d88da (patch)
tree950b20d0be4b5d38c899535a147bf14e94d651f7
parenta82fd666987b4941fcb439174ee830795c1a2c6f (diff)
remove MESA_handle_logger and MESA_prof_load
-rw-r--r--decoders/dtls/CMakeLists.txt4
-rw-r--r--decoders/dtls/dtls_entry.c15
-rw-r--r--decoders/dtls/dtls_global.h17
-rw-r--r--test/decoders/dtls/CMakeLists.txt2
-rw-r--r--test/decoders/dtls/dtls_decoder_test_plug.cpp2
-rw-r--r--test/decoders/dtls/plugin_test_main.cpp2
6 files changed, 18 insertions, 24 deletions
diff --git a/decoders/dtls/CMakeLists.txt b/decoders/dtls/CMakeLists.txt
index e0f2525..a9d8a30 100644
--- a/decoders/dtls/CMakeLists.txt
+++ b/decoders/dtls/CMakeLists.txt
@@ -13,10 +13,10 @@ add_library(dtls STATIC ${DTLS_SRC})
add_library(dtls_dyn SHARED ${DTLS_SRC})
set_target_properties(dtls PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/dtls.map")
target_include_directories(dtls PUBLIC ${CMAKE_SOURCE_DIR}/deps/)
-target_link_libraries(dtls MESA_handle_logger MESA_prof_load )
+target_link_libraries(dtls toml)
set_target_properties(dtls PROPERTIES PREFIX "")
set_target_properties(dtls_dyn PROPERTIES PREFIX "")
-target_link_libraries(dtls_dyn MESA_handle_logger MESA_prof_load )
+target_link_libraries(dtls_dyn toml)
diff --git a/decoders/dtls/dtls_entry.c b/decoders/dtls/dtls_entry.c
index 6f56f44..5d843bd 100644
--- a/decoders/dtls/dtls_entry.c
+++ b/decoders/dtls/dtls_entry.c
@@ -3,10 +3,10 @@
#include <string.h>
#include "toml/toml.h"
-#include "MESA_prof_load.h"
#include "dtls_entry.h"
#include "dtls_analyse.h"
#include "dtls_trace_tab.h"
+#include "stellar/log.h"
#define GIT_VERSION_CATTER(v) __attribute__((__used__)) const char *GIT_VERSION_##v = NULL
#define GIT_VERSION_EXPEND(v) GIT_VERSION_CATTER(v)
@@ -57,8 +57,8 @@ void dtls_decoder_on_message(struct session *sess, int topic_id, const void *msg
}else if( DTLS_PROTOCOL_FINGERPRINT_STUN == dtls_proto_fp_state ) {
sess_ctx->dtls_protocol_fingerprint_state = dtls_proto_fp_state;
sess_ctx->stun_parsed_num += 1;
- DTLS_RUNTIME_LOG_INFO(__FUNCTION__, "[%s] protocol_fingerprint : STUN, sess_stun_parsed_num:%d",
- sess_ctx->stun_parsed_num, session_get0_readable_addr(sess));
+ DTLS_RUNTIME_LOG_INFO(__FUNCTION__, "[%s] protocol_fingerprint : STUN, sess_stun_parsed_num:%d, sess_addr:%s",
+ session_get0_readable_addr(sess), sess_ctx->stun_parsed_num);
if(sess_ctx->stun_parsed_num > g_dtls_conf_param.stun_max_num_before_dtls) {
session_mq_ignore_message(sess, g_dtls_conf_param.sub_topic_id, g_dtls_conf_param.plugin_id);
}
@@ -136,12 +136,9 @@ static int load_dtls_decoder_config(const char *cfg_path, struct dtls_config_par
void *dtls_decoder_init(struct stellar *st)
{
- MESA_load_profile_int_def(DTLS_CONFIG_PATH, "DTLS", "LOG_LEVEL", &g_dtls_conf_param.log_level, 30);
- MESA_load_profile_string_def(DTLS_CONFIG_PATH, "DTLS", "LOG_PATH", g_dtls_conf_param.log_path, sizeof(g_dtls_conf_param.log_path), "./log/dtls/dtls");
-
- g_dtls_conf_param.logger = MESA_create_runtime_log_handle(g_dtls_conf_param.log_path, g_dtls_conf_param.log_level);
- if (g_dtls_conf_param.logger == NULL) {
- printf("dtls MESA_create_runtime_log() error!\n");
+ g_dtls_conf_param.logger = stellar_get_logger(st);
+ if(g_dtls_conf_param.logger == NULL) {
+ DTLS_RUNTIME_LOG_FATAL("[DTLS_INIT]", "stellar_get_logger failed");
return NULL;
}
diff --git a/decoders/dtls/dtls_global.h b/decoders/dtls/dtls_global.h
index 760380b..7365d34 100644
--- a/decoders/dtls/dtls_global.h
+++ b/decoders/dtls/dtls_global.h
@@ -3,13 +3,12 @@
#include <stdint.h>
#include "dtls.h"
-#include "MESA_handle_logger.h"
-#include "MESA_prof_load.h"
#include "stellar/stellar.h"
#include "stellar/session.h"
#include "stellar/stellar_mq.h"
#include "stellar/stellar_exdata.h"
+#include "stellar/log.h"
#define DTLS_TRUE 1
#define DTLS_FALSE 0
@@ -66,10 +65,8 @@ struct dtls_data
struct dtls_config_param
{
- int32_t log_level;
int32_t sess_exdata_idx;
int32_t plugin_id;
- char log_path[128];
uint64_t dtls_interested_region_flag;
void * logger;
uint32_t stun_max_num_before_dtls; //在进入解析dtls前,识别出的包是stun的个数,如果超过这个个数,则说明这条流不是dtls流。
@@ -154,12 +151,12 @@ struct dtls_message * dtls_sni_message_new(enum dtls_message_type msg_type, cons
enum protocol_fingerprint_state dtls_get_protocol_fingerprint_state( const uint8_t *udp_payload, uint32_t udp_payload_len);
-#define DTLS_RUNTIME_LOG_DEGBUG(mod, fmt, args...) \
- MESA_HANDLE_RUNTIME_LOG(g_dtls_conf_param.logger, RLOG_LV_DEBUG, mod , fmt, ##args)
-#define DTLS_RUNTIME_LOG_INFO(mod, fmt, args...) \
- MESA_HANDLE_RUNTIME_LOG(g_dtls_conf_param.logger, RLOG_LV_INFO, mod , fmt, ##args)
-#define DTLS_RUNTIME_LOG_FATAL(mod, fmt, args...) \
- MESA_HANDLE_RUNTIME_LOG(g_dtls_conf_param.logger, RLOG_LV_FATAL, mod , fmt, ##args)
+#define DTLS_RUNTIME_LOG_DEGBUG(mod, fmt, ...) \
+ STELLAR_LOG_DEBUG(g_dtls_conf_param.logger, mod, fmt, ##__VA_ARGS__)
+#define DTLS_RUNTIME_LOG_INFO(mod, fmt, ...) \
+ STELLAR_LOG_INFO(g_dtls_conf_param.logger, mod, fmt, ##__VA_ARGS__)
+#define DTLS_RUNTIME_LOG_FATAL(mod, fmt, ...) \
+ STELLAR_LOG_FATAL(g_dtls_conf_param.logger, mod, fmt, ##__VA_ARGS__)
#endif
diff --git a/test/decoders/dtls/CMakeLists.txt b/test/decoders/dtls/CMakeLists.txt
index a759e19..f5d6c21 100644
--- a/test/decoders/dtls/CMakeLists.txt
+++ b/test/decoders/dtls/CMakeLists.txt
@@ -25,7 +25,7 @@ add_executable(gtest_dtls dtls_decoder_gtest.cpp
${CMAKE_SOURCE_DIR}/decoders/dtls/dtls_global.c
${CMAKE_SOURCE_DIR}/decoders/dtls/dtls_trace_tab.c)
# add_executable(gtest_dtls dtls_decoder_gtest.cpp )
-target_link_libraries(gtest_dtls gtest stellar_devel MESA_handle_logger MESA_prof_load toml)
+target_link_libraries(gtest_dtls gtest stellar_devel toml)
add_executable(dtls_test_main plugin_test_main.cpp)
set_target_properties(dtls_test_main
diff --git a/test/decoders/dtls/dtls_decoder_test_plug.cpp b/test/decoders/dtls/dtls_decoder_test_plug.cpp
index 58bb281..25f01df 100644
--- a/test/decoders/dtls/dtls_decoder_test_plug.cpp
+++ b/test/decoders/dtls/dtls_decoder_test_plug.cpp
@@ -4,6 +4,7 @@
#include <assert.h>
#include <string.h>
+#include "cjson/cJSON.h"
#include "dtls.h"
#include "dtls_entry.h"
#include "dtls_analyse.h"
@@ -15,7 +16,6 @@ extern "C"
#include "stellar/session.h"
#include "stellar/stellar_mq.h"
#include "stellar/stellar_exdata.h"
-#include "cJSON.h"
}
#define UNUSED(x) ((void)(x))
diff --git a/test/decoders/dtls/plugin_test_main.cpp b/test/decoders/dtls/plugin_test_main.cpp
index 8f3d996..af490b7 100644
--- a/test/decoders/dtls/plugin_test_main.cpp
+++ b/test/decoders/dtls/plugin_test_main.cpp
@@ -1,8 +1,8 @@
-#include "cJSON.h"
#include <gtest/gtest.h>
#include <unistd.h>
#include <stdio.h>
#include <assert.h>
+#include "cjson/cJSON.h"
#ifdef __cplusplus
extern "C"