Struct dns_parser::Header[][src]

pub struct Header {
    pub id: u16,
    pub query: bool,
    pub opcode: Opcode,
    pub authoritative: bool,
    pub truncated: bool,
    pub recursion_desired: bool,
    pub recursion_available: bool,
    pub authenticated_data: bool,
    pub checking_disabled: bool,
    pub response_code: ResponseCode,
    pub questions: u16,
    pub answers: u16,
    pub nameservers: u16,
    pub additional: u16,
}

Represents parsed header of the packet

Fields

id: u16query: boolopcode: Opcodeauthoritative: booltruncated: boolrecursion_desired: boolrecursion_available: boolauthenticated_data: boolchecking_disabled: boolresponse_code: ResponseCodequestions: u16answers: u16nameservers: u16additional: u16

Implementations

impl Header[src]

pub fn parse(data: &[u8]) -> Result<Header, Error>[src]

Parse the header into a header structure

pub fn write(&self, data: &mut [u8])[src]

Write a header to a buffer slice

Panics

When buffer size is not exactly 12 bytes

pub fn set_truncated(data: &mut [u8])[src]

Set “truncated flag” in the raw data

pub fn size() -> usize[src]

Returns a size of the header (always 12 bytes)

Trait Implementations

impl Clone for Header[src]

impl Copy for Header[src]

impl Debug for Header[src]

impl Eq for Header[src]

impl PartialEq<Header> for Header[src]

impl StructuralEq for Header[src]

impl StructuralPartialEq for Header[src]

Auto Trait Implementations

impl RefUnwindSafe for Header

impl Send for Header

impl Sync for Header

impl Unpin for Header

impl UnwindSafe for Header

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.