summaryrefslogtreecommitdiff
path: root/test/include/plugin_manager_gtest_mock.h
blob: da994c9a7be0e89e1316e5952da2268696fbdf52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
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