73 #include <arpa/inet.h> 105 struct NtTuple2IPv4_s *hinput = &input.
u.
tuple2IPv4;
111 (void)fprintf(stderr,
"Failed to open hash reference library\n");
118 hinput->srcIP = htonl(0x0a0a0a0a);
119 hinput->dstIP = htonl(0xc0a80101);
123 (void)fprintf(stderr,
"Cannot calculate hash value\n");
127 (void)printf(
"2-tuple hash of (src = 10.10.10.10, dst = 192.168.1.1):\n" 128 "\tvalue = 0x%x, stream number = %d\n",
132 hinput->srcIP = htonl(0xc0a80101);
133 hinput->dstIP = htonl(0x0a0a0a0a);
137 (void)fprintf(stderr,
"Cannot calculate hash value\n");
141 (void)printf(
"2-tuple hash of (src = 192.168.1.1, dst = 10.10.10.10):\n" 142 "\tvalue = 0x%x, stream number = %d\n",
147 (void)fprintf(stderr,
"Failed to close hash reference library\n");
161 const unsigned char src_ip[16] =
162 { 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
163 0x5a, 0x94, 0x6b, 0xff, 0xfe, 0x6a, 0x09, 0x48 };
164 const unsigned char dst_ip[16] =
165 { 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
166 0x12, 0x34, 0x39, 0x10, 0x12, 0x90, 0x44, 0x01 };
167 struct NtTuple2IPv6_s *hinput = &input.
u.
tuple2IPv6;
173 (void)fprintf(stderr,
"Failed to open hash reference library\n");
180 (void)memcpy(hinput->srcIP, src_ip,
sizeof(src_ip));
181 (void)memcpy(hinput->dstIP, dst_ip,
sizeof(dst_ip));
185 (void)fprintf(stderr,
"Cannot calculate hash value\n");
189 (void)printf(
"2-tuple hash of (src = fe80::5a94:6bff:fe6a:948,\n" 190 "dst = fe80::1234:3910:1290:4401)\n" 191 "\tvalue = 0x%x, stream number = %d\n",
195 (void)memcpy(hinput->srcIP, dst_ip,
sizeof(dst_ip));
196 (void)memcpy(hinput->dstIP, src_ip,
sizeof(src_ip));
200 (void)fprintf(stderr,
"Cannot calculate hash value\n");
205 (void)printf(
"2-tuple hash of (src = fe80::1234:3910:1290:4401,\n" 206 "dst = fe80::5a94:6bff:fe6a:948)\n" 207 "\tvalue = 0x%x, stream number = %d\n",
212 (void)fprintf(stderr,
"Failed to close hash reference library\n");
226 struct NtTuple5IPv4_s *hinput = &input.
u.
tuple5IPv4;
232 (void)fprintf(stderr,
"Failed to open hash reference library\n");
239 hinput->srcIP = htonl(0x0a0a0a0a);
240 hinput->dstIP = htonl(0xc0a80101);
241 hinput->srcPort = htons(14532);
242 hinput->dstPort = htons(80);
243 hinput->protocol = 4;
247 (void)fprintf(stderr,
"Cannot calculate hash value\n");
251 (void)printf(
"5-tuple hash of (src = 10.10.10.10, dst = 192.168.1.1, " 252 "src_port = 14532, dst_port = 80, protocol = 4):\n" 253 "\tvalue = 0x%x, stream number = %d\n",
257 hinput->srcIP = htonl(0xc0a80101);
258 hinput->dstIP = htonl(0x0a0a0a0a);
259 hinput->dstPort = htons(14532);
260 hinput->srcPort = htons(80);
264 (void)fprintf(stderr,
"Cannot calculate hash value\n");
268 (void)printf(
"5-tuple hash of (src = 192.168.1.1, dst = 10.10.10.10, " 269 "src_port = 14532, dst_port = 80, protocol = 4):\n" 270 "\tvalue = 0x%x, stream number = %d\n",
275 (void)fprintf(stderr,
"Failed to close hash reference library\n");
289 const unsigned char src_ip[16] =
290 { 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
291 0x5a, 0x94, 0x6b, 0xff, 0xfe, 0x6a, 0x09, 0x48 };
292 const unsigned char dst_ip[16] =
293 { 0xfe, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
294 0x12, 0x34, 0x39, 0x10, 0x12, 0x90, 0x44, 0x01 };
295 struct NtTuple5IPv6_s *hinput = &input.
u.
tuple5IPv6;
301 (void)fprintf(stderr,
"Failed to open hash reference library\n");
308 assert(
sizeof(hinput->srcIP) >=
sizeof(src_ip));
309 assert(
sizeof(hinput->dstIP) >=
sizeof(dst_ip));
310 (void)memcpy(hinput->srcIP, src_ip,
sizeof(src_ip));
311 (void)memcpy(hinput->dstIP, dst_ip,
sizeof(dst_ip));
312 hinput->srcPort = htons(14532);
313 hinput->dstPort = htons(80);
314 hinput->protocol = 4;
318 (void)fprintf(stderr,
"Cannot calculate hash value\n");
322 (void)printf(
"5-tuple hash of (src = fe80::5a94:6bff:fe6a:948, " 323 "dst = fe80::1234:3910:1290:4401, dst_port = 80, protocol = 4):\n" 324 "\tvalue = 0x%x, stream number = %d\n",
328 (void)memcpy(hinput->srcIP, dst_ip,
sizeof(dst_ip));
329 (void)memcpy(hinput->dstIP, src_ip,
sizeof(src_ip));
330 hinput->dstPort = htons(14532);
331 hinput->srcPort = htons(80);
335 (void)fprintf(stderr,
"Cannot calculate hash value\n");
339 (void)printf(
"5-tuple hash of (src = fe80::1234:3910:1290:4401, " 340 "dst = fe80::5a94:6bff:fe6a:948, dst_port = 80, protocol = 4):\n" 341 "\tvalue = 0x%x, stream number = %d\n",
346 (void)fprintf(stderr,
"Failed to close hash reference library\n");
366 (void)fprintf(stderr,
"Failed to open hash reference library\n");
374 hinput->srcIP = htonl(0x0a0a0a0a);
375 hinput->dstIP = htonl(0xc0a80101);
376 hinput->ipId = htons(0x1234);
377 hinput->ipProt = (uint8_t)1;
381 (void)fprintf(stderr,
"Cannot calculate hash value\n");
385 (void)printf(
"IP fragment hash of (src = 10.10.10.10, dst = 192.168.1.1):\n" 386 "\tvalue = 0x%x, stream number = %d\n",
389 hinput->srcIP = htonl(0xc0a80101);
390 hinput->dstIP = htonl(0x0a0a0a0a);
394 (void)fprintf(stderr,
"Cannot calculate hash value\n");
398 (void)printf(
"IP fragment hash of (src = 192.168.1.1, dst = 10.10.10.10):\n" 399 "\tvalue = 0x%x, stream number = %d\n",
404 (void)fprintf(stderr,
"Failed to close hash reference library\n");