dns_message_parser/rr/
mod.rs

1//! This module contains struct for [resource records] handling.
2//!
3//! The [`RR`] enum represents an arbitrary resource record. Each [type] has a dedicated struct,
4//! which has a variant in the [`RR`] enum. For example, the [`A`] struct represent an A record.
5//!
6//! The [`Class`] enum represents the [class] field of the resource record.
7//!
8//! The [`Type`] enum represents the [type] field of the resource record.
9//!
10//! *Yet there are some missing resource records and types*
11//!
12//! # Example
13//! ```rust
14//! use dns_message_parser::rr::{RR, A};
15//!
16//! // Init A record
17//! let a = A {
18//!     // The domain name of the A record
19//!     domain_name: "example.org".parse().unwrap(),
20//!     // The time to live of the A record
21//!     ttl: 1000,
22//!     // The address of the A record
23//!     ipv4_addr: "10.0.0.1".parse().unwrap(),
24//! };
25//!
26//! // Convert the resource record into a RR
27//! let rr = RR::A(a);
28//!
29//! // Encode the A record into bytes::BytesMut
30//! let bytes = rr.encode().unwrap();
31//!
32//! // Decode the A record into a RR enum
33//! let rr = RR::decode(bytes.freeze()).unwrap();
34//! ```
35//!
36//! [`A`]: crate::rr::A
37//! [`RR`]: crate::rr::RR
38//! [`Class`]: crate::rr::Class
39//! [`Type`]: crate::rr::Type
40//! [resource records]: https://tools.ietf.org/html/rfc1035#section-4.1.3
41//! [class]: https://tools.ietf.org/html/rfc1035#section-3.2.4
42//! [type]: https://tools.ietf.org/html/rfc1035#section-3.2.2
43
44#[macro_use]
45mod macros;
46mod draft_ietf_dnsop_svcb_https;
47pub mod edns;
48mod enums;
49mod rfc_1035;
50mod rfc_1183;
51mod rfc_1706;
52mod rfc_1712;
53mod rfc_1876;
54mod rfc_2163;
55mod rfc_2230;
56mod rfc_2782;
57mod rfc_3123;
58mod rfc_3596;
59mod rfc_3658;
60mod rfc_4034;
61mod rfc_6672;
62mod rfc_6742;
63mod rfc_7043;
64mod rfc_7553;
65mod rfc_8659;
66mod subtypes;
67#[cfg(test)]
68mod tests;
69mod unknown;
70
71pub use draft_ietf_dnsop_svcb_https::{ServiceBinding, ServiceBindingMode, ServiceParameter};
72pub use edns::rfc_6891::OPT;
73pub use enums::{Class, ToType, Type, RR};
74pub use rfc_1035::{A, CNAME, HINFO, MB, MD, MF, MG, MINFO, MR, MX, NS, NULL, PTR, SOA, TXT, WKS};
75pub use rfc_1183::{
76    AFSDBSubtype, ISDNAddress, ISDNError, PSDNAddress, PSDNAddressError, AFSDB, ISDN, RP, RT, SA,
77    X25,
78};
79pub use rfc_1706::NSAP;
80pub use rfc_1712::GPOS;
81pub use rfc_1876::LOC;
82pub use rfc_2163::PX;
83pub use rfc_2230::KX;
84pub use rfc_2782::SRV;
85pub use rfc_3123::{APItem, APL, APL_NEGATION_MASK};
86pub use rfc_3596::AAAA;
87pub use rfc_3658::{SSHFPAlgorithm, SSHFPType, SSHFP};
88pub use rfc_4034::{
89    AlgorithmType, DigestType, DNSKEY, DNSKEY_ZERO_MASK, DS, SECURE_ENTRY_POINT_FLAG, ZONE_KEY_FLAG,
90};
91pub use rfc_6672::DNAME;
92pub use rfc_6742::{L32, L64, LP, NID};
93pub use rfc_7043::{EUI48, EUI64};
94pub use rfc_7553::URI;
95pub use rfc_8659::{Tag, TagError, CAA};
96pub use subtypes::{Address, AddressError, AddressFamilyNumber, NonEmptyVec};
97pub use unknown::{EID, NIMLOC};