summaryrefslogtreecommitdiff
path: root/include/private/stream_register.h
blob: 4fb7c8cd56cb8790d29afc469cd9941bc36d6711 (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
#ifndef _APP_STREAM_REGISTER_H_
#define _APP_STREAM_REGISTER_H_ 

#include "stream_inc/stream_base.h"
#include "stream_inc/stream_entry.h"

#define MAX_FUN_NUM 64

enum fun_type_t{
	FUN_TYPE_IPV4=0,
   	FUN_TYPE_IPV6,		
   	FUN_TYPE_TCP,		
   	FUN_TYPE_TCPALL,		
   	FUN_TYPE_UDP,		
   	FUN_TYPE_IPV4_RAW,		
   	FUN_TYPE_IPV6_RAW,		
   	FUN_TYPE_TCP_RAW,		
   	FUN_TYPE_TCPALL_RAW,		
   	FUN_TYPE_UDP_RAW,		
   	/* 2015-02-03 lijia add ip frag entry */
 	FUN_TYPE_IPV4_FRAG,
 	FUN_TYPE_IPV4_FRAG_RAW,
 	FUN_TYPE_IPV6_FRAG,
 	FUN_TYPE_IPV6_FRAG_RAW,
 	FUN_TYPE_PHONY, /* 2016-09-01 lijia add, phony plug entry, will not be called in fact. */
 	FUN_TYPE_POLLING, /* 2016-09-26 lijia add, polling plug entry, will be called wherether has received packet or not. */
 	FUN_TYPE_ARP,
 	__FUN_TYPE_MAX,
};


typedef struct _stFunArray
{
	enum fun_type_t funtype; /* ��ipͷ��ʼ, or ������ԭʼ�� */
	int entry_id; /* ȫ��Ψһ��id, ����ÿ�������ں�����ִ��ʱ��ͳ�� */
	union
	{
		SAPP_STREAM_FUN_T sapp_stream_fun;
		SAPP_PKT_CB_FUN_T sapp_pkt_fun;
		STREAM_CB_FUN_T	stream_fun;
		IPv4_CB_FUN_T	stream_ipv4_fun;
		IPv6_CB_FUN_T	stream_ipv6_fun;
		char (*pfun)(void);
	};	
}stFunArray;

#ifdef __cplusplus
extern "C" {
#endif


int stream_register_tcp_allpkt (STREAM_CB_FUN_T fun);
int stream_register_tcp_takeover (STREAM_CB_FUN_T fun);

int stream_register_tcp (STREAM_CB_FUN_T fun);
int stream_register_udp (STREAM_CB_FUN_T fun);
int stream_register_ip (IPv4_CB_FUN_T fun);
int stream_register_ipv6 (IPv6_CB_FUN_T fun);
int stream_register_ip_frag (IPv4_CB_FUN_T x);
int stream_register_ipv6_frag(IPv6_CB_FUN_T fun);

int stream_register_fun(enum fun_type_t funtype,char (*x)(void), int entry_id);

//ҵ���ص��ӿ�
char PROT_PROCESS(stSessionInfo* session_info,  void **pme, int thread_seq,struct streaminfo *a_stream,const void *a_packet);

/*
	ƽ̨�Ƿ�ת����ǰ��, ����ɴ˻ص���������,
	����:
		net_conn_mode:��������ģʽ;
		plug_action  :��ǰ��ҵ�����ķ���ֵ;
		
	����ֵ:
		PASS or DROP;
*/
int platform_register_action_judge(char (*action_cb_fun)(int net_conn_mode, char plug_action));

#ifdef __cplusplus
}
#endif



#endif