resolved-dns-rr.h revision 7b50eb2efa122200e39646c19a29abab302f7d24
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering This file is part of systemd.
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poettering Copyright 2014 Lennart 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 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 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/>.
4f5dd3943bef8a04be7e3b838b822bb9a7ad6cb3Lennart Poetteringtypedef struct DnsResourceKey DnsResourceKey;
3731acf1acfb4a6eb68374a5b137f3b368f63381Lennart Poetteringtypedef struct DnsResourceRecord DnsResourceRecord;
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/* mDNS RR flags */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering#define MDNS_RR_CACHE_FLUSH (UINT16_C(1) << 15)
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 Poettering DNSSEC_ALGORITHM_RSASHA256 = 8, /* RFC 5702 */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering DNSSEC_ALGORITHM_RSASHA512 = 10, /* RFC 5702 */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering/* DNSSEC digest identifiers, see
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering * https://www.iana.org/assignments/ds-rr-types/ds-rr-types.xhtml */
39883f622f392d8579f4428fc5a789a102efbb10Lennart Poettering char *_name; /* don't access directy, use DNS_RESOURCE_KEY_NAME()! */
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 ._name = (char*) n, \
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering /* https://tools.ietf.org/html/rfc4255#section-3.1 */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering /* http://tools.ietf.org/html/rfc4034#section-2.1 */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering /* http://tools.ietf.org/html/rfc4034#section-3.1 */
0f4ba83c397e807939a4eb0b2cbd04ad4ab548ccLennart Poettering /* https://tools.ietf.org/html/rfc4034#section-4.1 */
c7fdf44d08e1217d40dc092fb90a65978a0f541fLennart Poetteringstatic inline const char* DNS_RESOURCE_KEY_NAME(const DnsResourceKey *key) {
3cadce7d33e263ec7a6a83c00c11144930258b22Thomas Bächler return (char*) key + sizeof(DnsResourceKey);
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 Triplettstatic inline bool dns_key_is_shared(const DnsResourceKey *key) {
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 Triplettint dns_resource_record_to_wire_format(DnsResourceRecord *rr, bool canonical);
7b909d7407965c03caaba30daae7aee113627a83Josh TriplettDnsTxtItem *dns_txt_item_free_all(DnsTxtItem *i);
0c9d8f1d4b5018199cb5a9b57580dc1480a7f915Jani Nikulabool dns_txt_item_equal(DnsTxtItem *a, DnsTxtItem *b);
0c9d8f1d4b5018199cb5a9b57580dc1480a7f915Jani Nikulaextern const struct hash_ops dns_resource_key_hash_ops;
0c9d8f1d4b5018199cb5a9b57580dc1480a7f915Jani Nikulaconst char* dnssec_algorithm_to_string(int i) _const_;
7b909d7407965c03caaba30daae7aee113627a83Josh Triplettint dnssec_algorithm_from_string(const char *s) _pure_;
7b909d7407965c03caaba30daae7aee113627a83Josh Triplettconst char *dnssec_digest_to_string(int i) _const_;
7b909d7407965c03caaba30daae7aee113627a83Josh Triplettint dnssec_digest_from_string(const char *s) _pure_;