From 5d6fecfb9c54813bf81ca2bea2f72da675edf1dd Mon Sep 17 00:00:00 2001 From: yangwei Date: Mon, 19 Aug 2024 19:27:49 +0800 Subject: ✨ feat(appid.h): define app_id message in stellar MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- decoders/glimpse_detector/app_l7_protocol.cpp | 2 +- include/stellar/appid.h | 31 ++++++++++++++++++++++ test/glimpse_detector/CMakeLists.txt | 2 +- .../gtest_glimpse_detector_main.cpp | 2 +- vendor/CMakeLists.txt | 5 ++-- 5 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 include/stellar/appid.h diff --git a/decoders/glimpse_detector/app_l7_protocol.cpp b/decoders/glimpse_detector/app_l7_protocol.cpp index bd1f995..5bc1405 100644 --- a/decoders/glimpse_detector/app_l7_protocol.cpp +++ b/decoders/glimpse_detector/app_l7_protocol.cpp @@ -24,9 +24,9 @@ #include "stellar/stellar_mq.h" #include "stellar/layer.h" +#include "stellar/appid.h" #include "app_l7_protocol.h" -#include "firewall/firewall_message.h" const char *dns_name="DNS"; const char *imap_name="IMAP"; diff --git a/include/stellar/appid.h b/include/stellar/appid.h new file mode 100644 index 0000000..6d82d71 --- /dev/null +++ b/include/stellar/appid.h @@ -0,0 +1,31 @@ +#pragma once + +#include +#include + +#define MESSAGE_MAGIC 0x12345678 + +#define MAX_APP_ID_NUM 8 +#define APP_ID_MESSAGE_TOPIC "TOPIC_APP_ID" + +enum APP_IDENTIFY_ORIGIN +{ + ORIGIN_PROTO_IDENTIFY=0, + ORIGIN_APP_SKETCH_USER_DEFINE, + ORIGIN_PROTO_ENGINE, + ORIGIN_APP_SKETCH_BUILT_IN, + ORIGIN_PROTO_DECODED, + ORIGIN_EXCEED_PACKET_LIMIT, + ORIGIN_TUNNEL, + ORIGIN_MAX +}; + +struct app_id_message +{ + int magic; + enum APP_IDENTIFY_ORIGIN origin; + uint32_t app_id_num; + int32_t app_id[MAX_APP_ID_NUM]; + uint32_t surrogate_id[MAX_APP_ID_NUM]; + uint32_t packet_sequence[MAX_APP_ID_NUM]; +}; \ No newline at end of file diff --git a/test/glimpse_detector/CMakeLists.txt b/test/glimpse_detector/CMakeLists.txt index d516ac6..498e4a8 100644 --- a/test/glimpse_detector/CMakeLists.txt +++ b/test/glimpse_detector/CMakeLists.txt @@ -4,7 +4,7 @@ target_include_directories(gtest_glimpse_detector PRIVATE ${CMAKE_SOURCE_DIR}/de target_include_directories(gtest_glimpse_detector PRIVATE ${CMAKE_SOURCE_DIR}/decoders/glimpse_detector) target_link_libraries( -gtest_glimpse_detector PRIVATE stellar_devel glimpse_detector cjson-static MESA_prof_load +gtest_glimpse_detector PRIVATE stellar_devel glimpse_detector cjson-static dl "-rdynamic" gtest gmock ) diff --git a/test/glimpse_detector/gtest_glimpse_detector_main.cpp b/test/glimpse_detector/gtest_glimpse_detector_main.cpp index 8df1eef..026dc93 100644 --- a/test/glimpse_detector/gtest_glimpse_detector_main.cpp +++ b/test/glimpse_detector/gtest_glimpse_detector_main.cpp @@ -13,7 +13,7 @@ #include "app_l7_protocol.h" -#include "cJSON.h" +#include "cjson/cJSON.h" //#include "MESA_prof_load.h" #include "stellar/stellar.h" diff --git a/vendor/CMakeLists.txt b/vendor/CMakeLists.txt index 09d8e2b..08ca771 100644 --- a/vendor/CMakeLists.txt +++ b/vendor/CMakeLists.txt @@ -34,12 +34,13 @@ ExternalProject_Add(cjson PREFIX cjson BUILD_IN_SOURCE 1) ExternalProject_Get_Property(cjson INSTALL_DIR) -file(MAKE_DIRECTORY ${VENDOR_BUILD}/include/cjson) +message(STATUS "cjson will be installed in: ${INSTALL_DIR}") +file(MAKE_DIRECTORY ${INSTALL_DIR}/include/) add_library(cjson-static STATIC IMPORTED GLOBAL) add_dependencies(cjson-static cjson) set_property(TARGET cjson-static PROPERTY IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/vendor/cjson/src/cjson/libcjson.a) -set_property(TARGET cjson-static PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${VENDOR_BUILD}/include/cjson) +set_property(TARGET cjson-static PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${INSTALL_DIR}/include/) #llhttp-9.1.3 ExternalProject_Add(llhttp PREFIX llhttp -- cgit v1.2.3