Commit fa84b4c3 authored by Jan Včelák's avatar Jan Včelák 🚀

zones: remove knot_ from zone contents, rename zone-create.c

parent bbe06367
......@@ -258,6 +258,8 @@ libknotd_la_SOURCES = \
knot/worker/queue.h \
knot/worker/task.c \
knot/worker/task.h \
knot/zone/contents.c \
knot/zone/contents.h \
knot/zone/estimator.c \
knot/zone/estimator.h \
knot/zone/events.c \
......@@ -266,10 +268,6 @@ libknotd_la_SOURCES = \
knot/zone/node.h \
knot/zone/semantic-check.c \
knot/zone/semantic-check.h \
knot/zone/zone-contents.c \
knot/zone/zone-contents.h \
knot/zone/zone-create.c \
knot/zone/zone-create.h \
knot/zone/zone-diff.c \
knot/zone/zone-diff.h \
knot/zone/zone-dump.c \
......@@ -279,7 +277,9 @@ libknotd_la_SOURCES = \
knot/zone/zone.c \
knot/zone/zone.h \
knot/zone/zonedb.c \
knot/zone/zonedb.h
knot/zone/zonedb.h \
knot/zone/zonefile.c \
knot/zone/zonefile.h
# libraries
libknot_la_LIBADD = libknots.la zscanner/libzscanner.la
......
......@@ -31,7 +31,7 @@
#include "knot/ctl/process.h"
#include "knot/ctl/remote.h"
#include "knot/conf/conf.h"
#include "knot/zone/zone-create.h"
#include "knot/zone/zonefile.h"
#include "knot/server/tcp-handler.h"
#include "libknot/packet/wire.h"
#include "knot/server/zone-load.h"
......@@ -687,7 +687,7 @@ static int cmd_checkzone(int argc, char *argv[], unsigned flags)
}
/* Create zone loader context. */
zone_t *loaded_zone = load_zone_file(zone);
zone_t *loaded_zone = NULL; // TODO load_zone_file(zone);
if (loaded_zone == NULL) {
rc = 1;
continue;
......
......@@ -315,7 +315,7 @@ static int handle_nsec_next_dname(chain_fix_data_t *fix_data,
knot_node_rrset(a_node, KNOT_RRTYPE_NSEC);
assert(nsec_rrset);
const knot_node_t *next_node =
knot_zone_contents_find_node(fix_data->zone,
zone_contents_find_node(fix_data->zone,
knot_rdata_nsec_next(nsec_rrset));
assert(next_node);
update_last_used(fix_data, next_node->owner, next_node);
......@@ -324,7 +324,7 @@ static int handle_nsec_next_dname(chain_fix_data_t *fix_data,
} else {
// We have no immediate previous node, connect broken chain
const knot_node_t *next_node =
knot_zone_contents_find_node(fix_data->zone,
zone_contents_find_node(fix_data->zone,
fix_data->next_dname);
assert(next_node);
update_last_used(fix_data, next_node->owner, next_node);
......@@ -343,18 +343,18 @@ static int handle_nsec_next_dname(chain_fix_data_t *fix_data,
*
* \return Previous NSEC node for 'd'.
*/
static const knot_node_t *find_prev_nsec_node(const knot_zone_contents_t *z,
static const knot_node_t *find_prev_nsec_node(const zone_contents_t *z,
const knot_dname_t *d)
{
// Find previous node for the dname, return node that will be used later
const knot_node_t *prev_zone_node = knot_zone_contents_find_previous(z,
const knot_node_t *prev_zone_node = zone_contents_find_previous(z,
d);
bool nsec_node_found = !knot_node_is_non_auth(prev_zone_node) &&
!only_nsec_in_node(prev_zone_node);
while (!nsec_node_found) {
// Get previous node from zone tree
prev_zone_node =
knot_zone_contents_find_previous(z,
zone_contents_find_previous(z,
prev_zone_node->owner);
assert(prev_zone_node);
// Infinite loop check
......@@ -383,14 +383,14 @@ static int fix_nsec_chain(knot_dname_t *a, knot_dname_t *b,
assert(b);
assert(fix_data);
// Get changed nodes from zone
const knot_node_t *b_node = knot_zone_contents_find_node(fix_data->zone,
const knot_node_t *b_node = zone_contents_find_node(fix_data->zone,
b);
assert(b_node);
if (knot_node_is_non_auth(b_node)) {
// Nothing to fix in this node
return NSEC_NODE_SKIP;
}
const knot_node_t *a_node = knot_zone_contents_find_node(fix_data->zone,
const knot_node_t *a_node = zone_contents_find_node(fix_data->zone,
a);
// Find previous node in zone
const knot_node_t *prev_zone_node = find_prev_nsec_node(fix_data->zone,
......@@ -482,11 +482,11 @@ static int chain_finalize_nsec(chain_fix_data_t *fix_data)
// NSEC cannot point to itself (except for the case above)
const knot_rrset_t *nsec_rrset =
knot_node_rrset(from, KNOT_RRTYPE_NSEC);
to = knot_zone_contents_find_node(fix_data->zone,
to = zone_contents_find_node(fix_data->zone,
knot_rdata_nsec_next(nsec_rrset));
} else {
// Normal case
to = knot_zone_contents_find_node(fix_data->zone,
to = zone_contents_find_node(fix_data->zone,
fix_data->next_dname);
}
assert(to);
......@@ -693,7 +693,7 @@ bool knot_nsec_only_nsec_and_rrsigs_in_node(const knot_node_t *n)
/*!
* \brief Create new NSEC chain, add differences from current into a changeset.
*/
int knot_nsec_create_chain(const knot_zone_contents_t *zone, uint32_t ttl,
int knot_nsec_create_chain(const zone_contents_t *zone, uint32_t ttl,
knot_changeset_t *changeset)
{
assert(zone);
......
......@@ -31,7 +31,7 @@
#include <stdbool.h>
#include <stdint.h>
#include "knot/zone/zone-contents.h"
#include "knot/zone/contents.h"
#include "knot/updates/changesets.h"
#include "libknot/dnssec/bitmap.h"
......@@ -39,7 +39,7 @@
* \brief Parameters to be used when fixing NSEC(3) chain.
*/
typedef struct chain_fix_data {
const knot_zone_contents_t *zone; // Zone to fix
const zone_contents_t *zone; // Zone to fix
knot_changeset_t *out_ch; // Outgoing changes
const knot_dname_t *chain_start; // Possible new starting node
bool old_connected; // Marks old start connection
......@@ -56,7 +56,7 @@ typedef struct chain_fix_data {
typedef struct {
uint32_t ttl; // TTL for NSEC(3) records
knot_changeset_t *changeset; // Changeset for NSEC(3) changes
const knot_zone_contents_t *zone; // Updated zone
const zone_contents_t *zone; // Updated zone
} nsec_chain_iterate_data_t;
/*!
......@@ -166,7 +166,7 @@ bool knot_nsec_only_nsec_and_rrsigs_in_node(const knot_node_t *n);
*
* \return Error code, KNOT_EOK if successful.
*/
int knot_nsec_create_chain(const knot_zone_contents_t *zone, uint32_t ttl,
int knot_nsec_create_chain(const zone_contents_t *zone, uint32_t ttl,
knot_changeset_t *changeset);
/*!
......
This diff is collapsed.
......@@ -40,7 +40,7 @@
*
* \return KNOT_E*
*/
int knot_nsec3_create_chain(const knot_zone_contents_t *zone, uint32_t ttl,
int knot_nsec3_create_chain(const zone_contents_t *zone, uint32_t ttl,
knot_changeset_t *changeset);
/*!
......
......@@ -27,7 +27,7 @@
#include "common/debug.h"
#include "knot/zone/zone.h"
static int init_dnssec_structs(const knot_zone_contents_t *zone,
static int init_dnssec_structs(const zone_contents_t *zone,
conf_zone_t *config,
knot_zone_keys_t *zone_keys,
knot_dnssec_policy_t *policy,
......@@ -65,7 +65,7 @@ static int init_dnssec_structs(const knot_zone_contents_t *zone,
return KNOT_EOK;
}
static int zone_sign(knot_zone_contents_t *zone, conf_zone_t *zone_config,
static int zone_sign(zone_contents_t *zone, conf_zone_t *zone_config,
knot_changeset_t *out_ch, bool force,
knot_update_serial_t soa_up, uint32_t *refresh_at,
uint32_t new_serial)
......@@ -152,7 +152,7 @@ static int zone_sign(knot_zone_contents_t *zone, conf_zone_t *zone_config,
return KNOT_EOK;
}
int knot_dnssec_zone_sign(knot_zone_contents_t *zone, conf_zone_t *zone_config,
int knot_dnssec_zone_sign(zone_contents_t *zone, conf_zone_t *zone_config,
knot_changeset_t *out_ch,
knot_update_serial_t soa_up, uint32_t *refresh_at,
uint32_t new_serial)
......@@ -164,7 +164,7 @@ int knot_dnssec_zone_sign(knot_zone_contents_t *zone, conf_zone_t *zone_config,
return zone_sign(zone, zone_config, out_ch, false, soa_up, refresh_at, new_serial);
}
int knot_dnssec_zone_sign_force(knot_zone_contents_t *zone, conf_zone_t *zone_config,
int knot_dnssec_zone_sign_force(zone_contents_t *zone, conf_zone_t *zone_config,
knot_changeset_t *out_ch, uint32_t *refresh_at,
uint32_t new_serial)
{
......@@ -176,7 +176,7 @@ int knot_dnssec_zone_sign_force(knot_zone_contents_t *zone, conf_zone_t *zone_co
new_serial);
}
int knot_dnssec_sign_changeset(const knot_zone_contents_t *zone,
int knot_dnssec_sign_changeset(const zone_contents_t *zone,
conf_zone_t *zone_config,
const knot_changeset_t *in_ch,
knot_changeset_t *out_ch,
......
......@@ -44,7 +44,7 @@
*
* \return Error code, KNOT_EOK if successful.
*/
int knot_dnssec_zone_sign(knot_zone_contents_t *zone, conf_zone_t *zone_config,
int knot_dnssec_zone_sign(zone_contents_t *zone, conf_zone_t *zone_config,
knot_changeset_t *out_ch,
knot_update_serial_t soa_up, uint32_t *refresh_at,
uint32_t new_serial);
......@@ -61,7 +61,7 @@ int knot_dnssec_zone_sign(knot_zone_contents_t *zone, conf_zone_t *zone_config,
*
* \return Error code, KNOT_EOK if successful.
*/
int knot_dnssec_zone_sign_force(knot_zone_contents_t *zone, conf_zone_t *zone_config,
int knot_dnssec_zone_sign_force(zone_contents_t *zone, conf_zone_t *zone_config,
knot_changeset_t *out_ch,
uint32_t *refresh_at, uint32_t new_serial);
......@@ -79,7 +79,7 @@ int knot_dnssec_zone_sign_force(knot_zone_contents_t *zone, conf_zone_t *zone_co
*
* \return Error code, KNOT_EOK if successful.
*/
int knot_dnssec_sign_changeset(const knot_zone_contents_t *zone,
int knot_dnssec_sign_changeset(const zone_contents_t *zone,
conf_zone_t *zone_config,
const knot_changeset_t *in_ch,
knot_changeset_t *out_ch,
......
......@@ -34,7 +34,7 @@
#include "common/debug.h"
#include "libknot/util/utils.h"
#include "libknot/packet/wire.h"
#include "knot/zone/zone-contents.h"
#include "knot/zone/contents.h"
#include "knot/zone/zone-diff.h"
/*!
......@@ -44,7 +44,7 @@
* \param changeset Changeset to be used.
* \return KNOT_E*
*/
static int delete_nsec3_chain(const knot_zone_contents_t *zone,
static int delete_nsec3_chain(const zone_contents_t *zone,
knot_changeset_t *changeset)
{
assert(zone);
......@@ -74,7 +74,7 @@ static int delete_nsec3_chain(const knot_zone_contents_t *zone,
/*!
* \brief Check if NSEC3 is enabled for given zone.
*/
bool knot_is_nsec3_enabled(const knot_zone_contents_t *zone)
bool knot_is_nsec3_enabled(const zone_contents_t *zone)
{
if (!zone) {
return false;
......@@ -87,7 +87,7 @@ bool knot_is_nsec3_enabled(const knot_zone_contents_t *zone)
* \brief Get minimum TTL from zone SOA.
* \note Value should be used for NSEC records.
*/
static bool get_zone_soa_min_ttl(const knot_zone_contents_t *zone,
static bool get_zone_soa_min_ttl(const zone_contents_t *zone,
uint32_t *ttl)
{
assert(zone);
......@@ -193,7 +193,7 @@ knot_dname_t *knot_nsec3_hash_to_dname(const uint8_t *hash, size_t hash_size,
/*!
* \brief Create NSEC or NSEC3 chain in the zone.
*/
int knot_zone_create_nsec_chain(const knot_zone_contents_t *zone,
int knot_zone_create_nsec_chain(const zone_contents_t *zone,
knot_changeset_t *changeset,
const knot_zone_keys_t *zone_keys,
const knot_dnssec_policy_t *policy)
......@@ -231,7 +231,7 @@ int knot_zone_create_nsec_chain(const knot_zone_contents_t *zone,
/*!
* \brief Fix NSEC or NSEC3 chain in the zone.
*/
int knot_zone_fix_nsec_chain(const knot_zone_contents_t *zone,
int knot_zone_fix_nsec_chain(const zone_contents_t *zone,
hattrie_t *sorted_changes,
knot_changeset_t *out_ch,
const knot_zone_keys_t *zone_keys,
......
......@@ -31,7 +31,7 @@
#include <stdbool.h>
#include "knot/updates/changesets.h"
#include "knot/zone/zone-contents.h"
#include "knot/zone/contents.h"
#include "libknot/dnssec/policy.h"
#include "knot/dnssec/zone-keys.h"
#include "libknot/dnssec/bitmap.h"
......@@ -43,7 +43,7 @@
*
* \return NSEC3 is enabled.
*/
bool knot_is_nsec3_enabled(const knot_zone_contents_t *zone);
bool knot_is_nsec3_enabled(const zone_contents_t *zone);
/*!
* \brief Create NSEC3 owner name from hash and zone apex.
......@@ -80,7 +80,7 @@ knot_dname_t *knot_create_nsec3_owner(const knot_dname_t *owner,
*
* \return Error code, KNOT_EOK if successful.
*/
int knot_zone_create_nsec_chain(const knot_zone_contents_t *zone,
int knot_zone_create_nsec_chain(const zone_contents_t *zone,
knot_changeset_t *changeset,
const knot_zone_keys_t *zone_keys,
const knot_dnssec_policy_t *policy);
......@@ -98,7 +98,7 @@ int knot_zone_create_nsec_chain(const knot_zone_contents_t *zone,
*
* \return Error code, KNOT_EOK if successful.
*/
int knot_zone_fix_nsec_chain(const knot_zone_contents_t *zone,
int knot_zone_fix_nsec_chain(const zone_contents_t *zone,
hattrie_t *sorted_changes,
knot_changeset_t *out_ch,
const knot_zone_keys_t *zone_keys,
......
......@@ -36,7 +36,7 @@
#include "knot/updates/changesets.h"
#include "common/debug.h"
#include "knot/zone/node.h"
#include "knot/zone/zone-contents.h"
#include "knot/zone/contents.h"
/*- private API - common functions -------------------------------------------*/
......@@ -605,7 +605,7 @@ static int zone_tree_sign(knot_zone_tree_t *tree,
* \brief Struct to carry data for 'add_rrsigs_for_nsec' callback function.
*/
typedef struct {
const knot_zone_contents_t *zone;
const zone_contents_t *zone;
const knot_zone_keys_t *zone_keys;
const knot_dnssec_policy_t *policy;
knot_changeset_t *changeset;
......@@ -974,7 +974,7 @@ fail:
*
* \return Error code, KNOT_EOK if successful.
*/
static int update_dnskeys(const knot_zone_contents_t *zone,
static int update_dnskeys(const zone_contents_t *zone,
const knot_zone_keys_t *zone_keys,
const knot_dnssec_policy_t *policy,
knot_changeset_t *changeset)
......@@ -1155,7 +1155,7 @@ static int sign_changeset_wrap(knot_rrset_t *chg_rrset, void *data)
bool rr_signed = false;
// Find RR's node in zone, find out if we need to sign this RR
const knot_node_t *node =
knot_zone_contents_find_node(args->zone, chg_rrset->owner);
zone_contents_find_node(args->zone, chg_rrset->owner);
// If node is not in zone, all its RRSIGs were dropped - no-op
if (node) {
const knot_rrset_t *rrsigs = knot_node_rrset(node, KNOT_RRTYPE_RRSIG);
......@@ -1223,7 +1223,7 @@ static int free_helper_trie_node(value_t *val, void *d)
/*!
* \brief Update zone signatures and store performed changes in changeset.
*/
int knot_zone_sign(const knot_zone_contents_t *zone,
int knot_zone_sign(const zone_contents_t *zone,
const knot_zone_keys_t *zone_keys,
const knot_dnssec_policy_t *policy,
knot_changeset_t *changeset,
......@@ -1272,7 +1272,7 @@ int knot_zone_sign(const knot_zone_contents_t *zone,
/*!
* \brief Check if zone SOA signatures are expired.
*/
bool knot_zone_sign_soa_expired(const knot_zone_contents_t *zone,
bool knot_zone_sign_soa_expired(const zone_contents_t *zone,
const knot_zone_keys_t *zone_keys,
const knot_dnssec_policy_t *policy)
{
......@@ -1366,7 +1366,7 @@ int knot_zone_sign_update_soa(const knot_rrset_t *soa,
/*!
* \brief Sign changeset created by DDNS or zone-diff.
*/
int knot_zone_sign_changeset(const knot_zone_contents_t *zone,
int knot_zone_sign_changeset(const zone_contents_t *zone,
const knot_changeset_t *in_ch,
knot_changeset_t *out_ch,
hattrie_t **sorted_changes,
......
......@@ -31,7 +31,7 @@
#include "knot/updates/changesets.h"
#include "knot/zone/zone.h"
#include "knot/zone/zone-contents.h"
#include "knot/zone/contents.h"
#include "knot/dnssec/zone-keys.h"
#include "libknot/dnssec/policy.h"
......@@ -59,7 +59,7 @@ typedef struct signed_info {
*
* \return Error code, KNOT_EOK if successful.
*/
int knot_zone_sign(const knot_zone_contents_t *zone,
int knot_zone_sign(const zone_contents_t *zone,
const knot_zone_keys_t *zone_keys,
const knot_dnssec_policy_t *policy,
knot_changeset_t *out_ch, uint32_t *refresh_at);
......@@ -89,7 +89,7 @@ int knot_zone_sign_update_soa(const knot_rrset_t *soa, const knot_rrset_t *rrsig
*
* \return True if zone SOA signatures need update, false othewise.
*/
bool knot_zone_sign_soa_expired(const knot_zone_contents_t *zone,
bool knot_zone_sign_soa_expired(const zone_contents_t *zone,
const knot_zone_keys_t *zone_keys,
const knot_dnssec_policy_t *policy);
......@@ -105,7 +105,7 @@ bool knot_zone_sign_soa_expired(const knot_zone_contents_t *zone,
*
* \return Error code, KNOT_EOK if successful.
*/
int knot_zone_sign_changeset(const knot_zone_contents_t *zone,
int knot_zone_sign_changeset(const zone_contents_t *zone,
const knot_changeset_t *in_ch,
knot_changeset_t *out_ch,
hattrie_t **sorted_changes,
......
......@@ -103,7 +103,7 @@ static int axfr_answer_init(struct query_data *qdata)
/* Create transfer processing context. */
mm_ctx_t *mm = qdata->mm;
knot_zone_contents_t *zone = qdata->zone->contents;
zone_contents_t *zone = qdata->zone->contents;
struct xfr_proc *xfer = mm->alloc(mm->ctx, sizeof(struct axfr_proc));
if (xfer == NULL) {
return KNOT_ENOMEM;
......@@ -132,7 +132,7 @@ int xfr_process_list(knot_pkt_t *pkt, xfr_put_cb process_item, struct query_data
int ret = KNOT_EOK;
mm_ctx_t *mm = qdata->mm;
struct xfr_proc *xfer = qdata->ext;
knot_zone_contents_t *zone = qdata->zone->contents;
zone_contents_t *zone = qdata->zone->contents;
knot_rrset_t *soa_rr = knot_node_get_rrset(zone->apex, KNOT_RRTYPE_SOA);
/* Prepend SOA on first packet. */
......@@ -236,7 +236,7 @@ int axfr_process_answer(knot_ns_xfr_t *xfr)
dbg_ns("ns_process_axfrin: incoming packet, wire size: %zu\n",
xfr->wire_size);
int ret = xfrin_process_axfr_packet(xfr,
(knot_zone_contents_t **)&xfr->data);
(zone_contents_t **)&xfr->data);
if (ret > 0) { // transfer finished
dbg_ns("ns_process_axfrin: AXFR finished, zone created.\n");
......@@ -246,14 +246,14 @@ int axfr_process_answer(knot_ns_xfr_t *xfr)
* Adjust zone so that node count is set properly and nodes are
* marked authoritative / delegation point.
*/
knot_zone_contents_t *zone = (knot_zone_contents_t *)xfr->data;
zone_contents_t *zone = (zone_contents_t *)xfr->data;
assert(zone != NULL);
log_zone_info("%s Serial %u -> %u\n", xfr->msg,
knot_zone_serial(xfr->zone->contents),
knot_zone_serial(zone));
dbg_ns_verb("ns_process_axfrin: adjusting zone.\n");
int rc = knot_zone_contents_adjust_full(zone, NULL, NULL);
int rc = zone_contents_adjust_full(zone, NULL, NULL);
if (rc != KNOT_EOK) {
return rc;
}
......
......@@ -116,7 +116,7 @@ static bool dname_cname_cannot_synth(const knot_rrset_t *rrset, const knot_dname
static bool have_dnssec(struct query_data *qdata)
{
return knot_pkt_have_dnssec(qdata->query) &&
knot_zone_contents_is_signed(qdata->zone->contents);
zone_contents_is_signed(qdata->zone->contents);
}
/*! \brief Synthesize RRSIG for given parameters, store in 'qdata' for later use */
......@@ -199,7 +199,7 @@ static int put_answer(knot_pkt_t *pkt, uint16_t type, struct query_data *qdata)
/*! \brief Puts optional NS RRSet to the Authority section of the response. */
static int put_authority_ns(knot_pkt_t *pkt, struct query_data *qdata)
{
const knot_zone_contents_t *zone = qdata->zone->contents;
const zone_contents_t *zone = qdata->zone->contents;
dbg_ns("%s(%p, %p)\n", __func__, pkt, qdata);
/* DS/DNSKEY queries are not referrals. NS is optional.
......@@ -227,7 +227,7 @@ static int put_authority_ns(knot_pkt_t *pkt, struct query_data *qdata)
/*! \brief Puts optional SOA RRSet to the Authority section of the response. */
static int put_authority_soa(knot_pkt_t *pkt, struct query_data *qdata,
const knot_zone_contents_t *zone)
const zone_contents_t *zone)
{
dbg_ns("%s(%p, %p)\n", __func__, pkt, zone);
knot_rrset_t *soa_rrset = knot_node_get_rrset(zone->apex, KNOT_RRTYPE_SOA);
......@@ -479,7 +479,7 @@ static int name_not_found(knot_pkt_t *pkt, struct query_data *qdata)
static int solve_name(int state, knot_pkt_t *pkt, struct query_data *qdata)
{
dbg_ns("%s(%d, %p, %p)\n", __func__, state, pkt, qdata);
int ret = knot_zone_contents_find_dname(qdata->zone->contents, qdata->name,
int ret = zone_contents_find_dname(qdata->zone->contents, qdata->name,
&qdata->node, &qdata->encloser,
&qdata->previous);
......@@ -533,7 +533,7 @@ static int solve_answer_dnssec(int state, knot_pkt_t *pkt, struct query_data *qd
static int solve_authority(int state, knot_pkt_t *pkt, struct query_data *qdata)
{
int ret = KNOT_ERROR;
const knot_zone_contents_t *zone_contents = qdata->zone->contents;
const zone_contents_t *zone_contents = qdata->zone->contents;
switch (state) {
case HIT: /* Positive response, add (optional) AUTHORITY NS. */
......
......@@ -92,14 +92,14 @@ static int ns_put_nsec3_from_node(const knot_node_t *node,
* \retval NS_ERR_SERVFAIL if a runtime collision occured. The server should
* respond with SERVFAIL in such case.
*/
static int ns_put_covering_nsec3(const knot_zone_contents_t *zone,
static int ns_put_covering_nsec3(const zone_contents_t *zone,
const knot_dname_t *name,
struct query_data *qdata,
knot_pkt_t *resp)
{
const knot_node_t *prev, *node;
/*! \todo Check version. */
int match = knot_zone_contents_find_nsec3_for_name(zone, name,
int match = zone_contents_find_nsec3_for_name(zone, name,
&node, &prev);
//assert(match >= 0);
if (match < 0) {
......@@ -142,7 +142,7 @@ dbg_ns_exec_verb(
* \retval NS_ERR_SERVFAIL
*/
static int ns_put_nsec3_closest_encloser_proof(
const knot_zone_contents_t *zone,
const zone_contents_t *zone,
const knot_node_t **closest_encloser,
const knot_dname_t *qname,
struct query_data *qdata,
......@@ -155,14 +155,14 @@ static int ns_put_nsec3_closest_encloser_proof(
assert(resp != NULL);
// this function should be called only if NSEC3 is enabled in the zone
assert(knot_zone_contents_nsec3params(zone) != NULL);
assert(zone_contents_nsec3params(zone) != NULL);
dbg_ns_verb("Adding closest encloser proof\n");
if (knot_zone_contents_nsec3params(zone) == NULL) {
if (zone_contents_nsec3params(zone) == NULL) {
dbg_ns_exec_verb(
char *name = knot_dname_to_str(knot_node_owner(
knot_zone_contents_apex(zone)));
zone_contents_apex(zone)));
dbg_ns_verb("No NSEC3PARAM found in zone %s.\n", name);
free(name);
);
......@@ -282,7 +282,7 @@ dbg_ns_exec_verb(
* \param qdata Query data.
* \param resp Response to put the NSEC3s into.
*/
static int ns_put_nsec_wildcard(const knot_zone_contents_t *zone,
static int ns_put_nsec_wildcard(const zone_contents_t *zone,
const knot_dname_t *qname,
const knot_node_t *previous,
struct query_data *qdata,
......@@ -290,12 +290,12 @@ static int ns_put_nsec_wildcard(const knot_zone_contents_t *zone,
{
// check if we have previous; if not, find one using the tree
if (previous == NULL) {
previous = knot_zone_contents_find_previous(zone, qname);
previous = zone_contents_find_previous(zone, qname);
assert(previous != NULL);
/*!
* \todo isn't this handled in adjusting?
* knot_zone_contents_adjust_node_in_tree_ptr()
* zone_contents_adjust_node_in_tree_ptr()
*/
while (!knot_node_is_auth(previous)) {
previous = knot_node_previous(previous);
......@@ -331,7 +331,7 @@ static int ns_put_nsec_wildcard(const knot_zone_contents_t *zone,
* \retval KNOT_EOK
* \retval NS_ERR_SERVFAIL
*/
static int ns_put_nsec3_no_wildcard_child(const knot_zone_contents_t *zone,
static int ns_put_nsec3_no_wildcard_child(const zone_contents_t *zone,
const knot_node_t *node,
struct query_data *qdata,
knot_pkt_t *resp)
......@@ -372,7 +372,7 @@ static int ns_put_nsec3_no_wildcard_child(const knot_zone_contents_t *zone,
* \retval KNOT_EOK
* \retval NS_ERR_SERVFAIL
*/
static int ns_put_nsec3_wildcard(const knot_zone_contents_t *zone,
static int ns_put_nsec3_wildcard(const zone_contents_t *zone,
const knot_node_t *closest_encloser,
const knot_dname_t *qname,
struct query_data *qdata,
......@@ -431,7 +431,7 @@ dbg_ns_exec_verb(
static int ns_put_nsec_nsec3_wildcard_answer(const knot_node_t *node,
const knot_node_t *closest_encloser,
const knot_node_t *previous,
const knot_zone_contents_t *zone,
const zone_contents_t *zone,
const knot_dname_t *qname,
struct query_data *qdata,
knot_pkt_t *resp)
......@@ -473,7 +473,7 @@ static int ns_put_nsec_nsec3_wildcard_answer(const knot_node_t *node,
* \retval NS_ERR_SERVFAIL
*/
static int ns_put_nsec_nxdomain(const knot_dname_t *qname,
const knot_zone_contents_t *zone,
const zone_contents_t *zone,
const knot_node_t *previous,
const knot_node_t *closest_encloser,
struct query_data *qdata,
......@@ -485,12 +485,12 @@ static int ns_put_nsec_nxdomain(const knot_dname_t *qname,
// check if we have previous; if not, find one using the tree
if (previous == NULL) {
/*! \todo Check version. */
previous = knot_zone_contents_find_previous(zone, qname);
previous = zone_contents_find_previous(zone, qname);
assert(previous != NULL);
/*!
* \todo isn't this handled in adjusting?
* knot_zone_contents_adjust_node_in_tree_ptr()
* zone_contents_adjust_node_in_tree_ptr()
*/
while (!knot_node_is_auth(previous)) {
previous = knot_node_previous(previous);
......@@ -541,7 +541,7 @@ dbg_ns_exec_verb(
dbg_ns_verb("Previous node: %s\n", name);
free(name);
);
assert(prev_new != knot_zone_contents_apex(zone));
assert(prev_new != zone_contents_apex(zone));
prev_new = knot_node_previous(prev_new);
}
assert(knot_dname_cmp(knot_node_owner(prev_new),
......@@ -591,7 +591,7 @@ dbg_ns_exec_verb(
* \retval KNOT_EOK
* \retval NS_ERR_SERVFAIL
*/
static int ns_put_nsec3_nxdomain(const knot_zone_contents_t *zone,
static int ns_put_nsec3_nxdomain(const zone_contents_t *zone,
const knot_node_t *closest_encloser,
const knot_dname_t *qname,
struct query_data *qdata,
......@@ -631,7 +631,7 @@ static int ns_put_nsec3_nxdomain(const knot_zone_contents_t *zone,
* \retval KNOT_EOK
* \retval NS_ERR_SERVFAIL
*/
static int ns_put_nsec_nsec3_nxdomain(const knot_zone_contents_t *zone,
static int ns_put_nsec_nsec3_nxdomain(const zone_contents_t *zone,
const knot_node_t *previous,
const knot_node_t *closest_encloser,
const knot_dname_t *qname,
......@@ -667,7 +667,7 @@ static int ns_put_nsec_nsec3_nxdomain(const knot_zone_contents_t *zone,
static int ns_put_nsec_nsec3_nodata(const knot_node_t *node,
const knot_node_t *closest_encloser,
const knot_node_t *previous,
const knot_zone_contents_t *zone,
const zone_contents_t *zone,
const knot_dname_t *qname,
struct query_data *qdata,
knot_pkt_t *resp)
......
......@@ -89,7 +89,7 @@ static int update_forward(knot_pkt_t *pkt, struct query_data *qdata)
static int update_prereq_check(struct query_data *qdata)
{
knot_pkt_t *query = qdata->query;
const knot_zone_contents_t *contents = qdata->zone->contents;
const zone_contents_t *contents = qdata->zone->contents;
/*
* 2) DDNS Prerequisities Section processing (RFC2136, Section 3.2).
......@@ -194,8 +194,8 @@ int update_answer(knot_pkt_t *pkt, struct query_data *qdata)
* order to get rid of duplicate code.
*/
int knot_ns_process_update(const knot_pkt_t *query,
knot_zone_contents_t *old_contents,
knot_zone_contents_t **new_contents,
zone_contents_t *old_contents,
zone_contents_t **new_contents,
knot_changesets_t *chgs, knot_rcode_t *rcode,
uint32_t new_serial)
{
......@@ -208,7 +208,7 @@ int knot_ns_process_update(const knot_pkt_t *query,
// 1) Create zone shallow copy.
dbg_ns_verb("Creating shallow copy of the zone...\n");
knot_zone_contents_t *contents_copy = NULL;
zone_contents_t *contents_copy = NULL;
int ret = xfrin_prepare_zone_copy(old_contents, &contents_copy);
if (ret != KNOT_EOK) {
dbg_ns("Failed to prepare zone copy: %s\n",
......@@ -320,8 +320,8 @@ static int zones_process_update_auth(zone_t *zone, knot_pkt_t *query,
uint32_t new_serial = zones_next_serial(zone);
knot_zone_contents_t *new_contents = NULL;
knot_zone_contents_t *old_contents = zone->contents;
zone_contents_t *new_contents = NULL;
zone_contents_t *old_contents = zone->contents;
ret = knot_ns_process_update(query, old_contents, &new_contents,
chgsets, rcode, new_serial);
if (ret != KNOT_EOK) {
......@@ -433,7 +433,7 @@ static int zones_process_update_auth(zone_t *zone, knot_pkt_t *query,
}
} else {
// Set NSEC3 nodes if no new signatures were created (or auto DNSSEC is off)
ret = knot_zone_contents_adjust_nsec3_pointers(new_contents);
ret = zone_contents_adjust_nsec3_pointers(new_contents);
if (ret != KNOT_EOK) {
zones_store_changesets_rollback(transaction);
zones_free_merged_changesets(chgsets, sec_chs);
......
......@@ -44,7 +44,7 @@
int notify_create_request(const zone_t *zone, knot_pkt_t *pkt)
{
knot_zone_contents_t *contents = zone->contents;
zone_contents_t *contents = zone->contents;
if (contents == NULL) {
return KNOT_EINVAL; /* Not valid for stub zones. */
}
......
......@@ -272,10 +272,10 @@ static void xfr_task_cleanup(knot_ns_xfr_t *rq)
dbg_xfr_verb("Cleaning up after XFR-in.\n");
if (rq->type == XFR_TYPE_AIN) {
if (rq->flags & XFR_FLAG_AXFR_FINISHED) {
knot_zone_contents_deep_free(&rq->new_contents);
zone_contents_deep_free(&rq->new_contents);
} else if (rq->data) {
knot_zone_contents_t *zone = rq->data;
knot_zone_contents_deep_free(&zone);
zone_contents_t *zone = rq->data;
zone_contents_deep_free(&zone);