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]
pub fn from_vec(vec: Vec<u8>) -> ParseResult<Self>
[src]
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.
pub fn from_bytes(slice: &[u8]) -> ParseResult<Self>
[src]
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.
pub fn as_slice(&self) -> &Message
[src]
Returns a reference to the message slice.
Methods from Deref<Target = Message>
pub fn to_owned(&self) -> MessageBuf
[src]
Returns an owned copy of this message.
pub fn as_bytes(&self) -> &[u8]
[src]
Returns a reference to the underlying bytes slice.
pub fn header(&self) -> &Header
[src]
Returns a reference to the message header.
pub fn header_mut(&mut self) -> &mut Header
[src]
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.
pub fn counts(&self) -> &HeaderCounts
[src]
Returns a reference to the header counts of the message.
pub fn no_error(&self) -> bool
[src]
Returns whether the rcode is NoError.
pub fn is_error(&self) -> bool
[src]
Returns whether the rcode is one of the error values.
ⓘImportant traits for QuestionSection<'a>pub fn question(&self) -> QuestionSection
[src]
Returns the question section.
ⓘImportant traits for QuestionSection<'a>pub fn zone(&self) -> QuestionSection
[src]
Returns the zone section of an UPDATE message.
This is identical to self.question()
.
pub fn answer(&self) -> ParseResult<RecordSection>
[src]
Returns the answer section.
pub fn prerequisite(&self) -> ParseResult<RecordSection>
[src]
Returns the prerequisite section of an UPDATE message.
This is identical to self.answer()
.
[src]
Returns the authority section.
pub fn update(&self) -> ParseResult<RecordSection>
[src]
Returns the update section of an UPDATE message.
This is identical to self.authority()
.
pub fn additional(&self) -> ParseResult<RecordSection>
[src]
Returns the additional section.
pub fn sections(
&self
) -> ParseResult<(QuestionSection, RecordSection, RecordSection, RecordSection)>
[src]
&self
) -> ParseResult<(QuestionSection, RecordSection, RecordSection, RecordSection)>
Returns all four sections in one fell swoop.
pub fn is_answer<M: AsRef<Message>>(&self, query: M) -> bool
[src]
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.
pub fn first_question(&self) -> Option<Question<ParsedDName>>
[src]
Returns the first question, if there is any.
The method will return None
both if there are no questions or if
parsing fails.
pub fn qtype(&self) -> Option<Rtype>
[src]
Returns the query type of the first question, if any.
pub fn contains_answer<'a, D: ParsedRecordData<'a>>(&'a self) -> bool
[src]
Returns whether the message contains answers of a given type.
pub fn canonical_name(&self) -> Option<ParsedDName>
[src]
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
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for MessageBuf
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl Deref for MessageBuf
[src]
type Target = Message
The resulting type after dereferencing.
fn deref(&self) -> &Message
[src]
Dereferences the value.