pub struct DnsMessage {
pub header: DnsMessageHeader,
pub questions: Vec<DnsQuestion>,
pub answers: Vec<DnsRecord>,
pub name_servers: Vec<DnsRecord>,
pub additional: Vec<DnsRecord>,
}
Fields§
§header: DnsMessageHeader
§questions: Vec<DnsQuestion>
§answers: Vec<DnsRecord>
§name_servers: Vec<DnsRecord>
§additional: Vec<DnsRecord>
Implementations§
Source§impl DnsMessage
impl DnsMessage
Sourcepub fn question_count(&self) -> Result<u16, DnsError>
pub fn question_count(&self) -> Result<u16, DnsError>
§Errors
Returns an error when there are more than 65,536 questions.
Sourcepub fn read<const N: usize>(buf: &mut FixedBuf<N>) -> Result<Self, DnsError>
pub fn read<const N: usize>(buf: &mut FixedBuf<N>) -> Result<Self, DnsError>
§Errors
Returns an error when buf
does not contain a valid message.
Sourcepub fn write<const N: usize>(
&self,
out: &mut FixedBuf<N>,
) -> Result<(), DnsError>
pub fn write<const N: usize>( &self, out: &mut FixedBuf<N>, ) -> Result<(), DnsError>
§Errors
Returns an error when buf
fills up.
Sourcepub fn answer_response(&self, answers: Vec<DnsRecord>) -> Result<Self, DnsError>
pub fn answer_response(&self, answers: Vec<DnsRecord>) -> Result<Self, DnsError>
§Errors
Returns an error when there are more than 65,536 questions.
Sourcepub fn error_response(
&self,
response_code: DnsResponseCode,
) -> Result<Self, DnsError>
pub fn error_response( &self, response_code: DnsResponseCode, ) -> Result<Self, DnsError>
§Errors
Returns an error when there are more than 65,536 questions.
Trait Implementations§
Source§impl Clone for DnsMessage
impl Clone for DnsMessage
Source§fn clone(&self) -> DnsMessage
fn clone(&self) -> DnsMessage
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for DnsMessage
impl Debug for DnsMessage
Source§impl Hash for DnsMessage
impl Hash for DnsMessage
Source§impl PartialEq for DnsMessage
impl PartialEq for DnsMessage
impl Eq for DnsMessage
impl StructuralPartialEq for DnsMessage
Auto Trait Implementations§
impl Freeze for DnsMessage
impl RefUnwindSafe for DnsMessage
impl Send for DnsMessage
impl Sync for DnsMessage
impl Unpin for DnsMessage
impl UnwindSafe for DnsMessage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more