Struct resolve::message::Message
[−]
[src]
pub struct Message<'a> { pub header: Header, pub question: Vec<Question>, pub answer: Vec<Resource<'a>>, pub authority: Vec<Resource<'a>>, pub additional: Vec<Resource<'a>>, }
Represents a DNS message.
Fields
header | Describes the content of the remainder of the message. |
question | Carries the question of query type messages. |
answer | Resource records that answer the query |
authority | Resource records that point to an authoritative name server |
additional | Resource records that relate to the query, but are not strictly answers for the question. |
Methods
impl<'a> Message<'a>
fn new() -> Message<'a>
Constructs a new Message
with a random id value.
fn with_id(id: u16) -> Message<'a>
Constructs a new Message
with the given id value.
fn decode(data: &[u8]) -> Result<Message, DecodeError>
Decodes a message from a series of bytes.
fn encode<'buf>(&self, buf: &'buf mut [u8]) -> Result<&'buf [u8], EncodeError>
Encodes a message to a series of bytes. On success, returns a subslice of the given buffer containing only the encoded message bytes.
fn get_error(&self) -> Result<(), DnsError>
Returns a DnsError
if the message response code is an error.
fn records(&self) -> RecordIter
Returns an iterator over the records in this message.
fn into_records(self) -> RecordIntoIter<'a>
Consumes the message and returns an iterator over its records.