summaryrefslogtreecommitdiff
path: root/test/plugin_manager/plugin_manager_mock.h
blob: e02e6864ede9e507f20130787c8869bb620acd56 (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
#ifdef __cplusplus
extern "C"
{
#endif

#include "plugin_manager/plugin_manager.h"
#include "stellar_on_sapp/stellar_internal.h"

//mock stellar
struct stellar
{
	struct plugin_manager_schema *plug_mgr;
};

struct packet
{
	struct stellar *st;
	enum packet_type type;
	unsigned char ip_proto;
};

struct session
{
	struct plugin_manager_runtime *plug_mgr_rt;
};

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;
}

int stellar_get_worker_thread_num(struct stellar *st)
{
	return 1;
}

int stellar_get_current_thread_id(struct stellar *st)
{
	return 0;
}

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)
{
	if(pkt == NULL)return 0;
	return pkt->ip_proto;
}


enum packet_type packet_get_type(const struct packet *pkt)
{
	return pkt->type;
}

#ifdef __cplusplus
}
#endif