1 use super::*; 2 use crate::message::packer::*; 3 4 // An AAAAResource is an aaaa Resource record. 5 #[derive(Default, Debug, Clone, PartialEq, Eq)] 6 pub struct AaaaResource { 7 pub aaaa: [u8; 16], 8 } 9 10 impl fmt::Display for AaaaResource { fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result11 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { 12 write!(f, "dnsmessage.AAAAResource{{aaaa: {:?}}}", self.aaaa) 13 } 14 } 15 16 impl ResourceBody for AaaaResource { real_type(&self) -> DnsType17 fn real_type(&self) -> DnsType { 18 DnsType::Aaaa 19 } 20 21 // pack appends the wire format of the AAAAResource to msg. pack( &self, msg: Vec<u8>, _compression: &mut Option<HashMap<String, usize>>, _compression_off: usize, ) -> Result<Vec<u8>>22 fn pack( 23 &self, 24 msg: Vec<u8>, 25 _compression: &mut Option<HashMap<String, usize>>, 26 _compression_off: usize, 27 ) -> Result<Vec<u8>> { 28 Ok(pack_bytes(msg, &self.aaaa)) 29 } 30 unpack(&mut self, msg: &[u8], off: usize, _length: usize) -> Result<usize>31 fn unpack(&mut self, msg: &[u8], off: usize, _length: usize) -> Result<usize> { 32 unpack_bytes(msg, off, &mut self.aaaa) 33 } 34 } 35