[][src]Struct trust_dns_proto::op::header::Header

pub struct Header { /* fields omitted */ }

Metadata for the Message struct.

RFC 1035, DOMAIN NAMES - IMPLEMENTATION AND SPECIFICATION, November 1987

4.1.1. Header section format

The header contains the following fields

                                   1  1  1  1  1  1
     0  1  2  3  4  5  6  7  8  9  0  1  2  3  4  5
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                      ID                       |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |QR|   Opcode  |AA|TC|RD|RA|ZZ|AD|CD|   RCODE   |  /// AD and CD from RFC4035
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                    QDCOUNT / ZCOUNT           |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                    ANCOUNT / PRCOUNT          |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                    NSCOUNT / UPCOUNT          |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+
    |                    ARCOUNT / ADCOUNT          |
    +--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+--+

where

Z               Reserved for future use.  Must be zero in all queries
                and responses.

Methods

impl Header
[src]

pub fn new() -> Self
[src]

A default Header, not very useful.

pub fn len() -> usize
[src]

Length of the header, always 12 bytes

pub fn set_id(&mut self, id: u16) -> &mut Self
[src]

Sets the id of the message, for queries this shoudl be random.

pub fn set_message_type(&mut self, message_type: MessageType) -> &mut Self
[src]

Sets the message type, Queries and Updates both use Query.

pub fn set_op_code(&mut self, op_code: OpCode) -> &mut Self
[src]

Set the operation code for the message

pub fn set_authoritative(&mut self, authoritative: bool) -> &mut Self
[src]

From the server is specifies that it is an authoritative reqponse.

pub fn set_truncated(&mut self, truncated: bool) -> &mut Self
[src]

Specifies that the records were too large for the payload.

See EDNS or TCP for resolutions to truncation.

pub fn set_recursion_desired(&mut self, recursion_desired: bool) -> &mut Self
[src]

Specify that the resolver should recursiviley request data from upstream DNS nodes

pub fn set_recursion_available(
    &mut self,
    recursion_available: bool
) -> &mut Self
[src]

Specifies that recursion is available from this or the remote resolver

pub fn set_authentic_data(&mut self, authentic_data: bool) -> &mut Self
[src]

Specifies that the data is authnetic, i.e. the resolver believes all data to be valid through DNSSec

pub fn set_checking_disabled(&mut self, checking_disabled: bool) -> &mut Self
[src]

Used during recursive resolution to specified if a resolver should or should not validate DNSSec signatures

pub fn set_response_code(&mut self, response_code: ResponseCode) -> &mut Self
[src]

The low responsed code (original response codes before EDNS extensions)

pub fn set_query_count(&mut self, query_count: u16) -> &mut Self
[src]

Number or query records in the message

pub fn set_answer_count(&mut self, answer_count: u16) -> &mut Self
[src]

Number of answer records in the message

pub fn set_name_server_count(&mut self, name_server_count: u16) -> &mut Self
[src]

Number of name server records in the message

pub fn set_additional_count(&mut self, additional_count: u16) -> &mut Self
[src]

Number of additional records in the message

pub fn id(&self) -> u16
[src]

ID              A 16 bit identifier assigned by the program that
                generates any kind of query.  This identifier is copied
                the corresponding reply and can be used by the requester
                to match up replies to outstanding queries.

pub fn message_type(&self) -> MessageType
[src]

QR              A one bit field that specifies whether this message is a
                query (0), or a response (1).

pub fn op_code(&self) -> OpCode
[src]

OPCODE          A four bit field that specifies kind of query in this
                message.  This value is set by the originator of a query
                and copied into the response.  The values are: <see super::op_code>

pub fn authoritative(&self) -> bool
[src]

AA              Authoritative Answer - this bit is valid in responses,
                and specifies that the responding name server is an
                authority for the domain name in question section.

                Note that the contents of the answer section may have
                multiple owner names because of aliases.  The AA bit
                corresponds to the name which matches the query name, or
                the first owner name in the answer section.

pub fn truncated(&self) -> bool
[src]

TC              TrunCation - specifies that this message was truncated
                due to length greater than that permitted on the
                transmission channel.

pub fn recursion_desired(&self) -> bool
[src]

RD              Recursion Desired - this bit may be set in a query and
                is copied into the response.  If RD is set, it directs
                the name server to pursue the query recursively.
                Recursive query support is optional.

pub fn recursion_available(&self) -> bool
[src]

RA              Recursion Available - this be is set or cleared in a
                response, and denotes whether recursive query support is
                available in the name server.

pub fn authentic_data(&self) -> bool
[src]

RFC 4035, DNSSEC Resource Records, March 2005


3.1.6.  The AD and CD Bits in an Authoritative Response

  The CD and AD bits are designed for use in communication between
  security-aware resolvers and security-aware recursive name servers.
  These bits are for the most part not relevant to query processing by
  security-aware authoritative name servers.

  A security-aware name server does not perform signature validation
  for authoritative data during query processing, even when the CD bit
  is clear.  A security-aware name server SHOULD clear the CD bit when
  composing an authoritative response.

  A security-aware name server MUST NOT set the AD bit in a response
  unless the name server considers all RRsets in the Answer and
  Authority sections of the response to be authentic.  A security-aware
  name server's local policy MAY consider data from an authoritative
  zone to be authentic without further validation.  However, the name
  server MUST NOT do so unless the name server obtained the
  authoritative zone via secure means (such as a secure zone transfer
  mechanism) and MUST NOT do so unless this behavior has been
  configured explicitly.

  A security-aware name server that supports recursion MUST follow the
  rules for the CD and AD bits given in Section 3.2 when generating a
  response that involves data obtained via recursion.

pub fn checking_disabled(&self) -> bool
[src]

see is_authentic_data()

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

RCODE           Response code - this 4 bit field is set as part of
                responses.  The values have the following
                interpretation: <see super::response_code>

pub fn query_count(&self) -> u16
[src]

QDCOUNT         an unsigned 16 bit integer specifying the number of
                entries in the question section.

Return value

If this is a query, this will return the number of queries in the query section of the

pub fn answer_count(&self) -> u16
[src]

ANCOUNT         an unsigned 16 bit integer specifying the number of
                resource records in the answer section.

Return value

For query responses this is the number of records in the answer section, should be 0 for requests, for updates this is the count of prerequisite records.

pub fn name_server_count(&self) -> u16
[src]

for queries this is the nameservers which are authorities for the SOA of the Record for updates this is the update record count

NSCOUNT         an unsigned 16 bit integer specifying the number of name
                server resource records in the authority records
                section.

Return value

For query responses this is the number of authorities, or nameservers, in the name server section, for updates this is the number of update records being sent.

pub fn additional_count(&self) -> u16
[src]

ARCOUNT         an unsigned 16 bit integer specifying the number of
                resource records in the additional records section.

Return value

This is the additional record section count, this section may include EDNS options.

Trait Implementations

impl BinEncodable for Header
[src]

fn to_bytes(&self) -> ProtoResult<Vec<u8>>
[src]

Returns the object in binary form

impl<'r> BinDecodable<'r> for Header
[src]

fn from_bytes(bytes: &'r [u8]) -> ProtoResult<Self>
[src]

Returns the object in binary form

impl PartialOrd<Header> for Header
[src]

impl Default for Header
[src]

impl PartialEq<Header> for Header
[src]

impl Clone for Header
[src]

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

Performs copy-assignment from source. Read more

impl Debug for Header
[src]

Auto Trait Implementations

impl Send for Header

impl Sync for Header

Blanket Implementations

impl<T> From for T
[src]

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, U> TryFrom for T where
    T: From<U>, 
[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> BorrowMut 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> Erased for T