-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTunnel.h
107 lines (90 loc) · 2.52 KB
/
Tunnel.h
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
#ifndef _SIMPLE_TUNNEL_H
#define _SIMPLE_TUNNEL_H
////////////////////////////////////////////////////////////////////////////////
//
// General definitions
//
// Including the definitions for general using.
//
// These definitions are generally used in different operation system.
//
////////////////////////////////////////////////////////////////////////////////
//Tunnel
typedef struct tagNetworkTunnel
{
//Handle
_OBJECT lpHandle;
//Version
_UINT32 nVersion[3];
//MTU
_UINT32 nMTUSize;
//Local IP Address
_IPV4 ipLocal;
//Local IP Netmask
_IPV4 ipNetmask;
//Local MAC Address
_MAC6 macLocal;
//Remote IP Address
_IPV4 ipRemote;
//Remote MAC Address
_MAC6 macRemote;
//GUID
_PASCALSTRING strGuid;
//Adapter Index
_INT32 nAdapterIndex;
//DHCP Enabled
_BOOL bDHCPEnabled;
//NTE Context
_UINT32 nConext;
//NTE Instance
_UINT32 nInstance;
//Peer Port
_UINT16 nPeerPort;
//Peer IP Address
_PASCALSTRING strPeerAddress;
//UDP Socket
_SOCKET socketUDP;
//Read Overlapped
_OBJECT lpRead;
//Read Size
_UINT32 nReadSize;
//Write Overlapped
_OBJECT lpWrite;
//Write Size
_UINT32 nWriteSize;
//Read Thread.
SimpleThread readThread;
//Write Thread.
SimpleThread writeThread;
}
NetworkTunnel;
////////////////////////////////////////////////////////////////////////////////
//
// Initialize network functions.
//
////////////////////////////////////////////////////////////////////////////////
//Initialize Tunnel Environment
extern _BOOL InitializeTunnelEnvironment();
//Uninitialize Tunnel Environment
extern void UninitializeTunnelEnvironment();
////////////////////////////////////////////////////////////////////////////////
//
// Tunnel functions.
//
////////////////////////////////////////////////////////////////////////////////
//Initialize Network Tunnel
extern void InitializeNetworkTunnel(NetworkTunnel* pTunnel);
//Uninitialize Network Tunnel
extern void UninitializeNetworkTunnel(NetworkTunnel* pTunnel);
//Open Network Tunnel
extern _BOOL OpenNetworkTunnel(NetworkTunnel* pTunnel);
//Open Named Network Tunnel
extern _BOOL OpenNamedNetworkTunnel(NetworkTunnel* pTunnel,_STRING lpstrAdapterName);
//Close Network Tunnel
extern void CloseNetworkTunnel(NetworkTunnel* pTunnel);
//Read Network Tunnel
extern _BOOL ReadNetworkTunnel(NetworkTunnel* pTunnel,_BYTE* lpBuffer,_INT32* lpReadSize);
//Write Network Tunnel
extern _BOOL WriteNetworkTunnel(NetworkTunnel* pTunnel,_BYTE* lpBuffer,_INT32* lpWriteSize);
////////////////////////////////////////////////////////////////////////////////
#endif //End of the header file.