14#ifndef _PACKET_HEADER_H_
15#define _PACKET_HEADER_H_
21#include <sys/socket.h>
22#include <netinet/in.h>
23#include <netinet/tcp.h>
25#define ERROR_INVALID_PARAMETER EINVAL
29#define UINT8 unsigned char
31#define UINT16 unsigned short
33#define UINT32 unsigned int
34#define INT64 long long int
35#define UINT64 unsigned long long int
36#define UINT unsigned int
45#define WINDIVERT_HELPER_NO_IP_CHECKSUM 1
46#define WINDIVERT_HELPER_NO_ICMP_CHECKSUM 2
47#define WINDIVERT_HELPER_NO_ICMPV6_CHECKSUM 4
48#define WINDIVERT_HELPER_NO_TCP_CHECKSUM 8
49#define WINDIVERT_HELPER_NO_UDP_CHECKSUM 16
61 ICMP4_DST_UNREACH = 3,
62 ICMP4_SOURCE_QUENCH = 4,
64 ICMP4_ECHO_REQUEST = 8,
65 ICMP4_ROUTER_ADVERT = 9,
66 ICMP4_ROUTER_SOLICIT = 10,
67 ICMP4_TIME_EXCEEDED = 11,
68 ICMP4_PARAM_PROB = 12,
69 ICMP4_TIMESTAMP_REQUEST = 13,
70 ICMP4_TIMESTAMP_REPLY = 14,
71 ICMP4_MASK_REQUEST = 17,
72 ICMP4_MASK_REPLY = 18,
73} ICMP4_TYPE, *PICMP4_TYPE;
98 UINT8 TrafficClass0:4;
101 UINT8 TrafficClass1:4;
110#define IPV6_HDR_SIZE 40
157BOOL WinDivertHelperParsePacket(PVOID pPacket, UINT packetLen,
158 PWINDIVERT_IPHDR *ppIpHdr, PWINDIVERT_IPV6HDR *ppIpv6Hdr,
159 PWINDIVERT_ICMPHDR *ppIcmpHdr, PWINDIVERT_ICMPV6HDR *ppIcmpv6Hdr,
160 PWINDIVERT_TCPHDR *ppTcpHdr, PWINDIVERT_UDPHDR *ppUdpHdr, PVOID *ppData,
163UINT WinDivertHelperCalcChecksums(PVOID pPacket, UINT packetLen,
165BOOL WinDivertHelperParseIPv4Address(
const char *str, UINT32 *addr_ptr);
166BOOL WinDivertHelperParseIPv6Address(
const char *str, UINT32 *addr_ptr);