7 #define PH_IPV4_NETWORK_TYPE 0x1
8 #define PH_IPV6_NETWORK_TYPE 0x2
9 #define PH_NETWORK_TYPE_MASK 0x3
11 #define PH_TCP_PROTOCOL_TYPE 0x10
12 #define PH_UDP_PROTOCOL_TYPE 0x20
13 #define PH_PROTOCOL_TYPE_MASK 0x30
15 #define PH_NO_NETWORK_PROTOCOL 0x0
16 #define PH_TCP4_NETWORK_PROTOCOL (PH_IPV4_NETWORK_TYPE | PH_TCP_PROTOCOL_TYPE)
17 #define PH_TCP6_NETWORK_PROTOCOL (PH_IPV6_NETWORK_TYPE | PH_TCP_PROTOCOL_TYPE)
18 #define PH_UDP4_NETWORK_PROTOCOL (PH_IPV4_NETWORK_TYPE | PH_UDP_PROTOCOL_TYPE)
19 #define PH_UDP6_NETWORK_PROTOCOL (PH_IPV6_NETWORK_TYPE | PH_UDP_PROTOCOL_TYPE)
34 _In_ PPH_IP_ADDRESS Address1,
35 _In_ PPH_IP_ADDRESS Address2
38 if ((Address1->Type | Address2->Type) == 0)
40 if (Address1->Type != Address2->Type)
45 return Address1->Ipv4 == Address2->Ipv4;
51 *(PULONG64)(Address1->Ipv6) == *(PULONG64)(Address2->Ipv6) &&
52 *(PULONG64)(Address1->Ipv6 + 8) == *(PULONG64)(Address2->Ipv6 + 8);
55 *(PULONG)(Address1->Ipv6) == *(PULONG)(Address2->Ipv6) &&
56 *(PULONG)(Address1->Ipv6 + 4) == *(PULONG)(Address2->Ipv6 + 4) &&
57 *(PULONG)(Address1->Ipv6 + 8) == *(PULONG)(Address2->Ipv6 + 8) &&
58 *(PULONG)(Address1->Ipv6 + 12) == *(PULONG)(Address2->Ipv6 + 12);
64 _In_ PPH_IP_ADDRESS Address
69 if (Address->Type == 0)
72 hash = Address->Type | (Address->Type << 16);
76 hash ^= Address->Ipv4;
80 hash += *(PULONG)(Address->Ipv6);
81 hash ^= *(PULONG)(Address->Ipv6 + 4);
82 hash += *(PULONG)(Address->Ipv6 + 8);
83 hash ^= *(PULONG)(Address->Ipv6 + 12);
90 _In_ PPH_IP_ADDRESS Address
93 if (Address->Type == 0)
99 return Address->Ipv4 == 0;
104 return (*(PULONG64)(Address->Ipv6) | *(PULONG64)(Address->Ipv6 + 8)) == 0;
106 return (*(PULONG)(Address->Ipv6) | *(PULONG)(Address->Ipv6 + 4) |
107 *(PULONG)(Address->Ipv6 + 8) | *(PULONG)(Address->Ipv6 + 12)) == 0;
123 _In_ PPH_IP_ENDPOINT Endpoint1,
124 _In_ PPH_IP_ENDPOINT Endpoint2
129 Endpoint1->Port == Endpoint2->Port;
133 _In_ PPH_IP_ENDPOINT Endpoint