Commit 46c7232d authored by Lubos Slovak's avatar Lubos Slovak

Refactoring - removed old/new node notion.

refs #1550
parent 64425118
......@@ -770,7 +770,7 @@ static int check_nsec3_node_in_zone(knot_zone_contents_t *zone, knot_node_t *nod
err_handler_t *handler)
{
assert(handler);
const knot_node_t *nsec3_node = knot_node_nsec3_node(node, 0);
const knot_node_t *nsec3_node = knot_node_nsec3_node(node);
if (nsec3_node == NULL) {
/* I know it's probably not what RFCs say, but it will have to
......@@ -787,7 +787,7 @@ static int check_nsec3_node_in_zone(knot_zone_contents_t *zone, knot_node_t *nod
if (knot_zone_contents_find_nsec3_for_name(zone,
knot_node_owner(node),
&nsec3_node,
&nsec3_previous, 0) != 0) {
&nsec3_previous) != 0) {
err_handler_handle_error(handler, node,
ZC_ERR_NSEC3_NOT_FOUND);
}
......
......@@ -406,9 +406,9 @@ static void knot_node_dump_binary(knot_node_t *node, void *data,
fwrite_wrapper(&owner_id, sizeof(owner_id), 1, f, stream, stream_size,
crc);
if (knot_node_parent(node, 0) != NULL) {
if (knot_node_parent(node) != NULL) {
uint32_t parent_id = knot_dname_id(
knot_node_owner(knot_node_parent(node, 0)));
knot_node_owner(knot_node_parent(node)));
fwrite_wrapper(&parent_id, sizeof(parent_id), 1, f,
stream, stream_size, crc);
} else {
......@@ -422,13 +422,13 @@ static void knot_node_dump_binary(knot_node_t *node, void *data,
dbg_zdump("Written flags: %u\n", node->flags);
if (knot_node_nsec3_node(node, 0) != NULL) {
if (knot_node_nsec3_node(node) != NULL) {
uint32_t nsec3_id =
knot_node_owner(knot_node_nsec3_node(node, 0))->id;
knot_node_owner(knot_node_nsec3_node(node))->id;
fwrite_wrapper(&nsec3_id, sizeof(nsec3_id), 1, f,
stream, stream_size, crc);
dbg_zdump("Written nsec3 node id: %u\n",
knot_node_owner(knot_node_nsec3_node(node, 0))->id);
knot_node_owner(knot_node_nsec3_node(node))->id);
} else {
uint32_t nsec3_id = 0;
fwrite_wrapper(&nsec3_id, sizeof(nsec3_id), 1, f,
......
......@@ -310,7 +310,7 @@ static knot_rdata_t *knot_load_rdata(uint16_t type, FILE *f,
} else if (use_ids && !in_the_zone) { /* destroy the node */
if (id_array[dname_id]->node != NULL) {
knot_node_free(&id_array[dname_id]->
node, 0, 0);
node, 0);
}
/* Also sets node to NULL! */
}
......@@ -571,7 +571,7 @@ static knot_node_t *knot_load_node(FILE *f, knot_dname_t **id_array)
if (parent_id != 0) {
knot_node_set_parent(node, id_array[parent_id]->node);
assert(knot_node_parent(node, 0) != NULL);
assert(knot_node_parent(node) != NULL);
} else {
knot_node_set_parent(node, NULL);
}
......@@ -580,7 +580,7 @@ static knot_node_t *knot_load_node(FILE *f, knot_dname_t **id_array)
for (int i = 0; i < rrset_count; i++) {
if ((tmp_rrset = knot_load_rrset(f, id_array, 1)) == NULL) {
knot_node_free(&node, 1, 0);
knot_node_free(&node, 0);
//TODO what else to free?
fprintf(stderr, "zone: Could not load rrset.\n");
return NULL;
......@@ -1064,8 +1064,7 @@ knot_zone_t *knot_zload_load(zloader_t *loader)
}
}
assert(knot_node_previous(knot_zone_contents_apex(contents), 0)
== NULL);
assert(knot_node_previous(knot_zone_contents_apex(contents)) == NULL);
knot_node_set_previous(knot_zone_contents_get_apex(contents),
last_node);
......@@ -1119,7 +1118,7 @@ knot_zone_t *knot_zload_load(zloader_t *loader)
}
if (nsec3_node_count) {
assert(knot_node_previous(nsec3_first, 0) == NULL);
assert(knot_node_previous(nsec3_first) == NULL);
knot_node_set_previous(nsec3_first, last_node);
/* CLEANUP */
// nsec3_first->prev = last_node;
......
......@@ -693,27 +693,20 @@ uint8_t knot_dname_size_part(const knot_dname_t *dname, int labels)
/*----------------------------------------------------------------------------*/
const struct knot_node *knot_dname_node(const knot_dname_t *dname,
int check_version)
const struct knot_node *knot_dname_node(const knot_dname_t *dname)
{
if (check_version) {
return knot_node_current(dname->node);
} else {
return dname->node;
}
return knot_dname_get_node(dname);
}
/*----------------------------------------------------------------------------*/
struct knot_node *knot_dname_get_node(knot_dname_t *dname,
int check_version)
struct knot_node *knot_dname_get_node(knot_dname_t *dname)
{
if (check_version) {
return knot_node_get_current(dname->node);
} else {
return dname->node;
if (dname == NULL) {
return NULL;
}
return dname->node;
}
/*----------------------------------------------------------------------------*/
......
......@@ -215,11 +215,9 @@ uint8_t knot_dname_size_part(const knot_dname_t *dname, int labels);
*
* \return Zone node the domain name belongs to or NULL if none.
*/
const struct knot_node *knot_dname_node(const knot_dname_t *dname,
int check_version);
const struct knot_node *knot_dname_node(const knot_dname_t *dname);
struct knot_node *knot_dname_get_node(knot_dname_t *dname,
int check_version);
struct knot_node *knot_dname_get_node(knot_dname_t *dname);
void knot_dname_set_node(knot_dname_t *dname, struct knot_node *node);
......
......@@ -312,7 +312,7 @@ dbg_ns_exec(
knot_rrset_rdata(cname_rrset));
dbg_ns("CNAME name from RDATA: %p\n", cname);
// change the node to the node of that name
*node = knot_dname_node(cname, 1);
*node = knot_dname_node(cname);
dbg_ns("This name's node: %p\n", *node);
// // it is not an old node and if yes, skip it
// if (knot_node_is_old(*node)) {
......@@ -473,7 +473,7 @@ static void ns_put_additional_for_rrset(knot_packet_t *resp,
dname = knot_rdata_get_name(rdata,
knot_rrset_type(rrset));
assert(dname != NULL);
node = knot_dname_node(dname, 1);
node = knot_dname_node(dname);
// // check if the node is not old and if yes, take the new one
// if (knot_node_is_old(node)) {
// node = knot_node_new_node(node);
......@@ -485,7 +485,7 @@ static void ns_put_additional_for_rrset(knot_packet_t *resp,
// the stored node should be the closest encloser
assert(knot_dname_is_subdomain(dname, node->owner));
// try the wildcard child, if any
node = knot_node_wildcard_child(node, 1);
node = knot_node_wildcard_child(node);
// // this should not be old node!!
// assert(!knot_node_is_old(node));
}
......@@ -731,10 +731,10 @@ static int ns_put_covering_nsec3(const knot_zone_contents_t *zone,
const knot_node_t *prev, *node;
/*! \todo Check version. */
int match = knot_zone_contents_find_nsec3_for_name(zone, name,
&node, &prev, 1);
&node, &prev);
assert(match >= 0);
node = knot_node_current(node);
prev = knot_node_current(prev);
// node = knot_node_current(node);
// prev = knot_node_current(prev);
if (match == KNOT_ZONE_NAME_FOUND){
// run-time collision => SERVFAIL
......@@ -811,10 +811,10 @@ dbg_ns_exec(
*/
const knot_node_t *nsec3_node = NULL;
const knot_dname_t *next_closer = NULL;
while ((nsec3_node = knot_node_nsec3_node((*closest_encloser), 1))
while ((nsec3_node = knot_node_nsec3_node((*closest_encloser)))
== NULL) {
next_closer = knot_node_owner((*closest_encloser));
*closest_encloser = knot_node_parent(*closest_encloser, 1);
*closest_encloser = knot_node_parent(*closest_encloser);
if (*closest_encloser == NULL) {
// there are no NSEC3s to add
return KNOT_EOK;
......@@ -957,7 +957,7 @@ static void ns_put_nsec_nsec3_nodata(const knot_node_t *node,
return;
}
knot_node_t *nsec3_node = knot_node_get_nsec3_node(node, 1);
knot_node_t *nsec3_node = knot_node_get_nsec3_node(node);
knot_rrset_t *rrset = NULL;
if ((rrset = knot_node_get_rrset(node, KNOT_RRTYPE_NSEC)) != NULL
|| (nsec3_node != NULL && (rrset =
......@@ -1003,10 +1003,10 @@ static int ns_put_nsec_nxdomain(const knot_dname_t *qname,
previous = knot_zone_contents_find_previous(zone, qname);
while (!knot_node_is_auth(previous)) {
previous = knot_node_previous(previous, 1);
previous = knot_node_previous(previous);
}
previous = knot_node_current(previous);
//previous = knot_node_current(previous);
assert(previous != NULL);
}
......@@ -1047,7 +1047,7 @@ static int ns_put_nsec_nxdomain(const knot_dname_t *qname,
dbg_ns("Previous node: %s\n",
knot_dname_to_str(knot_node_owner(prev_new)));
assert(prev_new != knot_zone_contents_apex(zone));
prev_new = knot_node_previous(prev_new, 1);
prev_new = knot_node_previous(prev_new);
}
assert(knot_dname_compare(knot_node_owner(prev_new),
wildcard) < 0);
......@@ -1228,10 +1228,10 @@ static void ns_put_nsec_wildcard(const knot_zone_contents_t *zone,
previous = knot_zone_contents_find_previous(zone, qname);
while (!knot_node_is_auth(previous)) {
previous = knot_node_previous(previous, 1);
previous = knot_node_previous(previous);
}
previous = knot_node_current(previous);
// previous = knot_node_current(previous);
assert(previous != NULL);
}
......@@ -1280,7 +1280,7 @@ static int ns_put_nsec_nsec3_wildcard_nodata(const knot_node_t *node,
const knot_node_t *nsec3_node;
if (ret == KNOT_EOK
&& (nsec3_node = knot_node_nsec3_node(node, 1))
&& (nsec3_node = knot_node_nsec3_node(node))
!= NULL) {
ns_put_nsec3_from_node(nsec3_node, resp);
}
......@@ -1355,8 +1355,8 @@ static inline int ns_referral(const knot_node_t *node,
dbg_ns("Referral response.\n");
while (!knot_node_is_deleg_point(node)) {
assert(knot_node_parent(node, 1) != NULL);
node = knot_node_parent(node, 1);
assert(knot_node_parent(node) != NULL);
node = knot_node_parent(node);
}
knot_rrset_t *rrset = knot_node_get_rrset(node, KNOT_RRTYPE_NS);
......@@ -1387,7 +1387,7 @@ static inline int ns_referral(const knot_node_t *node,
// if NSEC3 enabled, search for NSEC3
if (knot_zone_contents_nsec3_enabled(zone)) {
const knot_node_t *nsec3_node =
knot_node_nsec3_node(node, 1);
knot_node_nsec3_node(node);
dbg_ns("There is no DS, putting NSEC3s...\n");
if (nsec3_node != NULL) {
dbg_ns("Putting NSEC3s from the node.\n");
......@@ -1465,7 +1465,7 @@ static int ns_answer_from_node(const knot_node_t *node,
//assert(knot_node_rrset_count(closest_encloser) > 0);
dbg_ns("Adding NSEC/NSEC3 for NXDOMAIN.\n");
ret = ns_put_nsec_nsec3_nxdomain(zone,
knot_node_previous(node, 1), closest_encloser,
knot_node_previous(node), closest_encloser,
qname, resp);
} else {
dbg_ns("Adding NSEC/NSEC3 for NODATA.\n");
......@@ -1741,7 +1741,7 @@ have_node:
}
// else check for a wildcard child
const knot_node_t *wildcard_node =
knot_node_wildcard_child(closest_encloser, 1);
knot_node_wildcard_child(closest_encloser);
if (wildcard_node == NULL) {
dbg_ns("No wildcard node. (cname: %d)\n",
......
......@@ -233,10 +233,10 @@ dbg_response_exec(
// If case-sensitive search is in place, we should not save the
// node's parent's positions.
to_save = !compr_cs && (knot_dname_node(to_save, 1) != NULL
&& knot_node_parent(knot_dname_node(to_save, 1), 1)
to_save = !compr_cs && (knot_dname_node(to_save) != NULL
&& knot_node_parent(knot_dname_node(to_save))
!= NULL) ? knot_node_owner(knot_node_parent(
knot_dname_node(to_save, 1), 1))
knot_dname_node(to_save)))
: NULL;
dbg_response("i: %d\n", i);
......@@ -391,31 +391,31 @@ dbg_response_exec(
}
#else
// if case-sensitive comparation, we cannot just take the parent
if (compr_cs || knot_dname_node(to_find, 1) == NULL
|| knot_node_owner(knot_dname_node(to_find, 1)) != to_find
|| knot_node_parent(knot_dname_node(to_find, 1), 1)
if (compr_cs || knot_dname_node(to_find) == NULL
|| knot_node_owner(knot_dname_node(to_find)) != to_find
|| knot_node_parent(knot_dname_node(to_find))
== NULL) {
dbg_response("compr_cs: %d\n", compr_cs);
dbg_response("knot_dname_node(to_find, 1) == %p"
"\n", knot_dname_node(to_find, 1));
"\n", knot_dname_node(to_find));
if (knot_dname_node(to_find, 1) != NULL) {
if (knot_dname_node(to_find) != NULL) {
dbg_response("knot_node_owner(knot_dname_node("
"to_find, 1)) = %p, to_find = %p\n",
knot_node_owner(knot_dname_node(to_find, 1)),
knot_node_owner(knot_dname_node(to_find)),
to_find);
dbg_response("knot_node_parent(knot_dname_node("
"to_find, 1), 1) = %p\n",
knot_node_parent(knot_dname_node(to_find, 1), 1));
knot_node_parent(knot_dname_node(to_find)));
}
break;
} else {
assert(knot_dname_node(to_find, 1) !=
knot_node_parent(knot_dname_node(to_find, 1), 1));
assert(knot_dname_node(to_find) !=
knot_node_parent(knot_dname_node(to_find)));
assert(to_find != knot_node_owner(
knot_node_parent(knot_dname_node(to_find, 1), 1)));
knot_node_parent(knot_dname_node(to_find))));
to_find = knot_node_owner(
knot_node_parent(knot_dname_node(to_find, 1), 1));
knot_node_parent(knot_dname_node(to_find)));
dbg_response("New to_find: %p\n", to_find);
}
#endif
......
......@@ -506,7 +506,7 @@ int xfrin_process_axfr_packet(/*const uint8_t *pkt, size_t size,
dbg_xfrin("No zone created, but the first RR in "
"Answer is not a SOA RR.\n");
knot_packet_free(&packet);
knot_node_free(&node, 0, 0);
knot_node_free(&node, 0);
knot_rrset_deep_free(&rr, 1, 1, 1);
/*! \todo Cleanup. */
return KNOT_EMALF;
......@@ -528,7 +528,7 @@ dbg_xfrin_exec(
);
/*! \todo Cleanup. */
knot_packet_free(&packet);
knot_node_free(&node, 0, 0);
knot_node_free(&node, 0);
knot_rrset_deep_free(&rr, 1, 1, 1);
return KNOT_EMALF;
}
......@@ -549,7 +549,7 @@ dbg_xfrin_exec(
if (*constr == NULL) {
dbg_xfrin("Failed to create new constr. zone.\n");
knot_packet_free(&packet);
knot_node_free(&node, 0, 0);
knot_node_free(&node, 0);
knot_rrset_deep_free(&rr, 1, 1, 1);
return KNOT_ENOMEM;
}
......@@ -561,7 +561,7 @@ dbg_xfrin_exec(
if ((*constr)->contents== NULL) {
dbg_xfrin("Failed to create new zone.\n");
knot_packet_free(&packet);
knot_node_free(&node, 0, 0);
knot_node_free(&node, 0);
knot_rrset_deep_free(&rr, 1, 1, 1);
/*! \todo Cleanup. */
return KNOT_ENOMEM;
......@@ -580,7 +580,7 @@ dbg_xfrin_exec(
dbg_xfrin("Failed to add RRSet to zone node: %s.\n",
knot_strerror(ret));
knot_packet_free(&packet);
knot_node_free(&node, 0, 0);
knot_node_free(&node, 0);
knot_rrset_deep_free(&rr, 1, 1, 1);
/*! \todo Cleanup. */
return KNOT_ERROR;
......@@ -696,7 +696,7 @@ dbg_xfrin_exec(
dbg_xfrin("Failed to save orphan"
" RRSIGs.\n");
knot_packet_free(&packet);
knot_node_free(&node, 1, 0); // ???
knot_node_free(&node, 0); // ???
knot_rrset_deep_free(&rr, 1, 1, 1);
return ret;
}
......@@ -704,7 +704,7 @@ dbg_xfrin_exec(
dbg_xfrin("Failed to add RRSIGs (%s).\n",
knot_strerror(ret));
knot_packet_free(&packet);
knot_node_free(&node, 1, 0); // ???
knot_node_free(&node, 0); // ???
knot_rrset_deep_free(&rr, 1, 1, 1);
return KNOT_ERROR; /*! \todo Other error code. */
} else if (ret == 1) {
......@@ -744,7 +744,7 @@ dbg_xfrin_exec(
// not allowed here
dbg_xfrin(" in Answer section.\n");
knot_packet_free(&packet);
knot_node_free(&node, 1, 0); // ???
knot_node_free(&node, 0); // ???
knot_rrset_deep_free(&rr, 1, 1, 1);
return KNOT_EMALF;
}
......@@ -787,7 +787,7 @@ dbg_xfrin_exec(
dbg_xfrin("Failed to add RRSet to node (%s"
")\n", knot_strerror(ret));
knot_packet_free(&packet);
knot_node_free(&node, 1, 0); // ???
knot_node_free(&node, 0); // ???
knot_rrset_deep_free(&rr, 1, 1, 1);
return KNOT_ERROR;
} else if (ret > 0) {
......@@ -803,7 +803,7 @@ dbg_xfrin_exec(
dbg_xfrin("Failed to add node to zone (%s)"
".\n", knot_strerror(ret));
knot_packet_free(&packet);
knot_node_free(&node, 1, 0); // ???
knot_node_free(&node, 0); // ???
knot_rrset_deep_free(&rr, 1, 1, 1);
return KNOT_ERROR;
}
......@@ -839,7 +839,7 @@ dbg_xfrin_exec(
dbg_xfrin("Could not parse next RR: %s.\n",
knot_strerror(ret));
knot_packet_free(&packet);
knot_node_free(&node, 0, 0);
knot_node_free(&node, 0);
knot_rrset_deep_free(&rr, 1, 1, 1);
/*! \todo Cleanup. */
return KNOT_EMALF;
......@@ -856,7 +856,7 @@ dbg_xfrin_exec(
dbg_xfrin("Failed to add last node into zone (%s)"
".\n", knot_strerror(ret));
knot_packet_free(&packet);
knot_node_free(&node, 1, 0);
knot_node_free(&node, 0);
return KNOT_ERROR; /*! \todo Other error */
}
}
......@@ -1392,9 +1392,9 @@ static void xfrin_zone_contents_free(knot_zone_contents_t **contents)
// free the zone tree with nodes
dbg_zone("Destroying zone tree.\n");
knot_zone_tree_deep_free(&(*contents)->nodes, 1);
knot_zone_tree_deep_free(&(*contents)->nodes);
dbg_zone("Destroying NSEC3 zone tree.\n");
knot_zone_tree_deep_free(&(*contents)->nsec3_nodes, 1);
knot_zone_tree_deep_free(&(*contents)->nsec3_nodes);
knot_nsec3_params_free(&(*contents)->nsec3_params);
......@@ -2184,9 +2184,9 @@ static void xfrin_zone_contents_free2(knot_zone_contents_t **contents)
// free the zone tree, but only the structure
// (nodes are already destroyed)
dbg_zone("Destroying zone tree.\n");
knot_zone_tree_deep_free(&(*contents)->nodes, 0);
knot_zone_tree_deep_free(&(*contents)->nodes);
dbg_zone("Destroying NSEC3 zone tree.\n");
knot_zone_tree_deep_free(&(*contents)->nsec3_nodes, 0);
knot_zone_tree_deep_free(&(*contents)->nsec3_nodes);
knot_nsec3_params_free(&(*contents)->nsec3_params);
......@@ -2765,7 +2765,7 @@ static int xfrin_remove_empty_nodes(knot_zone_contents_t *contents,
free(hash_item);
free(zone_node);
knot_node_free(&changes->old_nodes[i], 1, 1);
knot_node_free(&changes->old_nodes[i], 1);
}
changes->old_nodes_count = 0;
......
This diff is collapsed.
......@@ -214,8 +214,7 @@ const int knot_node_count_rrsets(const knot_node_t *node);
* \return Parent node of the given node or NULL if no parent has been set (e.g.
* node in a zone apex has no parent).
*/
const knot_node_t *knot_node_parent(const knot_node_t *node,
int check_version);
const knot_node_t *knot_node_parent(const knot_node_t *node);
/*!
* \brief Sets the parent of the node.
......@@ -237,8 +236,7 @@ unsigned int knot_node_children(const knot_node_t *node);
* the first node in zone if \a node is the last node in zone.
* \retval NULL if previous node is not set.
*/
const knot_node_t *knot_node_previous(const knot_node_t *node,
int check_version);
const knot_node_t *knot_node_previous(const knot_node_t *node);
/*!
* \brief Returns the previous authoritative node or delegation point in
......@@ -253,8 +251,7 @@ const knot_node_t *knot_node_previous(const knot_node_t *node,
* the first node in zone if \a node is the last node in zone.
* \retval NULL if previous node is not set.
*/
knot_node_t *knot_node_get_previous(const knot_node_t *node,
int check_version);
knot_node_t *knot_node_get_previous(const knot_node_t *node);
const knot_node_t *knot_node_next(const knot_node_t *node);
......@@ -276,8 +273,7 @@ void knot_node_set_previous(knot_node_t *node, knot_node_t *prev);
* and the name of the zone \a node belongs to).
* \retval NULL if the NSEC3 node is not set.
*/
knot_node_t *knot_node_get_nsec3_node(const knot_node_t *node,
int check_version);
knot_node_t *knot_node_get_nsec3_node(const knot_node_t *node);
/*!
* \brief Returns the NSEC3 node corresponding to the given node.
......@@ -289,8 +285,7 @@ knot_node_t *knot_node_get_nsec3_node(const knot_node_t *node,
* and the name of the zone \a node belongs to).
* \retval NULL if the NSEC3 node is not set.
*/
const knot_node_t *knot_node_nsec3_node(const knot_node_t *node,
int check_version);
const knot_node_t *knot_node_nsec3_node(const knot_node_t *node);
/*!
* \brief Sets the corresponding NSEC3 node of the given node.
......@@ -331,8 +326,7 @@ void knot_node_set_owner(knot_node_t *node, knot_dname_t* owner);
*
* \return Wildcard child of the given node or NULL if it has none.
*/
const knot_node_t *knot_node_wildcard_child(const knot_node_t *node,
int check_version);
const knot_node_t *knot_node_wildcard_child(const knot_node_t *node);
/*!
* \brief Sets the wildcard child of the node.
......@@ -341,18 +335,17 @@ const knot_node_t *knot_node_wildcard_child(const knot_node_t *node,
* \param wildcard_child Wildcard child of the node.
*/
void knot_node_set_wildcard_child(knot_node_t *node,
knot_node_t *wildcard_child);
knot_node_t *wildcard_child);
const knot_node_t *knot_node_current(const knot_node_t *node);
//const knot_node_t *knot_node_current(const knot_node_t *node);
knot_node_t *knot_node_get_current(knot_node_t *node);
//knot_node_t *knot_node_get_current(knot_node_t *node);
const knot_node_t *knot_node_new_node(const knot_node_t *node);
knot_node_t *knot_node_get_new_node(const knot_node_t *node);
void knot_node_set_new_node(knot_node_t *node,
knot_node_t *new_node);
void knot_node_set_new_node(knot_node_t *node, knot_node_t *new_node);
void knot_node_set_zone(knot_node_t *node, struct knot_zone *zone);
......@@ -431,7 +424,7 @@ void knot_node_free_rrsets(knot_node_t *node, int free_rdata_dnames);
*
* \todo Document missing parameters.
*/
void knot_node_free(knot_node_t **node, int free_owner, int fix_refs);
void knot_node_free(knot_node_t **node, int fix_refs);
/*!
* \brief Compares two nodes according to their owner.
......
......@@ -128,7 +128,7 @@ static void knot_zone_contents_destroy_node_owner_from_tree(
UNUSED(data);
/*!< \todo change completely! */
knot_node_free(&tnode->node, 0, 0);
knot_node_free(&tnode->node, 0);
}
/*----------------------------------------------------------------------------*/
......@@ -462,8 +462,7 @@ static void knot_zone_contents_adjust_rrsets(knot_node_t *node,
* \param zone Zone the node belongs to.
*/
static void knot_zone_contents_adjust_node(knot_node_t *node,
knot_zone_contents_t *zone,
int check_ver)
knot_zone_contents_t *zone)
{
dbg_zone_exec(
......@@ -476,15 +475,15 @@ dbg_zone_exec(
knot_zone_contents_adjust_rrsets(node, zone);
dbg_zone_exec(
if (knot_node_parent(node, 1)) {
if (knot_node_parent(node)) {
char *name = knot_dname_to_str(knot_node_owner(
knot_node_parent(node, check_ver)));
knot_node_parent(node)));
dbg_zone("Parent: %s\n", name);
dbg_zone("Parent is delegation point: %s\n",
knot_node_is_deleg_point(knot_node_parent(node, check_ver))
knot_node_is_deleg_point(knot_node_parent(node))
? "yes" : "no");
dbg_zone("Parent is non-authoritative: %s\n",
knot_node_is_non_auth(knot_node_parent(node, check_ver))
knot_node_is_non_auth(knot_node_parent(node))
? "yes" : "no");
free(name);
} else {
......@@ -492,9 +491,9 @@ dbg_zone_exec(
}
);
// delegation point / non-authoritative node
if (knot_node_parent(node, check_ver)
&& (knot_node_is_deleg_point(knot_node_parent(node, check_ver))
|| knot_node_is_non_auth(knot_node_parent(node, check_ver)))) {
if (knot_node_parent(node)
&& (knot_node_is_deleg_point(knot_node_parent(node))
|| knot_node_is_non_auth(knot_node_parent(node)))) {
knot_node_set_non_auth(node);
} else if (knot_node_rrset(node, KNOT_RRTYPE_NS) != NULL
&& node != zone->apex) {
......@@ -502,7 +501,7 @@ dbg_zone_exec(
}
// assure that owner has proper node
if (knot_dname_node(knot_node_owner(node), 0) == NULL) {
if (knot_dname_node(knot_node_owner(node)) == NULL) {
knot_dname_set_node(knot_node_get_owner(node), node);
}
......@@ -511,8 +510,7 @@ dbg_zone_exec(
const knot_node_t *nsec3;
int match = knot_zone_contents_find_nsec3_for_name(zone,
knot_node_owner(node),
&nsec3, &prev,
check_ver);
&nsec3, &prev);
if (match != KNOT_ZONE_NAME_FOUND) {
nsec3 = NULL;
}
......@@ -581,7 +579,7 @@ static void knot_zone_contents_adjust_node_in_tree(
* 3) Do other adjusting (flags, closest enclosers, wildcard children,
* etc.).
*/
knot_zone_contents_adjust_node(node, zone, 0);
knot_zone_contents_adjust_node(node, zone);
/*
* 4) Store previous node depending on the type of this node.
......@@ -745,9 +743,9 @@ dbg_zone_exec(
* node. \a previous is set properly.
*/
static int knot_zone_contents_find_in_tree(knot_zone_tree_t *tree,
const knot_dname_t *name,
knot_node_t **node,
knot_node_t **previous)
const knot_dname_t *name,
knot_node_t **node,
knot_node_t **previous)
{
assert(tree != NULL);
assert(name != NULL);
......@@ -757,8 +755,8 @@ static int knot_zone_contents_find_in_tree(knot_zone_tree_t *tree,
knot_node_t *found = NULL, *prev = NULL;
// knot_node_t *found2 = NULL, *prev2 = NULL;
int exact_match = knot_zone_tree_get_less_or_equal(
tree, name, &found, &prev, 1);
int exact_match = knot_zone_tree_get_less_or_equal(tree, name, &found,
&prev);
// assert(prev != NULL);
assert(exact_match >= 0);
......@@ -906,7 +904,7 @@ static void knot_zone_contents_check_loops_in_tree(knot_zone_tree_node_t *tnode,
const knot_dname_t *next_name = knot_rdata_cname_name(
knot_rrset_rdata(cname));
assert(next_name != NULL);
const knot_node_t *next_node = knot_dname_node(next_name, 1);
const knot_node_t *next_node = knot_dname_node(next_name);
if (next_node == NULL) {
// try to find the name in the zone
const knot_node_t *ce = NULL;
......@@ -918,7 +916,7 @@ static void knot_zone_contents_check_loops_in_tree(knot_zone_tree_node_t *tnode,
// try to find wildcard child
assert(knot_dname_is_subdomain(next_name,
knot_node_owner(ce)));
next_node = knot_node_wildcard_child(ce, 1);
next_node = knot_node_wildcard_child(ce);
}
assert(next_node == NULL || knot_dname_compare(
......@@ -1302,7 +1300,7 @@ dbg_zone_exec(
}
// set the found parent (in the zone) as the parent of the last
// inserted node
assert(knot_node_parent(node, 0) == NULL);
assert(knot_node_parent(node) == NULL);
knot_node_set_parent(node, next_node);
dbg_zone("Created all parents.\n");
......@@ -1856,7 +1854,7 @@ dbg_zone_exec(
while (matched_labels < knot_dname_label_count(
knot_node_owner((*closest_encloser)))) {
(*closest_encloser) =
knot_node_parent((*closest_encloser), 1);
knot_node_parent((*closest_encloser));
assert(*closest_encloser);
}
}
......@@ -2044,8 +2042,7 @@ const knot_node_t *knot_zone_contents_find_nsec3_node(
int knot_zone_contents_find_nsec3_for_name(const knot_zone_contents_t *zone,
const knot_dname_t *name,
const knot_node_t **nsec3_node,
const knot_node_t **nsec3_previous,
int check_ver)
const knot_node_t **nsec3_previous)
{
if (zone == NULL || name == NULL
|| nsec3_node == NULL || nsec3_previous == NULL) {
......@@ -2069,7 +2066,7 @@ dbg_zone_exec(
// create dummy node to use for lookup
int exact_match = knot_zone_tree_find_less_or_equal(
zone->nsec3_nodes, nsec3_name, &found, &prev, check_ver);
zone->nsec3_nodes, nsec3_name, &found, &prev);
assert(exact_match >= 0);
knot_dname_release(nsec3_name);
......@@ -2100,7 +2097,7 @@ dbg_zone_exec(
// set the previous node of the found node
assert(exact_match);
assert(*nsec3_node != NULL);
*nsec3_previous = knot_node_previous(*nsec3_node, check_ver);
*nsec3_previous = knot_node_previous(*nsec3_node);
} else {
*nsec3_previous = prev;
}
......@@ -2756,9 +2753,9 @@ static void knot_zc_integrity_check_previous(const knot_node_t *node,
char *name_prev = knot_dname_to_str(