]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/resolve/dns-type.h
Merge pull request #2306 from walyong/exec_v01
[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
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
115 assert_cc(DNS_TYPE_SSHFP == 44);
116 assert_cc(DNS_TYPE_TLSA == 52);
117 assert_cc(DNS_TYPE_ANY == 255);
118
119 /* DNS record classes, see RFC 1035 */
120 enum {
121 DNS_CLASS_IN = 0x01,
122 DNS_CLASS_ANY = 0xFF,
123
124 _DNS_CLASS_MAX,
125 _DNS_CLASS_INVALID = -1
126 };
127
128 bool dns_type_is_pseudo(uint16_t type);
129 bool dns_type_is_valid_query(uint16_t type);
130 bool dns_type_is_valid_rr(uint16_t type);
131 bool dns_type_may_redirect(uint16_t type);
132 bool dns_type_is_dnssec(uint16_t type);
133 bool dns_type_is_obsolete(uint16_t type);
134 bool dns_type_may_wildcard(uint16_t type);
135 bool dns_type_apex_only(uint16_t type);
136 int dns_type_to_af(uint16_t t);
137
138 bool dns_class_is_pseudo(uint16_t class);
139 bool dns_class_is_valid_rr(uint16_t class);
140
141 const char *dns_type_to_string(int type);
142 int dns_type_from_string(const char *s);
143
144 const char *dns_class_to_string(uint16_t type);
145 int dns_class_from_string(const char *name);