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)
const knot_rdataset_t *soa_rrs = NULL;
uint32_t serial = 0;
if (zone->contents) {
soa_rrs = knot_node_rdataset(zone->contents->apex,
soa_rrs = node_rdataset(zone->contents->apex,
KNOT_RRTYPE_SOA);
assert(soa_rrs != NULL);
serial = knot_soa_serial(soa_rrs);
......
......@@ -34,8 +34,8 @@
*
* \return NSEC RR set, NULL on error.
*/
static knot_rrset_t *create_nsec_rrset(const knot_node_t *from,
const knot_node_t *to,
static knot_rrset_t *create_nsec_rrset(const zone_node_t *from,
const zone_node_t *to,
uint32_t ttl)
{
assert(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_type(&rr_types, KNOT_RRTYPE_NSEC);
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);
}
......@@ -86,14 +86,14 @@ static knot_rrset_t *create_nsec_rrset(const knot_node_t *from,
*
* \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)
{
assert(a);
assert(b);
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;
}
......@@ -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),
* 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)) {
ret = knot_nsec_changeset_remove(b, data->changeset);
if (ret != KNOT_EOK) {
......@@ -120,7 +120,7 @@ static int connect_nsec_nodes(knot_node_t *a, knot_node_t *b,
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_equal(new_nsec, &old_nsec,
KNOT_RRSET_COMPARE_WHOLE)) {
......@@ -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");
// 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);
if (ret != KNOT_EOK) {
knot_rrset_free(&new_nsec, NULL);
......@@ -170,15 +170,15 @@ int knot_nsec_chain_iterate_create(knot_zone_tree_t *nodes,
return KNOT_EINVAL;
}
knot_node_t *first = (knot_node_t *)*hattrie_iter_val(it);
knot_node_t *previous = first;
knot_node_t *current = first;
zone_node_t *first = (zone_node_t *)*hattrie_iter_val(it);
zone_node_t *previous = first;
zone_node_t *current = first;
hattrie_iter_next(it);
int result = KNOT_EOK;
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);
if (result == NSEC_NODE_SKIP) {
......@@ -204,7 +204,7 @@ int knot_nsec_chain_iterate_create(knot_zone_tree_t *nodes,
/*!
* \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)
{
if (changeset == NULL) {
......@@ -213,9 +213,9 @@ int knot_nsec_changeset_remove(const knot_node_t *n,
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) {
nsec = knot_node_create_rrset(n, KNOT_RRTYPE_NSEC3);
nsec = node_create_rrset(n, KNOT_RRTYPE_NSEC3);
}
if (nsec) {
// update changeset
......@@ -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)) {
knot_rrset_t *synth_rrsigs = knot_rrset_new(n->owner,
KNOT_RRTYPE_RRSIG,
......@@ -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
* 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);
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 &&
rrset.type != KNOT_RRTYPE_RRSIG) {
return false;
......
......@@ -53,17 +53,17 @@ enum {
/*!
* \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 *);
/*!
* \brief Add all RR types from a node into the 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++) {
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 &&
rr.type != KNOT_RRTYPE_RRSIG) {
bitmap_add_type(bitmap, rr.type);
......@@ -95,7 +95,7 @@ int knot_nsec_chain_iterate_create(knot_zone_tree_t *nodes,
*
* \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);
/*!
......@@ -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 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.
......
......@@ -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.
*/
inline static bool valid_nsec3_node(const knot_node_t *node)
inline static bool valid_nsec3_node(const zone_node_t *node)
{
assert(node);
......@@ -52,7 +52,7 @@ inline static bool valid_nsec3_node(const knot_node_t *node)
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) {
return false;
}
......@@ -67,14 +67,14 @@ inline static bool valid_nsec3_node(const knot_node_t *node)
/*!
* \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))) {
return false;
}
knot_rrset_t a_rrset = knot_node_rrset(a, KNOT_RRTYPE_NSEC3);
knot_rrset_t b_rrset = knot_node_rrset(b, KNOT_RRTYPE_NSEC3);
knot_rrset_t a_rrset = node_rrset(a, 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);
}
......@@ -86,10 +86,10 @@ static bool are_nsec3_nodes_equal(const knot_node_t *a, const knot_node_t *b)
*
* \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++) {
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 ||
rrset.type == KNOT_RRTYPE_RRSIG) {
continue;
......@@ -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.
* 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(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)) {
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)
hattrie_iter_t *it = hattrie_iter_begin(from, sorted);
for (/* NOP */; !hattrie_iter_finished(it); hattrie_iter_next(it)) {
knot_node_t *node_from = (knot_node_t *)*hattrie_iter_val(it);
knot_node_t *node_to = NULL;
zone_node_t *node_from = (zone_node_t *)*hattrie_iter_val(it);
zone_node_t *node_to = NULL;
knot_zone_tree_get(to, node_from->owner, &node_to);
if (node_to == NULL) {
......@@ -173,13 +173,13 @@ static void free_nsec3_tree(knot_zone_tree_t *nodes)
bool sorted = false;
hattrie_iter_t *it = hattrie_iter_begin(nodes, sorted);
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
knot_rdataset_t *nsec3 = knot_node_rdataset(node, KNOT_RRTYPE_NSEC3);
knot_rdataset_t *rrsig = knot_node_rdataset(node, KNOT_RRTYPE_RRSIG);
knot_rdataset_t *nsec3 = node_rdataset(node, KNOT_RRTYPE_NSEC3);
knot_rdataset_t *rrsig = node_rdataset(node, KNOT_RRTYPE_RRSIG);
knot_rdataset_clear(nsec3, NULL);
knot_rdataset_clear(rrsig, NULL);
knot_node_free(&node);
node_free(&node);
}
hattrie_iter_free(it);
......@@ -272,9 +272,9 @@ static int create_nsec3_rrset(knot_rrset_t *rrset,
/*!
* \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,
knot_node_t *apex_node,
zone_node_t *apex_node,
const bitmap_t *rr_types,
uint32_t ttl)
{
......@@ -283,25 +283,25 @@ static knot_node_t *create_nsec3_node(knot_dname_t *owner,
assert(apex_node);
assert(rr_types);
knot_node_t *new_node = knot_node_new(owner);
zone_node_t *new_node = node_new(owner);
if (!new_node) {
return NULL;
}
knot_node_set_parent(new_node, apex_node);
node_set_parent(new_node, apex_node);
knot_rrset_t nsec3_rrset;
int ret = create_nsec3_rrset(&nsec3_rrset, owner, nsec3_params,
rr_types, NULL, ttl);
if (ret != KNOT_EOK) {
knot_node_free(&new_node);
node_free(&new_node);
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);
if (ret != KNOT_EOK) {
knot_node_free(&new_node);
node_free(&new_node);
return NULL;
}
......@@ -318,8 +318,8 @@ static knot_node_t *create_nsec3_node(knot_dname_t *owner,
*
* \return Error code, KNOT_EOK if successful.
*/
static knot_node_t *create_nsec3_node_for_node(knot_node_t *node,
knot_node_t *apex,
static zone_node_t *create_nsec3_node_for_node(zone_node_t *node,
zone_node_t *apex,
const knot_nsec3_params_t *params,
uint32_t ttl)
{
......@@ -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);
}
knot_node_t *nsec3_node;
zone_node_t *nsec3_node;
nsec3_node = create_nsec3_node(nsec3_owner, params, apex, &rr_types, ttl);
return nsec3_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.
*/
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)
{
assert(a);
......@@ -368,7 +368,7 @@ static int connect_nsec3_nodes(knot_node_t *a, knot_node_t *b,
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);
uint8_t algorithm = knot_nsec3_algorithm(a_rrs, 0);
if (algorithm == 0) {
......@@ -430,7 +430,7 @@ static int create_nsec3_nodes(const knot_zone_contents_t *zone, uint32_t ttl,
int sorted = false;
hattrie_iter_t *it = hattrie_iter_begin(zone->nodes, sorted);
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
......@@ -440,15 +440,15 @@ static int create_nsec3_nodes(const knot_zone_contents_t *zone, uint32_t ttl,
if (result != KNOT_EOK) {
break;
}
if (knot_node_rrtype_exists(node, KNOT_RRTYPE_NSEC)) {
node->flags |= KNOT_NODE_FLAGS_REMOVED_NSEC;
if (node_rrtype_exists(node, KNOT_RRTYPE_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);
continue;
}
knot_node_t *nsec3_node;
zone_node_t *nsec3_node;
nsec3_node = create_nsec3_node_for_node(node, zone->apex,
params, ttl);
if (!nsec3_node) {
......@@ -479,7 +479,7 @@ static int create_nsec3_nodes(const knot_zone_contents_t *zone, uint32_t ttl,
* RRSIGs and NSECs.
* \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) {
return false;
......@@ -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
* 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);
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
* criteria as empty.
*/
node->flags |= KNOT_NODE_FLAGS_EMPTY;
node->flags |= NODE_FLAGS_EMPTY;
if (node->parent) {
/* We must decrease the parent's children count,
......@@ -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
* 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);
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
* count.
*/
node->parent->children++;
/* Clear the 'empty' flag. */
node->flags &= ~KNOT_NODE_FLAGS_EMPTY;
node->flags &= ~NODE_FLAGS_EMPTY;
}
return KNOT_EOK;
......
......@@ -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
knot_rrset_t soa = knot_node_rrset(zone->apex, KNOT_RRTYPE_SOA);
knot_rrset_t rrsigs = knot_node_rrset(zone->apex, KNOT_RRTYPE_RRSIG);
knot_rrset_t soa = node_rrset(zone->apex, KNOT_RRTYPE_SOA);
knot_rrset_t rrsigs = node_rrset(zone->apex, KNOT_RRTYPE_RRSIG);
assert(!knot_rrset_empty(&soa));
result = knot_zone_sign_update_soa(&soa, &rrsigs, &zone_keys, &policy,
new_serial, out_ch);
......@@ -238,8 +238,8 @@ int knot_dnssec_sign_changeset(const knot_zone_contents_t *zone,
}
// Update SOA RRSIGs
knot_rrset_t soa = knot_node_rrset(zone->apex, KNOT_RRTYPE_SOA);
knot_rrset_t rrsigs = knot_node_rrset(zone->apex, KNOT_RRTYPE_RRSIG);
knot_rrset_t soa = node_rrset(zone->apex, KNOT_RRTYPE_SOA);
knot_rrset_t rrsigs = node_rrset(zone->apex, KNOT_RRTYPE_RRSIG);
ret = knot_zone_sign_update_soa(&soa, &rrsigs, &zone_keys, &policy,
new_serial, out_ch);
if (ret != KNOT_EOK) {
......
......@@ -92,8 +92,8 @@ static bool get_zone_soa_min_ttl(const knot_zone_contents_t *zone,
assert(zone->apex);
assert(ttl);
knot_node_t *apex = zone->apex;
const knot_rdataset_t *soa = knot_node_rdataset(apex, KNOT_RRTYPE_SOA);
zone_node_t *apex = zone->apex;
const knot_rdataset_t *soa = node_rdataset(apex, KNOT_RRTYPE_SOA);
if (!soa) {
return false;
}
......@@ -124,7 +124,7 @@ static int mark_nsec3(knot_rrset_t *rrset, void *data)
assert(data != NULL);
knot_zone_tree_t *nsec3s = (knot_zone_tree_t *)data;
knot_node_t *node = NULL;
zone_node_t *node = NULL;
int ret;
if (rrset->type == KNOT_RRTYPE_NSEC3) {
......@@ -136,7 +136,7 @@ static int mark_nsec3(knot_rrset_t *rrset, void *data)
}
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,
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,
knot_changeset_t *changeset)
{
......@@ -462,7 +462,7 @@ static int remove_standalone_rrsigs(const knot_node_t *node,
uint16_t rrsigs_rdata_count = rrsigs->rrs.rr_count;
for (uint16_t i = 0; i < rrsigs_rdata_count; ++i) {
uint16_t type_covered = knot_rrsig_type_covered(&rrsigs->rrs, i);
if (!knot_node_rrtype_exists(node, type_covered)) {
if (!node_rrtype_exists(node, type_covered)) {
knot_rrset_t *to_remove = knot_rrset_new(rrsigs->owner,
rrsigs->type,
rrsigs->rclass,
......@@ -499,7 +499,7 @@ static int remove_standalone_rrsigs(const knot_node_t *node,
*
* \return Error code, KNOT_EOK if successful.
*/
static int sign_node_rrsets(const knot_node_t *node,
static int sign_node_rrsets(const zone_node_t *node,
const knot_zone_keys_t *zone_keys,
const knot_dnssec_policy_t *policy,
knot_changeset_t *changeset,
......@@ -509,10 +509,10 @@ static int sign_node_rrsets(const knot_node_t *node,
assert(policy);
int result = KNOT_EOK;
knot_rrset_t rrsigs = knot_node_rrset(node, KNOT_RRTYPE_RRSIG);
knot_rrset_t rrsigs = node_rrset(node, KNOT_RRTYPE_RRSIG);
for (int i = 0; i < node->rrset_count; i++) {
knot_rrset_t rrset = knot_node_rrset_at(node, i);
knot_rrset_t rrset = node_rrset_at(node, i);
if (rrset.type == KNOT_RRTYPE_RRSIG) {
continue;
}
......@@ -558,7 +558,7 @@ typedef struct node_sign_args {
* \param node Node to be signed.
* \param data Callback data, node_sign_args_t.
*/
static int sign_node(knot_node_t **node, void *data)
static int sign_node(zone_node_t **node, void *data)
{
assert(node && *node);
assert(data);
......@@ -569,13 +569,13 @@ static int sign_node(knot_node_t **node, void *data)
return KNOT_EOK;
}
if ((*node)->flags & KNOT_NODE_FLAGS_NONAUTH) {
if ((*node)->flags & NODE_FLAGS_NONAUTH) {
return KNOT_EOK;
}
int result = sign_node_rrsets(*node, args->zone_keys, args->policy,
args->changeset, &args->expires_at);
(*node)->flags &= ~KNOT_NODE_FLAGS_REMOVED_NSEC;
(*node)->flags &= ~NODE_FLAGS_REMOVED_NSEC;
return result;
}
......@@ -987,10 +987,10 @@ static int update_dnskeys(const knot_zone_contents_t *zone,
assert(zone->apex);
assert(changeset);
const knot_node_t *apex = zone->apex;
knot_rrset_t dnskeys = knot_node_rrset(apex, KNOT_RRTYPE_DNSKEY);
knot_rrset_t soa = knot_node_rrset(apex, KNOT_RRTYPE_SOA);
knot_rrset_t rrsigs = knot_node_rrset(apex, KNOT_RRTYPE_RRSIG);
const zone_node_t *apex = zone->apex;
knot_rrset_t dnskeys = node_rrset(apex, KNOT_RRTYPE_DNSKEY);
knot_rrset_t soa = node_rrset(apex, KNOT_RRTYPE_SOA);
knot_rrset_t rrsigs = node_rrset(apex, KNOT_RRTYPE_RRSIG);
if (knot_rrset_empty(&soa)) {
return KNOT_EINVAL;
}
......@@ -1157,13 +1157,13 @@ static int sign_changeset_wrap(knot_rrset_t *chg_rrset, void *data)
{
changeset_signing_data_t *args = (changeset_signing_data_t *)data;
// Find RR's node in zone, find out if we need to sign this RR
const knot_node_t *node =
const zone_node_t *node =
knot_zone_contents_find_node(args->zone, chg_rrset->owner);
// If node is not in zone, all its RRSIGs were dropped - no-op
if (node) {
knot_rrset_t zone_rrset = knot_node_rrset(node, chg_rrset->type);
knot_rrset_t rrsigs = knot_node_rrset(node, KNOT_RRTYPE_RRSIG);
knot_rrset_t zone_rrset = node_rrset(node, chg_rrset->type);
knot_rrset_t rrsigs = node_rrset(node, KNOT_RRTYPE_RRSIG);
bool should_sign = false;
int ret = knot_zone_sign_rr_should_be_signed(node, &zone_rrset,
......@@ -1306,8 +1306,8 @@ bool knot_zone_sign_soa_expired(const knot_zone_contents_t *zone,
return KNOT_EINVAL;
}
knot_rrset_t soa = knot_node_rrset(zone->apex, KNOT_RRTYPE_SOA);
knot_rrset_t rrsigs = knot_node_rrset(zone->apex, KNOT_RRTYPE_RRSIG);
knot_rrset_t soa = node_rrset(zone->apex, KNOT_RRTYPE_SOA);
knot_rrset_t rrsigs = node_rrset(zone->apex, KNOT_RRTYPE_RRSIG);
assert(!knot_rrset_empty(&soa));
return !all_signatures_exist(&soa, &rrsigs, zone_keys, policy);
}
......@@ -1459,7 +1459,7 @@ int knot_zone_sign_nsecs_in_changeset(const knot_zone_keys_t *zone_keys,
* true for all types that should be signed, do not use this as an
* universal function, it is implementation specific.
*/
int knot_zone_sign_rr_should_be_signed(const knot_node_t *node,
int knot_zone_sign_rr_should_be_signed(const zone_node_t *node,
const knot_rrset_t *rrset,
bool *should_sign)
{
......@@ -1478,7 +1478,7 @@ int knot_zone_sign_rr_should_be_signed(const knot_node_t *node,
}
// SOA and DNSKEYs are handled separately in the zone apex
if (node->flags & KNOT_NODE_FLAGS_APEX) {
if (node_rrtype_exists(node, KNOT_RRTYPE_SOA)) {
if (rrset->type == KNOT_RRTYPE_SOA) {
return KNOT_EOK;
}
......@@ -1489,7 +1489,7 @@ int knot_zone_sign_rr_should_be_signed(const knot_node_t *node,
}
// At delegation points we only want to sign NSECs and DSs
if ((node->flags & KNOT_NODE_FLAGS_DELEG)) {
if ((node->flags & NODE_FLAGS_DELEG)) {
if (!(rrset->type == KNOT_RRTYPE_NSEC ||
rrset->type == KNOT_RRTYPE_DS)) {
return KNOT_EOK;
......@@ -1497,7 +1497,7 @@ int knot_zone_sign_rr_should_be_signed(const knot_node_t *node,
}
// These RRs have their signatures stored in changeset already
if (node->flags & KNOT_NODE_FLAGS_REMOVED_NSEC
if (node->flags & NODE_FLAGS_REMOVED_NSEC
&& ((rrset->type == KNOT_RRTYPE_NSEC)
|| (rrset->type == KNOT_RRTYPE_NSEC3))) {
return KNOT_EOK;
......
......@@ -135,7 +135,7 @@ int knot_zone_sign_nsecs_in_changeset(const knot_zone_keys_t *zone_keys,
*
* \return KNOT_E*
*/
int knot_zone_sign_rr_should_be_signed(const knot_node_t *node,
int knot_zone_sign_rr_should_be_signed(const zone_node_t *node,
const knot_rrset_t *rrset,
bool *should_sign);
......
......@@ -29,7 +29,7 @@ struct axfr_proc {
unsigned cur_rrset;
};
static int put_rrsets(knot_pkt_t *pkt, knot_node_t *node, struct axfr_proc *state)
static int put_rrsets(knot_pkt_t *pkt, zone_node_t *node, struct axfr_proc *state)
{
int ret = KNOT_EOK;
int i = state->cur_rrset;
......@@ -38,7 +38,7 @@ static int put_rrsets(knot_pkt_t *pkt, knot_node_t *node, struct axfr_proc *stat
/* Append all RRs. */
for (;i < rrset_count; ++i) {
knot_rrset_t rrset = knot_node_rrset_at(node, i);
knot_rrset_t rrset = node_rrset_at(node, i);
if (rrset.type == KNOT_RRTYPE_SOA) {
continue;
}
......@@ -65,9 +65,9 @@ static int axfr_process_node_tree(knot_pkt_t *pkt, const void *item, struct xfr_
/* Put responses. */
int ret = KNOT_EOK;
knot_node_t *node = NULL;
zone_node_t *node = NULL;
while(!hattrie_iter_finished(axfr->i)) {
node = (knot_node_t *)*hattrie_iter_val(axfr->i);
node = (zone_node_t *)*hattrie_iter_val(axfr->i);
ret = put_rrsets(pkt, node, axfr);
if (ret != KNOT_EOK) {
break;
......@@ -134,7 +134,7 @@ int xfr_process_list(knot_pkt_t *pkt, xfr_put_cb process_item, struct query_data
mm_ctx_t *mm = qdata->mm;
struct xfr_proc *xfer = qdata->ext;
knot_zone_contents_t *zone = qdata->zone->contents;
knot_rrset_t soa_rr = knot_node_rrset(zone->apex, KNOT_RRTYPE_SOA);
knot_rrset_t soa_rr = node_rrset(zone->apex, KNOT_RRTYPE_SOA);
/* Prepend SOA on first packet. */
if (xfer->npkts == 0) {
......
......@@ -27,7 +27,7 @@
#include "knot/server/zones.h"
/*! \brief Check if given node was already visited. */
static int wildcard_has_visited(struct query_data *qdata, const knot_node_t *node)
static int wildcard_has_visited(struct query_data *qdata, const zone_node_t *node)
{
struct wildcard_hit *item = NULL;
WALK_LIST(item, qdata->wildcards) {
......@@ -39,7 +39,7 @@ static int wildcard_has_visited(struct query_data *qdata, const knot_node_t *nod
}
/*! \brief Mark given node as visited. */
static int wildcard_visit(struct query_data *qdata, const knot_node_t *node, const knot_dname_t *sname)
static int wildcard_visit(struct query_data *qdata, const zone_node_t *node, const knot_dname_t *sname)
{
assert(qdata);
assert(node);
......@@ -193,7 +193,7 @@ static int put_answer(knot_pkt_t *pkt, uint16_t type, struct query_data *qdata)
return KNOT_ESPACE;
}
for (unsigned i = 0; i < qdata->node->rrset_count; ++i) {
rrset = knot_node_rrset_at(qdata->node, i);
rrset = node_rrset_at(qdata->node, i);
ret = ns_put_rr(pkt, &rrset, NULL, compr_hint, 0, qdata);
if (ret != KNOT_EOK) {
break;
......@@ -202,9 +202,9 @@ static int put_answer(knot_pkt_t *pkt, uint16_t type, struct query_data *qdata)
break;
}
default: /* Single RRSet of given type. */
rrset = knot_node_rrset(qdata->node, type);
rrset = node_rrset(qdata->node, type);
if (!knot_rrset_empty(&rrset)) {
knot_rrset_t rrsigs = knot_node_rrset(qdata->node, KNOT_RRTYPE_RRSIG);
knot_rrset_t rrsigs = node_rrset(qdata->node, KNOT_RRTYPE_RRSIG);
ret = ns_put_rr(pkt, &rrset, &rrsigs, compr_hint, 0, qdata);
}
break;
......@@ -231,9 +231,9 @@ static int put_authority_ns(knot_pkt_t *pkt, struct query_data *qdata)
return KNOT_EOK;
}
knot_rrset_t ns_rrset = knot_node_rrset(zone->apex, KNOT_RRTYPE_NS);
knot_rrset_t ns_rrset = node_rrset(zone->apex, KNOT_RRTYPE_NS);
if (!knot_rrset_empty(&ns_rrset)) {
knot_rrset_t rrsigs = knot_node_rrset(zone->apex, KNOT_RRTYPE_RRSIG);
knot_rrset_t rrsigs = node_rrset(zone->apex, KNOT_RRTYPE_RRSIG);
return ns_put_rr(pkt, &ns_rrset, &rrsigs, COMPR_HINT_NONE,
KNOT_PF_NOTRUNC|KNOT_PF_CHECKDUP, qdata);
} else {
......@@ -247,8 +247,8 @@ static int put_authority_soa(knot_pkt_t *pkt, struct query_data *qdata,
const knot_zone_contents_t *zone)
{
dbg_ns("%s(%p, %p)\n"