Kea  1.9.9-git
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. More...
 
 Generic (isc::util::InputBuffer &buffer, size_t rdata_len)
 Constructor from wire-format data. More...
 
 Generic (MasterLexer &lexer, const Name *name, MasterLoader::Options options, MasterLoaderCallbacks &callbacks)
 Constructor from master lexer. More...
 
virtual ~Generic ()
 The destructor. More...
 
 Generic (const Generic &source)
 The copy constructor. More...
 
Genericoperator= (const Generic &source)
 The assignment operator. More...
 
Converter methods
virtual std::string toText () const
 Convert an generic::Generic object to a string. More...
 
virtual void toWire (isc::util::OutputBuffer &buffer) const
 Render the generic::Generic in the wire format into a buffer. More...
 
virtual void toWire (AbstractMessageRenderer &renderer) const
 Render the generic::Generic in the wire format into a MessageRenderer object. More...
 
Comparison method
virtual int compare (const Rdata &other) const
 Compare two instances of generic::Generic objects. More...
 
- Public Member Functions inherited from isc::dns::rdata::Rdata
virtual uint16_t getLength () const
 Get the wire format length of an Rdata. More...
 
virtual ~Rdata ()
 The destructor. More...
 

Additional Inherited Members

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

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 249 of file rdata.h.

Constructor & Destructor Documentation

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 280 of file rdata.cc.

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

+ Here is the call graph for this function:

isc::dns::rdata::generic::Generic::Generic ( isc::util::InputBuffer buffer,
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 InvalidBufferPosition will be thrown.

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

Definition at line 205 of file rdata.cc.

References isc_throw, isc::dns::rdata::MAX_RDLENGTH, and isc::util::InputBuffer::readData().

+ Here is the call graph for this function:

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

Constructor from master lexer.

Definition at line 307 of file rdata.cc.

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

The destructor.

Definition at line 314 of file rdata.cc.

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 318 of file rdata.cc.

Member Function Documentation

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 394 of file rdata.cc.

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 326 of file rdata.cc.

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 352 of file rdata.cc.

References isc::dns::rdata::generic::GenericImpl::data_.

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

void isc::dns::rdata::generic::Generic::toWire ( isc::util::OutputBuffer buffer) 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
bufferAn output buffer to store the wire data.

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

Definition at line 364 of file rdata.cc.

References isc::dns::rdata::generic::GenericImpl::data_, and isc::util::OutputBuffer::writeData().

+ Here is the call graph for this function:

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 369 of file rdata.cc.

References isc::dns::rdata::generic::GenericImpl::data_, and isc::dns::AbstractMessageRenderer::writeData().

+ Here is the call graph for this function:


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