domain/base/iana/
rtype.rs

1//! Resource Record (RR) TYPEs
2
3//------------ Rtype ---------------------------------------------------------
4
5int_enum! {
6    /// Resource Record Types.
7    ///
8    /// Each resource records has a 16 bit type value indicating what kind of
9    /// information is represented by the record. Normal query includes the
10    /// type of record information is requested for. A few aditional types,
11    /// called query types, are defined as well and can only be used in
12    /// questions. This type represents both these types.
13    ///
14    /// The currently assigned values are maintained in an [IANA registry].
15    /// This type is complete as of 2019-01-28.
16    ///
17    /// [IANA registry]: http://www.iana.org/assignments/dns-parameters/dns-parameters.xhtml#dns-parameters-4
18    ///
19    /// In order to avoid confusion over capitalization, the mnemonics are
20    /// treated as single acronyms and therefore all variant names are spelled
21    /// with an initial capital letter in accordance with the Rust naming
22    /// guidelines.
23    =>
24    Rtype, u16;
25
26    /// A host address.
27    (A => 1, "A")
28
29    /// An authoritative name server.
30    (NS => 2, "NS")
31
32    /// A mail destination.
33    ///
34    /// (Obsolete – use MX)
35    (MD => 3, "MD")
36
37    /// A mail forwarder.
38    ///
39    /// (Obsolete – use MX)
40    (MF => 4, "MF")
41
42    /// The canonical name for an alias
43    (CNAME => 5, "CNAME")
44
45    /// Marks the start of a zone of authority.
46    (SOA => 6, "SOA")
47
48    /// A mailbox domain name.
49    ///
50    /// (Experimental.)
51    (MB =>  7, "MB")
52
53    /// A mail group member
54    ///
55    /// (Experimental.)
56    (MG => 8, "MG")
57
58    /// A mail rename domain name.
59    ///
60    /// (Experimental.)
61    (MR => 9, "MR")
62
63    /// A null resource record.
64    ///
65    /// (Experimental.)
66    (NULL =>  10, "NULL")
67
68    /// A well known service description.
69    (WKS => 11, "WKS")
70
71    /// A domain name pointer.
72    (PTR => 12, "PTR")
73
74    /// Host information.
75    (HINFO => 13, "HINFO")
76
77    /// Mailbox or mail list information.
78    (MINFO => 14, "MINFO")
79
80    /// Mail exchange.
81    (MX => 15, "MX")
82
83    /// Text strings.
84    (TXT => 16, "TXT")
85
86    /// For Responsible Person.
87    ///
88    /// See RFC 1183
89    (RP => 17, "RP")
90
91    /// For AFS Data Base location.
92    ///
93    /// See RFC 1183 and RFC 5864.
94    (AFSDB => 18, "AFSDB")
95
96    /// For X.25 PSDN address.
97    ///
98    /// See RFC 1183.
99    (X25 => 19, "X25")
100
101    /// For ISDN address.
102    ///
103    /// See RFC 1183.
104    (ISDN => 20, "ISDN")
105
106    /// For Route Through.
107    ///
108    /// See RFC 1183
109    (RT => 21, "RT")
110
111    /// For SNAP address, NSAP style A record.
112    ///
113    /// See RFC 1706.
114    (NSAP => 22, "NSAP")
115
116    /// For domain name pointer, NSAP style.
117    ///
118    /// See RFC 1348, RFC 1637, RFC 1706.
119    (NSAPPTR => 23, "NSAPPTR")
120
121    /// For security signature.
122    (SIG => 24, "SIG")
123
124    /// For security key.
125    (KEY => 25, "KEY")
126
127    /// X.400 mail mapping information.
128    ///
129    /// See RFC 2163.
130    (PX => 26, "PX")
131
132    /// Geographical position.
133    ///
134    /// See RFC 1712
135    (GPOS => 27, "GPOS")
136
137    /// IPv6 address.
138    ///
139    /// See RFC 3596.
140    (AAAA =>  28, "AAAA")
141
142    /// Location information.
143    ///
144    /// See RFC 1876.
145    (LOC => 29, "LOC")
146
147    /// Next domain.
148    ///
149    /// (Obsolete.)
150    ///
151    /// See RFC 3755 and RFC 2535.
152    (NXT => 30, "NXT")
153
154    /// Endpoint identifier.
155    (EID => 31, "EID")
156
157    /// Nimrod locator.
158    (NIMLOC => 32, "NIMLOC")
159
160    /// Server selection.
161    ///
162    /// See RFC 2782.
163    (SRV => 33, "SRV")
164
165    /// ATM address.
166    (ATMA => 34, "ATMA")
167
168    /// Naming authority pointer.
169    ///
170    /// See RFC 2915, RFC 2168, and RFC 3403.
171    (NAPTR => 35, "NAPTR")
172
173    /// Key exchanger.
174    ///
175    /// See RFC 2230.
176    (KX => 36, "KX")
177
178    /// CERT
179    ///
180    /// See RFC 4398.
181    (CERT => 37, "CERT")
182
183    /// A6.
184    ///
185    /// (Obsolete – use AAAA.)
186    ///
187    /// See RFC 3226, RFC 2874, and RFC 6563.
188    (A6 => 38, "A6")
189
190    /// DNAME.
191    ///
192    /// See RFC 6672.
193    (DNAME => 39, "DNAME")
194
195    /// SINK.
196    (SINK => 40, "SINK")
197
198    /// OPT.
199    ///
200    /// See RFC 6891 and RFC 3225.
201    (OPT => 41, "OPT")
202
203    /// APL.
204    ///
205    /// See RFC 3123.
206    (APL => 42, "APL")
207
208    /// Delegation signer.
209    ///
210    /// See RFC 4034 and RFC 3658.
211    (DS => 43, "DS")
212
213    /// SSH key fingerprint.
214    ///
215    /// See RFC 4255.
216    (SSHFP => 44, "SSHFP")
217
218    /// IPSECKEY
219    ///
220    /// See RFC 4255.
221    (IPSECKEY => 45, "IPSECKEY")
222
223    /// RRSIG.
224    ///
225    /// See RFC 4034 and RFC 3755.
226    (RRSIG => 46, "RRSIG")
227
228    /// NSEC.
229    ///
230    /// See RFC 4034 and RFC 3755.
231    (NSEC => 47, "NSEC")
232
233    /// DNSKEY.
234    ///
235    /// See RFC 4034 and RFC 3755.
236    (DNSKEY => 48, "DNSKEY")
237
238    /// DHCID.
239    ///
240    /// See RFC 4701.
241    (DHCID => 49, "DHCID")
242
243    /// NSEC3
244    ///
245    /// See RFC 5155.
246    (NSEC3 => 50, "NSEC3")
247
248    /// NSEC3PARAM.
249    ///
250    /// See RFC 5155.
251    (NSEC3PARAM => 51, "NSEC3PARAM")
252
253    /// TLSA.
254    ///
255    /// See RFC 6698.
256    (TLSA => 52, "TLSA")
257
258    /// S/MIME cert association.
259    ///
260    /// See draft-ietf-dane-smime.
261    (SMIMEA => 53, "SMIMEA")
262
263    /// Host Identity Protocol.
264    ///
265    /// See RFC 5205.
266    (HIP => 55, "HIP")
267
268    /// NINFO.
269    (NINFO => 56, "NINFO")
270
271    /// RKEY.
272    (RKEY => 57, "RKEY")
273
274    /// Trust Anchor Link
275    (TALINK => 58, "TALINK")
276
277    /// Child DS.
278    ///
279    /// See RFC 7344.
280    (CDS => 59, "CDS")
281
282    /// DNSKEY(s) the child wants reflected in DS.
283    ///
284    /// See RFC 7344.
285    (CDNSKEY => 60, "CDNSKEY")
286
287    /// OpenPGP key.
288    ///
289    /// See draft-ietf-dane-openpgpkey.
290    (OPENPGPKEY => 61, "OPENPGPKEY")
291
292    /// Child-to-parent synchronization.
293    ///
294    /// See RFC 7477.
295    (CSYNC => 62, "CSYNC")
296
297    /// Message digest for DNS zone.
298    ///
299    /// See draft-wessels-dns-zone-digest.
300    (ZONEMD => 63, "ZONEMD")
301
302    /// General Purpose Service Endpoints.
303    ///
304    /// See draft-ietf-dnsop-svcb-httpssvc
305    (SVCB => 64, "SVCB")
306
307    /// HTTPS Specific Service Endpoints.
308    ///
309    /// See draft-ietf-dnsop-svcb-httpssvc
310    (HTTPS => 65, "HTTPS")
311
312    /// SPF.
313    ///
314    /// RFC 7208.
315    (SPF => 99, "SPF")
316
317    /// UINFO.
318    ///
319    /// IANA-Reserved.
320    (UINFO => 100, "UINFO")
321
322    /// UID.
323    ///
324    /// IANA-Reserved.
325    (UID => 101, "UID")
326
327    /// GID.
328    ///
329    /// IANA-Reserved.
330    (GID => 102, "GID")
331
332    /// UNSPEC.
333    ///
334    /// IANA-Reserved.
335    (UNSPEC => 103, "UNSPEC")
336
337    /// NID.
338    ///
339    /// See RFC 6742.
340    (NID => 104, "NID")
341
342    /// L32.
343    ///
344    /// See RFC 6742.
345    (L32 => 105, "L32")
346
347    /// L64.
348    ///
349    /// See RFC 6742.
350    (L64 => 106, "L64")
351
352    /// LP.
353    ///
354    /// See RFC 6742.
355    (LP => 107, "LP")
356
357    /// An EUI-48 address.
358    ///
359    /// See RFC 7043.
360    (EUI48 => 108, "EUI48")
361
362    /// An EUI-64 address.
363    ///
364    /// See RFC 7043.
365    (EUI64 => 109, "EUI64")
366
367    /// NXNAME.
368    ///
369    /// IANA-Reserved.
370    (NXNAME => 128, "NXNAME")
371
372    /// Transaction key.
373    ///
374    /// See RFC 2930.
375    (TKEY => 249, "TKEY")
376
377    /// Transaction signature.
378    ///
379    /// See RFC 2845.
380    (TSIG => 250, "TSIG")
381
382    /// Incremental transfer.
383    ///
384    /// See RFC 1995.
385    (IXFR => 251, "IXFR")
386
387    /// Transfer of entire zone.
388    ///
389    /// See RFC 1035 and RFC 5936.
390    (AXFR => 252, "AXFR")
391
392    /// Mailbox-related RRs (MB, MG, or MR).
393    (MAILB => 253, "MAILB")
394
395    /// Mail agent RRS.
396    ///
397    /// (Obsolete – see MX.)
398    (MAILA => 254, "MAILA")
399
400    /// A request for all records the server/cache has available.
401    ///
402    /// See RFC 1035 and RFC 6895.
403    (ANY => 255, "ANY")
404
405    /// URI.
406    ///
407    /// See RFC 7553.
408    (URI => 256, "URI")
409
410    /// Certification Authority Restriction.
411    ///
412    /// See RFC 6844.
413    (CAA => 257, "CAA")
414
415    /// Application visibility and control.
416    (AVC => 258, "AVC")
417
418    /// Digital Object Architecture
419    ///
420    /// See draft-durand-doa-over-dns.
421    (DOA => 259, "DOA")
422
423    /// DNSSEC trust authorities.
424    (TA => 32768, "TA")
425
426    /// DNSSEC lookaside validation.
427    ///
428    /// See RFC 4431
429    (DLV => 32769, "DLV")
430}
431
432int_enum_str_with_prefix!(Rtype, "TYPE", b"TYPE", u16, "unknown record type");
433int_enum_zonefile_fmt_with_prefix!(Rtype, "TYPE");
434
435impl Rtype {
436    /// Returns true if this record type is a type used for Glue records.
437    ///
438    /// See the definition of "glue" in [RFC
439    /// 9499](https://datatracker.ietf.org/doc/rfc9499/) Section 7 "Zones".
440    pub fn is_glue(&self) -> bool {
441        matches!(*self, Rtype::A | Rtype::AAAA)
442    }
443}