async_dnssd/
dns_consts.rs

1#![cfg_attr(rustfmt, rustfmt_skip)]
2
3/// DNS CLASS
4///
5/// Originally QCLASS was a superset of CLASS; RFC 6895 now defines:
6///
7/// > There are currently two subcategories of DNS CLASSes: normal,
8/// > data-containing classes; and QCLASSes that are only meaningful in
9/// > queries or updates.
10///
11/// ## `ANY`
12///
13/// QTYPE 255 either (rules from RFC 6895):
14///
15/// - doesn't have a mnemonic, violating the existence rule
16/// - has "*" as mnemonic, violating the formatting rule
17/// - has "ANY" as mnemonic, violating the uniquess rule (class ANY)
18///
19/// The QCLASS `ANY` is mostly useless anyway and shouldn't be used in
20/// normal queries.
21#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
22pub struct Class(pub u16);
23
24impl Class {
25	/// CLASS Internet
26	pub const IN: Self = Self(0x0001); // RFC 1035
27	// CS = 0x0002, // "CSNET" (not just obsolete; unassigned in the IANA registry)
28	/// CLASS "Chaos"
29	pub const CH: Self = Self(0x0003); // "Chaos"
30	/// CLASS "Hesiod"
31	pub const HS: Self = Self(0x0004); // "Hesiod"
32	/// QCLASS NONE
33	pub const NONE: Self = Self(0x00fe); // RFC 2136
34	/// QCLASS "*" (ANY)
35	pub const ANY: Self = Self(0x00ff); // RFC 1035
36}
37
38/// DNS (RR)TYPE
39///
40/// Originally QTYPE was a superset of TYPE; RFC 6895 now defines:
41///
42/// > There are three subcategories of RRTYPE numbers: data TYPEs,
43/// > QTYPEs, and Meta-TYPEs.
44///
45/// ## `ANY`
46///
47/// QTYPE 255 ("*") doesn't seem to have an official mnemonic; `ANY` is
48/// used in most tools though.
49///
50/// The `ANY` mnemonic conflicts with the QCLASS `ANY` though...
51#[derive(Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash, Debug)]
52pub struct Type(pub u16);
53
54impl Type {
55	/// a host address
56	pub const A: Self = Self(0x0001); // RFC 1035
57	/// an authoritative name server
58	pub const NS: Self = Self(0x0002); // RFC 1035
59	/// a mail destination (OBSOLETE - use MX)
60	pub const MD: Self = Self(0x0003); // RFC 1035
61	/// a mail forwarder (OBSOLETE - use MX)
62	pub const MF: Self = Self(0x0004); // RFC 1035
63	/// the canonical name for an alias
64	pub const CNAME: Self = Self(0x0005); // RFC 1035
65	/// marks the start of a zone of authority
66	pub const SOA: Self = Self(0x0006); // RFC 1035
67	/// a mailbox domain name (EXPERIMENTAL)
68	pub const MB: Self = Self(0x0007); // RFC 1035
69	/// a mail group member (EXPERIMENTAL)
70	pub const MG: Self = Self(0x0008); // RFC 1035
71	/// a mail rename domain name (EXPERIMENTAL)
72	pub const MR: Self = Self(0x0009); // RFC 1035
73	/// a null RR (EXPERIMENTAL)
74	pub const NULL: Self = Self(0x000a); // RFC 1035
75	/// a well known service description
76	pub const WKS: Self = Self(0x000b); // RFC 1035
77	/// a domain name pointer
78	pub const PTR: Self = Self(0x000c); // RFC 1035
79	/// host information
80	pub const HINFO: Self = Self(0x000d); // RFC 1035
81	/// mailbox or mail list information
82	pub const MINFO: Self = Self(0x000e); // RFC 1035
83	/// mail exchange
84	pub const MX: Self = Self(0x000f); // RFC 1035
85	/// text strings
86	pub const TXT: Self = Self(0x0010); // RFC 1035
87	/// for Responsible Person
88	pub const RP: Self = Self(0x0011); // RFC 1183
89	/// for AFS Data Base location
90	pub const AFSDB: Self = Self(0x0012); // RFC 1183
91	/// for X.25 PSDN address
92	pub const X25: Self = Self(0x0013); // RFC 1183
93	/// for ISDN address
94	pub const ISDN: Self = Self(0x0014); // RFC 1183
95	/// for Route Through
96	pub const RT: Self = Self(0x0015); // RFC 1183
97	/// for NSAP address, NSAP style A record
98	pub const NSAP: Self = Self(0x0016); // RFC 1706
99	/// for domain name pointer, NSAP style
100	pub const NSAP_PTR: Self = Self(0x0017); // RFC 1348
101	/// for security signature
102	pub const SIG: Self = Self(0x0018); // RFC 2535
103	/// for security key
104	pub const KEY: Self = Self(0x0019); // RFC 2535
105	/// X.400 mail mapping information
106	pub const PX: Self = Self(0x001a); // RFC 2163
107	/// Geographical Position
108	pub const GPOS: Self = Self(0x001b); // RFC 1712
109	/// IP6 Address
110	pub const AAAA: Self = Self(0x001c); // RFC 3596
111	/// Location Information
112	pub const LOC: Self = Self(0x001d); // RFC 1876
113	/// Next Domain (OBSOLETE)
114	pub const NXT: Self = Self(0x001e); // RFC 2535
115	/// Endpoint Identifier
116	pub const EID: Self = Self(0x001f); // Michael Patton: http://ana-3.lcs.mit.edu/~jnc/nimrod/dns.txt
117	/// Nimrod Locator
118	pub const NIMLOC: Self = Self(0x0020); // Michael Patton: http://ana-3.lcs.mit.edu/~jnc/nimrod/dns.txt
119	/// Server Selection
120	pub const SRV: Self = Self(0x0021); // RFC 2782
121	/// ATM Address
122	pub const ATMA: Self = Self(0x0022); // http://www.broadband-forum.org/ftp/pub/approved-specs/af-dans-0152.000.pdf
123	/// Naming Authority Pointer
124	pub const NAPTR: Self = Self(0x0023); // RFC 2168
125	/// Key Exchanger
126	pub const KX: Self = Self(0x0024); // RFC 2230
127	/// CERT
128	pub const CERT: Self = Self(0x0025); // RFC 4398
129	/// A6 (OBSOLETE - use AAAA)
130	pub const A6: Self = Self(0x0026); // RFC 2874
131	/// DNAME
132	pub const DNAME: Self = Self(0x0027); // RFC 6672
133	/// SINK
134	pub const SINK: Self = Self(0x0028); // Donald E Eastlake: http://tools.ietf.org/html/draft-eastlake-kitchen-sink
135	/// OPT
136	pub const OPT: Self = Self(0x0029); // RFC 6891
137	/// APL
138	pub const APL: Self = Self(0x002a); // RFC 3123
139	/// Delegation Signer
140	pub const DS: Self = Self(0x002b); // RFC 3658
141	/// SSH Key Fingerprint
142	pub const SSHFP: Self = Self(0x002c); // RFC 4255
143	/// IPSECKEY
144	pub const IPSECKEY: Self = Self(0x002d); // RFC 4025
145	/// RRSIG
146	pub const RRSIG: Self = Self(0x002e); // RFC 4034
147	/// NSEC
148	pub const NSEC: Self = Self(0x002f); // RFC 4034
149	/// DNSKEY
150	pub const DNSKEY: Self = Self(0x0030); // RFC 4034
151	/// DHCID
152	pub const DHCID: Self = Self(0x0031); // RFC 4701
153	/// NSEC3
154	pub const NSEC3: Self = Self(0x0032); // RFC 5155
155	/// NSEC3PARAM
156	pub const NSEC3PARAM: Self = Self(0x0033); // RFC 5155
157	/// TLSA
158	pub const TLSA: Self = Self(0x0034); // RFC 6698
159	/// S/MIME cert association
160	pub const SMIMEA: Self = Self(0x0035); // RFC 8162
161	/// Host Identity Protocol
162	pub const HIP: Self = Self(0x0037); // RFC 8005
163	/// NINFO
164	pub const NINFO: Self = Self(0x0038); // Jim Reid: https://tools.ietf.org/html/draft-reid-dnsext-zs-01
165	/// RKEY
166	pub const RKEY: Self = Self(0x0039); // Jim Reid: https://tools.ietf.org/html/draft-reid-dnsext-rkey-00
167	/// Trust Anchor LINK
168	pub const TALINK: Self = Self(0x003a); // Wouter Wijngaards
169	/// Child DS
170	pub const CDS: Self = Self(0x003b); // RFC 7344
171	/// DNSKEY(s) the Child wants reflected in DS
172	pub const CDNSKEY: Self = Self(0x003c); // RFC 7344
173	/// OpenPGP Key
174	pub const OPENPGPKEY: Self = Self(0x003d); // RFC 7929
175	/// Child-To-Parent Synchronization
176	pub const CSYNC: Self = Self(0x003e); // RFC 7477
177	/// SPF
178	pub const SPF: Self = Self(0x0063); // RFC 7208
179	/// UINFO
180	pub const UINFO: Self = Self(0x0064); // IANA-Reserved
181	/// UID
182	pub const UID: Self = Self(0x0065); // IANA-Reserved
183	/// GID
184	pub const GID: Self = Self(0x0066); // IANA-Reserved
185	/// UNSPEC
186	pub const UNSPEC: Self = Self(0x0067); // IANA-Reserved
187	/// NID
188	pub const NID: Self = Self(0x0068); // RFC 6742
189	/// L32
190	pub const L32: Self = Self(0x0069); // RFC 6742
191	/// L64
192	pub const L64: Self = Self(0x006a); // RFC 6742
193	/// LP
194	pub const LP: Self = Self(0x006b); // RFC 6742
195	/// an EUI-48 address
196	pub const EUI48: Self = Self(0x006c); // RFC 7043
197	/// an EUI-64 address
198	pub const EUI64: Self = Self(0x006d); // RFC 7043
199
200	// 0x0080..0x00ff: meta and qtypes
201	/// Transaction Key
202	pub const TKEY: Self = Self(0x00f9); // RFC 2930
203	/// Transaction Signature
204	pub const TSIG: Self = Self(0x00fa); // RFC 2845
205	/// incremental transfer
206	pub const IXFR: Self = Self(0x00fb); // RFC 1995
207	/// transfer of an entire zone
208	pub const AXFR: Self = Self(0x00fc); // RFC 1035
209	/// mailbox-related RRs (MB, MG or MR)
210	pub const MAILB: Self = Self(0x00fd); // RFC 1035
211	/// mail agent RRs (OBSOLETE - see MX)
212	pub const MAILA: Self = Self(0x00fe); // RFC 1035
213	/// "*", a request for all records the server/cache has available
214	pub const ANY: Self = Self(0x00ff); // RFC 1035
215
216	/// URI
217	pub const URI: Self = Self(0x0100); // RFC 7553
218	/// Certification Authority Restriction
219	pub const CAA: Self = Self(0x0101); // RFC 6844
220	/// Application Visibility and Control
221	pub const AVC: Self = Self(0x0102); // Wolfgang Riedel
222	/// Digital Object Architecture
223	pub const DOA: Self = Self(0x0103); // http://www.iana.org/go/draft-durand-doa-over-dns
224	/// DNSSEC Trust Authorities
225	pub const TA: Self = Self(0x8000); //
226	/// DNSSEC Lookaside Validation
227	pub const DLV: Self = Self(0x8001); // RFC 4431
228}