Merge branch 'opaque-ports'
[strongswan.git] / src / libstrongswan / resolver / rr.h
1 /*
2 * Copyright (C) 2012 Reto Guadagnini
3 * Hochschule fuer Technik Rapperswil
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the
7 * Free Software Foundation; either version 2 of the License, or (at your
8 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 */
15
16 /**
17 * @defgroup rr rr
18 * @{ @ingroup resolver
19 */
20
21 #ifndef RR_H_
22 #define RR_H_
23
24 typedef struct rr_t rr_t;
25 typedef enum rr_type_t rr_type_t;
26 typedef enum rr_class_t rr_class_t;
27
28 #include <library.h>
29
30 /**
31 * Resource Record types.
32 *
33 * According to www.iana.org/assignments/dns-parameters (version 2012-03-13).
34 */
35 enum rr_type_t {
36 /** a host address */
37 RR_TYPE_A = 1,
38 /** an authoritative name server */
39 RR_TYPE_NS = 2,
40 //** a mail destination (OBSOLETE - use MX */
41 RR_TYPE_MD = 3,
42 /** a mail forwarder (OBSOLETE - use MX) */
43 RR_TYPE_MF = 4,
44 /** the canonical name for an alias */
45 RR_TYPE_CNAME = 5,
46 /** marks the start of a zone of authority */
47 RR_TYPE_SOA = 6,
48 /** a mailbox domain name (EXPERIMENTAL) */
49 RR_TYPE_MB = 7,
50 /** a mail group member (EXPERIMENTAL) */
51 RR_TYPE_MG = 8,
52 /** a mail rename domain name (EXPERIMENTAL) */
53 RR_TYPE_MR = 9,
54 /** a null RR (EXPERIMENTAL) */
55 RR_TYPE_NULL = 10,
56 /** a well known service description */
57 RR_TYPE_WKS = 11,
58 /** a domain name pointer */
59 RR_TYPE_PTR = 12,
60 /** host information */
61 RR_TYPE_HINFO = 13,
62 /** mailbox or mail list information */
63 RR_TYPE_MINFO = 14,
64 /** mail exchange */
65 RR_TYPE_MX = 15,
66 /** text strings */
67 RR_TYPE_TXT = 16,
68 /** for Responsible Person */
69 RR_TYPE_RP = 17,
70 /** for AFS Data Base location */
71 RR_TYPE_AFSDB = 18,
72 /** for X.25 PSDN address */
73 RR_TYPE_X25 = 19,
74 /** for ISDN address */
75 RR_TYPE_ISDN = 20,
76 /** for Route Through */
77 RR_TYPE_RT = 21,
78 /** for NSAP address, NSAP style A record */
79 RR_TYPE_NSAP = 22,
80 /** for domain name pointer, NSAP style */
81 RR_TYPE_NSAP_PTR = 23,
82 /** for security signature */
83 RR_TYPE_SIG = 24,
84 /** for security key */
85 RR_TYPE_KEY = 25,
86 /** X.400 mail mapping information */
87 RR_TYPE_PX = 26,
88 /** Geographical Position */
89 RR_TYPE_GPOS = 27,
90 /** ipv6 address */
91 RR_TYPE_AAAA = 28,
92 /** Location Information */
93 RR_TYPE_LOC = 29,
94 /** Next Domain (OBSOLETE) */
95 RR_TYPE_NXT = 30,
96 /** Endpoint Identifier */
97 RR_TYPE_EID = 31,
98 /** Nimrod Locator */
99 RR_TYPE_NIMLOC = 32,
100 /** Server Selection */
101 RR_TYPE_SRV = 33,
102 /** ATM Address */
103 RR_TYPE_ATMA = 34,
104 /** Naming Authority Pointer */
105 RR_TYPE_NAPTR = 35,
106 /** Key Exchanger */
107 RR_TYPE_KX = 36,
108 /** CERT */
109 RR_TYPE_CERT = 37,
110 /** A6 (OBSOLETE - use AAAA) */
111 RR_TYPE_A6 = 38,
112 /** DNAME */
113 RR_TYPE_DNAME = 39,
114 /** SINK */
115 RR_TYPE_SINK = 40,
116 /** OPT */
117 RR_TYPE_OPT = 41,
118 /** APL */
119 RR_TYPE_APL = 42,
120 /** Delegation Signer */
121 RR_TYPE_DS = 43,
122 /** SSH Key Fingerprint */
123 RR_TYPE_SSHFP = 44,
124 /** IPSECKEY */
125 RR_TYPE_IPSECKEY = 45,
126 /** RRSIG */
127 RR_TYPE_RRSIG = 46,
128 /** NSEC */
129 RR_TYPE_NSEC = 47,
130 /** DNSKEY */
131 RR_TYPE_DNSKEY = 48,
132 /** DHCID */
133 RR_TYPE_DHCID = 49,
134 /** NSEC3 */
135 RR_TYPE_NSEC3 = 50,
136 /** NSEC3PARAM */
137 RR_TYPE_NSEC3PARAM = 51,
138
139 /** Unassigned 52-54 */
140
141 /** Host Identity Protocol */
142 RR_TYPE_HIP = 55,
143 /** NINFO */
144 RR_TYPE_NINFO = 56,
145 /** RKEY */
146 RR_TYPE_RKEY = 57,
147 /** Trust Anchor LINK */
148 RR_TYPE_TALINK = 58,
149 /** Child DS */
150 RR_TYPE_CDS = 59,
151
152 /** Unassigned 60-98 */
153
154 /** SPF */
155 RR_TYPE_SPF = 99,
156 /** UINFO */
157 RR_TYPE_UINFO = 100,
158 /** UID */
159 RR_TYPE_UID = 101,
160 /** GID */
161 RR_TYPE_GID = 102,
162 /** UNSPEC */
163 RR_TYPE_UNSPEC = 103,
164
165 /** Unassigned 104-248 */
166
167 /** Transaction Key */
168 RR_TYPE_TKEY = 249,
169 /** Transaction Signature */
170 RR_TYPE_TSIG = 250,
171 /** incremental transfer */
172 RR_TYPE_IXFR = 251,
173 /** transfer of an entire zone */
174 RR_TYPE_AXFR = 252,
175 /** mailbox-related RRs (MB, MG or MR) */
176 RR_TYPE_MAILB = 253,
177 /** mail agent RRs (OBSOLETE - see MX) */
178 RR_TYPE_MAILA = 254,
179 /** A request for all records */
180 RR_TYPE_ANY = 255,
181 /** URI */
182 RR_TYPE_URI = 256,
183 /** Certification Authority Authorization */
184 RR_TYPE_CAA = 257,
185
186 /** Unassigned 258-32767 */
187
188 /** DNSSEC Trust Authorities */
189 RR_TYPE_TA = 32768,
190 /** DNSSEC Lookaside Validation */
191 RR_TYPE_DLV = 32769,
192
193 /** Unassigned 32770-65279 */
194
195 /** Private use 65280-65534 */
196
197 /** Reserved 65535 */
198 };
199
200
201 /**
202 * Resource Record CLASSes
203 */
204 enum rr_class_t {
205 /** Internet */
206 RR_CLASS_IN = 1,
207 /** Chaos */
208 RR_CLASS_CH = 3,
209 /** Hesiod */
210 RR_CLASS_HS = 4,
211 /** further CLASSes: http://wwwiana.org/assignments/dns-parameters */
212 };
213
214
215 /**
216 * A DNS Resource Record.
217 *
218 * Represents a Resource Record of the Domain Name System
219 * as defined in RFC 1035.
220 *
221 */
222 struct rr_t {
223
224 /**
225 * Get the NAME of the owner of this RR.
226 *
227 * @return owner name as string
228 */
229 char *(*get_name)(rr_t *this);
230
231 /**
232 * Get the type of this RR.
233 *
234 * @return RR type
235 */
236 rr_type_t (*get_type)(rr_t *this);
237
238 /**
239 * Get the class of this RR.
240 *
241 * @return RR class
242 */
243 rr_class_t (*get_class)(rr_t *this);
244
245 /**
246 * Get the Time to Live (TTL) of this RR.
247 *
248 * @return Time to Live
249 */
250 uint32_t (*get_ttl)(rr_t *this);
251
252 /**
253 * Get the content of the RDATA field as chunk.
254 *
255 * The data pointed by the chunk is still owned by the RR.
256 * Clone it if needed.
257 *
258 * @return RDATA field as chunk
259 */
260 chunk_t (*get_rdata)(rr_t *this);
261
262 /**
263 * Destroy the Resource Record.
264 */
265 void (*destroy) (rr_t *this);
266 };
267
268 #endif /** RR_H_ @}*/