refactor: move hexdump API to utils.h
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
add_subdirectory(log)
|
add_subdirectory(log)
|
||||||
add_subdirectory(times)
|
add_subdirectory(times)
|
||||||
add_subdirectory(tuple)
|
add_subdirectory(tuple)
|
||||||
add_subdirectory(hexdump)
|
|
||||||
add_subdirectory(packet)
|
add_subdirectory(packet)
|
||||||
add_subdirectory(packet_io)
|
add_subdirectory(packet_io)
|
||||||
add_subdirectory(id_generator)
|
add_subdirectory(id_generator)
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
add_library(hexdump hexdump.cpp)
|
|
||||||
target_include_directories(hexdump PUBLIC ${CMAKE_CURRENT_LIST_DIR})
|
|
||||||
target_link_libraries(hexdump)
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C"
|
|
||||||
{
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
|
|
||||||
void hexdump_to_fd(int fd, uint32_t idx, const char *data, uint16_t len);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -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_CURRENT_LIST_DIR})
|
||||||
target_include_directories(packet PUBLIC ${CMAKE_SOURCE_DIR}/deps/uthash)
|
target_include_directories(packet PUBLIC ${CMAKE_SOURCE_DIR}/deps/uthash)
|
||||||
target_include_directories(packet PUBLIC ${CMAKE_SOURCE_DIR}/include)
|
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)
|
add_subdirectory(test)
|
||||||
@@ -5,7 +5,7 @@
|
|||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
|
||||||
#include "log.h"
|
#include "log.h"
|
||||||
#include "hexdump.h"
|
#include "utils.h"
|
||||||
#include "eth_utils.h"
|
#include "eth_utils.h"
|
||||||
#include "gre_utils.h"
|
#include "gre_utils.h"
|
||||||
#include "udp_utils.h"
|
#include "udp_utils.h"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
set(SOURCE stellar_config.cpp stellar_stat.cpp stellar_core.cpp)
|
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})
|
add_library(stellar_core STATIC ${SOURCE})
|
||||||
target_link_libraries(stellar_core PUBLIC ${LIBRARY})
|
target_link_libraries(stellar_core PUBLIC ${LIBRARY})
|
||||||
|
|||||||
@@ -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 <stdint.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
static inline void hexdump_to_fd(int fd, uint32_t idx, const char *data, uint16_t len)
|
||||||
{
|
{
|
||||||
uint16_t i = 0;
|
uint16_t i = 0;
|
||||||
uint16_t used = 0;
|
uint16_t used = 0;
|
||||||
@@ -49,3 +57,7 @@ void hexdump_to_fd(int fd, uint32_t idx, const char *data, uint16_t len)
|
|||||||
dprintf(fd, "%s\n", line);
|
dprintf(fd, "%s\n", line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
# build libdebug_plugin.so
|
# build libdebug_plugin.so
|
||||||
add_library(debug_plugin SHARED debug_plugin.cpp)
|
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}/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")
|
set_target_properties(debug_plugin PROPERTIES LINK_FLAGS "-Wl,--version-script=${CMAKE_CURRENT_LIST_DIR}/version.map")
|
||||||
|
|
||||||
file(COPY ./conf/ DESTINATION ./conf/)
|
file(COPY ./conf/ DESTINATION ./conf/)
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
||||||
#include "hexdump.h"
|
#include "utils.h"
|
||||||
#include "session_utils.h"
|
#include "session_utils.h"
|
||||||
#include "packet_dump.h"
|
#include "packet_dump.h"
|
||||||
#include "stellar/packet.h"
|
#include "stellar/packet.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user