🦄 refactor(directory structure): restructure and rename src to infra
This commit is contained in:
17
infra/plugin_manager/test/CMakeLists.txt
Normal file
17
infra/plugin_manager/test/CMakeLists.txt
Normal file
@@ -0,0 +1,17 @@
|
||||
add_executable(gtest_plugin_manager
|
||||
plugin_manager_gtest_main.cpp
|
||||
)
|
||||
|
||||
include_directories(${CMAKE_SOURCE_DIR}/src/plugin/)
|
||||
|
||||
target_link_libraries(
|
||||
gtest_plugin_manager
|
||||
plugin_manager
|
||||
dl
|
||||
"-rdynamic"
|
||||
gtest
|
||||
gmock
|
||||
)
|
||||
|
||||
include(GoogleTest)
|
||||
gtest_discover_tests(gtest_plugin_manager)
|
||||
2312
infra/plugin_manager/test/plugin_manager_gtest_main.cpp
Normal file
2312
infra/plugin_manager/test/plugin_manager_gtest_main.cpp
Normal file
File diff suppressed because it is too large
Load Diff
116
infra/plugin_manager/test/plugin_manager_gtest_mock.h
Normal file
116
infra/plugin_manager/test/plugin_manager_gtest_mock.h
Normal file
@@ -0,0 +1,116 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "../plugin_manager_interna.h"
|
||||
|
||||
#include "stellar/session.h"
|
||||
#include "tuple/tuple.h"
|
||||
|
||||
//mock stellar
|
||||
struct stellar
|
||||
{
|
||||
struct plugin_manager_schema *plug_mgr;
|
||||
};
|
||||
|
||||
enum packet_type
|
||||
{
|
||||
UNKNOWN,
|
||||
IPv4,
|
||||
IPv6,
|
||||
UDP,
|
||||
TCP,
|
||||
TCP_STREAM,
|
||||
CONTROL,
|
||||
};
|
||||
|
||||
struct packet
|
||||
{
|
||||
struct stellar *st;
|
||||
enum packet_type type;
|
||||
unsigned char ip_proto;
|
||||
};
|
||||
|
||||
|
||||
struct session
|
||||
{
|
||||
struct plugin_manager_runtime *plug_mgr_rt;
|
||||
enum session_type type;
|
||||
enum session_state state;
|
||||
int sess_pkt_cnt;
|
||||
};
|
||||
|
||||
struct plugin_manager_schema * stellar_get_plugin_manager(struct stellar *st)
|
||||
{
|
||||
return st->plug_mgr;
|
||||
}
|
||||
|
||||
int stellar_set_plugin_manger(struct stellar *st, struct plugin_manager_schema *pm)
|
||||
{
|
||||
st->plug_mgr=pm;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int stellar_get_worker_thread_num(struct stellar *st)
|
||||
{
|
||||
return 16;
|
||||
}
|
||||
|
||||
uint16_t stellar_get_current_thread_index()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
unsigned char packet_get_ip_protocol(struct packet *pkt)
|
||||
{
|
||||
return pkt->ip_proto;
|
||||
}
|
||||
|
||||
enum session_type session_get_type(const struct session *sess)
|
||||
{
|
||||
return sess->type;
|
||||
|
||||
}
|
||||
|
||||
void session_set_user_data(struct session *sess, void *user_data)
|
||||
{
|
||||
sess->plug_mgr_rt = (struct plugin_manager_runtime *)user_data;
|
||||
}
|
||||
|
||||
void *session_get_user_data(const struct session *sess)
|
||||
{
|
||||
return sess->plug_mgr_rt;
|
||||
}
|
||||
|
||||
void *packet_get_user_data(const struct packet *pkt)
|
||||
{
|
||||
return pkt->st->plug_mgr;
|
||||
}
|
||||
|
||||
int packet_get_innermost_tuple6(const struct packet *pkt, struct tuple6 *tuple)
|
||||
{
|
||||
tuple->ip_proto = pkt->ip_proto;
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8_t packet_is_ctrl(const struct packet *pkt)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct tcp_segment *session_get_tcp_segment(struct session *sess)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void session_free_tcp_segment(struct session *sess, struct tcp_segment *seg)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user