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