Struct domain::bits::message::MessageBuf
[−]
[src]
pub struct MessageBuf { /* fields omitted */ }
An owned DNS message.
This type owns the underlying bytes of the message and derefs into a
Message
for all processing. For more information on DNS messages
and how they can be accessed, please refer to the documentation of
the Message
type.
This is, however, not the type for building messages. Use
[MessageBuilder
] instead.
Methods
impl MessageBuf
[src]
fn from_vec(vec: Vec<u8>) -> ParseResult<Self>
Creates a new owned message using the given vector.
If the content of the vector is too short to even contain a full header, the function fails.
fn from_bytes(slice: &[u8]) -> ParseResult<Self>
Creates a new owned message cloning the data from the bytes slice.
If the slice is too short to even contain a full header section, the function fails.
fn as_slice(&self) -> &Message
Returns a reference to the message slice.
Methods from Deref<Target=Message>
fn to_owned(&self) -> MessageBuf
Returns an owned copy of this message.
fn as_bytes(&self) -> &[u8]
Returns a reference to the underlying bytes slice.
fn header(&self) -> &Header
Returns a reference to the message header.
fn header_mut(&mut self) -> &mut Header
Returns a mutable reference to the message header.
The header is the only part of an already constructed message that can be safely manipulated without extra ado, so this is the only mutable method.
fn counts(&self) -> &HeaderCounts
Returns a reference to the header counts of the message.
fn no_error(&self) -> bool
Returns whether the rcode is NoError.
fn is_error(&self) -> bool
Returns whether the rcode is one of the error values.
fn question(&self) -> QuestionSection
Returns the question section.
fn zone(&self) -> QuestionSection
Returns the zone section of an UPDATE message.
This is identical to self.question()
.
fn answer(&self) -> ParseResult<RecordSection>
Returns the answer section.
fn prerequisite(&self) -> ParseResult<RecordSection>
Returns the prerequisite section of an UPDATE message.
This is identical to self.answer()
.
Returns the authority section.
fn update(&self) -> ParseResult<RecordSection>
Returns the update section of an UPDATE message.
This is identical to self.authority()
.
fn additional(&self) -> ParseResult<RecordSection>
Returns the additional section.
fn sections(&self) -> ParseResult<(QuestionSection, RecordSection, RecordSection, RecordSection)>
Returns all four sections in one fell swoop.
fn is_answer(&self, query: &Message) -> bool
Returns whether this is the answer to some other message.
The method checks whether the ID fields of the headers are the same, whether the QR flag is set in this message, and whether the questions are the same.
fn first_question(&self) -> Option<Question<ParsedDName>>
Returns the first question, if there is any.
The method will return None
both of there are no questions or if
parsing fails.
fn qtype(&self) -> Option<Rtype>
Returns the query type of the first question, if any.
fn contains_answer<'a, D: ParsedRecordData<'a>>(&'a self) -> bool
Returns whether the message contains answers of a given type.
fn canonical_name(&self) -> Option<ParsedDName>
Resolves the canonical name of the answer.
Returns None
if either the message doesn’t have a question or there
was a parse error. Otherwise starts with the question’s name,
follows any CNAME trail and returns the name answers should be for.
Trait Implementations
impl Clone for MessageBuf
[src]
fn clone(&self) -> MessageBuf
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for MessageBuf
[src]
impl Deref for MessageBuf
[src]
type Target = Message
The resulting type after dereferencing
fn deref(&self) -> &Message
The method called to dereference a value