domain/base/iana/
rtype.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
//! Resource Record (RR) TYPEs

//------------ Rtype ---------------------------------------------------------

int_enum! {
    /// Resource Record Types.
    ///
    /// Each resource records has a 16 bit type value indicating what kind of
    /// information is represented by the record. Normal query includes the
    /// type of record information is requested for. A few aditional types,
    /// called query types, are defined as well and can only be used in
    /// questions. This type represents both these types.
    ///
    /// The currently assigned values are maintained in an [IANA registry].
    /// This type is complete as of 2019-01-28.
    ///
    /// [IANA registry]: http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4
    ///
    /// In order to avoid confusion over capitalization, the mnemonics are
    /// treated as single acronyms and therefore all variant names are spelled
    /// with an initial capital letter in accordance with the Rust naming
    /// guidelines.
    =>
    Rtype, u16;

    /// A host address.
    (A => 1, b"A")

    /// An authoritative name server.
    (NS => 2, b"NS")

    /// A mail destination.
    ///
    /// (Obsolete – use MX)
    (MD => 3, b"MD")

    /// A mail forwarder.
    ///
    /// (Obsolete – use MX)
    (MF => 4, b"MF")

    /// The canonical name for an alias
    (CNAME => 5, b"CNAME")

    /// Marks the start of a zone of authority.
    (SOA => 6, b"SOA")

    /// A mailbox domain name.
    ///
    /// (Experimental.)
    (MB =>  7, b"MB")

    /// A mail group member
    ///
    /// (Experimental.)
    (MG => 8, b"MG")

    /// A mail rename domain name.
    ///
    /// (Experimental.)
    (MR => 9, b"MR")

    /// A null resource record.
    ///
    /// (Experimental.)
    (NULL =>  10, b"NULL")

    /// A well known service description.
    (WKS => 11, b"WKS")

    /// A domain name pointer.
    (PTR => 12, b"PTR")

    /// Host information.
    (HINFO => 13, b"HINFO")

    /// Mailbox or mail list information.
    (MINFO => 14, b"MINFO")

    /// Mail exchange.
    (MX => 15, b"MX")

    /// Text strings.
    (TXT => 16, b"TXT")

    /// For Responsible Person.
    ///
    /// See RFC 1183
    (RP => 17, b"RP")

    /// For AFS Data Base location.
    ///
    /// See RFC 1183 and RFC 5864.
    (AFSDB => 18, b"AFSDB")

    /// For X.25 PSDN address.
    ///
    /// See RFC 1183.
    (X25 => 19, b"X25")

    /// For ISDN address.
    ///
    /// See RFC 1183.
    (ISDN => 20, b"ISDN")

    /// For Route Through.
    ///
    /// See RFC 1183
    (RT => 21, b"RT")

    /// For SNAP address, NSAP style A record.
    ///
    /// See RFC 1706.
    (NSAP => 22, b"NSAP")

    /// For domain name pointer, NSAP style.
    ///
    /// See RFC 1348, RFC 1637, RFC 1706.
    (NSAPPTR => 23, b"NSAPPTR")

    /// For security signature.
    (SIG => 24, b"SIG")

    /// For security key.
    (KEY => 25, b"KEY")

    /// X.400 mail mapping information.
    ///
    /// See RFC 2163.
    (PX => 26, b"PX")

    /// Geographical position.
    ///
    /// See RFC 1712
    (GPOS => 27, b"GPOS")

    /// IPv6 address.
    ///
    /// See RFC 3596.
    (AAAA =>  28, b"AAAA")

    /// Location information.
    ///
    /// See RFC 1876.
    (LOC => 29, b"LOC")

    /// Next domain.
    ///
    /// (Obsolete.)
    ///
    /// See RFC 3755 and RFC 2535.
    (NXT => 30, b"NXT")

    /// Endpoint identifier.
    (EID => 31, b"EID")

    /// Nimrod locator.
    (NIMLOC => 32, b"NIMLOC")

    /// Server selection.
    ///
    /// See RFC 2782.
    (SRV => 33, b"SRV")

    /// ATM address.
    (ATMA => 34, b"ATMA")

    /// Naming authority pointer.
    ///
    /// See RFC 2915, RFC 2168, and RFC 3403.
    (NAPTR => 35, b"NAPTR")

    /// Key exchanger.
    ///
    /// See RFC 2230.
    (KX => 36, b"KX")

    /// CERT
    ///
    /// See RFC 4398.
    (CERT => 37, b"CERT")

    /// A6.
    ///
    /// (Obsolete – use AAAA.)
    ///
    /// See RFC 3226, RFC 2874, and RFC 6563.
    (A6 => 38, b"A6")

    /// DNAME.
    ///
    /// See RFC 6672.
    (DNAME => 39, b"DNAME")

    /// SINK.
    (SINK => 40, b"SINK")

    /// OPT.
    ///
    /// See RFC 6891 and RFC 3225.
    (OPT => 41, b"OPT")

    /// APL.
    ///
    /// See RFC 3123.
    (APL => 42, b"APL")

    /// Delegation signer.
    ///
    /// See RFC 4034 and RFC 3658.
    (DS => 43, b"DS")

    /// SSH key fingerprint.
    ///
    /// See RFC 4255.
    (SSHFP => 44, b"SSHFP")

    /// IPSECKEY
    ///
    /// See RFC 4255.
    (IPSECKEY => 45, b"IPSECKEY")

    /// RRSIG.
    ///
    /// See RFC 4034 and RFC 3755.
    (RRSIG => 46, b"RRSIG")

    /// NSEC.
    ///
    /// See RFC 4034 and RFC 3755.
    (NSEC => 47, b"NSEC")

    /// DNSKEY.
    ///
    /// See RFC 4034 and RFC 3755.
    (DNSKEY => 48, b"DNSKEY")

    /// DHCID.
    ///
    /// See RFC 4701.
    (DHCID => 49, b"DHCID")

    /// NSEC3
    ///
    /// See RFC 5155.
    (NSEC3 => 50, b"NSEC3")

    /// NSEC3PARAM.
    ///
    /// See RFC 5155.
    (NSEC3PARAM => 51, b"NSEC3PARAM")

    /// TLSA.
    ///
    /// See RFC 6698.
    (TLSA => 52, b"TLSA")

    /// S/MIME cert association.
    ///
    /// See draft-ietf-dane-smime.
    (SMIMEA => 53, b"SMIMEA")

    /// Host Identity Protocol.
    ///
    /// See RFC 5205.
    (HIP => 55, b"HIP")

    /// NINFO.
    (NINFO => 56, b"NINFO")

    /// RKEY.
    (RKEY => 57, b"RKEY")

    /// Trust Anchor Link
    (TALINK => 58, b"TALINK")

    /// Child DS.
    ///
    /// See RFC 7344.
    (CDS => 59, b"CDS")

    /// DNSKEY(s) the child wants reflected in DS.
    ///
    /// See RFC 7344.
    (CDNSKEY => 60, b"CDNSKEY")

    /// OpenPGP key.
    ///
    /// See draft-ietf-dane-openpgpkey.
    (OPENPGPKEY => 61, b"OPENPGPKEY")

    /// Child-to-parent synchronization.
    ///
    /// See RFC 7477.
    (CSYNC => 62, b"CSYNC")

    /// Message digest for DNS zone.
    ///
    /// See draft-wessels-dns-zone-digest.
    (ZONEMD => 63, b"ZONEMD")

    /// General Purpose Service Endpoints.
    ///
    /// See draft-ietf-dnsop-svcb-httpssvc
    (SVCB => 64, b"SVCB")

    /// HTTPS Specific Service Endpoints.
    ///
    /// See draft-ietf-dnsop-svcb-httpssvc
    (HTTPS => 65, b"HTTPS")

    /// SPF.
    ///
    /// RFC 7208.
    (SPF => 99, b"SPF")

    /// UINFO.
    ///
    /// IANA-Reserved.
    (UINFO => 100, b"UINFO")

    /// UID.
    ///
    /// IANA-Reserved.
    (UID => 101, b"UID")

    /// GID.
    ///
    /// IANA-Reserved.
    (GID => 102, b"GID")

    /// UNSPEC.
    ///
    /// IANA-Reserved.
    (UNSPEC => 103, b"UNSPEC")

    /// NID.
    ///
    /// See RFC 6742.
    (NID => 104, b"NID")

    /// L32.
    ///
    /// See RFC 6742.
    (L32 => 105, b"L32")

    /// L64.
    ///
    /// See RFC 6742.
    (L64 => 106, b"L64")

    /// LP.
    ///
    /// See RFC 6742.
    (LP => 107, b"LP")

    /// An EUI-48 address.
    ///
    /// See RFC 7043.
    (EUI48 => 108, b"EUI48")

    /// An EUI-64 address.
    ///
    /// See RFC 7043.
    (EUI64 => 109, b"EUI64")

    /// NXNAME.
    ///
    /// IANA-Reserved.
    (NXNAME => 128, b"NXNAME")

    /// Transaction key.
    ///
    /// See RFC 2930.
    (TKEY => 249, b"TKEY")

    /// Transaction signature.
    ///
    /// See RFC 2845.
    (TSIG => 250, b"TSIG")

    /// Incremental transfer.
    ///
    /// See RFC 1995.
    (IXFR => 251, b"IXFR")

    /// Transfer of entire zone.
    ///
    /// See RFC 1035 and RFC 5936.
    (AXFR => 252, b"AXFR")

    /// Mailbox-related RRs (MB, MG, or MR).
    (MAILB => 253, b"MAILB")

    /// Mail agent RRS.
    ///
    /// (Obsolete – see MX.)
    (MAILA => 254, b"MAILA")

    /// A request for all records the server/cache has available.
    ///
    /// See RFC 1035 and RFC 6895.
    (ANY => 255, b"ANY")

    /// URI.
    ///
    /// See RFC 7553.
    (URI => 256, b"URI")

    /// Certification Authority Restriction.
    ///
    /// See RFC 6844.
    (CAA => 257, b"CAA")

    /// Application visibility and control.
    (AVC => 258, b"AVC")

    /// Digital Object Architecture
    ///
    /// See draft-durand-doa-over-dns.
    (DOA => 259, b"DOA")

    /// DNSSEC trust authorities.
    (TA => 32768, b"TA")

    /// DNSSEC lookaside validation.
    ///
    /// See RFC 4431
    (DLV => 32769, b"DLV")
}

int_enum_str_with_prefix!(Rtype, "TYPE", b"TYPE", u16, "unknown record type");

impl Rtype {
    /// Returns true if this record type is a type used for Glue records.
    ///
    /// See the definition of "glue" in [RFC
    /// 9499](https://datatracker.ietf.org/doc/rfc9499/) Section 7 "Zones".
    pub fn is_glue(&self) -> bool {
        matches!(*self, Rtype::A | Rtype::AAAA)
    }
}