Commit 7524fe7f authored by Marek Vavruša's avatar Marek Vavruša

renamed knot_(rr|rrs)_t -> knot_(rdata|rdataset)_t

parent 919ee662
......@@ -210,13 +210,13 @@ src/libknot/processing/process.c
src/libknot/processing/process.h
src/libknot/rdata.c
src/libknot/rdata.h
src/libknot/rdata/dname.h
src/libknot/rdata/dnskey.h
src/libknot/rdata/nsec.h
src/libknot/rdata/nsec3.c
src/libknot/rdata/nsec3.h
src/libknot/rdata/nsec3param.c
src/libknot/rdata/nsec3param.h
src/libknot/rdata/rdname.h
src/libknot/rdata/rrsig.h
src/libknot/rdata/soa.h
src/libknot/rdata/tsig.c
......
......@@ -167,7 +167,7 @@ libknot_la_SOURCES = \
libknot/packet/wire.h \
libknot/processing/process.c \
libknot/processing/process.h \
libknot/rdata/dname.h \
libknot/rdata/rdname.h \
libknot/rdata/dnskey.h \
libknot/rdata/nsec.h \
libknot/rdata/nsec3.c \
......
......@@ -26,7 +26,7 @@
#include "libknot/packet/wire.h"
#include "common/descriptor.h"
#include "libknot/tsig-op.h"
#include "libknot/rdata/dname.h"
#include "libknot/rdata/rdname.h"
#include "libknot/rdata/soa.h"
#include "libknot/dnssec/random.h"
#include "knot/dnssec/zone-sign.h"
......@@ -236,7 +236,7 @@ static int remote_c_zonestatus(server_t *s, remote_cmdargs_t* a)
const zone_t *zone = knot_zonedb_iter_val(&it);
/* Fetch latest serial. */
const knot_rrs_t *soa_rrs = NULL;
const knot_rdataset_t *soa_rrs = NULL;
uint32_t serial = 0;
if (zone->contents) {
soa_rrs = knot_node_rrs(zone->contents->apex,
......
......@@ -52,7 +52,7 @@ inline static bool valid_nsec3_node(const knot_node_t *node)
return false;
}
const knot_rrs_t *nsec3 = knot_node_rrs(node, KNOT_RRTYPE_NSEC3);
const knot_rdataset_t *nsec3 = knot_node_rrs(node, KNOT_RRTYPE_NSEC3);
if (nsec3 == NULL) {
return false;
}
......@@ -175,10 +175,10 @@ static void free_nsec3_tree(knot_zone_tree_t *nodes)
for (/* NOP */; !hattrie_iter_finished(it); hattrie_iter_next(it)) {
knot_node_t *node = (knot_node_t *)*hattrie_iter_val(it);
// newly allocated NSEC3 nodes
knot_rrs_t *nsec3 = knot_node_get_rrs(node, KNOT_RRTYPE_NSEC3);
knot_rrs_t *rrsig = knot_node_get_rrs(node, KNOT_RRTYPE_RRSIG);
knot_rrs_clear(nsec3, NULL);
knot_rrs_clear(rrsig, NULL);
knot_rdataset_t *nsec3 = knot_node_get_rrs(node, KNOT_RRTYPE_NSEC3);
knot_rdataset_t *rrsig = knot_node_get_rrs(node, KNOT_RRTYPE_RRSIG);
knot_rdataset_clear(nsec3, NULL);
knot_rdataset_clear(rrsig, NULL);
knot_node_free(&node);
}
......@@ -367,7 +367,7 @@ static int connect_nsec3_nodes(knot_node_t *a, knot_node_t *b,
assert(a->rrset_count == 1);
knot_rrs_t *a_rrs = knot_node_get_rrs(a, KNOT_RRTYPE_NSEC3);
knot_rdataset_t *a_rrs = knot_node_get_rrs(a, KNOT_RRTYPE_NSEC3);
assert(a_rrs);
uint8_t algorithm = knot_nsec3_algorithm(a_rrs, 0);
if (algorithm == 0) {
......
......@@ -93,7 +93,7 @@ static bool get_zone_soa_min_ttl(const knot_zone_contents_t *zone,
assert(ttl);
knot_node_t *apex = zone->apex;
const knot_rrs_t *soa = knot_node_rrs(apex, KNOT_RRTYPE_SOA);
const knot_rdataset_t *soa = knot_node_rrs(apex, KNOT_RRTYPE_SOA);
if (!soa) {
return false;
}
......
......@@ -31,7 +31,7 @@
#include "libknot/dnssec/policy.h"
#include "libknot/dnssec/rrset-sign.h"
#include "libknot/dnssec/sign.h"
#include "libknot/rdata/dname.h"
#include "libknot/rdata/rdname.h"
#include "libknot/rdata/rrsig.h"
#include "libknot/rdata/soa.h"
#include "knot/dnssec/zone-keys.h"
......@@ -266,8 +266,8 @@ static int remove_expired_rrsigs(const knot_rrset_t *covered,
}
}
knot_rr_t *rr_rem = knot_rrs_rr(&synth_rrsig.rrs, i);
result = knot_rrs_add_rr(&to_remove->rrs, rr_rem, NULL);
knot_rdata_t *rr_rem = knot_rdataset_at(&synth_rrsig.rrs, i);
result = knot_rdataset_add(&to_remove->rrs, rr_rem, NULL);
if (result != KNOT_EOK) {
break;
}
......@@ -282,7 +282,7 @@ static int remove_expired_rrsigs(const knot_rrset_t *covered,
knot_rrset_free(&to_remove, NULL);
}
knot_rrs_clear(&synth_rrsig.rrs, NULL);
knot_rdataset_clear(&synth_rrsig.rrs, NULL);
return result;
}
......@@ -470,8 +470,8 @@ static int remove_standalone_rrsigs(const knot_node_t *node,
if (to_remove == NULL) {
return KNOT_ENOMEM;
}
knot_rr_t *rr_rem = knot_rrs_rr(&rrsigs->rrs, i);
int ret = knot_rrs_add_rr(&to_remove->rrs, rr_rem, NULL);
knot_rdata_t *rr_rem = knot_rdataset_at(&rrsigs->rrs, i);
int ret = knot_rdataset_add(&to_remove->rrs, rr_rem, NULL);
if (ret != KNOT_EOK) {
knot_rrset_free(&to_remove, NULL);
return ret;
......@@ -788,8 +788,8 @@ static int remove_invalid_dnskeys(const knot_rrset_t *soa,
}
}
knot_rr_t *to_rem = knot_rrs_rr(&dnskeys->rrs, i);
result = knot_rrs_add_rr(&to_remove->rrs, to_rem, NULL);
knot_rdata_t *to_rem = knot_rdataset_at(&dnskeys->rrs, i);
result = knot_rdataset_add(&to_remove->rrs, to_rem, NULL);
if (result != KNOT_EOK) {
break;
}
......@@ -930,8 +930,8 @@ static int update_dnskeys_rrsigs(const knot_rrset_t *dnskeys,
continue;
}
knot_rr_t *to_add = knot_rrs_rr(&dnskeys->rrs, i);
result = knot_rrs_add_rr(&new_dnskeys->rrs, to_add, NULL);
knot_rdata_t *to_add = knot_rdataset_at(&dnskeys->rrs, i);
result = knot_rdataset_add(&new_dnskeys->rrs, to_add, NULL);
if (result != KNOT_EOK) {
goto fail;
}
......@@ -1022,7 +1022,7 @@ static int update_dnskeys(const knot_zone_contents_t *zone,
bool signatures_exist = (!knot_rrset_empty(&dnskeys) &&
all_signatures_exist(&dnskeys, &dnskey_rrsig,
zone_keys, policy));
knot_rrs_clear(&dnskey_rrsig.rrs, NULL);
knot_rdataset_clear(&dnskey_rrsig.rrs, NULL);
if (!modified && signatures_exist) {
return KNOT_EOK;
}
......
......@@ -17,7 +17,7 @@
#include "common/debug.h"
#include "common/descriptor.h"
#include "libknot/common.h"
#include "libknot/rdata/dname.h"
#include "libknot/rdata/rdname.h"
#include "libknot/rdata/soa.h"
#include "libknot/dnssec/rrset-sign.h"
#include "knot/nameserver/internet.h"
......@@ -129,8 +129,8 @@ static int put_rrsig(const knot_dname_t *sig_owner, uint16_t type,
knot_rrinfo_t *rrinfo,
struct query_data *qdata)
{
knot_rrs_t synth_rrs;
knot_rrs_init(&synth_rrs);
knot_rdataset_t synth_rrs;
knot_rdataset_init(&synth_rrs);
int ret = knot_synth_rrsig(type, &rrsigs->rrs, &synth_rrs, qdata->mm);
if (ret == KNOT_ENOENT) {
// No signature
......@@ -143,7 +143,7 @@ static int put_rrsig(const knot_dname_t *sig_owner, uint16_t type,
/* Create rrsig info structure. */
struct rrsig_info *info = mm_alloc(qdata->mm, sizeof(struct rrsig_info));
if (info == NULL) {
knot_rrs_clear(&synth_rrs, qdata->mm);
knot_rdataset_clear(&synth_rrs, qdata->mm);
return KNOT_ENOMEM;
}
......@@ -151,7 +151,7 @@ static int put_rrsig(const knot_dname_t *sig_owner, uint16_t type,
knot_dname_t *owner_copy = knot_dname_copy(sig_owner, qdata->mm);
if (owner_copy == NULL) {
mm_free(qdata->mm, info);
knot_rrs_clear(&synth_rrs, qdata->mm);
knot_rdataset_clear(&synth_rrs, qdata->mm);
return KNOT_ENOMEM;
}
knot_rrset_init(&info->synth_rrsig, owner_copy, rrsigs->type, rrsigs->rclass);
......@@ -262,7 +262,7 @@ static int put_authority_soa(knot_pkt_t *pkt, struct query_data *qdata,
return KNOT_ENOMEM;
}
knot_rrset_init(&copy, dname_cpy, soa_rrset.type, soa_rrset.rclass);
int ret = knot_rrs_copy(&copy.rrs, &soa_rrset.rrs, &pkt->mm);
int ret = knot_rdataset_copy(&copy.rrs, &soa_rrset.rrs, &pkt->mm);
if (ret != KNOT_EOK) {
knot_dname_free(&dname_cpy, &pkt->mm);
return ret;
......@@ -709,7 +709,7 @@ int ns_put_rr(knot_pkt_t *pkt, const knot_rrset_t *rr,
return KNOT_ENOMEM;
}
knot_rrset_init(&to_add, qname_cpy, rr->type, rr->rclass);
int ret = knot_rrs_copy(&to_add.rrs, &rr->rrs, &pkt->mm);
int ret = knot_rdataset_copy(&to_add.rrs, &rr->rrs, &pkt->mm);
if (ret != KNOT_EOK) {
knot_dname_free(&qname_cpy, &pkt->mm);
}
......
......@@ -789,7 +789,7 @@ int nsec_append_rrsigs(knot_pkt_t *pkt, struct query_data *qdata, bool optional)
break;
}
/* RRSIG is owned by packet now. */
knot_rrs_init(&info->synth_rrsig.rrs);
knot_rdataset_init(&info->synth_rrsig.rrs);
};
/* Clear the list. */
......
......@@ -21,10 +21,10 @@
static size_t rr_binary_size(const knot_rrset_t *rrset, size_t rdata_pos)
{
const knot_rr_t *rr = knot_rrs_rr(&rrset->rrs, rdata_pos);
const knot_rdata_t *rr = knot_rdataset_at(&rrset->rrs, rdata_pos);
if (rr) {
// RR size + TTL
return knot_rr_rdata_size(rr) + sizeof(uint32_t);
return knot_rdata_rdlen(rr) + sizeof(uint32_t);
} else {
return 0;
}
......@@ -54,11 +54,11 @@ static uint64_t rrset_binary_size(const knot_rrset_t *rrset)
static void serialize_rr(const knot_rrset_t *rrset, size_t rdata_pos,
uint8_t *stream)
{
const knot_rr_t *rr = knot_rrs_rr(&rrset->rrs, rdata_pos);
const knot_rdata_t *rr = knot_rdataset_at(&rrset->rrs, rdata_pos);
assert(rr);
uint32_t ttl = knot_rr_ttl(rr);
uint32_t ttl = knot_rdata_ttl(rr);
memcpy(stream, &ttl, sizeof(uint32_t));
memcpy(stream + sizeof(uint32_t), knot_rr_rdata(rr), knot_rr_rdata_size(rr));
memcpy(stream + sizeof(uint32_t), knot_rdata_data(rr), knot_rdata_rdlen(rr));
}
static int deserialize_rr(knot_rrset_t *rrset, const uint8_t *stream, uint32_t rdata_size)
......
......@@ -203,7 +203,7 @@ static void log_zone_load_info(const zone_t *zone, const char *zone_name,
int64_t serial = 0;
if (zone->contents && zone->contents->apex) {
const knot_rrs_t *soa = knot_node_rrs(zone->contents->apex,
const knot_rdataset_t *soa = knot_node_rrs(zone->contents->apex,
KNOT_RRTYPE_SOA);
serial = knot_soa_serial(soa);
}
......
......@@ -65,7 +65,7 @@ static uint32_t zones_jitter(uint32_t interval)
* \param rr_func RDATA specificator.
* \return Timer in miliseconds.
*/
static uint32_t zones_soa_timer(zone_t *zone, uint32_t (*rr_func)(const knot_rrs_t*))
static uint32_t zones_soa_timer(zone_t *zone, uint32_t (*rr_func)(const knot_rdataset_t*))
{
if (!zone) {
dbg_zones_verb("zones: zones_soa_timer() called "
......@@ -76,7 +76,7 @@ static uint32_t zones_soa_timer(zone_t *zone, uint32_t (*rr_func)(const knot_rrs
uint32_t ret = 0;
/* Retrieve SOA RDATA. */
const knot_rrs_t *soa_rrs = NULL;
const knot_rdataset_t *soa_rrs = NULL;
rcu_read_lock();
......@@ -951,7 +951,7 @@ int zones_zonefile_sync(zone_t *zone, journal_t *journal)
}
/* Latest zone serial. */
const knot_rrs_t *soa_rrs = knot_node_rrs(contents->apex,
const knot_rdataset_t *soa_rrs = knot_node_rrs(contents->apex,
KNOT_RRTYPE_SOA);
assert(soa_rrs != NULL);
......@@ -1836,7 +1836,7 @@ int zones_journal_apply(zone_t *zone)
}
/* Fetch SOA serial. */
const knot_rrs_t *soa_rrs = 0;
const knot_rdataset_t *soa_rrs = 0;
soa_rrs = knot_node_rrs(contents->apex, KNOT_RRTYPE_SOA);
assert(soa_rrs != NULL);
int64_t serial_ret = knot_soa_serial(soa_rrs);
......
......@@ -53,7 +53,7 @@ static int add_rr_to_list(list_t *l, const knot_rrset_t *rr)
ptrnode_t *ptr_n = (ptrnode_t *)n;
knot_rrset_t *rrset = (knot_rrset_t *)ptr_n->d;
if (knot_rrset_equal(rr, rrset, KNOT_RRSET_COMPARE_HEADER)) {
return knot_rrs_merge(&rrset->rrs, &rr->rrs, NULL);
return knot_rdataset_merge(&rrset->rrs, &rr->rrs, NULL);
}
};
......@@ -372,14 +372,14 @@ static bool node_empty(const knot_node_t *node, knot_dname_t *owner,
knot_rrset_t node_rr;
knot_rrset_init(&node_rr, node->owner, node_rrset.type, KNOT_CLASS_IN);
for (uint16_t j = 0; j < node_rrset.rrs.rr_count; ++j) {
knot_rr_t *add_rr = knot_rrs_rr(&node_rrset.rrs, j);
knot_rrs_add_rr(&node_rr.rrs, add_rr, NULL);
knot_rdata_t *add_rr = knot_rdataset_at(&node_rrset.rrs, j);
knot_rdataset_add(&node_rr.rrs, add_rr, NULL);
if (!removed_rr(changeset, &node_rr)) {
// One of the RRs from node was not removed.
knot_rrs_clear(&node_rr.rrs, NULL);
knot_rdataset_clear(&node_rr.rrs, NULL);
return false;
}
knot_rrs_clear(&node_rr.rrs, NULL);
knot_rdataset_clear(&node_rr.rrs, NULL);
}
}
......@@ -390,11 +390,11 @@ static bool node_empty(const knot_node_t *node, knot_dname_t *owner,
static bool node_contains_rr(const knot_node_t *node,
const knot_rrset_t *rr)
{
const knot_rrs_t *zone_rrs = knot_node_rrs(node, rr->type);
const knot_rdataset_t *zone_rrs = knot_node_rrs(node, rr->type);
if (zone_rrs) {
assert(rr->rrs.rr_count == 1);
const bool compare_ttls = false;
return knot_rrs_member(zone_rrs, knot_rrs_rr(&rr->rrs, 0),
return knot_rdataset_member(zone_rrs, knot_rdataset_at(&rr->rrs, 0),
compare_ttls);
} else {
return false;
......@@ -539,13 +539,13 @@ static int rem_rrset_to_chgset(const knot_rrset_t *rrset,
knot_rrset_t rr;
knot_rrset_init(&rr, rrset->owner, rrset->type, rrset->rclass);
for (uint16_t i = 0; i < rrset->rrs.rr_count; ++i) {
knot_rr_t *rr_add = knot_rrs_rr(&rrset->rrs, i);
int ret = knot_rrs_add_rr(&rr.rrs, rr_add, NULL);
knot_rdata_t *rr_add = knot_rdataset_at(&rrset->rrs, i);
int ret = knot_rdataset_add(&rr.rrs, rr_add, NULL);
if (ret != KNOT_EOK) {
return ret;
}
ret = rem_rr_to_chgset(&rr, changeset, apex_ns_rem);
knot_rrs_clear(&rr.rrs, NULL);
knot_rdataset_clear(&rr.rrs, NULL);
if (ret != KNOT_EOK) {
return ret;
}
......@@ -707,7 +707,7 @@ static int process_rem_rr(const knot_rrset_t *rr,
const bool apex_ns = knot_node_rrtype_exists(node, KNOT_RRTYPE_SOA) &&
rr->type == KNOT_RRTYPE_NS;
if (apex_ns) {
const knot_rrs_t *ns_rrs = knot_node_rrs(node, KNOT_RRTYPE_NS);
const knot_rdataset_t *ns_rrs = knot_node_rrs(node, KNOT_RRTYPE_NS);
if (*apex_ns_rem == ns_rrs->rr_count - 1) {
// Cannot remove last apex NS RR
return KNOT_EOK;
......@@ -729,7 +729,7 @@ static int process_rem_rr(const knot_rrset_t *rr,
knot_rrset_t intersection;
knot_rrset_init(&intersection, to_modify.owner, to_modify.type, KNOT_CLASS_IN);
int ret = knot_rrs_intersect(&to_modify.rrs, &rr->rrs, &intersection.rrs,
int ret = knot_rdataset_intersect(&to_modify.rrs, &rr->rrs, &intersection.rrs,
NULL);
if (ret != KNOT_EOK) {
return ret;
......@@ -742,7 +742,7 @@ static int process_rem_rr(const knot_rrset_t *rr,
assert(intersection.rrs.rr_count == 1);
ret = rem_rr_to_chgset(&intersection, changeset,
apex_ns ? apex_ns_rem : NULL);
knot_rrs_clear(&intersection.rrs, NULL);
knot_rdataset_clear(&intersection.rrs, NULL);
return ret;
}
......
......@@ -80,7 +80,7 @@ int xfrin_transfer_needed(const knot_zone_contents_t *zone,
/*
* Retrieve the local Serial
*/
const knot_rrs_t *soa_rrs =
const knot_rdataset_t *soa_rrs =
knot_node_rrs(knot_zone_contents_apex(zone), KNOT_RRTYPE_SOA);
if (soa_rrs == NULL) {
char *name = knot_dname_to_str(knot_node_owner(
......@@ -673,13 +673,13 @@ static int xfrin_replace_rrs_with_copy(knot_node_t *node,
assert(data);
// Create new data.
knot_rrs_t *rrs = &data->rrs;
void *copy = malloc(knot_rrs_size(rrs));
knot_rdataset_t *rrs = &data->rrs;
void *copy = malloc(knot_rdataset_size(rrs));
if (copy == NULL) {
return KNOT_ENOMEM;
}
memcpy(copy, rrs->data, knot_rrs_size(rrs));
memcpy(copy, rrs->data, knot_rdataset_size(rrs));
/*
* Clear additional array from node in new tree. It's callers
......@@ -694,9 +694,9 @@ static int xfrin_replace_rrs_with_copy(knot_node_t *node,
static void clear_new_rrs(knot_node_t *node, uint16_t type)
{
knot_rrs_t *new_rrs = knot_node_get_rrs(node, type);
knot_rdataset_t *new_rrs = knot_node_get_rrs(node, type);
if (new_rrs) {
knot_rrs_clear(new_rrs, NULL);
knot_rdataset_clear(new_rrs, NULL);
}
}
......@@ -706,7 +706,7 @@ static bool can_remove(const knot_node_t *node, const knot_rrset_t *rr)
// Node does not exist, cannot remove anything.
return false;
}
const knot_rrs_t *node_rrs = knot_node_rrs(node, rr->type);
const knot_rdataset_t *node_rrs = knot_node_rrs(node, rr->type);
if (node_rrs == NULL) {
// Node does not have this type at all.
return false;
......@@ -714,8 +714,8 @@ static bool can_remove(const knot_node_t *node, const knot_rrset_t *rr)
const bool compare_ttls = false;
for (uint16_t i = 0; i < rr->rrs.rr_count; ++i) {
knot_rr_t *rr_cmp = knot_rrs_rr(&rr->rrs, i);
if (knot_rrs_member(node_rrs, rr_cmp, compare_ttls)) {
knot_rdata_t *rr_cmp = knot_rdataset_at(&rr->rrs, i);
if (knot_rdataset_member(node_rrs, rr_cmp, compare_ttls)) {
// At least one RR matches.
return true;
}
......@@ -725,7 +725,7 @@ static bool can_remove(const knot_node_t *node, const knot_rrset_t *rr)
return false;
}
static int add_old_data(knot_changeset_t *chset, knot_rr_t *old_data,
static int add_old_data(knot_changeset_t *chset, knot_rdata_t *old_data,
knot_node_t **old_additional)
{
if (ptrlist_add(&chset->old_data, old_data, NULL) == NULL) {
......@@ -743,7 +743,7 @@ static int add_old_data(knot_changeset_t *chset, knot_rr_t *old_data,
return KNOT_EOK;
}
static int add_new_data(knot_changeset_t *chset, knot_rr_t *new_data)
static int add_new_data(knot_changeset_t *chset, knot_rdata_t *new_data)
{
if (ptrlist_add(&chset->new_data, new_data, NULL) == NULL) {
return KNOT_ENOMEM;
......@@ -756,7 +756,7 @@ static int remove_rr(knot_node_t *node, const knot_rrset_t *rr,
knot_changeset_t *chset)
{
knot_rrset_t removed_rrset = knot_node_rrset(node, rr->type);
knot_rr_t *old_data = removed_rrset.rrs.data;
knot_rdata_t *old_data = removed_rrset.rrs.data;
knot_node_t **old_additional = removed_rrset.additional;
int ret = xfrin_replace_rrs_with_copy(node, rr->type);
if (ret != KNOT_EOK) {
......@@ -770,9 +770,9 @@ static int remove_rr(knot_node_t *node, const knot_rrset_t *rr,
return ret;
}
knot_rrs_t *changed_rrs = knot_node_get_rrs(node, rr->type);
knot_rdataset_t *changed_rrs = knot_node_get_rrs(node, rr->type);
// Subtract changeset RRS from node RRS.
ret = knot_rrs_subtract(changed_rrs, &rr->rrs, NULL);
ret = knot_rdataset_subtract(changed_rrs, &rr->rrs, NULL);
if (ret != KNOT_EOK) {
clear_new_rrs(node, rr->type);
return ret;
......@@ -782,7 +782,7 @@ static int remove_rr(knot_node_t *node, const knot_rrset_t *rr,
// Subtraction left some data in RRSet, store it for rollback.
ret = add_new_data(chset, changed_rrs->data);
if (ret != KNOT_EOK) {
knot_rrs_clear(changed_rrs, NULL);
knot_rdataset_clear(changed_rrs, NULL);
return ret;
}
} else {
......@@ -823,7 +823,7 @@ static int add_rr(knot_node_t *node, const knot_rrset_t *rr,
knot_rrset_t changed_rrset = knot_node_rrset(node, rr->type);
if (!knot_rrset_empty(&changed_rrset)) {
// Modifying existing RRSet.
knot_rr_t *old_data = changed_rrset.rrs.data;
knot_rdata_t *old_data = changed_rrset.rrs.data;
knot_node_t **old_additional = changed_rrset.additional;
int ret = xfrin_replace_rrs_with_copy(node, rr->type);
if (ret != KNOT_EOK) {
......@@ -838,8 +838,8 @@ static int add_rr(knot_node_t *node, const knot_rrset_t *rr,
}
// Extract copy, merge into it
knot_rrs_t *changed_rrs = knot_node_get_rrs(node, rr->type);
ret = knot_rrs_merge(changed_rrs, &rr->rrs, NULL);
knot_rdataset_t *changed_rrs = knot_node_get_rrs(node, rr->type);
ret = knot_rdataset_merge(changed_rrs, &rr->rrs, NULL);
if (ret != KNOT_EOK) {
clear_new_rrs(node, rr->type);
return ret;
......@@ -865,10 +865,10 @@ static int add_rr(knot_node_t *node, const knot_rrset_t *rr,
}
// Get changed RRS and store for possible rollback.
knot_rrs_t *rrs = knot_node_get_rrs(node, rr->type);
knot_rdataset_t *rrs = knot_node_get_rrs(node, rr->type);
int ret = add_new_data(chset, rrs->data);
if (ret != KNOT_EOK) {
knot_rrs_clear(rrs, NULL);
knot_rdataset_clear(rrs, NULL);
return ret;
}
......@@ -929,7 +929,7 @@ static int xfrin_apply_changeset(list_t *old_rrs, list_t *new_rrs,
chset->serial_from, chset->serial_to);
// check if serial matches
const knot_rrs_t *soa = knot_node_rrs(contents->apex, KNOT_RRTYPE_SOA);
const knot_rdataset_t *soa = knot_node_rrs(contents->apex, KNOT_RRTYPE_SOA);
if (soa == NULL || knot_soa_serial(soa)
!= chset->serial_from) {
dbg_xfrin("SOA serials do not match!!\n");
......
......@@ -71,13 +71,13 @@ static inline void knot_node_flags_clear(knot_node_t *node, uint8_t flag)
static void rr_data_clear(struct rr_data *data, mm_ctx_t *mm)
{
knot_rrs_clear(&data->rrs, mm);
knot_rdataset_clear(&data->rrs, mm);
free(data->additional);
}
static int rr_data_from(const knot_rrset_t *rrset, struct rr_data *data, mm_ctx_t *mm)
{
int ret = knot_rrs_copy(&data->rrs, &rrset->rrs, mm);
int ret = knot_rdataset_copy(&data->rrs, &rrset->rrs, mm);
if (ret != KNOT_EOK) {
return ret;
}
......@@ -152,14 +152,14 @@ int knot_node_add_rrset(knot_node_t *node, const knot_rrset_t *rrset, bool *ttl
/* Check if the added RR has the same TTL as the first
* RR in the RRSet.
*/
knot_rr_t *first = knot_rrs_rr(&node_data->rrs, 0);
knot_rdata_t *first = knot_rdataset_at(&node_data->rrs, 0);
uint32_t inserted_ttl = knot_rrset_rr_ttl(rrset, 0);
if (ttl_err && rrset->type != KNOT_RRTYPE_RRSIG &&
inserted_ttl != knot_rr_ttl(first)) {
inserted_ttl != knot_rdata_ttl(first)) {
*ttl_err = true;
}
return knot_rrs_merge(&node_data->rrs, &rrset->rrs, NULL);
return knot_rdataset_merge(&node_data->rrs, &rrset->rrs, NULL);
}
}
......@@ -169,12 +169,12 @@ int knot_node_add_rrset(knot_node_t *node, const knot_rrset_t *rrset, bool *ttl
/*----------------------------------------------------------------------------*/
const knot_rrs_t *knot_node_rrs(const knot_node_t *node, uint16_t type)
const knot_rdataset_t *knot_node_rrs(const knot_node_t *node, uint16_t type)
{
return (const knot_rrs_t *)knot_node_get_rrs(node, type);
return (const knot_rdataset_t *)knot_node_get_rrs(node, type);
}
knot_rrs_t *knot_node_get_rrs(const knot_node_t *node, uint16_t type)
knot_rdataset_t *knot_node_get_rrs(const knot_node_t *node, uint16_t type)
{
if (node == NULL) {
return NULL;
......@@ -620,7 +620,7 @@ bool knot_node_rrtype_is_signed(const knot_node_t *node, uint16_t type)
return false;
}
const knot_rrs_t *rrsigs = knot_node_rrs(node, KNOT_RRTYPE_RRSIG);
const knot_rdataset_t *rrsigs = knot_node_rrs(node, KNOT_RRTYPE_RRSIG);
if (rrsigs == NULL) {
return false;
}
......
......@@ -88,7 +88,7 @@ typedef struct knot_node knot_node_t;
/*!< \brief Structure storing RR data. */
struct rr_data {
uint16_t type; /*!< \brief RR type of data. */
knot_rrs_t rrs; /*!< \brief Data of given type. */
knot_rdataset_t rrs; /*!< \brief Data of given type. */
knot_node_t **additional; /*!< \brief Additional nodes with glues. */
};
......@@ -136,8 +136,8 @@ knot_node_t *knot_node_new(const knot_dname_t *owner, knot_node_t *parent,
*/
int knot_node_add_rrset(knot_node_t *node, const knot_rrset_t *rrset, bool *ttl_err);
const knot_rrs_t *knot_node_rrs(const knot_node_t *node, uint16_t type);
knot_rrs_t *knot_node_get_rrs(const knot_node_t *node, uint16_t type);
const knot_rdataset_t *knot_node_rrs(const knot_node_t *node, uint16_t type);
knot_rdataset_t *knot_node_get_rrs(const knot_node_t *node, uint16_t type);
/*!
* \brief Returns the RRSet of the given type from the node (non-const version).
......
......@@ -289,7 +289,7 @@ static int check_dnskey_rdata(const knot_rrset_t *rrset, size_t rdata_pos)
*/
static int check_rrsig_rdata(err_handler_t *handler,
const knot_node_t *node,
const knot_rrs_t *rrsig,
const knot_rdataset_t *rrsig,
size_t rr_pos,
const knot_rrset_t *rrset,
const knot_rrset_t *dnskey_rrset)
......@@ -438,8 +438,8 @@ static int check_rrsig_in_rrset(err_handler_t *handler,
if (ret < 0 || ret >= sizeof(info_str)) {
return KNOT_ENOMEM;
}
knot_rrs_t rrsigs;
knot_rrs_init(&rrsigs);
knot_rdataset_t rrsigs;
knot_rdataset_init(&rrsigs);
ret = knot_synth_rrsig(rrset->type,
knot_node_rrs(node, KNOT_RRTYPE_RRSIG),
&rrsigs, NULL);
......@@ -464,8 +464,8 @@ static int check_rrsig_in_rrset(err_handler_t *handler,
/* Safe to continue, nothing is malformed. */
}
const knot_rr_t *sig_rr = knot_rrs_rr(&rrsigs, 0);
if (knot_rrset_rr_ttl(rrset, 0) != knot_rr_ttl(sig_rr)) {
const knot_rdata_t *sig_rr = knot_rdataset_at(&rrsigs, 0);
if (knot_rrset_rr_ttl(rrset, 0) != knot_rdata_ttl(sig_rr)) {
err_handler_handle_error(handler, node,
ZC_ERR_RRSIG_TTL,
info_str);
......@@ -481,7 +481,7 @@ static int check_rrsig_in_rrset(err_handler_t *handler,
}
}
knot_rrs_clear(&rrsigs, NULL);
knot_rdataset_clear(&rrsigs, NULL);
return ret;
}
......@@ -512,7 +512,7 @@ static int get_bit(uint8_t *bits, size_t index)
* \retval KNOT_OK on success.
* \retval KNOT_NOMEM on memory error.
*/
static int rdata_nsec_to_type_array(const knot_rrs_t *rrs, uint16_t type,
static int rdata_nsec_to_type_array(const knot_rdataset_t *rrs, uint16_t type,
size_t pos, uint16_t **array, size_t *count)
{
assert(*array == NULL);
......@@ -620,7 +620,7 @@ static int check_nsec3_node_in_zone(knot_zone_contents_t *zone,
assert(nsec3_previous);
const knot_rrs_t *previous_rrs =
const knot_rdataset_t *previous_rrs =
knot_node_rrs(nsec3_previous, KNOT_RRTYPE_NSEC3);
assert(previous_rrs);
......@@ -640,7 +640,7 @@ static int check_nsec3_node_in_zone(knot_zone_contents_t *zone,
}
}
const knot_rrs_t *nsec3_rrs = knot_node_rrs(nsec3_node,
const knot_rdataset_t *nsec3_rrs = knot_node_rrs(nsec3_node,
KNOT_RRTYPE_NSEC3);
if (nsec3_rrs == NULL) {
err_handler_handle_error(handler, node,
......@@ -648,11 +648,11 @@ static int check_nsec3_node_in_zone(knot_zone_contents_t *zone,
return KNOT_EOK;
}
const knot_rr_t *nsec3_rr = knot_rrs_rr(nsec3_rrs, 0);
const knot_rrs_t *soa_rrs = knot_node_rrs(zone->apex, KNOT_RRTYPE_SOA);
const knot_rdata_t *nsec3_rr = knot_rdataset_at(nsec3_rrs, 0);
const knot_rdataset_t *soa_rrs = knot_node_rrs(zone->apex, KNOT_RRTYPE_SOA);
assert(soa_rrs);
uint32_t minimum_ttl = knot_soa_minimum(soa_rrs);
if (knot_rr_ttl(nsec3_rr) != minimum_ttl) {
if (knot_rdata_ttl(nsec3_rr) != minimum_ttl) {
err_handler_handle_error(handler, node,
ZC_ERR_NSEC3_RDATA_TTL, NULL);
}
......@@ -721,7 +721,7 @@ static int check_nsec3_node_in_zone(knot_zone_contents_t *zone,
static int sem_check_node_mandatory(const knot_node_t *node,
err_handler_t *handler, bool *fatal_error)
{
const knot_rrs_t *cname_rrs = knot_node_rrs(node, KNOT_RRTYPE_CNAME);
const knot_rdataset_t *cname_rrs = knot_node_rrs(node, KNOT_RRTYPE_CNAME);
if (cname_rrs) {
if (knot_node_rrset_count(node) != 1) {
/* With DNSSEC node can contain RRSIGs or NSEC */
......@@ -741,7 +741,7 @@ static int sem_check_node_mandatory(const knot_node_t *node,
}
}
const knot_rrs_t *dname_rrs = knot_node_rrs(node, KNOT_RRTYPE_DNAME);
const knot_rdataset_t *dname_rrs = knot_node_rrs(node, KNOT_RRTYPE_DNAME);
if (dname_rrs) {
if (cname_rrs) {
*fatal_error = true;
......@@ -776,7 +776,7 @@ static int sem_check_node_optional(const knot_zone_contents_t *zone,
node)) {
return KNOT_EOK;
}
const knot_rrs_t *ns_rrs = knot_node_rrs(node, KNOT_RRTYPE_NS);
const knot_rdataset_t *ns_rrs = knot_node_rrs(node, KNOT_RRTYPE_NS);
if (ns_rrs == NULL) {
err_handler_handle_error(handler, node,
ZC_ERR_MISSING_NS_DEL_POINT,
......@@ -895,7 +895,7 @@ static int semantic_checks_dnssec(knot_zone_contents_t *zone,
if (!nsec3 && auth) {
/* check for NSEC record */
const knot_rrs_t *nsec_rrs =
const knot_rdataset_t *nsec_rrs =
knot_node_rrs(node, KNOT_RRTYPE_NSEC);
if (nsec_rrs == NULL) {
err_handler_handle_error(handler, node,
......@@ -1068,7 +1068,7 @@ void log_cyclic_errors_in_zone(err_handler_t *handler,
if (last_nsec3_node == NULL || first_nsec3_node == NULL) {
return;
}
const knot_rrs_t *nsec3_rrs =