resolved-dns-rr.h revision 85aeaccc10b111e8d16d3879b7c30a219ee6e10a
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering This file is part of systemd.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Copyright 2014 Lennart Poettering
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is free software; you can redistribute it and/or modify it
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering under the terms of the GNU Lesser General Public License as published by
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering the Free Software Foundation; either version 2.1 of the License, or
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering (at your option) any later version.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering systemd is distributed in the hope that it will be useful, but
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering WITHOUT ANY WARRANTY; without even the implied warranty of
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering Lesser General Public License for more details.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering You should have received a copy of the GNU Lesser General Public License
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering along with systemd; If not, see <http://www.gnu.org/licenses/>.
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringtypedef struct DnsResourceKey DnsResourceKey;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poetteringtypedef struct DnsResourceRecord DnsResourceRecord;
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/* DNSKEY RR flags */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering#define DNSKEY_FLAG_SEP (UINT16_C(1) << 0)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering#define DNSKEY_FLAG_REVOKE (UINT16_C(1) << 7)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering#define DNSKEY_FLAG_ZONE_KEY (UINT16_C(1) << 8)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/* mDNS RR flags */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering#define MDNS_RR_CACHE_FLUSH (UINT16_C(1) << 15)
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/* DNSSEC algorithm identifiers, see
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * http://tools.ietf.org/html/rfc4034#appendix-A.1 and
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * https://www.iana.org/assignments/dns-sec-alg-numbers/dns-sec-alg-numbers.xhtml */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering DNSSEC_ALGORITHM_RSASHA256 = 8, /* RFC 5702 */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering DNSSEC_ALGORITHM_RSASHA512 = 10, /* RFC 5702 */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering DNSSEC_ALGORITHM_ECC_GOST = 12, /* RFC 5933 */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering DNSSEC_ALGORITHM_ECDSAP256SHA256 = 13, /* RFC 6605 */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering DNSSEC_ALGORITHM_ECDSAP384SHA384 = 14, /* RFC 6605 */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/* DNSSEC digest identifiers, see
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml */
a51c10485af349eb15faa4d1a63b9818bcf3e589Lennart Poettering DNSSEC_DIGEST_GOST_R_34_11_94 = 3, /* RFC 5933 */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering/* DNSSEC NSEC3 hash algorithms, see
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering * https://www.iana.org/assignments/dnssec-nsec3-parameters/dnssec-nsec3-parameters.xhtml */
8a516214c4412e8a40544bd725a6d499a30cbbbfLennart Poettering char *_name; /* don't access directy, use DNS_RESOURCE_KEY_NAME()! */
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering/* Creates a temporary resource key. This is only useful to quickly
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering * look up something, without allocating a full DnsResourceKey object
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering * for it. Note that it is not OK to take references to this kind of
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering * resource key object. */
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering ._name = (char*) n, \
1716f6dcf54d4c181c2e2558e3d5414f54c8d9caLennart Poettering usec_t expiry; /* RRSIG signature expiry */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* https://tools.ietf.org/html/rfc1876 */
623a4c97b9175f95c4b1c6fc34e36c56f1e4ddbfLennart Poettering /* https://tools.ietf.org/html/rfc4255#section-3.1 */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* http://tools.ietf.org/html/rfc4034#section-2.1 */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* http://tools.ietf.org/html/rfc4034#section-3.1 */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* https://tools.ietf.org/html/rfc4034#section-4.1 */
74b2466e14a1961bf3ac0e8a60cfaceec705bd59Lennart Poettering /* https://tools.ietf.org/html/rfc4034#section-5.1 */
19b50b5ba7ee8c1bfb330377309e4bab7a7531d8Lennart Poetteringstatic inline const char* DNS_RESOURCE_KEY_NAME(const DnsResourceKey *key) {
af49ca27ffd790d78dbbb465b978266dfd5c93daLennart Poettering return (char*) key + sizeof(DnsResourceKey);
19b50b5ba7ee8c1bfb330377309e4bab7a7531d8Lennart Poetteringstatic inline const void* DNS_RESOURCE_RECORD_RDATA(DnsResourceRecord *rr) {
aaa297d4e5401fd4466632555432774863457f1dLennart Poettering assert(rr->wire_format_rdata_offset <= rr->wire_format_size);
aaa297d4e5401fd4466632555432774863457f1dLennart Poettering return (uint8_t*) rr->wire_format + rr->wire_format_rdata_offset;
aaa297d4e5401fd4466632555432774863457f1dLennart Poetteringstatic inline size_t DNS_RESOURCE_RECORD_RDATA_SIZE(DnsResourceRecord *rr) {
aaa297d4e5401fd4466632555432774863457f1dLennart Poettering assert(rr->wire_format_rdata_offset <= rr->wire_format_size);
aaa297d4e5401fd4466632555432774863457f1dLennart Poettering return rr->wire_format_size - rr->wire_format_rdata_offset;
aaa297d4e5401fd4466632555432774863457f1dLennart PoetteringDnsResourceKey* dns_resource_key_new(uint16_t class, uint16_t type, const char *name);
aaa297d4e5401fd4466632555432774863457f1dLennart PoetteringDnsResourceKey* dns_resource_key_new_redirect(const DnsResourceKey *key, const DnsResourceRecord *cname);
aaa297d4e5401fd4466632555432774863457f1dLennart Poetteringint dns_resource_key_new_append_suffix(DnsResourceKey **ret, DnsResourceKey *key, char *name);
aaa297d4e5401fd4466632555432774863457f1dLennart PoetteringDnsResourceKey* dns_resource_key_new_consume(uint16_t class, uint16_t type, char *name);
aaa297d4e5401fd4466632555432774863457f1dLennart PoetteringDnsResourceKey* dns_resource_key_ref(DnsResourceKey *key);
aaa297d4e5401fd4466632555432774863457f1dLennart PoetteringDnsResourceKey* dns_resource_key_unref(DnsResourceKey *key);
aaa297d4e5401fd4466632555432774863457f1dLennart Poetteringbool dns_resource_key_is_address(const DnsResourceKey *key);
aaa297d4e5401fd4466632555432774863457f1dLennart Poetteringint dns_resource_key_equal(const DnsResourceKey *a, const DnsResourceKey *b);
aaa297d4e5401fd4466632555432774863457f1dLennart Poetteringint dns_resource_key_match_rr(const DnsResourceKey *key, DnsResourceRecord *rr, const char *search_domain);
aaa297d4e5401fd4466632555432774863457f1dLennart Poetteringint dns_resource_key_match_cname_or_dname(const DnsResourceKey *key, const DnsResourceKey *cname, const char *search_domain);
aaa297d4e5401fd4466632555432774863457f1dLennart Poetteringint dns_resource_key_match_soa(const DnsResourceKey *key, const DnsResourceKey *soa);
aaa297d4e5401fd4466632555432774863457f1dLennart Poetteringint dns_resource_key_to_string(const DnsResourceKey *key, char **ret);
ad6c04756115809d615dede330213d73edf732a8Lennart PoetteringDEFINE_TRIVIAL_CLEANUP_FUNC(DnsResourceKey*, dns_resource_key_unref);
2e1bab34bdb1a5e849060afa8361b865ce39f87fLennart Poetteringstatic inline bool dns_key_is_shared(const DnsResourceKey *key) {
ad6c04756115809d615dede330213d73edf732a8Lennart PoetteringDnsResourceRecord* dns_resource_record_new(DnsResourceKey *key);
ad6c04756115809d615dede330213d73edf732a8Lennart PoetteringDnsResourceRecord* dns_resource_record_new_full(uint16_t class, uint16_t type, const char *name);
ad6c04756115809d615dede330213d73edf732a8Lennart PoetteringDnsResourceRecord* dns_resource_record_ref(DnsResourceRecord *rr);
ad6c04756115809d615dede330213d73edf732a8Lennart PoetteringDnsResourceRecord* dns_resource_record_unref(DnsResourceRecord *rr);
ad6c04756115809d615dede330213d73edf732a8Lennart Poetteringint dns_resource_record_new_reverse(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *name);
ad6c04756115809d615dede330213d73edf732a8Lennart Poetteringint dns_resource_record_new_address(DnsResourceRecord **ret, int family, const union in_addr_union *address, const char *name);
ad6c04756115809d615dede330213d73edf732a8Lennart Poetteringint dns_resource_record_equal(const DnsResourceRecord *a, const DnsResourceRecord *b);
ad6c04756115809d615dede330213d73edf732a8Lennart Poetteringconst char* dns_resource_record_to_string(DnsResourceRecord *rr);
ad6c04756115809d615dede330213d73edf732a8Lennart PoetteringDEFINE_TRIVIAL_CLEANUP_FUNC(DnsResourceRecord*, dns_resource_record_unref);
2e1bab34bdb1a5e849060afa8361b865ce39f87fLennart Poetteringint dns_resource_record_to_wire_format(DnsResourceRecord *rr, bool canonical);
ad6c04756115809d615dede330213d73edf732a8Lennart PoetteringDnsTxtItem *dns_txt_item_free_all(DnsTxtItem *i);
ad6c04756115809d615dede330213d73edf732a8Lennart Poetteringbool dns_txt_item_equal(DnsTxtItem *a, DnsTxtItem *b);
2e1bab34bdb1a5e849060afa8361b865ce39f87fLennart Poetteringextern const struct hash_ops dns_resource_key_hash_ops;
2e1bab34bdb1a5e849060afa8361b865ce39f87fLennart Poetteringint dnssec_algorithm_to_string_alloc(int i, char **ret);
2e1bab34bdb1a5e849060afa8361b865ce39f87fLennart Poetteringint dnssec_algorithm_from_string(const char *s) _pure_;
2e1bab34bdb1a5e849060afa8361b865ce39f87fLennart Poetteringint dnssec_digest_to_string_alloc(int i, char **ret);