Kea: isc::dns::TSIGError Class Reference

| Kea 2.2.0

Public Types | List of all members
isc::dns::TSIGError Class Reference

TSIG errors. More...

`#include <tsigerror.h>`

## Public Types
enum | CodeValue { BAD_SIG_CODE = 16 , BAD_KEY_CODE = 17 , BAD_TIME_CODE = 18 , BAD_MODE_CODE = 19 , BAD_NAME_CODE = 20 , BAD_ALG_CODE = 21 , BAD_TRUNC_CODE = 22 }
| Constants for pre-defined TSIG error values. More...

## Constructors
We use the default versions of destructor, copy constructor, and assignment operator.
| TSIGError (uint16_t error_code)
| Constructor from the code value. More...
| TSIGError (Rcode rcode)
| Constructor from `Rcode`. More...
uint16_t | getCode () const
| Returns the `TSIGCode` error code value. More...
bool | equals (const TSIGError &other) const
| Return true iff two `TSIGError` objects are equal. More...
bool | operator== (const TSIGError &other) const
| Same as `equals()`. More...
bool | nequals (const TSIGError &other) const
| Return true iff two `TSIGError` objects are not equal. More...
bool | operator!= (const TSIGError &other) const
| Same as `nequals()`. More...
std::string | toText () const
| Convert the `TSIGError` to a string. More...
Rcode | toRcode () const
| Convert the `TSIGError` to a `Rcode`. More...
static const TSIGError & | NOERROR ()
| A constant TSIG error object derived from `Rcode::NOERROR()` More...
static const TSIGError & | FORMERR ()
| A constant TSIG error object derived from `Rcode::FORMERR()` More...
static const TSIGError & | SERVFAIL ()
| A constant TSIG error object derived from `Rcode::SERVFAIL()` More...
static const TSIGError & | NXDOMAIN ()
| A constant TSIG error object derived from `Rcode::NXDOMAIN()` More...
static const TSIGError & | NOTIMP ()
| A constant TSIG error object derived from `Rcode::NOTIMP()` More...
static const TSIGError & | REFUSED ()
| A constant TSIG error object derived from `Rcode::REFUSED()` More...
static const TSIGError & | YXDOMAIN ()
| A constant TSIG error object derived from `Rcode::YXDOMAIN()` More...
static const TSIGError & | YXRRSET ()
| A constant TSIG error object derived from `Rcode::YXRRSET()` More...
static const TSIGError & | NXRRSET ()
| A constant TSIG error object derived from `Rcode::NXRRSET()` More...
static const TSIGError & | NOTAUTH ()
| A constant TSIG error object derived from `Rcode::NOTAUTH()` More...
static const TSIGError & | NOTZONE ()
| A constant TSIG error object derived from `Rcode::NOTZONE()` More...
static const TSIGError & | RESERVED11 ()
| A constant TSIG error object derived from `Rcode::RESERVED11()` More...
static const TSIGError & | RESERVED12 ()
| A constant TSIG error object derived from `Rcode::RESERVED12()` More...
static const TSIGError & | RESERVED13 ()
| A constant TSIG error object derived from `Rcode::RESERVED13()` More...
static const TSIGError & | RESERVED14 ()
| A constant TSIG error object derived from `Rcode::RESERVED14()` More...
static const TSIGError & | RESERVED15 ()
| A constant TSIG error object derived from `Rcode::RESERVED15()` More...
static const TSIGError & | BAD_SIG ()
| A constant TSIG error object for the BADSIG code (see `TSIGError::BAD_SIG_CODE`). More...
static const TSIGError & | BAD_KEY ()
| A constant TSIG error object for the BADKEY code (see `TSIGError::BAD_KEY_CODE`). More...
static const TSIGError & | BAD_TIME ()
| A constant TSIG error object for the BADTIME code (see `TSIGError::BAD_TIME_CODE`). More...
static const TSIGError & | BAD_MODE ()
| A constant TSIG error object for the BADMODE code (see `TSIGError::BAD_MODE_CODE`). More...
static const TSIGError & | BAD_NAME ()
| A constant TSIG error object for the BADNAME code (see `TSIGError::BAD_NAME_CODE`). More...
static const TSIGError & | BAD_ALG ()
| A constant TSIG error object for the BADALG code (see `TSIGError::BAD_ALG_CODE`). More...
static const TSIGError & | BAD_TRUNC ()
| A constant TSIG error object for the BADTRUNC code (see `TSIGError::BAD_TRUNC_CODE`). More...

## Detailed Description

TSIG errors.

The `TSIGError` class objects represent standard errors related to TSIG protocol operations as defined in related specifications, mainly in RFC2845, RFC2930 and RFC4635.

Definition at line 22 of file tsigerror.h.

## Member Enumeration Documentation

## ◆ CodeValue

enum isc::dns::TSIGError::CodeValue

Constants for pre-defined TSIG error values.

Code values from 0 through 15 (inclusive) are derived from those of RCODE and are not defined here. See the `Rcode` class.

Note
  Unfortunately some systems define "BADSIG" as a macro in a public header file. To avoid conflict with it we add an underscore to our definitions.

Enumerator
BAD_SIG_CODE | 16: TSIG verification failure
BAD_KEY_CODE | 17: TSIG key is not recognized
BAD_TIME_CODE | 18: Current time and time signed are too different
BAD_MODE_CODE | 19: Bad TKEY mode
BAD_NAME_CODE | 20: Duplicate TKEY name
BAD_ALG_CODE | 21: TKEY algorithm not supported
BAD_TRUNC_CODE | 22: Bad truncation

Definition at line 32 of file tsigerror.h.

## Constructor & Destructor Documentation

## ◆ TSIGError() [1/2]

isc::dns::TSIGError::TSIGError | ( | uint16_t | error_code | ) |
| inlineexplicit

Constructor from the code value.

Exceptions

  None |

Parameters

  error_code | The underlying 16-bit error code value of the `TSIGError`.

Definition at line 52 of file tsigerror.h.

## ◆ TSIGError() [2/2]

isc::dns::TSIGError::TSIGError | ( | Rcode | rcode | ) |
| explicit

Constructor from `Rcode`.

As defined in RFC2845, error code values from 0 to 15 (inclusive) are derived from the DNS RCODEs, which are represented via the `Rcode` class in this library. This constructor works as a converter from these RCODEs to corresponding TSIGError objects.

Exceptions

  isc::OutOfRange | Given rcode is not convertible to TSIGErrors.

Parameters

  rcode | the `Rcode` from which the TSIGError should be derived.

Definition at line 33 of file tsigerror.cc.

References isc_throw.

## Member Function Documentation

## ◆ BAD_ALG()

const TSIGError & isc::dns::TSIGError::BAD_ALG | ( |  | ) |
| inlinestatic

A constant TSIG error object for the BADALG code (see `TSIGError::BAD_ALG_CODE`).

Definition at line 345 of file tsigerror.h.

References BAD_ALG_CODE.

## ◆ BAD_KEY()

const TSIGError & isc::dns::TSIGError::BAD_KEY | ( |  | ) |
| inlinestatic

A constant TSIG error object for the BADKEY code (see `TSIGError::BAD_KEY_CODE`).

Definition at line 321 of file tsigerror.h.

References BAD_KEY_CODE.

Referenced by isc::dns::TSIGContext::TSIGContext(), isc::dns::TSIGContext::getTSIGLength(), isc::dns::TSIGContext::sign(), and isc::dns::TSIGContext::verify().

## ◆ BAD_MODE()

const TSIGError & isc::dns::TSIGError::BAD_MODE | ( |  | ) |
| inlinestatic

A constant TSIG error object for the BADMODE code (see `TSIGError::BAD_MODE_CODE`).

Definition at line 333 of file tsigerror.h.

References BAD_MODE_CODE.

## ◆ BAD_NAME()

const TSIGError & isc::dns::TSIGError::BAD_NAME | ( |  | ) |
| inlinestatic

A constant TSIG error object for the BADNAME code (see `TSIGError::BAD_NAME_CODE`).

Definition at line 339 of file tsigerror.h.

References BAD_NAME_CODE.

## ◆ BAD_SIG()

const TSIGError & isc::dns::TSIGError::BAD_SIG | ( |  | ) |
| inlinestatic

A constant TSIG error object for the BADSIG code (see `TSIGError::BAD_SIG_CODE`).

Definition at line 315 of file tsigerror.h.

References BAD_SIG_CODE.

Referenced by isc::dns::TSIGContext::getTSIGLength(), isc::dns::TSIGContext::sign(), and isc::dns::TSIGContext::verify().

## ◆ BAD_TIME()

const TSIGError & isc::dns::TSIGError::BAD_TIME | ( |  | ) |
| inlinestatic

A constant TSIG error object for the BADTIME code (see `TSIGError::BAD_TIME_CODE`).

Definition at line 327 of file tsigerror.h.

References BAD_TIME_CODE.

Referenced by isc::dns::TSIGContext::getTSIGLength(), isc::dns::TSIGContext::sign(), and isc::dns::TSIGContext::verify().

## ◆ BAD_TRUNC()

const TSIGError & isc::dns::TSIGError::BAD_TRUNC | ( |  | ) |
| inlinestatic

A constant TSIG error object for the BADTRUNC code (see `TSIGError::BAD_TRUNC_CODE`).

Definition at line 351 of file tsigerror.h.

References BAD_TRUNC_CODE.

Referenced by isc::dns::TSIGContext::verify().

## ◆ equals()

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

Return true iff two `TSIGError` objects are equal.

Two TSIGError objects are equal iff their error codes are equal.

Exceptions

  None |

Parameters

  other | the `TSIGError` object to compare against.

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

Definition at line 83 of file tsigerror.h.

Referenced by operator==().

## ◆ FORMERR()

const TSIGError & isc::dns::TSIGError::FORMERR | ( |  | ) |
| inlinestatic

A constant TSIG error object derived from `Rcode::FORMERR()`

Definition at line 225 of file tsigerror.h.

References isc::dns::Rcode::FORMERR().

Referenced by isc::dns::TSIGContext::verify().

Here is the call graph for this function:

## ◆ getCode()

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

Returns the `TSIGCode` error code value.

Exceptions

  None |

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

Definition at line 73 of file tsigerror.h.

## ◆ nequals()

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

Return true iff two `TSIGError` objects are not equal.

Exceptions

  None |

Parameters

  other | the `TSIGError` object to compare against.

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

Definition at line 96 of file tsigerror.h.

Referenced by operator!=().

## ◆ NOERROR()

const TSIGError & isc::dns::TSIGError::NOERROR | ( |  | ) |
| inlinestatic

A constant TSIG error object derived from `Rcode::NOERROR()`

Definition at line 219 of file tsigerror.h.

References isc::dns::Rcode::NOERROR().

Referenced by isc::dns::TSIGContext::TSIGContextImpl::TSIGContextImpl(), isc::d2::D2UpdateMessage::fromWire(), isc::dns::TSIGContext::TSIGContextImpl::postVerifyUpdate(), isc::dns::TSIGContext::sign(), and isc::dns::TSIGContext::verify().

Here is the call graph for this function:

## ◆ NOTAUTH()

const TSIGError & isc::dns::TSIGError::NOTAUTH | ( |  | ) |
| inlinestatic

A constant TSIG error object derived from `Rcode::NOTAUTH()`

Definition at line 273 of file tsigerror.h.

References isc::dns::Rcode::NOTAUTH().

Here is the call graph for this function:

## ◆ NOTIMP()

const TSIGError & isc::dns::TSIGError::NOTIMP | ( |  | ) |
| inlinestatic

A constant TSIG error object derived from `Rcode::NOTIMP()`

Definition at line 243 of file tsigerror.h.

References isc::dns::Rcode::NOTIMP().

Here is the call graph for this function:

## ◆ NOTZONE()

const TSIGError & isc::dns::TSIGError::NOTZONE | ( |  | ) |
| inlinestatic

A constant TSIG error object derived from `Rcode::NOTZONE()`

Definition at line 279 of file tsigerror.h.

References isc::dns::Rcode::NOTZONE().

Here is the call graph for this function:

## ◆ NXDOMAIN()

const TSIGError & isc::dns::TSIGError::NXDOMAIN | ( |  | ) |
| inlinestatic

A constant TSIG error object derived from `Rcode::NXDOMAIN()`

Definition at line 237 of file tsigerror.h.

References isc::dns::Rcode::NXDOMAIN().

Here is the call graph for this function:

## ◆ NXRRSET()

const TSIGError & isc::dns::TSIGError::NXRRSET | ( |  | ) |
| inlinestatic

A constant TSIG error object derived from `Rcode::NXRRSET()`

Definition at line 267 of file tsigerror.h.

References isc::dns::Rcode::NXRRSET().

Here is the call graph for this function:

## ◆ operator!=()

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

Same as `nequals()`.

Definition at line 100 of file tsigerror.h.

References nequals().

Here is the call graph for this function:

## ◆ operator==()

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

Same as `equals()`.

Definition at line 87 of file tsigerror.h.

References equals().

Here is the call graph for this function:

## ◆ REFUSED()

const TSIGError & isc::dns::TSIGError::REFUSED | ( |  | ) |
| inlinestatic

A constant TSIG error object derived from `Rcode::REFUSED()`

Definition at line 249 of file tsigerror.h.

References isc::dns::Rcode::REFUSED().

Here is the call graph for this function:

## ◆ RESERVED11()

const TSIGError & isc::dns::TSIGError::RESERVED11 | ( |  | ) |
| inlinestatic

A constant TSIG error object derived from `Rcode::RESERVED11()`

Definition at line 285 of file tsigerror.h.

References isc::dns::Rcode::RESERVED11().

Here is the call graph for this function:

## ◆ RESERVED12()

const TSIGError & isc::dns::TSIGError::RESERVED12 | ( |  | ) |
| inlinestatic

A constant TSIG error object derived from `Rcode::RESERVED12()`

Definition at line 291 of file tsigerror.h.

References isc::dns::Rcode::RESERVED12().

Here is the call graph for this function:

## ◆ RESERVED13()

const TSIGError & isc::dns::TSIGError::RESERVED13 | ( |  | ) |
| inlinestatic

A constant TSIG error object derived from `Rcode::RESERVED13()`

Definition at line 297 of file tsigerror.h.

References isc::dns::Rcode::RESERVED13().

Here is the call graph for this function:

## ◆ RESERVED14()

const TSIGError & isc::dns::TSIGError::RESERVED14 | ( |  | ) |
| inlinestatic

A constant TSIG error object derived from `Rcode::RESERVED14()`

Definition at line 303 of file tsigerror.h.

References isc::dns::Rcode::RESERVED14().

Here is the call graph for this function:

## ◆ RESERVED15()

const TSIGError & isc::dns::TSIGError::RESERVED15 | ( |  | ) |
| inlinestatic

A constant TSIG error object derived from `Rcode::RESERVED15()`

Definition at line 309 of file tsigerror.h.

References isc::dns::Rcode::RESERVED15().

Here is the call graph for this function:

## ◆ SERVFAIL()

const TSIGError & isc::dns::TSIGError::SERVFAIL | ( |  | ) |
| inlinestatic

A constant TSIG error object derived from `Rcode::SERVFAIL()`

Definition at line 231 of file tsigerror.h.

References isc::dns::Rcode::SERVFAIL().

Here is the call graph for this function:

## ◆ toRcode()

Rcode isc::dns::TSIGError::toRcode | ( |  | ) | const

Convert the `TSIGError` to a `Rcode`.

This method returns an `Rcode` object that is corresponding to the TSIG error. The returned `Rcode` is expected to be used by a verifying server to specify the RCODE of a response when TSIG verification fails.

Specifically, this method returns `Rcode::NOTAUTH()` for the TSIG specific errors, BADSIG, BADKEY, BADTIME, as described in RFC2845. For errors derived from the standard Rcode (code 0-15), it returns the corresponding `Rcode`. For others, this method returns `Rcode::SERVFAIL()` as a last resort.

Exceptions

  None |

Definition at line 51 of file tsigerror.cc.

References BAD_TRUNC_CODE, isc::dns::Rcode::NOTAUTH(), and isc::dns::Rcode::SERVFAIL().

Here is the call graph for this function:

## ◆ toText()

std::string isc::dns::TSIGError::toText | ( |  | ) | const

Convert the `TSIGError` to a string.

For codes derived from RCODEs up to 15, this method returns the same string as `Rcode::toText()` for the corresponding code. For other pre-defined code values (see TSIGError::CodeValue), this method returns a string representation of the "mnemonic' used for the enum and constant objects as defined in RFC2845. For example, the string for code value 16 is "BADSIG", etc. For other code values it returns a string representation of the decimal number of the value, e.g. "32", "100", etc.

Exceptions

  std::bad_alloc | Resource allocation for the string fails

Returns
  A string representation of the `TSIGError`.

Definition at line 40 of file tsigerror.cc.

References BAD_TRUNC_CODE, and toText().

Referenced by toText().

Here is the call graph for this function:

## ◆ YXDOMAIN()

const TSIGError & isc::dns::TSIGError::YXDOMAIN | ( |  | ) |
| inlinestatic

A constant TSIG error object derived from `Rcode::YXDOMAIN()`

Definition at line 255 of file tsigerror.h.

References isc::dns::Rcode::YXDOMAIN().

Here is the call graph for this function:

## ◆ YXRRSET()

const TSIGError & isc::dns::TSIGError::YXRRSET | ( |  | ) |
| inlinestatic

A constant TSIG error object derived from `Rcode::YXRRSET()`

Definition at line 261 of file tsigerror.h.

References isc::dns::Rcode::YXRRSET().

Here is the call graph for this function:

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

- tsigerror.h
- tsigerror.cc