resolved-dns-rr.h revision 4b548ef382007e40bd8fb3affdce9f843d0d63ac
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#pragma once
/***
This file is part of systemd.
Copyright 2014 Lennart Poettering
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include "bitmap.h"
#include "dns-type.h"
#include "hashmap.h"
#include "in-addr-util.h"
#include "list.h"
typedef struct DnsResourceKey DnsResourceKey;
typedef struct DnsResourceRecord DnsResourceRecord;
typedef struct DnsTxtItem DnsTxtItem;
/* DNSKEY RR flags */
/* mDNS RR flags */
/* DNSSEC algorithm identifiers, see
* http://tools.ietf.org/html/rfc4034#appendix-A.1 and
enum {
DNSSEC_ALGORITHM_INDIRECT = 252,
};
/* DNSSEC digest identifiers, see
enum {
DNSSEC_DIGEST_SHA1 = 1,
DNSSEC_DIGEST_SHA256 = 2,
};
struct DnsResourceKey {
unsigned n_ref;
char *_name; /* don't access directy, use DNS_RESOURCE_KEY_NAME()! */
bool cache_flush:1;
};
/* Creates a temporary resource key. This is only useful to quickly
* look up something, without allocating a full DnsResourceKey object
* for it. Note that it is not OK to take references to this kind of
* resource key object. */
#define DNS_RESOURCE_KEY_CONST(c, t, n) \
((DnsResourceKey) { \
.n_ref = (unsigned) -1, \
.class = c, \
.type = t, \
._name = (char*) n, \
})
struct DnsTxtItem {
};
struct DnsResourceRecord {
unsigned n_ref;
bool unparseable:1;
bool wire_format_canonical:1;
void *wire_format;
union {
struct {
void *data;
struct {
char *name;
} srv;
struct {
char *name;
struct {
char *cpu;
char *os;
} hinfo;
struct {
struct {
} a;
struct {
} aaaa;
struct {
char *mname;
char *rname;
} soa;
struct {
char *exchange;
} mx;
struct {
} loc;
struct {
void *digest;
} ds;
/* https://tools.ietf.org/html/rfc4255#section-3.1 */
struct {
void *fingerprint;
} sshfp;
/* http://tools.ietf.org/html/rfc4034#section-2.1 */
struct {
void* key;
} dnskey;
/* http://tools.ietf.org/html/rfc4034#section-3.1 */
struct {
char *signer;
void *signature;
} rrsig;
/* https://tools.ietf.org/html/rfc4034#section-4.1 */
struct {
char *next_domain_name;
} nsec;
struct {
void *salt;
void *next_hashed_name;
} nsec3;
};
};
if (_unlikely_(!key))
return NULL;
return (char*) key + sizeof(DnsResourceKey);
}
DnsResourceKey* dns_resource_key_new_redirect(const DnsResourceKey *key, const DnsResourceRecord *cname);
int dns_resource_key_match_rr(const DnsResourceKey *key, DnsResourceRecord *rr, const char *search_domain);
int dns_resource_key_match_cname_or_dname(const DnsResourceKey *key, const DnsResourceKey *cname, const char *search_domain);
}
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);
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_;