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/>.
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering ***/
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering#include <netinet/in.h>
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering#include "bitmap.h"
f48e75cb9a8112d35855c44a156934f2ee0edb2eLennart Poettering#include "dns-type.h"
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering#include "hashmap.h"
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering#include "in-addr-util.h"
785890acf6d629ff881a1f065f431df1b7fc8c7aLennart Poettering#include "list.h"
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poetteringtypedef struct DnsResourceKey DnsResourceKey;
eef46c372f64f40dd75415b2c504c73138719c8dLennart Poetteringtypedef struct DnsResourceRecord DnsResourceRecord;
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersentypedef struct DnsTxtItem DnsTxtItem;
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen/* DNSKEY RR flags */
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering#define DNSKEY_FLAG_ZONE_KEY (UINT16_C(1) << 8)
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering#define DNSKEY_FLAG_SEP (UINT16_C(1) << 0)
9d12709626bccc0cae677a7035f62efe6aabb4abLennart Poettering
f2cbe59e113f08549949a76ac5b9b3972df4cc30Lennart Poettering/* mDNS RR flags */
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering#define MDNS_RR_CACHE_FLUSH (UINT16_C(1) << 15)
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering/* DNSSEC algorithm identifiers, see
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering * http://tools.ietf.org/html/rfc4034#appendix-A.1 and
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering * https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml */
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poetteringenum {
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering DNSSEC_ALGORITHM_RSAMD5 = 1,
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering DNSSEC_ALGORITHM_DH,
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering DNSSEC_ALGORITHM_DSA,
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering DNSSEC_ALGORITHM_ECC,
0b452006de98294d1690f045f6ea2f7f6630ec3bRonny Chevalier DNSSEC_ALGORITHM_RSASHA1,
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering DNSSEC_ALGORITHM_DSA_NSEC3_SHA1,
24882e06c135584f16f31ba8a00fecde8b7f6fadLennart Poettering DNSSEC_ALGORITHM_RSASHA1_NSEC3_SHA1,
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering DNSSEC_ALGORITHM_RSASHA256 = 8, /* RFC 5702 */
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering DNSSEC_ALGORITHM_RSASHA512 = 10, /* RFC 5702 */
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering DNSSEC_ALGORITHM_ECC_GOST = 12, /* RFC 5933 */
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering DNSSEC_ALGORITHM_ECDSAP256SHA256 = 13, /* RFC 6605 */
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering DNSSEC_ALGORITHM_ECDSAP384SHA384 = 14, /* RFC 6605 */
3f6fd1ba65f962702753c4ad284b588e59689a23Lennart Poettering DNSSEC_ALGORITHM_INDIRECT = 252,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_ALGORITHM_PRIVATEDNS,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_ALGORITHM_PRIVATEOID,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering _DNSSEC_ALGORITHM_MAX_DEFINED
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering};
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
e56056e93d33619a3acf13e483900b4f8938228fThomas Hindoe Paaboel Andersen/* DNSSEC digest identifiers, see
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering * https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml */
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poetteringenum {
d21ed1ead18d16d35c30299a69d3366847f8a039Lennart Poettering DNSSEC_DIGEST_SHA1 = 1,
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering DNSSEC_DIGEST_SHA256 = 2, /* RFC 4509 */
785890acf6d629ff881a1f065f431df1b7fc8c7aLennart Poettering DNSSEC_DIGEST_GOST_R_34_11_94 = 3, /* RFC 5933 */
785890acf6d629ff881a1f065f431df1b7fc8c7aLennart Poettering DNSSEC_DIGEST_SHA384 = 4, /* RFC 6605 */
d8f52ed25a9edce75fda5251c977b7898e33887eLennart Poettering _DNSSEC_DIGEST_MAX_DEFINED
acf97e213e69a97e63ab8f7fad7ecd53608c757aLennart Poettering};
8b0cc9a36c8f92f010f2e8465942d2cd7c580d78Lennart Poettering
8b0cc9a36c8f92f010f2e8465942d2cd7c580d78Lennart Poettering/* DNSSEC NSEC3 hash algorithms, see
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering * https://www.iana.org/assignments/dnssec-nsec3-parameters/dnssec-nsec3-parameters.xhtml */
6e18cc9fa078d2a967251017ddb5baefb104b720Lennart Poetteringenum {
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering NSEC3_ALGORITHM_SHA1 = 1,
587fec427c80b6c34dcf1d7570f891fcb652a7c5Lennart Poettering _NSEC3_ALGORITHM_MAX_DEFINED
c454426c54c9beb274f415a80c64a4f1580700e7Lennart Poettering};
c454426c54c9beb274f415a80c64a4f1580700e7Lennart 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};
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
acf97e213e69a97e63ab8f7fad7ecd53608c757aLennart Poettering * resource key object. */
acf97e213e69a97e63ab8f7fad7ecd53608c757aLennart Poettering#define DNS_RESOURCE_KEY_CONST(c, t, n) \
acf97e213e69a97e63ab8f7fad7ecd53608c757aLennart Poettering ((DnsResourceKey) { \
acf97e213e69a97e63ab8f7fad7ecd53608c757aLennart Poettering .n_ref = (unsigned) -1, \
acf97e213e69a97e63ab8f7fad7ecd53608c757aLennart Poettering .class = c, \
acf97e213e69a97e63ab8f7fad7ecd53608c757aLennart Poettering .type = t, \
acf97e213e69a97e63ab8f7fad7ecd53608c757aLennart Poettering ._name = (char*) n, \
acf97e213e69a97e63ab8f7fad7ecd53608c757aLennart Poettering })
acf97e213e69a97e63ab8f7fad7ecd53608c757aLennart Poettering
acf97e213e69a97e63ab8f7fad7ecd53608c757aLennart Poettering
acf97e213e69a97e63ab8f7fad7ecd53608c757aLennart Poetteringstruct DnsTxtItem {
acf97e213e69a97e63ab8f7fad7ecd53608c757aLennart Poettering size_t length;
acf97e213e69a97e63ab8f7fad7ecd53608c757aLennart Poettering LIST_FIELDS(DnsTxtItem, items);
8b0cc9a36c8f92f010f2e8465942d2cd7c580d78Lennart Poettering uint8_t data[];
8b0cc9a36c8f92f010f2e8465942d2cd7c580d78Lennart Poettering};
8b0cc9a36c8f92f010f2e8465942d2cd7c580d78Lennart Poettering
8b0cc9a36c8f92f010f2e8465942d2cd7c580d78Lennart Poetteringstruct DnsResourceRecord {
8b0cc9a36c8f92f010f2e8465942d2cd7c580d78Lennart Poettering unsigned n_ref;
8b0cc9a36c8f92f010f2e8465942d2cd7c580d78Lennart Poettering DnsResourceKey *key;
8b0cc9a36c8f92f010f2e8465942d2cd7c580d78Lennart Poettering char *to_string;
8b0cc9a36c8f92f010f2e8465942d2cd7c580d78Lennart Poettering uint32_t ttl;
8b0cc9a36c8f92f010f2e8465942d2cd7c580d78Lennart Poettering usec_t expiry; /* RRSIG signature expiry */
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering bool unparseable:1;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering bool wire_format_canonical:1;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering void *wire_format;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering size_t wire_format_size;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering size_t wire_format_rdata_offset;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering union {
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering struct {
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering void *data;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering size_t size;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering } generic, opt;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering struct {
56159e0d918e9a9be07988133bb2847779325de0Lennart Poettering uint16_t priority;
56159e0d918e9a9be07988133bb2847779325de0Lennart Poettering uint16_t weight;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering uint16_t port;
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen char *name;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering } srv;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen struct {
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering char *name;
56159e0d918e9a9be07988133bb2847779325de0Lennart Poettering } ptr, ns, cname, dname;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering struct {
56159e0d918e9a9be07988133bb2847779325de0Lennart Poettering char *cpu;
56159e0d918e9a9be07988133bb2847779325de0Lennart Poettering char *os;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering } hinfo;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen struct {
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen DnsTxtItem *items;
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen } txt, spf;
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen struct {
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen struct in_addr in_addr;
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen } a;
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering struct {
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen struct in6_addr in6_addr;
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen } aaaa;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering struct {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering char *mname;
3d7415f43f0fe6a821d7bc4a341ba371e8a30ef3Lennart Poettering char *rname;
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen uint32_t serial;
5b30bef856e89a571df57b7b953e9a1409d9acedLennart Poettering uint32_t refresh;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering uint32_t retry;
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen uint32_t expire;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering uint32_t minimum;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering } soa;
fee6d013d859bc66f5c993530898fece53fab06dLennart Poettering
fee6d013d859bc66f5c993530898fece53fab06dLennart Poettering struct {
fee6d013d859bc66f5c993530898fece53fab06dLennart Poettering uint16_t priority;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering char *exchange;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering } mx;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering /* https://tools.ietf.org/html/rfc1876 */
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering struct {
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering uint8_t version;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering uint8_t size;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering uint8_t horiz_pre;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering uint8_t vert_pre;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering uint32_t latitude;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering uint32_t longitude;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering uint32_t altitude;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering } loc;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering /* https://tools.ietf.org/html/rfc4255#section-3.1 */
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering struct {
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering uint8_t algorithm;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering uint8_t fptype;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering void *fingerprint;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering size_t fingerprint_size;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering } sshfp;
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen
5b30bef856e89a571df57b7b953e9a1409d9acedLennart Poettering /* http://tools.ietf.org/html/rfc4034#section-2.1 */
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen struct {
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen uint16_t flags;
a1da85830bfaa77b9eb9c54693e5573559c97e50Tom Gundersen uint8_t protocol;
5b30bef856e89a571df57b7b953e9a1409d9acedLennart Poettering uint8_t algorithm;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering void* key;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering size_t key_size;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering } dnskey;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering /* http://tools.ietf.org/html/rfc4034#section-3.1 */
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering struct {
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering uint16_t type_covered;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering uint8_t algorithm;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering uint8_t labels;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering uint32_t original_ttl;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering uint32_t expiration;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering uint32_t inception;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering uint16_t key_tag;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering char *signer;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering void *signature;
e56056e93d33619a3acf13e483900b4f8938228fThomas Hindoe Paaboel Andersen size_t signature_size;
0b63e2789f984e84f40bf6e49f5da15c87298cedLennart Poettering } rrsig;
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering /* https://tools.ietf.org/html/rfc4034#section-4.1 */
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering struct {
1ee306e1248866617c96ed9f4263f375588ad838Lennart Poettering char *next_domain_name;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering Bitmap *types;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering } nsec;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering /* https://tools.ietf.org/html/rfc4034#section-5.1 */
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering struct {
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering uint16_t key_tag;
b6b1849830f5e4a6065c3b0c993668e500c954d3Lennart Poettering uint8_t algorithm;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint8_t digest_type;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering void *digest;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering size_t digest_size;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering } ds;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering struct {
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint8_t algorithm;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering uint8_t flags;
56159e0d918e9a9be07988133bb2847779325de0Lennart Poettering uint16_t iterations;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering void *salt;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering size_t salt_size;
c19de71113f956809995fc68817e055e9f61f607Lennart Poettering void *next_hashed_name;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering size_t next_hashed_name_size;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering Bitmap *types;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering } nsec3;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering };
56159e0d918e9a9be07988133bb2847779325de0Lennart Poettering};
b6b1849830f5e4a6065c3b0c993668e500c954d3Lennart Poettering
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poetteringstatic inline const char* DNS_RESOURCE_KEY_NAME(const DnsResourceKey *key) {
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering if (_unlikely_(!key))
56159e0d918e9a9be07988133bb2847779325de0Lennart Poettering return NULL;
56159e0d918e9a9be07988133bb2847779325de0Lennart Poettering
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering if (key->_name)
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering return key->_name;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering return (char*) key + sizeof(DnsResourceKey);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering}
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart PoetteringDnsResourceKey* dns_resource_key_new(uint16_t class, uint16_t type, const char *name);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart 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);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart PoetteringDnsResourceKey* dns_resource_key_ref(DnsResourceKey *key);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart PoetteringDnsResourceKey* dns_resource_key_unref(DnsResourceKey *key);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart 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);
b6b1849830f5e4a6065c3b0c993668e500c954d3Lennart 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
b6b1849830f5e4a6065c3b0c993668e500c954d3Lennart Poetteringstatic inline bool dns_key_is_shared(const DnsResourceKey *key) {
b6b1849830f5e4a6065c3b0c993668e500c954d3Lennart Poettering return IN_SET(key->type, DNS_TYPE_PTR);
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering}
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart PoetteringDnsResourceRecord* dns_resource_record_new(DnsResourceKey *key);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart PoetteringDnsResourceRecord* dns_resource_record_new_full(uint16_t class, uint16_t type, const char *name);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart PoetteringDnsResourceRecord* dns_resource_record_ref(DnsResourceRecord *rr);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart PoetteringDnsResourceRecord* dns_resource_record_unref(DnsResourceRecord *rr);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poetteringint dns_resource_record_new_reverse(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *name);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poetteringint dns_resource_record_new_address(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *name);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poetteringint dns_resource_record_equal(const DnsResourceRecord *a, const DnsResourceRecord *b);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poetteringconst char* dns_resource_record_to_string(DnsResourceRecord *rr);
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart PoetteringDEFINE_TRIVIAL_CLEANUP_FUNC(DnsResourceRecord*, dns_resource_record_unref);
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poetteringint dns_resource_record_to_wire_format(DnsResourceRecord *rr, bool canonical);
b6b1849830f5e4a6065c3b0c993668e500c954d3Lennart Poettering
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart PoetteringDnsTxtItem *dns_txt_item_free_all(DnsTxtItem *i);
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poetteringbool dns_txt_item_equal(DnsTxtItem *a, DnsTxtItem *b);
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poetteringextern const struct hash_ops dns_resource_key_hash_ops;
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poettering
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poetteringconst char* dnssec_algorithm_to_string(int i) _const_;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poetteringint dnssec_algorithm_from_string(const char *s) _pure_;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poettering
cd61c3bfd718fb398cc53ced906266a9297782c9Lennart Poetteringconst char *dnssec_digest_to_string(int i) _const_;
10f9c75519671e7c7ab8993b54fe22da7c2d0c38Lennart Poetteringint dnssec_digest_from_string(const char *s) _pure_;
b6b1849830f5e4a6065c3b0c993668e500c954d3Lennart Poettering