summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-06-03 19:13:13 +0800
committeryangwei <[email protected]>2024-06-03 19:40:33 +0800
commit7875675349291b5137890ef78d71174661c1752d (patch)
tree185a953d0c96422e3e8a45ad3ff723cc4132f679
parent3c7e53b142981b9bfa66033151a7a32e074c615f (diff)
✨ feat(stellar.h add new API): stellar_emit_datapath_telemetryv2.1.1
-rw-r--r--include/stellar/stellar.h5
-rw-r--r--src/stellar_on_sapp/stellar_on_sapp_api.c7
-rw-r--r--test/plugin_manager/plugin_manager_gtest_main.cpp2
3 files changed, 12 insertions, 2 deletions
diff --git a/include/stellar/stellar.h b/include/stellar/stellar.h
index 491eab3..5176239 100644
--- a/include/stellar/stellar.h
+++ b/include/stellar/stellar.h
@@ -41,4 +41,7 @@ int stellar_packet_plugin_register(struct stellar *st, unsigned char ip_protocol
typedef int plugin_on_polling_func(void *plugin_env);
//return polling plugin_id
-int stellar_polling_plugin_register(struct stellar *st, plugin_on_polling_func on_polling, void *plugin_env); \ No newline at end of file
+int stellar_polling_plugin_register(struct stellar *st, plugin_on_polling_func on_polling, void *plugin_env);
+
+
+void stellar_emit_datapath_telemetry(struct packet *pkt, const char * module, const char *str); \ No newline at end of file
diff --git a/src/stellar_on_sapp/stellar_on_sapp_api.c b/src/stellar_on_sapp/stellar_on_sapp_api.c
index 9f2794d..f7dd17d 100644
--- a/src/stellar_on_sapp/stellar_on_sapp_api.c
+++ b/src/stellar_on_sapp/stellar_on_sapp_api.c
@@ -567,4 +567,11 @@ long long session_get_server_isn(struct session *sess)
int server_isn_sz=sizeof(server_isn);
if(MESA_get_stream_opt(pstream, MSO_TCP_ISN_S2C, &(server_isn), &server_isn_sz)!=0)return -1;
return server_isn;
+}
+
+void stellar_emit_datapath_telemetry(struct packet *pkt, const char * module, const char *str)
+{
+ if(pkt==NULL)return;
+ if(pkt->raw_pkt==NULL)return;
+ sapp_emit_datapath_telemetry(pkt->raw_pkt, module, str);
} \ No newline at end of file
diff --git a/test/plugin_manager/plugin_manager_gtest_main.cpp b/test/plugin_manager/plugin_manager_gtest_main.cpp
index 2745354..9c0e611 100644
--- a/test/plugin_manager/plugin_manager_gtest_main.cpp
+++ b/test/plugin_manager/plugin_manager_gtest_main.cpp
@@ -972,9 +972,9 @@ static void test_session_msg_free(struct session *sess, void *msg, void *msg_fre
{
struct session_plugin_env *env = (struct session_plugin_env *)msg_free_arg;
EXPECT_EQ(sess->plug_mgr_rt->plug_mgr, env->plug_mgr);
- EXPECT_EQ(env->test_mq_pub_called, *(int *)msg);
if(msg)
{
+ EXPECT_EQ(env->test_mq_pub_called, *(int *)msg);
env->test_mq_free_called+=1;
FREE(msg);
}