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