Kea 2.7.5
|
The generic::Generic
class represents generic "unknown" RDATA.
More...
#include <rdata.h>
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. | |
Generic & | operator= (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. | |
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.
|
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.
rdata_string | A 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().
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.
buff | A reference to an InputBuffer object storing the Rdata to parse. |
rdata_len | The 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.
isc::dns::rdata::generic::Generic::Generic | ( | MasterLexer & | lexer, |
const Name * | name, | ||
MasterLoader::Options | options, | ||
MasterLoaderCallbacks & | callbacks ) |
|
virtual |
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.
source | A reference to a generic::Generic object to copy from. |
|
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.
other | the right-hand operand to compare against. |
this
would be sorted before other
. this
is identical to other
in terms of sorting order. this
would be sorted after other
. Implements isc::dns::rdata::Rdata.
The assignment operator.
If resource allocation to copy the data fails, a corresponding standard exception will be thrown.
source | A reference to a generic::Generic object to copy from. |
|
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.
generic::Generic
. Implements isc::dns::rdata::Rdata.
Definition at line 332 of file rdata.cc.
Referenced by isc::dns::rdata::generic::operator<<().
|
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.
renderer | DNS message rendering context that encapsulates the output buffer in which the Generic object is to be stored. |
Implements isc::dns::rdata::Rdata.
|
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.
buff | An output buffer to store the wire data. |
Implements isc::dns::rdata::Rdata.