simple_dns/dns/rdata/
mod.rs

1#![allow(non_camel_case_types)]
2//! Contains RData implementations
3
4use crate::CharacterString;
5
6use super::{Name, WireFormat};
7use core::fmt::Debug;
8use std::{collections::HashMap, convert::TryInto};
9
10mod macros;
11
12mod a;
13pub use a::A;
14
15mod aaaa;
16pub use aaaa::AAAA;
17
18mod afsdb;
19pub use afsdb::AFSDB;
20
21mod caa;
22pub use caa::CAA;
23
24mod hinfo;
25pub use hinfo::HINFO;
26
27mod isdn;
28pub use isdn::ISDN;
29
30mod loc;
31pub use loc::LOC;
32
33mod minfo;
34pub use minfo::MINFO;
35
36mod mx;
37pub use mx::MX;
38
39mod naptr;
40pub use naptr::NAPTR;
41
42mod nsap;
43pub use nsap::NSAP;
44
45mod null;
46pub use null::NULL;
47
48mod opt;
49pub use opt::{OPTCode, OPT};
50
51mod route_through;
52pub use route_through::RouteThrough;
53
54mod rp;
55pub use rp::RP;
56
57mod soa;
58pub use soa::SOA;
59
60mod srv;
61pub use srv::SRV;
62
63mod txt;
64pub use txt::TXT;
65
66mod wks;
67pub use wks::WKS;
68
69mod svcb;
70pub use svcb::SVCB;
71
72pub(crate) trait RR {
73    const TYPE_CODE: u16;
74}
75
76macros::rr_wrapper! {
77    #[doc = "Authoritative name server, [RFC 1035](https://tools.ietf.org/html/rfc1035)"]
78    NS:Name = 2
79}
80
81macros::rr_wrapper! {
82    #[doc = "Mail destination (Obsolete - use MX), [RFC 1035](https://tools.ietf.org/html/rfc1035)"]
83    MD:Name = 3
84}
85
86macros::rr_wrapper! {
87    #[doc = "Mail forwarder (Obsolete - use MX), [RFC 1035](https://tools.ietf.org/html/rfc1035)"]
88    MF:Name = 4
89}
90
91macros::rr_wrapper! {
92    #[doc = "Canonical name for an alias, [RFC 1035](https://tools.ietf.org/html/rfc1035)"]
93    CNAME:Name = 5
94}
95
96macros::rr_wrapper! {
97    #[doc = "Mailbox domain name (EXPERIMENTAL), [RFC 1035](https://tools.ietf.org/html/rfc1035)"]
98    MB:Name = 7
99}
100
101macros::rr_wrapper! {
102    #[doc = "Mail group member (EXPERIMENTAL), [RFC 1035](https://tools.ietf.org/html/rfc1035)"]
103    MG: Name = 8
104}
105
106macros::rr_wrapper! {
107    #[doc = "Mail rename domain name (EXPERIMENTAL), [RFC 1035](https://tools.ietf.org/html/rfc1035)"]
108    MR: Name = 9
109}
110
111macros::rr_wrapper! {
112    #[doc="Domain name pointer, [RFC 1035](https://tools.ietf.org/html/rfc1035)"]
113    PTR:Name = 12
114}
115
116macros::rr_wrapper! {
117    #[doc = "X.25 address, [RFC 1183](https://datatracker.ietf.org/doc/html/rfc1183#section-3.1)"]
118    X25:CharacterString = 19
119}
120
121macros::rr_wrapper! {
122    #[doc = "PTR for NSAP records, [RFC 1348](https://datatracker.ietf.org/doc/rfc1348/)"]
123    NSAP_PTR:Name = 23
124}
125
126macros::rr_wrapper! {
127    #[doc = "HTTPS RR type is a [SVCB]-compatible RR type, specific to the \"https\" and \"http\" schemes. \
128        [RFC 9460](https://datatracker.ietf.org/doc/html/rfc9460#name-using-service-bindings-with)."]
129    HTTPS: SVCB = 65
130}
131
132macros::rdata_enum! {
133    A,
134    AAAA,
135    NS<'a>,
136    MD<'a>,
137    CNAME<'a>,
138    MB<'a>,
139    MG<'a>,
140    MR<'a>,
141    PTR<'a>,
142    MF<'a>,
143    HINFO<'a>,
144    MINFO<'a>,
145    MX<'a>,
146    TXT<'a>,
147    SOA<'a>,
148    WKS<'a>,
149    SRV<'a>,
150    RP<'a>,
151    AFSDB<'a>,
152    ISDN<'a>,
153    RouteThrough<'a>,
154    NAPTR<'a>,
155    NSAP,
156    NSAP_PTR<'a>,
157    LOC,
158    OPT<'a>,
159    CAA<'a>,
160    SVCB<'a>,
161    HTTPS<'a>,
162}