Kea 2.7.5
isc::dns::rdata::generic::OPT Class Reference

#include <rdataclass.h>

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

Classes

class  PseudoRR
 A class representing a pseudo RR (or option) within an OPT RR (see RFC 6891). More...
 

Public Member Functions

 OPT ()
 
 OPT (const OPT &other)
 
 OPT (const std::string &type_str)
 
 OPT (isc::util::InputBuffer &buffer, size_t rdata_len)
 
 OPT (MasterLexer &lexer, const Name *name, MasterLoader::Options options, MasterLoaderCallbacks &callbacks)
 
 ~OPT ()
 
void appendPseudoRR (uint16_t code, const uint8_t *data, uint16_t length)
 Append a pseudo RR (option) in this OPT RR.
 
virtual int compare (const Rdata &other) const
 Compare two instances of Rdata.
 
const std::vector< PseudoRR > & getPseudoRRs () const
 Return a vector of the pseudo RRs (options) in this OPT RR.
 
OPToperator= (const OPT &source)
 
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

Definition at line 245 of file rdataclass.h.

Constructor & Destructor Documentation

◆ OPT() [1/5]

isc::dns::rdata::generic::OPT::OPT ( const std::string & type_str)
explicit

◆ OPT() [2/5]

isc::dns::rdata::generic::OPT::OPT ( isc::util::InputBuffer & buffer,
size_t rdata_len )

◆ OPT() [3/5]

isc::dns::rdata::generic::OPT::OPT ( const OPT & other)

◆ OPT() [4/5]

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

◆ OPT() [5/5]

isc::dns::rdata::generic::OPT::OPT ( )

◆ ~OPT()

isc::dns::rdata::generic::OPT::~OPT ( )

Member Function Documentation

◆ appendPseudoRR()

void isc::dns::rdata::generic::OPT::appendPseudoRR ( uint16_t code,
const uint8_t * data,
uint16_t length )

Append a pseudo RR (option) in this OPT RR.

Parameters
codeThe OPTION-CODE field of the pseudo RR.
dataThe OPTION-DATA field of the pseudo RR.
lengthThe size of the data argument. OPTION-LENGTH is set to this size.
Exceptions
isc::InvalidParameterif this pseudo RR would cause the OPT RDATA to overflow its RDLENGTH.

◆ compare()

virtual int isc::dns::rdata::generic::OPT::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.

◆ getPseudoRRs()

const std::vector< PseudoRR > & isc::dns::rdata::generic::OPT::getPseudoRRs ( ) const

Return a vector of the pseudo RRs (options) in this OPT RR.

Note: The returned reference is only valid during the lifetime of this generic::OPT object. It should not be used afterwards.

◆ operator=()

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

◆ toText()

virtual std::string isc::dns::rdata::generic::OPT::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::generic::OPT::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::generic::OPT::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: