chiark / gitweb /
resolve: add more record types and convert to gperf table
[elogind.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 <inttypes.h>
25
26 #include "macro.h"
27
28 const char *dns_type_to_string(uint16_t type);
29 int dns_type_from_string(const char *s, uint16_t *type);
30
31 /* DNS record types, taken from
32  * http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml.
33  */
34 enum {
35         /* Normal records */
36         DNS_TYPE_A          = 0x01,
37         DNS_TYPE_NS,
38         DNS_TYPE_MD,
39         DNS_TYPE_MF,
40         DNS_TYPE_CNAME,
41         DNS_TYPE_SOA,
42         DNS_TYPE_MB,
43         DNS_TYPE_MG,
44         DNS_TYPE_MR,
45         DNS_TYPE_NULL,
46         DNS_TYPE_WKS,
47         DNS_TYPE_PTR,
48         DNS_TYPE_HINFO,
49         DNS_TYPE_MINFO,
50         DNS_TYPE_MX,
51         DNS_TYPE_TXT,
52         DNS_TYPE_RP,
53         DNS_TYPE_AFSDB,
54         DNS_TYPE_X25,
55         DNS_TYPE_ISDN,
56         DNS_TYPE_RT,
57         DNS_TYPE_NSAP,
58         DNS_TYPE_NSAP_PTR,
59         DNS_TYPE_SIG,
60         DNS_TYPE_KEY,
61         DNS_TYPE_PX,
62         DNS_TYPE_GPOS,
63         DNS_TYPE_AAAA,
64         DNS_TYPE_LOC,
65         DNS_TYPE_NXT,
66         DNS_TYPE_EID,
67         DNS_TYPE_NIMLOC,
68         DNS_TYPE_SRV,
69         DNS_TYPE_ATMA,
70         DNS_TYPE_NAPTR,
71         DNS_TYPE_KX,
72         DNS_TYPE_CERT,
73         DNS_TYPE_A6,
74         DNS_TYPE_DNAME,
75         DNS_TYPE_SINK,
76         DNS_TYPE_OPT,          /* EDNS0 option */
77         DNS_TYPE_APL,
78         DNS_TYPE_DS,
79         DNS_TYPE_SSHFP,
80         DNS_TYPE_IPSECKEY,
81         DNS_TYPE_RRSIG,
82         DNS_TYPE_NSEC,
83         DNS_TYPE_DNSKEY,
84         DNS_TYPE_DHCID,
85         DNS_TYPE_NSEC3,
86         DNS_TYPE_NSEC3PARAM,
87         DNS_TYPE_TLSA,
88
89         DNS_TYPE_HIP        = 0x37,
90         DNS_TYPE_NINFO,
91         DNS_TYPE_RKEY,
92         DNS_TYPE_TALINK,
93         DNS_TYPE_CDS,
94         DNS_TYPE_CDNSKEY,
95
96         DNS_TYPE_SPF        = 0x63,
97         DNS_TYPE_NID,
98         DNS_TYPE_L32,
99         DNS_TYPE_L64,
100         DNS_TYPE_LP,
101         DNS_TYPE_EUI48,
102         DNS_TYPE_EUI64,
103
104         DNS_TYPE_TKEY       = 0xF9,
105         DNS_TYPE_TSIG,
106         DNS_TYPE_IXFR,
107         DNS_TYPE_AXFR,
108         DNS_TYPE_MAILB,
109         DNS_TYPE_MAILA,
110         DNS_TYPE_ANY,
111         DNS_TYPE_URI,
112         DNS_TYPE_CAA,
113         DNS_TYPE_TA         = 0x8000,
114         DNS_TYPE_DLV,
115
116         _DNS_TYPE_MAX,
117         _DNS_TYPE_INVALID = -1
118 };
119
120 assert_cc(DNS_TYPE_SSHFP == 44);
121 assert_cc(DNS_TYPE_TLSA == 52);
122 assert_cc(DNS_TYPE_ANY == 255);