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ยง
- additional_
records - Returns the additional records from the header buffer
- additional_
records_ unchecked - Returns the additional records from the header buffer
- answers
- Returns the answers count from the header buffer
- answers_
unchecked - Returns the answers count from the header buffer
- has_
flags - Verify if buffer has the flags set. WARNING: This information may be wrong if there is an OPT record in packet
- has_
flags_ unchecked - Verify if buffer has the flags set. WARNING: This information may be wrong if there is an OPT record in packet
- id
- Returns the packet id from the header buffer
- id_
unchecked - Returns the packet id from the header buffer
- name_
servers - Returns the name servers count from the header buffer
- name_
servers_ unchecked - Returns the name servers count from the header buffer
- opcode
- Get the OPCODE from the buffer
- opcode_
unchecked - Get the OPCODE from the buffer
- questions
- Returns the questions count from the header buffer
- questions_
unchecked - Returns the questions count from the header buffer
- rcode
- Get the RCODE from the buffer. WARNING: This information may be wrong if there is an OPT record in packet
- rcode_
unchecked - Get the RCODE from the buffer. WARNING: This information may be wrong if there is an OPT record in packet