Kea 2.7.6
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.
 
 TSIGError (Rcode rcode)
 Constructor from Rcode.
 
uint16_t getCode () const
 Returns the TSIGCode error code value.
 
bool equals (const TSIGError &other) const
 Return true iff two TSIGError objects are equal.
 
bool operator== (const TSIGError &other) const
 Same as equals().
 
bool nequals (const TSIGError &other) const
 Return true iff two TSIGError objects are not equal.
 
bool operator!= (const TSIGError &other) const
 Same as nequals().
 
std::string toText () const
 Convert the TSIGError to a string.
 
Rcode toRcode () const
 Convert the TSIGError to a Rcode.
 
static const TSIGErrorNOERROR ()
 A constant TSIG error object derived from Rcode::NOERROR()
 
static const TSIGErrorFORMERR ()
 A constant TSIG error object derived from Rcode::FORMERR()
 
static const TSIGErrorSERVFAIL ()
 A constant TSIG error object derived from Rcode::SERVFAIL()
 
static const TSIGErrorNXDOMAIN ()
 A constant TSIG error object derived from Rcode::NXDOMAIN()
 
static const TSIGErrorNOTIMP ()
 A constant TSIG error object derived from Rcode::NOTIMP()
 
static const TSIGErrorREFUSED ()
 A constant TSIG error object derived from Rcode::REFUSED()
 
static const TSIGErrorYXDOMAIN ()
 A constant TSIG error object derived from Rcode::YXDOMAIN()
 
static const TSIGErrorYXRRSET ()
 A constant TSIG error object derived from Rcode::YXRRSET()
 
static const TSIGErrorNXRRSET ()
 A constant TSIG error object derived from Rcode::NXRRSET()
 
static const TSIGErrorNOTAUTH ()
 A constant TSIG error object derived from Rcode::NOTAUTH()
 
static const TSIGErrorNOTZONE ()
 A constant TSIG error object derived from Rcode::NOTZONE()
 
static const TSIGErrorRESERVED11 ()
 A constant TSIG error object derived from Rcode::RESERVED11()
 
static const TSIGErrorRESERVED12 ()
 A constant TSIG error object derived from Rcode::RESERVED12()
 
static const TSIGErrorRESERVED13 ()
 A constant TSIG error object derived from Rcode::RESERVED13()
 
static const TSIGErrorRESERVED14 ()
 A constant TSIG error object derived from Rcode::RESERVED14()
 
static const TSIGErrorRESERVED15 ()
 A constant TSIG error object derived from Rcode::RESERVED15()
 
static const TSIGErrorBAD_SIG ()
 A constant TSIG error object for the BADSIG code (see TSIGError::BAD_SIG_CODE).
 
static const TSIGErrorBAD_KEY ()
 A constant TSIG error object for the BADKEY code (see TSIGError::BAD_KEY_CODE).
 
static const TSIGErrorBAD_TIME ()
 A constant TSIG error object for the BADTIME code (see TSIGError::BAD_TIME_CODE).
 
static const TSIGErrorBAD_MODE ()
 A constant TSIG error object for the BADMODE code (see TSIGError::BAD_MODE_CODE).
 
static const TSIGErrorBAD_NAME ()
 A constant TSIG error object for the BADNAME code (see TSIGError::BAD_NAME_CODE).
 
static const TSIGErrorBAD_ALG ()
 A constant TSIG error object for the BADALG code (see TSIGError::BAD_ALG_CODE).
 
static const TSIGErrorBAD_TRUNC ()
 A constant TSIG error object for the BADTRUNC code (see TSIGError::BAD_TRUNC_CODE).
 

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

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_codeThe 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::OutOfRangeGiven rcode is not convertible to TSIGErrors.
Parameters
rcodethe 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 353 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 329 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 341 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 347 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 323 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 335 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 359 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
otherthe TSIGError object to compare against.
Returns
true if the two TSIGError are equal; otherwise false.

Definition at line 85 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 233 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
otherthe TSIGError object to compare against.
Returns
true if the two TSIGError objects are not equal; otherwise false.

Definition at line 101 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 227 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 281 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 251 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 287 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 245 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 275 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 106 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 90 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 257 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 293 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 299 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 305 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 311 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 317 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 239 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_allocResource 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 263 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 269 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: