NetSim Source Code Help
Loading...
Searching...
No Matches
windivert.h
Go to the documentation of this file.
1/*
2 * windivert.h
3 * (C) 2019, all rights reserved,
4 *
5 * This file is part of WinDivert.
6 *
7 * WinDivert is free software: you can redistribute it and/or modify it under
8 * the terms of the GNU Lesser General Public License as published by the
9 * Free Software Foundation, either version 3 of the License, or (at your
10 * option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
15 * License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 *
20 * WinDivert is free software; you can redistribute it and/or modify it under
21 * the terms of the GNU General Public License as published by the Free
22 * Software Foundation; either version 2 of the License, or (at your option)
23 * any later version.
24 *
25 * This program is distributed in the hope that it will be useful, but
26 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
27 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
28 * for more details.
29 *
30 * You should have received a copy of the GNU General Public License along
31 * with this program; if not, write to the Free Software Foundation, Inc., 51
32 * Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
33 */
34
35#ifndef __WINDIVERT_H
36#define __WINDIVERT_H
37
38#ifndef WINDIVERT_KERNEL
39#include <windows.h>
40#endif /* WINDIVERT_KERNEL */
41
42#ifndef WINDIVERTEXPORT
43#define WINDIVERTEXPORT __declspec(dllimport)
44#endif /* WINDIVERTEXPORT */
45
46#ifdef __MINGW32__
47#define __in
48#define __in_opt
49#define __out
50#define __out_opt
51#define __inout
52#define __inout_opt
53#include <stdint.h>
54#define INT8 int8_t
55#define UINT8 uint8_t
56#define INT16 int16_t
57#define UINT16 uint16_t
58#define INT32 int32_t
59#define UINT32 uint32_t
60#define INT64 int64_t
61#define UINT64 uint64_t
62#endif /* __MINGW32__ */
63
64#ifdef __cplusplus
65extern "C" {
66#endif
67
68/****************************************************************************/
69/* WINDIVERT API */
70/****************************************************************************/
71
72/*
73 * WinDivert layers.
74 */
75typedef enum
76{
77 WINDIVERT_LAYER_NETWORK = 0, /* Network layer. */
78 WINDIVERT_LAYER_NETWORK_FORWARD = 1,/* Network layer (forwarded packets) */
79 WINDIVERT_LAYER_FLOW = 2, /* Flow layer. */
80 WINDIVERT_LAYER_SOCKET = 3, /* Socket layer. */
81 WINDIVERT_LAYER_REFLECT = 4, /* Reflect layer. */
83
84/*
85 * WinDivert NETWORK and NETWORK_FORWARD layer data.
86 */
87typedef struct
88{
89 UINT32 IfIdx; /* Packet's interface index. */
90 UINT32 SubIfIdx; /* Packet's sub-interface index. */
92
93/*
94 * WinDivert FLOW layer data.
95 */
96typedef struct
97{
98 UINT64 EndpointId; /* Endpoint ID. */
99 UINT64 ParentEndpointId; /* Parent endpoint ID. */
100 UINT32 ProcessId; /* Process ID. */
101 UINT32 LocalAddr[4]; /* Local address. */
102 UINT32 RemoteAddr[4]; /* Remote address. */
103 UINT16 LocalPort; /* Local port. */
104 UINT16 RemotePort; /* Remote port. */
105 UINT8 Protocol; /* Protocol. */
107
108/*
109 * WinDivert SOCKET layer data.
110 */
111typedef struct
112{
113 UINT64 EndpointId; /* Endpoint ID. */
114 UINT64 ParentEndpointId; /* Parent Endpoint ID. */
115 UINT32 ProcessId; /* Process ID. */
116 UINT32 LocalAddr[4]; /* Local address. */
117 UINT32 RemoteAddr[4]; /* Remote address. */
118 UINT16 LocalPort; /* Local port. */
119 UINT16 RemotePort; /* Remote port. */
120 UINT8 Protocol; /* Protocol. */
122
123/*
124 * WinDivert REFLECTION layer data.
125 */
126typedef struct
127{
128 INT64 Timestamp; /* Handle open time. */
129 UINT32 ProcessId; /* Handle process ID. */
130 WINDIVERT_LAYER Layer; /* Handle layer. */
131 UINT64 Flags; /* Handle flags. */
132 INT16 Priority; /* Handle priority. */
134
135/*
136 * WinDivert address.
137 */
138typedef struct
139{
140 INT64 Timestamp; /* Packet's timestamp. */
141 UINT64 Layer:8; /* Packet's layer. */
142 UINT64 Event:8; /* Packet event. */
143 UINT64 Sniffed:1; /* Packet was sniffed? */
144 UINT64 Outbound:1; /* Packet is outound? */
145 UINT64 Loopback:1; /* Packet is loopback? */
146 UINT64 Impostor:1; /* Packet is impostor? */
147 UINT64 IPv6:1; /* Packet is IPv6? */
148 UINT64 IPChecksum:1; /* Packet has valid IPv4 checksum? */
149 UINT64 TCPChecksum:1; /* Packet has valid TCP checksum? */
150 UINT64 UDPChecksum:1; /* Packet has valid UDP checksum? */
152 union
153 {
154 WINDIVERT_DATA_NETWORK Network; /* Network layer data. */
155 WINDIVERT_DATA_FLOW Flow; /* Flow layer data. */
156 WINDIVERT_DATA_SOCKET Socket; /* Socket layer data. */
157 WINDIVERT_DATA_REFLECT Reflect; /* Reflect layer data. */
158 UINT8 Reserved2[64];
159 };
161
162/*
163 * WinDivert events.
164 */
165typedef enum
166{
167 WINDIVERT_EVENT_NETWORK_PACKET = 0, /* Network packet. */
169 /* Flow established. */
170 WINDIVERT_EVENT_FLOW_DELETED = 2, /* Flow deleted. */
171 WINDIVERT_EVENT_SOCKET_BIND = 3, /* Socket bind. */
172 WINDIVERT_EVENT_SOCKET_CONNECT = 4, /* Socket connect. */
173 WINDIVERT_EVENT_SOCKET_LISTEN = 5, /* Socket listen. */
174 WINDIVERT_EVENT_SOCKET_ACCEPT = 6, /* Socket accept. */
175 WINDIVERT_EVENT_SOCKET_CLOSE = 7, /* Socket close. */
176 WINDIVERT_EVENT_REFLECT_OPEN = 8, /* WinDivert handle opened. */
177 WINDIVERT_EVENT_REFLECT_CLOSE = 9, /* WinDivert handle closed. */
179
180/*
181 * WinDivert flags.
182 */
183#define WINDIVERT_FLAG_SNIFF 0x0001
184#define WINDIVERT_FLAG_DROP 0x0002
185#define WINDIVERT_FLAG_RECV_ONLY 0x0004
186#define WINDIVERT_FLAG_READ_ONLY WINDIVERT_FLAG_RECV_ONLY
187#define WINDIVERT_FLAG_SEND_ONLY 0x0008
188#define WINDIVERT_FLAG_WRITE_ONLY WINDIVERT_FLAG_SEND_ONLY
189#define WINDIVERT_FLAG_NO_INSTALL 0x0010
190
191/*
192 * WinDivert parameters.
193 */
194typedef enum
195{
196 WINDIVERT_PARAM_QUEUE_LENGTH = 0, /* Packet queue length. */
197 WINDIVERT_PARAM_QUEUE_TIME = 1, /* Packet queue time. */
198 WINDIVERT_PARAM_QUEUE_SIZE = 2, /* Packet queue size. */
199 WINDIVERT_PARAM_VERSION_MAJOR = 3, /* Driver version (major). */
200 WINDIVERT_PARAM_VERSION_MINOR = 4, /* Driver version (minor). */
202#define WINDIVERT_PARAM_MAX WINDIVERT_PARAM_VERSION_MINOR
203
204/*
205 * WinDivert shutdown parameter.
206 */
207typedef enum
208{
209 WINDIVERT_SHUTDOWN_RECV = 0x1, /* Shutdown recv. */
210 WINDIVERT_SHUTDOWN_SEND = 0x2, /* Shutdown send. */
211 WINDIVERT_SHUTDOWN_BOTH = 0x3, /* Shutdown recv and send. */
213#define WINDIVERT_SHUTDOWN_MAX WINDIVERT_SHUTDOWN_BOTH
214
215#ifndef WINDIVERT_KERNEL
216
217/*
218 * Open a WinDivert handle.
219 */
221 __in const char *filter,
222 __in WINDIVERT_LAYER layer,
223 __in INT16 priority,
224 __in UINT64 flags);
225
226/*
227 * Receive (read) a packet from a WinDivert handle.
228 */
231 __out_opt VOID *pPacket,
232 __in UINT packetLen,
233 __out_opt UINT *pRecvLen,
234 __out_opt WINDIVERT_ADDRESS *pAddr);
235
236/*
237 * Receive (read) a packet from a WinDivert handle.
238 */
241 __out_opt VOID *pPacket,
242 __in UINT packetLen,
243 __out_opt UINT *pRecvLen,
244 __in UINT64 flags,
246 __inout_opt UINT *pAddrLen,
247 __inout_opt LPOVERLAPPED lpOverlapped);
248
249/*
250 * Send (write/inject) a packet to a WinDivert handle.
251 */
254 __in const VOID *pPacket,
255 __in UINT packetLen,
256 __out_opt UINT *pSendLen,
257 __in const WINDIVERT_ADDRESS *pAddr);
258
259/*
260 * Send (write/inject) a packet to a WinDivert handle.
261 */
264 __in const VOID *pPacket,
265 __in UINT packetLen,
266 __out_opt UINT *pSendLen,
267 __in UINT64 flags,
268 __in const WINDIVERT_ADDRESS *pAddr,
269 __in UINT addrLen,
270 __inout_opt LPOVERLAPPED lpOverlapped);
271
272/*
273 * Shutdown a WinDivert handle.
274 */
278
279/*
280 * Close a WinDivert handle.
281 */
284
285/*
286 * Set a WinDivert handle parameter.
287 */
290 __in WINDIVERT_PARAM param,
291 __in UINT64 value);
292
293/*
294 * Get a WinDivert handle parameter.
295 */
298 __in WINDIVERT_PARAM param,
299 __out UINT64 *pValue);
300
301#endif /* WINDIVERT_KERNEL */
302
303/*
304 * WinDivert constants.
305 */
306#define WINDIVERT_PRIORITY_HIGHEST 30000
307#define WINDIVERT_PRIORITY_LOWEST (-WINDIVERT_PRIORITY_HIGHEST)
308#define WINDIVERT_PARAM_QUEUE_LENGTH_DEFAULT 4096
309#define WINDIVERT_PARAM_QUEUE_LENGTH_MIN 32
310#define WINDIVERT_PARAM_QUEUE_LENGTH_MAX 16384
311#define WINDIVERT_PARAM_QUEUE_TIME_DEFAULT 2000 /* 2s */
312#define WINDIVERT_PARAM_QUEUE_TIME_MIN 100 /* 100ms */
313#define WINDIVERT_PARAM_QUEUE_TIME_MAX 16000 /* 16s */
314#define WINDIVERT_PARAM_QUEUE_SIZE_DEFAULT 4194304 /* 4MB */
315#define WINDIVERT_PARAM_QUEUE_SIZE_MIN 65535 /* 64KB */
316#define WINDIVERT_PARAM_QUEUE_SIZE_MAX 33554432 /* 32MB */
317#define WINDIVERT_BATCH_MAX 0xFF /* 255 */
318#define WINDIVERT_MTU_MAX (40 + 0xFFFF)
319
320/****************************************************************************/
321/* WINDIVERT HELPER API */
322/****************************************************************************/
323
324/*
325 * IPv4/IPv6/ICMP/ICMPv6/TCP/UDP header definitions.
326 */
327typedef struct
328{
329 UINT8 HdrLength:4;
330 UINT8 Version:4;
331 UINT8 TOS;
332 UINT16 Length;
333 UINT16 Id;
334 UINT16 FragOff0;
335 UINT8 TTL;
336 UINT8 Protocol;
337 UINT16 Checksum;
338 UINT32 SrcAddr;
339 UINT32 DstAddr;
341
342#define WINDIVERT_IPHDR_GET_FRAGOFF(hdr) \
343 (((hdr)->FragOff0) & 0xFF1F)
344#define WINDIVERT_IPHDR_GET_MF(hdr) \
345 ((((hdr)->FragOff0) & 0x0020) != 0)
346#define WINDIVERT_IPHDR_GET_DF(hdr) \
347 ((((hdr)->FragOff0) & 0x0040) != 0)
348#define WINDIVERT_IPHDR_GET_RESERVED(hdr) \
349 ((((hdr)->FragOff0) & 0x0080) != 0)
350
351#define WINDIVERT_IPHDR_SET_FRAGOFF(hdr, val) \
352 do \
353 { \
354 (hdr)->FragOff0 = (((hdr)->FragOff0) & 0x00E0) | \
355 ((val) & 0xFF1F); \
356 } \
357 while (FALSE)
358#define WINDIVERT_IPHDR_SET_MF(hdr, val) \
359 do \
360 { \
361 (hdr)->FragOff0 = (((hdr)->FragOff0) & 0xFFDF) | \
362 (((val) & 0x0001) << 5); \
363 } \
364 while (FALSE)
365#define WINDIVERT_IPHDR_SET_DF(hdr, val) \
366 do \
367 { \
368 (hdr)->FragOff0 = (((hdr)->FragOff0) & 0xFFBF) | \
369 (((val) & 0x0001) << 6); \
370 } \
371 while (FALSE)
372#define WINDIVERT_IPHDR_SET_RESERVED(hdr, val) \
373 do \
374 { \
375 (hdr)->FragOff0 = (((hdr)->FragOff0) & 0xFF7F) | \
376 (((val) & 0x0001) << 7); \
377 } \
378 while (FALSE)
379
380typedef struct
381{
382 UINT8 TrafficClass0:4;
383 UINT8 Version:4;
384 UINT8 FlowLabel0:4;
385 UINT8 TrafficClass1:4;
386 UINT16 FlowLabel1;
387 UINT16 Length;
388 UINT8 NextHdr;
389 UINT8 HopLimit;
390 UINT32 SrcAddr[4];
391 UINT32 DstAddr[4];
393
394#define WINDIVERT_IPV6HDR_GET_TRAFFICCLASS(hdr) \
395 ((((hdr)->TrafficClass0) << 4) | ((hdr)->TrafficClass1))
396#define WINDIVERT_IPV6HDR_GET_FLOWLABEL(hdr) \
397 ((((UINT32)(hdr)->FlowLabel0) << 16) | ((UINT32)(hdr)->FlowLabel1))
398
399#define WINDIVERT_IPV6HDR_SET_TRAFFICCLASS(hdr, val) \
400 do \
401 { \
402 (hdr)->TrafficClass0 = ((UINT8)(val) >> 4); \
403 (hdr)->TrafficClass1 = (UINT8)(val); \
404 } \
405 while (FALSE)
406#define WINDIVERT_IPV6HDR_SET_FLOWLABEL(hdr, val) \
407 do \
408 { \
409 (hdr)->FlowLabel0 = (UINT8)((val) >> 16); \
410 (hdr)->FlowLabel1 = (UINT16)(val); \
411 } \
412 while (FALSE)
413
414typedef struct
415{
416 UINT8 Type;
417 UINT8 Code;
418 UINT16 Checksum;
419 UINT32 Body;
421
422typedef struct
423{
424 UINT8 Type;
425 UINT8 Code;
426 UINT16 Checksum;
427 UINT32 Body;
429
430typedef struct
431{
432 UINT16 SrcPort;
433 UINT16 DstPort;
434 UINT32 SeqNum;
435 UINT32 AckNum;
436 UINT16 Reserved1:4;
437 UINT16 HdrLength:4;
438 UINT16 Fin:1;
439 UINT16 Syn:1;
440 UINT16 Rst:1;
441 UINT16 Psh:1;
442 UINT16 Ack:1;
443 UINT16 Urg:1;
444 UINT16 Reserved2:2;
445 UINT16 Window;
446 UINT16 Checksum;
447 UINT16 UrgPtr;
449
450typedef struct
451{
452 UINT16 SrcPort;
453 UINT16 DstPort;
454 UINT16 Length;
455 UINT16 Checksum;
457
458/*
459 * Flags for WinDivertHelperCalcChecksums()
460 */
461#define WINDIVERT_HELPER_NO_IP_CHECKSUM 1
462#define WINDIVERT_HELPER_NO_ICMP_CHECKSUM 2
463#define WINDIVERT_HELPER_NO_ICMPV6_CHECKSUM 4
464#define WINDIVERT_HELPER_NO_TCP_CHECKSUM 8
465#define WINDIVERT_HELPER_NO_UDP_CHECKSUM 16
466
467#ifndef WINDIVERT_KERNEL
468
469/*
470 * Hash a packet.
471 */
473 __in const VOID *pPacket,
474 __in UINT packetLen,
475 __in UINT64 seed
476#ifdef __cplusplus
477 = 0
478#endif
479);
480
481/*
482 * Parse IPv4/IPv6/ICMP/ICMPv6/TCP/UDP headers from a raw packet.
483 */
485 __in const VOID *pPacket,
486 __in UINT packetLen,
487 __out_opt PWINDIVERT_IPHDR *ppIpHdr,
488 __out_opt PWINDIVERT_IPV6HDR *ppIpv6Hdr,
489 __out_opt UINT8 *pProtocol,
490 __out_opt PWINDIVERT_ICMPHDR *ppIcmpHdr,
491 __out_opt PWINDIVERT_ICMPV6HDR *ppIcmpv6Hdr,
492 __out_opt PWINDIVERT_TCPHDR *ppTcpHdr,
493 __out_opt PWINDIVERT_UDPHDR *ppUdpHdr,
494 __out_opt PVOID *ppData,
495 __out_opt UINT *pDataLen,
496 __out_opt PVOID *ppNext,
497 __out_opt UINT *pNextLen);
498
499/*
500 * Parse an IPv4 address.
501 */
503 __in const char *addrStr,
504 __out_opt UINT32 *pAddr);
505
506/*
507 * Parse an IPv6 address.
508 */
510 __in const char *addrStr,
511 __out_opt UINT32 *pAddr);
512
513/*
514 * Format an IPv4 address.
515 */
517 __in UINT32 addr,
518 __out char *buffer,
519 __in UINT bufLen);
520
521/*
522 * Format an IPv6 address.
523 */
525 __in const UINT32 *pAddr,
526 __out char *buffer,
527 __in UINT bufLen);
528
529/*
530 * Calculate IPv4/IPv6/ICMP/ICMPv6/TCP/UDP checksums.
531 */
533 __inout VOID *pPacket,
534 __in UINT packetLen,
535 __out_opt WINDIVERT_ADDRESS *pAddr,
536 __in UINT64 flags);
537
538/*
539 * Decrement the TTL/HopLimit.
540 */
542 __inout VOID *pPacket,
543 __in UINT packetLen);
544
545/*
546 * Compile the given filter string.
547 */
549 __in const char *filter,
550 __in WINDIVERT_LAYER layer,
551 __out_opt char *object,
552 __in UINT objLen,
553 __out_opt const char **errorStr,
554 __out_opt UINT *errorPos);
555
556/*
557 * Evaluate the given filter string.
558 */
560 __in const char *filter,
561 __in const VOID *pPacket,
562 __in UINT packetLen,
563 __in const WINDIVERT_ADDRESS *pAddr);
564
565/*
566 * Format the given filter string.
567 */
569 __in const char *filter,
570 __in WINDIVERT_LAYER layer,
571 __out char *buffer,
572 __in UINT bufLen);
573
574/*
575 * Byte ordering.
576 */
578 __in UINT16 x);
580 __in UINT16 x);
582 __in UINT32 x);
584 __in UINT32 x);
586 __in UINT64 x);
588 __in UINT64 x);
590 __in const UINT *inAddr,
591 __out UINT *outAddr);
593 __in const UINT *inAddr,
594 __out UINT *outAddr);
595
596#endif /* WINDIVERT_KERNEL */
597
598#ifdef __cplusplus
599}
600#endif
601
602#endif /* __WINDIVERT_H */
static ANIM_HANDLE handle
Definition: BatteryModel.c:197
#define PVOID
Definition: Linux.h:46
#define UINT64
Definition: Linux.h:37
BOOL
Definition: Linux.h:62
#define __in
Definition: Linux.h:113
#define UINT
Definition: Linux.h:38
#define UINT32
Definition: Linux.h:35
#define INT64
Definition: Linux.h:36
#define UINT16
Definition: Linux.h:33
#define HANDLE
Definition: Linux.h:73
#define __out
Definition: Linux.h:114
#define INT16
Definition: Linux.h:32
#define UINT8
Definition: Linux.h:31
UINT64 TCPChecksum
Definition: windivert.h:149
UINT64 UDPChecksum
Definition: windivert.h:150
WINDIVERT_DATA_NETWORK Network
Definition: windivert.h:154
WINDIVERT_DATA_REFLECT Reflect
Definition: windivert.h:157
WINDIVERT_DATA_FLOW Flow
Definition: windivert.h:155
WINDIVERT_DATA_SOCKET Socket
Definition: windivert.h:156
UINT64 ParentEndpointId
Definition: windivert.h:99
WINDIVERT_LAYER Layer
Definition: windivert.h:130
struct WINDIVERT_ADDRESS * PWINDIVERT_ADDRESS
WINDIVERTEXPORT BOOL WinDivertHelperParsePacket(__in const VOID *pPacket, __in UINT packetLen, __out_opt PWINDIVERT_IPHDR *ppIpHdr, __out_opt PWINDIVERT_IPV6HDR *ppIpv6Hdr, __out_opt UINT8 *pProtocol, __out_opt PWINDIVERT_ICMPHDR *ppIcmpHdr, __out_opt PWINDIVERT_ICMPV6HDR *ppIcmpv6Hdr, __out_opt PWINDIVERT_TCPHDR *ppTcpHdr, __out_opt PWINDIVERT_UDPHDR *ppUdpHdr, __out_opt PVOID *ppData, __out_opt UINT *pDataLen, __out_opt PVOID *ppNext, __out_opt UINT *pNextLen)
WINDIVERTEXPORT void WinDivertHelperHtonIpv6Address(__in const UINT *inAddr, __out UINT *outAddr)
struct WINDIVERT_TCPHDR * PWINDIVERT_TCPHDR
WINDIVERTEXPORT BOOL WinDivertGetParam(__in HANDLE handle, __in WINDIVERT_PARAM param, __out UINT64 *pValue)
WINDIVERTEXPORT BOOL WinDivertHelperCompileFilter(__in const char *filter, __in WINDIVERT_LAYER layer, __out_opt char *object, __in UINT objLen, __out_opt const char **errorStr, __out_opt UINT *errorPos)
WINDIVERTEXPORT BOOL WinDivertRecvEx(__in HANDLE handle, __out_opt VOID *pPacket, __in UINT packetLen, __out_opt UINT *pRecvLen, __in UINT64 flags, __out WINDIVERT_ADDRESS *pAddr, __inout_opt UINT *pAddrLen, __inout_opt LPOVERLAPPED lpOverlapped)
WINDIVERTEXPORT void WinDivertHelperNtohIpv6Address(__in const UINT *inAddr, __out UINT *outAddr)
WINDIVERTEXPORT BOOL WinDivertClose(__in HANDLE handle)
WINDIVERTEXPORT BOOL WinDivertSend(__in HANDLE handle, __in const VOID *pPacket, __in UINT packetLen, __out_opt UINT *pSendLen, __in const WINDIVERT_ADDRESS *pAddr)
WINDIVERTEXPORT BOOL WinDivertHelperParseIPv6Address(__in const char *addrStr, __out_opt UINT32 *pAddr)
WINDIVERTEXPORT BOOL WinDivertHelperDecrementTTL(__inout VOID *pPacket, __in UINT packetLen)
enum WINDIVERT_SHUTDOWN * PWINDIVERT_SHUTDOWN
WINDIVERTEXPORT UINT64 WinDivertHelperHtonll(__in UINT64 x)
WINDIVERTEXPORT BOOL WinDivertHelperCalcChecksums(__inout VOID *pPacket, __in UINT packetLen, __out_opt WINDIVERT_ADDRESS *pAddr, __in UINT64 flags)
WINDIVERTEXPORT BOOL WinDivertHelperParseIPv4Address(__in const char *addrStr, __out_opt UINT32 *pAddr)
WINDIVERTEXPORT UINT16 WinDivertHelperHtons(__in UINT16 x)
struct WINDIVERT_ICMPV6HDR * PWINDIVERT_ICMPV6HDR
WINDIVERTEXPORT BOOL WinDivertHelperFormatFilter(__in const char *filter, __in WINDIVERT_LAYER layer, __out char *buffer, __in UINT bufLen)
struct WINDIVERT_UDPHDR * PWINDIVERT_UDPHDR
WINDIVERTEXPORT UINT16 WinDivertHelperNtohs(__in UINT16 x)
WINDIVERTEXPORT BOOL WinDivertSendEx(__in HANDLE handle, __in const VOID *pPacket, __in UINT packetLen, __out_opt UINT *pSendLen, __in UINT64 flags, __in const WINDIVERT_ADDRESS *pAddr, __in UINT addrLen, __inout_opt LPOVERLAPPED lpOverlapped)
struct WINDIVERT_DATA_SOCKET * PWINDIVERT_DATA_SOCKET
struct WINDIVERT_DATA_REFLECT * PWINDIVERT_DATA_REFLECT
enum WINDIVERT_PARAM * PWINDIVERT_PARAM
WINDIVERTEXPORT BOOL WinDivertSetParam(__in HANDLE handle, __in WINDIVERT_PARAM param, __in UINT64 value)
enum WINDIVERT_EVENT * PWINDIVERT_EVENT
WINDIVERT_LAYER
Definition: windivert.h:76
@ WINDIVERT_LAYER_SOCKET
Definition: windivert.h:80
@ WINDIVERT_LAYER_NETWORK
Definition: windivert.h:77
@ WINDIVERT_LAYER_NETWORK_FORWARD
Definition: windivert.h:78
@ WINDIVERT_LAYER_FLOW
Definition: windivert.h:79
@ WINDIVERT_LAYER_REFLECT
Definition: windivert.h:81
struct WINDIVERT_DATA_FLOW * PWINDIVERT_DATA_FLOW
struct WINDIVERT_IPV6HDR * PWINDIVERT_IPV6HDR
#define WINDIVERTEXPORT
Definition: windivert.h:43
WINDIVERTEXPORT BOOL WinDivertHelperEvalFilter(__in const char *filter, __in const VOID *pPacket, __in UINT packetLen, __in const WINDIVERT_ADDRESS *pAddr)
enum WINDIVERT_LAYER * PWINDIVERT_LAYER
WINDIVERT_EVENT
Definition: windivert.h:166
@ WINDIVERT_EVENT_SOCKET_CLOSE
Definition: windivert.h:175
@ WINDIVERT_EVENT_FLOW_DELETED
Definition: windivert.h:170
@ WINDIVERT_EVENT_REFLECT_OPEN
Definition: windivert.h:176
@ WINDIVERT_EVENT_FLOW_ESTABLISHED
Definition: windivert.h:168
@ WINDIVERT_EVENT_NETWORK_PACKET
Definition: windivert.h:167
@ WINDIVERT_EVENT_SOCKET_BIND
Definition: windivert.h:171
@ WINDIVERT_EVENT_REFLECT_CLOSE
Definition: windivert.h:177
@ WINDIVERT_EVENT_SOCKET_LISTEN
Definition: windivert.h:173
@ WINDIVERT_EVENT_SOCKET_CONNECT
Definition: windivert.h:172
@ WINDIVERT_EVENT_SOCKET_ACCEPT
Definition: windivert.h:174
WINDIVERT_SHUTDOWN
Definition: windivert.h:208
@ WINDIVERT_SHUTDOWN_SEND
Definition: windivert.h:210
@ WINDIVERT_SHUTDOWN_RECV
Definition: windivert.h:209
@ WINDIVERT_SHUTDOWN_BOTH
Definition: windivert.h:211
WINDIVERTEXPORT UINT32 WinDivertHelperNtohl(__in UINT32 x)
struct WINDIVERT_DATA_NETWORK * PWINDIVERT_DATA_NETWORK
WINDIVERTEXPORT BOOL WinDivertShutdown(__in HANDLE handle, __in WINDIVERT_SHUTDOWN how)
WINDIVERTEXPORT BOOL WinDivertHelperFormatIPv6Address(__in const UINT32 *pAddr, __out char *buffer, __in UINT bufLen)
WINDIVERTEXPORT BOOL WinDivertHelperFormatIPv4Address(__in UINT32 addr, __out char *buffer, __in UINT bufLen)
struct WINDIVERT_IPHDR * PWINDIVERT_IPHDR
struct WINDIVERT_ICMPHDR * PWINDIVERT_ICMPHDR
WINDIVERTEXPORT BOOL WinDivertRecv(__in HANDLE handle, __out_opt VOID *pPacket, __in UINT packetLen, __out_opt UINT *pRecvLen, __out_opt WINDIVERT_ADDRESS *pAddr)
WINDIVERTEXPORT UINT32 WinDivertHelperHtonl(__in UINT32 x)
WINDIVERTEXPORT UINT64 WinDivertHelperNtohll(__in UINT64 x)
WINDIVERT_PARAM
Definition: windivert.h:195
@ WINDIVERT_PARAM_QUEUE_SIZE
Definition: windivert.h:198
@ WINDIVERT_PARAM_QUEUE_TIME
Definition: windivert.h:197
@ WINDIVERT_PARAM_VERSION_MINOR
Definition: windivert.h:200
@ WINDIVERT_PARAM_VERSION_MAJOR
Definition: windivert.h:199
@ WINDIVERT_PARAM_QUEUE_LENGTH
Definition: windivert.h:196
WINDIVERTEXPORT HANDLE WinDivertOpen(__in const char *filter, __in WINDIVERT_LAYER layer, __in INT16 priority, __in UINT64 flags)
WINDIVERTEXPORT UINT64 WinDivertHelperHashPacket(__in const VOID *pPacket, __in UINT packetLen, __in UINT64 seed)