summaryrefslogtreecommitdiff
path: root/include/private/FakeInterface.h
blob: f3e2267ee56aa5bade3b770d65ed6f0f736eb9b6 (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
98
99
100
101
102
103
104
105
106
107
108
#ifndef __FAKE_INTERFACE_H__
#define __FAKE_INTERFACE_H__
//#include "ace/OS.h"

#ifdef __cplusplus
extern "C" {
#endif	

#define ETH_P_IP 0x0800
#define PROTO_TCP 0x06
#define PROTO_UDP 0x11

#define MAX_QUEUE_COUNT 	16
#define MAX_SKB_QUEUE_LENGTH	10000
#define MAX_FLOW_QUEUE_LENGTH	100000


struct RawShotAddr
{
	
unsigned int srcIp;
	
unsigned int dstIp;
	
unsigned short srcPort;
	
unsigned short dstPort;
	
unsigned char proto;
	
unsigned char srcNation;			//ԴIP������
	
unsigned char dstNation;			//Ŀ��IP������
	
unsigned char allRecvShotType;		//ȫ���б�����
	
unsigned short srcShotType;			//ԭʼ���ĵ��б����ͣ�Դ����
	
unsigned short dstShotType;			//ԭʼ���ĵ��б����ͣ�Ŀ�ķ���
	
unsigned long jiffies;              //jiffieֵ

};

//������˵Ķ�������Ϣ����ԭʼ����
enum TargetType
{
	TARGET_FLOWINFO = 1,				//��������Ϣ
	TARGET_RAWDATA = 2					//����ԭʼ����
};

//������˹������ȼ�
enum RecordPriority
{
	RECORD_PRIORITY_LOW	= 1,			//�����ȼ�
	RECORD_PRIORITY_HIGH = 2			//�����ȼ�
};

/*�ӿ�ͨ�÷���ֵ��
 * 		0��ִ�гɹ�
 * 		-1����������
 * 		-2������pid�����ϵ�������
 * 		-3����Դ����ʧ��
 * 		-4��ϵͳ����ʧ��
 * 		-5���ں�δ��ʼ��
 * 		������ֵ��ִ����������δ����������������ԭ����ӿڷ���ֵ���ܡ�
 * 		���ฺֵ��ִ���쳣������ԭ����ӿڷ���ֵ���ܡ�
 */


/*��ȫ�չ���
����ֵ��
*/	
int BindAllRecvRule(enum TargetType targetType, enum RecordPriority recordPriority);

/*���ȫ�չ���
����ֵ��
*/
int UnbindAllRecvRule(enum TargetType targetType, enum RecordPriority recordPriority);


/*�����ɼ�����
������
	queueCount����������
	bufLen��ÿ���հ�����ij��ȣ�ע�⣺���Ƕ��еij��ȣ���
����ֵ��
*/
int CreateRawDataTask(unsigned int queueCount, unsigned int bufLen);


/*�����������ٹ����뻺������
����ֵ��
*/
int CloseRawDataTask();

/*��ָ����ԭʼ����queue����ȡԭʼ����������recvBuf�����У�ÿ�����ĵĶ�Ӧ��Ϣ������rawShotAddr�У�
  requestCount��ʾrecvBuf�ĸ�����recvCount����ʵ����ȡ�ı��ĸ�����
����ֵ��
	1��δ��ȡ���ݣ���Ϊû�������б�
*/
int RecvRawData(unsigned int queueId, char* recvBuf[], unsigned int recvBufLen[], struct RawShotAddr rawShotAddr[], int requestCount, int* recvCount);

#ifdef __cplusplus
}
#endif	

#endif