Added dns body models #27

Closed
mice_on_drugs wants to merge 1 commits from dns-body-models into master

View File

@ -156,11 +156,47 @@ pub struct DNSHeader {
}
#[derive(Debug, Clone)]
pub struct DNSQuery {
pub hdr: DNSHeader,
pub enum DNSClass {
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 qclass: u16,
pub qtype: u16,
pub r#type: DNSType,
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 {