Kea 2.7.5
isc::dns::rdata::any::TSIG Class Reference

rdata::TSIG class represents the TSIG RDATA as defined in RFC2845. More...

#include <rdataclass.h>

+ Inheritance diagram for isc::dns::rdata::any::TSIG:

Public Member Functions

 TSIG (const Name &algorithm, uint64_t time_signed, uint16_t fudge, uint16_t mac_size, const void *mac, uint16_t original_id, uint16_t error, uint16_t other_len, const void *other_data)
 Constructor from RDATA field parameters.
 
 TSIG (const std::string &type_str)
 
 TSIG (const TSIG &other)
 
 TSIG (isc::util::InputBuffer &buffer, size_t rdata_len)
 
 TSIG (MasterLexer &lexer, const Name *name, MasterLoader::Options options, MasterLoaderCallbacks &callbacks)
 
 ~TSIG ()
 The destructor.
 
virtual int compare (const Rdata &other) const
 Compare two instances of Rdata.
 
const NamegetAlgorithm () const
 Return the algorithm name.
 
uint16_t getError () const
 Return the value of the Error field.
 
uint16_t getFudge () const
 Return the value of the Fudge field.
 
const void * getMAC () const
 Return the value of the MAC field.
 
uint16_t getMACSize () const
 Return the value of the MAC Size field.
 
uint16_t getOriginalID () const
 Return the value of the Original ID field.
 
const void * getOtherData () const
 Return the value of the Other Data field.
 
uint16_t getOtherLen () const
 Return the value of the Other Len field.
 
uint64_t getTimeSigned () const
 Return the value of the Time Signed field.
 
TSIGoperator= (const TSIG &source)
 Assignment operator.
 
virtual std::string toText () const
 Convert an Rdata to a string.
 
virtual void toWire (AbstractMessageRenderer &renderer) const
 Render the Rdata in the wire format into a MessageRenderer object.
 
virtual void toWire (isc::util::OutputBuffer &buffer) const
 Render the Rdata in the wire format into a buffer.
 
- Public Member Functions inherited from isc::dns::rdata::Rdata
virtual uint16_t getLength () const
 Get the wire format length of an Rdata.
 
virtual ~Rdata ()
 The destructor.
 

Additional Inherited Members

- Protected Member Functions inherited from isc::dns::rdata::Rdata
 Rdata ()
 The default constructor.
 

Detailed Description

rdata::TSIG class represents the TSIG RDATA as defined in RFC2845.

This class implements the basic interfaces inherited from the abstract rdata::Rdata class, and provides trivial accessors specific to the TSIG RDATA.

Definition at line 44 of file rdataclass.h.

Constructor & Destructor Documentation

◆ TSIG() [1/5]

isc::dns::rdata::any::TSIG::TSIG ( const std::string & type_str)
explicit

◆ TSIG() [2/5]

isc::dns::rdata::any::TSIG::TSIG ( isc::util::InputBuffer & buffer,
size_t rdata_len )

◆ TSIG() [3/5]

isc::dns::rdata::any::TSIG::TSIG ( const TSIG & other)

◆ TSIG() [4/5]

isc::dns::rdata::any::TSIG::TSIG ( MasterLexer & lexer,
const Name * name,
MasterLoader::Options options,
MasterLoaderCallbacks & callbacks )

◆ TSIG() [5/5]

isc::dns::rdata::any::TSIG::TSIG ( const Name & algorithm,
uint64_t time_signed,
uint16_t fudge,
uint16_t mac_size,
const void * mac,
uint16_t original_id,
uint16_t error,
uint16_t other_len,
const void * other_data )

Constructor from RDATA field parameters.

The parameters are a straightforward mapping of TSIG RDATA fields as defined in RFC2845, but there are some implementation specific notes as follows.

algorithm is a Name object that specifies the algorithm. For example, if the algorithm is HMAC-SHA256, algorithm would be Name("hmac-sha256").

time_signed corresponds to the Time Signed field, which is of 48-bit unsigned integer type, and therefore cannot exceed 2^48-1; otherwise, an exception of type OutOfRange will be thrown.

mac_size and mac correspond to the MAC Size and MAC fields, respectively. When the MAC field is empty, mac must be null. mac_size and mac must be consistent in that mac_size is 0 if and only if mac is null; otherwise an exception of type InvalidParameter will be thrown.

The same restriction applies to other_len and other_data, which correspond to the Other Len and Other Data fields, respectively.

This constructor internally involves resource allocation, and if it fails, a corresponding standard exception will be thrown.

◆ ~TSIG()

isc::dns::rdata::any::TSIG::~TSIG ( )

The destructor.

Member Function Documentation

◆ compare()

virtual int isc::dns::rdata::any::TSIG::compare ( const Rdata & other) const
virtual

Compare two instances of Rdata.

This method compares this and the other Rdata objects in terms of the DNSSEC sorting order as defined in RFC4034, and returns the result as an integer.

This is a pure virtual method without the definition; the actual comparison logic is specific to each derived concrete class and should be explicitly defined in the derived class.

Specific implementations of this method must confirm that this and the other are objects of the same concrete derived class of Rdata. This is normally done by dynamic_cast in the implementation. It also means if the assumption isn't met an exception of class std::bad_cast will be thrown.

Here is an implementation choice: instead of relying on dynamic_cast, we could first convert the data into wire-format and compare the pair as opaque data. This would be more polymorphic, but might involve significant overhead, especially for a large size of RDATA.

Parameters
otherthe right-hand operand to compare against.
Returns
< 0 if this would be sorted before other.
0 if this is identical to other in terms of sorting order.
> 0 if this would be sorted after other.

Implements isc::dns::rdata::Rdata.

◆ getAlgorithm()

const Name & isc::dns::rdata::any::TSIG::getAlgorithm ( ) const

Return the algorithm name.

This method never throws an exception.

◆ getError()

uint16_t isc::dns::rdata::any::TSIG::getError ( ) const

Return the value of the Error field.

This method never throws an exception.

◆ getFudge()

uint16_t isc::dns::rdata::any::TSIG::getFudge ( ) const

Return the value of the Fudge field.

This method never throws an exception.

◆ getMAC()

const void * isc::dns::rdata::any::TSIG::getMAC ( ) const

Return the value of the MAC field.

If the MAC field is empty, it returns null. Otherwise, the memory region beginning at the address returned by this method is valid up to the bytes specified by the return value of getMACSize(). The memory region is only valid while the corresponding TSIG object is valid. The caller must hold the TSIG object while it needs to refer to the region or it must make a local copy of the region.

This method never throws an exception.

◆ getMACSize()

uint16_t isc::dns::rdata::any::TSIG::getMACSize ( ) const

Return the value of the MAC Size field.

This method never throws an exception.

◆ getOriginalID()

uint16_t isc::dns::rdata::any::TSIG::getOriginalID ( ) const

Return the value of the Original ID field.

This method never throws an exception.

◆ getOtherData()

const void * isc::dns::rdata::any::TSIG::getOtherData ( ) const

Return the value of the Other Data field.

The same note as getMAC() applies.

This method never throws an exception.

◆ getOtherLen()

uint16_t isc::dns::rdata::any::TSIG::getOtherLen ( ) const

Return the value of the Other Len field.

This method never throws an exception.

◆ getTimeSigned()

uint64_t isc::dns::rdata::any::TSIG::getTimeSigned ( ) const

Return the value of the Time Signed field.

The returned value does not exceed 2^48-1.

This method never throws an exception.

◆ operator=()

TSIG & isc::dns::rdata::any::TSIG::operator= ( const TSIG & source)

Assignment operator.

It internally allocates a resource, and if it fails a corresponding standard exception will be thrown. This operator never throws an exception otherwise.

This operator provides the strong exception guarantee: When an exception is thrown the content of the assignment target will be intact.

◆ toText()

virtual std::string isc::dns::rdata::any::TSIG::toText ( ) const
virtual

Convert an Rdata to a string.

This method returns a std::string object representing the Rdata.

This is a pure virtual method without the definition; the actual representation is specific to each derived concrete class and should be explicitly defined in the derived class.

Returns
A string representation of Rdata.

Implements isc::dns::rdata::Rdata.

◆ toWire() [1/2]

virtual void isc::dns::rdata::any::TSIG::toWire ( AbstractMessageRenderer & renderer) const
virtual

Render the Rdata in the wire format into a MessageRenderer object.

This is a pure virtual method without the definition; the actual conversion is specific to each derived concrete class and should be explicitly defined in the derived class.

Parameters
rendererDNS message rendering context that encapsulates the output buffer in which the Rdata is to be stored.

Implements isc::dns::rdata::Rdata.

◆ toWire() [2/2]

virtual void isc::dns::rdata::any::TSIG::toWire ( isc::util::OutputBuffer & buff) const
virtual

Render the Rdata in the wire format into a buffer.

This is a pure virtual method without the definition; the actual conversion is specific to each derived concrete class and should be explicitly defined in the derived class.

Parameters
buffAn output buffer to store the wire data.

Implements isc::dns::rdata::Rdata.


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