]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/resolve/dns-type.h
Replace DNS_RESOURCE_KEY_NAME with a version which always returns "." for root
[thirdparty/systemd.git] / src / resolve / dns-type.h
CommitLineData
7263f724
ZJS
1/***
2 This file is part of systemd.
3
4 Copyright 2014 Zbigniew Jędrzejewski-Szmek
5
6 systemd is free software; you can redistribute it and/or modify it
7 under the terms of the GNU Lesser General Public License as published by
8 the Free Software Foundation; either version 2.1 of the License, or
9 (at your option) any later version.
10
11 systemd is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public License
17 along with systemd; If not, see <http://www.gnu.org/licenses/>.
18***/
19
20#pragma once
21
7263f724
ZJS
22#include "macro.h"
23
7263f724
ZJS
24/* DNS record types, taken from
25 * http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml.
26 */
27enum {
28 /* Normal records */
29 DNS_TYPE_A = 0x01,
30 DNS_TYPE_NS,
31 DNS_TYPE_MD,
32 DNS_TYPE_MF,
33 DNS_TYPE_CNAME,
34 DNS_TYPE_SOA,
35 DNS_TYPE_MB,
36 DNS_TYPE_MG,
37 DNS_TYPE_MR,
38 DNS_TYPE_NULL,
39 DNS_TYPE_WKS,
40 DNS_TYPE_PTR,
41 DNS_TYPE_HINFO,
42 DNS_TYPE_MINFO,
43 DNS_TYPE_MX,
44 DNS_TYPE_TXT,
45 DNS_TYPE_RP,
46 DNS_TYPE_AFSDB,
47 DNS_TYPE_X25,
48 DNS_TYPE_ISDN,
49 DNS_TYPE_RT,
50 DNS_TYPE_NSAP,
51 DNS_TYPE_NSAP_PTR,
52 DNS_TYPE_SIG,
53 DNS_TYPE_KEY,
54 DNS_TYPE_PX,
55 DNS_TYPE_GPOS,
56 DNS_TYPE_AAAA,
57 DNS_TYPE_LOC,
58 DNS_TYPE_NXT,
59 DNS_TYPE_EID,
60 DNS_TYPE_NIMLOC,
61 DNS_TYPE_SRV,
62 DNS_TYPE_ATMA,
63 DNS_TYPE_NAPTR,
64 DNS_TYPE_KX,
65 DNS_TYPE_CERT,
66 DNS_TYPE_A6,
67 DNS_TYPE_DNAME,
68 DNS_TYPE_SINK,
69 DNS_TYPE_OPT, /* EDNS0 option */
70 DNS_TYPE_APL,
71 DNS_TYPE_DS,
72 DNS_TYPE_SSHFP,
73 DNS_TYPE_IPSECKEY,
74 DNS_TYPE_RRSIG,
75 DNS_TYPE_NSEC,
76 DNS_TYPE_DNSKEY,
77 DNS_TYPE_DHCID,
78 DNS_TYPE_NSEC3,
79 DNS_TYPE_NSEC3PARAM,
80 DNS_TYPE_TLSA,
81
82 DNS_TYPE_HIP = 0x37,
83 DNS_TYPE_NINFO,
84 DNS_TYPE_RKEY,
85 DNS_TYPE_TALINK,
86 DNS_TYPE_CDS,
87 DNS_TYPE_CDNSKEY,
d93a16b8 88 DNS_TYPE_OPENPGPKEY,
7263f724
ZJS
89
90 DNS_TYPE_SPF = 0x63,
91 DNS_TYPE_NID,
92 DNS_TYPE_L32,
93 DNS_TYPE_L64,
94 DNS_TYPE_LP,
95 DNS_TYPE_EUI48,
96 DNS_TYPE_EUI64,
97
98 DNS_TYPE_TKEY = 0xF9,
99 DNS_TYPE_TSIG,
100 DNS_TYPE_IXFR,
101 DNS_TYPE_AXFR,
102 DNS_TYPE_MAILB,
103 DNS_TYPE_MAILA,
104 DNS_TYPE_ANY,
105 DNS_TYPE_URI,
106 DNS_TYPE_CAA,
107 DNS_TYPE_TA = 0x8000,
108 DNS_TYPE_DLV,
109
110 _DNS_TYPE_MAX,
111 _DNS_TYPE_INVALID = -1
112};
113
114assert_cc(DNS_TYPE_SSHFP == 44);
115assert_cc(DNS_TYPE_TLSA == 52);
116assert_cc(DNS_TYPE_ANY == 255);
4b548ef3
LP
117
118/* DNS record classes, see RFC 1035 */
119enum {
120 DNS_CLASS_IN = 0x01,
121 DNS_CLASS_ANY = 0xFF,
222148b6 122
4b548ef3
LP
123 _DNS_CLASS_MAX,
124 _DNS_CLASS_INVALID = -1
125};
126
222148b6
LP
127bool dns_type_is_pseudo(uint16_t type);
128bool dns_type_is_valid_query(uint16_t type);
129bool dns_type_is_valid_rr(uint16_t type);
d3c7e913 130bool dns_type_may_redirect(uint16_t type);
91adc4db 131bool dns_type_is_dnssec(uint16_t type);
d0129ddb 132bool dns_type_is_obsolete(uint16_t type);
e8233bce 133bool dns_type_may_wildcard(uint16_t type);
588c53d0 134bool dns_type_apex_only(uint16_t type);
41815a4a 135bool dns_type_needs_authentication(uint16_t type);
d07b43a1 136int dns_type_to_af(uint16_t t);
222148b6 137
4b548ef3
LP
138bool dns_class_is_pseudo(uint16_t class);
139bool dns_class_is_valid_rr(uint16_t class);
140
869b3b67 141/* TYPE?? follows http://tools.ietf.org/html/rfc3597#section-5 */
222148b6
LP
142const char *dns_type_to_string(int type);
143int dns_type_from_string(const char *s);
144
4b548ef3
LP
145const char *dns_class_to_string(uint16_t type);
146int dns_class_from_string(const char *name);
cfb90da3
ZJS
147
148/* https://tools.ietf.org/html/draft-ietf-dane-protocol-23#section-7.2 */
149const char *tlsa_cert_usage_to_string(uint8_t cert_usage);
150
151/* https://tools.ietf.org/html/draft-ietf-dane-protocol-23#section-7.3 */
152const char *tlsa_selector_to_string(uint8_t selector);
153
154/* https://tools.ietf.org/html/draft-ietf-dane-protocol-23#section-7.4 */
155const char *tlsa_matching_type_to_string(uint8_t selector);
718af59e
ZJS
156
157/* https://tools.ietf.org/html/rfc6844#section-5.1 */
158#define CAA_FLAG_CRITICAL (1u << 7)