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