summaryrefslogtreecommitdiff
path: root/include/MESA/stream_inc/stream_tunnel.h
blob: bada1403daee3c052875850050cba63219d380ab (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
#ifndef _APP_STREAM_TUNNEL_H_
#define _APP_STREAM_TUNNEL_H_ 1 

#define STREAM_TUNNEL_H_VERSION		(20161201)

#ifdef __cplusplus
extern "C" {
#endif

enum tunnel_channel_type_t{
	TUNNEL_CHANNEL_TYPE_CONTROL	= 1, /* ����Э�����ͨ�� */
	TUNNEL_CHANNEL_TYPE_DATA	= 2, /* ����Э������ͨ�� */
};

enum tunnel_content_type_t{
	TUNNEL_CONTENT_TYPE_CLEAR		= 1, /* �������� */
	TUNNEL_CONTENT_TYPE_COMPRESS	= 2,	/* ѹ������ */
	TUNNEL_CONTENT_TYPE_ENCRYPT		= 3, /* �������� */
};

#define PPTP_ENCRYPT_MPPE				(1)
#define PPTP_ENCRYPT_IPSEC				(2)
#define PPTP_ENCRYPT_PAP				(3)
#define PPTP_ENCRYPT_CHAP				(4)
#define PPTP_ENCRYPT_MS_CHAP			(5)
#define PPTP_ENCRYPT_EAP_TLS			(6)

#define PPTP_ENCRYPT_MPPC				(100) /* ѹ���㷨, ����־����в�����, ʹ��100, Ԥ������ֵ����չ�ռ� */

typedef struct{
	int link_type;
	int encrypt_pro;
	int authentication_pro;
	int protocol_compress_enable;
	int addr_ctrl_compress_enable;
	int content_type; /* refer to tunnel_content_type_t */	
}pptp_info_t;


#define L2TP_ENCRYPT_OTHER	(0)	
#define L2TP_ENCRYPT_IPSEC		(1)
#define L2TP_ENCRYPT_NONE		(2)

typedef struct{
	int link_type;
	int encrypt_pro;
	int authentication_pro;
	int protocol_compress_enable;
	int addr_ctrl_compress_enable;	
	int content_type; /* tunnel_content_type_t */	
	char *chap_username; /* string end with '\0' */
}l2tp_info_t;

#define IPSEC_VERSION_ISAKMP_V1	(1)
#define IPSEC_VERSION_IKE_V2		(2)


typedef struct{
	unsigned long long init_cookie;
	unsigned long long resp_cookie;
	unsigned short encry_algo;
	unsigned short hash_algo;
	unsigned short auth_method;
	unsigned char upon_udp_nat; /* �Ƿ����UDP-4500�˿ڵ�NAT */
	unsigned char exchange_type;
	unsigned char major_version;
	unsigned char minor_version;
}isakmp_info_t;

typedef enum{
	/* NOTE: �ܶ�Э����ص�ֵ��������, ��Ϊ���󲻶�������, ���еĶ��岻�ܸĶ�, ֻ���ٺ���׷����ֵ */
	TUNNEL_PHONY_PROT_FLAG	= 1<<0,		/* phony flag, meaningless */	
	IPSEC_OPT_IKE_VERSION 		= 1<<1,  		/* opt_val type is int* */
	IPSEC_OPT_ENCRYPT_ALGO 	= 1<<2,  		/* opt_val type is int* */
	IPSEC_OPT_HASH_ALGO 		= 1<<3,  		/* opt_val type is int* */
	PPTP_OPT_LINK_TYPE 		= 1<<4,		/* opt_val type is int* */
	PPTP_OPT_ENCRYPT_PRO 		= 1<<5,		/* opt_val type is int* */
	PPTP_OPT_AUTHEN_PRO 		= 1<<6,		/* opt_val type is int* */
	PPTP_OPT_COMPRESS_PRO	= 1<<7,		/* opt_val type is int* */
	L2TP_OPT_LINK_TYPE 		= 1<<8,		/* opt_val type is int* */
	L2TP_OPT_ENCRYPT_PRO 		= 1<<9,		/* opt_val type is int* */	
	IPSEC_OPT_EXCHG_MODE		= 1<<10,		/* opt_val type is uint8*, just a 8bit integer, not string */	
	IPSEC_OPT_IS_NAT			= 1<<11, 	/* opt_val type is uint8*, just a 8bit integer, not string */
	L2TP_OPT_CHAP_USER_NAME 	= 1<<12, 	/* opt_val type is string, end with '\0' */
	PPTP_CONTENT_TYPE			= 1<<13,		/* opt_val type is int*,  refer to enum tunnel_content_type_t */
	L2TP_CONTENT_TYPE			= 1<<14,		/* opt_val type is int*,  refer to enum tunnel_content_type_t */	
}tunnel_info_opt_t;


struct MESA_tunnel_info{
	int tunnel_type; /* refer to stream_base.h --> enum stream_type_t */
	union{
		pptp_info_t pptp_info;
		l2tp_info_t l2tp_info;
		isakmp_info_t isakmp_info;
	};
};


#ifdef __cplusplus
}
#endif

#endif