svn cleanup
[anytun.git] / openvpn / tap-win32 / prototypes.h
blob2237ed0bd64b5d510181fe026eacfad4385b9af5
1 /*
2 * TAP-Win32 -- A kernel driver to provide virtual tap device functionality
3 * on Windows. Originally derived from the CIPE-Win32
4 * project by Damion K. Wilson, with extensive modifications by
5 * James Yonan.
7 * All source code which derives from the CIPE-Win32 project is
8 * Copyright (C) Damion K. Wilson, 2003, and is released under the
9 * GPL version 2 (see below).
11 * All other source code is Copyright (C) 2002-2005 OpenVPN Solutions LLC,
12 * and is released under the GPL version 2 (see below).
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License version 2
16 * as published by the Free Software Foundation.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program (see the file COPYING included with this
25 * distribution); if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 #ifndef TAP_PROTOTYPES_DEFINED
30 #define TAP_PROTOTYPES_DEFINED
32 NTSTATUS DriverEntry
34 IN PDRIVER_OBJECT p_DriverObject,
35 IN PUNICODE_STRING p_RegistryPath
38 VOID TapDriverUnload
40 IN PDRIVER_OBJECT p_DriverObject
43 NDIS_STATUS AdapterCreate
45 OUT PNDIS_STATUS p_ErrorStatus,
46 OUT PUINT p_MediaIndex,
47 IN PNDIS_MEDIUM p_Media,
48 IN UINT p_MediaCount,
49 IN NDIS_HANDLE p_AdapterHandle,
50 IN NDIS_HANDLE p_ConfigurationHandle
53 VOID AdapterHalt
55 IN NDIS_HANDLE p_AdapterContext
58 VOID AdapterFreeResources
60 TapAdapterPointer p_Adapter
63 NDIS_STATUS AdapterReset
65 OUT PBOOLEAN p_AddressingReset,
66 IN NDIS_HANDLE p_AdapterContext
69 NDIS_STATUS AdapterQuery
71 IN NDIS_HANDLE p_AdapterContext,
72 IN NDIS_OID p_OID,
73 IN PVOID p_Buffer,
74 IN ULONG p_BufferLength,
75 OUT PULONG p_BytesWritten,
76 OUT PULONG p_BytesNeeded
79 NDIS_STATUS AdapterModify
81 IN NDIS_HANDLE p_AdapterContext,
82 IN NDIS_OID p_OID,
83 IN PVOID p_Buffer,
84 IN ULONG p_BufferLength,
85 OUT PULONG p_BytesRead,
86 OUT PULONG p_BytesNeeded
89 NDIS_STATUS AdapterTransmit
91 IN NDIS_HANDLE p_AdapterContext,
92 IN PNDIS_PACKET p_Packet,
93 IN UINT p_Flags
96 NDIS_STATUS AdapterReceive
98 OUT PNDIS_PACKET p_Packet,
99 OUT PUINT p_Transferred,
100 IN NDIS_HANDLE p_AdapterContext,
101 IN NDIS_HANDLE p_ReceiveContext,
102 IN UINT p_Offset,
103 IN UINT p_ToTransfer
106 NTSTATUS TapDeviceHook
108 IN PDEVICE_OBJECT p_DeviceObject,
109 IN PIRP p_IRP
112 NDIS_STATUS CreateTapDevice
114 TapExtensionPointer p_Extension,
115 const char *p_Name
118 VOID DestroyTapDevice
120 TapExtensionPointer p_Extension
123 VOID TapDeviceFreeResources
125 TapExtensionPointer p_Extension
128 NTSTATUS CompleteIRP
130 IN PIRP p_IRP,
131 IN TapPacketPointer p_PacketBuffer,
132 IN CCHAR PriorityBoost
135 VOID CancelIRPCallback
137 IN PDEVICE_OBJECT p_DeviceObject,
138 IN PIRP p_IRP
141 VOID CancelIRP
143 TapExtensionPointer p_Extension,
144 IN PIRP p_IRP,
145 BOOLEAN callback
148 VOID FlushQueues
150 TapExtensionPointer p_Extension
153 VOID ResetTapAdapterState
155 TapAdapterPointer p_Adapter
158 BOOLEAN ProcessARP
160 TapAdapterPointer p_Adapter,
161 const PARP_PACKET src,
162 const IPADDR adapter_ip,
163 const IPADDR ip_network,
164 const IPADDR ip_netmask,
165 const MACADDR mac
168 VOID SetMediaStatus
170 TapAdapterPointer p_Adapter,
171 BOOLEAN state
174 VOID InjectPacket
176 TapAdapterPointer p_Adapter,
177 UCHAR *packet,
178 const unsigned int len
181 VOID CheckIfDhcpAndTunMode
183 TapAdapterPointer p_Adapter
186 VOID HookDispatchFunctions();
188 #if ENABLE_NONADMIN
190 typedef struct _SECURITY_DESCRIPTOR {
191 unsigned char opaque[20];
192 } SECURITY_DESCRIPTOR;
194 NTSYSAPI
195 NTSTATUS
196 NTAPI
197 ZwSetSecurityObject (
198 IN HANDLE Handle,
199 IN SECURITY_INFORMATION SecurityInformation,
200 IN PSECURITY_DESCRIPTOR SecurityDescriptor);
202 VOID AllowNonAdmin (TapExtensionPointer p_Extension);
204 #endif
206 #if PACKET_TRUNCATION_CHECK
208 VOID IPv4PacketSizeVerify
210 const UCHAR *data,
211 ULONG length,
212 BOOLEAN tun,
213 const char *prefix,
214 LONG *counter
217 #endif
219 #endif