pub struct MessageDecoder<'a, S>where
S: Section,{ /* private fields */ }Expand description
Streaming decoder for DNS messages.
In DNS messages, sections are ordered as follows:
- Question section
- Answer section
- Authority section
- Additional Records section
To ensure efficient decoding and prevent misuse, the message decoder stores the section it is
currently decoding as the S type parameter. Initially (after calling MessageDecoder::new),
the decoder is in the section::Question state, and is advanced by calling the appropriate
methods.
Implementations§
Source§impl<'a> MessageDecoder<'a, Question>
impl<'a> MessageDecoder<'a, Question>
Source§impl<'a, S> MessageDecoder<'a, S>where
S: Section,
impl<'a, S> MessageDecoder<'a, S>where
S: Section,
Source§impl<'a> MessageDecoder<'a, Question>
impl<'a> MessageDecoder<'a, Question>
Sourcepub fn next(&mut self) -> Option<Result<Question, Error>>
pub fn next(&mut self) -> Option<Result<Question, Error>>
Reads the next Question from the Question section.
Sourcepub fn iter(&mut self) -> QuestionIter<'_, 'a> ⓘ
pub fn iter(&mut self) -> QuestionIter<'_, 'a> ⓘ
Returns an iterator over all Questions in the Question section of the message.
Sourcepub fn answers(self) -> Result<MessageDecoder<'a, Answer>, Error>
pub fn answers(self) -> Result<MessageDecoder<'a, Answer>, Error>
Skips the remaining entries in the Question section and advances the decoder to the Answer section.
Skips the remaining entries in the Question section, as well as all entries in the Answer section, and advances the decoder to the Authority section.
Sourcepub fn additional(self) -> Result<MessageDecoder<'a, Additional>, Error>
pub fn additional(self) -> Result<MessageDecoder<'a, Additional>, Error>
Skips the remaining entries in the Question section, as well as all entries in the Answer and Authority sections, and advances the decoder to the Additional Records section.
Source§impl<'a> MessageDecoder<'a, Answer>
impl<'a> MessageDecoder<'a, Answer>
Sourcepub fn next(&mut self) -> Option<Result<ResourceRecord<'_>, Error>>
pub fn next(&mut self) -> Option<Result<ResourceRecord<'_>, Error>>
Reads the next ResourceRecord from the Answer section.
Sourcepub fn iter(&mut self) -> ResourceRecordIter<'_, 'a, Answer> ⓘ
pub fn iter(&mut self) -> ResourceRecordIter<'_, 'a, Answer> ⓘ
Returns an iterator over all resource records in the Answer section.
Skips the remaining entries in the Answer section, and advances the decoder to the Additional Records section.
Sourcepub fn additional(self) -> Result<MessageDecoder<'a, Additional>, Error>
pub fn additional(self) -> Result<MessageDecoder<'a, Additional>, Error>
Skips the remaining entries in the Answer section, as well as all entries in the Authority section, and advances the decoder to the Additional Records section.
Source§impl<'a> MessageDecoder<'a, Authority>
impl<'a> MessageDecoder<'a, Authority>
Sourcepub fn next(&mut self) -> Option<Result<ResourceRecord<'_>, Error>>
pub fn next(&mut self) -> Option<Result<ResourceRecord<'_>, Error>>
Reads the next ResourceRecord from the Authority section.
Sourcepub fn iter(&mut self) -> ResourceRecordIter<'_, 'a, Authority> ⓘ
pub fn iter(&mut self) -> ResourceRecordIter<'_, 'a, Authority> ⓘ
Returns an iterator over all resource records in the Authority section.
pub fn additional(self) -> Result<MessageDecoder<'a, Additional>, Error>
Source§impl<'a> MessageDecoder<'a, Additional>
impl<'a> MessageDecoder<'a, Additional>
Sourcepub fn next(&mut self) -> Option<Result<ResourceRecord<'_>, Error>>
pub fn next(&mut self) -> Option<Result<ResourceRecord<'_>, Error>>
Reads the next ResourceRecord from the Additional Records section.
Sourcepub fn iter(&mut self) -> ResourceRecordIter<'_, 'a, Additional> ⓘ
pub fn iter(&mut self) -> ResourceRecordIter<'_, 'a, Additional> ⓘ
Returns an iterator over all resource records in the Additional Record section.