7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek/***
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek This file is part of systemd.
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek Copyright 2014 Zbigniew Jędrzejewski-Szmek
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek systemd is free software; you can redistribute it and/or modify it
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek under the terms of the GNU Lesser General Public License as published by
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek the Free Software Foundation; either version 2.1 of the License, or
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek (at your option) any later version.
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek systemd is distributed in the hope that it will be useful, but
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek WITHOUT ANY WARRANTY; without even the implied warranty of
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek Lesser General Public License for more details.
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek You should have received a copy of the GNU Lesser General Public License
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek along with systemd; If not, see <http://www.gnu.org/licenses/>.
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek***/
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek#pragma once
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek#include "macro.h"
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek/* DNS record types, taken from
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek * http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml.
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek */
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmekenum {
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek /* Normal records */
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_A = 0x01,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_NS,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_MD,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_MF,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_CNAME,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_SOA,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_MB,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_MG,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_MR,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_NULL,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_WKS,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_PTR,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_HINFO,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_MINFO,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_MX,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_TXT,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_RP,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_AFSDB,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_X25,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_ISDN,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_RT,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_NSAP,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_NSAP_PTR,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_SIG,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_KEY,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_PX,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_GPOS,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_AAAA,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_LOC,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_NXT,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_EID,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_NIMLOC,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_SRV,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_ATMA,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_NAPTR,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_KX,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_CERT,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_A6,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_DNAME,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_SINK,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_OPT, /* EDNS0 option */
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_APL,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_DS,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_SSHFP,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_IPSECKEY,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_RRSIG,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_NSEC,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_DNSKEY,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_DHCID,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_NSEC3,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_NSEC3PARAM,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_TLSA,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_HIP = 0x37,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_NINFO,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_RKEY,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_TALINK,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_CDS,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_CDNSKEY,
d93a16b81f8baa0e6a16310b210f225129347322Zbigniew Jędrzejewski-Szmek DNS_TYPE_OPENPGPKEY,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_SPF = 0x63,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_NID,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_L32,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_L64,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_LP,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_EUI48,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_EUI64,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_TKEY = 0xF9,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_TSIG,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_IXFR,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_AXFR,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_MAILB,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_MAILA,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_ANY,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_URI,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_CAA,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_TA = 0x8000,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek DNS_TYPE_DLV,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek _DNS_TYPE_MAX,
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek _DNS_TYPE_INVALID = -1
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek};
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmek
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmekassert_cc(DNS_TYPE_SSHFP == 44);
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmekassert_cc(DNS_TYPE_TLSA == 52);
7263f72499e962b3fd54cdb7c79d49ca72121edeZbigniew Jędrzejewski-Szmekassert_cc(DNS_TYPE_ANY == 255);
4b548ef382007e40bd8fb3affdce9f843d0d63acLennart Poettering
4b548ef382007e40bd8fb3affdce9f843d0d63acLennart Poettering/* DNS record classes, see RFC 1035 */
4b548ef382007e40bd8fb3affdce9f843d0d63acLennart Poetteringenum {
4b548ef382007e40bd8fb3affdce9f843d0d63acLennart Poettering DNS_CLASS_IN = 0x01,
4b548ef382007e40bd8fb3affdce9f843d0d63acLennart Poettering DNS_CLASS_ANY = 0xFF,
222148b66d1abf5b05c9d803472a9368331dae53Lennart Poettering
4b548ef382007e40bd8fb3affdce9f843d0d63acLennart Poettering _DNS_CLASS_MAX,
4b548ef382007e40bd8fb3affdce9f843d0d63acLennart Poettering _DNS_CLASS_INVALID = -1
4b548ef382007e40bd8fb3affdce9f843d0d63acLennart Poettering};
4b548ef382007e40bd8fb3affdce9f843d0d63acLennart Poettering
222148b66d1abf5b05c9d803472a9368331dae53Lennart Poetteringbool dns_type_is_pseudo(uint16_t type);
222148b66d1abf5b05c9d803472a9368331dae53Lennart Poetteringbool dns_type_is_valid_query(uint16_t type);
222148b66d1abf5b05c9d803472a9368331dae53Lennart Poetteringbool dns_type_is_valid_rr(uint16_t type);
d3c7e9139c50bec5096925a09b9c1341942c72c4Lennart Poetteringbool dns_type_may_redirect(uint16_t type);
91adc4db33f69606aabd332813a5d7d5751c859fLennart Poetteringbool dns_type_is_dnssec(uint16_t type);
d0129ddb9fbb07bed7c8ea51b8031f824bf506fbLennart Poetteringbool dns_type_is_obsolete(uint16_t type);
e8233bce196a14fa3ebde2969594fcdfa4404e19Lennart Poetteringbool dns_type_may_wildcard(uint16_t type);
588c53d0441ee33b617582429434b47492f51744Lennart Poetteringbool dns_type_apex_only(uint16_t type);
d07b43a18e2234e8abebc1cd4d93bfd78ab62001Lennart Poetteringint dns_type_to_af(uint16_t t);
222148b66d1abf5b05c9d803472a9368331dae53Lennart Poettering
4b548ef382007e40bd8fb3affdce9f843d0d63acLennart Poetteringbool dns_class_is_pseudo(uint16_t class);
4b548ef382007e40bd8fb3affdce9f843d0d63acLennart Poetteringbool dns_class_is_valid_rr(uint16_t class);
4b548ef382007e40bd8fb3affdce9f843d0d63acLennart Poettering
869b3b67e392f1ea6219570ccf6aa3bf224d0391Zbigniew Jędrzejewski-Szmek/* TYPE?? follows http://tools.ietf.org/html/rfc3597#section-5 */
222148b66d1abf5b05c9d803472a9368331dae53Lennart Poetteringconst char *dns_type_to_string(int type);
222148b66d1abf5b05c9d803472a9368331dae53Lennart Poetteringint dns_type_from_string(const char *s);
222148b66d1abf5b05c9d803472a9368331dae53Lennart Poettering
4b548ef382007e40bd8fb3affdce9f843d0d63acLennart Poetteringconst char *dns_class_to_string(uint16_t type);
4b548ef382007e40bd8fb3affdce9f843d0d63acLennart Poetteringint dns_class_from_string(const char *name);
cfb90da3dc579e2f9408bc0e04a71c82dd28ac71Zbigniew Jędrzejewski-Szmek
cfb90da3dc579e2f9408bc0e04a71c82dd28ac71Zbigniew Jędrzejewski-Szmek/* https://tools.ietf.org/html/draft-ietf-dane-protocol-23#section-7.2 */
cfb90da3dc579e2f9408bc0e04a71c82dd28ac71Zbigniew Jędrzejewski-Szmekconst char *tlsa_cert_usage_to_string(uint8_t cert_usage);
cfb90da3dc579e2f9408bc0e04a71c82dd28ac71Zbigniew Jędrzejewski-Szmek
cfb90da3dc579e2f9408bc0e04a71c82dd28ac71Zbigniew Jędrzejewski-Szmek/* https://tools.ietf.org/html/draft-ietf-dane-protocol-23#section-7.3 */
cfb90da3dc579e2f9408bc0e04a71c82dd28ac71Zbigniew Jędrzejewski-Szmekconst char *tlsa_selector_to_string(uint8_t selector);
cfb90da3dc579e2f9408bc0e04a71c82dd28ac71Zbigniew Jędrzejewski-Szmek
cfb90da3dc579e2f9408bc0e04a71c82dd28ac71Zbigniew Jędrzejewski-Szmek/* https://tools.ietf.org/html/draft-ietf-dane-protocol-23#section-7.4 */
cfb90da3dc579e2f9408bc0e04a71c82dd28ac71Zbigniew Jędrzejewski-Szmekconst char *tlsa_matching_type_to_string(uint8_t selector);