【修改】修改名称
This commit is contained in:
97
test/include/plugin_manager_gtest_mock.h
Normal file
97
test/include/plugin_manager_gtest_mock.h
Normal file
@@ -0,0 +1,97 @@
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
#include "plugin_manager_interna.h"
|
||||
#include "stellar_internal.h"
|
||||
#include "stellar/session.h"
|
||||
#include "lua_plugin_manage.h"
|
||||
|
||||
|
||||
//mock stellar
|
||||
struct stellar
|
||||
{
|
||||
struct plugin_manager_schema *plug_mgr;
|
||||
struct lua_plugin_manage * lua_plug_mgr;
|
||||
int thread_num;
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
enum session_state session_get_current_state(struct session *sess)
|
||||
{
|
||||
return sess->state;
|
||||
}
|
||||
|
||||
enum session_type session_get_type(struct session *sess)
|
||||
{
|
||||
return sess->type;
|
||||
}
|
||||
|
||||
int session_get_current_plugin_id(struct session *sess)
|
||||
{
|
||||
return sess->plug_mgr_rt->current_session_plugin_id;
|
||||
}
|
||||
|
||||
struct plugin_manager_schema * stellar_plugin_manager_schema_get(struct stellar *st)
|
||||
{
|
||||
return st->plug_mgr;
|
||||
}
|
||||
|
||||
int stellar_plugin_manager_schema_set(struct stellar *st, struct plugin_manager_schema *pm)
|
||||
{
|
||||
st->plug_mgr=pm;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wunused-parameter"
|
||||
int stellar_get_worker_thread_num(struct stellar *st)
|
||||
{
|
||||
return st->thread_num;
|
||||
}
|
||||
|
||||
int stellar_get_current_thread_id(struct stellar *st)
|
||||
{
|
||||
return 3;
|
||||
}
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
struct stellar * packet_stellar_get(struct packet *pkt)
|
||||
{
|
||||
return pkt->st;
|
||||
}
|
||||
|
||||
struct plugin_manager_runtime * session_plugin_manager_runtime_get(struct session *sess)
|
||||
{
|
||||
return sess->plug_mgr_rt;
|
||||
}
|
||||
|
||||
unsigned char packet_get_ip_protocol(struct packet *pkt)
|
||||
{
|
||||
return pkt->ip_proto;
|
||||
}
|
||||
|
||||
|
||||
enum packet_type packet_get_type(const struct packet *pkt)
|
||||
{
|
||||
return pkt->type;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
Reference in New Issue
Block a user