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

libdns++ implementation of RRsetCollectionBase using an STL container. More...

#include <rrset_collection.h>

+ Inheritance diagram for isc::dns::RRsetCollection:

Classes

class  DnsIter
 

Public Member Functions

 RRsetCollection ()
 Constructor. More...
 
 RRsetCollection (const char *filename, const isc::dns::Name &origin, const isc::dns::RRClass &rrclass)
 Constructor. More...
 
 RRsetCollection (std::istream &input_stream, const isc::dns::Name &origin, const isc::dns::RRClass &rrclass)
 Constructor. More...
 
virtual ~RRsetCollection ()
 Destructor. More...
 
void addRRset (isc::dns::RRsetPtr rrset)
 Add an RRset to the collection. More...
 
virtual isc::dns::ConstRRsetPtr find (const isc::dns::Name &name, const isc::dns::RRClass &rrclass, const isc::dns::RRType &rrtype) const
 Find a matching RRset in the collection. More...
 
isc::dns::RRsetPtr find (const isc::dns::Name &name, const isc::dns::RRClass &rrclass, const isc::dns::RRType &rrtype)
 Find a matching RRset in the collection (non-const variant). More...
 
bool removeRRset (const isc::dns::Name &name, const isc::dns::RRClass &rrclass, const isc::dns::RRType &rrtype)
 Remove an RRset from the collection. More...
 
- Public Member Functions inherited from isc::dns::RRsetCollectionBase
virtual ~RRsetCollectionBase ()
 Destructor. More...
 
Iterator begin ()
 Returns an iterator pointing to the beginning of the collection. More...
 
Iterator end ()
 Returns an iterator pointing past the end of the collection. More...
 

Protected Member Functions

virtual RRsetCollectionBase::IterPtr getBeginning ()
 Returns an IterPtr wrapping an Iter pointing to the beginning of the collection. More...
 
virtual RRsetCollectionBase::IterPtr getEnd ()
 Returns an IterPtr wrapping an Iter pointing past the end of the collection. More...
 

Additional Inherited Members

- Protected Types inherited from isc::dns::RRsetCollectionBase
typedef boost::shared_ptr< IterIterPtr
 Wraps Iter with a reference count. More...
 

Detailed Description

libdns++ implementation of RRsetCollectionBase using an STL container.

Definition at line 23 of file rrset_collection.h.

Constructor & Destructor Documentation

◆ RRsetCollection() [1/3]

isc::dns::RRsetCollection::RRsetCollection ( )
inline

Constructor.

This constructor creates an empty collection without any data in it. RRsets can be added to the collection with the addRRset() method.

Definition at line 30 of file rrset_collection.h.

◆ RRsetCollection() [2/3]

isc::dns::RRsetCollection::RRsetCollection ( const char *  filename,
const isc::dns::Name origin,
const isc::dns::RRClass rrclass 
)

Constructor.

The origin and rrclass arguments are required for the zone loading, but RRsetCollection itself does not do any validation, and the collection of RRsets does not have to form a valid zone.

Exceptions
MasterLoaderErrorif there is an error during loading.
Parameters
filenameName of a file containing a collection of RRs in the master file format (which may or may not form a valid zone).
originThe zone origin.
rrclassThe zone class.

Definition at line 60 of file rrset_collection.cc.

◆ RRsetCollection() [3/3]

isc::dns::RRsetCollection::RRsetCollection ( std::istream &  input_stream,
const isc::dns::Name origin,
const isc::dns::RRClass rrclass 
)

Constructor.

This constructor is similar to the previous one, but instead of taking a filename to load a zone from, it takes an input stream.

Exceptions
MasterLoaderErrorif there is an error during loading.
Parameters
input_streamThe input stream to load from.
originThe zone origin.
rrclassThe zone class.

Definition at line 66 of file rrset_collection.cc.

◆ ~RRsetCollection()

virtual isc::dns::RRsetCollection::~RRsetCollection ( )
inlinevirtual

Destructor.

Definition at line 61 of file rrset_collection.h.

References addRRset(), find(), and removeRRset().

+ Here is the call graph for this function:

Member Function Documentation

◆ addRRset()

void isc::dns::RRsetCollection::addRRset ( isc::dns::RRsetPtr  rrset)

Add an RRset to the collection.

Does not do any validation whether rrset belongs to a particular zone or not. A reference to rrset is taken in an internally managed shared_ptr, so even if the caller's RRsetPtr is destroyed, the RRset it wrapped is still alive and managed by the RRsetCollection. It throws an isc::InvalidParameter exception if an rrset with the same class, type and name already exists.

Callers must not modify the RRset after adding it to the collection, as the rrset is indexed internally by the collection.

Definition at line 31 of file rrset_collection.cc.

References isc::dns::MasterLoader::DEFAULT, isc::dns::RRCollator::flush(), isc::dns::RRCollator::getCallback(), isc_throw, and isc::dns::MasterLoader::load().

Referenced by ~RRsetCollection().

+ Here is the call graph for this function:

◆ find() [1/2]

ConstRRsetPtr isc::dns::RRsetCollection::find ( const isc::dns::Name name,
const isc::dns::RRClass rrclass,
const isc::dns::RRType rrtype 
) const
virtual

Find a matching RRset in the collection.

Returns the RRset in the collection that exactly matches the given name, rrclass and rrtype. If no matching RRset is found, NULL is returned.

Parameters
nameThe name of the RRset to search for.
rrclassThe class of the RRset to search for.
rrtypeThe type of the RRset to search for.
Returns
The RRset if found, NULL otherwise.

Implements isc::dns::RRsetCollectionBase.

Definition at line 84 of file rrset_collection.cc.

Referenced by ~RRsetCollection().

◆ find() [2/2]

RRsetPtr isc::dns::RRsetCollection::find ( const isc::dns::Name name,
const isc::dns::RRClass rrclass,
const isc::dns::RRType rrtype 
)

Find a matching RRset in the collection (non-const variant).

See above for a description of the method and arguments.

Definition at line 73 of file rrset_collection.cc.

◆ getBeginning()

RRsetCollectionBase::IterPtr isc::dns::RRsetCollection::getBeginning ( )
protectedvirtual

Returns an IterPtr wrapping an Iter pointing to the beginning of the collection.

Exceptions
isc::dns::RRsetCollectionErrorif using the iterator results in some underlying datasrc error.

Implements isc::dns::RRsetCollectionBase.

Definition at line 111 of file rrset_collection.cc.

Referenced by isc::dns::RRsetCollection::DnsIter::equals().

◆ getEnd()

RRsetCollectionBase::IterPtr isc::dns::RRsetCollection::getEnd ( )
protectedvirtual

Returns an IterPtr wrapping an Iter pointing past the end of the collection.

Exceptions
isc::dns::RRsetCollectionErrorif using the iterator results in some underlying datasrc error.

Implements isc::dns::RRsetCollectionBase.

Definition at line 117 of file rrset_collection.cc.

Referenced by isc::dns::RRsetCollection::DnsIter::equals().

◆ removeRRset()

bool isc::dns::RRsetCollection::removeRRset ( const isc::dns::Name name,
const isc::dns::RRClass rrclass,
const isc::dns::RRType rrtype 
)

Remove an RRset from the collection.

RRset(s) matching the name, rrclass and rrtype are removed from the collection.

Returns
true if a matching RRset was deleted, false if no such RRset exists.

Definition at line 96 of file rrset_collection.cc.

Referenced by ~RRsetCollection().


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