DnsHeader

Struct DnsHeader 

Source
pub struct DnsHeader { /* private fields */ }
Expand description

A DNS header.

Implementations§

Source§

impl DnsHeader

Source

pub fn id(&self) -> u16

The id of the DNS header.

Source

pub fn kind(&self) -> DnsHeaderKind

The kind of the DNS header.

Source

pub fn opcode(&self) -> DnsHeaderOpcode

The opcode of the DNS header.

Source

pub fn authoritative_answer(&self) -> bool

Whether the DNS header is an authoritative answer.

Source

pub fn truncated(&self) -> bool

Whether the DNS header is truncated.

Source

pub fn recursion_desired(&self) -> bool

Whether the DNS header recursion is desired.

Source

pub fn recursion_available(&self) -> bool

Whether the DNS header recursion is available.

Source

pub fn response_code(&self) -> DnsHeaderResponseCode

The response code of the DNS header.

Source

pub fn question_count(&self) -> u16

The number of questions in the DNS message.

Source

pub fn answer_count(&self) -> u16

The number of answers in the DNS message.

Source

pub fn name_server_count(&self) -> u16

The number of name servers in the DNS message.

Source

pub fn additional_records_count(&self) -> u16

The number of additional records in the DNS message.

Source

pub fn set_id(&mut self, id: u16)

Set the id of the DNS header.

Source

pub fn set_kind(&mut self, kind: DnsHeaderKind)

Set the kind of the DNS header.

Source

pub fn set_opcode(&mut self, opcode: DnsHeaderOpcode)

Set the opcode of the DNS header.

Source

pub fn set_authoritative_answer(&mut self, authoritative_answer: bool)

Set whether the DNS header is an authoritative answer.

Source

pub fn set_truncated(&mut self, truncated: bool)

Set whether the DNS header is truncated.

Source

pub fn set_recursion_desired(&mut self, recursion_desired: bool)

Set whether recursion is desired.

Source

pub fn set_recursion_available(&mut self, recursion_available: bool)

Set whether recursion is available.

Source

pub fn set_response_code(&mut self, response_code: DnsHeaderResponseCode)

Set the response code of the DNS header.

Trait Implementations§

Source§

impl Clone for DnsHeader

Source§

fn clone(&self) -> DnsHeader

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for DnsHeader

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Copy for DnsHeader

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.