Function parse_dnsv4

Source
fn parse_dnsv4(
    packet_bytes: &[u8],
    measurement_type: u8,
    origin_map: &Vec<Origin>,
) -> Option<(Reply, bool)>
Expand description

Parse DNSv4 packets (including v4 headers) into a Reply result.

Filters out spoofed packets and only parses DNS replies valid for the current measurement.

§Arguments

  • ‘packet_bytes’ - the bytes of the packet to parse

  • ‘measurement_type’ - the type of measurement being performed

  • ‘origin_map’ - mapping of origin to origin ID

§Returns

  • Option<Reply> - the received DNS reply

§Remarks

The function returns None if the packet is too short to contain a UDP header.