resolved-dns-rr.h revision af22c65b272f0e7a1c0518c222749f3c09d05438
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/>.
8bdbb8d9cbe1d35708385573d70984ab4533812dLennart 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"
04d39279245834494baccfdb9349db8bf80abd13Lennart Poettering#include "in-addr-util.h"
878cd7e95ca303f9851d227a22d2022bd49944b0Lennart Poettering#include "list.h"
878cd7e95ca303f9851d227a22d2022bd49944b0Lennart Poettering
f48e75cb9a8112d35855c44a156934f2ee0edb2eLennart Poetteringtypedef struct DnsResourceKey DnsResourceKey;
785890acf6d629ff881a1f065f431df1b7fc8c7aLennart Poetteringtypedef struct DnsResourceRecord DnsResourceRecord;
f2cbe59e113f08549949a76ac5b9b3972df4cc30Lennart Poetteringtypedef struct DnsTxtItem DnsTxtItem;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen/* DNSKEY RR flags */
1ee306e1248866617c96ed9f4263f375588ad838Lennart 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 */
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen#define MDNS_RR_CACHE_FLUSH (UINT16_C(1) << 15)
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering/* DNSSEC algorithm identifiers, see
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering * http://tools.ietf.org/html/rfc4034#appendix-A.1 and
aa1936ea1a89c2bb968ba33e3274898a4eeae771Lennart Poettering * https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml */
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringenum {
9d12709626bccc0cae677a7035f62efe6aabb4abLennart Poettering DNSSEC_ALGORITHM_RSAMD5 = 1,
04d39279245834494baccfdb9349db8bf80abd13Lennart Poettering DNSSEC_ALGORITHM_DH,
023fb90b83871a15ef7f57e8cd126e3426f99b9eLennart Poettering DNSSEC_ALGORITHM_DSA,
785890acf6d629ff881a1f065f431df1b7fc8c7aLennart Poettering DNSSEC_ALGORITHM_ECC,
785890acf6d629ff881a1f065f431df1b7fc8c7aLennart Poettering DNSSEC_ALGORITHM_RSASHA1,
f2cbe59e113f08549949a76ac5b9b3972df4cc30Lennart Poettering DNSSEC_ALGORITHM_DSA_NSEC3_SHA1,
56159e0d918e9a9be07988133bb2847779325de0Lennart Poettering DNSSEC_ALGORITHM_RSASHA1_NSEC3_SHA1,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_ALGORITHM_RSASHA256 = 8, /* RFC 5702 */
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_ALGORITHM_RSASHA512 = 10, /* RFC 5702 */
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_ALGORITHM_INDIRECT = 252,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_ALGORITHM_PRIVATEDNS,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_ALGORITHM_PRIVATEOID,
e56056e93d33619a3acf13e483900b4f8938228fThomas Hindoe Paaboel Andersen _DNSSEC_ALGORITHM_MAX_DEFINED
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering};
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
d21ed1ead18d16d35c30299a69d3366847f8a039Lennart Poettering/* DNSSEC digest identifiers, see
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering * https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml */
785890acf6d629ff881a1f065f431df1b7fc8c7aLennart Poetteringenum {
785890acf6d629ff881a1f065f431df1b7fc8c7aLennart Poettering DNSSEC_DIGEST_SHA1 = 1,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_DIGEST_SHA256 = 2,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_DIGEST_SHA384 = 4,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering _DNSSEC_DIGEST_MAX_DEFINED
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering};
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringstruct DnsResourceKey {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering unsigned n_ref;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering uint16_t class, type;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering char *_name; /* don't access directy, use DNS_RESOURCE_KEY_NAME()! */
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering};
56159e0d918e9a9be07988133bb2847779325de0Lennart Poettering
56159e0d918e9a9be07988133bb2847779325de0Lennart Poettering/* Creates a temporary resource key. This is only useful to quickly
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen * look up something, without allocating a full DnsResourceKey object
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen * for it. Note that it is not OK to take references to this kind of
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen * resource key object. */
56159e0d918e9a9be07988133bb2847779325de0Lennart Poettering#define DNS_RESOURCE_KEY_CONST(c, t, n) \
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering ((DnsResourceKey) { \
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering .n_ref = (unsigned) -1, \
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering .class = c, \
56159e0d918e9a9be07988133bb2847779325de0Lennart Poettering .type = t, \
56159e0d918e9a9be07988133bb2847779325de0Lennart Poettering ._name = (char*) n, \
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering })
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersenstruct DnsTxtItem {
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen size_t length;
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen LIST_FIELDS(DnsTxtItem, items);
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen uint8_t data[];
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen};
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersenstruct DnsResourceRecord {
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen unsigned n_ref;
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen DnsResourceKey *key;
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen char *to_string;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering uint32_t ttl;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering bool unparseable:1;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering bool wire_format_canonical:1;
e56056e93d33619a3acf13e483900b4f8938228fThomas Hindoe Paaboel Andersen void *wire_format;
e56056e93d33619a3acf13e483900b4f8938228fThomas Hindoe Paaboel Andersen size_t wire_format_size;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering size_t wire_format_rdata_offset;
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen union {
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen struct {
5b30bef856e89a571df57b7b953e9a1409d9acedLennart Poettering void *data;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering size_t size;
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen } generic, opt;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering struct {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering uint16_t priority;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering uint16_t weight;
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen uint16_t port;
5b30bef856e89a571df57b7b953e9a1409d9acedLennart Poettering char *name;
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen } srv;
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen struct {
5b30bef856e89a571df57b7b953e9a1409d9acedLennart Poettering char *name;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering } ptr, ns, cname, dname;
e56056e93d33619a3acf13e483900b4f8938228fThomas Hindoe Paaboel Andersen
e56056e93d33619a3acf13e483900b4f8938228fThomas Hindoe Paaboel Andersen struct {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering char *cpu;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering char *os;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering } hinfo;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering struct {
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering DnsTxtItem *items;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering } txt, spf;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering struct {
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering struct in_addr in_addr;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering } a;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering struct {
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering struct in6_addr in6_addr;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering } aaaa;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering struct {
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering char *mname;
56159e0d918e9a9be07988133bb2847779325de0Lennart Poettering char *rname;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint32_t serial;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint32_t refresh;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering uint32_t retry;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint32_t expire;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint32_t minimum;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering } soa;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering
56159e0d918e9a9be07988133bb2847779325de0Lennart Poettering struct {
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering uint16_t priority;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering char *exchange;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering } mx;
56159e0d918e9a9be07988133bb2847779325de0Lennart Poettering
56159e0d918e9a9be07988133bb2847779325de0Lennart Poettering struct {
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint8_t version;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint8_t size;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint8_t horiz_pre;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint8_t vert_pre;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint32_t latitude;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint32_t longitude;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint32_t altitude;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering } loc;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering struct {
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint16_t key_tag;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint8_t algorithm;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint8_t digest_type;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering void *digest;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering size_t digest_size;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering } ds;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering /* https://tools.ietf.org/html/rfc4255#section-3.1 */
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering struct {
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint8_t algorithm;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering uint8_t fptype;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering void *fingerprint;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering size_t fingerprint_size;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering } sshfp;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering /* http://tools.ietf.org/html/rfc4034#section-2.1 */
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering struct {
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint16_t flags;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint8_t protocol;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint8_t algorithm;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering void* key;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering size_t key_size;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering } dnskey;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering /* http://tools.ietf.org/html/rfc4034#section-3.1 */
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering struct {
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering uint16_t type_covered;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering uint8_t algorithm;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering uint8_t labels;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint32_t original_ttl;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering uint32_t expiration;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering uint32_t inception;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering uint16_t key_tag;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering char *signer;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering void *signature;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering size_t signature_size;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering } rrsig;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering /* https://tools.ietf.org/html/rfc4034#section-4.1 */
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering struct {
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering char *next_domain_name;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering Bitmap *types;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering } nsec;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering struct {
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint8_t algorithm;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint8_t flags;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint16_t iterations;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering void *salt;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering size_t salt_size;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering void *next_hashed_name;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering size_t next_hashed_name_size;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering Bitmap *types;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering } nsec3;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering };
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering};
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poetteringstatic inline const char* DNS_RESOURCE_KEY_NAME(const DnsResourceKey *key) {
6389e747d5b09b18e00d85b9b13c1be2ff884015Lennart Poettering if (_unlikely_(!key))
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering return NULL;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering if (key->_name)
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering return key->_name;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering return (char*) key + sizeof(DnsResourceKey);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering}
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart PoetteringDnsResourceKey* dns_resource_key_new(uint16_t class, uint16_t type, const char *name);
8937e7b68940d0fa0d0aab90eb7425fa7dccebc9Lennart PoetteringDnsResourceKey* dns_resource_key_new_redirect(const DnsResourceKey *key, const DnsResourceRecord *cname);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poetteringint dns_resource_key_new_append_suffix(DnsResourceKey **ret, DnsResourceKey *key, char *name);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart PoetteringDnsResourceKey* dns_resource_key_new_consume(uint16_t class, uint16_t type, char *name);
8937e7b68940d0fa0d0aab90eb7425fa7dccebc9Lennart PoetteringDnsResourceKey* dns_resource_key_ref(DnsResourceKey *key);
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart PoetteringDnsResourceKey* dns_resource_key_unref(DnsResourceKey *key);
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poetteringbool dns_resource_key_is_address(const DnsResourceKey *key);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poetteringint dns_resource_key_equal(const DnsResourceKey *a, const DnsResourceKey *b);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poetteringint dns_resource_key_match_rr(const DnsResourceKey *key, DnsResourceRecord *rr, const char *search_domain);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poetteringint dns_resource_key_match_cname_or_dname(const DnsResourceKey *key, const DnsResourceKey *cname, const char *search_domain);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poetteringint dns_resource_key_match_soa(const DnsResourceKey *key, const DnsResourceKey *soa);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poetteringint dns_resource_key_to_string(const DnsResourceKey *key, char **ret);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart PoetteringDEFINE_TRIVIAL_CLEANUP_FUNC(DnsResourceKey*, dns_resource_key_unref);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poetteringstatic inline bool dns_key_is_shared(const DnsResourceKey *key) {
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering return IN_SET(key->type, DNS_TYPE_PTR);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering}
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart PoetteringDnsResourceRecord* dns_resource_record_new(DnsResourceKey *key);
89f7c8465cd1ab37347dd0c15920bce31e8225dfLennart PoetteringDnsResourceRecord* dns_resource_record_new_full(uint16_t class, uint16_t type, const char *name);
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom GundersenDnsResourceRecord* dns_resource_record_ref(DnsResourceRecord *rr);
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom GundersenDnsResourceRecord* dns_resource_record_unref(DnsResourceRecord *rr);
aa1936ea1a89c2bb968ba33e3274898a4eeae771Lennart Poetteringint dns_resource_record_new_reverse(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *name);
aa1936ea1a89c2bb968ba33e3274898a4eeae771Lennart Poetteringint dns_resource_record_new_address(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *name);
aa1936ea1a89c2bb968ba33e3274898a4eeae771Lennart Poetteringint dns_resource_record_equal(const DnsResourceRecord *a, const DnsResourceRecord *b);
aa1936ea1a89c2bb968ba33e3274898a4eeae771Lennart Poetteringconst char* dns_resource_record_to_string(DnsResourceRecord *rr);
aa1936ea1a89c2bb968ba33e3274898a4eeae771Lennart PoetteringDEFINE_TRIVIAL_CLEANUP_FUNC(DnsResourceRecord*, dns_resource_record_unref);
aa1936ea1a89c2bb968ba33e3274898a4eeae771Lennart Poettering
aa1936ea1a89c2bb968ba33e3274898a4eeae771Lennart Poetteringint dns_resource_record_to_wire_format(DnsResourceRecord *rr, bool canonical);
aa1936ea1a89c2bb968ba33e3274898a4eeae771Lennart Poettering
d21ed1ead18d16d35c30299a69d3366847f8a039Lennart PoetteringDnsTxtItem *dns_txt_item_free_all(DnsTxtItem *i);
aa1936ea1a89c2bb968ba33e3274898a4eeae771Lennart Poetteringbool dns_txt_item_equal(DnsTxtItem *a, DnsTxtItem *b);
aa1936ea1a89c2bb968ba33e3274898a4eeae771Lennart Poettering
aa1936ea1a89c2bb968ba33e3274898a4eeae771Lennart Poetteringextern const struct hash_ops dns_resource_key_hash_ops;
aa1936ea1a89c2bb968ba33e3274898a4eeae771Lennart Poettering
aa1936ea1a89c2bb968ba33e3274898a4eeae771Lennart Poetteringconst char* dnssec_algorithm_to_string(int i) _const_;
aa1936ea1a89c2bb968ba33e3274898a4eeae771Lennart Poetteringint dnssec_algorithm_from_string(const char *s) _pure_;
a7893c6b28772edbc7e1fea3c209caa54d465648Lennart Poettering
aa1936ea1a89c2bb968ba33e3274898a4eeae771Lennart Poetteringconst char *dnssec_digest_to_string(int i) _const_;
aa1936ea1a89c2bb968ba33e3274898a4eeae771Lennart Poetteringint dnssec_digest_from_string(const char *s) _pure_;
aa1936ea1a89c2bb968ba33e3274898a4eeae771Lennart Poettering