Struct domain::bits::header::HeaderCounts [−][src]
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]
impl HeaderCounts
pub fn new() -> HeaderCounts
[src]
pub fn new() -> HeaderCounts
Creates a new value with all counters set to zero.
pub fn from_message(s: &[u8]) -> &HeaderCounts
[src]
pub fn from_message(s: &[u8]) -> &HeaderCounts
Creates a reference from the bytes slice of a message (!).
Panics
This function panics if the bytes slice is too short.
pub fn from_message_mut(s: &mut [u8]) -> &mut HeaderCounts
[src]
pub fn from_message_mut(s: &mut [u8]) -> &mut HeaderCounts
Creates a mutable reference from the bytes slice of a message.
Panics
This function panics if the bytes slice is too short.
pub fn as_bytes(&self) -> &[u8]
[src]
pub fn as_bytes(&self) -> &[u8]
Returns a reference to the underlying bytes slice.
impl HeaderCounts
[src]
impl HeaderCounts
pub fn qdcount(&self) -> u16
[src]
pub fn qdcount(&self) -> u16
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]
pub fn set_qdcount(&mut self, value: u16)
Sets the value of the QDCOUNT field.
pub fn inc_qdcount(&mut self, inc: u16) -> ComposeResult<()>
[src]
pub fn inc_qdcount(&mut self, inc: u16) -> ComposeResult<()>
Increase the value of the QDCOUNT field.
pub fn ancount(&self) -> u16
[src]
pub fn ancount(&self) -> u16
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]
pub fn set_ancount(&mut self, value: u16)
Sets the value of the ANCOUNT field.
pub fn inc_ancount(&mut self, inc: u16) -> ComposeResult<()>
[src]
pub fn inc_ancount(&mut self, inc: u16) -> ComposeResult<()>
Increases the value of the ANCOUNT field.
pub fn nscount(&self) -> u16
[src]
pub fn nscount(&self) -> u16
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]
pub fn set_nscount(&mut self, value: u16)
Sets the value of the NSCOUNT field.
pub fn inc_nscount(&mut self, inc: u16) -> ComposeResult<()>
[src]
pub fn inc_nscount(&mut self, inc: u16) -> ComposeResult<()>
Increases the value of the NSCOUNT field.
pub fn arcount(&self) -> u16
[src]
pub fn arcount(&self) -> u16
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]
pub fn set_arcount(&mut self, value: u16)
Sets the value of the ARCOUNT field.
pub fn inc_arcount(&mut self, inc: u16) -> ComposeResult<()>
[src]
pub fn inc_arcount(&mut self, inc: u16) -> ComposeResult<()>
Increases the value of the ARCOUNT field.
pub fn zocount(&self) -> u16
[src]
pub fn zocount(&self) -> u16
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]
pub fn set_zocount(&mut self, value: u16)
Sets the value of the ZOCOUNT field.
pub fn inc_zocount(&mut self, inc: u16) -> ComposeResult<()>
[src]
pub fn inc_zocount(&mut self, inc: u16) -> ComposeResult<()>
Increments the value of the ZOCOUNT field.
pub fn prcount(&self) -> u16
[src]
pub fn prcount(&self) -> u16
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]
pub fn set_prcount(&mut self, value: u16)
Sete the value of the PRCOUNT field.
pub fn inc_prcount(&mut self, inc: u16) -> ComposeResult<()>
[src]
pub fn inc_prcount(&mut self, inc: u16) -> ComposeResult<()>
Increments the value of the PRCOUNT field,
pub fn upcount(&self) -> u16
[src]
pub fn upcount(&self) -> u16
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]
pub fn set_upcount(&mut self, value: u16)
Sets the value of the UPCOUNT field.
pub fn inc_upcount(&mut self, inc: u16) -> ComposeResult<()>
[src]
pub fn inc_upcount(&mut self, inc: u16) -> ComposeResult<()>
Increments the value of the UPCOUNT field.
pub fn adcount(&self) -> u16
[src]
pub fn adcount(&self) -> u16
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]
pub fn set_adcount(&mut self, value: u16)
Sets the value of the ADCOUNT field.
pub fn inc_adcount(&mut self, inc: u16) -> ComposeResult<()>
[src]
pub fn inc_adcount(&mut self, inc: u16) -> ComposeResult<()>
Increments the value of the ADCOUNT field.
Trait Implementations
impl Clone for HeaderCounts
[src]
impl Clone for HeaderCounts
fn clone(&self) -> HeaderCounts
[src]
fn clone(&self) -> HeaderCounts
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl Debug for HeaderCounts
[src]
impl Debug for HeaderCounts
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl Default for HeaderCounts
[src]
impl Default for HeaderCounts
fn default() -> HeaderCounts
[src]
fn default() -> HeaderCounts
Returns the "default value" for a type. Read more
impl PartialEq for HeaderCounts
[src]
impl PartialEq for HeaderCounts
fn eq(&self, other: &HeaderCounts) -> bool
[src]
fn eq(&self, other: &HeaderCounts) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &HeaderCounts) -> bool
[src]
fn ne(&self, other: &HeaderCounts) -> bool
This method tests for !=
.
Auto Trait Implementations
impl Send for HeaderCounts
impl Send for HeaderCounts
impl Sync for HeaderCounts
impl Sync for HeaderCounts