Commit f4332a07 authored by Marek Vavruša's avatar Marek Vavruša

zone: cleanup of zone, renaming, documentation

parent 8f039119
......@@ -147,7 +147,7 @@ static int remote_zone_sign(server_t *server, zone_t *zone)
free(zone_name);
if (zone->conf->dnssec_enable) {
zone->dnssec.next_force = true;
zone->flags |= ZONE_FORCE_RESIGN;
zone_events_schedule(zone, ZONE_EVENT_DNSSEC, ZONE_EVENT_NOW);
return KNOT_EOK;
}
......
......@@ -151,7 +151,7 @@ static int connect_nsec_nodes(zone_node_t *a, zone_node_t *b,
/*!
* \brief Call a function for each piece of the chain formed by sorted nodes.
*/
int knot_nsec_chain_iterate_create(knot_zone_tree_t *nodes,
int knot_nsec_chain_iterate_create(zone_tree_t *nodes,
chain_iterate_create_cb callback,
nsec_chain_iterate_data_t *data)
{
......
......@@ -83,7 +83,7 @@ inline static void bitmap_add_node_rrsets(bitmap_t *bitmap,
*
* \return Error code, KNOT_EOK if successful.
*/
int knot_nsec_chain_iterate_create(knot_zone_tree_t *nodes,
int knot_nsec_chain_iterate_create(zone_tree_t *nodes,
chain_iterate_create_cb callback,
nsec_chain_iterate_data_t *data);
......
......@@ -127,9 +127,9 @@ static int shallow_copy_signature(const zone_node_t *from, zone_node_t *to)
/*!
* \brief Reuse signatatures by shallow copying them from one tree to another.
*/
static int copy_signatures(const knot_zone_tree_t *from, knot_zone_tree_t *to)
static int copy_signatures(const zone_tree_t *from, zone_tree_t *to)
{
if (knot_zone_tree_is_empty(from)) {
if (zone_tree_is_empty(from)) {
return KNOT_EOK;
}
......@@ -142,7 +142,7 @@ static int copy_signatures(const knot_zone_tree_t *from, knot_zone_tree_t *to)
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);
zone_tree_get(to, node_from->owner, &node_to);
if (node_to == NULL) {
continue;
}
......@@ -166,7 +166,7 @@ static int copy_signatures(const knot_zone_tree_t *from, knot_zone_tree_t *to)
* \brief Custom NSEC3 tree free function.
*
*/
static void free_nsec3_tree(knot_zone_tree_t *nodes)
static void free_nsec3_tree(zone_tree_t *nodes)
{
assert(nodes);
......@@ -183,7 +183,7 @@ static void free_nsec3_tree(knot_zone_tree_t *nodes)
}
hattrie_iter_free(it);
knot_zone_tree_free(&nodes);
zone_tree_free(&nodes);
}
/* - NSEC3 nodes construction ----------------------------------------------- */
......@@ -414,7 +414,7 @@ static int connect_nsec3_nodes(zone_node_t *a, zone_node_t *b,
* \return Error code, KNOT_EOK if successful.
*/
static int create_nsec3_nodes(const zone_contents_t *zone, uint32_t ttl,
knot_zone_tree_t *nsec3_nodes,
zone_tree_t *nsec3_nodes,
changeset_t *chgset)
{
assert(zone);
......@@ -456,7 +456,7 @@ static int create_nsec3_nodes(const zone_contents_t *zone, uint32_t ttl,
break;
}
result = knot_zone_tree_insert(nsec3_nodes, nsec3_node);
result = zone_tree_insert(nsec3_nodes, nsec3_node);
if (result != KNOT_EOK) {
break;
}
......@@ -532,7 +532,7 @@ static void mark_empty_nodes_tmp(const zone_contents_t *zone)
{
assert(zone);
int ret = knot_zone_tree_apply(zone->nodes, nsec3_mark_empty, NULL);
int ret = zone_tree_apply(zone->nodes, nsec3_mark_empty, NULL);
assert(ret == KNOT_EOK);
}
......@@ -572,7 +572,7 @@ static void reset_nodes(const zone_contents_t *zone)
{
assert(zone);
int ret = knot_zone_tree_apply(zone->nodes, nsec3_reset, NULL);
int ret = zone_tree_apply(zone->nodes, nsec3_reset, NULL);
assert(ret == KNOT_EOK);
}
......@@ -590,7 +590,7 @@ int knot_nsec3_create_chain(const zone_contents_t *zone, uint32_t ttl,
int result;
knot_zone_tree_t *nsec3_nodes = knot_zone_tree_create();
zone_tree_t *nsec3_nodes = zone_tree_create();
if (!nsec3_nodes) {
return KNOT_ENOMEM;
}
......@@ -623,7 +623,7 @@ int knot_nsec3_create_chain(const zone_contents_t *zone, uint32_t ttl,
copy_signatures(zone->nsec3_nodes, nsec3_nodes);
result = knot_zone_tree_add_diff(zone->nsec3_nodes, nsec3_nodes,
result = zone_tree_add_diff(zone->nsec3_nodes, nsec3_nodes,
changeset);
free_nsec3_tree(nsec3_nodes);
......
......@@ -49,20 +49,20 @@ static int delete_nsec3_chain(const zone_contents_t *zone,
assert(zone);
assert(changeset);
if (knot_zone_tree_is_empty(zone->nsec3_nodes)) {
if (zone_tree_is_empty(zone->nsec3_nodes)) {
return KNOT_EOK;
}
dbg_dnssec_detail("deleting NSEC3 chain\n");
knot_zone_tree_t *empty_tree = knot_zone_tree_create();
zone_tree_t *empty_tree = zone_tree_create();
if (!empty_tree) {
return KNOT_ENOMEM;
}
int result = knot_zone_tree_add_diff(zone->nsec3_nodes, empty_tree,
int result = zone_tree_add_diff(zone->nsec3_nodes, empty_tree,
changeset);
knot_zone_tree_free(&empty_tree);
zone_tree_free(&empty_tree);
return result;
}
......@@ -111,7 +111,7 @@ static bool get_zone_soa_min_ttl(const zone_contents_t *zone,
* \brief Finds a node with the same owner as the given NSEC3 RRSet and marks it
* as 'removed'.
*
* \param data NSEC3 tree to search for the node in. (type knot_zone_tree_t *).
* \param data NSEC3 tree to search for the node in. (type zone_tree_t *).
* \param rrset RRSet whose owner will be sought in the zone tree. non-NSEC3
* RRSets are ignored.
*
......@@ -123,13 +123,13 @@ static int mark_nsec3(knot_rrset_t *rrset, void *data)
assert(rrset != NULL);
assert(data != NULL);
knot_zone_tree_t *nsec3s = (knot_zone_tree_t *)data;
zone_tree_t *nsec3s = (zone_tree_t *)data;
zone_node_t *node = NULL;
int ret;
if (rrset->type == KNOT_RRTYPE_NSEC3) {
// Find the name in the NSEC3 tree and mark the node
ret = knot_zone_tree_get(nsec3s, rrset->owner,
ret = zone_tree_get(nsec3s, rrset->owner,
&node);
if (ret != KNOT_EOK) {
return ret;
......@@ -152,7 +152,7 @@ static int mark_nsec3(knot_rrset_t *rrset, void *data)
static int mark_removed_nsec3(changeset_t *out_ch,
const zone_contents_t *zone)
{
if (knot_zone_tree_is_empty(zone->nsec3_nodes)) {
if (zone_tree_is_empty(zone->nsec3_nodes)) {
return KNOT_EOK;
}
......
......@@ -591,7 +591,7 @@ static int sign_node(zone_node_t **node, void *data)
*
* \return Error code, KNOT_EOK if successful.
*/
static int zone_tree_sign(knot_zone_tree_t *tree,
static int zone_tree_sign(zone_tree_t *tree,
const knot_zone_keys_t *zone_keys,
const knot_dnssec_policy_t *policy,
changeset_t *changeset,
......@@ -608,7 +608,7 @@ static int zone_tree_sign(knot_zone_tree_t *tree,
.expires_at = time(NULL) + policy->sign_lifetime
};
int result = knot_zone_tree_apply(tree, sign_node, &args);
int result = zone_tree_apply(tree, sign_node, &args);
*expires_at = args.expires_at;
return result;
......
......@@ -116,7 +116,7 @@ static int axfr_query_init(struct query_data *qdata)
gettimeofday(&axfr->proc.tstamp, NULL);
ptrlist_add(&axfr->proc.nodes, zone->nodes, mm);
/* Put NSEC3 data if exists. */
if (!knot_zone_tree_is_empty(zone->nsec3_nodes)) {
if (!zone_tree_is_empty(zone->nsec3_nodes)) {
ptrlist_add(&axfr->proc.nodes, zone->nsec3_nodes, mm);
}
......
......@@ -61,7 +61,7 @@ static zone_t *bootstrap_zone(conf_zone_t *conf)
}
/* Initialize bootstrap timer. */
new_zone->xfr_in.bootstrap_retry = knot_random_uint32_t() % XFRIN_BOOTSTRAP_DELAY;
new_zone->bootstrap_retry = knot_random_uint32_t() % XFRIN_BOOTSTRAP_DELAY;
return new_zone;
}
......
......@@ -373,7 +373,7 @@ static int remove_empty_nodes(zone_contents_t *z)
list_t l;
init_list(&l);
// walk through the zone and select nodes to be removed
int ret = knot_zone_tree_apply(z->nodes, mark_empty, &l);
int ret = zone_tree_apply(z->nodes, mark_empty, &l);
if (ret != KNOT_EOK) {
return ret;
}
......@@ -392,7 +392,7 @@ static int remove_empty_nodes(zone_contents_t *z)
init_list(&l);
// Do the same with NSEC3 nodes.
ret = knot_zone_tree_apply(z->nsec3_nodes, mark_empty, &l);
ret = zone_tree_apply(z->nsec3_nodes, mark_empty, &l);
if (ret != KNOT_EOK) {
return ret;
}
......@@ -577,9 +577,9 @@ void update_free_old_zone(zone_contents_t **contents)
* Free the zone tree, but only the structure
* (nodes are already destroyed) and free additional arrays.
*/
knot_zone_tree_apply((*contents)->nodes, free_additional, NULL);
knot_zone_tree_deep_free(&(*contents)->nodes);
knot_zone_tree_deep_free(&(*contents)->nsec3_nodes);
zone_tree_apply((*contents)->nodes, free_additional, NULL);
zone_tree_deep_free(&(*contents)->nodes);
zone_tree_deep_free(&(*contents)->nsec3_nodes);
knot_nsec3param_free(&(*contents)->nsec3_params);
......
......@@ -31,7 +31,6 @@
#include <string.h>
#include "knot/zone/zone.h"
#include "knot/server/xfr-handler.h"
#include "knot/updates/changesets.h"
/*!
......
......@@ -234,7 +234,7 @@ static int adjust_nsec3_pointers(zone_node_t **tnode, void *data)
int ret = zone_contents_nsec3_name(args->zone, node->owner, &nsec3_name);
if (ret == KNOT_EOK) {
assert(nsec3_name);
knot_zone_tree_get(args->zone->nsec3_nodes, nsec3_name, &nsec3);
zone_tree_get(args->zone->nsec3_nodes, nsec3_name, &nsec3);
node->nsec3_node = nsec3;
} else if (ret == KNOT_ENSEC3PAR) {
node->nsec3_node = NULL;
......@@ -346,7 +346,7 @@ static int adjust_additional(zone_node_t **tnode, void *data)
* \retval 0 if the domain name was not found. \a node may hold any (or none)
* node. \a previous is set properly.
*/
static int zone_contents_find_in_tree(knot_zone_tree_t *tree,
static int zone_contents_find_in_tree(zone_tree_t *tree,
const knot_dname_t *name,
zone_node_t **node,
zone_node_t **previous)
......@@ -358,7 +358,7 @@ static int zone_contents_find_in_tree(knot_zone_tree_t *tree,
zone_node_t *found = NULL, *prev = NULL;
int exact_match = knot_zone_tree_get_less_or_equal(tree, name, &found,
int exact_match = zone_tree_get_less_or_equal(tree, name, &found,
&prev);
assert(exact_match >= 0);
......@@ -416,12 +416,12 @@ zone_contents_t *zone_contents_new(const knot_dname_t *apex_name)
goto cleanup;
}
contents->nodes = knot_zone_tree_create();
contents->nodes = zone_tree_create();
if (contents->nodes == NULL) {
goto cleanup;
}
if (knot_zone_tree_insert(contents->nodes, contents->apex) != KNOT_EOK) {
if (zone_tree_insert(contents->nodes, contents->apex) != KNOT_EOK) {
goto cleanup;
}
......@@ -445,7 +445,7 @@ static zone_node_t *zone_contents_get_node(const zone_contents_t *zone,
}
zone_node_t *n;
int ret = knot_zone_tree_get(zone->nodes, name, &n);
int ret = zone_tree_get(zone->nodes, name, &n);
if (ret != KNOT_EOK) {
dbg_zone("Failed to find name in the zone tree.\n");
return NULL;
......@@ -469,7 +469,7 @@ static int zone_contents_add_node(zone_contents_t *zone, zone_node_t *node,
return ret;
}
ret = knot_zone_tree_insert(zone->nodes, node);
ret = zone_tree_insert(zone->nodes, node);
if (ret != KNOT_EOK) {
dbg_zone("Failed to insert node into zone tree.\n");
return ret;
......@@ -509,7 +509,7 @@ static int zone_contents_add_node(zone_contents_t *zone, zone_node_t *node,
/* Insert node to a tree. */
dbg_zone_detail("Inserting new node to zone tree.\n");
ret = knot_zone_tree_insert(zone->nodes, next_node);
ret = zone_tree_insert(zone->nodes, next_node);
if (ret != KNOT_EOK) {
node_free(&next_node);
return ret;
......@@ -553,14 +553,14 @@ static int zone_contents_add_nsec3_node(zone_contents_t *zone, zone_node_t *node
/* Create NSEC3 tree if not exists. */
if (zone->nsec3_nodes == NULL) {
zone->nsec3_nodes = knot_zone_tree_create();
zone->nsec3_nodes = zone_tree_create();
if (zone->nsec3_nodes == NULL) {
return KNOT_ENOMEM;
}
}
// how to know if this is successfull??
ret = knot_zone_tree_insert(zone->nsec3_nodes, node);
ret = zone_tree_insert(zone->nsec3_nodes, node);
if (ret != KNOT_EOK) {
dbg_zone("Failed to insert node into NSEC3 tree: %s.\n",
knot_strerror(ret));
......@@ -584,7 +584,7 @@ static zone_node_t *zone_contents_get_nsec3_node(const zone_contents_t *zone,
}
zone_node_t *n;
int ret = knot_zone_tree_get(zone->nsec3_nodes, name, &n);
int ret = zone_tree_get(zone->nsec3_nodes, name, &n);
if (ret != KNOT_EOK) {
dbg_zone("Failed to find NSEC3 name in the zone tree."
"\n");
......@@ -643,7 +643,7 @@ static int recreate_normal_tree(const zone_contents_t *z, zone_contents_t *out)
}
// Normal additions need apex ... so we need to insert directly.
int ret = knot_zone_tree_insert(out->nodes, apex_cpy);
int ret = zone_tree_insert(out->nodes, apex_cpy);
if (ret != KNOT_EOK) {
node_free(&apex_cpy);
return ret;
......@@ -749,7 +749,7 @@ dbg_zone_exec_verb(
free(name);
);
zone_node_t *removed_node = NULL;
int ret = knot_zone_tree_remove(contents->nodes, owner, &removed_node);
int ret = zone_tree_remove(contents->nodes, owner, &removed_node);
if (ret != KNOT_EOK) {
return KNOT_ENONODE;
}
......@@ -768,7 +768,7 @@ int zone_contents_remove_nsec3_node(zone_contents_t *contents, const knot_dname_
// remove the node from the zone tree
zone_node_t *removed_node = NULL;
int ret = knot_zone_tree_remove(contents->nsec3_nodes, owner,
int ret = zone_tree_remove(contents->nsec3_nodes, owner,
&removed_node);
if (ret != KNOT_EOK) {
return KNOT_ENONODE;
......@@ -925,7 +925,7 @@ int zone_contents_find_nsec3_for_name(const zone_contents_t *zone,
}
// check if the NSEC3 tree is not empty
if (knot_zone_tree_is_empty(zone->nsec3_nodes)) {
if (zone_tree_is_empty(zone->nsec3_nodes)) {
dbg_zone("NSEC3 tree is empty.\n");
return KNOT_ENSEC3CHAIN;
}
......@@ -946,7 +946,7 @@ dbg_zone_exec_verb(
const zone_node_t *found = NULL, *prev = NULL;
// create dummy node to use for lookup
int exact_match = knot_zone_tree_find_less_or_equal(
int exact_match = zone_tree_find_less_or_equal(
zone->nsec3_nodes, nsec3_name, &found, &prev);
assert(exact_match >= 0);
......@@ -1053,11 +1053,11 @@ const zone_node_t *zone_contents_find_wildcard_child(const zone_contents_t *cont
/*----------------------------------------------------------------------------*/
static int zone_contents_adjust_nodes(knot_zone_tree_t *nodes,
static int zone_contents_adjust_nodes(zone_tree_t *nodes,
zone_adjust_arg_t *adjust_arg,
knot_zone_tree_apply_cb_t callback)
zone_tree_apply_cb_t callback)
{
if (knot_zone_tree_is_empty(nodes)) {
if (zone_tree_is_empty(nodes)) {
return KNOT_EOK;
}
......@@ -1069,7 +1069,7 @@ static int zone_contents_adjust_nodes(knot_zone_tree_t *nodes,
adjust_arg->previous_node = NULL;
hattrie_build_index(nodes);
int result = knot_zone_tree_apply_inorder(nodes, callback, adjust_arg);
int result = zone_tree_apply_inorder(nodes, callback, adjust_arg);
if (adjust_arg->first_node) {
adjust_arg->first_node->prev = adjust_arg->previous_node;
......@@ -1230,7 +1230,7 @@ int zone_contents_tree_apply_inorder(zone_contents_t *zone,
f.func = function;
f.data = data;
return knot_zone_tree_apply_inorder(zone->nodes, tree_apply_cb, &f);
return zone_tree_apply_inorder(zone->nodes, tree_apply_cb, &f);
}
/*----------------------------------------------------------------------------*/
......@@ -1246,7 +1246,7 @@ int zone_contents_nsec3_apply_inorder(zone_contents_t *zone,
f.func = function;
f.data = data;
return knot_zone_tree_apply_inorder(zone->nsec3_nodes,
return zone_tree_apply_inorder(zone->nsec3_nodes,
tree_apply_cb, &f);
}
......@@ -1271,7 +1271,7 @@ int zone_contents_shallow_copy(const zone_contents_t *from, zone_contents_t **to
int ret = recreate_normal_tree(from, contents);
if (ret != KNOT_EOK) {
knot_zone_tree_free(&contents->nodes);
zone_tree_free(&contents->nodes);
free(contents);
return ret;
}
......@@ -1279,8 +1279,8 @@ int zone_contents_shallow_copy(const zone_contents_t *from, zone_contents_t **to
if (from->nsec3_nodes) {
ret = recreate_nsec3_tree(from, contents);
if (ret != KNOT_EOK) {
knot_zone_tree_free(&contents->nodes);
knot_zone_tree_free(&contents->nsec3_nodes);
zone_tree_free(&contents->nodes);
zone_tree_free(&contents->nsec3_nodes);
free(contents);
return ret;
}
......@@ -1302,9 +1302,9 @@ void zone_contents_free(zone_contents_t **contents)
// free the zone tree, but only the structure
dbg_zone("Destroying zone tree.\n");
knot_zone_tree_free(&(*contents)->nodes);
zone_tree_free(&(*contents)->nodes);
dbg_zone("Destroying NSEC3 zone tree.\n");
knot_zone_tree_free(&(*contents)->nsec3_nodes);
zone_tree_free(&(*contents)->nsec3_nodes);
knot_nsec3param_free(&(*contents)->nsec3_params);
......@@ -1322,13 +1322,13 @@ void zone_contents_deep_free(zone_contents_t **contents)
if ((*contents) != NULL) {
// Delete NSEC3 tree
knot_zone_tree_apply(
zone_tree_apply(
(*contents)->nsec3_nodes,
zone_contents_destroy_node_rrsets_from_tree,
(void*)1);
// Delete normal tree
knot_zone_tree_apply(
zone_tree_apply(
(*contents)->nodes,
zone_contents_destroy_node_rrsets_from_tree,
(void*)1);
......
......@@ -43,8 +43,8 @@ enum zone_contents_find_dname_result {
typedef struct zone_contents_t {
zone_node_t *apex; /*!< Apex node of the zone (holding SOA) */
knot_zone_tree_t *nodes;
knot_zone_tree_t *nsec3_nodes;
zone_tree_t *nodes;
zone_tree_t *nsec3_nodes;
knot_nsec3_params_t nsec3_params;
} zone_contents_t;
......
......@@ -198,7 +198,7 @@ static void schedule_dnssec(zone_t *zone)
char time_str[64] = { 0 };
struct tm time_gm = { 0 };
time_t unixtime = zone->dnssec.refresh_at;
time_t unixtime = zone->dnssec_refresh;
gmtime_r(&unixtime, &time_gm);
strftime(time_str, sizeof(time_str), KNOT_LOG_TIME_FORMAT, &time_gm);
log_zone_info("DNSSEC: Zone %s - Next event on %s.\n",
......@@ -263,8 +263,8 @@ static int event_reload(zone_t *zone)
zone_events_schedule(zone, ZONE_EVENT_REFRESH, ZONE_EVENT_NOW);
}
if (!zone_contents_is_empty(contents)) {
zone->xfr_in.bootstrap_retry = ZONE_EVENT_NOW;
zone_events_schedule(zone, ZONE_EVENT_NOTIFY, zone->xfr_in.bootstrap_retry);
zone->bootstrap_retry = ZONE_EVENT_NOW;
zone_events_schedule(zone, ZONE_EVENT_NOTIFY, zone->bootstrap_retry);
}
if (zone->conf->dnssec_enable) {
schedule_dnssec(zone);
......@@ -334,12 +334,12 @@ static int event_xfer(zone_t *zone)
zone_events_schedule(zone, ZONE_EVENT_EXPIRE, knot_soa_expire(soa));
zone_events_schedule(zone, ZONE_EVENT_REFRESH, knot_soa_refresh(soa));
zone_events_schedule(zone, ZONE_EVENT_NOTIFY, ZONE_EVENT_NOW);
zone->xfr_in.bootstrap_retry = ZONE_EVENT_NOW;
zone->bootstrap_retry = ZONE_EVENT_NOW;
} else {
/* Zone contents is still empty, increment bootstrap retry timer
* and try again. */
zone->xfr_in.bootstrap_retry = bootstrap_next(zone->xfr_in.bootstrap_retry);
zone_events_schedule(zone, ZONE_EVENT_XFER, zone->xfr_in.bootstrap_retry);
zone->bootstrap_retry = bootstrap_next(zone->bootstrap_retry);
zone_events_schedule(zone, ZONE_EVENT_XFER, zone->bootstrap_retry);
}
return KNOT_EOK;
......@@ -459,11 +459,11 @@ static int event_dnssec(zone_t *zone)
}
uint32_t refresh_at = 0;
if (zone->dnssec.next_force) {
if (zone->flags & ZONE_FORCE_RESIGN) {
log_zone_info("%s Complete resign started (dropping all "
"previous signatures)...\n", msgpref);
zone->dnssec.next_force = false;
zone->flags &= ~ZONE_FORCE_RESIGN;
ret = knot_dnssec_zone_sign_force(zone->contents, zone->conf,
ch, &refresh_at);
} else {
......@@ -487,7 +487,7 @@ static int event_dnssec(zone_t *zone)
// Schedule dependent events.
zone->dnssec.refresh_at = refresh_at;
zone->dnssec_refresh = refresh_at;
schedule_dnssec(zone);
zone_events_schedule(zone, ZONE_EVENT_NOTIFY, ZONE_EVENT_NOW);
if (zone->conf->dbsync_timeout == 0) {
......
......@@ -26,7 +26,7 @@
#include "libknot/rrtype/soa.h"
struct zone_diff_param {
knot_zone_tree_t *nodes;
zone_tree_t *nodes;
changeset_t *changeset;
};
......@@ -355,7 +355,7 @@ static int knot_zone_diff_node(zone_node_t **node_ptr, void *data)
const knot_dname_t *node_owner = node->owner;
assert(node_owner);
knot_zone_tree_find(param->nodes, node_owner, &node_in_second_tree);
zone_tree_find(param->nodes, node_owner, &node_in_second_tree);
if (node_in_second_tree == NULL) {
dbg_zonediff_detail("zone_diff: diff_node: Node %p is not "
......@@ -482,7 +482,7 @@ static int knot_zone_diff_add_new_nodes(zone_node_t **node_ptr, void *data)
assert(node_owner);
zone_node_t *new_node = NULL;
knot_zone_tree_get(param->nodes, node_owner, &new_node);
zone_tree_get(param->nodes, node_owner, &new_node);
int ret = KNOT_EOK;
......@@ -500,8 +500,8 @@ static int knot_zone_diff_add_new_nodes(zone_node_t **node_ptr, void *data)
return ret;
}
static int knot_zone_diff_load_trees(knot_zone_tree_t *nodes1,
knot_zone_tree_t *nodes2,
static int knot_zone_diff_load_trees(zone_tree_t *nodes1,
zone_tree_t *nodes2,
changeset_t *changeset)
{
assert(changeset);
......@@ -511,14 +511,14 @@ static int knot_zone_diff_load_trees(knot_zone_tree_t *nodes1,
// Traverse one tree, compare every node, each RRSet with its rdata.
param.nodes = nodes2;
int result = knot_zone_tree_apply(nodes1, knot_zone_diff_node, &param);
int result = zone_tree_apply(nodes1, knot_zone_diff_node, &param);
if (result != KNOT_EOK) {
return result;
}
// Some nodes may have been added. Add missing nodes to changeset.
param.nodes = nodes1;
result = knot_zone_tree_apply(nodes2, knot_zone_diff_add_new_nodes,
result = zone_tree_apply(nodes2, knot_zone_diff_add_new_nodes,
&param);
return result;
......@@ -572,7 +572,7 @@ int zone_contents_create_diff(const zone_contents_t *z1,
return KNOT_EOK;
}
int knot_zone_tree_add_diff(knot_zone_tree_t *t1, knot_zone_tree_t *t2,
int zone_tree_add_diff(zone_tree_t *t1, zone_tree_t *t2,
changeset_t *changeset)
{
if (!changeset) {
......
......@@ -32,7 +32,7 @@ int zone_contents_create_diff(const zone_contents_t *z1,
/*!
* \brief Add diff between two zone trees into the changeset.
*/
int knot_zone_tree_add_diff(knot_zone_tree_t *t1, knot_zone_tree_t *t2,
int zone_tree_add_diff(zone_tree_t *t1, zone_tree_t *t2,
changeset_t *changeset);
#endif // _KNOT_ZONE_DIFF_H_
......@@ -140,7 +140,7 @@ int zone_load_post(zone_contents_t *contents, zone_t *zone)
ret = knot_dnssec_zone_sign(contents, conf,
changesets_get_last(dnssec_change),
KNOT_SOA_SERIAL_UPDATE,
&zone->dnssec.refresh_at);
&zone->dnssec_refresh);
if (ret != KNOT_EOK) {
changesets_free(&dnssec_change, NULL);
return ret;
......
......@@ -27,26 +27,26 @@
/* API functions */
/*----------------------------------------------------------------------------*/
knot_zone_tree_t* knot_zone_tree_create()
zone_tree_t* zone_tree_create()
{
return hattrie_create();
}
/*----------------------------------------------------------------------------*/
size_t knot_zone_tree_weight(const knot_zone_tree_t* tree)
size_t zone_tree_weight(const zone_tree_t* tree)
{
return hattrie_weight(tree);
}
int knot_zone_tree_is_empty(const knot_zone_tree_t *tree)
int zone_tree_is_empty(const zone_tree_t *tree)
{
return knot_zone_tree_weight(tree) == 0;
return zone_tree_weight(tree) == 0;
}
/*----------------------------------------------------------------------------*/
int knot_zone_tree_insert(knot_zone_tree_t *tree, zone_node_t *node)
int zone_tree_insert(zone_tree_t *tree, zone_node_t *node)
{
if (tree == NULL) {
return KNOT_EINVAL;
......@@ -62,26 +62,26 @@ int knot_zone_tree_insert(knot_zone_tree_t *tree, zone_node_t *node)
/*----------------------------------------------------------------------------*/
int knot_zone_tree_find(knot_zone_tree_t *tree, const knot_dname_t *owner,
int zone_tree_find(zone_tree_t *tree, const knot_dname_t *owner,
const zone_node_t **found)
{
if (owner == NULL || found == NULL) {
return KNOT_EINVAL;
}
return knot_zone_tree_get(tree, owner, (zone_node_t **)found);
return zone_tree_get(tree, owner, (zone_node_t **)found);
}
/*----------------------------------------------------------------------------*/
int knot_zone_tree_get(knot_zone_tree_t *tree, const knot_dname_t *owner,
int zone_tree_get(zone_tree_t *tree, const knot_dname_t *owner,
zone_node_t **found)
{
if (owner == NULL) {
return KNOT_EINVAL;
}
if (knot_zone_tree_is_empty(tree)) {
if (zone_tree_is_empty(tree)) {
return KNOT_ENONODE;
}
......@@ -100,7 +100,7 @@ int knot_zone_tree_get(knot_zone_tree_t *tree, const knot_dname_t *owner,
/*----------------------------------------------------------------------------*/
int knot_zone_tree_find_less_or_equal(knot_zone_tree_t *tree,
int zone_tree_find_less_or_equal(zone_tree_t *tree,
const knot_dname_t *owner,
const zone_node_t **found,
const zone_node_t **previous)
......@@ -110,7 +110,7 @@ int knot_zone_tree_find_less_or_equal(knot_zone_tree_t *tree,
}
zone_node_t *f = NULL, *p = NULL;
int ret = knot_zone_tree_get_less_or_equal(tree, owner, &f, &p);
int ret = zone_tree_get_less_or_equal(tree, owner, &f, &p);
*found = f;
*previous = p;
......@@ -120,7 +120,7 @@ int knot_zone_tree_find_less_or_equal(knot_zone_tree_t *tree,
/*----------------------------------------------------------------------------*/
int knot_zone_tree_get_less_or_equal(knot_zone_tree_t *tree,
int zone_tree_get_less_or_equal(zone_tree_t *tree,
const knot_dname_t *owner,
zone_node_t **found,
zone_node_t **previous)
......@@ -129,7 +129,7 @@ int knot_zone_tree_get_less_or_equal(knot_zone_tree_t *tree,
return KNOT_EINVAL;
}
if (knot_zone_tree_is_empty(tree)) {
if (zone_tree_is_empty(tree)) {
return KNOT_ENONODE;
}
......@@ -192,7 +192,7 @@ dbg_zone_exec_detail(
/*----------------------------------------------------------------------------*/
int knot_zone_tree_remove(knot_zone_tree_t *tree,
int zone_tree_remove(zone_tree_t *tree,
const knot_dname_t *owner,
zone_node_t **removed)
{
......@@ -200,7 +200,7 @@ int knot_zone_tree_remove(knot_zone_tree_t *tree,
return KNOT_EINVAL;
}
if (knot_zone_tree_is_empty(tree)) {
if (zone_tree_is_empty(tree)) {
return KNOT_ENONODE;
}
......@@ -221,15 +221,15 @@ int knot_zone_tree_remove(knot_zone_tree_t *tree,