Kea
1.9.9-git
|
libdns++ implementation of RRsetCollectionBase using an STL container. More...
#include <rrset_collection.h>
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< Iter > | IterPtr |
Wraps Iter with a reference count. More... | |
libdns++ implementation of RRsetCollectionBase using an STL container.
Definition at line 23 of file rrset_collection.h.
|
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.
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.
MasterLoaderError | if there is an error during loading. |
filename | Name of a file containing a collection of RRs in the master file format (which may or may not form a valid zone). |
origin | The zone origin. |
rrclass | The zone class. |
Definition at line 60 of file rrset_collection.cc.
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.
MasterLoaderError | if there is an error during loading. |
input_stream | The input stream to load from. |
origin | The zone origin. |
rrclass | The zone class. |
Definition at line 66 of file rrset_collection.cc.
|
inlinevirtual |
Destructor.
Definition at line 61 of file rrset_collection.h.
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_throw.
|
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.
name | The name of the RRset to search for. |
rrclass | The class of the RRset to search for. |
rrtype | The type of the RRset to search for. |
NULL
otherwise. Implements isc::dns::RRsetCollectionBase.
Definition at line 84 of file rrset_collection.cc.
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.
|
protectedvirtual |
Returns an IterPtr
wrapping an Iter pointing to the beginning of the collection.
isc::dns::RRsetCollectionError | if using the iterator results in some underlying datasrc error. |
Implements isc::dns::RRsetCollectionBase.
Definition at line 111 of file rrset_collection.cc.
|
protectedvirtual |
Returns an IterPtr
wrapping an Iter pointing past the end of the collection.
isc::dns::RRsetCollectionError | if using the iterator results in some underlying datasrc error. |
Implements isc::dns::RRsetCollectionBase.
Definition at line 117 of file rrset_collection.cc.
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.
Definition at line 96 of file rrset_collection.cc.