Kea  2.3.5-git
isc::dns::BasicRRset Class Reference

The BasicRRset class is a concrete derived class of AbstractRRset that defines a straightforward RRset implementation. More...

#include <rrset.h>

+ Inheritance diagram for isc::dns::BasicRRset:

Public Member Functions

Getter and Setter Methods
virtual unsigned int getRdataCount () const
 Returns the number of Rdata objects contained in the RRset. More...
 
virtual uint16_t getLength () const
 Get the wire format length of the BasicRRset. More...
 
virtual const NamegetName () const
 Returns the owner name of the RRset. More...
 
virtual const RRClassgetClass () const
 Returns the RR Class of the RRset. More...
 
virtual const RRTypegetType () const
 Returns the RR Type of the RRset. More...
 
virtual const RRTTLgetTTL () const
 Returns the TTL of the RRset. More...
 
virtual void setTTL (const RRTTL &ttl)
 Updates the TTL of the RRset. More...
 
Converter Methods
virtual std::string toText () const
 Convert the RRset to a string. More...
 
virtual unsigned int toWire (AbstractMessageRenderer &renderer) const
 Render the RRset in the wire format with name compression and truncation handling. More...
 
virtual unsigned int toWire (isc::util::OutputBuffer &buffer) const
 Render the RRset in the wire format without any compression. More...
 
RDATA manipulation methods
virtual void addRdata (rdata::ConstRdataPtr rdata)
 Add an RDATA to the RRset (pointer version). More...
 
virtual void addRdata (const rdata::Rdata &rdata)
 Add an RDATA to the RRset (reference version). More...
 
virtual void addRdata (const std::string &rdata_str)
 Add an RDATA to the RRset (string version). More...
 
virtual RdataIteratorPtr getRdataIterator () const
 Return an iterator to go through all RDATA stored in the BasicRRset. More...
 
Associated RRSIG methods

The associated RRSIG RRset is not supported in BasicRRset.

For ease of use, getRRsig() returns a null pointer (indicating no RRset). The addRRsig()/removeRRsig() methods throw a "NotImplemented" exception - if you are using a BasicRRset, you should not be trying to modify signatures on it.

virtual RRsetPtr getRRsig () const
 Return pointer to this RRset's RRSIG RRset. More...
 
virtual unsigned int getRRsigDataCount () const
 Returns the number of RRSIG records associated with the RRset. More...
 
virtual void addRRsig (const rdata::ConstRdataPtr &)
 Adds RRSIG RRset RRs to the associated RRSIG RRset. More...
 
virtual void addRRsig (const rdata::RdataPtr &)
 Adds RRSIG RRset RRs to the associated RRSIG RRset. More...
 
virtual void addRRsig (const AbstractRRset &)
 Adds RRSIG RRset RRs to the associated RRSIG RRset. More...
 
virtual void addRRsig (const ConstRRsetPtr &)
 Adds RRSIG RRset RRs to the associated RRSIG RRset. More...
 
virtual void addRRsig (const RRsetPtr &)
 Adds RRSIG RRset RRs to the associated RRSIG RRset. More...
 
virtual void removeRRsig ()
 Clear the RRSIGs for this RRset. More...
 
- Public Member Functions inherited from isc::dns::AbstractRRset
virtual bool isSameKind (const AbstractRRset &other) const
 Check whether two RRsets are of the same kind. More...
 
virtual ~AbstractRRset ()
 The destructor. More...
 

Constructors and Destructor

Note: The copy constructor and the assignment operator are intentionally defined as private.

The intended use case wouldn't require copies of a BasicRRset object; once created, it would normally be used as a const object (via references).

 BasicRRset (const Name &name, const RRClass &rrclass, const RRType &rrtype, const RRTTL &ttl)
 Constructor from (mostly) fixed parameters of the RRset. More...
 
virtual ~BasicRRset ()
 The destructor. More...
 

Additional Inherited Members

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

Detailed Description

The BasicRRset class is a concrete derived class of AbstractRRset that defines a straightforward RRset implementation.

This class is designed to be as portable as possible, and so it adopts the Pimpl idiom to hide as many details as possible. Performance is a secondary concern for this class.

This class is intended to be used by applications that only need moderate level of performance with full functionality provided by the AbstractRRset interfaces. Highly performance-sensitive applications, such as a large scale authoritative or caching name servers will implement and use a customized version of derived AbstractRRset class.

Definition at line 629 of file rrset.h.

Constructor & Destructor Documentation

◆ BasicRRset()

isc::dns::BasicRRset::BasicRRset ( const Name name,
const RRClass rrclass,
const RRType rrtype,
const RRTTL ttl 
)

Constructor from (mostly) fixed parameters of the RRset.

This constructor is normally expected to be exception free, but copying the name may involve resource allocation, and if it fails the corresponding standard exception will be thrown.

Parameters
nameThe owner name of the RRset.
rrclassThe RR class of the RRset.
rrtypeThe RR type of the RRset.
ttlThe TTL of the RRset.

Definition at line 231 of file rrset.cc.

◆ ~BasicRRset()

isc::dns::BasicRRset::~BasicRRset ( )
virtual

The destructor.

Definition at line 237 of file rrset.cc.

Member Function Documentation

◆ addRdata() [1/3]

void isc::dns::BasicRRset::addRdata ( rdata::ConstRdataPtr  rdata)
virtual

Add an RDATA to the RRset (pointer version).

This method is normally expected to be exception free, but it may involve resource allocation, and if it fails the corresponding standard exception will be thrown.

Parameters
rdataA pointer (like) type of rdata::RdataPtr to be added to the BasicRRset.

Implements isc::dns::AbstractRRset.

Definition at line 242 of file rrset.cc.

◆ addRdata() [2/3]

void isc::dns::BasicRRset::addRdata ( const rdata::Rdata rdata)
virtual

Add an RDATA to the RRset (reference version).

This method simply uses the default implementation. See AbstractRRset::addRdata(const rdata::Rdata&).

Implements isc::dns::AbstractRRset.

Definition at line 247 of file rrset.cc.

◆ addRdata() [3/3]

void isc::dns::BasicRRset::addRdata ( const std::string &  rdata_str)
virtual

Add an RDATA to the RRset (string version).

Parameters
rdata_strRDATA string in presentation format.
Exceptions
InvalidRdataTextif the rdata_str is invalid for this RRset.

Implements isc::dns::AbstractRRset.

Definition at line 252 of file rrset.cc.

References isc::dns::rdata::createRdata().

+ Here is the call graph for this function:

◆ addRRsig() [1/5]

virtual void isc::dns::BasicRRset::addRRsig ( const rdata::ConstRdataPtr rdata)
inlinevirtual

Adds RRSIG RRset RRs to the associated RRSIG RRset.

Adds the (assumed) RRSIG rdata the RRSIG RRset associated with this RRset. If one does not exist, it is created using the data given.

Parameters
rdataPointer to RRSIG rdata to be added.

Implements isc::dns::AbstractRRset.

Reimplemented in isc::dns::RRset.

Definition at line 808 of file rrset.h.

References isc_throw.

◆ addRRsig() [2/5]

virtual void isc::dns::BasicRRset::addRRsig ( const rdata::RdataPtr rdata)
inlinevirtual

Adds RRSIG RRset RRs to the associated RRSIG RRset.

Adds the (assumed) RRSIG rdata the RRSIG RRset associated with this RRset. If one does not exist, it is created using the data given.

(This overload is for an older version of boost that doesn't support conversion from shared_ptr<X> to shared_ptr<const X>.)

Parameters
rdataPointer to RRSIG rdata to be added.

Implements isc::dns::AbstractRRset.

Reimplemented in isc::dns::RRset.

Definition at line 813 of file rrset.h.

References isc_throw.

◆ addRRsig() [3/5]

virtual void isc::dns::BasicRRset::addRRsig ( const AbstractRRset sigs)
inlinevirtual

Adds RRSIG RRset RRs to the associated RRSIG RRset.

Adds the signatures in the given (assumed) RRSIG RRset to the RRSIG RRset associated with this RRset. If one does not exist, it is created using the data given.

Parameters
sigsRRSIG RRset containing signatures to be added to the RRSIG RRset associated with this class.

Implements isc::dns::AbstractRRset.

Reimplemented in isc::dns::RRset.

Definition at line 818 of file rrset.h.

References isc_throw.

◆ addRRsig() [4/5]

virtual void isc::dns::BasicRRset::addRRsig ( const ConstRRsetPtr sigs)
inlinevirtual

Adds RRSIG RRset RRs to the associated RRSIG RRset.

Adds the signatures in the given (assumed) RRSIG RRset to the RRSIG RRset associated with this RRset. If one does not exist, it is created using the data given.

Parameters
sigsPointer to a RRSIG RRset containing signatures to be added to the RRSIG RRset associated with this class.

Implements isc::dns::AbstractRRset.

Reimplemented in isc::dns::RRset.

Definition at line 823 of file rrset.h.

References isc_throw.

◆ addRRsig() [5/5]

virtual void isc::dns::BasicRRset::addRRsig ( const RRsetPtr sigs)
inlinevirtual

Adds RRSIG RRset RRs to the associated RRSIG RRset.

Adds the signatures in the given (assumed) RRSIG RRset to the RRSIG RRset associated with this RRset. If one does not exist, it is created using the data given.

(This overload is for an older version of boost that doesn't support conversion from shared_ptr<X> to shared_ptr<const X>.)

Parameters
sigsPointer to a RRSIG RRset containing signatures to be added to the RRSIG RRset associated with this class.

Implements isc::dns::AbstractRRset.

Reimplemented in isc::dns::RRset.

Definition at line 828 of file rrset.h.

References isc_throw.

◆ getClass()

const RRClass & isc::dns::BasicRRset::getClass ( ) const
virtual

Returns the RR Class of the RRset.

This method never throws an exception.

Returns
A reference to a RRClass class object corresponding to the RR class of the RRset.

Implements isc::dns::AbstractRRset.

Definition at line 267 of file rrset.cc.

◆ getLength()

uint16_t isc::dns::BasicRRset::getLength ( ) const
virtual

Get the wire format length of the BasicRRset.

Returns
The length of the wire format representation of the BasicRRset.
Exceptions
EmptyRRsetif the BasicRRset is empty.

Implements isc::dns::AbstractRRset.

Reimplemented in isc::dns::RRset.

Definition at line 292 of file rrset.cc.

References isc_throw, and isc::log::NONE.

Referenced by isc::dns::RRset::getLength().

◆ getName()

const Name & isc::dns::BasicRRset::getName ( ) const
virtual

Returns the owner name of the RRset.

This method never throws an exception.

Returns
A reference to a Name class object corresponding to the RRset owner name.

Implements isc::dns::AbstractRRset.

Definition at line 262 of file rrset.cc.

◆ getRdataCount()

unsigned int isc::dns::BasicRRset::getRdataCount ( ) const
virtual

Returns the number of Rdata objects contained in the RRset.

This method never throws an exception.

Returns
The number of Rdata objects contained.

Implements isc::dns::AbstractRRset.

Definition at line 257 of file rrset.cc.

Referenced by isc::dns::RRset::toWire().

◆ getRdataIterator()

RdataIteratorPtr isc::dns::BasicRRset::getRdataIterator ( ) const
virtual

Return an iterator to go through all RDATA stored in the BasicRRset.

This is a concrete derived implementation of AbstractRRset::getRdataIterator().

This method dynamically allocates resources. If it fails it will throw the corresponding standard exception. The iterator methods for the BasicRRset class are exception free.

Returns
A pointer-like object pointing to the derived RdataIterator object for the BasicRRset class.

Implements isc::dns::AbstractRRset.

Definition at line 461 of file rrset.cc.

◆ getRRsig()

virtual RRsetPtr isc::dns::BasicRRset::getRRsig ( ) const
inlinevirtual

Return pointer to this RRset's RRSIG RRset.

Returns
Null pointer, as this class does not support RRSIG records.

Implements isc::dns::AbstractRRset.

Reimplemented in isc::dns::RRset.

Definition at line 795 of file rrset.h.

◆ getRRsigDataCount()

virtual unsigned int isc::dns::BasicRRset::getRRsigDataCount ( ) const
inlinevirtual

Returns the number of RRSIG records associated with the RRset.

Returns
Always returns 0. Associated RRSIG RRsets are not supported in this class.

Implements isc::dns::AbstractRRset.

Reimplemented in isc::dns::RRset.

Definition at line 804 of file rrset.h.

◆ getTTL()

const RRTTL & isc::dns::BasicRRset::getTTL ( ) const
virtual

Returns the TTL of the RRset.

This method never throws an exception.

Returns
A reference to a RRTTL class object corresponding to the TTL of the RRset.

Implements isc::dns::AbstractRRset.

Definition at line 277 of file rrset.cc.

◆ getType()

const RRType & isc::dns::BasicRRset::getType ( ) const
virtual

Returns the RR Type of the RRset.

This method never throws an exception.

Returns
A reference to a RRType class object corresponding to the RR type of the RRset.

Implements isc::dns::AbstractRRset.

Definition at line 272 of file rrset.cc.

◆ removeRRsig()

virtual void isc::dns::BasicRRset::removeRRsig ( )
inlinevirtual

Clear the RRSIGs for this RRset.

Implements isc::dns::AbstractRRset.

Reimplemented in isc::dns::RRset.

Definition at line 833 of file rrset.h.

References isc_throw.

◆ setTTL()

void isc::dns::BasicRRset::setTTL ( const RRTTL ttl)
virtual

Updates the TTL of the RRset.

This method never throws an exception.

Parameters
ttlA reference to a RRTTL class object to be copied as the new TTL.

Implements isc::dns::AbstractRRset.

Reimplemented in isc::dns::RRset.

Definition at line 282 of file rrset.cc.

◆ toText()

string isc::dns::BasicRRset::toText ( ) const
virtual

Convert the RRset to a string.

This method simply uses the default implementation. See AbstractRRset::toText().

Implements isc::dns::AbstractRRset.

Definition at line 287 of file rrset.cc.

◆ toWire() [1/2]

unsigned int isc::dns::BasicRRset::toWire ( AbstractMessageRenderer renderer) const
virtual

Render the RRset in the wire format with name compression and truncation handling.

This method simply uses the default implementation. See AbstractRRset::toWire(MessageRenderer&)const.

Implements isc::dns::AbstractRRset.

Reimplemented in isc::dns::RRset.

Definition at line 341 of file rrset.cc.

References isc::dns::AbstractMessageRenderer::getLengthLimit(), and isc::dns::AbstractMessageRenderer::setTruncated().

Referenced by isc::dns::RRset::toWire().

+ Here is the call graph for this function:

◆ toWire() [2/2]

unsigned int isc::dns::BasicRRset::toWire ( isc::util::OutputBuffer buffer) const
virtual

Render the RRset in the wire format without any compression.

This method simply uses the default implementation. See AbstractRRset::toWire(OutputBuffer&)const.

Implements isc::dns::AbstractRRset.

Reimplemented in isc::dns::RRset.

Definition at line 336 of file rrset.cc.


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