summaryrefslogtreecommitdiff
path: root/test/packet_inject
diff options
context:
space:
mode:
authoryangwei <[email protected]>2024-08-06 20:37:59 +0800
committerluwenpeng <[email protected]>2024-08-12 15:45:50 +0800
commit6786372449b70caaaf6824e1ed0e59800659b2d6 (patch)
tree869aaa46825ce60d224338f8040f1a1b35f5df00 /test/packet_inject
parentee695957205fceb7990d123f6cccf7de3e58c12c (diff)
✨ feat(plugin manager integration): packet and session exdata&mq
Diffstat (limited to 'test/packet_inject')
-rw-r--r--test/packet_inject/CMakeLists.txt7
-rw-r--r--test/packet_inject/packet_inject.cpp8
2 files changed, 9 insertions, 6 deletions
diff --git a/test/packet_inject/CMakeLists.txt b/test/packet_inject/CMakeLists.txt
index 61fc165..3bfb3c2 100644
--- a/test/packet_inject/CMakeLists.txt
+++ b/test/packet_inject/CMakeLists.txt
@@ -1,14 +1,15 @@
# build libpacket_inject.so
add_library(packet_inject SHARED packet_inject.cpp)
-target_link_libraries(packet_inject stellar_devel toml)
+target_link_libraries(packet_inject toml)
target_include_directories(packet_inject PUBLIC ${CMAKE_SOURCE_DIR}/include/)
set_target_properties(packet_inject PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_LIST_DIR}/version.map")
# build gtest
function(packet_inject_add_case EXEC_NAME)
add_executable(${EXEC_NAME} ${EXEC_NAME}.cpp)
- target_link_libraries(${EXEC_NAME} "-rdynamic")
- target_link_libraries(${EXEC_NAME} stellar_devel gtest)
+ target_include_directories(${EXEC_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/include/)
+ target_link_libraries(${EXEC_NAME} PRIVATE "-rdynamic")
+ target_link_libraries(${EXEC_NAME} PRIVATE stellar_devel gtest)
gtest_discover_tests(${EXEC_NAME})
endfunction()
diff --git a/test/packet_inject/packet_inject.cpp b/test/packet_inject/packet_inject.cpp
index 193cbd5..0ffdc61 100644
--- a/test/packet_inject/packet_inject.cpp
+++ b/test/packet_inject/packet_inject.cpp
@@ -5,8 +5,10 @@
#include <arpa/inet.h>
#include "toml.h"
+#include "stellar/stellar.h"
#include "stellar/layer.h"
-#include "stellar/session_mq.h"
+#include "stellar/session.h"
+#include "stellar/stellar_mq.h"
#define LOG_ERR(fmt, ...) printf("ERROR [packet inject] " fmt, ##__VA_ARGS__)
#define LOG_INFO(fmt, ...) printf("INFO [packet inject] " fmt, ##__VA_ARGS__)
@@ -545,8 +547,8 @@ extern "C"
ctx->st = st;
ctx->sess_plug_id = stellar_session_plugin_register(st, on_sess_new, on_sess_free, ctx);
- ctx->tcp_topic_id = stellar_session_mq_get_topic_id(st, TOPIC_TCP);
- ctx->udp_topic_id = stellar_session_mq_get_topic_id(st, TOPIC_UDP);
+ ctx->tcp_topic_id = stellar_mq_get_topic_id(st, TOPIC_TCP);
+ ctx->udp_topic_id = stellar_mq_get_topic_id(st, TOPIC_UDP);
stellar_session_mq_subscribe(st, ctx->tcp_topic_id, on_sess_msg, ctx->sess_plug_id);
stellar_session_mq_subscribe(st, ctx->udp_topic_id, on_sess_msg, ctx->sess_plug_id);