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