resolved-dns-rr.h revision 7778dffff3d8bd7438fe19a248c16203668324c9
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen#pragma once
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen/***
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen This file is part of systemd.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen Copyright 2014 Lennart Poettering
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen systemd is free software; you can redistribute it and/or modify it
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen under the terms of the GNU Lesser General Public License as published by
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen the Free Software Foundation; either version 2.1 of the License, or
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen (at your option) any later version.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen systemd is distributed in the hope that it will be useful, but
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen WITHOUT ANY WARRANTY; without even the implied warranty of
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen Lesser General Public License for more details.
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen You should have received a copy of the GNU Lesser General Public License
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen along with systemd; If not, see <http://www.gnu.org/licenses/>.
b5efdb8af40ea759a1ea584c1bc44ecc81dd00ceLennart Poettering ***/
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
cf0fbc49e67b55f8d346fc94de28c90113505297Thomas Hindoe Paaboel Andersen#include <netinet/in.h>
cf0fbc49e67b55f8d346fc94de28c90113505297Thomas Hindoe Paaboel Andersen
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen#include "bitmap.h"
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen#include "dns-type.h"
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen#include "hashmap.h"
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen#include "in-addr-util.h"
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen#include "list.h"
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen
a2ba62c719224a4b47751623ca5e8b0333f49721Lennart Poetteringtypedef struct DnsResourceKey DnsResourceKey;
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersentypedef struct DnsResourceRecord DnsResourceRecord;
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersentypedef struct DnsTxtItem DnsTxtItem;
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen/* DNS record classes, see RFC 1035 */
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersenenum {
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen DNS_CLASS_IN = 0x01,
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen DNS_CLASS_ANY = 0xFF,
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen _DNS_CLASS_MAX,
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen _DNS_CLASS_INVALID = -1
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen};
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen/* DNSKEY RR flags */
a2ba62c719224a4b47751623ca5e8b0333f49721Lennart Poettering#define DNSKEY_FLAG_ZONE_KEY (UINT16_C(1) << 8)
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen#define DNSKEY_FLAG_SEP (UINT16_C(1) << 0)
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen/* mDNS RR flags */
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen#define MDNS_RR_CACHE_FLUSH (UINT16_C(1) << 15)
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen
a2ba62c719224a4b47751623ca5e8b0333f49721Lennart Poettering/* DNSSEC algorithm identifiers, see
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen * http://tools.ietf.org/html/rfc4034#appendix-A.1 and
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen * https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml */
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersenenum {
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen DNSSEC_ALGORITHM_RSAMD5 = 1,
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen DNSSEC_ALGORITHM_DH,
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen DNSSEC_ALGORITHM_DSA,
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich DNSSEC_ALGORITHM_ECC,
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich DNSSEC_ALGORITHM_RSASHA1,
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich DNSSEC_ALGORITHM_DSA_NSEC3_SHA1,
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich DNSSEC_ALGORITHM_RSASHA1_NSEC3_SHA1,
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich DNSSEC_ALGORITHM_RSASHA256 = 8, /* RFC 5702 */
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich DNSSEC_ALGORITHM_RSASHA512 = 10, /* RFC 5702 */
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich DNSSEC_ALGORITHM_INDIRECT = 252,
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich DNSSEC_ALGORITHM_PRIVATEDNS,
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich DNSSEC_ALGORITHM_PRIVATEOID,
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich _DNSSEC_ALGORITHM_MAX_DEFINED
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich};
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich/* DNSSEC digest identifiers, see
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich * https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml */
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovichenum {
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich DNSSEC_DIGEST_SHA1 = 1,
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich DNSSEC_DIGEST_SHA256 = 2,
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich _DNSSEC_DIGEST_MAX_DEFINED
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich};
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovichstruct DnsResourceKey {
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich unsigned n_ref;
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich uint16_t class, type;
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich char *_name; /* don't access directy, use DNS_RESOURCE_KEY_NAME()! */
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich bool cache_flush:1;
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich};
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich/* Creates a temporary resource key. This is only useful to quickly
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich * look up something, without allocating a full DnsResourceKey object
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich * for it. Note that it is not OK to take references to this kind of
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich * resource key object. */
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich#define DNS_RESOURCE_KEY_CONST(c, t, n) \
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich ((DnsResourceKey) { \
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich .n_ref = (unsigned) -1, \
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich .class = c, \
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich .type = t, \
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich ._name = (char*) n, \
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich })
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovichstruct DnsTxtItem {
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich size_t length;
5bb14c8651b017983bb9cbd1444969c7a1bda14eTom Gundersen LIST_FIELDS(DnsTxtItem, items);
5bb14c8651b017983bb9cbd1444969c7a1bda14eTom Gundersen uint8_t data[];
5bb14c8651b017983bb9cbd1444969c7a1bda14eTom Gundersen};
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovichstruct DnsResourceRecord {
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich unsigned n_ref;
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich DnsResourceKey *key;
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich uint32_t ttl;
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich bool unparseable:1;
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich bool wire_format_canonical:1;
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich void *wire_format;
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich size_t wire_format_size;
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich size_t wire_format_rdata_offset;
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich union {
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich struct {
5347925a59530bd4e6616eb8c8d43a02c3e14c46Tom Gundersen void *data;
5347925a59530bd4e6616eb8c8d43a02c3e14c46Tom Gundersen size_t size;
7c99d940c11e4da1863a218b6b70dd16e65b7518Tom Gundersen } generic;
7c99d940c11e4da1863a218b6b70dd16e65b7518Tom Gundersen
7c99d940c11e4da1863a218b6b70dd16e65b7518Tom Gundersen struct {
7c99d940c11e4da1863a218b6b70dd16e65b7518Tom Gundersen uint16_t priority;
12e0f830f592ec4c6bb49ac7ae1e0e84f74105e3Tom Gundersen uint16_t weight;
7c99d940c11e4da1863a218b6b70dd16e65b7518Tom Gundersen uint16_t port;
5347925a59530bd4e6616eb8c8d43a02c3e14c46Tom Gundersen char *name;
5347925a59530bd4e6616eb8c8d43a02c3e14c46Tom Gundersen } srv;
5347925a59530bd4e6616eb8c8d43a02c3e14c46Tom Gundersen
5347925a59530bd4e6616eb8c8d43a02c3e14c46Tom Gundersen struct {
5347925a59530bd4e6616eb8c8d43a02c3e14c46Tom Gundersen char *name;
5347925a59530bd4e6616eb8c8d43a02c3e14c46Tom Gundersen } ptr, ns, cname, dname;
12e0f830f592ec4c6bb49ac7ae1e0e84f74105e3Tom Gundersen
5347925a59530bd4e6616eb8c8d43a02c3e14c46Tom Gundersen struct {
5347925a59530bd4e6616eb8c8d43a02c3e14c46Tom Gundersen char *cpu;
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen char *os;
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen } hinfo;
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen struct {
505f8da7325591defe5f751f328bd26915267602Tom Gundersen DnsTxtItem *items;
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen } txt, spf;
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen struct {
505f8da7325591defe5f751f328bd26915267602Tom Gundersen struct in_addr in_addr;
12e0f830f592ec4c6bb49ac7ae1e0e84f74105e3Tom Gundersen } a;
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen struct {
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen struct in6_addr in6_addr;
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen } aaaa;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen
f0213e3796b4dd66e546e2de4d677db319f9171bTom Gundersen struct {
f0213e3796b4dd66e546e2de4d677db319f9171bTom Gundersen char *mname;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen char *rname;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen uint32_t serial;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen uint32_t refresh;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen uint32_t retry;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen uint32_t expire;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen uint32_t minimum;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen } soa;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen struct {
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen uint16_t priority;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen char *exchange;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen } mx;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen
3ac8e5433f20bfb5e12b918252643106a2de52afTom Gundersen struct {
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen uint8_t version;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen uint8_t size;
3ac8e5433f20bfb5e12b918252643106a2de52afTom Gundersen uint8_t horiz_pre;
3ac8e5433f20bfb5e12b918252643106a2de52afTom Gundersen uint8_t vert_pre;
3ac8e5433f20bfb5e12b918252643106a2de52afTom Gundersen uint32_t latitude;
3ac8e5433f20bfb5e12b918252643106a2de52afTom Gundersen uint32_t longitude;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen uint32_t altitude;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen } loc;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen struct {
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen uint16_t key_tag;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen uint8_t algorithm;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen uint8_t digest_type;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen void *digest;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen size_t digest_size;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen } ds;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen /* https://tools.ietf.org/html/rfc4255#section-3.1 */
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen struct {
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen uint8_t algorithm;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen uint8_t fptype;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen void *fingerprint;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen size_t fingerprint_size;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen } sshfp;
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen /* http://tools.ietf.org/html/rfc4034#section-2.1 */
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen struct {
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen uint16_t flags;
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen uint8_t protocol;
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen uint8_t algorithm;
5347925a59530bd4e6616eb8c8d43a02c3e14c46Tom Gundersen void* key;
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen size_t key_size;
09bee74d7a5f266b175baa19892fa84a9da51d7fTom Gundersen } dnskey;
e1ea665edac17d75fce01b72dadfa3211b60df2cEugene Yakubovich
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen /* http://tools.ietf.org/html/rfc4034#section-3.1 */
9505d3c6deda0452c22ab2ed47bca74b98d87a17Tom Gundersen struct {
12e0f830f592ec4c6bb49ac7ae1e0e84f74105e3Tom Gundersen uint16_t type_covered;
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen uint8_t algorithm;
5347925a59530bd4e6616eb8c8d43a02c3e14c46Tom Gundersen uint8_t labels;
5347925a59530bd4e6616eb8c8d43a02c3e14c46Tom Gundersen uint32_t original_ttl;
5347925a59530bd4e6616eb8c8d43a02c3e14c46Tom Gundersen uint32_t expiration;
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen uint32_t inception;
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen uint16_t key_tag;
12e0f830f592ec4c6bb49ac7ae1e0e84f74105e3Tom Gundersen char *signer;
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen void *signature;
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen size_t signature_size;
12e0f830f592ec4c6bb49ac7ae1e0e84f74105e3Tom Gundersen } rrsig;
12e0f830f592ec4c6bb49ac7ae1e0e84f74105e3Tom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen /* https://tools.ietf.org/html/rfc4034#section-4.1 */
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen struct {
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen char *next_domain_name;
505f8da7325591defe5f751f328bd26915267602Tom Gundersen Bitmap *types;
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen } nsec;
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen struct {
f579559b3a14c1f1ef96c372e7626c4733e6ef7dTom Gundersen uint8_t algorithm;
uint8_t flags;
uint16_t iterations;
void *salt;
size_t salt_size;
void *next_hashed_name;
size_t next_hashed_name_size;
Bitmap *types;
} nsec3;
};
};
static inline const char* DNS_RESOURCE_KEY_NAME(const DnsResourceKey *key) {
if (_unlikely_(!key))
return NULL;
if (key->_name)
return key->_name;
return (char*) key + sizeof(DnsResourceKey);
}
DnsResourceKey* dns_resource_key_new(uint16_t class, uint16_t type, const char *name);
DnsResourceKey* dns_resource_key_new_redirect(const DnsResourceKey *key, const DnsResourceRecord *cname);
int dns_resource_key_new_append_suffix(DnsResourceKey **ret, DnsResourceKey *key, char *name);
DnsResourceKey* dns_resource_key_new_consume(uint16_t class, uint16_t type, char *name);
DnsResourceKey* dns_resource_key_ref(DnsResourceKey *key);
DnsResourceKey* dns_resource_key_unref(DnsResourceKey *key);
bool dns_resource_key_is_address(const DnsResourceKey *key);
int dns_resource_key_equal(const DnsResourceKey *a, const DnsResourceKey *b);
int dns_resource_key_match_rr(const DnsResourceKey *key, const DnsResourceRecord *rr, const char *search_domain);
int dns_resource_key_match_cname(const DnsResourceKey *key, const DnsResourceRecord *rr, const char *search_domain);
int dns_resource_key_to_string(const DnsResourceKey *key, char **ret);
DEFINE_TRIVIAL_CLEANUP_FUNC(DnsResourceKey*, dns_resource_key_unref);
static inline bool dns_key_is_shared(const DnsResourceKey *key) {
return IN_SET(key->type, DNS_TYPE_PTR);
}
DnsResourceRecord* dns_resource_record_new(DnsResourceKey *key);
DnsResourceRecord* dns_resource_record_new_full(uint16_t class, uint16_t type, const char *name);
DnsResourceRecord* dns_resource_record_ref(DnsResourceRecord *rr);
DnsResourceRecord* dns_resource_record_unref(DnsResourceRecord *rr);
int dns_resource_record_new_reverse(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *name);
int dns_resource_record_new_address(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *name);
int dns_resource_record_equal(const DnsResourceRecord *a, const DnsResourceRecord *b);
int dns_resource_record_to_string(const DnsResourceRecord *rr, char **ret);
DEFINE_TRIVIAL_CLEANUP_FUNC(DnsResourceRecord*, dns_resource_record_unref);
int dns_resource_record_to_wire_format(DnsResourceRecord *rr, bool canonical);
DnsTxtItem *dns_txt_item_free_all(DnsTxtItem *i);
bool dns_txt_item_equal(DnsTxtItem *a, DnsTxtItem *b);
const char *dns_class_to_string(uint16_t type);
int dns_class_from_string(const char *name, uint16_t *class);
extern const struct hash_ops dns_resource_key_hash_ops;
const char* dnssec_algorithm_to_string(int i) _const_;
int dnssec_algorithm_from_string(const char *s) _pure_;
const char *dnssec_digest_to_string(int i) _const_;
int dnssec_digest_from_string(const char *s) _pure_;