]> git.ipfire.org Git - thirdparty/systemd.git/blame - src/resolve/dns-type.h
resolve-host: propagate error properly
[thirdparty/systemd.git] / src / resolve / dns-type.h
CommitLineData
7263f724
ZJS
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
7263f724
ZJS
24#include "macro.h"
25
7263f724
ZJS
26/* DNS record types, taken from
27 * http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml.
28 */
29enum {
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
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
222148b6
LP
128bool dns_type_is_pseudo(uint16_t type);
129bool dns_type_is_valid_query(uint16_t type);
130bool dns_type_is_valid_rr(uint16_t type);
131
4b548ef3
LP
132bool dns_class_is_pseudo(uint16_t class);
133bool dns_class_is_valid_rr(uint16_t class);
134
222148b6
LP
135const char *dns_type_to_string(int type);
136int dns_type_from_string(const char *s);
137
4b548ef3
LP
138const char *dns_class_to_string(uint16_t type);
139int dns_class_from_string(const char *name);