trust_dns_proto::op::response_code

Enum ResponseCode

Source
pub enum ResponseCode {
Show 21 variants NoError, FormErr, ServFail, NXDomain, NotImp, Refused, YXDomain, YXRRSet, NXRRSet, NotAuth, NotZone, BADVERS, BADSIG, BADKEY, BADTIME, BADMODE, BADNAME, BADALG, BADTRUNC, BADCOOKIE, Unknown(u16),
}
Expand description

The status code of the response to a query.

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

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

                0               No error condition

                1               Format error - The name server was
                                unable to interpret the query.

                2               Server failure - The name server was
                                unable to process this query due to a
                                problem with the name server.

                3               Name Error - Meaningful only for
                                responses from an authoritative name
                                server, this code signifies that the
                                domain name referenced in the query does
                                not exist.

                4               Not Implemented - The name server does
                                not support the requested kind of query.

                5               Refused - The name server refuses to
                                perform the specified operation for
                                policy reasons.  For example, a name
                                server may not wish to provide the
                                information to the particular requester,
                                or a name server may not wish to perform
                                a particular operation (e.g., zone
                                transfer) for particular data.

                6-15            Reserved for future use.

Variants§

§

NoError

No Error RFC 1035

§

FormErr

Format Error RFC 1035

§

ServFail

Server Failure RFC 1035

§

NXDomain

Non-Existent Domain RFC 1035

§

NotImp

Not Implemented RFC 1035

§

Refused

Query Refused RFC 1035

§

YXDomain

Name Exists when it should not RFC 2136

§

YXRRSet

RR Set Exists when it should not RFC 2136

§

NXRRSet

RR Set that should exist does not RFC 2136

§

NotAuth

Server Not Authoritative for zone RFC 2136 or Not Authorized RFC 2845

§

NotZone

Name not contained in zone RFC 2136

§

BADVERS

Bad OPT Version RFC 6891

§

BADSIG

TSIG Signature Failure RFC 2845

§

BADKEY

Key not recognized RFC 2845

§

BADTIME

Signature out of time window RFC 2845

§

BADMODE

Bad TKEY Mode RFC 2930

§

BADNAME

Duplicate key name RFC 2930

§

BADALG

Algorithm not supported RFC 2930

§

BADTRUNC

Bad Truncation RFC 4635

§

BADCOOKIE

Bad/missing server cookie draft-ietf-dnsop-cookies

§

Unknown(u16)

An unknown or unregisterd response code was received.

Implementations§

Source§

impl ResponseCode

Source

pub fn low(self) -> u8

returns the lower 4 bits of the response code (for the original header portion of the code)

Source

pub fn high(self) -> u8

returns the high 8 bits for the EDNS portion of the response code

Source

pub fn from_low(low: u8) -> Self

DNS can not store the entire space of ResponseCodes in 4 bit space of the Header, this function allows for a initial value of the first 4 bits to be set.

After the EDNS is read, the entire ResponseCode (12 bits) can be reconstructed for the full ResponseCode.

Source

pub fn from(high: u8, low: u8) -> Self

Combines the EDNS high and low from the Header to produce the Extended ResponseCode

Source

pub fn to_str(self) -> &'static str

Transforms the response code into the human message

Trait Implementations§

Source§

impl Clone for ResponseCode

Source§

fn clone(&self) -> ResponseCode

Returns a copy 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 ResponseCode

Source§

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

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

impl Default for ResponseCode

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for ResponseCode

Source§

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

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

impl From<ResponseCode> for u16

Convert from ResponseCode to u16

use std::convert::From;
use trust_dns_proto::op::response_code::ResponseCode;

let var: ResponseCode = From::from(0);
assert_eq!(ResponseCode::NoError, var);

let var: ResponseCode = 0.into();
assert_eq!(ResponseCode::NoError, var);
Source§

fn from(rt: ResponseCode) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for ResponseCode

Convert from u16 to ResponseCode

use std::convert::From;
use trust_dns_proto::op::response_code::ResponseCode;

let var: u16 = From::from(ResponseCode::NoError);
assert_eq!(0, var);

let var: u16 = ResponseCode::NoError.into();
assert_eq!(0, var);
Source§

fn from(value: u16) -> Self

Converts to this type from the input type.
Source§

impl Hash for ResponseCode

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ResponseCode

Source§

fn eq(&self, other: &ResponseCode) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for ResponseCode

Source§

fn partial_cmp(&self, other: &ResponseCode) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for ResponseCode

Source§

impl Eq for ResponseCode

Source§

impl StructuralPartialEq for ResponseCode

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, dst: *mut T)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more