Commit 94ae366b authored by Daniel Salzman's avatar Daniel Salzman

libknot/rdataset: rename structure items

parent 90f073b5
...@@ -540,7 +540,7 @@ static int send_rrset(knot_rrset_t *rrset, send_ctx_t *ctx) ...@@ -540,7 +540,7 @@ static int send_rrset(knot_rrset_t *rrset, send_ctx_t *ctx)
return KNOT_ESPACE; return KNOT_ESPACE;
} }
for (size_t i = 0; i < rrset->rrs.rr_count; ++i) { for (size_t i = 0; i < rrset->rrs.count; ++i) {
ret = knot_rrset_txt_dump_data(rrset, i, ctx->rdata, ret = knot_rrset_txt_dump_data(rrset, i, ctx->rdata,
sizeof(ctx->rdata), &ctx->style); sizeof(ctx->rdata), &ctx->style);
if (ret < 0) { if (ret < 0) {
......
...@@ -94,7 +94,7 @@ static int ds_query_consume(knot_layer_t *layer, knot_pkt_t *pkt) ...@@ -94,7 +94,7 @@ static int ds_query_consume(knot_layer_t *layer, knot_pkt_t *pkt)
for (size_t j = 0; j < answer->count; j++) { for (size_t j = 0; j < answer->count; j++) {
const knot_rrset_t *rr = knot_pkt_rr(answer, j); const knot_rrset_t *rr = knot_pkt_rr(answer, j);
if (!rr || rr->type != KNOT_RRTYPE_DS || rr->rrs.rr_count != 1) { if (!rr || rr->type != KNOT_RRTYPE_DS || rr->rrs.count != 1) {
ns_log(LOG_WARNING, data->zone_name, LOG_OPERATION_PARENT, ns_log(LOG_WARNING, data->zone_name, LOG_OPERATION_PARENT,
LOG_DIRECTION_OUT, data->remote, "malformed message"); LOG_DIRECTION_OUT, data->remote, "malformed message");
return KNOT_STATE_FAIL; return KNOT_STATE_FAIL;
......
...@@ -44,7 +44,7 @@ inline static bool valid_nsec3_node(const zone_node_t *node) ...@@ -44,7 +44,7 @@ inline static bool valid_nsec3_node(const zone_node_t *node)
return false; return false;
} }
if (nsec3->rr_count != 1) { if (nsec3->count != 1) {
return false; return false;
} }
......
...@@ -281,11 +281,11 @@ int knot_synth_rrsig(uint16_t type, const knot_rdataset_t *rrsig_rrs, ...@@ -281,11 +281,11 @@ int knot_synth_rrsig(uint16_t type, const knot_rdataset_t *rrsig_rrs,
return KNOT_ENOENT; return KNOT_ENOENT;
} }
if (out_sig == NULL || out_sig->rr_count > 0) { if (out_sig == NULL || out_sig->count > 0) {
return KNOT_EINVAL; return KNOT_EINVAL;
} }
for (int i = 0; i < rrsig_rrs->rr_count; ++i) { for (int i = 0; i < rrsig_rrs->count; ++i) {
if (type == knot_rrsig_type_covered(rrsig_rrs, i)) { if (type == knot_rrsig_type_covered(rrsig_rrs, i)) {
const knot_rdata_t *rr_to_copy = knot_rdataset_at(rrsig_rrs, i); const knot_rdata_t *rr_to_copy = knot_rdataset_at(rrsig_rrs, i);
int ret = knot_rdataset_add(out_sig, rr_to_copy, mm); int ret = knot_rdataset_add(out_sig, rr_to_copy, mm);
...@@ -296,7 +296,7 @@ int knot_synth_rrsig(uint16_t type, const knot_rdataset_t *rrsig_rrs, ...@@ -296,7 +296,7 @@ int knot_synth_rrsig(uint16_t type, const knot_rdataset_t *rrsig_rrs,
} }
} }
return out_sig->rr_count > 0 ? KNOT_EOK : KNOT_ENOENT; return out_sig->count > 0 ? KNOT_EOK : KNOT_ENOENT;
} }
/*- Verification of signatures -----------------------------------------------*/ /*- Verification of signatures -----------------------------------------------*/
......
...@@ -174,7 +174,7 @@ static bool nsec3param_valid(const knot_rdataset_t *rrs, ...@@ -174,7 +174,7 @@ static bool nsec3param_valid(const knot_rdataset_t *rrs,
} }
// multiple NSEC3 records // multiple NSEC3 records
if (rrs->rr_count != 1) { if (rrs->count != 1) {
return false; return false;
} }
......
...@@ -110,7 +110,7 @@ static bool valid_signature_exists(const knot_rrset_t *covered, ...@@ -110,7 +110,7 @@ static bool valid_signature_exists(const knot_rrset_t *covered,
return false; return false;
} }
uint16_t rrsigs_rdata_count = rrsigs->rrs.rr_count; uint16_t rrsigs_rdata_count = rrsigs->rrs.count;
for (uint16_t i = 0; i < rrsigs_rdata_count; i++) { for (uint16_t i = 0; i < rrsigs_rdata_count; i++) {
uint16_t rr_keytag = knot_rrsig_key_tag(&rrsigs->rrs, i); uint16_t rr_keytag = knot_rrsig_key_tag(&rrsigs->rrs, i);
uint16_t rr_covered = knot_rrsig_type_covered(&rrsigs->rrs, i); uint16_t rr_covered = knot_rrsig_type_covered(&rrsigs->rrs, i);
...@@ -278,7 +278,7 @@ static int remove_expired_rrsigs(const knot_rrset_t *covered, ...@@ -278,7 +278,7 @@ static int remove_expired_rrsigs(const knot_rrset_t *covered,
return KNOT_EOK; return KNOT_EOK;
} }
uint16_t rrsig_rdata_count = synth_rrsig.rrs.rr_count; uint16_t rrsig_rdata_count = synth_rrsig.rrs.count;
for (uint16_t i = 0; i < rrsig_rdata_count; i++) { for (uint16_t i = 0; i < rrsig_rdata_count; i++) {
struct keyptr_dynarray keys = get_matching_zone_keys(&synth_rrsig, i, zone_keys); struct keyptr_dynarray keys = get_matching_zone_keys(&synth_rrsig, i, zone_keys);
int endloop = 0; // 1 - continue; 2 - break int endloop = 0; // 1 - continue; 2 - break
...@@ -481,7 +481,7 @@ static int remove_standalone_rrsigs(const zone_node_t *node, ...@@ -481,7 +481,7 @@ static int remove_standalone_rrsigs(const zone_node_t *node,
return KNOT_EOK; return KNOT_EOK;
} }
uint16_t rrsigs_rdata_count = rrsigs->rrs.rr_count; uint16_t rrsigs_rdata_count = rrsigs->rrs.count;
for (uint16_t i = 0; i < rrsigs_rdata_count; ++i) { for (uint16_t i = 0; i < rrsigs_rdata_count; ++i) {
uint16_t type_covered = knot_rrsig_type_covered(&rrsigs->rrs, i); uint16_t type_covered = knot_rrsig_type_covered(&rrsigs->rrs, i);
if (!node_rrtype_exists(node, type_covered)) { if (!node_rrtype_exists(node, type_covered)) {
......
...@@ -832,7 +832,7 @@ static int soa_query_consume(knot_layer_t *layer, knot_pkt_t *pkt) ...@@ -832,7 +832,7 @@ static int soa_query_consume(knot_layer_t *layer, knot_pkt_t *pkt)
const knot_pktsection_t *answer = knot_pkt_section(pkt, KNOT_ANSWER); const knot_pktsection_t *answer = knot_pkt_section(pkt, KNOT_ANSWER);
const knot_rrset_t *rr = answer->count == 1 ? knot_pkt_rr(answer, 0) : NULL; const knot_rrset_t *rr = answer->count == 1 ? knot_pkt_rr(answer, 0) : NULL;
if (!rr || rr->type != KNOT_RRTYPE_SOA || rr->rrs.rr_count != 1) { if (!rr || rr->type != KNOT_RRTYPE_SOA || rr->rrs.count != 1) {
REFRESH_LOG(LOG_WARNING, data->zone->name, data->remote, REFRESH_LOG(LOG_WARNING, data->zone->name, data->remote,
"malformed message"); "malformed message");
return KNOT_STATE_FAIL; return KNOT_STATE_FAIL;
......
...@@ -114,7 +114,7 @@ void serialize_prepare(serialize_ctx_t *ctx, size_t max_size, size_t *realsize) ...@@ -114,7 +114,7 @@ void serialize_prepare(serialize_ctx_t *ctx, size_t max_size, size_t *realsize)
size_t candidate = 0; size_t candidate = 0;
long tmp_phase = ctx->rrset_phase; long tmp_phase = ctx->rrset_phase;
while (1) { while (1) {
if (tmp_phase >= ctx->rrset_buf[ctx->rrset_buf_size - 1].rrs.rr_count) { if (tmp_phase >= ctx->rrset_buf[ctx->rrset_buf_size - 1].rrs.count) {
if (ctx->rrset_buf_size >= RRSET_BUF_MAXSIZE) { if (ctx->rrset_buf_size >= RRSET_BUF_MAXSIZE) {
return; return;
} }
...@@ -145,7 +145,7 @@ void serialize_chunk(serialize_ctx_t *ctx, uint8_t *dst_chunk, size_t chunk_size ...@@ -145,7 +145,7 @@ void serialize_chunk(serialize_ctx_t *ctx, uint8_t *dst_chunk, size_t chunk_size
wire_ctx_t wire = wire_ctx_init(dst_chunk, chunk_size); wire_ctx_t wire = wire_ctx_init(dst_chunk, chunk_size);
for (size_t i = 0; ; ) { for (size_t i = 0; ; ) {
if (ctx->rrset_phase >= ctx->rrset_buf[i].rrs.rr_count) { if (ctx->rrset_phase >= ctx->rrset_buf[i].rrs.count) {
if (++i >= ctx->rrset_buf_size) { if (++i >= ctx->rrset_buf_size) {
break; break;
} }
...@@ -160,7 +160,7 @@ void serialize_chunk(serialize_ctx_t *ctx, uint8_t *dst_chunk, size_t chunk_size ...@@ -160,7 +160,7 @@ void serialize_chunk(serialize_ctx_t *ctx, uint8_t *dst_chunk, size_t chunk_size
wire_ctx_skip(&wire, size); wire_ctx_skip(&wire, size);
wire_ctx_write_u16(&wire, ctx->rrset_buf[i].type); wire_ctx_write_u16(&wire, ctx->rrset_buf[i].type);
wire_ctx_write_u16(&wire, ctx->rrset_buf[i].rclass); wire_ctx_write_u16(&wire, ctx->rrset_buf[i].rclass);
wire_ctx_write_u16(&wire, ctx->rrset_buf[i].rrs.rr_count); wire_ctx_write_u16(&wire, ctx->rrset_buf[i].rrs.count);
} else { } else {
const knot_rdata_t *rr = knot_rdataset_at(&ctx->rrset_buf[i].rrs, const knot_rdata_t *rr = knot_rdataset_at(&ctx->rrset_buf[i].rrs,
ctx->rrset_phase); ctx->rrset_phase);
...@@ -265,7 +265,7 @@ int deserialize_rrset_chunks(wire_ctx_t *wire, knot_rrset_t *rrset, ...@@ -265,7 +265,7 @@ int deserialize_rrset_chunks(wire_ctx_t *wire, knot_rrset_t *rrset,
static uint64_t rrset_binary_size(const knot_rrset_t *rrset) static uint64_t rrset_binary_size(const knot_rrset_t *rrset)
{ {
if (rrset == NULL || rrset->rrs.rr_count == 0) { if (rrset == NULL || rrset->rrs.count == 0) {
return 0; return 0;
} }
...@@ -273,7 +273,7 @@ static uint64_t rrset_binary_size(const knot_rrset_t *rrset) ...@@ -273,7 +273,7 @@ static uint64_t rrset_binary_size(const knot_rrset_t *rrset)
uint64_t size = knot_dname_size(rrset->owner) + 3 * sizeof(uint16_t); uint64_t size = knot_dname_size(rrset->owner) + 3 * sizeof(uint16_t);
// RRs. // RRs.
for (uint16_t i = 0; i < rrset->rrs.rr_count; i++) { for (uint16_t i = 0; i < rrset->rrs.count; i++) {
const knot_rdata_t *rr = knot_rdataset_at(&rrset->rrs, i); const knot_rdata_t *rr = knot_rdataset_at(&rrset->rrs, i);
assert(rr); assert(rr);
......
...@@ -824,7 +824,7 @@ int process_query_put_rr(knot_pkt_t *pkt, knotd_qdata_t *qdata, ...@@ -824,7 +824,7 @@ int process_query_put_rr(knot_pkt_t *pkt, knotd_qdata_t *qdata,
const knot_rrset_t *rr, const knot_rrset_t *rrsigs, const knot_rrset_t *rr, const knot_rrset_t *rrsigs,
uint16_t compr_hint, uint32_t flags) uint16_t compr_hint, uint32_t flags)
{ {
if (rr->rrs.rr_count < 1) { if (rr->rrs.count < 1) {
return KNOT_EMALF; return KNOT_EMALF;
} }
......
/* Copyright (C) 2017 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> /* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -76,10 +76,10 @@ static int replace_rdataset_with_copy(zone_node_t *node, uint16_t type) ...@@ -76,10 +76,10 @@ static int replace_rdataset_with_copy(zone_node_t *node, uint16_t type)
return KNOT_ENOMEM; return KNOT_ENOMEM;
} }
memcpy(copy, rrs->data, knot_rdataset_size(rrs)); memcpy(copy, rrs->rdata, knot_rdataset_size(rrs));
// Store new data into node RRS. // Store new data into node RRS.
rrs->data = copy; rrs->rdata = copy;
return KNOT_EOK; return KNOT_EOK;
} }
...@@ -126,7 +126,7 @@ static bool can_remove(const zone_node_t *node, const knot_rrset_t *rr) ...@@ -126,7 +126,7 @@ static bool can_remove(const zone_node_t *node, const knot_rrset_t *rr)
return false; return false;
} }
for (uint16_t i = 0; i < rr->rrs.rr_count; ++i) { for (uint16_t i = 0; i < rr->rrs.count; ++i) {
knot_rdata_t *rr_cmp = knot_rdataset_at(&rr->rrs, i); knot_rdata_t *rr_cmp = knot_rdataset_at(&rr->rrs, i);
if (knot_rdataset_member(node_rrs, rr_cmp)) { if (knot_rdataset_member(node_rrs, rr_cmp)) {
// At least one RR matches. // At least one RR matches.
...@@ -264,7 +264,7 @@ int apply_add_rr(apply_ctx_t *ctx, const knot_rrset_t *rr) ...@@ -264,7 +264,7 @@ int apply_add_rr(apply_ctx_t *ctx, const knot_rrset_t *rr)
knot_rrset_t changed_rrset = node_rrset(node, rr->type); knot_rrset_t changed_rrset = node_rrset(node, rr->type);
if (!knot_rrset_empty(&changed_rrset)) { if (!knot_rrset_empty(&changed_rrset)) {
// Modifying existing RRSet. // Modifying existing RRSet.
knot_rdata_t *old_data = changed_rrset.rrs.data; knot_rdata_t *old_data = changed_rrset.rrs.rdata;
int ret = replace_rdataset_with_copy(node, rr->type); int ret = replace_rdataset_with_copy(node, rr->type);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
return ret; return ret;
...@@ -283,7 +283,7 @@ int apply_add_rr(apply_ctx_t *ctx, const knot_rrset_t *rr) ...@@ -283,7 +283,7 @@ int apply_add_rr(apply_ctx_t *ctx, const knot_rrset_t *rr)
if (ret == KNOT_EOK || ret == KNOT_ETTL) { if (ret == KNOT_EOK || ret == KNOT_ETTL) {
// RR added, store for possible rollback. // RR added, store for possible rollback.
knot_rdataset_t *rrs = node_rdataset(node, rr->type); knot_rdataset_t *rrs = node_rdataset(node, rr->type);
int data_ret = add_new_data(ctx, rrs->data); int data_ret = add_new_data(ctx, rrs->rdata);
if (data_ret != KNOT_EOK) { if (data_ret != KNOT_EOK) {
knot_rdataset_clear(rrs, NULL); knot_rdataset_clear(rrs, NULL);
return data_ret; return data_ret;
...@@ -326,7 +326,7 @@ int apply_remove_rr(apply_ctx_t *ctx, const knot_rrset_t *rr) ...@@ -326,7 +326,7 @@ int apply_remove_rr(apply_ctx_t *ctx, const knot_rrset_t *rr)
contents->nsec3_nodes : contents->nodes; contents->nsec3_nodes : contents->nodes;
knot_rrset_t removed_rrset = node_rrset(node, rr->type); knot_rrset_t removed_rrset = node_rrset(node, rr->type);
knot_rdata_t *old_data = removed_rrset.rrs.data; knot_rdata_t *old_data = removed_rrset.rrs.rdata;
int ret = replace_rdataset_with_copy(node, rr->type); int ret = replace_rdataset_with_copy(node, rr->type);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
return ret; return ret;
...@@ -347,9 +347,9 @@ int apply_remove_rr(apply_ctx_t *ctx, const knot_rrset_t *rr) ...@@ -347,9 +347,9 @@ int apply_remove_rr(apply_ctx_t *ctx, const knot_rrset_t *rr)
return ret; return ret;
} }
if (changed_rrs->rr_count > 0) { if (changed_rrs->count > 0) {
// Subtraction left some data in RRSet, store it for rollback. // Subtraction left some data in RRSet, store it for rollback.
ret = add_new_data(ctx, changed_rrs->data); ret = add_new_data(ctx, changed_rrs->rdata);
if (ret != KNOT_EOK) { if (ret != KNOT_EOK) {
knot_rdataset_clear(changed_rrs, NULL); knot_rdataset_clear(changed_rrs, NULL);
return ret; return ret;
......
...@@ -163,7 +163,7 @@ static int check_not_in_use(zone_update_t *update, ...@@ -163,7 +163,7 @@ static int check_not_in_use(zone_update_t *update,
/*!< \brief Returns true if rrset has 0 data or RDATA of size 0 (we need TTL).*/ /*!< \brief Returns true if rrset has 0 data or RDATA of size 0 (we need TTL).*/
static bool rrset_empty(const knot_rrset_t *rrset) static bool rrset_empty(const knot_rrset_t *rrset)
{ {
uint16_t rr_count = rrset->rrs.rr_count; uint16_t rr_count = rrset->rrs.count;
if (rr_count == 0) { if (rr_count == 0) {
return true; return true;
} }
...@@ -282,7 +282,7 @@ static bool node_contains_rr(const zone_node_t *node, ...@@ -282,7 +282,7 @@ static bool node_contains_rr(const zone_node_t *node,
{ {
const knot_rdataset_t *zone_rrs = node_rdataset(node, rr->type); const knot_rdataset_t *zone_rrs = node_rdataset(node, rr->type);
if (zone_rrs) { if (zone_rrs) {
assert(rr->rrs.rr_count == 1); assert(rr->rrs.count == 1);
return knot_rdataset_member(zone_rrs, knot_rdataset_at(&rr->rrs, 0)); return knot_rdataset_member(zone_rrs, knot_rdataset_at(&rr->rrs, 0));
} else { } else {
return false; return false;
...@@ -494,7 +494,7 @@ static int process_rem_rr(const knot_rrset_t *rr, ...@@ -494,7 +494,7 @@ static int process_rem_rr(const knot_rrset_t *rr,
// Zone without apex NS. // Zone without apex NS.
return KNOT_EOK; return KNOT_EOK;
} }
if (ns_rrs->rr_count == 1) { if (ns_rrs->count == 1) {
// Cannot remove last apex NS RR. // Cannot remove last apex NS RR.
return KNOT_EOK; return KNOT_EOK;
} }
...@@ -507,7 +507,7 @@ static int process_rem_rr(const knot_rrset_t *rr, ...@@ -507,7 +507,7 @@ static int process_rem_rr(const knot_rrset_t *rr,
} }
knot_rdataset_t *rrs = node_rdataset(node, rr->type); knot_rdataset_t *rrs = node_rdataset(node, rr->type);
if (!knot_rdataset_member(rrs, rr->rrs.data)) { if (!knot_rdataset_member(rrs, rr->rrs.rdata)) {
// Node does not contain this RR // Node does not contain this RR
return KNOT_EOK; return KNOT_EOK;
} }
......
...@@ -120,7 +120,7 @@ static int discover_additionals(const knot_dname_t *owner, struct rr_data *rr_da ...@@ -120,7 +120,7 @@ static int discover_additionals(const knot_dname_t *owner, struct rr_data *rr_da
rr_data->additional = NULL; rr_data->additional = NULL;
const knot_rdataset_t *rrs = &rr_data->rrs; const knot_rdataset_t *rrs = &rr_data->rrs;
uint16_t rdcount = rrs->rr_count; uint16_t rdcount = rrs->count;
uint16_t mandatory_count = 0; uint16_t mandatory_count = 0;
uint16_t others_count = 0; uint16_t others_count = 0;
...@@ -353,7 +353,7 @@ static int adjust_nsec3_node(zone_node_t **tnode, void *data) ...@@ -353,7 +353,7 @@ static int adjust_nsec3_node(zone_node_t **tnode, void *data)
// check if this node belongs to correct chain // check if this node belongs to correct chain
const knot_rdataset_t *nsec3_rrs = node_rdataset(node, KNOT_RRTYPE_NSEC3); const knot_rdataset_t *nsec3_rrs = node_rdataset(node, KNOT_RRTYPE_NSEC3);
for (uint16_t i = 0; nsec3_rrs != NULL && i < nsec3_rrs->rr_count; i++) { for (uint16_t i = 0; nsec3_rrs != NULL && i < nsec3_rrs->count; i++) {
if (nsec3_params_match(nsec3_rrs, &args->zone->nsec3_params, i)) { if (nsec3_params_match(nsec3_rrs, &args->zone->nsec3_params, i)) {
node->flags |= NODE_FLAGS_IN_NSEC3_CHAIN; node->flags |= NODE_FLAGS_IN_NSEC3_CHAIN;
} }
...@@ -641,7 +641,7 @@ static int remove_rr(zone_contents_t *z, const knot_rrset_t *rr, ...@@ -641,7 +641,7 @@ static int remove_rr(zone_contents_t *z, const knot_rrset_t *rr,
return ret; return ret;
} }
if (node_rrs->rr_count == 0) { if (node_rrs->count == 0) {
// RRSet is empty now, remove it from node, all data freed. // RRSet is empty now, remove it from node, all data freed.
node_remove_rdataset(node, rr->type); node_remove_rdataset(node, rr->type);
// If node is empty now, delete it from zone tree. // If node is empty now, delete it from zone tree.
...@@ -966,7 +966,7 @@ static int load_nsec3param(zone_contents_t *contents) ...@@ -966,7 +966,7 @@ static int load_nsec3param(zone_contents_t *contents)
return KNOT_EOK; return KNOT_EOK;
} }
if (rrs->rr_count < 1) { if (rrs->count < 1) {
return KNOT_EINVAL; return KNOT_EINVAL;
} }
......
...@@ -76,7 +76,7 @@ static int add_rrset_no_merge(zone_node_t *node, const knot_rrset_t *rrset, ...@@ -76,7 +76,7 @@ static int add_rrset_no_merge(zone_node_t *node, const knot_rrset_t *rrset,
/*! \brief Checks if the added RR has the same TTL as the first RR in the node. */ /*! \brief Checks if the added RR has the same TTL as the first RR in the node. */
static bool ttl_changed(struct rr_data *node_data, const knot_rrset_t *rrset) static bool ttl_changed(struct rr_data *node_data, const knot_rrset_t *rrset)
{ {
if (rrset->type == KNOT_RRTYPE_RRSIG || node_data->rrs.rr_count == 0) { if (rrset->type == KNOT_RRTYPE_RRSIG || node_data->rrs.count == 0) {
return false; return false;
} }
...@@ -272,7 +272,7 @@ bool node_rrtype_is_signed(const zone_node_t *node, uint16_t type) ...@@ -272,7 +272,7 @@ bool node_rrtype_is_signed(const zone_node_t *node, uint16_t type)
return false; return false;
} }
uint16_t rrsigs_rdata_count = rrsigs->rr_count; uint16_t rrsigs_rdata_count = rrsigs->count;
for (uint16_t i = 0; i < rrsigs_rdata_count; ++i) { for (uint16_t i = 0; i < rrsigs_rdata_count; ++i) {
const uint16_t type_covered = const uint16_t type_covered =
knot_rrsig_type_covered(rrsigs, i); knot_rrsig_type_covered(rrsigs, i);
......
...@@ -349,7 +349,7 @@ static int check_rrsig_rdata(sem_handler_t *handler, ...@@ -349,7 +349,7 @@ static int check_rrsig_rdata(sem_handler_t *handler,
return KNOT_EOK; return KNOT_EOK;
} }
for (int i = 0; i < dnskeys->rr_count; i++) { for (int i = 0; i < dnskeys->count; i++) {
uint16_t flags = knot_dnskey_flags(dnskeys, i); uint16_t flags = knot_dnskey_flags(dnskeys, i);
uint8_t proto = knot_dnskey_proto(dnskeys, i); uint8_t proto = knot_dnskey_proto(dnskeys, i);
/* RFC 4034 2.1.1 & 2.1.2 */ /* RFC 4034 2.1.1 & 2.1.2 */
...@@ -432,7 +432,7 @@ static int check_rrsig_in_rrset(sem_handler_t *handler, ...@@ -432,7 +432,7 @@ static int check_rrsig_in_rrset(sem_handler_t *handler,
} }
bool verified = false; bool verified = false;
for (uint16_t i = 0; ret == KNOT_EOK && i < (&rrsigs)->rr_count; ++i) { for (uint16_t i = 0; ret == KNOT_EOK && i < (&rrsigs)->count; ++i) {
ret = check_rrsig_rdata(handler, zone, node, &rrsigs, i, rrset, ret = check_rrsig_rdata(handler, zone, node, &rrsigs, i, rrset,
context, level, &verified); context, level, &verified);
} }
...@@ -468,7 +468,7 @@ static int check_delegation(const zone_node_t *node, semchecks_data_t *data) ...@@ -468,7 +468,7 @@ static int check_delegation(const zone_node_t *node, semchecks_data_t *data)
} }
// check glue record for delegation // check glue record for delegation
for (int i = 0; i < ns_rrs->rr_count; ++i) { for (int i = 0; i < ns_rrs->count; ++i) {
const knot_dname_t *ns_dname = knot_ns_name(ns_rrs, i); const knot_dname_t *ns_dname = knot_ns_name(ns_rrs, i);
if (!knot_dname_is_sub(ns_dname, node->owner)) { if (!knot_dname_is_sub(ns_dname, node->owner)) {
continue; continue;
...@@ -515,11 +515,11 @@ static int check_submission(const zone_node_t *node, semchecks_data_t *data) ...@@ -515,11 +515,11 @@ static int check_submission(const zone_node_t *node, semchecks_data_t *data)
return KNOT_EOK; return KNOT_EOK;
} }
if (cdss->rr_count != 1) { if (cdss->count != 1) {
data->handler->cb(data->handler, data->zone, node, data->handler->cb(data->handler, data->zone, node,
SEM_ERR_CDS_MULTIPLE, NULL); SEM_ERR_CDS_MULTIPLE, NULL);
} }
if (cdnskeys->rr_count != 1) { if (cdnskeys->count != 1) {
data->handler->cb(data->handler, data->zone, node, data->handler->cb(data->handler, data->zone, node,
SEM_ERR_CDNSKEY_MULTIPLE, NULL); SEM_ERR_CDNSKEY_MULTIPLE, NULL);
} }
...@@ -530,7 +530,7 @@ static int check_submission(const zone_node_t *node, semchecks_data_t *data) ...@@ -530,7 +530,7 @@ static int check_submission(const zone_node_t *node, semchecks_data_t *data)
const knot_rdataset_t *dnskeys = node_rdataset(data->zone->apex, const knot_rdataset_t *dnskeys = node_rdataset(data->zone->apex,
KNOT_RRTYPE_DNSKEY); KNOT_RRTYPE_DNSKEY);
for (int i = 0; dnskeys != NULL && i < dnskeys->rr_count; i++) { for (int i = 0; dnskeys != NULL && i < dnskeys->count; i++) {
knot_rdata_t *dnskey = knot_rdataset_at(dnskeys, i); knot_rdata_t *dnskey = knot_rdataset_at(dnskeys, i);
if (knot_rdata_cmp(dnskey, cdnskey) != 0) { if (knot_rdata_cmp(dnskey, cdnskey) != 0) {
continue; continue;
...@@ -585,7 +585,7 @@ static int check_ds(const zone_node_t *node, semchecks_data_t *data) ...@@ -585,7 +585,7 @@ static int check_ds(const zone_node_t *node, semchecks_data_t *data)
return KNOT_EOK; return KNOT_EOK;
} }
for (int i = 0; i < dss->rr_count; i++) { for (int i = 0; i < dss->count; i++) {
uint16_t keytag = knot_ds_key_tag(dss, i); uint16_t keytag = knot_ds_key_tag(dss, i);
uint8_t digest_type = knot_ds_digest_type(dss, i); uint8_t digest_type = knot_ds_digest_type(dss, i);
...@@ -772,7 +772,7 @@ static int check_nsec(const zone_node_t *node, semchecks_data_t *data) ...@@ -772,7 +772,7 @@ static int check_nsec(const zone_node_t *node, semchecks_data_t *data)
} }
/* Test that only one record is in the NSEC RRSet */ /* Test that only one record is in the NSEC RRSet */
if (nsec_rrs->rr_count != 1) { if (nsec_rrs->count != 1) {
data->handler->cb(data->handler, data->zone, node, data->handler->cb(data->handler, data->zone, node,
SEM_ERR_NSEC_RDATA_MULTIPLE, NULL); SEM_ERR_NSEC_RDATA_MULTIPLE, NULL);
} }
...@@ -1015,7 +1015,7 @@ static int check_cname(const zone_node_t *node, semchecks_data_t *data) ...@@ -1015,7 +1015,7 @@ static int check_cname(const zone_node_t *node, semchecks_data_t *data)
data->handler->cb(data->handler, data->zone, node, data->handler->cb(data->handler, data->zone, node,
SEM_ERR_CNAME_EXTRA_RECORDS, NULL); SEM_ERR_CNAME_EXTRA_RECORDS, NULL);
} }
if (cname_rrs->rr_count != 1) { if (cname_rrs->count != 1) {
data->handler->fatal_error = true; data->handler->fatal_error = true;
data->handler->cb(data->handler, data->zone, node, data->handler->cb(data->handler, data->zone, node,
SEM_ERR_CNAME_MULTIPLE, NULL); SEM_ERR_CNAME_MULTIPLE, NULL);
...@@ -1114,7 +1114,7 @@ static void check_dnskey(zone_contents_t *zone, sem_handler_t *handler) ...@@ -1114,7 +1114,7 @@ static void check_dnskey(zone_contents_t *zone, sem_handler_t *handler)
return; return;
} }
for (int i = 0; i < dnskeys->rr_count; i++) { for (int i = 0; i < dnskeys->count; i++) {
knot_rdata_t *dnskey = knot_rdataset_at(dnskeys, i); knot_rdata_t *dnskey = knot_rdataset_at(dnskeys, i);
dnssec_key_t *key; dnssec_key_t *key;
int ret = dnssec_key_from_rdata(&key, zone->apex->owner, int ret = dnssec_key_from_rdata(&key, zone->apex->owner,
......
...@@ -46,8 +46,8 @@ static int load_soas(const zone_contents_t *zone1, const zone_contents_t *zone2, ...@@ -46,8 +46,8 @@ static int load_soas(const zone_contents_t *zone1, const zone_contents_t *zone2,
return KNOT_EINVAL; return KNOT_EINVAL;
} }
if (soa_rrset1.rrs.rr_count == 0 || if (soa_rrset1.rrs.count == 0 ||
soa_rrset2.rrs.rr_count == 0) { soa_rrset2.rrs.count == 0) {
return KNOT_EINVAL; return KNOT_EINVAL;
} }
...@@ -129,7 +129,7 @@ static int rdata_return_changes(const knot_rrset_t *rrset1, ...@@ -129,7 +129,7 @@ static int rdata_return_changes(const knot_rrset_t *rrset1,
* changed/removed rdatas. This has awful computation time. * changed/removed rdatas. This has awful computation time.
*/ */
bool ttl_differ = rrset1->ttl != rrset2->ttl; bool ttl_differ = rrset1->ttl != rrset2->ttl;
uint16_t rr1_count = rrset1->rrs.rr_count; uint16_t rr1_count = rrset1->rrs.count;
for (uint16_t i = 0; i < rr1_count; ++i) { for (uint16_t i = 0; i < rr1_count; ++i) {
if (ttl_differ || !rr_exists(rrset2, rrset1, i)) { if (ttl_differ || !rr_exists(rrset2, rrset1, i)) {
/* /*
......
/* Copyright (C) 2016 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz> /* Copyright (C) 2018 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
This program is free software: you can redistribute it and/or modify This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -48,7 +48,7 @@ static int apex_node_dump_text(zone_node_t *node, dump_params_t *params) ...@@ -48,7 +48,7 @@ static int apex_node_dump_text(zone_node_t *node, dump_params_t *params)
if (ret < 0) { if (ret < 0) {
return ret; return ret;
} }
params->rr_count += soa.rrs.rr_count; params->rr_count += soa.rrs.count;
fprintf(params->file, "%s", params->buf); fprintf(params->file, "%s", params->buf);
params->buf[0] = '\0'; params->buf[0] = '\0';
} }
...@@ -72,7 +72,7 @@ static int apex_node_dump_text(zone_node_t *node, dump_params_t *params) ...@@ -72,7 +72,7 @@ static int apex_node_dump_text(zone_node_t *node, dump_params_t *params)
if (ret < 0) { if (ret < 0) {
return ret; return ret;
} }
params->rr_count += rrset.rrs.rr_count; params->rr_count += rrset.rrs.count;
fprintf(params->file, "%s", params->buf); fprintf(params->file, "%s", params->buf);
params->buf[0] = '\0'; params->buf[0] = '\0';
} }
...@@ -128,7 +128,7 @@ static int node_dump_text(zone_node_t *node, void *data) ...@@ -128,7 +128,7 @@ static int node_dump_text(zone_node_t *node, void *data)
if (ret < 0) { if (ret < 0) {
return ret; return ret;
} }
params->rr_count += rrset.rrs.rr_count; params->rr_count += rrset.rrs.count;
fprintf(params->file, "%s", params->buf); fprintf(params->file, "%s", params->buf);
params->buf[0] = '\0'; params->buf[0] = '\0';
} }
......
...@@ -76,7 +76,7 @@ static bool handle_err(zcreator_t *zc, const knot_rrset_t *rr, int ret, bool mas ...@@ -76,7 +76,7 @@ static bool handle_err(zcreator_t *zc, const knot_rrset_t *rr, int ret, bool mas
int zcreator_step(zcreator_t *zc, const knot_rrset_t *rr) int zcreator_step(zcreator_t *zc, const knot_rrset_t *rr)
{ {
if (zc == NULL || rr == NULL || rr->rrs.rr_count != 1) { if (zc == NULL || rr == NULL || rr->rrs.count != 1) {
return KNOT_EINVAL; return KNOT_EINVAL;
} }
......
...@@ -43,8 +43,8 @@ static bool pkt_contains(const knot_pkt_t *packet, const knot_rrset_t *rrset) ...@@ -43,8 +43,8 @@ static bool pkt_contains(const knot_pkt_t *packet, const knot_rrset_t *rrset)
for (int i = 0; i < packet->rrset_count; ++i) { for (int i = 0; i < packet->rrset_count; ++i) {
const uint16_t type = packet->rr[i].type; const uint16_t type = packet->rr[i].type;
const knot_rdata_t *data = packet->rr[i].rrs.data; const knot_rdata_t *data = packet->rr[i].rrs.rdata;
if (type == rrset->type && data == rrset->rrs.data) { if (type == rrset->type && data == rrset->rrs.rdata) {
return true; return true;
} }
} }
...@@ -544,7 +544,7 @@ int knot_pkt_put_rotate(knot_pkt_t *pkt, uint16_t compr_hint, const knot_rrset_t ...@@ -544,7 +544,7 @@ int knot_pkt_put_rotate(knot_pkt_t *pkt, uint16_t compr_hint, const knot_rrset_t
} }
size_t len = ret; size_t len = ret;
uint16_t rr_added = rr->rrs.