Bug #1443 » util-radix-tree.c.patch
util-radix-tree.c 2015-01-29 09:23:47.584924110 -0800 | ||
---|---|---|
tree = SCRadixCreateRadixTree(free, NULL);
|
||
/* add the keys */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.1", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.2", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.167.1.3", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.167.1.4", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
... | ... | |
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
/* test for the existance of a key */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.6", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
/* test for the existance of a key */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.167.1.4", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL);
|
||
/* continue adding keys */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "220.168.1.2", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.5", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.18", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
/* test the existence of keys */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.3", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "127.234.2.62", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.1", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.5", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.2", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.167.1.3", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.167.1.4", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "220.168.1.2", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.18", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL);
|
||
... | ... | |
tree = SCRadixCreateRadixTree(free, NULL);
|
||
/* add the keys */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.1", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.2", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.167.1.3", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.167.1.4", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "220.168.1.2", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.5", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.18", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
/* remove the keys from the tree */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.1", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixRemoveKeyIPV4((uint8_t *)&servaddr.sin_addr, tree);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.167.1.3", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixRemoveKeyIPV4((uint8_t *)&servaddr.sin_addr, tree);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.167.1.4", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixRemoveKeyIPV4((uint8_t *)&servaddr.sin_addr, tree);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.18", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixRemoveKeyIPV4((uint8_t *)&servaddr.sin_addr, tree);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.167.1.1", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.2", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.167.1.3", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixRemoveKeyIPV4((uint8_t *)&servaddr.sin_addr, tree);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "220.168.1.2", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixRemoveKeyIPV4((uint8_t *)&servaddr.sin_addr, tree);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.5", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.2", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.2", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixRemoveKeyIPV4((uint8_t *)&servaddr.sin_addr, tree);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.5", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixRemoveKeyIPV4((uint8_t *)&servaddr.sin_addr, tree);
|
||
... | ... | |
tree = SCRadixCreateRadixTree(free, NULL);
|
||
/* add the keys */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2003:0BF1:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "BD15:9791:5346:6223:AADB:8713:9882:2432",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "1111:A21B:6221:BDEA:BBBA::DBAA:9861",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "4444:0BF7:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
... | ... | |
/* Try to add the prefix that already exists in the tree */
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "5555:0BF1:ABCD:ADEA:7922:ABCD:9124:2375",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "DBCA:ABCD:ABCD:DBCA:1245:2342:1111:2212",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2003:0BF1:5346:1251:7422:1112:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
/* test the existence of keys */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2003:0BF1:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "BD15:9791:5346:6223:AADB:8713:9882:2432",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "1111:A21B:6221:BDEA:BBBA::DBAA:9861",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "4444:0BF7:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "DBCA:ABC2:ABCD:DBCA:1245:2342:1111:2212",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2003:0BF5:5346:1251:7422:1112:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "5555:0BF1:ABCD:ADEA:7922:ABCD:9124:2375",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "DBCA:ABCD:ABCD:DBCA:1245:2342:1111:2212",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2003:0BF1:5346:1251:7422:1112:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
... | ... | |
tree = SCRadixCreateRadixTree(free, NULL);
|
||
/* add the keys */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2003:0BF1:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "BD15:9791:5346:6223:AADB:8713:9882:2432",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "1111:A21B:6221:BDEA:BBBA::DBAA:9861",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "4444:0BF7:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
... | ... | |
/* Try to add the prefix that already exists in the tree */
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "5555:0BF1:ABCD:ADEA:7922:ABCD:9124:2375",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "DBCA:ABCD:ABCD:DBCA:1245:2342:1111:2212",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2003:0BF1:5346:1251:7422:1112:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
/* test the existence of keys */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2003:0BF1:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "8888:0BF1:5346:BDEA:6422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2006:0BF1:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2003:0BF1:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "BD15:9791:5346:6223:AADB:8713:9882:2432",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
/* test for existance */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "1111:A21B:6221:BDEA:BBBA::DBAA:9861",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "4444:0BF7:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "5555:0BF1:ABCD:ADEA:7922:ABCD:9124:2375",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "DBCA:ABCD:ABCD:DBCA:1245:2342:1111:2212",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2003:0BF1:5346:1251:7422:1112:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2003:0BF1:5346:BDEA:7422:8713:DDDD:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) == NULL);
|
||
/* remove keys */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2003:0BF1:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixRemoveKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "BD15:9791:5346:6223:AADB:8713:9882:2432",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixRemoveKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree);
|
||
/* test for existance */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2003:0BF1:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "BD15:9791:5346:6223:AADB:8713:9882:2432",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "1111:A21B:6221:BDEA:BBBA::DBAA:9861",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "4444:0BF7:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "5555:0BF1:ABCD:ADEA:7922:ABCD:9124:2375",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "DBCA:ABCD:ABCD:DBCA:1245:2342:1111:2212",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
/* remove keys */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "1111:A21B:6221:BDEA:BBBA::DBAA:9861",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixRemoveKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "4444:0BF7:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixRemoveKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "5555:0BF1:ABCD:ADEA:7922:ABCD:9124:2375",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixRemoveKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "DBCA:ABCD:ABCD:DBCA:1245:2342:1111:2212",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixRemoveKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree);
|
||
/* test for existance */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2003:0BF1:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "BD15:9791:5346:6223:AADB:8713:9882:2432",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "1111:A21B:6221:BDEA:BBBA::DBAA:9861",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "4444:0BF7:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "5555:0BF1:ABCD:ADEA:7922:ABCD:9124:2375",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "DBCA:ABCD:ABCD:DBCA:1245:2342:1111:2212",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
... | ... | |
tree = SCRadixCreateRadixTree(free, NULL);
|
||
/* add the keys */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.1", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.2", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.167.1.3", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.167.1.4", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "220.168.1.2", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.5", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.18", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.0.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 16);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 24);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.192.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 18);
|
||
... | ... | |
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 16);
|
||
/* test for the existance of a key */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.6", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.170.1.6", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.145", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.64.6", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.191.6", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.224.6", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.174.224.6", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.175.224.6", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL);
|
||
... | ... | |
tree = SCRadixCreateRadixTree(free, NULL);
|
||
/* add the keys */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "253.192.0.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 16);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "253.192.235.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 24);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.167.0.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 16);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.167.1.4", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "220.168.0.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 16);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "253.224.1.5", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.0.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 16);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
node[0] = SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL,
|
||
24);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.45", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
node[1] = SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.0.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 18);
|
||
... | ... | |
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 16);
|
||
/* test for the existance of a key */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.53", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == node[0]);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.45", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == node[1]);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.45", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == node[1]);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.78", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == node[0]);
|
||
/* let us remove a netblock */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixRemoveKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, 24);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.78", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.127.78", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
... | ... | |
tree = SCRadixCreateRadixTree(free, NULL);
|
||
/* add the keys */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "253.192.0.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 16);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "253.192.235.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 24);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.167.0.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 16);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.167.1.4", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "220.168.0.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 16);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "253.224.1.5", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.0.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 16);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 24);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.45", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.0.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 18);
|
||
... | ... | |
node = SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 0);
|
||
/* test for the existance of a key */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.53", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.45", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.78", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.127.78", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == node);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "1.1.1.1", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == node);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.255.254.25", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == node);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "169.255.254.25", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == node);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "0.0.0.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == node);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "253.224.1.5", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL &&
|
||
SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != node);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "245.63.62.121", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL &&
|
||
SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == node);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "253.224.1.6", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL &&
|
||
SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == node);
|
||
/* remove node 0.0.0.0 */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "0.0.0.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixRemoveKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, 0);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "253.224.1.6", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.127.78", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "1.1.1.1", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.255.254.25", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "169.255.254.25", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "0.0.0.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
... | ... | |
tree = SCRadixCreateRadixTree(free, NULL);
|
||
/* add the keys */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "253.192.0.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 16);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "253.192.235.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 24);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.167.0.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 16);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.167.1.4", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "220.168.0.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 16);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "253.224.1.5", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.0.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 16);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
node[0] = SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 24);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.45", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
node[1] = SCRadixAddKeyIPV4((uint8_t *)&servaddr.sin_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.0.0", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 18);
|
||
... | ... | |
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, NULL, 32);
|
||
/* test for the existance of a key */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.53", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == node[0]);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.53", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.45", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == node[1]);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.45", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == node[1]);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.45", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == node[1]);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.128.78", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4BestMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == node[0]);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.171.127.78", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "225.175.21.228", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "225.175.21.224", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "225.175.21.229", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "225.175.21.230", &servaddr.sin_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV4ExactMatch((uint8_t *)&servaddr.sin_addr, tree, NULL) == NULL);
|
||
... | ... | |
tree = SCRadixCreateRadixTree(free, NULL);
|
||
/* add the keys */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2003:0BF1:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "BD15:9791:5346:6223:AADB:8713:9882:2432",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "1111:A21B:6221:BDEA:BBBA::DBAA:9861",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "4444:0BF7:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "5555:0BF1:ABCD:ADEA:7922:ABCD:9124:2375",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "DBCA:ABCD:ABCD:DB00:0000:0000:0000:0000",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6Netblock((uint8_t *)&servaddr.sin6_addr, tree, NULL, 56);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "DBCA:ABCD:ABCD:DBAA:1245:2342:1145:6241",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
/* test the existence of keys */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2003:0BF1:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "BD15:9791:5346:6223:AADB:8713:9882:2432",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "1111:A21B:6221:BDEA:BBBA::DBAA:9861",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "1111:A21B:6221:BDEA:BBBA::DBAA:9861",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6BestMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "4444:0BF7:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "DBCA:ABC2:ABCD:DBCA:1245:2342:1111:2212",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2003:0BF5:5346:1251:7422:1112:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "5555:0BF1:ABCD:ADEA:7922:ABCD:9124:2375",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "DBCA:ABCD:ABCD:DBCA:1245:2342:1111:2212",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6BestMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "DBCA:ABCD:ABCD:DBAA:1245:2342:1146:6241",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6BestMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "DBCA:ABCD:ABCD:DBAA:1245:2342:1356:1241",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6BestMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "DBCA:ABCD:ABCD:DAAA:1245:2342:1146:6241",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
... | ... | |
tree = SCRadixCreateRadixTree(free, NULL);
|
||
/* add the keys */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2003:0BF1:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "BD15:9791:5346:6223:AADB:8713:9882:2432",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "1111:A21B:6221:BDEA:BBBA::DBAA:9861",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "4444:0BF7:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "5555:0BF1:ABCD:ADEA:7922:ABCD:9124:2375",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "DBCA:ABCD:ABCD:DB00:0000:0000:0000:0000",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6Netblock((uint8_t *)&servaddr.sin6_addr, tree, NULL, 56);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "DBCA:ABCD:ABCD:DBAA:1245:2342:1145:6241",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
SCRadixAddKeyIPV6((uint8_t *)&servaddr.sin6_addr, tree, NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "::", &servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
node = SCRadixAddKeyIPV6Netblock((uint8_t *)&servaddr.sin6_addr, tree, NULL,
|
||
0);
|
||
/* test the existence of keys */
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2004:0BF1:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) == NULL);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2004:0BF1:5346:BDEA:7422:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6BestMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) == node);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2004:0BF1:5346:B116:2362:8713:9124:2315",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6BestMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) == node);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "2004:0B23:3252:BDEA:7422:8713:9124:2341",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6BestMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) == node);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "DBCA:ABCD:ABCD:DBAA:1245:2342:1145:6241",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
result &= (SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != NULL &&
|
||
SCRadixFindKeyIPV6ExactMatch((uint8_t *)&servaddr.sin6_addr, tree, NULL) != node);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET6, "DBCA:ABCD:ABCD:DBAA:1245:2342:1145:6241",
|
||
&servaddr.sin6_addr) <= 0)
|
||
return 0;
|
||
... | ... | |
uint32_t *user;
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.0.1", &servaddr.sin_addr) <= 0) {
|
||
result = 0;
|
||
goto end;
|
||
... | ... | |
uint32_t *user;
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.1", &servaddr.sin_addr) <= 0) {
|
||
result = 0;
|
||
goto end;
|
||
... | ... | |
uint32_t *user;
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "10.0.0.1", &servaddr.sin_addr) <= 0) {
|
||
result = 0;
|
||
goto end;
|
||
... | ... | |
uint32_t *user;
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "172.26.0.1", &servaddr.sin_addr) <= 0) {
|
||
result = 0;
|
||
goto end;
|
||
... | ... | |
uint32_t *user;
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "0.0.0.0", &servaddr.sin_addr) <= 0) {
|
||
result = 0;
|
||
goto end;
|
||
... | ... | |
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, user, 0);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "192.168.1.15", &servaddr.sin_addr) <= 0) {
|
||
result = 0;
|
||
goto end;
|
||
... | ... | |
user_data = NULL;
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "177.0.0.0", &servaddr.sin_addr) <= 0) {
|
||
result = 0;
|
||
goto end;
|
||
... | ... | |
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, user, 8);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "177.168.1.15", &servaddr.sin_addr) <= 0) {
|
||
result = 0;
|
||
goto end;
|
||
... | ... | |
user_data = NULL;
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "178.168.1.15", &servaddr.sin_addr) <= 0) {
|
||
result = 0;
|
||
goto end;
|
||
... | ... | |
}
|
||
user_data = NULL;
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "177.168.0.0", &servaddr.sin_addr) <= 0) {
|
||
result = 0;
|
||
goto end;
|
||
... | ... | |
SCRadixAddKeyIPV4Netblock((uint8_t *)&servaddr.sin_addr, tree, user, 12);
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "177.168.1.15", &servaddr.sin_addr) <= 0) {
|
||
result = 0;
|
||
goto end;
|
||
... | ... | |
}
|
||
user_data = NULL;
|
||
bzero(&servaddr, sizeof(servaddr));
|
||
memset(&servaddr, 0, sizeof(servaddr));
|
||
if (inet_pton(AF_INET, "177.167.1.15", &servaddr.sin_addr) <= 0) {
|
||
result = 0;
|
||
goto end;
|
||
... | ... | |
}
|
||
user_data = NULL;
|
||
bzero(&servaddr, sizeof(servaddr));
|
- « Previous
- 1
- 2
- 3
- 4
- Next »