[][src]Struct rusty_dns::dns_packet::dns_header::DnsHeader

pub struct DnsHeader {
    pub id: u16,
    pub qr: bool,
    pub opcode: u8,
    pub aa: bool,
    pub tc: bool,
    pub rd: bool,
    pub ra: bool,
    pub z: u8,
    pub rcode: u8,
    pub qdcount: u16,
    pub ancount: u16,
    pub nscount: u16,
    pub arcount: u16,
}

DNS Packet Header.

Fields

id: u16

The ID for the DNS query and corresponding response.

qr: bool

The QR flag is false if the DNS packet is a query, true if it is a response.

opcode: u8

OPCODE for the query. Valid values are 0-2. See DNS_RFC_Notes.

aa: bool

The AA flag is false if the answer is non-authoritative, true otherwise.

tc: bool

The TC flag is true if the DNS packet was truncated due to message length.

rd: bool

The RD flag is set if recursion is desired during query resolution.

ra: bool

The RA flag is set in a response if the answering server supports recursive query.

z: u8

The Z field is reserved per the DNS protocol, and must always be 0.

rcode: u8

The RCODE field is the response from the answering server during query resolution.

qdcount: u16

QDCOUNT is the number of entries in the question section of the DNS packet.

ancount: u16

ANCOUNT is the number of entries in the answer section of the DNS packet.

nscount: u16

NSCOUNT is the number of name server resource records in the authority section of the DNS packet.

arcount: u16

ARCOUNT is the numer of entries in the additional section of the DNS packet.

Implementations

impl DnsHeader[src]

pub fn new() -> Result<DnsHeader, String>[src]

pub fn parse(dns_packet_buf: &Vec<u8>) -> Result<DnsHeader, String>[src]

Parse a DNS header from the start of a raw DNS packet.

pub fn serialize(&self) -> Vec<u8>[src]

Serialize the DNS header into a DNS protocol conformant, network ready buffer.

Trait Implementations

impl Debug for DnsHeader[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,