Struct sparkle::WireEncoder
[−]
[src]
pub struct WireEncoder<'a, Q: QueryOrResponse, S: EncoderState> { /* fields omitted */ }
Writes a DNS message to an external buffer.
WireEncoder
guards against buffer overflow. If the external buffer is too
small to contain all content, then the encoder sets the message's TC
(truncation) flag and elides questions and/or resource records such that the
DNS message is valid and fits within the buffer.
Methods
impl<'a, Q: QueryOrResponse> WireEncoder<'a, Q, QuestionSection>
[src]
fn finalize_questions(self) -> WireEncoder<'a, Q, AnswerSection>
Transitions the encoder into a state for encoding answers.
fn encode_question<'b, F: Format<'b>>(
&mut self,
q: &'b Question<'b, F>
) -> Result<(), EncoderError>
&mut self,
q: &'b Question<'b, F>
) -> Result<(), EncoderError>
impl<'a> WireEncoder<'a, Query, QuestionSection>
[src]
impl<'a> WireEncoder<'a, Response, AnswerSection>
[src]
fn new_response(
buffer: &'a mut [u8],
request: &WireMessage
) -> Result<Self, EncoderError>
buffer: &'a mut [u8],
request: &WireMessage
) -> Result<Self, EncoderError>
Constructs an encoder for encoding a response message.
The target response is initialized such that:
- Its ID field is copied from the request.
- Its QR bit is set.
- Its RD bit is copied from the request.
- Its question section is copied verbatim from the request.
If the request contains multiple questions, then the response will also contain multiple questions.
fn finalize_answers(self) -> WireEncoder<'a, Response, AuthoritySection>
fn encode_answer<'b, F: Format<'b>>(
&mut self,
r: &'b ResourceRecord<'b, F>
) -> Result<(), EncoderError>
&mut self,
r: &'b ResourceRecord<'b, F>
) -> Result<(), EncoderError>
impl<'a> WireEncoder<'a, Response, AuthoritySection>
[src]
impl<'a> WireEncoder<'a, Response, AdditionalSection>
[src]
fn finalize_additionals(self) -> WireEncoder<'a, Response, Done>
fn encode_additional<'b, F: Format<'b>>(
&mut self,
r: &'b ResourceRecord<'b, F>
) -> Result<(), EncoderError>
&mut self,
r: &'b ResourceRecord<'b, F>
) -> Result<(), EncoderError>
impl<'a, Q: QueryOrResponse> WireEncoder<'a, Q, Done>
[src]
Trait Implementations
impl<'a, Q: Debug + QueryOrResponse, S: Debug + EncoderState> Debug for WireEncoder<'a, Q, S>
[src]
impl<'a, Q: Eq + QueryOrResponse, S: Eq + EncoderState> Eq for WireEncoder<'a, Q, S>
[src]
impl<'a, Q: PartialEq + QueryOrResponse, S: PartialEq + EncoderState> PartialEq for WireEncoder<'a, Q, S>
[src]
fn eq(&self, __arg_0: &WireEncoder<'a, Q, S>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &WireEncoder<'a, Q, S>) -> bool
This method tests for !=
.