dns_message_parser/rr/
rfc_1876.rs

1use super::Class;
2use crate::DomainName;
3use std::fmt::{Display, Formatter, Result as FmtResult};
4
5/// The [location information] resource record type.
6///
7/// [location information]: https://tools.ietf.org/html/rfc1876#section-2
8#[derive(Debug, Clone, PartialEq, Eq, Hash)]
9pub struct LOC {
10    pub domain_name: DomainName,
11    pub ttl: u32,
12    pub class: Class,
13    pub version: u8,
14    pub size: u8,
15    pub horiz_pre: u8,
16    pub vert_pre: u8,
17    pub latitube: u32,
18    pub longitube: u32,
19    pub altitube: u32,
20}
21
22impl_to_type!(LOC);
23
24impl Display for LOC {
25    fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
26        write!(
27            f,
28            "{} {} {} LOC {} {} {} {} {} {} {}",
29            self.domain_name,
30            self.ttl,
31            self.class,
32            self.version,
33            self.size,
34            self.horiz_pre,
35            self.vert_pre,
36            self.latitube,
37            self.longitube,
38            self.altitube,
39        )
40    }
41}