Commit 1e117bc2 authored by Marek Vavruša's avatar Marek Vavruša

libknot/rdata: dissolved rdata.h into respective files

parent dd1a92bd
......@@ -211,6 +211,13 @@ src/libknot/packet/wire.h
src/libknot/processing/process.c
src/libknot/processing/process.h
src/libknot/rdata.h
src/libknot/rdata/dname.h
src/libknot/rdata/dnskey.h
src/libknot/rdata/nsec.h
src/libknot/rdata/nsec3.h
src/libknot/rdata/nsec3param.h
src/libknot/rdata/rrsig.h
src/libknot/rdata/soa.h
src/libknot/rr.c
src/libknot/rr.h
src/libknot/rrset-dump.c
......
......@@ -148,8 +148,6 @@ libknot_la_SOURCES = \
libknot/dnssec/key.c \
libknot/dnssec/key.h \
libknot/dnssec/bitmap.h \
libknot/dnssec/nsec3.c \
libknot/dnssec/nsec3.h \
libknot/dnssec/policy.c \
libknot/dnssec/policy.h \
libknot/dnssec/random.h \
......@@ -169,7 +167,18 @@ libknot_la_SOURCES = \
libknot/packet/wire.h \
libknot/processing/process.c \
libknot/processing/process.h \
libknot/rdata.h \
libknot/rdata/dname.h \
libknot/rdata/dnskey.h \
libknot/rdata/nsec.h \
libknot/rdata/nsec3.c \
libknot/rdata/nsec3.h \
libknot/rdata/nsec3param.h \
libknot/rdata/nsec3param.c \
libknot/rdata/nsec.h \
libknot/rdata/rrsig.h \
libknot/rdata/soa.h \
libknot/rdata/tsig.c \
libknot/rdata/tsig.h \
libknot/rrset-dump.c \
libknot/rrset-dump.h \
libknot/rr.c \
......@@ -178,8 +187,6 @@ libknot_la_SOURCES = \
libknot/rrset.h \
libknot/tsig-op.c \
libknot/tsig-op.h \
libknot/tsig.c \
libknot/tsig.h \
libknot/util/endian.h \
libknot/util/tolower.c \
libknot/util/tolower.h \
......
......@@ -35,7 +35,7 @@
#include <urcu.h>
#include "libknot/dname.h"
#include "libknot/tsig.h"
#include "libknot/rdata/tsig.h"
#include "libknot/dnssec/key.h"
#include "libknot/dnssec/policy.h"
#include "common/lists.h"
......
......@@ -26,7 +26,8 @@
#include "libknot/packet/wire.h"
#include "common/descriptor.h"
#include "libknot/tsig-op.h"
#include "libknot/rdata.h"
#include "libknot/rdata/dname.h"
#include "libknot/rdata/soa.h"
#include "libknot/dnssec/random.h"
#include "knot/dnssec/zone-sign.h"
#include "knot/dnssec/zone-nsec.h"
......
......@@ -17,7 +17,6 @@
#include <assert.h>
#include <stdint.h>
#include "libknot/rdata.h"
#include "common/debug.h"
#include "knot/dnssec/nsec-chain.h"
#include "knot/dnssec/zone-sign.h"
......
......@@ -19,7 +19,6 @@
#include "common/base32hex.h"
#include "knot/dnssec/nsec3-chain.h"
#include "libknot/dname.h"
#include "libknot/rdata.h"
#include "libknot/packet/wire.h"
#include "knot/zone/zone-contents.h"
#include "knot/zone/zone-diff.h"
......@@ -27,6 +26,7 @@
#include "knot/dnssec/zone-sign.h"
#include "knot/dnssec/zone-nsec.h"
#include "libknot/dnssec/bitmap.h"
#include "libknot/rdata/nsec3.h"
/* - Forward declarations --------------------------------------------------- */
......
......@@ -18,16 +18,16 @@
#include <dirent.h>
#include <stdbool.h>
#include <inttypes.h>
#include "common/debug.h"
#include "common/errcode.h"
#include "common/mempattern.h"
#include "libknot/common.h"
#include "libknot/dname.h"
#include "libknot/consts.h"
#include "libknot/dnssec/nsec3.h"
#include "libknot/rdata/dnskey.h"
#include "libknot/dnssec/sign.h"
#include "knot/dnssec/zone-keys.h"
#include "libknot/rdata.h"
#include "common/debug.h"
/*!
* \brief Free DNSSEC signing context for each key.
......
......@@ -21,18 +21,18 @@
#include <limits.h>
#include "common/base32hex.h"
#include "common/debug.h"
#include "common/descriptor.h"
#include "common/hhash.h"
#include "libknot/dnssec/bitmap.h"
#include "libknot/util/utils.h"
#include "libknot/packet/wire.h"
#include "libknot/rdata/soa.h"
#include "libknot/rdata/nsec3.h"
#include "knot/dnssec/nsec-chain.h"
#include "knot/dnssec/nsec3-chain.h"
#include "libknot/dnssec/bitmap.h"
#include "libknot/dnssec/nsec3.h"
#include "knot/dnssec/zone-nsec.h"
#include "knot/dnssec/zone-sign.h"
#include "libknot/rdata.h"
#include "common/debug.h"
#include "libknot/util/utils.h"
#include "libknot/packet/wire.h"
#include "knot/zone/zone-contents.h"
#include "knot/zone/zone-diff.h"
......
......@@ -19,21 +19,24 @@
#include <stdint.h>
#include <sys/types.h>
#include <time.h>
#include "common/debug.h"
#include "common/descriptor.h"
#include "common/errcode.h"
#include "common/hattrie/hat-trie.h"
#include "libknot/common.h"
#include "libknot/dname.h"
#include "libknot/rrset.h"
#include "libknot/dnssec/key.h"
#include "libknot/dnssec/policy.h"
#include "libknot/dnssec/rrset-sign.h"
#include "libknot/dnssec/sign.h"
#include "libknot/rdata/dname.h"
#include "libknot/rdata/rrsig.h"
#include "libknot/rdata/soa.h"
#include "knot/dnssec/zone-keys.h"
#include "knot/dnssec/zone-sign.h"
#include "libknot/rdata.h"
#include "libknot/rrset.h"
#include "knot/updates/changesets.h"
#include "common/debug.h"
#include "knot/zone/node.h"
#include "knot/zone/zone-contents.h"
......
/* Copyright (C) 2013 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
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
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "common/debug.h"
#include "common/descriptor.h"
#include "libknot/common.h"
#include "libknot/rdata/dname.h"
#include "libknot/rdata/soa.h"
#include "libknot/dnssec/rrset-sign.h"
#include "knot/nameserver/internet.h"
#include "knot/nameserver/nsec_proofs.h"
#include "knot/nameserver/process_query.h"
#include "knot/zone/zonedb.h"
#include "libknot/common.h"
#include "libknot/rdata.h"
#include "common/debug.h"
#include "common/descriptor.h"
#include "knot/server/zones.h"
#include "libknot/dnssec/rrset-sign.h"
/*! \brief Check if given node was already visited. */
static int wildcard_has_visited(struct query_data *qdata, const knot_node_t *node)
......
......@@ -3,10 +3,10 @@
#include "knot/nameserver/internet.h"
#include "knot/nameserver/process_query.h"
#include "common/debug.h"
#include "libknot/rdata.h"
#include "knot/server/zones.h"
#include "common/descriptor.h"
#include "libknot/util/utils.h"
#include "libknot/rdata/soa.h"
/*! \brief Current IXFR answer sections. */
enum {
......
......@@ -4,7 +4,6 @@
#include "knot/dnssec/zone-nsec.h"
#include "libknot/common.h"
#include "libknot/rdata.h"
#include "common/debug.h"
#define DNSSEC_ENABLED 1
......
......@@ -31,11 +31,11 @@
#include "common/evsched.h"
#include "knot/other/debug.h"
#include "knot/server/server.h"
#include "libknot/rdata.h"
#include "knot/nameserver/internet.h"
#include "common/debug.h"
#include "knot/nameserver/process_query.h"
#include "libknot/dnssec/random.h"
#include "libknot/rdata/soa.h"
/*----------------------------------------------------------------------------*/
/* API functions */
......
......@@ -26,7 +26,7 @@
#include "libknot/dname.h"
#include "libknot/dnssec/crypto.h"
#include "libknot/dnssec/random.h"
#include "libknot/rdata.h"
#include "libknot/rdata/soa.h"
#include "knot/zone/zone.h"
#include "knot/zone/zone.h"
#include "knot/zone/zonedb.h"
......
......@@ -31,10 +31,10 @@
#include "knot/zone/zone-dump.h"
#include "libknot/dname.h"
#include "libknot/dnssec/random.h"
#include "libknot/rdata/soa.h"
#include "knot/dnssec/zone-events.h"
#include "knot/dnssec/zone-sign.h"
#include "knot/nameserver/chaos.h"
#include "libknot/rdata.h"
#include "libknot/tsig-op.h"
#include "knot/updates/changesets.h"
#include "knot/updates/ddns.h"
......
......@@ -25,7 +25,7 @@
#include "common/errcode.h"
#include "knot/updates/acl.h"
#include "libknot/util/endian.h"
#include "libknot/tsig.h"
#include "libknot/rdata/tsig.h"
static inline uint32_t ipv4_chunk(const struct sockaddr_in *ipv4)
{
......
......@@ -33,7 +33,7 @@
#include "common/lists.h"
#include "common/sockaddr.h"
#include "common/mempattern.h"
#include "libknot/tsig.h"
#include "libknot/rdata/tsig.h"
struct knot_tsig_key;
......
......@@ -24,8 +24,8 @@
#include "common/mempattern.h"
#include "common/mempool.h"
#include "libknot/rrset.h"
#include "libknot/rdata/soa.h"
#include "common/debug.h"
#include "libknot/rdata.h"
int knot_changesets_init(knot_changesets_t **changesets)
{
......
......@@ -22,11 +22,11 @@
#include "knot/updates/changesets.h"
#include "knot/updates/xfr-in.h"
#include "knot/zone/semantic-check.h"
#include "libknot/rdata.h"
#include "common/debug.h"
#include "libknot/packet/pkt.h"
#include "libknot/common.h"
#include "libknot/consts.h"
#include "libknot/rdata/soa.h"
#include "common/mempattern.h"
#include "common/descriptor.h"
#include "common/lists.h"
......
......@@ -32,13 +32,13 @@
#include "libknot/dnssec/random.h"
#include "libknot/common.h"
#include "knot/updates/changesets.h"
#include "libknot/tsig.h"
#include "libknot/rdata/tsig.h"
#include "libknot/tsig-op.h"
#include "knot/zone/semantic-check.h"
#include "common/lists.h"
#include "common/descriptor.h"
#include "libknot/rdata.h"
#include "libknot/util/utils.h"
#include "libknot/rdata/soa.h"
#define KNOT_NS_TSIG_FREQ 100
......
......@@ -24,7 +24,7 @@
#include "knot/zone/node.h"
#include "libknot/rrset.h"
#include "libknot/rr.h"
#include "libknot/rdata.h"
#include "libknot/rdata/rrsig.h"
#include "common/descriptor.h"
#include "common/debug.h"
#include "common/mempattern.h"
......
......@@ -26,11 +26,14 @@
#include "libknot/libknot.h"
#include "libknot/dnssec/key.h"
#include "libknot/dnssec/rrset-sign.h"
#include "libknot/rdata/rrsig.h"
#include "libknot/rdata/soa.h"
#include "libknot/rdata/nsec.h"
#include "libknot/rdata/nsec3.h"
#include "common/base32hex.h"
#include "common/crc.h"
#include "common/descriptor.h"
#include "common/mempattern.h"
#include "libknot/rdata.h"
#include "knot/dnssec/zone-nsec.h"
#include "knot/zone/semantic-check.h"
......
......@@ -27,7 +27,10 @@
#include "knot/zone/zone-tree.h"
#include "libknot/packet/wire.h"
#include "libknot/consts.h"
#include "libknot/rdata.h"
#include "libknot/rdata/rrsig.h"
#include "libknot/rdata/nsec3.h"
#include "libknot/rdata/soa.h"
#include "libknot/rdata/dname.h"
/*----------------------------------------------------------------------------*/
/* Non-API functions */
......
......@@ -27,10 +27,9 @@
#ifndef _KNOT_ZONE_CONTENTS_H_
#define _KNOT_ZONE_CONTENTS_H_
#include "knot/zone/node.h"
#include "libknot/dnssec/nsec3.h"
#include "common/lists.h"
#include "libknot/rdata/nsec3param.h"
#include "knot/zone/node.h"
#include "knot/zone/zone-tree.h"
struct zone_t;
......
......@@ -34,7 +34,6 @@
#include "knot/other/debug.h"
#include "knot/zone/zone-create.h"
#include "zscanner/zscanner.h"
#include "libknot/rdata.h"
void process_error(const zs_scanner_t *s)
{
......
......@@ -22,8 +22,8 @@
#include "common/errcode.h"
#include "knot/zone/zone-diff.h"
#include "common/descriptor.h"
#include "libknot/rdata.h"
#include "libknot/util/utils.h"
#include "libknot/rdata/soa.h"
struct zone_diff_param {
knot_zone_tree_t *nodes;
......
......@@ -27,7 +27,6 @@
#include "libknot/common.h"
#include "libknot/dname.h"
#include "libknot/dnssec/random.h"
#include "libknot/rdata.h"
#include "libknot/util/utils.h"
/*!
......
......@@ -32,7 +32,7 @@
#include "libknot/dname.h"
#include "libknot/dnssec/key.h"
#include "libknot/dnssec/sig0.h"
#include "libknot/tsig.h"
#include "libknot/rdata/tsig.h"
#include "zscanner/zscanner.h"
/*!
......
......@@ -31,7 +31,7 @@
#include <time.h>
#include "libknot/dname.h"
#include "libknot/binary.h"
#include "libknot/tsig.h"
#include "libknot/rdata/tsig.h"
/*----------------------------------------------------------------------------*/
......
......@@ -24,8 +24,8 @@
#include "libknot/dnssec/policy.h"
#include "libknot/dnssec/rrset-sign.h"
#include "libknot/dnssec/sign.h"
#include "libknot/rdata.h"
#include "libknot/rrset.h"
#include "libknot/rdata/rrsig.h"
#define MAX_RR_WIREFORMAT_SIZE (64 * 1024)
#define RRSIG_RDATA_SIGNER_OFFSET 18
......
......@@ -33,13 +33,20 @@
#include "libknot/packet/wire.h"
#include "libknot/packet/compr.h"
#include "libknot/packet/pkt.h"
#include "libknot/rr.h"
#include "libknot/rrset.h"
#include "libknot/rrset-dump.h"
#include "libknot/tsig.h"
#include "libknot/rdata/dname.h"
#include "libknot/rdata/dnskey.h"
#include "libknot/rdata/nsec3.h"
#include "libknot/rdata/nsec3param.h"
#include "libknot/rdata/nsec.h"
#include "libknot/rdata/rrsig.h"
#include "libknot/rdata/soa.h"
#include "libknot/rdata/tsig.h"
#include "libknot/tsig-op.h"
#include "libknot/util/tolower.h"
#include "libknot/util/utils.h"
#include "libknot/rdata.h"
#endif
......
......@@ -23,7 +23,7 @@
#include "libknot/common.h"
#include "common/descriptor.h"
#include "libknot/packet/wire.h"
#include "libknot/tsig.h"
#include "libknot/rdata/tsig.h"
#include "libknot/tsig-op.h"
/*! \brief Scan packet for RRSet existence. */
......
......@@ -29,7 +29,7 @@
#include "common/mempattern.h"
#include "libknot/consts.h"
#include "libknot/tsig.h"
#include "libknot/rdata/tsig.h"
#include "libknot/packet/pkt.h"
/*! \brief Main packet processing states.
......
This diff is collapsed.
/* Copyright (C) 2014 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
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
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "common/descriptor.h"
#include "libknot/rr.h"
#include "libknot/dname.h"
static inline
const knot_dname_t *knot_rrs_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)
{
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)
{
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)
{
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)
{
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)
{
switch (type) {
case KNOT_RRTYPE_NS:
return knot_rrs_ns_name(rrs, pos);
case KNOT_RRTYPE_MX:
return knot_rrs_mx_name(rrs, pos);
case KNOT_RRTYPE_SRV:
return knot_rrs_srv_name(rrs, pos);
case KNOT_RRTYPE_CNAME:
return knot_rrs_cname_name(rrs);
}
return NULL;
}
\ No newline at end of file
/* Copyright (C) 2014 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
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
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "libknot/rr.h"
#define KNOT_RDATA_DNSKEY_FLAG_KSK 1
static inline
uint16_t knot_rrs_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)
{
RRS_CHECK(rrs, pos, return 0);
return *data_offset(rrs, pos, 2);
}
static inline
uint8_t knot_rrs_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,
uint16_t *key_size)
{
RRS_CHECK(rrs, pos, return);
*key = data_offset(rrs, pos, 4);
const knot_rr_t *rr = knot_rrs_rr(rrs, pos);
*key_size = knot_rr_rdata_size(rr) - 4;
}
\ No newline at end of file
/* Copyright (C) 2014 CZ.NIC, z.s.p.o. <knot-dns@labs.nic.cz>
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
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once
#include "libknot/rr.h"
static inline
const knot_dname_t *knot_rrs_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,
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));
*bitmap = knot_rr_rdata(rr) + next_size;
*size = knot_rr_rdata_size(rr) - next_size;
}
\ No newline at end of file
......@@ -17,17 +17,10 @@
#include <assert.h>
#include <openssl/evp.h>
#include <openssl/sha.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdlib.h>
#include "common/descriptor.h"
#include "common/memdup.h"
#include "libknot/common.h"
#include "libknot/consts.h"
#include "libknot/dnssec/nsec3.h"
#include "libknot/rdata.h"
#include "libknot/rdata/nsec3.h"
#include "libknot/util/tolower.h"
#include "common/errcode.h"
/*!
* \brief Compute NSEC3 SHA1 hash.
......@@ -102,49 +95,6 @@ static int nsec3_sha1(const uint8_t *salt, uint8_t salt_length,
return KNOT_EOK;
}
/* - public API -------------------------------------------------------------*/
/*!
* \brief Initialize the structure with NSEC3 params from NSEC3PARAM RR set.
*/
int knot_nsec3_params_from_wire(knot_nsec3_params_t *params,
const knot_rrs_t *rrs)
{
if (params == NULL || rrs == NULL || rrs->rr_count == 0) {
return KNOT_EINVAL;
}
knot_nsec3_params_t result = { 0 };
result.algorithm = knot_rrs_nsec3param_algorithm(rrs, 0);
result.iterations = knot_rrs_nsec3param_iterations(rrs, 0);
result.flags = knot_rrs_nsec3param_flags(rrs, 0);
result.salt_length = knot_rrs_nsec3param_salt_length(rrs, 0);
if (result.salt_length > 0) {
result.salt = knot_memdup(knot_rrs_nsec3param_salt(rrs, 0),
result.salt_length);
if (!result.salt) {
return KNOT_ENOMEM;
}
} else {
result.salt = NULL;
}
knot_nsec3_params_free(params);
*params = result;
return KNOT_EOK;
}
/*!
* \brief Clean up structure with NSEC3 params (do not deallocate).
*/
void knot_nsec3_params_free(knot_nsec3_params_t *params)
{
free(params->salt);
}
/*!
* \brief Compute NSEC3 hash for given data.
*/
......
......@@ -25,17 +25,80 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef _KNOT_DNSSEC_NSEC3_H_
#define _KNOT_DNSSEC_NSEC3_H_
#pragma once
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
#include "libknot/consts.h"
#include "libknot/rrset.h"
#include "libknot/rr.h"
#include "libknot/rdata/nsec3param.h"
/*---------------------------------------------------------------------------*/
static inline
uint8_t knot_rrs_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)
{