pub struct Rcode(/* private fields */);
Expand description
DNS Response Codes.
The response code of a response indicates what happend on the server when trying to answer the query. The code is a 4 bit value and part of the header of a DNS message.
This response was defined as part of RFC 1035. Later, RFC 2671 defined an extended response code of 12 bits using the lower four bits from the header and eight additional bits stored in the OPT pseudo-record. The type OptRcode represents this extended response code. A third response code, now 16 bit wide, was defined for the transaction authentication mechansim (TSIG) in [RFC 2845] and is represented by TsigRcode.
All three codes share the same name space. Their values are defined in one registry, IANA DNS RCODEs. This type is complete as of 2019-01-28.
Implementations§
Source§impl Rcode
impl Rcode
Sourcepub const SERVFAIL: Self
pub const SERVFAIL: Self
Server failure.
The name server was unable to process this query due to a problem with the name server.
Defined in RFC 1035.
Sourcepub const NXDOMAIN: Self
pub const NXDOMAIN: Self
Name error.
The domain name given in the query does not exist at the name server.
Defined in RFC 1035.
Sourcepub const REFUSED: Self
pub const REFUSED: Self
Query refused.
The name server refused to perform the operation requested by the query for policy reasons.
Defined in RFC 1035.
Sourcepub const YXRRSET: Self
pub const YXRRSET: Self
RR set exists when it should not.
Returned for an UPDATE query when an RRset requested to not exist does in fact exist.
Defined in RFC 2136.
Sourcepub const NXRRSET: Self
pub const NXRRSET: Self
RR set that should exist does not.
Returned for an UPDATE query when an RRset requested to exist does not.
Defined in RFC 2136.
Source§impl Rcode
impl Rcode
Sourcepub const fn checked_from_int(value: u8) -> Option<Self>
pub const fn checked_from_int(value: u8) -> Option<Self>
Creates an rcode from an integer, returning None
if invalid.
The rcode is valid if the upper four bits of value
are all zero.
Sourcepub const fn masked_from_int(value: u8) -> Self
pub const fn masked_from_int(value: u8) -> Self
Creates an rcode from an integer, only considering the lower four bits.
This function will ignore the upper four bit of value
.
Sourcepub const fn to_int(self) -> u8
pub const fn to_int(self) -> u8
Returns the integer value for this rcode.
Only the lower 4 bits of the returned octet are used by the rcode. The upper four bits are always zero.
Sourcepub const fn to_mnemonic(self) -> Option<&'static [u8]>
pub const fn to_mnemonic(self) -> Option<&'static [u8]>
Returns the mnemonic for this value if there is one.