Commit d1ac696b authored by Jan Kadlec's avatar Jan Kadlec

Cleanup: node.h cleanup/rename + doxygen.

- knot_ prefix dropped
- flags cleanup
- node.h functions reorganized
- also fixed a few comments/formattings that had nothing to do with node structure
parent 9f79a236
...@@ -239,7 +239,7 @@ static int remote_c_zonestatus(server_t *s, remote_cmdargs_t* a) ...@@ -239,7 +239,7 @@ static int remote_c_zonestatus(server_t *s, remote_cmdargs_t* a)
const knot_rdataset_t *soa_rrs = NULL; const knot_rdataset_t *soa_rrs = NULL;
uint32_t serial = 0; uint32_t serial = 0;
if (zone->contents) { if (zone->contents) {
soa_rrs = knot_node_rdataset(zone->contents->apex, soa_rrs = node_rdataset(zone->contents->apex,
KNOT_RRTYPE_SOA); KNOT_RRTYPE_SOA);
assert(soa_rrs != NULL); assert(soa_rrs != NULL);
serial = knot_soa_serial(soa_rrs); serial = knot_soa_serial(soa_rrs);
......
...@@ -34,8 +34,8 @@ ...@@ -34,8 +34,8 @@
* *
* \return NSEC RR set, NULL on error. * \return NSEC RR set, NULL on error.
*/ */
static knot_rrset_t *create_nsec_rrset(const knot_node_t *from, static knot_rrset_t *create_nsec_rrset(const zone_node_t *from,
const knot_node_t *to, const zone_node_t *to,
uint32_t ttl) uint32_t ttl)
{ {
assert(from); assert(from);
...@@ -51,7 +51,7 @@ static knot_rrset_t *create_nsec_rrset(const knot_node_t *from, ...@@ -51,7 +51,7 @@ static knot_rrset_t *create_nsec_rrset(const knot_node_t *from,
bitmap_add_node_rrsets(&rr_types, from); bitmap_add_node_rrsets(&rr_types, from);
bitmap_add_type(&rr_types, KNOT_RRTYPE_NSEC); bitmap_add_type(&rr_types, KNOT_RRTYPE_NSEC);
bitmap_add_type(&rr_types, KNOT_RRTYPE_RRSIG); bitmap_add_type(&rr_types, KNOT_RRTYPE_RRSIG);
if (knot_node_rrtype_exists(from, KNOT_RRTYPE_SOA)) { if (node_rrtype_exists(from, KNOT_RRTYPE_SOA)) {
bitmap_add_type(&rr_types, KNOT_RRTYPE_DNSKEY); bitmap_add_type(&rr_types, KNOT_RRTYPE_DNSKEY);
} }
...@@ -86,14 +86,14 @@ static knot_rrset_t *create_nsec_rrset(const knot_node_t *from, ...@@ -86,14 +86,14 @@ static knot_rrset_t *create_nsec_rrset(const knot_node_t *from,
* *
* \return Error code, KNOT_EOK if successful. * \return Error code, KNOT_EOK if successful.
*/ */
static int connect_nsec_nodes(knot_node_t *a, knot_node_t *b, static int connect_nsec_nodes(zone_node_t *a, zone_node_t *b,
nsec_chain_iterate_data_t *data) nsec_chain_iterate_data_t *data)
{ {
assert(a); assert(a);
assert(b); assert(b);
assert(data); assert(data);
if (b->rrset_count == 0 || b->flags & KNOT_NODE_FLAGS_NONAUTH) { if (b->rrset_count == 0 || b->flags & NODE_FLAGS_NONAUTH) {
return NSEC_NODE_SKIP; return NSEC_NODE_SKIP;
} }
...@@ -103,7 +103,7 @@ static int connect_nsec_nodes(knot_node_t *a, knot_node_t *b, ...@@ -103,7 +103,7 @@ static int connect_nsec_nodes(knot_node_t *a, knot_node_t *b,
* If the node has no other RRSets than NSEC (and possibly RRSIGs), * If the node has no other RRSets than NSEC (and possibly RRSIGs),
* just remove the NSEC and its RRSIG, they are redundant * just remove the NSEC and its RRSIG, they are redundant
*/ */
if (knot_node_rrtype_exists(b, KNOT_RRTYPE_NSEC) if (node_rrtype_exists(b, KNOT_RRTYPE_NSEC)
&& knot_nsec_empty_nsec_and_rrsigs_in_node(b)) { && knot_nsec_empty_nsec_and_rrsigs_in_node(b)) {
ret = knot_nsec_changeset_remove(b, data->changeset); ret = knot_nsec_changeset_remove(b, data->changeset);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
...@@ -120,7 +120,7 @@ static int connect_nsec_nodes(knot_node_t *a, knot_node_t *b, ...@@ -120,7 +120,7 @@ static int connect_nsec_nodes(knot_node_t *a, knot_node_t *b,
return KNOT_ENOMEM; return KNOT_ENOMEM;
} }
knot_rrset_t old_nsec = knot_node_rrset(a, KNOT_RRTYPE_NSEC); knot_rrset_t old_nsec = node_rrset(a, KNOT_RRTYPE_NSEC);
if (!knot_rrset_empty(&old_nsec)) { if (!knot_rrset_empty(&old_nsec)) {
if (knot_rrset_equal(new_nsec, &old_nsec, if (knot_rrset_equal(new_nsec, &old_nsec,
KNOT_RRSET_COMPARE_WHOLE)) { KNOT_RRSET_COMPARE_WHOLE)) {
...@@ -132,7 +132,7 @@ static int connect_nsec_nodes(knot_node_t *a, knot_node_t *b, ...@@ -132,7 +132,7 @@ static int connect_nsec_nodes(knot_node_t *a, knot_node_t *b,
dbg_dnssec_detail("NSECs not equal, replacing.\n"); dbg_dnssec_detail("NSECs not equal, replacing.\n");
// Mark the node so that we do not sign this NSEC // Mark the node so that we do not sign this NSEC
a->flags |= KNOT_NODE_FLAGS_REMOVED_NSEC; a->flags |= NODE_FLAGS_REMOVED_NSEC;
ret = knot_nsec_changeset_remove(a, data->changeset); ret = knot_nsec_changeset_remove(a, data->changeset);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
knot_rrset_free(&new_nsec, NULL); knot_rrset_free(&new_nsec, NULL);
...@@ -170,15 +170,15 @@ int knot_nsec_chain_iterate_create(knot_zone_tree_t *nodes, ...@@ -170,15 +170,15 @@ int knot_nsec_chain_iterate_create(knot_zone_tree_t *nodes,
return KNOT_EINVAL; return KNOT_EINVAL;
} }
knot_node_t *first = (knot_node_t *)*hattrie_iter_val(it); zone_node_t *first = (zone_node_t *)*hattrie_iter_val(it);
knot_node_t *previous = first; zone_node_t *previous = first;
knot_node_t *current = first; zone_node_t *current = first;
hattrie_iter_next(it); hattrie_iter_next(it);
int result = KNOT_EOK; int result = KNOT_EOK;
while (!hattrie_iter_finished(it)) { while (!hattrie_iter_finished(it)) {
current = (knot_node_t *)*hattrie_iter_val(it); current = (zone_node_t *)*hattrie_iter_val(it);
result = callback(previous, current, data); result = callback(previous, current, data);
if (result == NSEC_NODE_SKIP) { if (result == NSEC_NODE_SKIP) {
...@@ -204,7 +204,7 @@ int knot_nsec_chain_iterate_create(knot_zone_tree_t *nodes, ...@@ -204,7 +204,7 @@ int knot_nsec_chain_iterate_create(knot_zone_tree_t *nodes,
/*! /*!
* \brief Add entry for removed NSEC to the changeset. * \brief Add entry for removed NSEC to the changeset.
*/ */
int knot_nsec_changeset_remove(const knot_node_t *n, int knot_nsec_changeset_remove(const zone_node_t *n,
knot_changeset_t *changeset) knot_changeset_t *changeset)
{ {
if (changeset == NULL) { if (changeset == NULL) {
...@@ -213,9 +213,9 @@ int knot_nsec_changeset_remove(const knot_node_t *n, ...@@ -213,9 +213,9 @@ int knot_nsec_changeset_remove(const knot_node_t *n,
int result = KNOT_EOK; int result = KNOT_EOK;
knot_rrset_t *nsec = knot_node_create_rrset(n, KNOT_RRTYPE_NSEC); knot_rrset_t *nsec = node_create_rrset(n, KNOT_RRTYPE_NSEC);
if (nsec == NULL) { if (nsec == NULL) {
nsec = knot_node_create_rrset(n, KNOT_RRTYPE_NSEC3); nsec = node_create_rrset(n, KNOT_RRTYPE_NSEC3);
} }
if (nsec) { if (nsec) {
// update changeset // update changeset
...@@ -227,7 +227,7 @@ int knot_nsec_changeset_remove(const knot_node_t *n, ...@@ -227,7 +227,7 @@ int knot_nsec_changeset_remove(const knot_node_t *n,
} }
} }
knot_rrset_t rrsigs = knot_node_rrset(n, KNOT_RRTYPE_RRSIG); knot_rrset_t rrsigs = node_rrset(n, KNOT_RRTYPE_RRSIG);
if (!knot_rrset_empty(&rrsigs)) { if (!knot_rrset_empty(&rrsigs)) {
knot_rrset_t *synth_rrsigs = knot_rrset_new(n->owner, knot_rrset_t *synth_rrsigs = knot_rrset_new(n->owner,
KNOT_RRTYPE_RRSIG, KNOT_RRTYPE_RRSIG,
...@@ -268,11 +268,11 @@ int knot_nsec_changeset_remove(const knot_node_t *n, ...@@ -268,11 +268,11 @@ int knot_nsec_changeset_remove(const knot_node_t *n,
* \brief Checks whether the node is empty or eventually contains only NSEC and * \brief Checks whether the node is empty or eventually contains only NSEC and
* RRSIGs. * RRSIGs.
*/ */
bool knot_nsec_empty_nsec_and_rrsigs_in_node(const knot_node_t *n) bool knot_nsec_empty_nsec_and_rrsigs_in_node(const zone_node_t *n)
{ {
assert(n); assert(n);
for (int i = 0; i < n->rrset_count; ++i) { for (int i = 0; i < n->rrset_count; ++i) {
knot_rrset_t rrset = knot_node_rrset_at(n, i); knot_rrset_t rrset = node_rrset_at(n, i);
if (rrset.type != KNOT_RRTYPE_NSEC && if (rrset.type != KNOT_RRTYPE_NSEC &&
rrset.type != KNOT_RRTYPE_RRSIG) { rrset.type != KNOT_RRTYPE_RRSIG) {
return false; return false;
......
...@@ -53,17 +53,17 @@ enum { ...@@ -53,17 +53,17 @@ enum {
/*! /*!
* \brief Callback used when creating NSEC chains. * \brief Callback used when creating NSEC chains.
*/ */
typedef int (*chain_iterate_create_cb)(knot_node_t *, knot_node_t *, typedef int (*chain_iterate_create_cb)(zone_node_t *, zone_node_t *,
nsec_chain_iterate_data_t *); nsec_chain_iterate_data_t *);
/*! /*!
* \brief Add all RR types from a node into the bitmap. * \brief Add all RR types from a node into the bitmap.
*/ */
inline static void bitmap_add_node_rrsets(bitmap_t *bitmap, inline static void bitmap_add_node_rrsets(bitmap_t *bitmap,
const knot_node_t *node) const zone_node_t *node)
{ {
for (int i = 0; i < node->rrset_count; i++) { for (int i = 0; i < node->rrset_count; i++) {
knot_rrset_t rr = knot_node_rrset_at(node, i); knot_rrset_t rr = node_rrset_at(node, i);
if (rr.type != KNOT_RRTYPE_NSEC && if (rr.type != KNOT_RRTYPE_NSEC &&
rr.type != KNOT_RRTYPE_RRSIG) { rr.type != KNOT_RRTYPE_RRSIG) {
bitmap_add_type(bitmap, rr.type); bitmap_add_type(bitmap, rr.type);
...@@ -95,7 +95,7 @@ int knot_nsec_chain_iterate_create(knot_zone_tree_t *nodes, ...@@ -95,7 +95,7 @@ int knot_nsec_chain_iterate_create(knot_zone_tree_t *nodes,
* *
* \return Error code, KNOT_EOK if successful. * \return Error code, KNOT_EOK if successful.
*/ */
int knot_nsec_changeset_remove(const knot_node_t *n, int knot_nsec_changeset_remove(const zone_node_t *n,
knot_changeset_t *changeset); knot_changeset_t *changeset);
/*! /*!
...@@ -107,7 +107,7 @@ int knot_nsec_changeset_remove(const knot_node_t *n, ...@@ -107,7 +107,7 @@ int knot_nsec_changeset_remove(const knot_node_t *n,
* \retval true if the node is empty or contains only NSEC and RRSIGs. * \retval true if the node is empty or contains only NSEC and RRSIGs.
* \retval false otherwise. * \retval false otherwise.
*/ */
bool knot_nsec_empty_nsec_and_rrsigs_in_node(const knot_node_t *n); bool knot_nsec_empty_nsec_and_rrsigs_in_node(const zone_node_t *n);
/*! /*!
* \brief Create new NSEC chain, add differences from current into a changeset. * \brief Create new NSEC chain, add differences from current into a changeset.
......
...@@ -44,7 +44,7 @@ static int create_nsec3_rrset(knot_rrset_t *rrset, ...@@ -44,7 +44,7 @@ static int create_nsec3_rrset(knot_rrset_t *rrset,
/*! /*!
* \brief Perform some basic checks that the node is a valid NSEC3 node. * \brief Perform some basic checks that the node is a valid NSEC3 node.
*/ */
inline static bool valid_nsec3_node(const knot_node_t *node) inline static bool valid_nsec3_node(const zone_node_t *node)
{ {
assert(node); assert(node);
...@@ -52,7 +52,7 @@ inline static bool valid_nsec3_node(const knot_node_t *node) ...@@ -52,7 +52,7 @@ inline static bool valid_nsec3_node(const knot_node_t *node)
return false; return false;
} }
const knot_rdataset_t *nsec3 = knot_node_rdataset(node, KNOT_RRTYPE_NSEC3); const knot_rdataset_t *nsec3 = node_rdataset(node, KNOT_RRTYPE_NSEC3);
if (nsec3 == NULL) { if (nsec3 == NULL) {
return false; return false;
} }
...@@ -67,14 +67,14 @@ inline static bool valid_nsec3_node(const knot_node_t *node) ...@@ -67,14 +67,14 @@ inline static bool valid_nsec3_node(const knot_node_t *node)
/*! /*!
* \brief Check if two nodes are equal. * \brief Check if two nodes are equal.
*/ */
static bool are_nsec3_nodes_equal(const knot_node_t *a, const knot_node_t *b) static bool are_nsec3_nodes_equal(const zone_node_t *a, const zone_node_t *b)
{ {
if (!(valid_nsec3_node(a) && valid_nsec3_node(b))) { if (!(valid_nsec3_node(a) && valid_nsec3_node(b))) {
return false; return false;
} }
knot_rrset_t a_rrset = knot_node_rrset(a, KNOT_RRTYPE_NSEC3); knot_rrset_t a_rrset = node_rrset(a, KNOT_RRTYPE_NSEC3);
knot_rrset_t b_rrset = knot_node_rrset(b, KNOT_RRTYPE_NSEC3); knot_rrset_t b_rrset = node_rrset(b, KNOT_RRTYPE_NSEC3);
return knot_rrset_equal(&a_rrset, &b_rrset, KNOT_RRSET_COMPARE_WHOLE); return knot_rrset_equal(&a_rrset, &b_rrset, KNOT_RRSET_COMPARE_WHOLE);
} }
...@@ -86,10 +86,10 @@ static bool are_nsec3_nodes_equal(const knot_node_t *a, const knot_node_t *b) ...@@ -86,10 +86,10 @@ static bool are_nsec3_nodes_equal(const knot_node_t *a, const knot_node_t *b)
* *
* \return true/false. * \return true/false.
*/ */
static bool node_should_be_signed_nsec3(const knot_node_t *n) static bool node_should_be_signed_nsec3(const zone_node_t *n)
{ {
for (int i = 0; i < n->rrset_count; i++) { for (int i = 0; i < n->rrset_count; i++) {
knot_rrset_t rrset = knot_node_rrset_at(n, i); knot_rrset_t rrset = node_rrset_at(n, i);
if (rrset.type == KNOT_RRTYPE_NSEC || if (rrset.type == KNOT_RRTYPE_NSEC ||
rrset.type == KNOT_RRTYPE_RRSIG) { rrset.type == KNOT_RRTYPE_RRSIG) {
continue; continue;
...@@ -112,16 +112,16 @@ static bool node_should_be_signed_nsec3(const knot_node_t *n) ...@@ -112,16 +112,16 @@ static bool node_should_be_signed_nsec3(const knot_node_t *n)
* \brief Shallow copy NSEC3 signatures from the one node to the second one. * \brief Shallow copy NSEC3 signatures from the one node to the second one.
* Just sets the pointer, needed only for comparison. * Just sets the pointer, needed only for comparison.
*/ */
static int shallow_copy_signature(const knot_node_t *from, knot_node_t *to) static int shallow_copy_signature(const zone_node_t *from, zone_node_t *to)
{ {
assert(valid_nsec3_node(from)); assert(valid_nsec3_node(from));
assert(valid_nsec3_node(to)); assert(valid_nsec3_node(to));
knot_rrset_t from_sig = knot_node_rrset(from, KNOT_RRTYPE_RRSIG); knot_rrset_t from_sig = node_rrset(from, KNOT_RRTYPE_RRSIG);
if (knot_rrset_empty(&from_sig)) { if (knot_rrset_empty(&from_sig)) {
return KNOT_EOK; return KNOT_EOK;
} }
return knot_node_add_rrset(to, &from_sig, NULL); return node_add_rrset(to, &from_sig, NULL);
} }
/*! /*!
...@@ -139,8 +139,8 @@ static int copy_signatures(const knot_zone_tree_t *from, knot_zone_tree_t *to) ...@@ -139,8 +139,8 @@ static int copy_signatures(const knot_zone_tree_t *from, knot_zone_tree_t *to)
hattrie_iter_t *it = hattrie_iter_begin(from, sorted); hattrie_iter_t *it = hattrie_iter_begin(from, sorted);
for (/* NOP */; !hattrie_iter_finished(it); hattrie_iter_next(it)) { for (/* NOP */; !hattrie_iter_finished(it); hattrie_iter_next(it)) {
knot_node_t *node_from = (knot_node_t *)*hattrie_iter_val(it); zone_node_t *node_from = (zone_node_t *)*hattrie_iter_val(it);
knot_node_t *node_to = NULL; zone_node_t *node_to = NULL;
knot_zone_tree_get(to, node_from->owner, &node_to); knot_zone_tree_get(to, node_from->owner, &node_to);
if (node_to == NULL) { if (node_to == NULL) {
...@@ -173,13 +173,13 @@ static void free_nsec3_tree(knot_zone_tree_t *nodes) ...@@ -173,13 +173,13 @@ static void free_nsec3_tree(knot_zone_tree_t *nodes)
bool sorted = false; bool sorted = false;
hattrie_iter_t *it = hattrie_iter_begin(nodes, sorted); hattrie_iter_t *it = hattrie_iter_begin(nodes, sorted);
for (/* NOP */; !hattrie_iter_finished(it); hattrie_iter_next(it)) { for (/* NOP */; !hattrie_iter_finished(it); hattrie_iter_next(it)) {
knot_node_t *node = (knot_node_t *)*hattrie_iter_val(it); zone_node_t *node = (zone_node_t *)*hattrie_iter_val(it);
// newly allocated NSEC3 nodes // newly allocated NSEC3 nodes
knot_rdataset_t *nsec3 = knot_node_rdataset(node, KNOT_RRTYPE_NSEC3); knot_rdataset_t *nsec3 = node_rdataset(node, KNOT_RRTYPE_NSEC3);
knot_rdataset_t *rrsig = knot_node_rdataset(node, KNOT_RRTYPE_RRSIG); knot_rdataset_t *rrsig = node_rdataset(node, KNOT_RRTYPE_RRSIG);
knot_rdataset_clear(nsec3, NULL); knot_rdataset_clear(nsec3, NULL);
knot_rdataset_clear(rrsig, NULL); knot_rdataset_clear(rrsig, NULL);
knot_node_free(&node); node_free(&node);
} }
hattrie_iter_free(it); hattrie_iter_free(it);
...@@ -272,9 +272,9 @@ static int create_nsec3_rrset(knot_rrset_t *rrset, ...@@ -272,9 +272,9 @@ static int create_nsec3_rrset(knot_rrset_t *rrset,
/*! /*!
* \brief Create NSEC3 node. * \brief Create NSEC3 node.
*/ */
static knot_node_t *create_nsec3_node(knot_dname_t *owner, static zone_node_t *create_nsec3_node(knot_dname_t *owner,
const knot_nsec3_params_t *nsec3_params, const knot_nsec3_params_t *nsec3_params,
knot_node_t *apex_node, zone_node_t *apex_node,
const bitmap_t *rr_types, const bitmap_t *rr_types,
uint32_t ttl) uint32_t ttl)
{ {
...@@ -283,25 +283,25 @@ static knot_node_t *create_nsec3_node(knot_dname_t *owner, ...@@ -283,25 +283,25 @@ static knot_node_t *create_nsec3_node(knot_dname_t *owner,
assert(apex_node); assert(apex_node);
assert(rr_types); assert(rr_types);
knot_node_t *new_node = knot_node_new(owner); zone_node_t *new_node = node_new(owner);
if (!new_node) { if (!new_node) {
return NULL; return NULL;
} }
knot_node_set_parent(new_node, apex_node); node_set_parent(new_node, apex_node);
knot_rrset_t nsec3_rrset; knot_rrset_t nsec3_rrset;
int ret = create_nsec3_rrset(&nsec3_rrset, owner, nsec3_params, int ret = create_nsec3_rrset(&nsec3_rrset, owner, nsec3_params,
rr_types, NULL, ttl); rr_types, NULL, ttl);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
knot_node_free(&new_node); node_free(&new_node);
return NULL; return NULL;
} }
ret = knot_node_add_rrset(new_node, &nsec3_rrset, NULL); ret = node_add_rrset(new_node, &nsec3_rrset, NULL);
knot_rrset_clear(&nsec3_rrset, NULL); knot_rrset_clear(&nsec3_rrset, NULL);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
knot_node_free(&new_node); node_free(&new_node);
return NULL; return NULL;
} }
...@@ -318,8 +318,8 @@ static knot_node_t *create_nsec3_node(knot_dname_t *owner, ...@@ -318,8 +318,8 @@ static knot_node_t *create_nsec3_node(knot_dname_t *owner,
* *
* \return Error code, KNOT_EOK if successful. * \return Error code, KNOT_EOK if successful.
*/ */
static knot_node_t *create_nsec3_node_for_node(knot_node_t *node, static zone_node_t *create_nsec3_node_for_node(zone_node_t *node,
knot_node_t *apex, zone_node_t *apex,
const knot_nsec3_params_t *params, const knot_nsec3_params_t *params,
uint32_t ttl) uint32_t ttl)
{ {
...@@ -342,7 +342,7 @@ static knot_node_t *create_nsec3_node_for_node(knot_node_t *node, ...@@ -342,7 +342,7 @@ static knot_node_t *create_nsec3_node_for_node(knot_node_t *node,
bitmap_add_type(&rr_types, KNOT_RRTYPE_DNSKEY); bitmap_add_type(&rr_types, KNOT_RRTYPE_DNSKEY);
} }
knot_node_t *nsec3_node; zone_node_t *nsec3_node;
nsec3_node = create_nsec3_node(nsec3_owner, params, apex, &rr_types, ttl); nsec3_node = create_nsec3_node(nsec3_owner, params, apex, &rr_types, ttl);
return nsec3_node; return nsec3_node;
...@@ -359,7 +359,7 @@ static knot_node_t *create_nsec3_node_for_node(knot_node_t *node, ...@@ -359,7 +359,7 @@ static knot_node_t *create_nsec3_node_for_node(knot_node_t *node,
* *
* \return Error code, KNOT_EOK if successful. * \return Error code, KNOT_EOK if successful.
*/ */
static int connect_nsec3_nodes(knot_node_t *a, knot_node_t *b, static int connect_nsec3_nodes(zone_node_t *a, zone_node_t *b,
nsec_chain_iterate_data_t *data) nsec_chain_iterate_data_t *data)
{ {
assert(a); assert(a);
...@@ -368,7 +368,7 @@ static int connect_nsec3_nodes(knot_node_t *a, knot_node_t *b, ...@@ -368,7 +368,7 @@ static int connect_nsec3_nodes(knot_node_t *a, knot_node_t *b,
assert(a->rrset_count == 1); assert(a->rrset_count == 1);
knot_rdataset_t *a_rrs = knot_node_rdataset(a, KNOT_RRTYPE_NSEC3); knot_rdataset_t *a_rrs = node_rdataset(a, KNOT_RRTYPE_NSEC3);
assert(a_rrs); assert(a_rrs);
uint8_t algorithm = knot_nsec3_algorithm(a_rrs, 0); uint8_t algorithm = knot_nsec3_algorithm(a_rrs, 0);
if (algorithm == 0) { if (algorithm == 0) {
...@@ -430,7 +430,7 @@ static int create_nsec3_nodes(const knot_zone_contents_t *zone, uint32_t ttl, ...@@ -430,7 +430,7 @@ static int create_nsec3_nodes(const knot_zone_contents_t *zone, uint32_t ttl,
int sorted = false; int sorted = false;
hattrie_iter_t *it = hattrie_iter_begin(zone->nodes, sorted); hattrie_iter_t *it = hattrie_iter_begin(zone->nodes, sorted);
while (!hattrie_iter_finished(it)) { while (!hattrie_iter_finished(it)) {
knot_node_t *node = (knot_node_t *)*hattrie_iter_val(it); zone_node_t *node = (zone_node_t *)*hattrie_iter_val(it);
/*! /*!
* Remove possible NSEC from the node. (Do not allow both NSEC * Remove possible NSEC from the node. (Do not allow both NSEC
...@@ -440,15 +440,15 @@ static int create_nsec3_nodes(const knot_zone_contents_t *zone, uint32_t ttl, ...@@ -440,15 +440,15 @@ static int create_nsec3_nodes(const knot_zone_contents_t *zone, uint32_t ttl,
if (result != KNOT_EOK) { if (result != KNOT_EOK) {
break; break;
} }
if (knot_node_rrtype_exists(node, KNOT_RRTYPE_NSEC)) { if (node_rrtype_exists(node, KNOT_RRTYPE_NSEC)) {
node->flags |= KNOT_NODE_FLAGS_REMOVED_NSEC; node->flags |= NODE_FLAGS_REMOVED_NSEC;
} }
if (node->flags & KNOT_NODE_FLAGS_NONAUTH || node->flags & KNOT_NODE_FLAGS_EMPTY) { if (node->flags & NODE_FLAGS_NONAUTH || node->flags & NODE_FLAGS_EMPTY) {
hattrie_iter_next(it); hattrie_iter_next(it);
continue; continue;
} }
knot_node_t *nsec3_node; zone_node_t *nsec3_node;
nsec3_node = create_nsec3_node_for_node(node, zone->apex, nsec3_node = create_nsec3_node_for_node(node, zone->apex,
params, ttl); params, ttl);
if (!nsec3_node) { if (!nsec3_node) {
...@@ -479,7 +479,7 @@ static int create_nsec3_nodes(const knot_zone_contents_t *zone, uint32_t ttl, ...@@ -479,7 +479,7 @@ static int create_nsec3_nodes(const knot_zone_contents_t *zone, uint32_t ttl,
* RRSIGs and NSECs. * RRSIGs and NSECs.
* \retval false otherwise. * \retval false otherwise.
*/ */
static bool nsec3_is_empty(knot_node_t *node) static bool nsec3_is_empty(zone_node_t *node)
{ {
if (node->children > 0) { if (node->children > 0) {
return false; return false;
...@@ -495,17 +495,17 @@ static bool nsec3_is_empty(knot_node_t *node) ...@@ -495,17 +495,17 @@ static bool nsec3_is_empty(knot_node_t *node)
* It also lowers the children count for the parent of marked node. This must be * It also lowers the children count for the parent of marked node. This must be
* fixed before further operations on the zone. * fixed before further operations on the zone.
*/ */
static int nsec3_mark_empty(knot_node_t **node_p, void *data) static int nsec3_mark_empty(zone_node_t **node_p, void *data)
{ {
UNUSED(data); UNUSED(data);
knot_node_t *node = *node_p; zone_node_t *node = *node_p;
if (!(node->flags & KNOT_NODE_FLAGS_EMPTY) && nsec3_is_empty(node)) { if (!(node->flags & NODE_FLAGS_EMPTY) && nsec3_is_empty(node)) {
/*! /*!
* Mark this node and all parent nodes that meet the same * Mark this node and all parent nodes that meet the same
* criteria as empty. * criteria as empty.
*/ */
node->flags |= KNOT_NODE_FLAGS_EMPTY; node->flags |= NODE_FLAGS_EMPTY;
if (node->parent) { if (node->parent) {
/* We must decrease the parent's children count, /* We must decrease the parent's children count,
...@@ -544,18 +544,18 @@ static void mark_empty_nodes_tmp(const knot_zone_contents_t *zone) ...@@ -544,18 +544,18 @@ static void mark_empty_nodes_tmp(const knot_zone_contents_t *zone)
* The children count of node's parent is increased if this node was marked as * The children count of node's parent is increased if this node was marked as
* empty, as it was previously decreased in the \a nsec3_mark_empty() function. * empty, as it was previously decreased in the \a nsec3_mark_empty() function.
*/ */
static int nsec3_reset(knot_node_t **node_p, void *data) static int nsec3_reset(zone_node_t **node_p, void *data)
{ {
UNUSED(data); UNUSED(data);
knot_node_t *node = *node_p; zone_node_t *node = *node_p;
if (node->flags & KNOT_NODE_FLAGS_EMPTY) { if (node->flags & NODE_FLAGS_EMPTY) {
/* If node was marked as empty, increase its parent's children /* If node was marked as empty, increase its parent's children
* count. * count.
*/ */
node->parent->children++; node->parent->children++;
/* Clear the 'empty' flag. */ /* Clear the 'empty' flag. */
node->flags &= ~KNOT_NODE_FLAGS_EMPTY; node->flags &= ~NODE_FLAGS_EMPTY;
} }
return KNOT_EOK; return KNOT_EOK;
......
...@@ -128,8 +128,8 @@ static int zone_sign(knot_zone_contents_t *zone, conf_zone_t *zone_config, ...@@ -128,8 +128,8 @@ static int zone_sign(knot_zone_contents_t *zone, conf_zone_t *zone_config,
} }
// update SOA if there were any changes // update SOA if there were any changes
knot_rrset_t soa = knot_node_rrset(zone->apex, KNOT_RRTYPE_SOA); knot_rrset_t soa = node_rrset(zone->apex, KNOT_RRTYPE_SOA);
knot_rrset_t rrsigs = knot_node_rrset(zone->apex, KNOT_RRTYPE_RRSIG); knot_rrset_t rrsigs = node_rrset(zone->apex, KNOT_RRTYPE_RRSIG);
assert(!knot_rrset_empty(&soa)); assert(!knot_rrset_empty(&soa));
result = knot_zone_sign_update_soa(&soa, &rrsigs, &zone_keys, &policy, result = knot_zone_sign_update_soa(&soa, &rrsigs, &zone_keys, &policy,
new_serial, out_ch); new_serial, out_ch);
...@@ -238,8 +238,8 @@ int knot_dnssec_sign_changeset(const knot_zone_contents_t *zone, ...@@ -238,8 +238,8 @@ int knot_dnssec_sign_changeset(const knot_zone_contents_t *zone,
} }
// Update SOA RRSIGs // Update SOA RRSIGs
knot_rrset_t soa = knot_node_rrset(zone->apex, KNOT_RRTYPE_SOA); knot_rrset_t soa = node_rrset(zone->apex, KNOT_RRTYPE_SOA);
knot_rrset_t rrsigs = knot_node_rrset(zone->apex, KNOT_RRTYPE_RRSIG); knot_rrset_t rrsigs = node_rrset(zone->apex, KNOT_RRTYPE_RRSIG);
ret = knot_zone_sign_update_soa(&soa, &rrsigs, &zone_keys, &policy, ret = knot_zone_sign_update_soa(&soa, &rrsigs, &zone_keys, &policy,
new_serial, out_ch); new_serial, out_ch);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
......
...@@ -92,8 +92,8 @@ static bool get_zone_soa_min_ttl(const knot_zone_contents_t *zone, ...@@ -92,8 +92,8 @@ static bool get_zone_soa_min_ttl(const knot_zone_contents_t *zone,
assert(zone->apex); assert(zone->apex);
assert(ttl); assert(ttl);
knot_node_t *apex = zone->apex; zone_node_t *apex = zone->apex;
const knot_rdataset_t *soa = knot_node_rdataset(apex, KNOT_RRTYPE_SOA); const knot_rdataset_t *soa = node_rdataset(apex, KNOT_RRTYPE_SOA);
if (!soa) { if (!soa) {
return false; return false;
} }
...@@ -124,7 +124,7 @@ static int mark_nsec3(knot_rrset_t *rrset, void *data) ...@@ -124,7 +124,7 @@ static int mark_nsec3(knot_rrset_t *rrset, void *data)
assert(data != NULL); assert(data != NULL);
knot_zone_tree_t *nsec3s = (knot_zone_tree_t *)data; knot_zone_tree_t *nsec3s = (knot_zone_tree_t *)data;
knot_node_t *node = NULL; zone_node_t *node = NULL;
int ret; int ret;
if (rrset->type == KNOT_RRTYPE_NSEC3) { if (rrset->type == KNOT_RRTYPE_NSEC3) {
...@@ -136,7 +136,7 @@ static int mark_nsec3(knot_rrset_t *rrset, void *data) ...@@ -136,7 +136,7 @@ static int mark_nsec3(knot_rrset_t *rrset, void *data)
} }
if (node != NULL) { if (node != NULL) {
node->flags |= KNOT_NODE_FLAGS_REMOVED_NSEC; node->flags |= NODE_FLAGS_REMOVED_NSEC;
} }
} }
......
...@@ -451,7 +451,7 @@ static int resign_rrset(const knot_rrset_t *covered, ...@@ -451,7 +451,7 @@ static int resign_rrset(const knot_rrset_t *covered,
changeset); changeset);
} }
static int remove_standalone_rrsigs(const knot_node_t *node, static int remove_standalone_rrsigs(const zone_node_t *node,
const knot_rrset_t *rrsigs, const knot_rrset_t *rrsigs,
knot_changeset_t *changeset) knot_changeset_t *changeset)
{ {
...@@ -462,7 +462,7 @@ static int remove_standalone_rrsigs(const knot_node_t *node,