Expand description
Helper functions to assert a buffer for the header flags of a DNS Packet. Useful for checking the header
without parsing the whole packet.
WARNING: Flags and RCODE information may be incomplete if the packet contains EDNS (OPT) or
DNSSEC Resource Records
use simple_dns::{header_buffer, PacketFlag};
let buffer = b"\xff\xff\x03\x00\x00\x02\x00\x02\x00\x02\x00\x02";
assert_eq!(u16::MAX, header_buffer::id(&buffer[..]).unwrap());
assert!(!header_buffer::has_flags(&buffer[..], PacketFlag::RESPONSE).unwrap());
Functionsยง
- Returns the additional records from the header buffer
- Returns the answers count from the header buffer
- Verify if buffer has the flags set.
WARNING: This information may be wrong if there is an OPT record in packet - Returns the packet id from the header buffer
- Returns the name servers count from the header buffer
- Get the OPCODE from the buffer
- Returns the questions count from the header buffer
- Get the RCODE from the buffer.
WARNING: This information may be wrong if there is an OPT record in packet