fn parse_entry<I: Iterator<Item = char>>(
origin: Option<&DomainName>,
previous_domain: Option<&MaybeWildcard>,
previous_ttl: Option<u32>,
stream: &mut Peekable<I>,
) -> Result<Option<Entry>, Error>Expand description
Parse a single entry, skipping comments and whitespace. Entries are of the form:
$ORIGIN <domain-name>
$INCLUDE <file-name> [<domain-name>]
<rr>Where <rr> is one of these forms:
<domain-name> <ttl> <class> <type> <rdata>
<domain-name> <class> <ttl> <type> <rdata>
<domain-name> <ttl> <type> <rdata>
<domain-name> <class> <type> <rdata>
<domain-name> <type> <rdata>
<ttl> <class> <type> <rdata>
<class> <ttl> <type> <rdata>
<ttl> <type> <rdata>
<class> <type> <rdata>
<type> <rdata>This is annoyingly flexible:
-
If the
<domain-name>,<ttl>, or<class>are missing, the previous is used (so it is an error to omit it in the first RR). -
But since this implementation only supports
IN-class records, if the class is missing in the first RR,INis used. -
The
<domain-name>can be an absolute domain, given as a dotted string ending in a.; or a relative domain, given as a dotted string not ending in a., in which case the origin is prepended; or@, in which case it is the origin.
The <rdata> format depends on the record type.
Some special characters are:
@- the current origin;- the rest of the line is a comment" ... "- a string (used for rdata)( ... )- a group of data which crosses a newline\X- quotes a character, whereXis a non-digit\DDD- an octet, given as a decimal number
Returns None if the stream is empty.
ยงErrors
If the string cannot be parsed.