Commit 6afe3a04 authored by Stephen Morris's avatar Stephen Morris

[1604b] Make (Const)RRsetPtr point to an AbstractRRset

To allow for future optimization, the RRset pointer classes now
point to the base of the RRset inheritance hierarchy.
parent ee0782b6
...@@ -34,7 +34,7 @@ namespace isc { ...@@ -34,7 +34,7 @@ namespace isc {
namespace auth { namespace auth {
void void
Query::addAdditional(ZoneFinder& zone, const RRset& rrset) { Query::addAdditional(ZoneFinder& zone, const AbstractRRset& rrset) {
RdataIteratorPtr rdata_iterator(rrset.getRdataIterator()); RdataIteratorPtr rdata_iterator(rrset.getRdataIterator());
for (; !rdata_iterator->isLast(); rdata_iterator->next()) { for (; !rdata_iterator->isLast(); rdata_iterator->next()) {
const Rdata& rdata(rdata_iterator->getCurrent()); const Rdata& rdata(rdata_iterator->getCurrent());
...@@ -73,7 +73,7 @@ Query::addAdditionalAddrs(ZoneFinder& zone, const Name& qname, ...@@ -73,7 +73,7 @@ Query::addAdditionalAddrs(ZoneFinder& zone, const Name& qname,
options | dnssec_opt_); options | dnssec_opt_);
if (a_result.code == ZoneFinder::SUCCESS) { if (a_result.code == ZoneFinder::SUCCESS) {
response_.addRRset(Message::SECTION_ADDITIONAL, response_.addRRset(Message::SECTION_ADDITIONAL,
boost::const_pointer_cast<RRset>(a_result.rrset), dnssec_); boost::const_pointer_cast<AbstractRRset>(a_result.rrset), dnssec_);
} }
} }
...@@ -83,7 +83,7 @@ Query::addAdditionalAddrs(ZoneFinder& zone, const Name& qname, ...@@ -83,7 +83,7 @@ Query::addAdditionalAddrs(ZoneFinder& zone, const Name& qname,
options | dnssec_opt_); options | dnssec_opt_);
if (aaaa_result.code == ZoneFinder::SUCCESS) { if (aaaa_result.code == ZoneFinder::SUCCESS) {
response_.addRRset(Message::SECTION_ADDITIONAL, response_.addRRset(Message::SECTION_ADDITIONAL,
boost::const_pointer_cast<RRset>(aaaa_result.rrset), boost::const_pointer_cast<AbstractRRset>(aaaa_result.rrset),
dnssec_); dnssec_);
} }
} }
...@@ -104,7 +104,7 @@ Query::addSOA(ZoneFinder& finder) { ...@@ -104,7 +104,7 @@ Query::addSOA(ZoneFinder& finder) {
* to insist. * to insist.
*/ */
response_.addRRset(Message::SECTION_AUTHORITY, response_.addRRset(Message::SECTION_AUTHORITY,
boost::const_pointer_cast<RRset>(soa_result.rrset), dnssec_); boost::const_pointer_cast<AbstractRRset>(soa_result.rrset), dnssec_);
} }
} }
...@@ -124,7 +124,7 @@ Query::addNXDOMAINProof(ZoneFinder& finder, ConstRRsetPtr nsec) { ...@@ -124,7 +124,7 @@ Query::addNXDOMAINProof(ZoneFinder& finder, ConstRRsetPtr nsec) {
// Add the NSEC proving NXDOMAIN to the authority section. // Add the NSEC proving NXDOMAIN to the authority section.
response_.addRRset(Message::SECTION_AUTHORITY, response_.addRRset(Message::SECTION_AUTHORITY,
boost::const_pointer_cast<RRset>(nsec), dnssec_); boost::const_pointer_cast<AbstractRRset>(nsec), dnssec_);
// Next, identify the best possible wildcard name that would match // Next, identify the best possible wildcard name that would match
// the query name. It's the longer common suffix with the qname // the query name. It's the longer common suffix with the qname
...@@ -162,7 +162,7 @@ Query::addNXDOMAINProof(ZoneFinder& finder, ConstRRsetPtr nsec) { ...@@ -162,7 +162,7 @@ Query::addNXDOMAINProof(ZoneFinder& finder, ConstRRsetPtr nsec) {
// for some optimized data source implementations. // for some optimized data source implementations.
if (nsec->getName() != fresult.rrset->getName()) { if (nsec->getName() != fresult.rrset->getName()) {
response_.addRRset(Message::SECTION_AUTHORITY, response_.addRRset(Message::SECTION_AUTHORITY,
boost::const_pointer_cast<RRset>(fresult.rrset), boost::const_pointer_cast<AbstractRRset>(fresult.rrset),
dnssec_); dnssec_);
} }
} }
...@@ -180,7 +180,7 @@ Query::addWildcardProof(ZoneFinder& finder) { ...@@ -180,7 +180,7 @@ Query::addWildcardProof(ZoneFinder& finder) {
isc_throw(BadNSEC, "Unexpected result for wildcard proof"); isc_throw(BadNSEC, "Unexpected result for wildcard proof");
} }
response_.addRRset(Message::SECTION_AUTHORITY, response_.addRRset(Message::SECTION_AUTHORITY,
boost::const_pointer_cast<RRset>(fresult.rrset), boost::const_pointer_cast<AbstractRRset>(fresult.rrset),
dnssec_); dnssec_);
} }
...@@ -203,7 +203,7 @@ Query::addWildcardNXRRSETProof(ZoneFinder& finder, ConstRRsetPtr nsec) { ...@@ -203,7 +203,7 @@ Query::addWildcardNXRRSETProof(ZoneFinder& finder, ConstRRsetPtr nsec) {
if (nsec->getName() != fresult.rrset->getName()) { if (nsec->getName() != fresult.rrset->getName()) {
// one NSEC RR proves wildcard_nxrrset that no matched QNAME. // one NSEC RR proves wildcard_nxrrset that no matched QNAME.
response_.addRRset(Message::SECTION_AUTHORITY, response_.addRRset(Message::SECTION_AUTHORITY,
boost::const_pointer_cast<RRset>(fresult.rrset), boost::const_pointer_cast<AbstractRRset>(fresult.rrset),
dnssec_); dnssec_);
} }
} }
...@@ -214,7 +214,7 @@ Query::addDS(ZoneFinder& finder, const Name& dname) { ...@@ -214,7 +214,7 @@ Query::addDS(ZoneFinder& finder, const Name& dname) {
finder.find(dname, RRType::DS(), dnssec_opt_); finder.find(dname, RRType::DS(), dnssec_opt_);
if (ds_result.code == ZoneFinder::SUCCESS) { if (ds_result.code == ZoneFinder::SUCCESS) {
response_.addRRset(Message::SECTION_AUTHORITY, response_.addRRset(Message::SECTION_AUTHORITY,
boost::const_pointer_cast<RRset>(ds_result.rrset), boost::const_pointer_cast<AbstractRRset>(ds_result.rrset),
dnssec_); dnssec_);
} else if (ds_result.code == ZoneFinder::NXRRSET) { } else if (ds_result.code == ZoneFinder::NXRRSET) {
addNXRRsetProof(finder, ds_result); addNXRRsetProof(finder, ds_result);
...@@ -230,7 +230,7 @@ Query::addNXRRsetProof(ZoneFinder& finder, ...@@ -230,7 +230,7 @@ Query::addNXRRsetProof(ZoneFinder& finder,
{ {
if (db_result.isNSECSigned() && db_result.rrset) { if (db_result.isNSECSigned() && db_result.rrset) {
response_.addRRset(Message::SECTION_AUTHORITY, response_.addRRset(Message::SECTION_AUTHORITY,
boost::const_pointer_cast<RRset>( boost::const_pointer_cast<AbstractRRset>(
db_result.rrset), db_result.rrset),
dnssec_); dnssec_);
if (db_result.isWildcard()) { if (db_result.isWildcard()) {
...@@ -251,7 +251,7 @@ Query::addAuthAdditional(ZoneFinder& finder) { ...@@ -251,7 +251,7 @@ Query::addAuthAdditional(ZoneFinder& finder) {
finder.getOrigin().toText()); finder.getOrigin().toText());
} else { } else {
response_.addRRset(Message::SECTION_AUTHORITY, response_.addRRset(Message::SECTION_AUTHORITY,
boost::const_pointer_cast<RRset>(ns_result.rrset), dnssec_); boost::const_pointer_cast<AbstractRRset>(ns_result.rrset), dnssec_);
// Handle additional for authority section // Handle additional for authority section
addAdditional(finder, *ns_result.rrset); addAdditional(finder, *ns_result.rrset);
} }
...@@ -294,7 +294,7 @@ Query::process() { ...@@ -294,7 +294,7 @@ Query::process() {
case ZoneFinder::DNAME: { case ZoneFinder::DNAME: {
// First, put the dname into the answer // First, put the dname into the answer
response_.addRRset(Message::SECTION_ANSWER, response_.addRRset(Message::SECTION_ANSWER,
boost::const_pointer_cast<RRset>(db_result.rrset), boost::const_pointer_cast<AbstractRRset>(db_result.rrset),
dnssec_); dnssec_);
/* /*
* Empty DNAME should never get in, as it is impossible to * Empty DNAME should never get in, as it is impossible to
...@@ -345,7 +345,7 @@ Query::process() { ...@@ -345,7 +345,7 @@ Query::process() {
* So, just put it there. * So, just put it there.
*/ */
response_.addRRset(Message::SECTION_ANSWER, response_.addRRset(Message::SECTION_ANSWER,
boost::const_pointer_cast<RRset>(db_result.rrset), boost::const_pointer_cast<AbstractRRset>(db_result.rrset),
dnssec_); dnssec_);
// If the answer is a result of wildcard substitution, // If the answer is a result of wildcard substitution,
...@@ -360,13 +360,13 @@ Query::process() { ...@@ -360,13 +360,13 @@ Query::process() {
// into answer section. // into answer section.
BOOST_FOREACH(ConstRRsetPtr rrset, target) { BOOST_FOREACH(ConstRRsetPtr rrset, target) {
response_.addRRset(Message::SECTION_ANSWER, response_.addRRset(Message::SECTION_ANSWER,
boost::const_pointer_cast<RRset>(rrset), dnssec_); boost::const_pointer_cast<AbstractRRset>(rrset), dnssec_);
// Handle additional for answer section // Handle additional for answer section
addAdditional(*result.zone_finder, *rrset.get()); addAdditional(*result.zone_finder, *rrset.get());
} }
} else { } else {
response_.addRRset(Message::SECTION_ANSWER, response_.addRRset(Message::SECTION_ANSWER,
boost::const_pointer_cast<RRset>(db_result.rrset), boost::const_pointer_cast<AbstractRRset>(db_result.rrset),
dnssec_); dnssec_);
// Handle additional for answer section // Handle additional for answer section
addAdditional(*result.zone_finder, *db_result.rrset); addAdditional(*result.zone_finder, *db_result.rrset);
...@@ -391,7 +391,7 @@ Query::process() { ...@@ -391,7 +391,7 @@ Query::process() {
case ZoneFinder::DELEGATION: case ZoneFinder::DELEGATION:
response_.setHeaderFlag(Message::HEADERFLAG_AA, false); response_.setHeaderFlag(Message::HEADERFLAG_AA, false);
response_.addRRset(Message::SECTION_AUTHORITY, response_.addRRset(Message::SECTION_AUTHORITY,
boost::const_pointer_cast<RRset>(db_result.rrset), boost::const_pointer_cast<AbstractRRset>(db_result.rrset),
dnssec_); dnssec_);
// If DNSSEC is requested, see whether there is a DS // If DNSSEC is requested, see whether there is a DS
// record for this delegation. // record for this delegation.
......
...@@ -135,7 +135,7 @@ private: ...@@ -135,7 +135,7 @@ private:
/// \param rrset The RRset (i.e., NS or MX rrset) which require additional /// \param rrset The RRset (i.e., NS or MX rrset) which require additional
/// processing. /// processing.
void addAdditional(isc::datasrc::ZoneFinder& zone, void addAdditional(isc::datasrc::ZoneFinder& zone,
const isc::dns::RRset& rrset); const isc::dns::AbstractRRset& rrset);
/// \brief Find address records for a specified name. /// \brief Find address records for a specified name.
/// ///
......
...@@ -389,7 +389,7 @@ private: ...@@ -389,7 +389,7 @@ private:
// A helper function that generates a new RRset based on "wild_rrset", // A helper function that generates a new RRset based on "wild_rrset",
// replacing its owner name with 'real_name'. // replacing its owner name with 'real_name'.
ConstRRsetPtr ConstRRsetPtr
substituteWild(const RRset& wild_rrset, const Name& real_name) { substituteWild(const AbstractRRset& wild_rrset, const Name& real_name) {
RRsetPtr rrset(new RRset(real_name, wild_rrset.getClass(), RRsetPtr rrset(new RRset(real_name, wild_rrset.getClass(),
wild_rrset.getType(), wild_rrset.getTTL())); wild_rrset.getType(), wild_rrset.getTTL()));
// For simplicity we only consider the case with one RDATA (for now) // For simplicity we only consider the case with one RDATA (for now)
......
...@@ -43,7 +43,7 @@ LocalZoneData::lookup(const isc::dns::Name& name, ...@@ -43,7 +43,7 @@ LocalZoneData::lookup(const isc::dns::Name& name,
} }
void void
LocalZoneData::update(const isc::dns::RRset& rrset) { LocalZoneData::update(const isc::dns::AbstractRRset& rrset) {
//TODO Do we really need to recreate the rrset again? //TODO Do we really need to recreate the rrset again?
string key = genCacheEntryName(rrset.getName(), rrset.getType()); string key = genCacheEntryName(rrset.getName(), rrset.getType());
LOG_DEBUG(logger, DBG_TRACE_DATA, CACHE_LOCALZONE_UPDATE).arg(key); LOG_DEBUG(logger, DBG_TRACE_DATA, CACHE_LOCALZONE_UPDATE).arg(key);
......
...@@ -47,7 +47,7 @@ public: ...@@ -47,7 +47,7 @@ public:
/// Otherwise, the existed one will be overwritten. /// Otherwise, the existed one will be overwritten.
/// ///
/// \param rrset The rrset to update /// \param rrset The rrset to update
void update(const isc::dns::RRset& rrset); void update(const isc::dns::AbstractRRset& rrset);
private: private:
std::map<std::string, isc::dns::RRsetPtr> rrsets_map_; // RRsets of the zone std::map<std::string, isc::dns::RRsetPtr> rrsets_map_; // RRsets of the zone
......
...@@ -70,7 +70,7 @@ RRsetCache::lookup(const isc::dns::Name& qname, ...@@ -70,7 +70,7 @@ RRsetCache::lookup(const isc::dns::Name& qname,
} }
RRsetEntryPtr RRsetEntryPtr
RRsetCache::update(const isc::dns::RRset& rrset, RRsetCache::update(const isc::dns::AbstractRRset& rrset,
const RRsetTrustLevel& level) const RRsetTrustLevel& level)
{ {
LOG_DEBUG(logger, DBG_TRACE_DATA, CACHE_RRSET_UPDATE).arg(rrset.getName()). LOG_DEBUG(logger, DBG_TRACE_DATA, CACHE_RRSET_UPDATE).arg(rrset.getName()).
......
...@@ -73,7 +73,7 @@ public: ...@@ -73,7 +73,7 @@ public:
/// \param level trustworthiness of the rrset. /// \param level trustworthiness of the rrset.
/// \return return the rrset entry in the cache, it may be the /// \return return the rrset entry in the cache, it may be the
/// new added rrset entry or existed one if it is not replaced. /// new added rrset entry or existed one if it is not replaced.
RRsetEntryPtr update(const isc::dns::RRset& rrset, RRsetEntryPtr update(const isc::dns::AbstractRRset& rrset,
const RRsetTrustLevel& level); const RRsetTrustLevel& level);
/// \short Protected memebers, so they can be accessed by tests. /// \short Protected memebers, so they can be accessed by tests.
......
...@@ -20,7 +20,7 @@ namespace isc { ...@@ -20,7 +20,7 @@ namespace isc {
namespace cache { namespace cache {
void void
rrsetCopy(const isc::dns::RRset& src, isc::dns::RRset& dst) { rrsetCopy(const isc::dns::AbstractRRset& src, isc::dns::AbstractRRset& dst) {
RdataIteratorPtr rdata_itor = src.getRdataIterator(); RdataIteratorPtr rdata_itor = src.getRdataIterator();
rdata_itor->first(); rdata_itor->first();
while(!rdata_itor->isLast()){ while(!rdata_itor->isLast()){
......
...@@ -33,7 +33,7 @@ namespace cache { ...@@ -33,7 +33,7 @@ namespace cache {
/// we have to do the copy. /// we have to do the copy.
void void
rrsetCopy(const isc::dns::RRset& src, isc::dns::RRset& dst); rrsetCopy(const isc::dns::AbstractRRset& src, isc::dns::AbstractRRset& dst);
} // namespace cache } // namespace cache
} // namespace isc } // namespace isc
......
...@@ -25,7 +25,8 @@ using namespace isc::dns; ...@@ -25,7 +25,8 @@ using namespace isc::dns;
namespace isc { namespace isc {
namespace cache { namespace cache {
RRsetEntry::RRsetEntry(const isc::dns::RRset& rrset, const RRsetTrustLevel& level): RRsetEntry::RRsetEntry(const isc::dns::AbstractRRset& rrset,
const RRsetTrustLevel& level):
entry_name_(genCacheEntryName(rrset.getName(), rrset.getType())), entry_name_(genCacheEntryName(rrset.getName(), rrset.getType())),
expire_time_(time(NULL) + rrset.getTTL().getValue()), expire_time_(time(NULL) + rrset.getTTL().getValue()),
trust_level_(level), trust_level_(level),
......
...@@ -75,7 +75,8 @@ public: ...@@ -75,7 +75,8 @@ public:
/// \brief Constructor /// \brief Constructor
/// \param rrset The RRset used to initialize the RRset entry. /// \param rrset The RRset used to initialize the RRset entry.
/// \param level trustworthiness of the RRset. /// \param level trustworthiness of the RRset.
RRsetEntry(const isc::dns::RRset& rrset, const RRsetTrustLevel& level); RRsetEntry(const isc::dns::AbstractRRset& rrset,
const RRsetTrustLevel& level);
/// The destructor. /// The destructor.
~RRsetEntry() {} ~RRsetEntry() {}
......
...@@ -1120,8 +1120,8 @@ public: ...@@ -1120,8 +1120,8 @@ public:
virtual ZoneFinder& getFinder() { return (*finder_); } virtual ZoneFinder& getFinder() { return (*finder_); }
virtual void addRRset(const RRset& rrset); virtual void addRRset(const AbstractRRset& rrset);
virtual void deleteRRset(const RRset& rrset); virtual void deleteRRset(const AbstractRRset& rrset);
virtual void commit(); virtual void commit();
private: private:
...@@ -1148,14 +1148,15 @@ private: ...@@ -1148,14 +1148,15 @@ private:
// This is a set of validation checks commonly used for addRRset() and // This is a set of validation checks commonly used for addRRset() and
// deleteRRset to minimize duplicate code logic and to make the main // deleteRRset to minimize duplicate code logic and to make the main
// code concise. // code concise.
void validateAddOrDelete(const char* const op_str, const RRset& rrset, void validateAddOrDelete(const char* const op_str,
const AbstractRRset& rrset,
DiffPhase prev_phase, DiffPhase prev_phase,
DiffPhase current_phase) const; DiffPhase current_phase) const;
}; };
void void
DatabaseUpdater::validateAddOrDelete(const char* const op_str, DatabaseUpdater::validateAddOrDelete(const char* const op_str,
const RRset& rrset, const AbstractRRset& rrset,
DiffPhase prev_phase, DiffPhase prev_phase,
DiffPhase current_phase) const DiffPhase current_phase) const
{ {
...@@ -1193,7 +1194,7 @@ DatabaseUpdater::validateAddOrDelete(const char* const op_str, ...@@ -1193,7 +1194,7 @@ DatabaseUpdater::validateAddOrDelete(const char* const op_str,
} }
void void
DatabaseUpdater::addRRset(const RRset& rrset) { DatabaseUpdater::addRRset(const AbstractRRset& rrset) {
validateAddOrDelete("add", rrset, DELETE, ADD); validateAddOrDelete("add", rrset, DELETE, ADD);
// It's guaranteed rrset has at least one RDATA at this point. // It's guaranteed rrset has at least one RDATA at this point.
...@@ -1239,7 +1240,7 @@ DatabaseUpdater::addRRset(const RRset& rrset) { ...@@ -1239,7 +1240,7 @@ DatabaseUpdater::addRRset(const RRset& rrset) {
} }
void void
DatabaseUpdater::deleteRRset(const RRset& rrset) { DatabaseUpdater::deleteRRset(const AbstractRRset& rrset) {
// If this is the first operation, pretend we are starting a new delete // If this is the first operation, pretend we are starting a new delete
// sequence after adds. This will simplify the validation below. // sequence after adds. This will simplify the validation below.
if (diff_phase_ == NOT_STARTED) { if (diff_phase_ == NOT_STARTED) {
......
...@@ -286,7 +286,7 @@ struct InMemoryZoneFinder::InMemoryZoneFinderImpl { ...@@ -286,7 +286,7 @@ struct InMemoryZoneFinder::InMemoryZoneFinderImpl {
// Note: there's a slight chance of getting an exception. // Note: there's a slight chance of getting an exception.
// As noted in add(), we give up strong exception guarantee in such // As noted in add(), we give up strong exception guarantee in such
// cases. // cases.
boost::const_pointer_cast<RRset>(it->second)->addRRsig(sig_rrset); boost::const_pointer_cast<AbstractRRset>(it->second)->addRRsig(sig_rrset);
return (result::SUCCESS); return (result::SUCCESS);
} }
......
...@@ -667,7 +667,7 @@ public: ...@@ -667,7 +667,7 @@ public:
/// \exception std::bad_alloc Resource allocation failure /// \exception std::bad_alloc Resource allocation failure
/// ///
/// \param rrset The RRset to be added /// \param rrset The RRset to be added
virtual void addRRset(const isc::dns::RRset& rrset) = 0; virtual void addRRset(const isc::dns::AbstractRRset& rrset) = 0;
/// Delete an RRset from a zone via the updater /// Delete an RRset from a zone via the updater
/// ///
...@@ -739,7 +739,7 @@ public: ...@@ -739,7 +739,7 @@ public:
/// \exception std::bad_alloc Resource allocation failure /// \exception std::bad_alloc Resource allocation failure
/// ///
/// \param rrset The RRset to be deleted /// \param rrset The RRset to be deleted
virtual void deleteRRset(const isc::dns::RRset& rrset) = 0; virtual void deleteRRset(const isc::dns::AbstractRRset& rrset) = 0;
/// Commit the updates made in the updater to the zone /// Commit the updates made in the updater to the zone
/// ///
......
...@@ -433,7 +433,7 @@ private: ...@@ -433,7 +433,7 @@ private:
}; };
typedef SectionInserter<ConstQuestionPtr, Question> QuestionInserter; typedef SectionInserter<ConstQuestionPtr, Question> QuestionInserter;
typedef SectionInserter<ConstRRsetPtr, RRset> RRsetInserter; typedef SectionInserter<ConstRRsetPtr, AbstractRRset> RRsetInserter;
// TODO use direct iterators for these? (or simply lists for now?) // TODO use direct iterators for these? (or simply lists for now?)
PyObject* PyObject*
......
...@@ -415,7 +415,7 @@ PyTypeObject rrset_type = { ...@@ -415,7 +415,7 @@ PyTypeObject rrset_type = {
}; };
PyObject* PyObject*
createRRsetObject(const RRset& source) { createRRsetObject(const AbstractRRset& source) {
// RRsets are noncopyable, so as a workaround we recreate a new one // RRsets are noncopyable, so as a workaround we recreate a new one
// and copy over all content // and copy over all content
...@@ -450,7 +450,7 @@ PyRRset_Check(PyObject* obj) { ...@@ -450,7 +450,7 @@ PyRRset_Check(PyObject* obj) {
return (PyObject_TypeCheck(obj, &rrset_type)); return (PyObject_TypeCheck(obj, &rrset_type));
} }
RRset& AbstractRRset&
PyRRset_ToRRset(PyObject* rrset_obj) { PyRRset_ToRRset(PyObject* rrset_obj) {
s_RRset* rrset = static_cast<s_RRset*>(rrset_obj); s_RRset* rrset = static_cast<s_RRset*>(rrset_obj);
return (*rrset->cppobj); return (*rrset->cppobj);
......
...@@ -36,7 +36,7 @@ extern PyTypeObject rrset_type; ...@@ -36,7 +36,7 @@ extern PyTypeObject rrset_type;
/// returns a NULL pointer). /// returns a NULL pointer).
/// This function is expected to be called within a try block /// This function is expected to be called within a try block
/// followed by necessary setup for python exception. /// followed by necessary setup for python exception.
PyObject* createRRsetObject(const RRset& source); PyObject* createRRsetObject(const AbstractRRset& source);
/// \brief Checks if the given python object is a RRset object /// \brief Checks if the given python object is a RRset object
/// ///
...@@ -56,7 +56,7 @@ bool PyRRset_Check(PyObject* obj); ...@@ -56,7 +56,7 @@ bool PyRRset_Check(PyObject* obj);
/// may be destroyed, the caller must copy it itself. /// may be destroyed, the caller must copy it itself.
/// ///
/// \param rrset_obj The rrset object to convert /// \param rrset_obj The rrset object to convert
RRset& PyRRset_ToRRset(PyObject* rrset_obj); AbstractRRset& PyRRset_ToRRset(PyObject* rrset_obj);
/// \brief Returns the shared_ptr of the RRset object contained within the /// \brief Returns the shared_ptr of the RRset object contained within the
/// given Python object. /// given Python object.
......
...@@ -58,14 +58,14 @@ class RRset; ...@@ -58,14 +58,14 @@ class RRset;
/// ///
/// This type is commonly used as an argument of various functions defined /// This type is commonly used as an argument of various functions defined
/// in this library in order to handle RRsets in a polymorphic manner. /// in this library in order to handle RRsets in a polymorphic manner.
typedef boost::shared_ptr<RRset> RRsetPtr; typedef boost::shared_ptr<AbstractRRset> RRsetPtr;
/// \brief A pointer-like type pointing to an (immutable) \c RRset /// \brief A pointer-like type pointing to an (immutable) \c RRset
/// object. /// object.
/// ///
/// This type is commonly used as an argument of various functions defined /// This type is commonly used as an argument of various functions defined
/// in this library in order to handle RRsets in a polymorphic manner. /// in this library in order to handle RRsets in a polymorphic manner.
typedef boost::shared_ptr<const RRset> ConstRRsetPtr; typedef boost::shared_ptr<const AbstractRRset> ConstRRsetPtr;
/// \brief A pointer-like type point to an \c RdataIterator object. /// \brief A pointer-like type point to an \c RdataIterator object.
typedef boost::shared_ptr<RdataIterator> RdataIteratorPtr; typedef boost::shared_ptr<RdataIterator> RdataIteratorPtr;
...@@ -400,6 +400,82 @@ public: ...@@ -400,6 +400,82 @@ public:
/// object. /// object.
virtual RdataIteratorPtr getRdataIterator() const = 0; virtual RdataIteratorPtr getRdataIterator() const = 0;
//@} //@}
///
/// \name Associated RRSIG methods
///
/// These methods access an "associated" RRset, that containing the DNSSEC
/// signatures for this RRset. It can be argued that this is not a
/// fundamental part of the RRset abstraction, since RFC 2181 defined an
/// RRset as a group of records with the same label, class and type but
/// different data. However, BIND 10 has to deal with DNSSEC and in
/// practice, including the information at the AbstractRRset level makes
/// implementation easier. (If a class is ever needed that must be
/// ignorant of the idea of an associated RRSIG RRset - e.g. a specialised
/// RRSIG RRset class - these methods can just throw a "NotImplemented"
/// exception.)
//@{
/// \brief Return pointer to this RRset's RRSIG RRset
///
/// \return Pointer to the associated RRSIG RRset or null if there is none.
virtual RRsetPtr getRRsig() const = 0;
/// \brief 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.
///
/// \param rdata Pointer to RRSIG rdata to be added.
virtual void addRRsig(const rdata::ConstRdataPtr rdata) = 0;
/// \brief 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>.)
///
/// \param rdata Pointer to RRSIG rdata to be added.
virtual void addRRsig(const rdata::RdataPtr rdata) = 0;
/// \brief 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.
///
/// \param sigs RRSIG RRset containing signatures to be added to the
/// RRSIG RRset associated with this class.
virtual void addRRsig(const AbstractRRset& sigs) = 0;
/// \brief 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.
///
/// \param sigs Pointer to a RRSIG RRset containing signatures to be added
/// to the RRSIG RRset associated with this class.
virtual void addRRsig(ConstRRsetPtr sigs) = 0;
/// \brief 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>.)