diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 44718f1..248b236 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,6 @@ add_subdirectory(log) add_subdirectory(times) add_subdirectory(tuple) -add_subdirectory(hexdump) add_subdirectory(packet) add_subdirectory(packet_io) add_subdirectory(id_generator) diff --git a/src/hexdump/CMakeLists.txt b/src/hexdump/CMakeLists.txt deleted file mode 100644 index 81215e1..0000000 --- a/src/hexdump/CMakeLists.txt +++ /dev/null @@ -1,3 +0,0 @@ -add_library(hexdump hexdump.cpp) -target_include_directories(hexdump PUBLIC ${CMAKE_CURRENT_LIST_DIR}) -target_link_libraries(hexdump) \ No newline at end of file diff --git a/src/hexdump/hexdump.h b/src/hexdump/hexdump.h deleted file mode 100644 index 24a8f8f..0000000 --- a/src/hexdump/hexdump.h +++ /dev/null @@ -1,15 +0,0 @@ -#pragma once - -#ifdef __cplusplus -extern "C" -{ -#endif - -#include -#include - -void hexdump_to_fd(int fd, uint32_t idx, const char *data, uint16_t len); - -#ifdef __cplusplus -} -#endif diff --git a/src/packet/CMakeLists.txt b/src/packet/CMakeLists.txt index 55f2812..d644619 100644 --- a/src/packet/CMakeLists.txt +++ b/src/packet/CMakeLists.txt @@ -2,6 +2,7 @@ add_library(packet packet_parse.cpp packet_craft.cpp packet_dump.cpp packet_util target_include_directories(packet PUBLIC ${CMAKE_CURRENT_LIST_DIR}) target_include_directories(packet PUBLIC ${CMAKE_SOURCE_DIR}/deps/uthash) target_include_directories(packet PUBLIC ${CMAKE_SOURCE_DIR}/include) -target_link_libraries(packet hexdump tuple log) +target_include_directories(packet PUBLIC ${CMAKE_SOURCE_DIR}/src/utils) +target_link_libraries(packet tuple log) add_subdirectory(test) \ No newline at end of file diff --git a/src/packet/packet_dump.cpp b/src/packet/packet_dump.cpp index 854d9c2..a4ccfd7 100644 --- a/src/packet/packet_dump.cpp +++ b/src/packet/packet_dump.cpp @@ -5,7 +5,7 @@ #include #include "log.h" -#include "hexdump.h" +#include "utils.h" #include "eth_utils.h" #include "gre_utils.h" #include "udp_utils.h" diff --git a/src/stellar/CMakeLists.txt b/src/stellar/CMakeLists.txt index bc2c897..5f665eb 100644 --- a/src/stellar/CMakeLists.txt +++ b/src/stellar/CMakeLists.txt @@ -1,5 +1,5 @@ set(SOURCE stellar_config.cpp stellar_stat.cpp stellar_core.cpp) -set(LIBRARY times session_manager plugin_manager ip_reassembly packet_io packet pthread fieldstat4 toml hexdump) +set(LIBRARY times session_manager plugin_manager ip_reassembly packet_io packet pthread fieldstat4 toml) add_library(stellar_core STATIC ${SOURCE}) target_link_libraries(stellar_core PUBLIC ${LIBRARY}) diff --git a/src/hexdump/hexdump.cpp b/src/utils/utils.h similarity index 85% rename from src/hexdump/hexdump.cpp rename to src/utils/utils.h index a2d19cc..7155d9f 100644 --- a/src/hexdump/hexdump.cpp +++ b/src/utils/utils.h @@ -1,6 +1,14 @@ -#include "hexdump.h" +#pragma once -void hexdump_to_fd(int fd, uint32_t idx, const char *data, uint16_t len) +#ifdef __cplusplus +extern "C" +{ +#endif + +#include +#include + +static inline void hexdump_to_fd(int fd, uint32_t idx, const char *data, uint16_t len) { uint16_t i = 0; uint16_t used = 0; @@ -48,4 +56,8 @@ void hexdump_to_fd(int fd, uint32_t idx, const char *data, uint16_t len) } dprintf(fd, "%s\n", line); } -} \ No newline at end of file +} + +#ifdef __cplusplus +} +#endif diff --git a/test/debug_plugin/CMakeLists.txt b/test/debug_plugin/CMakeLists.txt index 4513145..3f45af8 100644 --- a/test/debug_plugin/CMakeLists.txt +++ b/test/debug_plugin/CMakeLists.txt @@ -1,7 +1,8 @@ # build libdebug_plugin.so add_library(debug_plugin SHARED debug_plugin.cpp) -target_link_libraries(debug_plugin stellar_devel hexdump session_manager packet) +target_link_libraries(debug_plugin stellar_devel session_manager packet) target_include_directories(debug_plugin PUBLIC ${CMAKE_SOURCE_DIR}/include/) +target_include_directories(debug_plugin PUBLIC ${CMAKE_SOURCE_DIR}/src/utils) set_target_properties(debug_plugin PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_LIST_DIR}/version.map") file(COPY ./conf/ DESTINATION ./conf/) \ No newline at end of file diff --git a/test/debug_plugin/debug_plugin.cpp b/test/debug_plugin/debug_plugin.cpp index 35e234f..e2954f0 100644 --- a/test/debug_plugin/debug_plugin.cpp +++ b/test/debug_plugin/debug_plugin.cpp @@ -9,7 +9,7 @@ #include #include -#include "hexdump.h" +#include "utils.h" #include "session_utils.h" #include "packet_dump.h" #include "stellar/packet.h"