DRILL_LOBJS = drill/chasetrace.lo drill/dnssec.lo drill/drill.lo drill/drill_util.lo drill/error.lo drill/root.lo drill/securetrace.lo drill/work.lo
-EXAMPLE_LOBJS = examples/ldns-chaos.lo examples/ldns-compare-zones.lo examples/ldnsd.lo examples/ldns-dpa.lo examples/ldns-gen-zone.lo examples/ldns-key2ds.lo examples/ldns-keyfetcher.lo examples/ldns-keygen.lo examples/ldns-mx.lo examples/ldns-notify.lo examples/ldns-nsec3-hash.lo examples/ldns-read-zone.lo examples/ldns-resolver.lo examples/ldns-revoke.lo examples/ldns-rrsig.lo examples/ldns-signzone.lo examples/ldns-test-edns.lo examples/ldns-testns.lo examples/ldns-testpkts.lo examples/ldns-update.lo examples/ldns-verify-zone.lo examples/ldns-version.lo examples/ldns-radixtree.lo examples/ldns-walk.lo examples/ldns-zcat.lo examples/ldns-zsplit.lo
-EXAMPLE_PROGS = examples/ldns-chaos examples/ldns-compare-zones examples/ldnsd examples/ldns-gen-zone examples/ldns-key2ds examples/ldns-keyfetcher examples/ldns-keygen examples/ldns-mx examples/ldns-notify examples/ldns-read-zone examples/ldns-resolver examples/ldns-rrsig examples/ldns-test-edns examples/ldns-update examples/ldns-version examples/ldns-radixtree examples/ldns-walk examples/ldns-zcat examples/ldns-zsplit
-EX_PROGS_BASENM = ldns-chaos ldns-compare-zones ldnsd ldns-dpa ldns-gen-zone ldns-key2ds ldns-keyfetcher ldns-keygen ldns-mx ldns-notify ldns-nsec3-hash ldns-read-zone ldns-resolver ldns-revoke ldns-rrsig ldns-signzone ldns-test-edns ldns-testns ldns-testpkts ldns-update ldns-verify-zone ldns-version ldns-radixtree ldns-walk ldns-zcat ldns-zsplit
+EXAMPLE_LOBJS = examples/ldns-chaos.lo examples/ldns-compare-zones.lo examples/ldnsd.lo examples/ldns-dpa.lo examples/ldns-gen-zone.lo examples/ldns-key2ds.lo examples/ldns-keyfetcher.lo examples/ldns-keygen.lo examples/ldns-mx.lo examples/ldns-notify.lo examples/ldns-nsec3-hash.lo examples/ldns-read-zone.lo examples/ldns-resolver.lo examples/ldns-revoke.lo examples/ldns-rrsig.lo examples/ldns-signzone.lo examples/ldns-test-edns.lo examples/ldns-testns.lo examples/ldns-testpkts.lo examples/ldns-update.lo examples/ldns-verify-zone.lo examples/ldns-version.lo examples/ldns-walk.lo examples/ldns-zcat.lo examples/ldns-zsplit.lo
+EXAMPLE_PROGS = examples/ldns-chaos examples/ldns-compare-zones examples/ldnsd examples/ldns-gen-zone examples/ldns-key2ds examples/ldns-keyfetcher examples/ldns-keygen examples/ldns-mx examples/ldns-notify examples/ldns-read-zone examples/ldns-resolver examples/ldns-rrsig examples/ldns-test-edns examples/ldns-update examples/ldns-version examples/ldns-walk examples/ldns-zcat examples/ldns-zsplit
+EX_PROGS_BASENM = ldns-chaos ldns-compare-zones ldnsd ldns-dpa ldns-gen-zone ldns-key2ds ldns-keyfetcher ldns-keygen ldns-mx ldns-notify ldns-nsec3-hash ldns-read-zone ldns-resolver ldns-revoke ldns-rrsig ldns-signzone ldns-test-edns ldns-testns ldns-testpkts ldns-update ldns-verify-zone ldns-version ldns-walk ldns-zcat ldns-zsplit
EXAMPLE_PROGS_EX= ^examples/ldns-testpkts\.c|examples/ldns-testns\.c|examples/ldns-dpa\.c|examples/ldns-nsec3-hash\.c|examples/ldns-revoke\.c|examples/ldns-signzone\.c|examples/ldns-verify-zone\.c$$
TESTNS = examples/ldns-testns
TESTNS_LOBJS = examples/ldns-testns.lo examples/ldns-testpkts.lo
$(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
$(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
$(srcdir)/ldns/sha2.h
-examples/ldns-radixtree.lo examples/ldns-radixtree.o: $(srcdir)/examples/ldns-radixtree.c \
- $(srcdir)/ldns/ldns.h \
- $(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h \
- $(srcdir)/ldns/dname.h $(srcdir)/ldns/rdata.h $(srcdir)/ldns/dnssec.h $(srcdir)/ldns/packet.h $(srcdir)/ldns/rr.h \
- $(srcdir)/ldns/keys.h $(srcdir)/ldns/zone.h $(srcdir)/ldns/resolver.h $(srcdir)/ldns/tsig.h $(srcdir)/ldns/dnssec_zone.h \
- $(srcdir)/ldns/radix.h $(srcdir)/ldns/rbtree.h $(srcdir)/ldns/host2str.h $(srcdir)/ldns/dnssec_verify.h $(srcdir)/ldns/dnssec_sign.h \
- $(srcdir)/ldns/duration.h $(srcdir)/ldns/higher.h $(srcdir)/ldns/host2wire.h \
- $(srcdir)/ldns/str2host.h $(srcdir)/ldns/update.h \
- $(srcdir)/ldns/wire2host.h $(srcdir)/ldns/rr_functions.h $(srcdir)/ldns/parse.h $(srcdir)/ldns/sha1.h \
- $(srcdir)/ldns/sha2.h
examples/ldns-walk.lo examples/ldns-walk.o: $(srcdir)/examples/ldns-walk.c \
$(srcdir)/ldns/ldns.h \
$(srcdir)/ldns/buffer.h $(srcdir)/ldns/error.h \
* Example 1: The root:
* | [0]
**/
- fprintf(stdout, "[radix] insert root\n");
tree->root = add;
} else {
/** Example 2: 'dns':
* | [0]
* --| [d+ns] dns
**/
- fprintf(stdout, "[radix] insert shadow root\n");
-
prefix = ldns_radix_new_node(NULL, (uint8_t*)"", 0);
if (!prefix) {
LDNS_FREE(add);
LDNS_FREE(prefix->array);
return LDNS_STATUS_MEM_ERR;
}
- fprintf(stdout, "[radix] insert %s at root[0]\n", (char*) key);
/** Set relational pointers */
add->parent = prefix;
add->parent_index = 0;
}
} else if (pos == len) {
/** Exact match found */
- fprintf(stdout, "[radix] exact match found for %s\n", (char*) key);
if (prefix->data) {
/* Element already exists */
LDNS_FREE(add);
assert(byte >= prefix->offset);
assert((byte - prefix->offset) <= prefix->len);
byte -= prefix->offset;
- fprintf(stdout, "[radix] insert %s at node[%u]\n", (char*) key, byte);
if (pos+1 < len) {
/** Create remainder of the string. */
if (!ldns_radix_str_create(
* --| [l+dns] ldns
**/
byte -= prefix->offset;
- fprintf(stdout, "[radix] insert %s at node[%u]\n", (char*) key, byte);
if (pos+1 < len) {
/** Create remainder of the string. */
if (!ldns_radix_str_create(
* Use existing element, but it has a shared prefix,
* we need a split.
*/
- fprintf(stdout, "[radix] shared prefix found for %s\n", (char*) key);
-
if (!ldns_radix_array_split(&prefix->array[byte-(prefix->offset)],
key, pos+1, len, add)) {
LDNS_FREE(add);
while (pos < len) {
byte = key[pos];
if (byte < node->offset) {
- fprintf(stdout, "[radix] byte < node->offset\n");
/**
* No exact match. The lesser is in this or the
* previous node.
}
byte -= node->offset;
if (byte >= node->len) {
- fprintf(stdout, "[radix] byte >= node->len\n");
/**
* No exact match. The lesser is in this node or the
* last of this array, or something before this node.
}
pos++;
if (!node->array[byte].edge) {
- fprintf(stdout, "[radix] !node->array[byte].edge\n");
/**
* No exact match. Find the previous in the array
* from this index.
return 0;
}
if (node->array[byte].len != 0) {
- fprintf(stdout, "[radix] node->array[byte].len != 0\n");
/** Must match additional string. */
if (pos + node->array[byte].len > len) {
/** Additional string is longer than key. */
node = node->array[byte].edge;
}
if (node->data) {
- fprintf(stdout, "[radix] node->data\n");
/** Exact match. */
*result = node;
return 1;
status = LDNS_STATUS_NO_DATA;
/** Insert current node into tree1 */
if (cur_node->data) {
- fprintf(stdout, "[radix] join insert %s\n", (char*) cur_node->data);
status = ldns_radix_insert(tree1, cur_node->key,
cur_node->klen, cur_node->data);
/** Exist errors may occur */
return LDNS_STATUS_NULL;
}
if (!*tree2) {
- fprintf(stdout, "[radix] split create new tree\n");
*tree2 = ldns_radix_create();
if (!*tree2) {
return LDNS_STATUS_MEM_ERR;
cur_node = ldns_radix_first(tree1);
while (count < num && cur_node) {
if (cur_node->data) {
- fprintf(stdout, "[radix] split element %u %s\n",
- count, (char*) cur_node->data);
/** Delete current node from tree1. */
uint8_t* cur_key = cur_node->key;
radix_strlen_t cur_len = cur_node->klen;
- fprintf(stdout, "[radix] delete element %s\n",
- (char*) cur_node->data);
void* cur_data = ldns_radix_delete(tree1, cur_key,
cur_len);
/** Insert current node into tree2/ */
if (!cur_data) {
return LDNS_STATUS_NO_DATA;
}
- fprintf(stdout, "[radix] insert element %s\n",
- (char*) cur_data);
status = ldns_radix_insert(*tree2, cur_key, cur_len,
cur_data);
if (status != LDNS_STATUS_OK &&
/** The string to add is a prefix of the existing string */
uint8_t* split_str = NULL, *dup_str = NULL;
radix_strlen_t split_len = 0;
- fprintf(stdout, "[radix] (new) %s is prefix of (existing) %s\n", (char*) key, (char*) array->str);
/**
* Example 5: 'ld'
* | [0]
**/
uint8_t* split_str = NULL;
radix_strlen_t split_len = 0;
- fprintf(stdout, "[radix] (existing) %s is prefix of (new) %s\n", (char*) array->str, (char*) key);
assert(array->len < strlen_to_add);
if (strlen_to_add - array->len > 1) {
if (!ldns_radix_prefix_remainder(array->len+1,
* --| [l+d] ld
* ----| [n+s] ldns
**/
- fprintf(stdout, "[radix] split (existing) %s \n", (char*) array->str);
-
ldns_radix_node_t* common = NULL;
uint8_t* common_str = NULL, *s1 = NULL, *s2 = NULL;
radix_strlen_t common_len = 0, l1 = 0, l2 = 0;
return 0;
}
}
- fprintf(stdout, "[radix] %u bytes in common... \n", (unsigned) common_len);
-
/** Create the shared prefix. */
if (common_len > 0) {
common_str = LDNS_XMALLOC(uint8_t, common_len);
}
memcpy(common_str, str_to_add, common_len);
}
- fprintf(stdout, "[radix] common prefix is %s \n", (char*) common_str);
-
/** Make space in the common node array. */
if (!ldns_radix_array_space(common, array->str[common_len]) ||
!ldns_radix_array_space(common, str_to_add[common_len])) {
return;
} else if (node->len == 1 && node->parent) {
/** Node with one child is fold back into. */
- fprintf(stdout, "[radix] delfix cleanup onechild\n");
ldns_radix_cleanup_onechild(node);
return;
} else if (node->len == 0) {
return;
}
/** Cleanup leaf node and continue with parent. */
- fprintf(stdout, "[radix] delfix cleanup leaf\n");
ldns_radix_cleanup_leaf(node);
node = parent;
} else {