[][src]Struct domain_core::bits::header::HeaderCounts

pub struct HeaderCounts { /* fields omitted */ }

The section count part of the header section of a DNS message.

This part consists of four 16 bit counters for the number of entries in the four sections of a DNS message.

The counters are arranged in the same order as the sections themselves: QDCOUNT for the question section, ANCOUNT for the answer section, NSCOUNT for the authority section, and ARCOUNT for the additional section. These are defined in RFC 1035.

RFC 2136 defines the UPDATE method and reuses the four section for different purposes. Here the counters are ZOCOUNT for the zone section, PRCOUNT for the prerequisite section, UPCOUNT for the update section, and ADCOUNT for the additional section. The type has convenience methods for these fields as well so you don’t have to remember which is which.

For each field there are three methods for getting, setting, and incrementing.

Methods

impl HeaderCounts[src]

pub fn new() -> Self[src]

Creates a new value with all counters set to zero.

pub fn for_message_slice(message: &[u8]) -> &Self[src]

Creates a header reference from a byte slice of a message.

The slice message mut be the whole message, i.e., start with the bytes of the Header.

Panics

This function panics if the bytes slice is too short.

pub fn for_message_slice_mut(message: &mut [u8]) -> &mut Self[src]

Creates a mutable header reference from a bytes slice of a message.

The slice message mut be the whole message, i.e., start with the bytes of the Header.

Panics

This function panics if the bytes slice is too short.

pub fn as_slice(&self) -> &[u8][src]

Returns a reference to the raw byte slice of the header counts.

pub fn as_slice_mut(&mut self) -> &mut [u8][src]

Returns a mutable reference to the raw byte slice of the header counts.

pub fn set(&mut self, counts: HeaderCounts)[src]

Sets the counts to those from counts.

impl HeaderCounts[src]

pub fn qdcount(self) -> u16[src]

Returns the value of the QDCOUNT field.

This field contains the number of questions in the first section of the message, normally the question section.

pub fn set_qdcount(&mut self, value: u16)[src]

Sets the value of the QDCOUNT field.

pub fn inc_qdcount(&mut self)[src]

Increases the value of the QDCOUNT field by one.

Panics

This method panics if the count is already at its maximum.

pub fn ancount(self) -> u16[src]

Returns the value of the ANCOUNT field.

This field contains the number of resource records in the second section of the message, normally the answer section.

pub fn set_ancount(&mut self, value: u16)[src]

Sets the value of the ANCOUNT field.

pub fn inc_ancount(&mut self)[src]

Increases the value of the ANCOUNT field by one.

Panics

This method panics if the count is already at its maximum.

pub fn nscount(self) -> u16[src]

Returns the value of the NSCOUNT field.

This field contains the number of resource records in the third section of the message, normally the authority section.

pub fn set_nscount(&mut self, value: u16)[src]

Sets the value of the NSCOUNT field.

pub fn inc_nscount(&mut self)[src]

Increases the value of the NSCOUNT field by one.

Panics

This method panics if the count is already at its maximum.

pub fn arcount(self) -> u16[src]

Returns the value of the ARCOUNT field.

This field contains the number of resource records in the fourth section of the message, normally the additional section.

pub fn set_arcount(&mut self, value: u16)[src]

Sets the value of the ARCOUNT field.

pub fn inc_arcount(&mut self)[src]

Increases the value of the ARCOUNT field by one.

Panics

This method panics if the count is already at its maximum.

pub fn zocount(self) -> u16[src]

Returns the value of the ZOCOUNT field.

This is the same as the qdcount(). It is used in UPDATE queries where the first section is the zone section.

pub fn set_zocount(&mut self, value: u16)[src]

Sets the value of the ZOCOUNT field.

pub fn prcount(self) -> u16[src]

Returns the value of the PRCOUNT field.

This is the same as the ancount(). It is used in UPDATE queries where the first section is the prerequisite section.

pub fn set_prcount(&mut self, value: u16)[src]

Sete the value of the PRCOUNT field.

pub fn upcount(self) -> u16[src]

Returns the value of the UPCOUNT field.

This is the same as the nscount(). It is used in UPDATE queries where the first section is the update section.

pub fn set_upcount(&mut self, value: u16)[src]

Sets the value of the UPCOUNT field.

pub fn adcount(self) -> u16[src]

Returns the value of the ADCOUNT field.

This is the same as the arcount(). It is used in UPDATE queries where the first section is the additional section.

pub fn set_adcount(&mut self, value: u16)[src]

Sets the value of the ADCOUNT field.

Trait Implementations

impl Eq for HeaderCounts[src]

impl Clone for HeaderCounts[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for HeaderCounts[src]

impl PartialEq<HeaderCounts> for HeaderCounts[src]

impl Default for HeaderCounts[src]

impl Debug for HeaderCounts[src]

Auto Trait Implementations

Blanket Implementations

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

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T> From for T[src]

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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