Kea: isc::dns::BasicRRset Class Reference

| Kea 3.2.0-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:
[legend]

## Public Member Functions
Getter and Setter Methods
virtual uint32_t | getRdataCount () const
| Returns the number of `Rdata` objects contained in the `RRset`.
virtual uint16_t | getLength () const
| Get the wire format length of the `BasicRRset`.
virtual const Name & | getName () const
| Returns the owner name of the `RRset`.
virtual const RRClass & | getClass () const
| Returns the RR Class of the `RRset`.
virtual const RRType & | getType () const
| Returns the RR Type of the `RRset`.
virtual const RRTTL & | getTTL () const
| Returns the TTL of the `RRset`.
virtual void | setTTL (const RRTTL &ttl)
| Updates the TTL of the `RRset`.
Converter Methods
virtual std::string | toText () const
| Convert the RRset to a string.
virtual uint32_t | toWire (AbstractMessageRenderer &renderer) const
| Render the RRset in the wire format with name compression and truncation handling.
virtual uint32_t | toWire (isc::util::OutputBuffer &buffer) const
| Render the RRset in the wire format without any compression.
RDATA manipulation methods
virtual void | addRdata (rdata::ConstRdataPtr rdata)
| Add an RDATA to the RRset (pointer version).
virtual void | addRdata (const rdata::Rdata &rdata)
| Add an RDATA to the RRset (reference version).
virtual void | addRdata (const std::string &rdata_str)
| Add an RDATA to the RRset (string version).
virtual RdataIteratorPtr | getRdataIterator () const
| Return an iterator to go through all RDATA stored in the `BasicRRset`.
Public Member Functions inherited from isc::dns::AbstractRRset
virtual bool | isSameKind (const AbstractRRset &other) const
| Check whether two RRsets are of the same kind.
virtual | ~AbstractRRset ()
| The destructor.

## 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.
virtual uint32_t | getRRsigDataCount () const
| Returns the number of `RRSIG` records associated with the `RRset`.
virtual void | addRRsig (const rdata::ConstRdataPtr &)
| Adds RRSIG RRset RRs to the associated RRSIG RRset.
virtual void | addRRsig (const rdata::RdataPtr &)
| Adds RRSIG RRset RRs to the associated RRSIG RRset.
virtual void | addRRsig (const AbstractRRset &)
| Adds RRSIG RRset RRs to the associated RRSIG RRset.
virtual void | addRRsig (const ConstRRsetPtr &)
| Adds RRSIG RRset RRs to the associated RRSIG RRset.
virtual void | addRRsig (const RRsetPtr &)
| Adds RRSIG RRset RRs to the associated RRSIG RRset.
virtual void | removeRRsig ()
| Clear the RRSIGs for this RRset.

## 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.
virtual | ~BasicRRset ()
| The destructor.

## Additional Inherited Members
| AbstractRRset ()
| The default constructor.

## 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 626 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

  name | The owner name of the RRset.
  rrclass | The RR class of the RRset.
  rrtype | The RR type of the RRset.
  ttl | The TTL of the RRset.

Definition at line 231 of file rrset.cc.

## ◆ ~BasicRRset()

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

The destructor.

Definition at line 236 of file rrset.cc.

## Member Function Documentation

## ◆ addRdata() [1/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 245 of file rrset.cc.

References isc::dns::AbstractRRset::addRdata().

Here is the call graph for this function:

## ◆ addRdata() [2/3]

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

Add an RDATA to the RRset (string version).

Parameters

  rdata_str | RDATA string in presentation format.

Exceptions

  InvalidRdataText | if the `rdata_str` is invalid for this `RRset`.

Implements isc::dns::AbstractRRset.

Definition at line 250 of file rrset.cc.

References addRdata(), isc::dns::rdata::createRdata(), getClass(), and getType().

Here is the call graph for this function:

## ◆ addRdata() [3/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

  rdata | A pointer (like) type of `rdata::RdataPtr` to be added to the `BasicRRset`.

Implements isc::dns::AbstractRRset.

Definition at line 240 of file rrset.cc.

Referenced by addRdata().

## ◆ addRRsig() [1/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

  sigs | 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 815 of file rrset.h.

References isc_throw.

## ◆ addRRsig() [2/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

  sigs | Pointer 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 820 of file rrset.h.

References isc_throw.

## ◆ addRRsig() [3/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

  rdata | Pointer to RRSIG rdata to be added.

Implements isc::dns::AbstractRRset.

Reimplemented in isc::dns::RRset.

Definition at line 805 of file rrset.h.

References isc_throw.

## ◆ addRRsig() [4/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

  rdata | Pointer to RRSIG rdata to be added.

Implements isc::dns::AbstractRRset.

Reimplemented in isc::dns::RRset.

Definition at line 810 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

  sigs | Pointer 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 825 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 265 of file rrset.cc.

Referenced by addRdata(), isc::dns::RRset::addRRsig(), isc::dns::RRset::addRRsig(), and getLength().

## ◆ 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

  EmptyRRset | if the `BasicRRset` is empty.

Implements isc::dns::AbstractRRset.

Reimplemented in isc::dns::RRset.

Definition at line 290 of file rrset.cc.

References isc::dns::RRClass::ANY(), getClass(), isc::dns::Name::getLength(), getName(), getRdataIterator(), isc_throw, isc_throw_assert, and isc::dns::RRClass::NONE().

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

Here is the call graph for this function:

## ◆ 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 260 of file rrset.cc.

Referenced by isc::dns::RRset::addRRsig(), isc::dns::RRset::addRRsig(), and getLength().

## ◆ getRdataCount()

uint32_t 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 255 of file rrset.cc.

Referenced by isc::dns::RRset::toWire(), and 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 460 of file rrset.cc.

Referenced by getLength().

## ◆ 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 792 of file rrset.h.

## ◆ getRRsigDataCount()

virtual uint32_t 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 801 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 275 of file rrset.cc.

Referenced by isc::dns::RRset::addRRsig(), and isc::dns::RRset::addRRsig().

## ◆ 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 270 of file rrset.cc.

Referenced by addRdata().

## ◆ 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 830 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

  ttl | A 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 280 of file rrset.cc.

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

## ◆ 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 285 of file rrset.cc.

References isc::dns::AbstractRRset::toText().

Here is the call graph for this function:

## ◆ toWire() [1/2]

uint32_t 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 339 of file rrset.cc.

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

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

Here is the call graph for this function:

## ◆ toWire() [2/2]

uint32_t 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 334 of file rrset.cc.

References isc::dns::AbstractRRset::toWire().

Here is the call graph for this function:

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

- rrset.h
- rrset.cc