Added dns body models

This commit is contained in:
Tobias Ottenweller 2022-05-08 20:57:37 +02:00
parent d0e4bea3e8
commit 59556f6b3c

View File

@ -156,11 +156,47 @@ pub struct DNSHeader {
} }
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct DNSQuery { pub enum DNSClass {
pub hdr: DNSHeader, Internet = 1,
Any = 255,
}
#[derive(Debug, Clone)]
pub enum DNSType {
HostAddress = 1,
NameServer = 2,
CanonicalName = 5,
StartOfZoneAuthority = 6,
WellKnownServiceDescription = 11,
DomainNamePointer = 12,
HostInformation = 13,
MailListInformation = 14,
MailExchange = 15,
TextStrings = 16,
Any = 255,
}
#[derive(Debug, Clone)]
pub struct DNSQuestion {
pub name: String, pub name: String,
pub qclass: u16, pub r#type: DNSType,
pub qtype: u16, pub class: DNSClass,
}
pub struct DNSResourceRecord {
pub name: String,
pub r#type: DNSType,
pub class: DNSClass,
pub ttl: u32,
pub data: String,
}
pub struct DNSMessage {
pub header: DNSHeader,
pub questions: Vec<DNSQuestion>,
pub answers: Vec<DNSResourceRecord>,
pub authorities: Vec<DNSResourceRecord>,
pub additionals: Vec<DNSResourceRecord>,
} }
impl DNSHeader { impl DNSHeader {