Commit 26378b61 authored by Marek Vavruša's avatar Marek Vavruša

libknot/rdata: dropped rrs_ prefix

parent 1e117bc2
......@@ -101,7 +101,7 @@ static int remote_rdata_apply(server_t *s, remote_cmdargs_t* a, remote_zonef_t *
uint16_t rr_count = knot_rrset_rr_count(rr);
for (uint16_t i = 0; i < rr_count; i++) {
const knot_dname_t *dn = knot_rrs_ns_name(&rr->rrs, i);
const knot_dname_t *dn = knot_ns_name(&rr->rrs, i);
rcu_read_lock();
zone = knot_zonedb_find(s->zone_db, dn);
if (cb(s, zone) != KNOT_EOK) {
......@@ -242,7 +242,7 @@ static int remote_c_zonestatus(server_t *s, remote_cmdargs_t* a)
soa_rrs = knot_node_rrs(zone->contents->apex,
KNOT_RRTYPE_SOA);
assert(soa_rrs != NULL);
serial = knot_rrs_soa_serial(soa_rrs);
serial = knot_soa_serial(soa_rrs);
}
/* Evalute zone type. */
......@@ -539,7 +539,7 @@ static void log_command(const char *cmd, const remote_cmdargs_t* args)
uint16_t rr_count = knot_rrset_rr_count(rr);
for (uint16_t j = 0; j < rr_count; j++) {
const knot_dname_t *dn = knot_rrs_ns_name(&rr->rrs, j);
const knot_dname_t *dn = knot_ns_name(&rr->rrs, j);
char *name = knot_dname_to_str(dn);
int ret = snprintf(params, rest, " %s", name);
......
......@@ -369,14 +369,14 @@ static int connect_nsec3_nodes(knot_node_t *a, knot_node_t *b,
knot_rrs_t *a_rrs = knot_node_get_rrs(a, KNOT_RRTYPE_NSEC3);
assert(a_rrs);
uint8_t algorithm = knot_rrs_nsec3_algorithm(a_rrs, 0);
uint8_t algorithm = knot_nsec3_algorithm(a_rrs, 0);
if (algorithm == 0) {
return KNOT_EINVAL;
}
uint8_t *raw_hash = NULL;
uint8_t raw_length = 0;
knot_rrs_nsec3_next_hashed(a_rrs, 0, &raw_hash, &raw_length);
knot_nsec3_next_hashed(a_rrs, 0, &raw_hash, &raw_length);
if (raw_hash == NULL) {
return KNOT_EINVAL;
}
......
......@@ -98,7 +98,7 @@ static bool get_zone_soa_min_ttl(const knot_zone_contents_t *zone,
return false;
}
uint32_t result = knot_rrs_soa_minimum(soa);
uint32_t result = knot_soa_minimum(soa);
if (result == 0) {
return false;
}
......
......@@ -80,8 +80,8 @@ static bool valid_signature_exists(const knot_rrset_t *covered,
uint16_t rrsigs_rdata_count = knot_rrset_rr_count(rrsigs);
for (uint16_t i = 0; i < rrsigs_rdata_count; i++) {
uint16_t keytag = knot_rrs_rrsig_key_tag(&rrsigs->rrs, i);
uint16_t type_covered = knot_rrs_rrsig_type_covered(&rrsigs->rrs, i);
uint16_t keytag = knot_rrsig_key_tag(&rrsigs->rrs, i);
uint16_t type_covered = knot_rrsig_type_covered(&rrsigs->rrs, i);
if (keytag != key->keytag || type_covered != covered->type) {
continue;
}
......@@ -172,7 +172,7 @@ static const knot_zone_key_t *get_matching_zone_key(const knot_rrset_t *rrsigs,
assert(rrsigs && rrsigs->type == KNOT_RRTYPE_RRSIG);
assert(keys);
uint16_t keytag = knot_rrs_rrsig_key_tag(&rrsigs->rrs, pos);
uint16_t keytag = knot_rrsig_key_tag(&rrsigs->rrs, pos);
return knot_get_zone_key(keys, keytag);
}
......@@ -190,7 +190,7 @@ static void note_earliest_expiration(const knot_rrset_t *rrsigs, size_t pos,
assert(rrsigs);
assert(expires_at);
const uint32_t current = knot_rrs_rrsig_sig_expiration(&rrsigs->rrs, pos);
const uint32_t current = knot_rrsig_sig_expiration(&rrsigs->rrs, pos);
if (current < *expires_at) {
*expires_at = current;
}
......@@ -461,7 +461,7 @@ static int remove_standalone_rrsigs(const knot_node_t *node,
uint16_t rrsigs_rdata_count = knot_rrset_rr_count(rrsigs);
for (uint16_t i = 0; i < rrsigs_rdata_count; ++i) {
uint16_t type_covered = knot_rrs_rrsig_type_covered(&rrsigs->rrs, i);
uint16_t type_covered = knot_rrsig_type_covered(&rrsigs->rrs, i);
if (!knot_node_rrtype_exists(node, type_covered)) {
knot_rrset_t *to_remove = knot_rrset_new(rrsigs->owner,
rrsigs->type,
......@@ -1328,7 +1328,7 @@ int knot_zone_sign_update_soa(const knot_rrset_t *soa,
dbg_dnssec_verb("Updating SOA...\n");
uint32_t serial = knot_rrs_soa_serial(&soa->rrs);
uint32_t serial = knot_soa_serial(&soa->rrs);
if (serial == UINT32_MAX && policy->soa_up == KNOT_SOA_SERIAL_UPDATE) {
// TODO: this is wrong, the value should be 'rewound' to 0 in this case
return KNOT_EINVAL;
......@@ -1369,7 +1369,7 @@ int knot_zone_sign_update_soa(const knot_rrset_t *soa,
return KNOT_ENOMEM;
}
knot_rrs_soa_serial_set(&soa_to->rrs, new_serial);
knot_soa_serial_set(&soa_to->rrs, new_serial);
// add signatures for new SOA
......
......@@ -76,7 +76,7 @@ static int dname_cname_synth(const knot_rrset_t *dname_rr,
/* Replace last labels of qname with DNAME. */
const knot_dname_t *dname_wire = dname_rr->owner;
const knot_dname_t *dname_tgt = knot_rrs_dname_target(&dname_rr->rrs);
const knot_dname_t *dname_tgt = knot_dname_target(&dname_rr->rrs);
int labels = knot_dname_labels(dname_wire, NULL);
knot_dname_t *cname = knot_dname_replace_suffix(qname, labels, dname_tgt);
if (cname == NULL) {
......@@ -108,7 +108,7 @@ static bool dname_cname_cannot_synth(const knot_rrset_t *rrset, const knot_dname
{
if (knot_dname_labels(qname, NULL)
- knot_dname_labels(rrset->owner, NULL)
+ knot_dname_labels(knot_rrs_dname_target(&rrset->rrs), NULL)
+ knot_dname_labels(knot_dname_target(&rrset->rrs), NULL)
> KNOT_DNAME_MAXLABELS) {
return true;
} else {
......@@ -254,7 +254,7 @@ static int put_authority_soa(knot_pkt_t *pkt, struct query_data *qdata,
// MINIMUM as TTL
int ret = KNOT_EOK;
uint32_t flags = KNOT_PF_NOTRUNC;
uint32_t min = knot_rrs_soa_minimum(&soa_rrset.rrs);
uint32_t min = knot_soa_minimum(&soa_rrset.rrs);
if (min < knot_rrset_rr_ttl(&soa_rrset, 0)) {
knot_rrset_t copy;
knot_dname_t *dname_cpy = knot_dname_copy(soa_rrset.owner, &pkt->mm);
......@@ -409,7 +409,7 @@ static int follow_cname(knot_pkt_t *pkt, uint16_t rrtype, struct query_data *qda
}
/* Now follow the next CNAME TARGET. */
qdata->name = knot_rrs_cname_name(&cname_rr.rrs);
qdata->name = knot_cname_name(&cname_rr.rrs);
#ifdef KNOT_NS_DEBUG
char *cname_str = knot_dname_to_str(cname_node->owner);
......
......@@ -130,7 +130,7 @@ static int ixfr_load_chsets(knot_changesets_t **chgsets, const zone_t *zone,
/* Compare serials. */
uint32_t serial_to = knot_zone_serial(zone->contents);
uint32_t serial_from = knot_rrs_soa_serial(&their_soa->rrs);
uint32_t serial_from = knot_soa_serial(&their_soa->rrs);
int ret = knot_serial_compare(serial_to, serial_from);
if (ret <= 0) { /* We have older/same age zone. */
return KNOT_EUPTODATE;
......@@ -297,8 +297,8 @@ int ixfr_answer(knot_pkt_t *pkt, struct query_data *qdata)
case KNOT_EOK: /* OK */
ixfr = (struct ixfr_proc*)qdata->ext;
IXFR_LOG(LOG_INFO, "Started (serial %u -> %u).",
knot_rrs_soa_serial(&ixfr->soa_from->rrs),
knot_rrs_soa_serial(&ixfr->soa_to->rrs));
knot_soa_serial(&ixfr->soa_from->rrs),
knot_soa_serial(&ixfr->soa_to->rrs));
break;
case KNOT_EUPTODATE: /* Our zone is same age/older, send SOA. */
IXFR_LOG(LOG_INFO, "Zone is up-to-date.");
......@@ -387,7 +387,7 @@ int ixfr_process_answer(knot_pkt_t *pkt, knot_ns_xfr_t *xfr)
// serial
uint32_t zone_serial = knot_zone_serial(zone->contents);
if (knot_serial_compare(
knot_rrs_soa_serial(&chgsets->first_soa->rrs),
knot_soa_serial(&chgsets->first_soa->rrs),
zone_serial)
> 0) {
if ((xfr->flags & XFR_FLAG_UDP) != 0) {
......
......@@ -96,7 +96,7 @@ int internet_notify(knot_pkt_t *pkt, struct query_data *qdata)
if (answer->count > 0) {
const knot_rrset_t *soa = &answer->rr[0];
if (soa->type == KNOT_RRTYPE_SOA) {
serial = knot_rrs_soa_serial(&soa->rrs);
serial = knot_soa_serial(&soa->rrs);
dbg_ns("%s: received serial %u\n", __func__, serial);
} else { /* Ignore */
dbg_ns("%s: NOTIFY answer != SOA_RR\n", __func__);
......
......@@ -205,7 +205,7 @@ static void log_zone_load_info(const zone_t *zone, const char *zone_name,
if (zone->contents && zone->contents->apex) {
const knot_rrs_t *soa = knot_node_rrs(zone->contents->apex,
KNOT_RRTYPE_SOA);
serial = knot_rrs_soa_serial(soa);
serial = knot_soa_serial(soa);
}
log_zone_info("Zone '%s' %s (serial %" PRId64 ")\n", zone_name, action, serial);
......
......@@ -104,7 +104,7 @@ static uint32_t zones_soa_timer(zone_t *zone, uint32_t (*rr_func)(const knot_rrs
*/
static uint32_t zones_soa_refresh(zone_t *zone)
{
return zones_soa_timer(zone, knot_rrs_soa_refresh);
return zones_soa_timer(zone, knot_soa_refresh);
}
/*!
......@@ -115,7 +115,7 @@ static uint32_t zones_soa_refresh(zone_t *zone)
*/
static uint32_t zones_soa_retry(zone_t *zone)
{
return zones_soa_timer(zone, knot_rrs_soa_retry);
return zones_soa_timer(zone, knot_soa_retry);
}
/*!
......@@ -126,7 +126,7 @@ static uint32_t zones_soa_retry(zone_t *zone)
*/
static uint32_t zones_soa_expire(zone_t *zone)
{
return zones_soa_timer(zone, knot_rrs_soa_expire);
return zones_soa_timer(zone, knot_soa_expire);
}
/*!
......@@ -509,7 +509,7 @@ int zones_changesets_from_binary(knot_changesets_t *chgsets)
dbg_xfr_verb("xfr: reading RRSets to REMOVE, first RR is %hu\n",
rrset->type);
assert(rrset->type == KNOT_RRTYPE_SOA);
assert(chs->serial_from == knot_rrs_soa_serial(&rrset->rrs));
assert(chs->serial_from == knot_soa_serial(&rrset->rrs));
knot_changeset_add_soa(chs, rrset, KNOT_CHANGESET_REMOVE);
/* Read remaining RRSets */
......@@ -955,7 +955,7 @@ int zones_zonefile_sync(zone_t *zone, journal_t *journal)
KNOT_RRTYPE_SOA);
assert(soa_rrs != NULL);
int64_t serial_ret = knot_rrs_soa_serial(soa_rrs);
int64_t serial_ret = knot_soa_serial(soa_rrs);
if (serial_ret < 0) {
rcu_read_unlock();
pthread_mutex_unlock(&zone->lock);
......@@ -1839,7 +1839,7 @@ int zones_journal_apply(zone_t *zone)
const knot_rrs_t *soa_rrs = 0;
soa_rrs = knot_node_rrs(contents->apex, KNOT_RRTYPE_SOA);
assert(soa_rrs != NULL);
int64_t serial_ret = knot_rrs_soa_serial(soa_rrs);
int64_t serial_ret = knot_soa_serial(soa_rrs);
if (serial_ret < 0) {
rcu_read_unlock();
return KNOT_EINVAL;
......
......@@ -131,7 +131,7 @@ static void knot_changeset_store_soa(knot_rrset_t **chg_soa,
uint32_t *chg_serial, knot_rrset_t *soa)
{
*chg_soa = soa;
*chg_serial = knot_rrs_soa_serial(&soa->rrs);
*chg_serial = knot_soa_serial(&soa->rrs);
}
void knot_changeset_add_soa(knot_changeset_t *changeset, knot_rrset_t *soa,
......
......@@ -437,7 +437,7 @@ static bool skip_soa(const knot_rrset_t *rr, int64_t sn)
if (rr->type == KNOT_RRTYPE_SOA
&& (rr->rclass == KNOT_CLASS_NONE
|| rr->rclass == KNOT_CLASS_ANY
|| knot_serial_compare(knot_rrs_soa_serial(&rr->rrs),
|| knot_serial_compare(knot_soa_serial(&rr->rrs),
sn) <= 0)) {
return true;
}
......@@ -1014,7 +1014,7 @@ int knot_ddns_process_update(const knot_zone_contents_t *zone,
*rcode = KNOT_RCODE_SERVFAIL;
return KNOT_ENOMEM;
}
knot_rrs_soa_serial_set(&soa_cpy->rrs, new_serial);
knot_soa_serial_set(&soa_cpy->rrs, new_serial);
knot_changeset_add_soa(changeset, soa_cpy, KNOT_CHANGESET_ADD);
}
......
......@@ -90,7 +90,7 @@ int xfrin_transfer_needed(const knot_zone_contents_t *zone,
return KNOT_ERROR;
}
uint32_t local_serial = knot_rrs_soa_serial(soa_rrs);
uint32_t local_serial = knot_soa_serial(soa_rrs);
/*
* Retrieve the remote Serial
*/
......@@ -104,7 +104,7 @@ int xfrin_transfer_needed(const knot_zone_contents_t *zone,
return KNOT_EMALF;
}
uint32_t remote_serial = knot_rrs_soa_serial(&soa_rr.rrs);
uint32_t remote_serial = knot_soa_serial(&soa_rr.rrs);
return (knot_serial_compare(local_serial, remote_serial) < 0);
}
......@@ -457,8 +457,8 @@ int xfrin_process_ixfr_packet(knot_pkt_t *pkt, knot_ns_xfr_t *xfr)
goto cleanup;
}
if (knot_rrs_soa_serial(&rr->rrs)
== knot_rrs_soa_serial(&(*chs)->first_soa->rrs)) {
if (knot_soa_serial(&rr->rrs)
== knot_soa_serial(&(*chs)->first_soa->rrs)) {
/*! \note [TSIG] Check TSIG, we're at the end of
* transfer.
......@@ -534,8 +534,8 @@ int xfrin_process_ixfr_packet(knot_pkt_t *pkt, knot_ns_xfr_t *xfr)
if (rr->type == KNOT_RRTYPE_SOA) {
log_zone_info("%s Serial %u -> %u.\n",
xfr->msg,
knot_rrs_soa_serial(&chset->soa_from->rrs),
knot_rrs_soa_serial(&chset->soa_to->rrs));
knot_soa_serial(&chset->soa_from->rrs),
knot_soa_serial(&chset->soa_to->rrs));
state = -1;
continue;
} else {
......@@ -617,7 +617,7 @@ static void xfrin_zone_contents_free(knot_zone_contents_t **contents)
dbg_zone("Destroying NSEC3 zone tree.\n");
knot_zone_tree_deep_free(&(*contents)->nsec3_nodes);
knot_nsec3_params_free(&(*contents)->nsec3_params);
knot_nsec3param_free(&(*contents)->nsec3_params);
free(*contents);
*contents = NULL;
......@@ -930,7 +930,7 @@ static int xfrin_apply_changeset(list_t *old_rrs, list_t *new_rrs,
// check if serial matches
const knot_rrs_t *soa = knot_node_rrs(contents->apex, KNOT_RRTYPE_SOA);
if (soa == NULL || knot_rrs_soa_serial(soa)
if (soa == NULL || knot_soa_serial(soa)
!= chset->serial_from) {
dbg_xfrin("SOA serials do not match!!\n");
return KNOT_EINVAL;
......
......@@ -628,7 +628,7 @@ bool knot_node_rrtype_is_signed(const knot_node_t *node, uint16_t type)
uint16_t rrsigs_rdata_count = rrsigs->rr_count;
for (uint16_t i = 0; i < rrsigs_rdata_count; ++i) {
const uint16_t type_covered =
knot_rrs_rrsig_type_covered(rrsigs, i);
knot_rrsig_type_covered(rrsigs, i);
if (type_covered == type) {
return true;
}
......
......@@ -303,7 +303,7 @@ static int check_rrsig_rdata(err_handler_t *handler,
return KNOT_ENOMEM;
}
if (knot_rrs_rrsig_type_covered(rrsig, 0) != rrset->type) {
if (knot_rrsig_type_covered(rrsig, 0) != rrset->type) {
/* zoneparser would not let this happen
* but to be on the safe side
*/
......@@ -313,7 +313,7 @@ static int check_rrsig_rdata(err_handler_t *handler,
}
/* label number at the 2nd index should be same as owner's */
uint8_t labels_rdata = knot_rrs_rrsig_labels(rrsig, rr_pos);
uint8_t labels_rdata = knot_rrsig_labels(rrsig, rr_pos);
int tmp = knot_dname_labels(rrset->owner, NULL) - labels_rdata;
......@@ -333,7 +333,7 @@ static int check_rrsig_rdata(err_handler_t *handler,
}
/* check original TTL */
uint32_t original_ttl = knot_rrs_rrsig_original_ttl(rrsig, rr_pos);
uint32_t original_ttl = knot_rrsig_original_ttl(rrsig, rr_pos);
uint16_t rr_count = knot_rrset_rr_count(rrset);
for (uint16_t i = 0; i < rr_count; ++i) {
......@@ -345,7 +345,7 @@ static int check_rrsig_rdata(err_handler_t *handler,
}
/* Check for expired signature. */
if (knot_rrs_rrsig_sig_expiration(rrsig, rr_pos) < time(NULL)) {
if (knot_rrsig_sig_expiration(rrsig, rr_pos) < time(NULL)) {
err_handler_handle_error(handler, node,
ZC_ERR_RRSIG_RDATA_EXPIRATION,
info_str);
......@@ -359,7 +359,7 @@ static int check_rrsig_rdata(err_handler_t *handler,
/* signer's name is same as in the zone apex */
const knot_dname_t *signer_name =
knot_rrs_rrsig_signer_name(rrsig, rr_pos);
knot_rrsig_signer_name(rrsig, rr_pos);
/* dnskey is in the apex node */
if (!knot_rrset_empty(dnskey_rrset) &&
......@@ -374,12 +374,12 @@ static int check_rrsig_rdata(err_handler_t *handler,
* before */
int match = 0;
uint8_t rrsig_alg = knot_rrs_rrsig_algorithm(rrsig, rr_pos);
uint16_t key_tag_rrsig = knot_rrs_rrsig_key_tag(rrsig, rr_pos);
uint8_t rrsig_alg = knot_rrsig_algorithm(rrsig, rr_pos);
uint16_t key_tag_rrsig = knot_rrsig_key_tag(rrsig, rr_pos);
for (uint16_t i = 0; i < knot_rrset_rr_count(dnskey_rrset) &&
!match; ++i) {
uint8_t dnskey_alg =
knot_rrs_dnskey_alg(&dnskey_rrset->rrs, i);
knot_dnskey_alg(&dnskey_rrset->rrs, i);
if (rrsig_alg != dnskey_alg) {
continue;
}
......@@ -520,9 +520,9 @@ static int rdata_nsec_to_type_array(const knot_rrs_t *rrs, uint16_t type,
uint8_t *data = NULL;
uint16_t rr_bitmap_size = 0;
if (type == KNOT_RRTYPE_NSEC) {
knot_rrs_nsec_bitmap(rrs, &data, &rr_bitmap_size);
knot_nsec_bitmap(rrs, &data, &rr_bitmap_size);
} else {
knot_rrs_nsec3_bitmap(rrs, pos, &data, &rr_bitmap_size);
knot_nsec3_bitmap(rrs, pos, &data, &rr_bitmap_size);
}
if (data == NULL) {
return KNOT_EMALF;
......@@ -627,7 +627,7 @@ static int check_nsec3_node_in_zone(knot_zone_contents_t *zone,
/* check for Opt-Out flag */
uint8_t flags =
knot_rrs_nsec3_flags(previous_rrs, 0);
knot_nsec3_flags(previous_rrs, 0);
uint8_t opt_out_mask = 1;
if (!(flags & opt_out_mask)) {
......@@ -651,7 +651,7 @@ static int check_nsec3_node_in_zone(knot_zone_contents_t *zone,
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);
assert(soa_rrs);
uint32_t minimum_ttl = knot_rrs_soa_minimum(soa_rrs);
uint32_t minimum_ttl = knot_soa_minimum(soa_rrs);
if (knot_rr_ttl(nsec3_rr) != minimum_ttl) {
err_handler_handle_error(handler, node,
ZC_ERR_NSEC3_RDATA_TTL, NULL);
......@@ -661,7 +661,7 @@ static int check_nsec3_node_in_zone(knot_zone_contents_t *zone,
const knot_node_t *apex = knot_zone_contents_apex(zone);
uint8_t *next_dname_str = NULL;
uint8_t next_dname_size = 0;
knot_rrs_nsec3_next_hashed(nsec3_rrs, 0, &next_dname_str,
knot_nsec3_next_hashed(nsec3_rrs, 0, &next_dname_str,
&next_dname_size);
knot_dname_t *next_dname = knot_nsec3_hash_to_dname(next_dname_str,
next_dname_size,
......@@ -786,7 +786,7 @@ static int sem_check_node_optional(const knot_zone_contents_t *zone,
for (int i = 0; i < ns_rrs->rr_count; ++i) {
const knot_dname_t *ns_dname =
knot_rrs_ns_name(ns_rrs, i);
knot_ns_name(ns_rrs, i);
const knot_node_t *glue_node =
knot_zone_contents_find_node(zone, ns_dname);
......@@ -946,7 +946,7 @@ static int semantic_checks_dnssec(knot_zone_contents_t *zone,
* the next link in each node.
*/
const knot_dname_t *next_domain =
knot_rrs_nsec_next(nsec_rrs);
knot_nsec_next(nsec_rrs);
// Convert name to lowercase for trie lookup
knot_dname_t *lowercase = knot_dname_copy(next_domain, NULL);
if (lowercase == NULL) {
......@@ -1080,7 +1080,7 @@ void log_cyclic_errors_in_zone(err_handler_t *handler,
const knot_node_t *apex = knot_zone_contents_apex(zone);
uint8_t *next_dname_str = NULL;
uint8_t next_dname_size = 0;
knot_rrs_nsec3_next_hashed(nsec3_rrs, 0, &next_dname_str,
knot_nsec3_next_hashed(nsec3_rrs, 0, &next_dname_str,
&next_dname_size);
knot_dname_t *next_dname = knot_nsec3_hash_to_dname(next_dname_str,
next_dname_size,
......@@ -1123,7 +1123,7 @@ void log_cyclic_errors_in_zone(err_handler_t *handler,
return;
}
const knot_dname_t *next_dname = knot_rrs_nsec_next(nsec_rrs);
const knot_dname_t *next_dname = knot_nsec_next(nsec_rrs);
assert(next_dname);
const knot_dname_t *apex_dname =
......
......@@ -176,7 +176,7 @@ static int discover_additionals(struct rr_data *rr_data,
for (uint16_t i = 0; i < rdcount; i++) {
/* Try to find node for the dname in the RDATA. */
dname = knot_rrs_name(rrs, i, rr_data->type);
dname = knot_rdata_name(rrs, i, rr_data->type);
knot_zone_contents_find_dname(zone, dname, &node, &encloser, &prev);
if (node == NULL && encloser && encloser->wildcard_child) {
node = encloser->wildcard_child;
......@@ -397,19 +397,19 @@ static int knot_zc_nsec3_parameters_match(const knot_rrs_t *rrs,
dbg_zone_detail("RDATA algo: %u, iterations: %u, salt length: %u, salt:"
" %.*s\n",
knot_rrs_nsec3_algorithm(rrs, rdata_pos),
knot_rrs_nsec3_iterations(rrs, rdata_pos),
knot_rrs_nsec3_salt_length(rrs, rdata_pos),
knot_rrs_nsec3_salt_length(rrs, rdata_pos),
knot_rrs_nsec3_salt(rrs, rdata_pos));
knot_nsec3_algorithm(rrs, rdata_pos),
knot_nsec3_iterations(rrs, rdata_pos),
knot_nsec3_salt_length(rrs, rdata_pos),
knot_nsec3_salt_length(rrs, rdata_pos),
knot_nsec3_salt(rrs, rdata_pos));
dbg_zone_detail("NSEC3PARAM algo: %u, iterations: %u, salt length: %u, "
"salt: %.*s\n", params->algorithm, params->iterations,
params->salt_length, params->salt_length, params->salt);
return (knot_rrs_nsec3_algorithm(rrs, rdata_pos) == params->algorithm
&& knot_rrs_nsec3_iterations(rrs, rdata_pos) == params->iterations
&& knot_rrs_nsec3_salt_length(rrs, rdata_pos) == params->salt_length
&& strncmp((const char *)knot_rrs_nsec3_salt(rrs, rdata_pos),
return (knot_nsec3_algorithm(rrs, rdata_pos) == params->algorithm
&& knot_nsec3_iterations(rrs, rdata_pos) == params->iterations
&& knot_nsec3_salt_length(rrs, rdata_pos) == params->salt_length
&& strncmp((const char *)knot_nsec3_salt(rrs, rdata_pos),
(const char *)params->salt, params->salt_length)
== 0);
}
......@@ -793,7 +793,7 @@ static bool rrset_is_nsec3rel(const knot_rrset_t *rr)
/* Is NSEC3 or non-empty RRSIG covering NSEC3. */
return ((rr->type == KNOT_RRTYPE_NSEC3)
|| (rr->type == KNOT_RRTYPE_RRSIG
&& knot_rrs_rrsig_type_covered(&rr->rrs, 0)
&& knot_rrsig_type_covered(&rr->rrs, 0)
== KNOT_RRTYPE_NSEC3));
}
......@@ -1273,7 +1273,7 @@ int knot_zone_contents_load_nsec3param(knot_zone_contents_t *zone)
const knot_rrs_t *rrs = knot_node_rrs(zone->apex, KNOT_RRTYPE_NSEC3PARAM);
if (rrs!= NULL) {
int r = knot_nsec3_params_from_wire(&zone->nsec3_params, rrs);
int r = knot_nsec3param_from_wire(&zone->nsec3_params, rrs);
if (r != KNOT_EOK) {
dbg_zone("Failed to load NSEC3PARAM (%s).\n",
knot_strerror(r));
......@@ -1397,7 +1397,7 @@ void knot_zone_contents_free(knot_zone_contents_t **contents)
dbg_zone("Destroying NSEC3 zone tree.\n");
knot_zone_tree_free(&(*contents)->nsec3_nodes);
knot_nsec3_params_free(&(*contents)->nsec3_params);
knot_nsec3param_free(&(*contents)->nsec3_params);
free(*contents);
*contents = NULL;
......@@ -1435,7 +1435,7 @@ uint32_t knot_zone_serial(const knot_zone_contents_t *zone)
if (!zone) return 0;
const knot_rrs_t *soa = NULL;
soa = knot_node_rrs(knot_zone_contents_apex(zone), KNOT_RRTYPE_SOA);
uint32_t serial = knot_rrs_soa_serial(soa);
uint32_t serial = knot_soa_serial(soa);
return serial;
}
......
......@@ -60,8 +60,8 @@ static int knot_zone_diff_load_soas(const knot_zone_contents_t *zone1,
return KNOT_EINVAL;
}
int64_t soa_serial1 = knot_rrs_soa_serial(&soa_rrset1.rrs);
int64_t soa_serial2 = knot_rrs_soa_serial(&soa_rrset2.rrs);
int64_t soa_serial1 = knot_soa_serial(&soa_rrset1.rrs);
int64_t soa_serial2 = knot_soa_serial(&soa_rrset2.rrs);
if (knot_serial_compare(soa_serial1, soa_serial2) == 0) {
return KNOT_ENODIFF;
......
......@@ -280,7 +280,7 @@ int knot_synth_rrsig(uint16_t type, const knot_rrs_t *rrsig_rrs,
}
for (int i = 0; i < rrsig_rrs->rr_count; ++i) {
if (type == knot_rrs_rrsig_type_covered(rrsig_rrs, i)) {
if (type == knot_rrsig_type_covered(rrsig_rrs, i)) {
const knot_rr_t *rr_to_copy = knot_rrs_rr(rrsig_rrs, i);
int ret = knot_rrs_add_rr(out_sig, rr_to_copy, mm);
if (ret != KNOT_EOK) {
......@@ -311,7 +311,7 @@ static bool is_expired_signature(const knot_rrset_t *rrsigs, size_t pos,
assert(rrsigs->type == KNOT_RRTYPE_RRSIG);
assert(policy);
uint32_t expiration = knot_rrs_rrsig_sig_expiration(&rrsigs->rrs, pos);
uint32_t expiration = knot_rrsig_sig_expiration(&rrsigs->rrs, pos);
return (expiration <= policy->refresh_before);
}
......@@ -343,7 +343,7 @@ int knot_is_valid_signature(const knot_rrset_t *covered,
uint8_t *signature = NULL;
size_t signature_size = 0;
knot_rrs_rrsig_signature(&rrsigs->rrs, pos, &signature, &signature_size);
knot_rrsig_signature(&rrsigs->rrs, pos, &signature, &signature_size);
if (!signature) {
return KNOT_EINVAL;
}
......
......@@ -21,53 +21,52 @@
#include "libknot/dname.h"
static inline
const knot_dname_t *knot_rrs_cname_name(const knot_rrs_t *rrs)
const knot_dname_t *knot_cname_name(const knot_rrs_t *rrs)
{
RRS_CHECK(rrs, 0, return NULL);
return data_offset(rrs, 0, 0);
}
static inline
const knot_dname_t *knot_rrs_dname_target(const knot_rrs_t *rrs)
const knot_dname_t *knot_dname_target(const knot_rrs_t *rrs)
{
RRS_CHECK(rrs, 0, return NULL);
return data_offset(rrs, 0, 0);
}
static inline
const knot_dname_t *knot_rrs_ns_name(const knot_rrs_t *rrs, size_t pos)
const knot_dname_t *knot_ns_name(const knot_rrs_t *rrs, size_t pos)
{
RRS_CHECK(rrs, pos, return 0);
return data_offset(rrs, pos, 0);
}
static inline
const knot_dname_t *knot_rrs_mx_name(const knot_rrs_t *rrs, size_t pos)
const knot_dname_t *knot_mx_name(const knot_rrs_t *rrs, size_t pos)
{
RRS_CHECK(rrs, pos, return 0);
return data_offset(rrs, pos, 2);
}
static inline
const knot_dname_t *knot_rrs_srv_name(const knot_rrs_t *rrs, size_t pos)
const knot_dname_t *knot_srv_name(const knot_rrs_t *rrs, size_t pos)
{
RRS_CHECK(rrs, pos, return 0);
return data_offset(rrs, pos, 6);
}
static inline
const knot_dname_t *knot_rrs_name(const knot_rrs_t *rrs, size_t pos,
uint16_t type)
const knot_dname_t *knot_rdata_name(const knot_rrs_t *rrs, size_t pos, uint16_t type)
{
switch (type) {
case KNOT_RRTYPE_NS:
return knot_rrs_ns_name(rrs, pos);
return knot_ns_name(rrs, pos);
case KNOT_RRTYPE_MX:
return knot_rrs_mx_name(rrs, pos);
return knot_mx_name(rrs, pos);
case KNOT_RRTYPE_SRV:
return knot_rrs_srv_name(rrs, pos);
return knot_srv_name(rrs, pos);
case KNOT_RRTYPE_CNAME:
return knot_rrs_cname_name(rrs);
return knot_cname_name(rrs);
}
return NULL;
......
......@@ -21,14 +21,14 @@
#define KNOT_RDATA_DNSKEY_FLAG_KSK 1
static inline
uint16_t knot_rrs_dnskey_flags(const knot_rrs_t *rrs, size_t pos)
uint16_t knot_dnskey_flags(const knot_rrs_t *rrs, size_t pos)
{
RRS_CHECK(rrs, pos, return 0);
return knot_wire_read_u16(data_offset(rrs, pos, 0));
}
static inline
uint8_t knot_rrs_dnskey_proto(const knot_rrs_t *rrs, size_t pos)
uint8_t knot_dnskey_proto(const knot_rrs_t *rrs, size_t pos)
{
RRS_CHECK(rrs, pos, return 0);
......@@ -36,14 +36,14 @@ uint8_t knot_rrs_dnskey_proto(const knot_rrs_t *rrs, size_t pos)
}
static inline
uint8_t knot_rrs_dnskey_alg(const knot_rrs_t *rrs, size_t pos)
uint8_t knot_dnskey_alg(const knot_rrs_t *rrs, size_t pos)
{
RRS_CHECK(rrs, pos, return 0);
return *data_offset(rrs, pos, 3);
}
static inline
void knot_rrs_dnskey_key(const knot_rrs_t *rrs, size_t pos, uint8_t **key,
void knot_dnskey_key(const knot_rrs_t *rrs, size_t pos, uint8_t **key,
uint16_t *key_size)
{
RRS_CHECK(rrs, pos, return);
......
......@@ -19,19 +19,19 @@
#include "libknot/rr.h"
static inline
const knot_dname_t *knot_rrs_nsec_next(const knot_rrs_t *rrs)
const knot_dname_t *knot_nsec_next(const knot_rrs_t *rrs)
{
RRS_CHECK(rrs, 0, return NULL);
return data_offset(rrs, 0, 0);
}
static inline
void knot_rrs_nsec_bitmap(const knot_rrs_t *rrs,
void knot_nsec_bitmap(const knot_rrs_t *rrs,
uint8_t **bitmap, uint16_t *size)
{
RRS_CHECK(rrs, 0, return);
knot_rr_t *rr = knot_rrs_rr(rrs, 0);
int next_size = knot_dname_size(knot_rrs_nsec_next(rrs));
int next_size = knot_dname_size(knot_nsec_next(rrs));
*bitmap = knot_rr_rdata(rr) + next_size;
*size = knot_rr_rdata_size(rr) - next_size;
......
......@@ -36,63 +36,63 @@
#include "libknot/rdata/nsec3param.h"
static inline
uint8_t knot_rrs_nsec3_algorithm(const knot_rrs_t *rrs, size_t pos)
uint8_t knot_nsec3_algorithm(const knot_rrs_t *rrs, size_t pos)
{
RRS_CHECK(rrs, pos, return 0);
return *data_offset(rrs, pos, 0);
}
static inline
uint8_t knot_rrs_nsec3_flags(const knot_rrs_t *rrs, size_t pos)
uint8_t knot_nsec3_flags(const knot_rrs_t *rrs, size_t pos)
{
RRS_CHECK(rrs, pos, return 0);
return *data_offset(rrs, pos, 1);
}