resolved-dns-rr.h revision 7b50eb2efa122200e39646c19a29abab302f7d24
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering#pragma once
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering/***
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering This file is part of systemd.
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering Copyright 2014 Lennart Poettering
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering systemd is free software; you can redistribute it and/or modify it
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering under the terms of the GNU Lesser General Public License as published by
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering (at your option) any later version.
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering systemd is distributed in the hope that it will be useful, but
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering Lesser General Public License for more details.
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering You should have received a copy of the GNU Lesser General Public License
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering ***/
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering#include <netinet/in.h>
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering#include "bitmap.h"
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poettering#include "dns-type.h"
4e731273edfe852a3eee2949cd20f49fd5b4f6d7Lennart Poettering#include "hashmap.h"
4e731273edfe852a3eee2949cd20f49fd5b4f6d7Lennart Poettering#include "in-addr-util.h"
07630cea1f3a845c09309f197ac7c4f11edd3b62Lennart Poettering#include "list.h"
1ca208fb4f93e5869704af1812cbff7130a2fc03Zbigniew Jędrzejewski-Szmek
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poetteringtypedef struct DnsResourceKey DnsResourceKey;
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poetteringtypedef struct DnsResourceRecord DnsResourceRecord;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringtypedef struct DnsTxtItem DnsTxtItem;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering/* DNSKEY RR flags */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering#define DNSKEY_FLAG_ZONE_KEY (UINT16_C(1) << 8)
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering#define DNSKEY_FLAG_SEP (UINT16_C(1) << 0)
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering/* mDNS RR flags */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering#define MDNS_RR_CACHE_FLUSH (UINT16_C(1) << 15)
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering/* DNSSEC algorithm identifiers, see
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering * http://tools.ietf.org/html/rfc4034#appendix-A.1 and
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering * https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringenum {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering DNSSEC_ALGORITHM_RSAMD5 = 1,
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering DNSSEC_ALGORITHM_DH,
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering DNSSEC_ALGORITHM_DSA,
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering DNSSEC_ALGORITHM_ECC,
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering DNSSEC_ALGORITHM_RSASHA1,
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering DNSSEC_ALGORITHM_DSA_NSEC3_SHA1,
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering DNSSEC_ALGORITHM_RSASHA1_NSEC3_SHA1,
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering DNSSEC_ALGORITHM_RSASHA256 = 8, /* RFC 5702 */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering DNSSEC_ALGORITHM_RSASHA512 = 10, /* RFC 5702 */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering DNSSEC_ALGORITHM_INDIRECT = 252,
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering DNSSEC_ALGORITHM_PRIVATEDNS,
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering DNSSEC_ALGORITHM_PRIVATEOID,
938d2699d2e818bd996614e89ea3d668200ad2a8Zbigniew Jędrzejewski-Szmek _DNSSEC_ALGORITHM_MAX_DEFINED
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering};
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering/* DNSSEC digest identifiers, see
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering * https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringenum {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering DNSSEC_DIGEST_SHA1 = 1,
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering DNSSEC_DIGEST_SHA256 = 2,
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering _DNSSEC_DIGEST_MAX_DEFINED
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering};
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringstruct DnsResourceKey {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering unsigned n_ref;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint16_t class, type;
39883f622f392d8579f4428fc5a789a102efbb10Lennart Poettering char *_name; /* don't access directy, use DNS_RESOURCE_KEY_NAME()! */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering};
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
938d2699d2e818bd996614e89ea3d668200ad2a8Zbigniew Jędrzejewski-Szmek/* Creates a temporary resource key. This is only useful to quickly
938d2699d2e818bd996614e89ea3d668200ad2a8Zbigniew Jędrzejewski-Szmek * look up something, without allocating a full DnsResourceKey object
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering * for it. Note that it is not OK to take references to this kind of
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering * resource key object. */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering#define DNS_RESOURCE_KEY_CONST(c, t, n) \
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering ((DnsResourceKey) { \
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering .n_ref = (unsigned) -1, \
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering .class = c, \
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering .type = t, \
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering ._name = (char*) n, \
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering })
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringstruct DnsTxtItem {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering size_t length;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering LIST_FIELDS(DnsTxtItem, items);
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint8_t data[];
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering};
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poetteringstruct DnsResourceRecord {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering unsigned n_ref;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering DnsResourceKey *key;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering char *to_string;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint32_t ttl;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering bool unparseable:1;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering bool wire_format_canonical:1;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering void *wire_format;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering size_t wire_format_size;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering size_t wire_format_rdata_offset;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering union {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering void *data;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering size_t size;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering } generic, opt;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint16_t priority;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint16_t weight;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint16_t port;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering char *name;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering } srv;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering char *name;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering } ptr, ns, cname, dname;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering char *cpu;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering char *os;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering } hinfo;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering DnsTxtItem *items;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering } txt, spf;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct in_addr in_addr;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering } a;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct in6_addr in6_addr;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering } aaaa;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering char *mname;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering char *rname;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint32_t serial;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint32_t refresh;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint32_t retry;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint32_t expire;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint32_t minimum;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering } soa;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint16_t priority;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering char *exchange;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering } mx;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint8_t version;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint8_t size;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint8_t horiz_pre;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint8_t vert_pre;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint32_t latitude;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint32_t longitude;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint32_t altitude;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering } loc;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint16_t key_tag;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint8_t algorithm;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint8_t digest_type;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering void *digest;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering size_t digest_size;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering } ds;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering /* https://tools.ietf.org/html/rfc4255#section-3.1 */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint8_t algorithm;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint8_t fptype;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering void *fingerprint;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering size_t fingerprint_size;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering } sshfp;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering /* http://tools.ietf.org/html/rfc4034#section-2.1 */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint16_t flags;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint8_t protocol;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint8_t algorithm;
938d2699d2e818bd996614e89ea3d668200ad2a8Zbigniew Jędrzejewski-Szmek void* key;
938d2699d2e818bd996614e89ea3d668200ad2a8Zbigniew Jędrzejewski-Szmek size_t key_size;
938d2699d2e818bd996614e89ea3d668200ad2a8Zbigniew Jędrzejewski-Szmek } dnskey;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering /* http://tools.ietf.org/html/rfc4034#section-3.1 */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint16_t type_covered;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint8_t algorithm;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint8_t labels;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint32_t original_ttl;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering uint32_t expiration;
938d2699d2e818bd996614e89ea3d668200ad2a8Zbigniew Jędrzejewski-Szmek uint32_t inception;
938d2699d2e818bd996614e89ea3d668200ad2a8Zbigniew Jędrzejewski-Szmek uint16_t key_tag;
938d2699d2e818bd996614e89ea3d668200ad2a8Zbigniew Jędrzejewski-Szmek char *signer;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering void *signature;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering size_t signature_size;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering } rrsig;
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering /* https://tools.ietf.org/html/rfc4034#section-4.1 */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering struct {
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering char *next_domain_name;
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächler Bitmap *types;
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett } nsec;
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächler struct {
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett uint8_t algorithm;
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett uint8_t flags;
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett uint16_t iterations;
c7fdf44d08e1217d40dc092fb90a65978a0f541fLennart Poettering void *salt;
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächler size_t salt_size;
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett void *next_hashed_name;
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett size_t next_hashed_name_size;
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächler Bitmap *types;
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett } nsec3;
da927ba997d68401563b927f92e6e40e021a8e5cMichal Schmidt };
c7fdf44d08e1217d40dc092fb90a65978a0f541fLennart Poettering};
c7fdf44d08e1217d40dc092fb90a65978a0f541fLennart Poettering
c7fdf44d08e1217d40dc092fb90a65978a0f541fLennart Poetteringstatic inline const char* DNS_RESOURCE_KEY_NAME(const DnsResourceKey *key) {
c7fdf44d08e1217d40dc092fb90a65978a0f541fLennart Poettering if (_unlikely_(!key))
c7fdf44d08e1217d40dc092fb90a65978a0f541fLennart Poettering return NULL;
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächler
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett if (key->_name)
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett return key->_name;
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächler
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächler return (char*) key + sizeof(DnsResourceKey);
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächler}
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächler
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas BächlerDnsResourceKey* dns_resource_key_new(uint16_t class, uint16_t type, const char *name);
4cd2b2cf8ca585d15ebc859701b346658262b5bbDenis TikhomirovDnsResourceKey* dns_resource_key_new_redirect(const DnsResourceKey *key, const DnsResourceRecord *cname);
4cd2b2cf8ca585d15ebc859701b346658262b5bbDenis Tikhomirovint dns_resource_key_new_append_suffix(DnsResourceKey **ret, DnsResourceKey *key, char *name);
4cd2b2cf8ca585d15ebc859701b346658262b5bbDenis TikhomirovDnsResourceKey* dns_resource_key_new_consume(uint16_t class, uint16_t type, char *name);
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas BächlerDnsResourceKey* dns_resource_key_ref(DnsResourceKey *key);
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas BächlerDnsResourceKey* dns_resource_key_unref(DnsResourceKey *key);
0c9d8f1d4b5018199cb5a9b57580dc1480a7f915Jani Nikulabool dns_resource_key_is_address(const DnsResourceKey *key);
4cd2b2cf8ca585d15ebc859701b346658262b5bbDenis Tikhomirovint dns_resource_key_equal(const DnsResourceKey *a, const DnsResourceKey *b);
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächlerint dns_resource_key_match_rr(const DnsResourceKey *key, DnsResourceRecord *rr, const char *search_domain);
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächlerint dns_resource_key_match_cname_or_dname(const DnsResourceKey *key, const DnsResourceKey *cname, const char *search_domain);
7b909d7407965c03caaba30daae7aee113627a83Josh Triplettint dns_resource_key_match_soa(const DnsResourceKey *key, const DnsResourceKey *soa);
da927ba997d68401563b927f92e6e40e021a8e5cMichal Schmidtint dns_resource_key_to_string(const DnsResourceKey *key, char **ret);
7b909d7407965c03caaba30daae7aee113627a83Josh TriplettDEFINE_TRIVIAL_CLEANUP_FUNC(DnsResourceKey*, dns_resource_key_unref);
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett
7b909d7407965c03caaba30daae7aee113627a83Josh Triplettstatic inline bool dns_key_is_shared(const DnsResourceKey *key) {
4cd2b2cf8ca585d15ebc859701b346658262b5bbDenis Tikhomirov return IN_SET(key->type, DNS_TYPE_PTR);
4cd2b2cf8ca585d15ebc859701b346658262b5bbDenis Tikhomirov}
4cd2b2cf8ca585d15ebc859701b346658262b5bbDenis Tikhomirov
4cd2b2cf8ca585d15ebc859701b346658262b5bbDenis TikhomirovDnsResourceRecord* dns_resource_record_new(DnsResourceKey *key);
4cd2b2cf8ca585d15ebc859701b346658262b5bbDenis TikhomirovDnsResourceRecord* dns_resource_record_new_full(uint16_t class, uint16_t type, const char *name);
4cd2b2cf8ca585d15ebc859701b346658262b5bbDenis TikhomirovDnsResourceRecord* dns_resource_record_ref(DnsResourceRecord *rr);
0c9d8f1d4b5018199cb5a9b57580dc1480a7f915Jani NikulaDnsResourceRecord* dns_resource_record_unref(DnsResourceRecord *rr);
7b909d7407965c03caaba30daae7aee113627a83Josh Triplettint dns_resource_record_new_reverse(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *name);
7b909d7407965c03caaba30daae7aee113627a83Josh Triplettint dns_resource_record_new_address(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *name);
7b909d7407965c03caaba30daae7aee113627a83Josh Triplettint dns_resource_record_equal(const DnsResourceRecord *a, const DnsResourceRecord *b);
7b909d7407965c03caaba30daae7aee113627a83Josh Triplettconst char* dns_resource_record_to_string(DnsResourceRecord *rr);
7b909d7407965c03caaba30daae7aee113627a83Josh TriplettDEFINE_TRIVIAL_CLEANUP_FUNC(DnsResourceRecord*, dns_resource_record_unref);
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett
7b909d7407965c03caaba30daae7aee113627a83Josh Triplettint dns_resource_record_to_wire_format(DnsResourceRecord *rr, bool canonical);
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett
7b909d7407965c03caaba30daae7aee113627a83Josh TriplettDnsTxtItem *dns_txt_item_free_all(DnsTxtItem *i);
0c9d8f1d4b5018199cb5a9b57580dc1480a7f915Jani Nikulabool dns_txt_item_equal(DnsTxtItem *a, DnsTxtItem *b);
0c9d8f1d4b5018199cb5a9b57580dc1480a7f915Jani Nikula
0c9d8f1d4b5018199cb5a9b57580dc1480a7f915Jani Nikulaextern const struct hash_ops dns_resource_key_hash_ops;
0c9d8f1d4b5018199cb5a9b57580dc1480a7f915Jani Nikula
0c9d8f1d4b5018199cb5a9b57580dc1480a7f915Jani Nikulaconst char* dnssec_algorithm_to_string(int i) _const_;
7b909d7407965c03caaba30daae7aee113627a83Josh Triplettint dnssec_algorithm_from_string(const char *s) _pure_;
7b909d7407965c03caaba30daae7aee113627a83Josh Triplett
7b909d7407965c03caaba30daae7aee113627a83Josh Triplettconst char *dnssec_digest_to_string(int i) _const_;
7b909d7407965c03caaba30daae7aee113627a83Josh Triplettint dnssec_digest_from_string(const char *s) _pure_;
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering