Kea 2.7.0
isc::dns::rdata::generic::Generic Class Reference

The generic::Generic class represents generic "unknown" RDATA. More...

#include <rdata.h>

+ Inheritance diagram for isc::dns::rdata::generic::Generic:

Public Member Functions

Constructors, Assignment Operator and Destructor.
 Generic (const std::string &rdata_string)
 Constructor from a string.
 
 Generic (isc::util::InputBuffer &buff, size_t rdata_len)
 Constructor from wire-format data.
 
 Generic (MasterLexer &lexer, const Name *name, MasterLoader::Options options, MasterLoaderCallbacks &callbacks)
 Constructor from master lexer.
 
virtual ~Generic ()
 The destructor.
 
 Generic (const Generic &source)
 The copy constructor.
 
Genericoperator= (const Generic &source)
 The assignment operator.
 
Converter methods
virtual std::string toText () const
 Convert an generic::Generic object to a string.
 
virtual void toWire (isc::util::OutputBuffer &buff) const
 Render the generic::Generic in the wire format into a buffer.
 
virtual void toWire (AbstractMessageRenderer &renderer) const
 Render the generic::Generic in the wire format into a MessageRenderer object.
 
- 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.
 

Comparison method

virtual int compare (const Rdata &other) const
 Compare two instances of generic::Generic objects.
 

Additional Inherited Members

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

Detailed Description

The generic::Generic class represents generic "unknown" RDATA.

This class is used as a placeholder for all non well-known type of RDATA. By definition, the stored data is regarded as opaque binary without assuming any structure.

Definition at line 246 of file rdata.h.

Constructor & Destructor Documentation

◆ Generic() [1/4]

isc::dns::rdata::generic::Generic::Generic ( const std::string & rdata_string)
explicit

Constructor from a string.

This method constructs a generic::Generic object from a textual representation as defined in RFC3597.

If rdata_string isn't a valid textual representation of this type of RDATA, an exception of class InvalidRdataText or InvalidRdataLength will be thrown. If resource allocation to store the data fails, a corresponding standard exception will be thrown.

Parameters
rdata_stringA string of textual representation of generic RDATA.

Definition at line 273 of file rdata.cc.

References isc::dns::MasterToken::END_OF_FILE, isc_throw, isc::dns::MasterLexer::pushSource(), and isc::Exception::what().

+ Here is the call graph for this function:

◆ Generic() [2/4]

isc::dns::rdata::generic::Generic::Generic ( isc::util::InputBuffer & buff,
size_t rdata_len )

Constructor from wire-format data.

The buffer parameter normally stores a complete DNS message containing the generic RDATA to be constructed. The current read position of the buffer points to the head of the data.

This method reads rdata_len bytes from the buffer, and internally stores the data as an opaque byte sequence.

rdata_len must not exceed MAX_RDLENGTH; otherwise, an exception of class InvalidRdataLength will be thrown. If resource allocation to hold the data fails, a corresponding standard exception will be thrown; if the buffer doesn't contain rdata_len bytes of unread data, an exception of class isc::OutOfRange will be thrown.

Parameters
buffA reference to an InputBuffer object storing the Rdata to parse.
rdata_lenThe length in buffer of the Rdata. In bytes.

Definition at line 198 of file rdata.cc.

References isc_throw, and isc::dns::rdata::MAX_RDLENGTH.

◆ Generic() [3/4]

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

Constructor from master lexer.

Definition at line 291 of file rdata.cc.

◆ ~Generic()

isc::dns::rdata::generic::Generic::~Generic ( )
virtual

The destructor.

Definition at line 297 of file rdata.cc.

◆ Generic() [4/4]

isc::dns::rdata::generic::Generic::Generic ( const Generic & source)

The copy constructor.

If resource allocation to copy the data fails, a corresponding standard exception will be thrown.

Parameters
sourceA reference to a generic::Generic object to copy from.

Definition at line 300 of file rdata.cc.

Member Function Documentation

◆ compare()

int isc::dns::rdata::generic::Generic::compare ( const Rdata & other) const
virtual

Compare two instances of generic::Generic objects.

As defined in RFC4034, this method simply compares the wire-format representations of the two objects as left-justified unsigned octet sequences.

The object referenced by other must have been instantiated as a c generic::Generic class object; otherwise, an exception of class std::bad_cast will be thrown. Note that the comparison is RR type/class agnostic: this method doesn't check whether the two Rdata objects to compare are of the comparable RR type/class. For example, this object may come from an RRset of RRType x, and the other may come from a different RRset of RRType y (where x != y). This situation would be considered a bug, but this method cannot detect this type of error. The caller must ensure this condition.

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.

Definition at line 374 of file rdata.cc.

◆ operator=()

Generic & isc::dns::rdata::generic::Generic::operator= ( const Generic & source)

The assignment operator.

If resource allocation to copy the data fails, a corresponding standard exception will be thrown.

Parameters
sourceA reference to a generic::Generic object to copy from.

Definition at line 308 of file rdata.cc.

◆ toText()

string isc::dns::rdata::generic::Generic::toText ( ) const
virtual

Convert an generic::Generic object to a string.

This method converts a generic "unknown" RDATA object into a textual representation of such unknown data as defined in RFC3597.

If resource allocation to copy the data fails, a corresponding standard exception will be thrown.

Returns
A string representation of generic::Generic.

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

Definition at line 332 of file rdata.cc.

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

◆ toWire() [1/2]

void isc::dns::rdata::generic::Generic::toWire ( AbstractMessageRenderer & renderer) const
virtual

Render the generic::Generic in the wire format into a MessageRenderer object.

This will require rdata_len bytes of remaining capacity in the buffer. If this is not the case and resource allocation for the necessary memory space fails, a corresponding standard exception will be thrown.

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

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

Definition at line 349 of file rdata.cc.

◆ toWire() [2/2]

void isc::dns::rdata::generic::Generic::toWire ( isc::util::OutputBuffer & buff) const
virtual

Render the generic::Generic in the wire format into a buffer.

This will require rdata_len bytes of remaining capacity in the buffer. If this is not the case and resource allocation for the necessary memory space fails, a corresponding standard exception will be thrown.

Parameters
buffAn output buffer to store the wire data.

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

Definition at line 344 of file rdata.cc.


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