resolved-dns-rr.h revision d15ad74251454d55b715958d8e6f50f45195904a
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering#pragma once
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering/***
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering This file is part of systemd.
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering Copyright 2014 Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering systemd is free software; you can redistribute it and/or modify it
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering under the terms of the GNU Lesser General Public License as published by
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering (at your option) any later version.
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering systemd is distributed in the hope that it will be useful, but
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering Lesser General Public License for more details.
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering You should have received a copy of the GNU Lesser General Public License
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering ***/
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering#include <netinet/in.h>
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering#include "bitmap.h"
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering#include "dns-type.h"
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering#include "hashmap.h"
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering#include "in-addr-util.h"
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering#include "list.h"
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringtypedef struct DnsResourceKey DnsResourceKey;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poetteringtypedef struct DnsResourceRecord DnsResourceRecord;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringtypedef struct DnsTxtItem DnsTxtItem;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering/* DNSKEY RR flags */
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering#define DNSKEY_FLAG_ZONE_KEY (UINT16_C(1) << 8)
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering#define DNSKEY_FLAG_SEP (UINT16_C(1) << 0)
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering/* mDNS RR flags */
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering#define MDNS_RR_CACHE_FLUSH (UINT16_C(1) << 15)
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering/* DNSSEC algorithm identifiers, see
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering * http://tools.ietf.org/html/rfc4034#appendix-A.1 and
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering * https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml */
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringenum {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_ALGORITHM_RSAMD5 = 1,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_ALGORITHM_DH,
d3e84ddb885e9d5f0ae9930eb905910e3a81f157Lennart Poettering DNSSEC_ALGORITHM_DSA,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_ALGORITHM_ECC,
d3e84ddb885e9d5f0ae9930eb905910e3a81f157Lennart Poettering DNSSEC_ALGORITHM_RSASHA1,
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering DNSSEC_ALGORITHM_DSA_NSEC3_SHA1,
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering DNSSEC_ALGORITHM_RSASHA1_NSEC3_SHA1,
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering DNSSEC_ALGORITHM_RSASHA256 = 8, /* RFC 5702 */
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering DNSSEC_ALGORITHM_RSASHA512 = 10, /* RFC 5702 */
afc6adb5ec7e73bc13156c43f52fb015cd80cc68Lennart Poettering DNSSEC_ALGORITHM_ECC_GOST = 12, /* RFC 5933 */
a658cafa98ab55ea948c29bc87eb3945d515fb41Lennart Poettering DNSSEC_ALGORITHM_ECDSAP256SHA256 = 13, /* RFC 6605 */
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_ALGORITHM_ECDSAP384SHA384 = 14, /* RFC 6605 */
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_ALGORITHM_INDIRECT = 252,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_ALGORITHM_PRIVATEDNS,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_ALGORITHM_PRIVATEOID,
cde93897cdefdd7c7f66c400a61e42ceee5f6a46Lennart Poettering _DNSSEC_ALGORITHM_MAX_DEFINED
cde93897cdefdd7c7f66c400a61e42ceee5f6a46Lennart Poettering};
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering/* DNSSEC digest identifiers, see
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering * https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml */
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringenum {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_DIGEST_SHA1 = 1,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_DIGEST_SHA256 = 2, /* RFC 4509 */
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_DIGEST_GOST_R_34_11_94 = 3, /* RFC 5933 */
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_DIGEST_SHA384 = 4, /* RFC 6605 */
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering _DNSSEC_DIGEST_MAX_DEFINED
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering};
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering/* DNSSEC NSEC3 hash algorithms, see
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering * https://www.iana.org/assignments/dnssec-nsec3-parameters/dnssec-nsec3-parameters.xhtml */
d3e84ddb885e9d5f0ae9930eb905910e3a81f157Lennart Poetteringenum {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering NSEC3_ALGORITHM_SHA1 = 1,
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering _NSEC3_ALGORITHM_MAX_DEFINED
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering};
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poetteringstruct DnsResourceKey {
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering unsigned n_ref;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint16_t class, type;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering char *_name; /* don't access directy, use DNS_RESOURCE_KEY_NAME()! */
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering};
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering/* Creates a temporary resource key. This is only useful to quickly
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering * look up something, without allocating a full DnsResourceKey object
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering * for it. Note that it is not OK to take references to this kind of
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering * resource key object. */
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering#define DNS_RESOURCE_KEY_CONST(c, t, n) \
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering ((DnsResourceKey) { \
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering .n_ref = (unsigned) -1, \
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering .class = c, \
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering .type = t, \
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering ._name = (char*) n, \
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering })
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringstruct DnsTxtItem {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering size_t length;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering LIST_FIELDS(DnsTxtItem, items);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering uint8_t data[];
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering};
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringstruct DnsResourceRecord {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering unsigned n_ref;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DnsResourceKey *key;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering char *to_string;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering uint32_t ttl;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering usec_t expiry; /* RRSIG signature expiry */
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering bool unparseable:1;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering bool wire_format_canonical:1;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering void *wire_format;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering size_t wire_format_size;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering size_t wire_format_rdata_offset;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering union {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering struct {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering void *data;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering size_t size;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering } generic, opt;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering struct {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering uint16_t priority;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering uint16_t weight;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering uint16_t port;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering char *name;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering } srv;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering struct {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering char *name;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering } ptr, ns, cname, dname;
76b543756ef69ce69784d571aefe8de65eaeb331Lennart Poettering
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering struct {
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering char *cpu;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering char *os;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering } hinfo;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering struct {
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering DnsTxtItem *items;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering } txt, spf;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering struct {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering struct in_addr in_addr;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering } a;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering struct {
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering struct in6_addr in6_addr;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering } aaaa;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering struct {
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering char *mname;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering char *rname;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint32_t serial;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering uint32_t refresh;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering uint32_t retry;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint32_t expire;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint32_t minimum;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering } soa;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering struct {
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint16_t priority;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering char *exchange;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering } mx;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering /* https://tools.ietf.org/html/rfc1876 */
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering struct {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering uint8_t version;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering uint8_t size;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint8_t horiz_pre;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint8_t vert_pre;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint32_t latitude;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint32_t longitude;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint32_t altitude;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering } loc;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering /* https://tools.ietf.org/html/rfc4255#section-3.1 */
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering struct {
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint8_t algorithm;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint8_t fptype;
943aca8efb39453e3994ccdd1e08534b788c5aeeLennart Poettering void *fingerprint;
943aca8efb39453e3994ccdd1e08534b788c5aeeLennart Poettering size_t fingerprint_size;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering } sshfp;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering /* http://tools.ietf.org/html/rfc4034#section-2.1 */
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering struct {
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint16_t flags;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint8_t protocol;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint8_t algorithm;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering void* key;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering size_t key_size;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering } dnskey;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering /* http://tools.ietf.org/html/rfc4034#section-3.1 */
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering struct {
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint16_t type_covered;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint8_t algorithm;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint8_t labels;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint32_t original_ttl;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint32_t expiration;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint32_t inception;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint16_t key_tag;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering char *signer;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering void *signature;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering size_t signature_size;
6797c324a653f119a3d7133122648aaa4878ddd6Lennart Poettering } rrsig;
6797c324a653f119a3d7133122648aaa4878ddd6Lennart Poettering
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering /* https://tools.ietf.org/html/rfc4034#section-4.1 */
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering struct {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering char *next_domain_name;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering Bitmap *types;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering } nsec;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering /* https://tools.ietf.org/html/rfc4034#section-5.1 */
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering struct {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering uint16_t key_tag;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint8_t algorithm;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint8_t digest_type;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering void *digest;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering size_t digest_size;
5bb658a1784a0fd4f0f32adb4b1fb636ff503f7dKay Sievers } ds;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering struct {
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering uint8_t algorithm;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering uint8_t flags;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering uint16_t iterations;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering void *salt;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering size_t salt_size;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering void *next_hashed_name;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering size_t next_hashed_name_size;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering Bitmap *types;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering } nsec3;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering };
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering};
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringstatic inline const char* DNS_RESOURCE_KEY_NAME(const DnsResourceKey *key) {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering if (_unlikely_(!key))
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering return NULL;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering if (key->_name)
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering return key->_name;
71fda00f320379f5cbee8e118848de98caaa229dLennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering return (char*) key + sizeof(DnsResourceKey);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering}
a658cafa98ab55ea948c29bc87eb3945d515fb41Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart PoetteringDnsResourceKey* dns_resource_key_new(uint16_t class, uint16_t type, const char *name);
1ee306e1248866617c96ed9f4263f375588ad838Lennart PoetteringDnsResourceKey* dns_resource_key_new_redirect(const DnsResourceKey *key, const DnsResourceRecord *cname);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringint dns_resource_key_new_append_suffix(DnsResourceKey **ret, DnsResourceKey *key, char *name);
1ee306e1248866617c96ed9f4263f375588ad838Lennart PoetteringDnsResourceKey* dns_resource_key_new_consume(uint16_t class, uint16_t type, char *name);
1ee306e1248866617c96ed9f4263f375588ad838Lennart PoetteringDnsResourceKey* dns_resource_key_ref(DnsResourceKey *key);
1ee306e1248866617c96ed9f4263f375588ad838Lennart PoetteringDnsResourceKey* dns_resource_key_unref(DnsResourceKey *key);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringbool dns_resource_key_is_address(const DnsResourceKey *key);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringint dns_resource_key_equal(const DnsResourceKey *a, const DnsResourceKey *b);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringint dns_resource_key_match_rr(const DnsResourceKey *key, DnsResourceRecord *rr, const char *search_domain);
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poetteringint dns_resource_key_match_cname_or_dname(const DnsResourceKey *key, const DnsResourceKey *cname, const char *search_domain);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringint dns_resource_key_match_soa(const DnsResourceKey *key, const DnsResourceKey *soa);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringint dns_resource_key_to_string(const DnsResourceKey *key, char **ret);
1ee306e1248866617c96ed9f4263f375588ad838Lennart PoetteringDEFINE_TRIVIAL_CLEANUP_FUNC(DnsResourceKey*, dns_resource_key_unref);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringstatic inline bool dns_key_is_shared(const DnsResourceKey *key) {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering return IN_SET(key->type, DNS_TYPE_PTR);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering}
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart PoetteringDnsResourceRecord* dns_resource_record_new(DnsResourceKey *key);
1ee306e1248866617c96ed9f4263f375588ad838Lennart PoetteringDnsResourceRecord* dns_resource_record_new_full(uint16_t class, uint16_t type, const char *name);
1ee306e1248866617c96ed9f4263f375588ad838Lennart PoetteringDnsResourceRecord* dns_resource_record_ref(DnsResourceRecord *rr);
1ee306e1248866617c96ed9f4263f375588ad838Lennart PoetteringDnsResourceRecord* dns_resource_record_unref(DnsResourceRecord *rr);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringint dns_resource_record_new_reverse(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *name);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringint dns_resource_record_new_address(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *name);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringint dns_resource_record_equal(const DnsResourceRecord *a, const DnsResourceRecord *b);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringconst char* dns_resource_record_to_string(DnsResourceRecord *rr);
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart PoetteringDEFINE_TRIVIAL_CLEANUP_FUNC(DnsResourceRecord*, dns_resource_record_unref);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringint dns_resource_record_to_wire_format(DnsResourceRecord *rr, bool canonical);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart PoetteringDnsTxtItem *dns_txt_item_free_all(DnsTxtItem *i);
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringbool dns_txt_item_equal(DnsTxtItem *a, DnsTxtItem *b);
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poetteringextern const struct hash_ops dns_resource_key_hash_ops;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringconst char* dnssec_algorithm_to_string(int i) _const_;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringint dnssec_algorithm_from_string(const char *s) _pure_;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poetteringconst char *dnssec_digest_to_string(int i) _const_;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poetteringint dnssec_digest_from_string(const char *s) _pure_;
c335068380fe8c9d843cdb2cf8a00f822cfabed3Lennart Poettering