72 #include <arpa/inet.h> 104 struct NtTuple2IPv4_s *hinput = &input.
u.
tuple2IPv4;
110 (void)fprintf(stderr,
"Failed to open hash reference library\n");
117 hinput->srcIP = htonl(0x0a0a0a0a);
118 hinput->dstIP = htonl(0xc0a80101);
122 (void)fprintf(stderr,
"Cannot calculate hash value\n");
126 (void)printf(
"2-tuple hash of (src = 10.10.10.10, dst = 192.168.1.1):\n" 127 "\tvalue = 0x%x, stream number = %d\n",
131 hinput->srcIP = htonl(0xc0a80101);
132 hinput->dstIP = htonl(0x0a0a0a0a);
136 (void)fprintf(stderr,
"Cannot calculate hash value\n");
140 (void)printf(
"2-tuple hash of (src = 192.168.1.1, dst = 10.10.10.10):\n" 141 "\tvalue = 0x%x, stream number = %d\n",
146 (void)fprintf(stderr,
"Failed to close hash reference library\n");
160 const unsigned char src_ip[16] =
161 { 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
162 0x5a, 0x94, 0x6b, 0xff, 0xfe, 0x6a, 0x09, 0x48 };
163 const unsigned char dst_ip[16] =
164 { 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
165 0x12, 0x34, 0x39, 0x10, 0x12, 0x90, 0x44, 0x01 };
166 struct NtTuple2IPv6_s *hinput = &input.
u.
tuple2IPv6;
172 (void)fprintf(stderr,
"Failed to open hash reference library\n");
179 (void)memcpy(hinput->srcIP, src_ip,
sizeof(src_ip));
180 (void)memcpy(hinput->dstIP, dst_ip,
sizeof(dst_ip));
184 (void)fprintf(stderr,
"Cannot calculate hash value\n");
188 (void)printf(
"2-tuple hash of (src = fe80::5a94:6bff:fe6a:948,\n" 189 "dst = fe80::1234:3910:1290:4401)\n" 190 "\tvalue = 0x%x, stream number = %d\n",
194 (void)memcpy(hinput->srcIP, dst_ip,
sizeof(dst_ip));
195 (void)memcpy(hinput->dstIP, src_ip,
sizeof(src_ip));
199 (void)fprintf(stderr,
"Cannot calculate hash value\n");
204 (void)printf(
"2-tuple hash of (src = fe80::1234:3910:1290:4401,\n" 205 "dst = fe80::5a94:6bff:fe6a:948)\n" 206 "\tvalue = 0x%x, stream number = %d\n",
211 (void)fprintf(stderr,
"Failed to close hash reference library\n");
225 struct NtTuple5IPv4_s *hinput = &input.
u.
tuple5IPv4;
231 (void)fprintf(stderr,
"Failed to open hash reference library\n");
238 hinput->srcIP = htonl(0x0a0a0a0a);
239 hinput->dstIP = htonl(0xc0a80101);
240 hinput->srcPort = htons(14532);
241 hinput->dstPort = htons(80);
242 hinput->protocol = 4;
246 (void)fprintf(stderr,
"Cannot calculate hash value\n");
250 (void)printf(
"5-tuple hash of (src = 10.10.10.10, dst = 192.168.1.1, " 251 "src_port = 14532, dst_port = 80, protocol = 4):\n" 252 "\tvalue = 0x%x, stream number = %d\n",
256 hinput->srcIP = htonl(0xc0a80101);
257 hinput->dstIP = htonl(0x0a0a0a0a);
258 hinput->dstPort = htons(14532);
259 hinput->srcPort = htons(80);
263 (void)fprintf(stderr,
"Cannot calculate hash value\n");
267 (void)printf(
"5-tuple hash of (src = 192.168.1.1, dst = 10.10.10.10, " 268 "src_port = 14532, dst_port = 80, protocol = 4):\n" 269 "\tvalue = 0x%x, stream number = %d\n",
274 (void)fprintf(stderr,
"Failed to close hash reference library\n");
288 const unsigned char src_ip[16] =
289 { 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
290 0x5a, 0x94, 0x6b, 0xff, 0xfe, 0x6a, 0x09, 0x48 };
291 const unsigned char dst_ip[16] =
292 { 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
293 0x12, 0x34, 0x39, 0x10, 0x12, 0x90, 0x44, 0x01 };
294 struct NtTuple5IPv6_s *hinput = &input.
u.
tuple5IPv6;
300 (void)fprintf(stderr,
"Failed to open hash reference library\n");
307 assert(
sizeof(hinput->srcIP) >=
sizeof(src_ip));
308 assert(
sizeof(hinput->dstIP) >=
sizeof(dst_ip));
309 (void)memcpy(hinput->srcIP, src_ip,
sizeof(src_ip));
310 (void)memcpy(hinput->dstIP, dst_ip,
sizeof(dst_ip));
311 hinput->srcPort = htons(14532);
312 hinput->dstPort = htons(80);
313 hinput->protocol = 4;
317 (void)fprintf(stderr,
"Cannot calculate hash value\n");
321 (void)printf(
"5-tuple hash of (src = fe80::5a94:6bff:fe6a:948, " 322 "dst = fe80::1234:3910:1290:4401, dst_port = 80, protocol = 4):\n" 323 "\tvalue = 0x%x, stream number = %d\n",
327 (void)memcpy(hinput->srcIP, dst_ip,
sizeof(dst_ip));
328 (void)memcpy(hinput->dstIP, src_ip,
sizeof(src_ip));
329 hinput->dstPort = htons(14532);
330 hinput->srcPort = htons(80);
334 (void)fprintf(stderr,
"Cannot calculate hash value\n");
338 (void)printf(
"5-tuple hash of (src = fe80::1234:3910:1290:4401, " 339 "dst = fe80::5a94:6bff:fe6a:948, dst_port = 80, protocol = 4):\n" 340 "\tvalue = 0x%x, stream number = %d\n",
345 (void)fprintf(stderr,
"Failed to close hash reference library\n");
365 (void)fprintf(stderr,
"Failed to open hash reference library\n");
373 hinput->srcIP = htonl(0x0a0a0a0a);
374 hinput->dstIP = htonl(0xc0a80101);
375 hinput->ipId = htons(0x1234);
376 hinput->ipProt = (uint8_t)1;
380 (void)fprintf(stderr,
"Cannot calculate hash value\n");
384 (void)printf(
"IP fragment hash of (src = 10.10.10.10, dst = 192.168.1.1):\n" 385 "\tvalue = 0x%x, stream number = %d\n",
388 hinput->srcIP = htonl(0xc0a80101);
389 hinput->dstIP = htonl(0x0a0a0a0a);
393 (void)fprintf(stderr,
"Cannot calculate hash value\n");
397 (void)printf(
"IP fragment hash of (src = 192.168.1.1, dst = 10.10.10.10):\n" 398 "\tvalue = 0x%x, stream number = %d\n",
403 (void)fprintf(stderr,
"Failed to close hash reference library\n");