]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/resolve/dns-type.h
tree-wide: beautify remaining copyright statements
[thirdparty/systemd.git] / src / resolve / dns-type.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 Copyright © 2014 Zbigniew Jędrzejewski-Szmek
6 ***/
7
8 #include "macro.h"
9
10 /* DNS record types, taken from
11 * http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml.
12 */
13 enum {
14 /* Normal records */
15 DNS_TYPE_A = 0x01,
16 DNS_TYPE_NS,
17 DNS_TYPE_MD,
18 DNS_TYPE_MF,
19 DNS_TYPE_CNAME,
20 DNS_TYPE_SOA,
21 DNS_TYPE_MB,
22 DNS_TYPE_MG,
23 DNS_TYPE_MR,
24 DNS_TYPE_NULL,
25 DNS_TYPE_WKS,
26 DNS_TYPE_PTR,
27 DNS_TYPE_HINFO,
28 DNS_TYPE_MINFO,
29 DNS_TYPE_MX,
30 DNS_TYPE_TXT,
31 DNS_TYPE_RP,
32 DNS_TYPE_AFSDB,
33 DNS_TYPE_X25,
34 DNS_TYPE_ISDN,
35 DNS_TYPE_RT,
36 DNS_TYPE_NSAP,
37 DNS_TYPE_NSAP_PTR,
38 DNS_TYPE_SIG,
39 DNS_TYPE_KEY,
40 DNS_TYPE_PX,
41 DNS_TYPE_GPOS,
42 DNS_TYPE_AAAA,
43 DNS_TYPE_LOC,
44 DNS_TYPE_NXT,
45 DNS_TYPE_EID,
46 DNS_TYPE_NIMLOC,
47 DNS_TYPE_SRV,
48 DNS_TYPE_ATMA,
49 DNS_TYPE_NAPTR,
50 DNS_TYPE_KX,
51 DNS_TYPE_CERT,
52 DNS_TYPE_A6,
53 DNS_TYPE_DNAME,
54 DNS_TYPE_SINK,
55 DNS_TYPE_OPT, /* EDNS0 option */
56 DNS_TYPE_APL,
57 DNS_TYPE_DS,
58 DNS_TYPE_SSHFP,
59 DNS_TYPE_IPSECKEY,
60 DNS_TYPE_RRSIG,
61 DNS_TYPE_NSEC,
62 DNS_TYPE_DNSKEY,
63 DNS_TYPE_DHCID,
64 DNS_TYPE_NSEC3,
65 DNS_TYPE_NSEC3PARAM,
66 DNS_TYPE_TLSA,
67
68 DNS_TYPE_HIP = 0x37,
69 DNS_TYPE_NINFO,
70 DNS_TYPE_RKEY,
71 DNS_TYPE_TALINK,
72 DNS_TYPE_CDS,
73 DNS_TYPE_CDNSKEY,
74 DNS_TYPE_OPENPGPKEY,
75
76 DNS_TYPE_SPF = 0x63,
77 DNS_TYPE_NID,
78 DNS_TYPE_L32,
79 DNS_TYPE_L64,
80 DNS_TYPE_LP,
81 DNS_TYPE_EUI48,
82 DNS_TYPE_EUI64,
83
84 DNS_TYPE_TKEY = 0xF9,
85 DNS_TYPE_TSIG,
86 DNS_TYPE_IXFR,
87 DNS_TYPE_AXFR,
88 DNS_TYPE_MAILB,
89 DNS_TYPE_MAILA,
90 DNS_TYPE_ANY,
91 DNS_TYPE_URI,
92 DNS_TYPE_CAA,
93 DNS_TYPE_TA = 0x8000,
94 DNS_TYPE_DLV,
95
96 _DNS_TYPE_MAX,
97 _DNS_TYPE_INVALID = -1
98 };
99
100 assert_cc(DNS_TYPE_SSHFP == 44);
101 assert_cc(DNS_TYPE_TLSA == 52);
102 assert_cc(DNS_TYPE_ANY == 255);
103
104 /* DNS record classes, see RFC 1035 */
105 enum {
106 DNS_CLASS_IN = 0x01,
107 DNS_CLASS_ANY = 0xFF,
108
109 _DNS_CLASS_MAX,
110 _DNS_CLASS_INVALID = -1
111 };
112
113 #define _DNS_CLASS_STRING_MAX (sizeof "CLASS" + DECIMAL_STR_MAX(uint16_t))
114 #define _DNS_TYPE_STRING_MAX (sizeof "CLASS" + DECIMAL_STR_MAX(uint16_t))
115
116 bool dns_type_is_pseudo(uint16_t type);
117 bool dns_type_is_valid_query(uint16_t type);
118 bool dns_type_is_valid_rr(uint16_t type);
119 bool dns_type_may_redirect(uint16_t type);
120 bool dns_type_is_dnssec(uint16_t type);
121 bool dns_type_is_obsolete(uint16_t type);
122 bool dns_type_may_wildcard(uint16_t type);
123 bool dns_type_apex_only(uint16_t type);
124 bool dns_type_needs_authentication(uint16_t type);
125 bool dns_type_is_zone_transer(uint16_t type);
126 int dns_type_to_af(uint16_t type);
127
128 bool dns_class_is_pseudo(uint16_t class);
129 bool dns_class_is_valid_rr(uint16_t class);
130
131 /* TYPE?? follows http://tools.ietf.org/html/rfc3597#section-5 */
132 const char *dns_type_to_string(int type);
133 int dns_type_from_string(const char *s);
134
135 const char *dns_class_to_string(uint16_t class);
136 int dns_class_from_string(const char *name);
137
138 /* https://tools.ietf.org/html/draft-ietf-dane-protocol-23#section-7.2 */
139 const char *tlsa_cert_usage_to_string(uint8_t cert_usage);
140
141 /* https://tools.ietf.org/html/draft-ietf-dane-protocol-23#section-7.3 */
142 const char *tlsa_selector_to_string(uint8_t selector);
143
144 /* https://tools.ietf.org/html/draft-ietf-dane-protocol-23#section-7.4 */
145 const char *tlsa_matching_type_to_string(uint8_t selector);
146
147 /* https://tools.ietf.org/html/rfc6844#section-5.1 */
148 #define CAA_FLAG_CRITICAL (1u << 7)