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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
#ifndef _PLUGIN_H
#define _PLUGIN_H
#include <netinet/ip.h>
#include "stream.h"
#include "sapp_limits.h"
#include "sapp_mem.h"
#include "stream_register.h"
#include "sapp_global_val.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef MAX_THREAD_NUM
#define MAX_THREAD_NUM 256
#endif
#define PLUGTYPE_PROTOCOL 1
#define PLUGTYPE_BUSENISS 2
#define PLUGTYPE_PLATFORM 3
#define PLUGIN_MAX_ENTRYNUM 16
#define PLUGIN_MAX_CONFLEN 1024
#define KEYWORD_SPECIAL1 "["
#define KEYWORD_SPECIAL2 "]"
#define SECTION_PLUGINFO "PLUGINFO"
#define SECTION_FUN_IP "IP"
#define SECTION_FUN_IPV6 "IPV6"
#define SECTION_FUN_IPV4_RAW "IPV4_RAW"
#define SECTION_FUN_IPV6_RAW "IPV6_RAW"
#define SECTION_FUN_TCP "TCP"
#define SECTION_FUN_TCP_ALL "TCP_ALL"
#define SECTION_FUN_UDP "UDP"
#define SECTION_FUN_TCP_RAW "TCP_RAW"
#define SECTION_FUN_TCPALL_RAW "TCPALL_RAW"
#define SECTION_FUN_UDP_RAW "UDP_RAW"
#define SECTION_FUN_IP_FRAG "IP_FRAG"
#define SECTION_FUN_IP_FRAG_RAW "IP_FRAG_RAW"
#define SECTION_FUN_IPV6_FRAG "IPV6_FRAG"
#define SECTION_FUN_IPV6_FRAG_RAW "IPV6_FRAG_RAW"
/* 2016-09-01 lijia add, phony plug entry, will not be called in fact. */
#define SECTION_FUN_PHONY "PHONY"
/* 2016-09-26 lijia add, polling plug entry, will be called wherether has received packet or not. */
#define SECTION_FUN_POLLING "POLLING"
//20170525 liuyang add for wy serial
#define KEYWORD_PLUGID "PLUGID"
#define KEYWORD_PLUGTYPE "PLUGTYPE"
//add end
#define KEYWORD_PLUGNAME "PLUGNAME"
#define KEYWORD_FILENAME "SO_PATH"
#define KEYWORD_FUNINIT "INIT_FUNC"
#define KEYWORD_FUNDESTROY "DESTROY_FUNC"
#define KEYWORD_FUNUPDATE "UPDATE_FUNC"
//ֻ�н�����������Ҫ
#define KEYWORD_FUNCHANGE "FLAGCHANGE_FUNC"
#define KEYWORD_FUNSTATE "FLAGSTATE_FUNC"
#define KEYWORD_FUNGETID "GETPLUGID_FUNC"
#define KEYWORD_FUNFLAG "FUNC_FLAG"
#define KEYWORD_FUNNAME "FUNC_NAME"
#define FUNFLAG_ALL_B "ALL"
#define FUNFLAG_ALL_S "all"
typedef struct _plugin_entryname_elem
{
char name[PLUGIN_MAX_CONFLEN];
}stEntryNameElem;
typedef struct _plugin_entry_name_info
{
int num;
stEntryNameElem* entryname;
}stEntryNameInfo;
typedef char (*AppEntry)(stSessionInfo* session_info, void **pme, int thread_seq,struct streaminfo *a_stream,const void *a_packet);
//ÿ��Ӧ�ò�Ự��Ҫ�ĺ������
typedef struct _plugin_protocol_session_fun_info
{
long long protflag;
AppEntry appentry;
//modify liuy 20140616 for pending has no flag;
char called_flag;
//modify end
char appstate;
char pre_kill_flag;
int entry_id;
void* pme; //ҵ������������Ϣ
struct _plugin_protocol_session_fun_info* next;
}stSessionFunInfo;
typedef struct {
int entry_id; /* ȫ��Ψһ, ���в��ÿ���entry������һ��id */
int priority; /* ��������ȼ� */
const char *plug_name;
const char *plug_entry_name;
}plug_global_entry_t;
extern plug_global_entry_t g_plug_global_entry[SAPP_MAX_PLUG_ENTRY_NUM];
extern int g_plug_global_entry_index;
extern sapp_global_t *sapp_global_val;
#define g_plugin_runtime_handle sapp_global_val->individual_fixed.plugin_log_handle
extern int stream_register_fun(enum fun_type_t funtype,char (*x)(void), int entry_id);
void plugin_call_flagstate();
int process_conf_entryname();
int process_confelem_plugname(char* filename,int plugtype,char** plugname);
int process_conflist(int plug_type);
int plug_mange_get_entry_id(const char *plug_name, const char *plug_entry_name);
int sapp_plugin_load_state_fs2_init(void);
void plugin_load_state_update(int init_state, long long time_spent_in_us, const char *plug_path, const char *plug_name);
int plug_priority_get(int entry_id);
int max_plug_priority_get();
#ifdef __cplusplus
}
#endif
#endif
|