pub struct ParsedPacket {
Show 13 fields pub packet: Option<Vec<u8>>, pub offset_question: Option<usize>, pub offset_answers: Option<usize>, pub offset_nameservers: Option<usize>, pub offset_additional: Option<usize>, pub offset_edns: Option<usize>, pub edns_count: u16, pub ext_rcode: Option<u8>, pub edns_version: Option<u8>, pub ext_flags: Option<u16>, pub maybe_compressed: bool, pub max_payload: usize, pub cached: Option<(Vec<u8>, u16, u16)>,
}
Expand description

A ParsedPacket structure contains information about a successfully parsed DNS packet, that allows quick access to (extended) flags and to individual sections.

Fields

packet: Option<Vec<u8>>offset_question: Option<usize>offset_answers: Option<usize>offset_nameservers: Option<usize>offset_additional: Option<usize>offset_edns: Option<usize>edns_count: u16ext_rcode: Option<u8>edns_version: Option<u8>ext_flags: Option<u16>maybe_compressed: boolmax_payload: usizecached: Option<(Vec<u8>, u16, u16)>

Implementations

Creates an empty parsed_packet

Converts a ParsedPacket back into a raw packet.

Returns a reference to the packet

Iterates over the question section.

Iterates over the answer section.

Iterates over the list of name servers.

Iterates over the additional section - OPT RRs are skipped.

Iterates over the additional section - OPT RRs are included.

Iterates over the records from the optional edns pseudo-section.

Copy the packet header

Copy the EDNS section

Returns the transaction ID.

Changes the transaction ID.

Returns the flags, including extended flags. The extended flags optionally obtained using edns are exposed as the highest 16 bits, instead of having distinct sets of flags. The opcode and rcode are intentionally masked in order to prevent misuse: these bits are never supposed to be accessed individually.

Changes the flags. Extended flags from the OPT section are currently ignored.

Check if this is a question with the DO bit, or a response with the AD bit

Check if this is a response

Set the response bit

Returns the return code.

Changes the return code.

Returns the opcode.

Changes the operation code.

Maximum payload size when using UDP

Increments the number of records in a given section

Decrements the number of records in a given section

Recomputes all section offsets after an in-place decompression of the packet. It is currently re-parsing everything by calling parse(), but this can be optimized later to skip over RDATA, and by assuming that the input is always well-formed.

Returns the question as a raw vector, without case conversion, as well as the query type and class Names include a trailing 0

Returns the question as a raw vector, without case conversion, as well as the query type and class Names do not include trailing 0

Returns the question as a string, without case conversion, as well as the query type and class

Return the query type and class

Replaces source_name with target_name in all names, in all records. If match_suffix is true, do suffix matching instead of exact matching This allows renaming *.example.com into *.example.net.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
The error type produced by a failed conversion.
Convert the given value into an approximately equivalent representation.
The error type produced by a failed conversion.
Convert the subject into an approximately equivalent representation.
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Approximate the subject with the default scheme.
Approximate the subject with a specific scheme.
Approximate the subject to a given type with the default scheme.
Approximate the subject to a given type with a specific scheme.
Convert the subject to a given type.
Attempt to convert the subject to a given type.
Attempt a value conversion of the subject to a given type.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The error type produced by a failed conversion.
Convert the given value into the subject type.
The type returned in the event of a conversion error.
Performs the conversion.
The error type produced by a failed conversion.
Convert the subject into the destination type.
The type returned in the event of a conversion error.
Performs the conversion.
The error type produced by a failed conversion.
Convert the given value into an exactly equivalent representation.
The error type produced by a failed conversion.
Convert the subject into an exactly equivalent representation.