[][src]Struct trust_dns::op::DnsResponse

pub struct DnsResponse(_);

A DNS response object

For Most DNS requests, only one response is expected, the exception is a multicast request.

Methods

impl DnsResponse[src]

pub fn messages(&self) -> Iter<Message>[src]

Get all the messages in the Response

pub fn messages_mut(&mut self) -> IterMut<Message>[src]

Get all the messages in the Response

pub fn len(&self) -> usize[src]

returns the number of messages in the response

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

returns the number of messages in the response

Methods from Deref<Target = Message>

pub fn truncate(&self) -> Message[src]

Truncates a Message, this blindly removes all response fields and sets trucation to true

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

see Header::set_id

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

see Header::set_message_type

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

see Header::set_op_code

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

see Header::set_authoritative

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

see Header::set_truncated

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

see Header::set_recursion_desired

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

see Header::set_recursion_available

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

see Header::set_authentic_data

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

see Header::set_checking_disabled

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

see Header::set_response_code

pub fn add_query(&mut self, query: Query) -> &mut Message[src]

Add a query to the Message, either the query response from the server, or the request Query.

pub fn add_queries<Q, I>(&mut self, queries: Q) -> &mut Message where
    I: Iterator<Item = Query>,
    Q: IntoIterator<Item = Query, IntoIter = I>, 
[src]

Adds an iterator over a set of Queries to be added to the message

pub fn add_answer(&mut self, record: Record) -> &mut Message[src]

Add an answer to the Message

pub fn add_answers<R, I>(&mut self, records: R) -> &mut Message where
    I: Iterator<Item = Record>,
    R: IntoIterator<Item = Record, IntoIter = I>, 
[src]

Add all the records from the iterator to the answers section of the Message

pub fn insert_answers(&mut self, records: Vec<Record>)[src]

Sets the answers to the specified set of Records.

Panics

Will panic if answer records are already associated to the message.

pub fn add_name_server(&mut self, record: Record) -> &mut Message[src]

Add a name server record to the Message

pub fn add_name_servers<R, I>(&mut self, records: R) -> &mut Message where
    I: Iterator<Item = Record>,
    R: IntoIterator<Item = Record, IntoIter = I>, 
[src]

Add all the records in the Iterator to the name server section of the message

pub fn insert_name_servers(&mut self, records: Vec<Record>)[src]

Sets the name_servers to the specified set of Records.

Panics

Will panic if name_servers records are already associated to the message.

pub fn add_additional(&mut self, record: Record) -> &mut Message[src]

A an addtional Record to the message

pub fn insert_additionals(&mut self, records: Vec<Record>)[src]

Sets the additional to the specified set of Records.

Panics

Will panic if additional records are already associated to the message.

pub fn set_edns(&mut self, edns: Edns) -> &mut Message[src]

Add the EDNS section the the Message

pub fn add_sig0(&mut self, record: Record) -> &mut Message[src]

Add a SIG0 record, i.e. sign this message

This must be don't only after all records have been associated. Generally this will be handled by the client and not need to be used directly

pub fn header(&self) -> &Header[src]

Gets the header of the Message

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

see Header::id()

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

see Header::message_type()

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

see Header::op_code()

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

see Header::authoritative()

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

see Header::truncated()

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

see Header::recursion_desired()

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

see Header::recursion_available()

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

see Header::authentic_data()

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

see Header::checking_disabled()

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

Return value

The ResponseCode, if this is an EDNS message then this will join the section from the OPT record to create the EDNS ResponseCode

pub fn queries(&self) -> &[Query][src]

Question        Carries the query name and other query parameters.

pub fn answers(&self) -> &[Record][src]

Answer          Carries RRs which directly answer the query.

pub fn take_answers(&mut self) -> Vec<Record>[src]

Removes all the answers from the Message

pub fn name_servers(&self) -> &[Record][src]

Authority       Carries RRs which describe other authoritative servers.
                May optionally carry the SOA RR for the authoritative
                data in the answer section.

pub fn take_name_servers(&mut self) -> Vec<Record>[src]

Remove the name servers from the Message

pub fn additionals(&self) -> &[Record][src]

Additional      Carries RRs which may be helpful in using the RRs in the
                other sections.

pub fn take_additionals(&mut self) -> Vec<Record>[src]

Remove the additional Records from the Message

pub fn edns(&self) -> Option<&Edns>[src]

RFC 6891, EDNS(0) Extensions, April 2013

6.1.1.  Basic Elements

 An OPT pseudo-RR (sometimes called a meta-RR) MAY be added to the
 additional data section of a request.

 The OPT RR has RR type 41.

 If an OPT record is present in a received request, compliant
 responders MUST include an OPT record in their respective responses.

 An OPT record does not carry any DNS data.  It is used only to
 contain control information pertaining to the question-and-answer
 sequence of a specific transaction.  OPT RRs MUST NOT be cached,
 forwarded, or stored in or loaded from master files.

 The OPT RR MAY be placed anywhere within the additional data section.
 When an OPT RR is included within any DNS message, it MUST be the
 only OPT RR in that message.  If a query message with more than one
 OPT RR is received, a FORMERR (RCODE=1) MUST be returned.  The
 placement flexibility for the OPT RR does not override the need for
 the TSIG or SIG(0) RRs to be the last in the additional section
 whenever they are present.

Return value

Returns the EDNS record if it was found in the additional section.

pub fn edns_mut(&mut self) -> &mut Edns[src]

If edns is_none, this will create a new default Edns.

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

Return value

the max payload value as it's defined in the EDNS section.

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

Return value

the version as defined in the EDNS record

pub fn sig0(&self) -> &[Record][src]

RFC 2535, Domain Name System Security Extensions, March 1999

A DNS request may be optionally signed by including one or more SIGs
 at the end of the query. Such SIGs are identified by having a "type
 covered" field of zero. They sign the preceding DNS request message
 including DNS header but not including the IP header or any request
 SIGs at the end and before the request RR counts have been adjusted
 for the inclusions of any request SIG(s).

Return value

The sig0, i.e. signed record, for verifying the sending and package integrity

pub fn to_vec(&self) -> Result<Vec<u8>, ProtoError>[src]

Encodes the Message into a buffer

pub fn finalize<MF>(
    &mut self,
    finalizer: &MF,
    inception_time: u32
) -> Result<(), ProtoError> where
    MF: MessageFinalizer
[src]

Finalize the message prior to sending.

Subsequent to calling this, the Message should not change.

Trait Implementations

impl From<Message> for DnsResponse[src]

impl From<SmallVec<[Message; 1]>> for DnsResponse[src]

impl From<DnsResponse> for Message[src]

impl DerefMut for DnsResponse[src]

impl Debug for DnsResponse[src]

impl Deref for DnsResponse[src]

type Target = Message

The resulting type after dereferencing.

impl Clone for DnsResponse[src]

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

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for DnsResponse

impl Sync for DnsResponse

Blanket Implementations

impl<T> From<T> for T[src]

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

type Owned = T

The resulting type after obtaining ownership.

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

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.

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

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

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

impl<T> Erased for T