| Kea 3.0.2-git

isc::dns::Rcode Class Reference

DNS Response Codes (RCODEs) class. More...

`#include <rcode.h>`

## Public Types
enum | CodeValue { NOERROR_CODE = 0 , FORMERR_CODE = 1 , SERVFAIL_CODE = 2 , NXDOMAIN_CODE = 3 , NOTIMP_CODE = 4 , REFUSED_CODE = 5 , YXDOMAIN_CODE = 6 , YXRRSET_CODE = 7 , NXRRSET_CODE = 8 , NOTAUTH_CODE = 9 , NOTZONE_CODE = 10 , RESERVED11_CODE = 11 , RESERVED12_CODE = 12 , RESERVED13_CODE = 13 , RESERVED14_CODE = 14 , RESERVED15_CODE = 15 , BADVERS_CODE = 16 }
| Constants for pre-defined RCODE values. More...

## Constructors and Destructor
We use the default versions of destructor, copy constructor, and assignment operator. The default constructor is hidden as a result of defining the other constructors. This is intentional; we don't want to allow an `Rcode` object to be constructed with an invalid state.
| Rcode (const uint16_t code)
| Constructor from the code value.
| Rcode (const uint8_t code, const uint8_t extended_code)
| Constructor from a pair of base and extended parts of code.
uint16_t | getCode () const
| Returns the `Rcode` code value.
uint8_t | getExtendedCode () const
| Returns the upper 8-bit of the `Rcode` code value.
bool | equals (const Rcode &other) const
| Return true iff two Rcodes are equal.
bool | operator== (const Rcode &other) const
| Same as `equals()`.
bool | nequals (const Rcode &other) const
| Return true iff two Rcodes are not equal.
bool | operator!= (const Rcode &other) const
| Same as `nequals()`.
std::string | toText () const
| Convert the `Rcode` to a string.
static const Rcode & | NOERROR ()
| A constant object for the NOERROR Rcode (see `Rcode::NOERROR_CODE`).
static const Rcode & | FORMERR ()
| A constant object for the FORMERR Rcode (see `Rcode::FORMERR_CODE`).
static const Rcode & | SERVFAIL ()
| A constant object for the SERVFAIL Rcode (see `Rcode::SERVFAIL_CODE`).
static const Rcode & | NXDOMAIN ()
| A constant object for the NXDOMAIN Rcode (see `Rcode::NXDOMAIN_CODE`).
static const Rcode & | NOTIMP ()
| A constant object for the NOTIMP Rcode (see `Rcode::NOTIMP_CODE`).
static const Rcode & | REFUSED ()
| A constant object for the REFUSED Rcode (see `Rcode::REFUSED_CODE`).
static const Rcode & | YXDOMAIN ()
| A constant object for the YXDOMAIN Rcode (see `Rcode::YXDOMAIN_CODE`).
static const Rcode & | YXRRSET ()
| A constant object for the YXRRSET Rcode (see `Rcode::YXRRSET_CODE`).
static const Rcode & | NXRRSET ()
| A constant object for the NXRRSET Rcode (see `Rcode::NXRRSET_CODE`).
static const Rcode & | NOTAUTH ()
| A constant object for the NOTAUTH Rcode (see `Rcode::NOTAUTH_CODE`).
static const Rcode & | NOTZONE ()
| A constant object for the NOTZONE Rcode (see `Rcode::NOTZONE_CODE`).
static const Rcode & | RESERVED11 ()
| A constant object for a reserved (code 11) Rcode.
static const Rcode & | RESERVED12 ()
| A constant object for a reserved (code 12) Rcode.
static const Rcode & | RESERVED13 ()
| A constant object for a reserved (code 13) Rcode.
static const Rcode & | RESERVED14 ()
| A constant object for a reserved (code 14) Rcode.
static const Rcode & | RESERVED15 ()
| A constant object for a reserved (code 15) Rcode.
static const Rcode & | BADVERS ()
| A constant object for the BADVERS Rcode (see `Rcode::BADVERS_CODE`).

## Detailed Description

DNS Response Codes (RCODEs) class.

The `Rcode` class objects represent standard Response Codes (RCODEs) of the header section of DNS messages, and extended response codes as defined in the EDNS specification.

Originally RCODEs were defined as 4-bit integers (RFC1035), and then extended to 12 bits as part of the EDNS specification (RFC2671). This API uses the 12-bit version of the definition from the beginning; applications don't have to aware of the original definition except when dealing with the wire-format representation of the EDNS OPT RR (which is rare).

Like the `Opcode` class, Rcodes could be represented as bare integers, but we define a separate class to benefit from C++ type safety.

For convenience we also provide an enum type for pre-defined RCODE values, but it is generally advisable to handle RCODEs through this class. In fact, public interfaces of this library uses this class to pass or return RCODEs instead of the bare code values.

Definition at line 40 of file rcode.h.

## Member Enumeration Documentation

## ◆ CodeValue

enum isc::dns::Rcode::CodeValue

Constants for pre-defined RCODE values.

Enumerator
NOERROR_CODE | 0: No error (RFC1035)
FORMERR_CODE | 1: Format error (RFC1035)
SERVFAIL_CODE | 2: Server failure (RFC1035)
NXDOMAIN_CODE | 3: Name Error (RFC1035)
NOTIMP_CODE | 4: Not Implemented (RFC1035)
REFUSED_CODE | 5: Refused (RFC1035)
YXDOMAIN_CODE | 6: Name unexpectedly exists (RFC2136)
YXRRSET_CODE | 7: RRset unexpectedly exists (RFC2136)
NXRRSET_CODE | 8: RRset should exist but not (RFC2136)
NOTAUTH_CODE | 9: Server isn't authoritative (RFC2136)
NOTZONE_CODE | 10: Name is not within the zone (RFC2136)
RESERVED11_CODE | 11: Reserved for future use (RFC1035)
RESERVED12_CODE | 12: Reserved for future use (RFC1035)
RESERVED13_CODE | 13: Reserved for future use (RFC1035)
RESERVED14_CODE | 14: Reserved for future use (RFC1035)
RESERVED15_CODE | 15: Reserved for future use (RFC1035)
BADVERS_CODE | 16: EDNS version not implemented (RFC2671)

Definition at line 43 of file rcode.h.

## Constructor & Destructor Documentation

## ◆ Rcode() [1/2]

isc::dns::Rcode::Rcode | ( | const uint16_t | code | ) |
| explicit

Constructor from the code value.

Since RCODEs are 12-bit values, parameters larger than 0xfff are invalid. If `code` is larger than 0xfff an exception of class `isc::OutOfRange` will be thrown.

Parameters

  code | The underlying 12-bit code value of the `Rcode`.

Definition at line 58 of file rcode.cc.

References isc_throw.

Referenced by BADVERS(), equals(), FORMERR(), nequals(), NOERROR(), NOTAUTH(), NOTIMP(), NOTZONE(), NXDOMAIN(), NXRRSET(), operator!=(), operator==(), REFUSED(), RESERVED11(), RESERVED12(), RESERVED13(), RESERVED14(), RESERVED15(), SERVFAIL(), YXDOMAIN(), and YXRRSET().

## ◆ Rcode() [2/2]

isc::dns::Rcode::Rcode | ( | const uint8_t | code,
|  | const uint8_t | extended_code )

Constructor from a pair of base and extended parts of code.

This constructor takes two parameters, one for the lower 4 bits of the code value, the other for the upper 8 bits, and combines them to build a complete 12-bit code value.

The first parameter, `code`, is the lower 4 bits, and therefore must not exceed 15. Otherwise, an exception of class `isc::OutOfRange` will be thrown.

This version of constructor is provided specifically for constructing an Rcode from a DNS header and an EDNS OPT RR. Normal applications won't have to use this constructor.

Parameters

  code | The lower 4 bits of the underlying code value.
  extended_code | The upper 8 bits of the underlying code value.

Definition at line 64 of file rcode.cc.

References isc_throw.

## Member Function Documentation

## ◆ BADVERS()

const Rcode & isc::dns::Rcode::BADVERS | ( |  | ) |
| inline static

A constant object for the BADVERS Rcode (see `Rcode::BADVERS_CODE`).

Definition at line 324 of file rcode.h.

References Rcode().

Referenced by isc::dns::DNSMessageBADVERS::getRcode().

Here is the call graph for this function:

## ◆ equals()

bool isc::dns::Rcode::equals | ( | const Rcode & | other | ) | const
| inline

Return true iff two Rcodes are equal.

Two Rcodes are equal iff their type codes are equal.

This method never throws an exception.

Parameters

  other | the `Rcode` object to compare against.

Returns
  true if the two Rcodes are equal; otherwise false.

Definition at line 129 of file rcode.h.

References Rcode().

Referenced by operator==().

Here is the call graph for this function:

## ◆ FORMERR()

const Rcode & isc::dns::Rcode::FORMERR | ( |  | ) |
| inline static

A constant object for the FORMERR Rcode (see `Rcode::FORMERR_CODE`).

Definition at line 234 of file rcode.h.

References Rcode().

Referenced by isc::dns::TSIGError::FORMERR(), and isc::dns::DNSMessageFORMERR::getRcode().

Here is the call graph for this function:

## ◆ getCode()

uint16_t isc::dns::Rcode::getCode | ( |  | ) | const
| inline

Returns the `Rcode` code value.

This method never throws an exception.

Returns
  The underlying code value corresponding to the `Rcode`.

Definition at line 106 of file rcode.h.

Referenced by isc::d2::CheckExistsAddTransaction::addingFwdAddrsHandler(), isc::d2::NameAddTransaction::addingFwdAddrsHandler(), isc::d2::CheckExistsRemoveTransaction::removingFwdAddrsHandler(), isc::d2::NameRemoveTransaction::removingFwdAddrsHandler(), isc::d2::CheckExistsRemoveTransaction::removingFwdRRsHandler(), isc::d2::NameRemoveTransaction::removingFwdRRsHandler(), isc::d2::SimpleRemoveTransaction::removingFwdRRsHandler(), isc::d2::SimpleRemoveWithoutDHCIDTransaction::removingFwdRRsHandler(), isc::d2::CheckExistsRemoveTransaction::removingRevPtrsHandler(), isc::d2::NameRemoveTransaction::removingRevPtrsHandler(), isc::d2::SimpleRemoveTransaction::removingRevPtrsHandler(), isc::d2::SimpleRemoveWithoutDHCIDTransaction::removingRevPtrsHandler(), isc::d2::CheckExistsAddTransaction::replacingFwdAddrsHandler(), isc::d2::NameAddTransaction::replacingFwdAddrsHandler(), isc::d2::SimpleAddTransaction::replacingFwdAddrsHandler(), isc::d2::SimpleAddWithoutDHCIDTransaction::replacingFwdAddrsHandler(), isc::d2::CheckExistsAddTransaction::replacingRevPtrsHandler(), isc::d2::NameAddTransaction::replacingRevPtrsHandler(), isc::d2::SimpleAddTransaction::replacingRevPtrsHandler(), and isc::d2::SimpleAddWithoutDHCIDTransaction::replacingRevPtrsHandler().

## ◆ getExtendedCode()

uint8_t isc::dns::Rcode::getExtendedCode | ( |  | ) | const

Returns the upper 8-bit of the `Rcode` code value.

Normal applications won't have to use this method. This is provided in case the upper 8 bits are necessary for the EDNS protocol processing.

This method never throws an exception.

Returns
  The upper 8-bit of the underlying code value.

Definition at line 75 of file rcode.cc.

## ◆ nequals()

bool isc::dns::Rcode::nequals | ( | const Rcode & | other | ) | const
| inline

Return true iff two Rcodes are not equal.

This method never throws an exception.

Parameters

  other | the `Rcode` object to compare against.

Returns
  true if the two Rcodes are not equal; otherwise false.

Definition at line 144 of file rcode.h.

References Rcode().

Referenced by operator!=().

Here is the call graph for this function:

## ◆ NOERROR()

const Rcode & isc::dns::Rcode::NOERROR | ( |  | ) |
| inline static

A constant object for the NOERROR Rcode (see `Rcode::NOERROR_CODE`).

Definition at line 228 of file rcode.h.

References Rcode().

Referenced by isc::d2::D2UpdateMessage::D2UpdateMessage(), isc::d2::CheckExistsAddTransaction::addingFwdAddrsHandler(), isc::d2::NameAddTransaction::addingFwdAddrsHandler(), isc::dns::TSIGError::NOERROR(), isc::d2::CheckExistsRemoveTransaction::removingFwdAddrsHandler(), isc::d2::NameRemoveTransaction::removingFwdAddrsHandler(), isc::d2::CheckExistsRemoveTransaction::removingFwdRRsHandler(), isc::d2::NameRemoveTransaction::removingFwdRRsHandler(), isc::d2::SimpleRemoveTransaction::removingFwdRRsHandler(), isc::d2::SimpleRemoveWithoutDHCIDTransaction::removingFwdRRsHandler(), isc::d2::CheckExistsRemoveTransaction::removingRevPtrsHandler(), isc::d2::NameRemoveTransaction::removingRevPtrsHandler(), isc::d2::SimpleRemoveTransaction::removingRevPtrsHandler(), isc::d2::SimpleRemoveWithoutDHCIDTransaction::removingRevPtrsHandler(), isc::d2::CheckExistsAddTransaction::replacingFwdAddrsHandler(), isc::d2::NameAddTransaction::replacingFwdAddrsHandler(), isc::d2::SimpleAddTransaction::replacingFwdAddrsHandler(), isc::d2::SimpleAddWithoutDHCIDTransaction::replacingFwdAddrsHandler(), isc::d2::CheckExistsAddTransaction::replacingRevPtrsHandler(), isc::d2::NameAddTransaction::replacingRevPtrsHandler(), isc::d2::SimpleAddTransaction::replacingRevPtrsHandler(), and isc::d2::SimpleAddWithoutDHCIDTransaction::replacingRevPtrsHandler().

Here is the call graph for this function:

## ◆ NOTAUTH()

const Rcode & isc::dns::Rcode::NOTAUTH | ( |  | ) |
| inline static

A constant object for the NOTAUTH Rcode (see `Rcode::NOTAUTH_CODE`).

Definition at line 282 of file rcode.h.

References Rcode().

Referenced by isc::dns::TSIGError::NOTAUTH(), and isc::dns::TSIGError::toRcode().

Here is the call graph for this function:

## ◆ NOTIMP()

const Rcode & isc::dns::Rcode::NOTIMP | ( |  | ) |
| inline static

A constant object for the NOTIMP Rcode (see `Rcode::NOTIMP_CODE`).

Definition at line 252 of file rcode.h.

References Rcode().

Referenced by isc::dns::TSIGError::NOTIMP().

Here is the call graph for this function:

## ◆ NOTZONE()

const Rcode & isc::dns::Rcode::NOTZONE | ( |  | ) |
| inline static

A constant object for the NOTZONE Rcode (see `Rcode::NOTZONE_CODE`).

Definition at line 288 of file rcode.h.

References Rcode().

Referenced by isc::dns::TSIGError::NOTZONE().

Here is the call graph for this function:

## ◆ NXDOMAIN()

const Rcode & isc::dns::Rcode::NXDOMAIN | ( |  | ) |
| inline static

A constant object for the NXDOMAIN Rcode (see `Rcode::NXDOMAIN_CODE`).

Definition at line 246 of file rcode.h.

References Rcode().

Referenced by isc::dns::TSIGError::NXDOMAIN(), isc::d2::CheckExistsAddTransaction::replacingFwdAddrsHandler(), and isc::d2::NameAddTransaction::replacingFwdAddrsHandler().

Here is the call graph for this function:

## ◆ NXRRSET()

const Rcode & isc::dns::Rcode::NXRRSET | ( |  | ) |
| inline static

A constant object for the NXRRSET Rcode (see `Rcode::NXRRSET_CODE`).

Definition at line 276 of file rcode.h.

References Rcode().

Referenced by isc::dns::TSIGError::NXRRSET(), isc::d2::CheckExistsRemoveTransaction::removingFwdAddrsHandler(), isc::d2::NameRemoveTransaction::removingFwdAddrsHandler(), isc::d2::CheckExistsRemoveTransaction::removingFwdRRsHandler(), isc::d2::NameRemoveTransaction::removingFwdRRsHandler(), isc::d2::SimpleRemoveTransaction::removingFwdRRsHandler(), isc::d2::SimpleRemoveWithoutDHCIDTransaction::removingFwdRRsHandler(), isc::d2::CheckExistsRemoveTransaction::removingRevPtrsHandler(), isc::d2::NameRemoveTransaction::removingRevPtrsHandler(), isc::d2::SimpleRemoveTransaction::removingRevPtrsHandler(), and isc::d2::SimpleRemoveWithoutDHCIDTransaction::removingRevPtrsHandler().

Here is the call graph for this function:

## ◆ operator!=()

bool isc::dns::Rcode::operator!= | ( | const Rcode & | other | ) | const
| inline

Same as `nequals()`.

Definition at line 149 of file rcode.h.

References Rcode(), and nequals().

Here is the call graph for this function:

## ◆ operator==()

bool isc::dns::Rcode::operator== | ( | const Rcode & | other | ) | const
| inline

Same as `equals()`.

Definition at line 134 of file rcode.h.

References Rcode(), and equals().

Here is the call graph for this function:

## ◆ REFUSED()

const Rcode & isc::dns::Rcode::REFUSED | ( |  | ) |
| inline static

A constant object for the REFUSED Rcode (see `Rcode::REFUSED_CODE`).

Definition at line 258 of file rcode.h.

References Rcode().

Referenced by isc::dns::TSIGError::REFUSED().

Here is the call graph for this function:

## ◆ RESERVED11()

const Rcode & isc::dns::Rcode::RESERVED11 | ( |  | ) |
| inline static

A constant object for a reserved (code 11) Rcode.

(see `Rcode::RESERVED11_CODE`).

Definition at line 294 of file rcode.h.

References Rcode().

Referenced by isc::dns::TSIGError::RESERVED11().

Here is the call graph for this function:

## ◆ RESERVED12()

const Rcode & isc::dns::Rcode::RESERVED12 | ( |  | ) |
| inline static

A constant object for a reserved (code 12) Rcode.

(see `Rcode::RESERVED12_CODE`).

Definition at line 300 of file rcode.h.

References Rcode().

Referenced by isc::dns::TSIGError::RESERVED12().

Here is the call graph for this function:

## ◆ RESERVED13()

const Rcode & isc::dns::Rcode::RESERVED13 | ( |  | ) |
| inline static

A constant object for a reserved (code 13) Rcode.

(see `Rcode::RESERVED13_CODE`).

Definition at line 306 of file rcode.h.

References Rcode().

Referenced by isc::dns::TSIGError::RESERVED13().

Here is the call graph for this function:

## ◆ RESERVED14()

const Rcode & isc::dns::Rcode::RESERVED14 | ( |  | ) |
| inline static

A constant object for a reserved (code 14) Rcode.

(see `Rcode::RESERVED14_CODE`).

Definition at line 312 of file rcode.h.

References Rcode().

Referenced by isc::dns::TSIGError::RESERVED14().

Here is the call graph for this function:

## ◆ RESERVED15()

const Rcode & isc::dns::Rcode::RESERVED15 | ( |  | ) |
| inline static

A constant object for a reserved (code 15) Rcode.

(see `Rcode::RESERVED15_CODE`).

Definition at line 318 of file rcode.h.

References Rcode().

Referenced by isc::dns::TSIGError::RESERVED15().

Here is the call graph for this function:

## ◆ SERVFAIL()

const Rcode & isc::dns::Rcode::SERVFAIL | ( |  | ) |
| inline static

A constant object for the SERVFAIL Rcode (see `Rcode::SERVFAIL_CODE`).

Definition at line 240 of file rcode.h.

References Rcode().

Referenced by isc::dns::TSIGError::SERVFAIL(), and isc::dns::TSIGError::toRcode().

Here is the call graph for this function:

## ◆ toText()

string isc::dns::Rcode::toText | ( |  | ) | const

Convert the `Rcode` to a string.

For pre-defined code values (see Rcode::CodeValue), this method returns a string representation of the "mnemonic' used for the enum and constant objects. For example, the string for code value 0 is "NOERROR", etc. For other code values it returns a string representation of the decimal number of the value, e.g. "32", "100", etc.

If resource allocation for the string fails, a corresponding standard exception will be thrown.

Returns
  A string representation of the `Rcode`.

Definition at line 80 of file rcode.cc.

Referenced by isc::dns::operator<<().

## ◆ YXDOMAIN()

const Rcode & isc::dns::Rcode::YXDOMAIN | ( |  | ) |
| inline static

A constant object for the YXDOMAIN Rcode (see `Rcode::YXDOMAIN_CODE`).

Definition at line 264 of file rcode.h.

References Rcode().

Referenced by isc::d2::CheckExistsAddTransaction::addingFwdAddrsHandler(), isc::d2::NameAddTransaction::addingFwdAddrsHandler(), and isc::dns::TSIGError::YXDOMAIN().

Here is the call graph for this function:

## ◆ YXRRSET()

const Rcode & isc::dns::Rcode::YXRRSET | ( |  | ) |
| inline static

A constant object for the YXRRSET Rcode (see `Rcode::YXRRSET_CODE`).

Definition at line 270 of file rcode.h.

References Rcode().

Referenced by isc::dns::TSIGError::YXRRSET().

Here is the call graph for this function:

The documentation for this class was generated from the following files:

- rcode.h
- rcode.cc