BIND 10 master, updated. 58b7b149b8b3afbdbd8c960fc716f4e85f1803ee [master] ChangeLog for Trac 1604

BIND 10 source code commits bind10-changes at lists.isc.org
Fri Feb 3 12:06:19 UTC 2012


The branch, master has been updated
       via  58b7b149b8b3afbdbd8c960fc716f4e85f1803ee (commit)
       via  3071211d2c537150a691120b0a5ce2b18d010239 (commit)
       via  b9aed5e8c47dd0e44981e6a7c40b5b3c8e403e53 (commit)
       via  f5a196c2aaa02ab50f8bb50f9e23cdff7e945559 (commit)
       via  6afe3a0422647e7e6973857bed9c657366f10674 (commit)
      from  6cba1c1241e8c23779d0dc29374ce8420fadc2c5 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 58b7b149b8b3afbdbd8c960fc716f4e85f1803ee
Author: Stephen Morris <stephen at isc.org>
Date:   Fri Feb 3 12:02:52 2012 +0000

    [master] ChangeLog for Trac 1604

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |    6 +
 src/bin/auth/query.cc                              |   32 ++--
 src/bin/auth/query.h                               |    2 +-
 src/bin/auth/tests/query_unittest.cc               |    2 +-
 src/lib/cache/local_zone_data.cc                   |    2 +-
 src/lib/cache/local_zone_data.h                    |    2 +-
 src/lib/cache/rrset_cache.cc                       |    2 +-
 src/lib/cache/rrset_cache.h                        |    2 +-
 src/lib/cache/rrset_copy.cc                        |    2 +-
 src/lib/cache/rrset_copy.h                         |    2 +-
 src/lib/cache/rrset_entry.cc                       |    3 +-
 src/lib/cache/rrset_entry.h                        |    3 +-
 src/lib/datasrc/database.cc                        |   13 +-
 src/lib/datasrc/memory_datasrc.cc                  |    4 +-
 src/lib/datasrc/zone.h                             |    4 +-
 src/lib/dns/python/message_python.cc               |    2 +-
 src/lib/dns/python/rrset_python.cc                 |    4 +-
 src/lib/dns/python/rrset_python.h                  |    4 +-
 src/lib/dns/rrset.h                                |  144 ++++++++++++++++++--
 .../tests/nameserver_address_store_unittest.cc     |    2 +-
 20 files changed, 186 insertions(+), 51 deletions(-)

-----------------------------------------------------------------------
diff --git a/ChangeLog b/ChangeLog
index 5b81afc..239a359 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+374.	[func]*     stephen
+	Alter RRsetPtr and ConstRRsetPtr to point to AbstractRRset (instead
+	of RRset) to allow for specialised implementations of RRsets in
+	data sources.
+	(Trac #1604, git 3071211d2c537150a691120b0a5ce2b18d010239)
+
 373.	[bug]		jinmei
 	libdatasrc: the in-memory data source incorrectly rejected loading
 	a zone containing a CNAME RR with RRSIG and/or NSEC.
diff --git a/src/bin/auth/query.cc b/src/bin/auth/query.cc
index 88624b8..7fe085e 100644
--- a/src/bin/auth/query.cc
+++ b/src/bin/auth/query.cc
@@ -34,7 +34,7 @@ namespace isc {
 namespace auth {
 
 void
-Query::addAdditional(ZoneFinder& zone, const RRset& rrset) {
+Query::addAdditional(ZoneFinder& zone, const AbstractRRset& rrset) {
     RdataIteratorPtr rdata_iterator(rrset.getRdataIterator());
     for (; !rdata_iterator->isLast(); rdata_iterator->next()) {
         const Rdata& rdata(rdata_iterator->getCurrent());
@@ -73,7 +73,7 @@ Query::addAdditionalAddrs(ZoneFinder& zone, const Name& qname,
                                                     options | dnssec_opt_);
         if (a_result.code == ZoneFinder::SUCCESS) {
             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,
                                                        options | dnssec_opt_);
         if (aaaa_result.code == ZoneFinder::SUCCESS) {
             response_.addRRset(Message::SECTION_ADDITIONAL,
-                    boost::const_pointer_cast<RRset>(aaaa_result.rrset),
+                    boost::const_pointer_cast<AbstractRRset>(aaaa_result.rrset),
                     dnssec_);
         }
     }
@@ -104,7 +104,7 @@ Query::addSOA(ZoneFinder& finder) {
          * to insist.
          */
         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) {
 
     // Add the NSEC proving NXDOMAIN to the authority section.
     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
     // the query name.  It's the longer common suffix with the qname
@@ -162,7 +162,7 @@ Query::addNXDOMAINProof(ZoneFinder& finder, ConstRRsetPtr nsec) {
     // for some optimized data source implementations.
     if (nsec->getName() != fresult.rrset->getName()) {
         response_.addRRset(Message::SECTION_AUTHORITY,
-                           boost::const_pointer_cast<RRset>(fresult.rrset),
+                           boost::const_pointer_cast<AbstractRRset>(fresult.rrset),
                            dnssec_);
     }
 }
@@ -180,7 +180,7 @@ Query::addWildcardProof(ZoneFinder& finder) {
         isc_throw(BadNSEC, "Unexpected result for wildcard proof");
     }
     response_.addRRset(Message::SECTION_AUTHORITY,
-                       boost::const_pointer_cast<RRset>(fresult.rrset),
+                       boost::const_pointer_cast<AbstractRRset>(fresult.rrset),
                        dnssec_);
 }
 
@@ -203,7 +203,7 @@ Query::addWildcardNXRRSETProof(ZoneFinder& finder, ConstRRsetPtr nsec) {
     if (nsec->getName() != fresult.rrset->getName()) {
         // one NSEC RR proves wildcard_nxrrset that no matched QNAME.
         response_.addRRset(Message::SECTION_AUTHORITY,
-                           boost::const_pointer_cast<RRset>(fresult.rrset),
+                           boost::const_pointer_cast<AbstractRRset>(fresult.rrset),
                            dnssec_);
     }
 }
@@ -214,7 +214,7 @@ Query::addDS(ZoneFinder& finder, const Name& dname) {
         finder.find(dname, RRType::DS(), dnssec_opt_);
     if (ds_result.code == ZoneFinder::SUCCESS) {
         response_.addRRset(Message::SECTION_AUTHORITY,
-                           boost::const_pointer_cast<RRset>(ds_result.rrset),
+                           boost::const_pointer_cast<AbstractRRset>(ds_result.rrset),
                            dnssec_);
     } else if (ds_result.code == ZoneFinder::NXRRSET) {
         addNXRRsetProof(finder, ds_result);
@@ -230,7 +230,7 @@ Query::addNXRRsetProof(ZoneFinder& finder,
 {
     if (db_result.isNSECSigned() && db_result.rrset) {
         response_.addRRset(Message::SECTION_AUTHORITY,
-                           boost::const_pointer_cast<RRset>(
+                           boost::const_pointer_cast<AbstractRRset>(
                                db_result.rrset),
                            dnssec_);
         if (db_result.isWildcard()) {
@@ -251,7 +251,7 @@ Query::addAuthAdditional(ZoneFinder& finder) {
                 finder.getOrigin().toText());
     } else {
         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
         addAdditional(finder, *ns_result.rrset);
     }
@@ -294,7 +294,7 @@ Query::process() {
         case ZoneFinder::DNAME: {
             // First, put the dname into the answer
             response_.addRRset(Message::SECTION_ANSWER,
-                boost::const_pointer_cast<RRset>(db_result.rrset),
+                boost::const_pointer_cast<AbstractRRset>(db_result.rrset),
                 dnssec_);
             /*
              * Empty DNAME should never get in, as it is impossible to
@@ -345,7 +345,7 @@ Query::process() {
              * So, just put it there.
              */
             response_.addRRset(Message::SECTION_ANSWER,
-                boost::const_pointer_cast<RRset>(db_result.rrset),
+                boost::const_pointer_cast<AbstractRRset>(db_result.rrset),
                 dnssec_);
 
             // If the answer is a result of wildcard substitution,
@@ -360,13 +360,13 @@ Query::process() {
                 // into answer section.
                 BOOST_FOREACH(ConstRRsetPtr rrset, target) {
                     response_.addRRset(Message::SECTION_ANSWER,
-                        boost::const_pointer_cast<RRset>(rrset), dnssec_);
+                        boost::const_pointer_cast<AbstractRRset>(rrset), dnssec_);
                     // Handle additional for answer section
                     addAdditional(*result.zone_finder, *rrset.get());
                 }
             } else {
                 response_.addRRset(Message::SECTION_ANSWER,
-                    boost::const_pointer_cast<RRset>(db_result.rrset),
+                    boost::const_pointer_cast<AbstractRRset>(db_result.rrset),
                     dnssec_);
                 // Handle additional for answer section
                 addAdditional(*result.zone_finder, *db_result.rrset);
@@ -391,7 +391,7 @@ Query::process() {
         case ZoneFinder::DELEGATION:
             response_.setHeaderFlag(Message::HEADERFLAG_AA, false);
             response_.addRRset(Message::SECTION_AUTHORITY,
-                boost::const_pointer_cast<RRset>(db_result.rrset),
+                boost::const_pointer_cast<AbstractRRset>(db_result.rrset),
                 dnssec_);
             // If DNSSEC is requested, see whether there is a DS
             // record for this delegation.
diff --git a/src/bin/auth/query.h b/src/bin/auth/query.h
index 886ff93..be98474 100644
--- a/src/bin/auth/query.h
+++ b/src/bin/auth/query.h
@@ -135,7 +135,7 @@ private:
     /// \param rrset The RRset (i.e., NS or MX rrset) which require additional
     /// processing.
     void addAdditional(isc::datasrc::ZoneFinder& zone,
-                       const isc::dns::RRset& rrset);
+                       const isc::dns::AbstractRRset& rrset);
 
     /// \brief Find address records for a specified name.
     ///
diff --git a/src/bin/auth/tests/query_unittest.cc b/src/bin/auth/tests/query_unittest.cc
index 0f330f5..d308faf 100644
--- a/src/bin/auth/tests/query_unittest.cc
+++ b/src/bin/auth/tests/query_unittest.cc
@@ -389,7 +389,7 @@ private:
 // A helper function that generates a new RRset based on "wild_rrset",
 // replacing its owner name with 'real_name'.
 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(),
                              wild_rrset.getType(), wild_rrset.getTTL()));
     // For simplicity we only consider the case with one RDATA (for now)
diff --git a/src/lib/cache/local_zone_data.cc b/src/lib/cache/local_zone_data.cc
index 13d1d75..29ab2bf 100644
--- a/src/lib/cache/local_zone_data.cc
+++ b/src/lib/cache/local_zone_data.cc
@@ -43,7 +43,7 @@ LocalZoneData::lookup(const isc::dns::Name& name,
 }
 
 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?
     string key = genCacheEntryName(rrset.getName(), rrset.getType());
     LOG_DEBUG(logger, DBG_TRACE_DATA, CACHE_LOCALZONE_UPDATE).arg(key);
diff --git a/src/lib/cache/local_zone_data.h b/src/lib/cache/local_zone_data.h
index 3015847..df77f40 100644
--- a/src/lib/cache/local_zone_data.h
+++ b/src/lib/cache/local_zone_data.h
@@ -47,7 +47,7 @@ public:
     /// Otherwise, the existed one will be overwritten.
     ///
     /// \param rrset The rrset to update
-    void update(const isc::dns::RRset& rrset);
+    void update(const isc::dns::AbstractRRset& rrset);
 
 private:
     std::map<std::string, isc::dns::RRsetPtr> rrsets_map_; // RRsets of the zone
diff --git a/src/lib/cache/rrset_cache.cc b/src/lib/cache/rrset_cache.cc
index 1a5fd48..bb4d339 100644
--- a/src/lib/cache/rrset_cache.cc
+++ b/src/lib/cache/rrset_cache.cc
@@ -70,7 +70,7 @@ RRsetCache::lookup(const isc::dns::Name& qname,
 }
 
 RRsetEntryPtr
-RRsetCache::update(const isc::dns::RRset& rrset,
+RRsetCache::update(const isc::dns::AbstractRRset& rrset,
                    const RRsetTrustLevel& level)
 {
     LOG_DEBUG(logger, DBG_TRACE_DATA, CACHE_RRSET_UPDATE).arg(rrset.getName()).
diff --git a/src/lib/cache/rrset_cache.h b/src/lib/cache/rrset_cache.h
index 73f9b58..a4ea54e 100644
--- a/src/lib/cache/rrset_cache.h
+++ b/src/lib/cache/rrset_cache.h
@@ -73,7 +73,7 @@ public:
     /// \param level trustworthiness of the rrset.
     /// \return return the rrset entry in the cache, it may be the
     /// 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);
 
     /// \short Protected memebers, so they can be accessed by tests.
diff --git a/src/lib/cache/rrset_copy.cc b/src/lib/cache/rrset_copy.cc
index 05b139a..b395ce1 100644
--- a/src/lib/cache/rrset_copy.cc
+++ b/src/lib/cache/rrset_copy.cc
@@ -20,7 +20,7 @@ namespace isc {
 namespace cache {
 
 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();
     rdata_itor->first();
     while(!rdata_itor->isLast()){
diff --git a/src/lib/cache/rrset_copy.h b/src/lib/cache/rrset_copy.h
index b6af8d6..e1dc489 100644
--- a/src/lib/cache/rrset_copy.h
+++ b/src/lib/cache/rrset_copy.h
@@ -33,7 +33,7 @@ namespace cache {
 ///       we have to do the copy.
 
 void
-rrsetCopy(const isc::dns::RRset& src, isc::dns::RRset& dst);
+rrsetCopy(const isc::dns::AbstractRRset& src, isc::dns::AbstractRRset& dst);
 
 } // namespace cache
 } // namespace isc
diff --git a/src/lib/cache/rrset_entry.cc b/src/lib/cache/rrset_entry.cc
index c829956..359fd68 100644
--- a/src/lib/cache/rrset_entry.cc
+++ b/src/lib/cache/rrset_entry.cc
@@ -25,7 +25,8 @@ using namespace isc::dns;
 namespace isc {
 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())),
     expire_time_(time(NULL) + rrset.getTTL().getValue()),
     trust_level_(level),
diff --git a/src/lib/cache/rrset_entry.h b/src/lib/cache/rrset_entry.h
index 09cf79c..129300d 100644
--- a/src/lib/cache/rrset_entry.h
+++ b/src/lib/cache/rrset_entry.h
@@ -75,7 +75,8 @@ public:
     /// \brief Constructor
     /// \param rrset The RRset used to initialize the RRset entry.
     /// \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.
     ~RRsetEntry() {}
diff --git a/src/lib/datasrc/database.cc b/src/lib/datasrc/database.cc
index 1dc5359..139576a 100644
--- a/src/lib/datasrc/database.cc
+++ b/src/lib/datasrc/database.cc
@@ -1120,8 +1120,8 @@ public:
 
     virtual ZoneFinder& getFinder() { return (*finder_); }
 
-    virtual void addRRset(const RRset& rrset);
-    virtual void deleteRRset(const RRset& rrset);
+    virtual void addRRset(const AbstractRRset& rrset);
+    virtual void deleteRRset(const AbstractRRset& rrset);
     virtual void commit();
 
 private:
@@ -1148,14 +1148,15 @@ private:
     // This is a set of validation checks commonly used for addRRset() and
     // deleteRRset to minimize duplicate code logic and to make the main
     // 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 current_phase) const;
 };
 
 void
 DatabaseUpdater::validateAddOrDelete(const char* const op_str,
-                                     const RRset& rrset,
+                                     const AbstractRRset& rrset,
                                      DiffPhase prev_phase,
                                      DiffPhase current_phase) const
 {
@@ -1193,7 +1194,7 @@ DatabaseUpdater::validateAddOrDelete(const char* const op_str,
 }
 
 void
-DatabaseUpdater::addRRset(const RRset& rrset) {
+DatabaseUpdater::addRRset(const AbstractRRset& rrset) {
     validateAddOrDelete("add", rrset, DELETE, ADD);
 
     // It's guaranteed rrset has at least one RDATA at this point.
@@ -1239,7 +1240,7 @@ DatabaseUpdater::addRRset(const RRset& rrset) {
 }
 
 void
-DatabaseUpdater::deleteRRset(const RRset& rrset) {
+DatabaseUpdater::deleteRRset(const AbstractRRset& rrset) {
     // If this is the first operation, pretend we are starting a new delete
     // sequence after adds.  This will simplify the validation below.
     if (diff_phase_ == NOT_STARTED) {
diff --git a/src/lib/datasrc/memory_datasrc.cc b/src/lib/datasrc/memory_datasrc.cc
index 0263b91..450c8b6 100644
--- a/src/lib/datasrc/memory_datasrc.cc
+++ b/src/lib/datasrc/memory_datasrc.cc
@@ -183,7 +183,7 @@ struct InMemoryZoneFinder::InMemoryZoneFinderImpl {
      *
      * If such condition is found, it throws AddError.
      */
-    void contextCheck(const RRset& rrset, const Domain& domain) const {
+    void contextCheck(const AbstractRRset& rrset, const Domain& domain) const {
         // Ensure CNAME and other type of RR don't coexist for the same
         // owner name except with NSEC, which is the only RR that can coexist
         // with CNAME (and also RRSIG, which is handled separately)
@@ -379,7 +379,7 @@ struct InMemoryZoneFinder::InMemoryZoneFinderImpl {
         // Note: there's a slight chance of getting an exception.
         // As noted in add(), we give up strong exception guarantee in such
         // cases.
-        boost::const_pointer_cast<RRset>(covered_rrset)->addRRsig(sig_rrset);
+        boost::const_pointer_cast<AbstractRRset>(covered_rrset)->addRRsig(sig_rrset);
 
         return (result::SUCCESS);
     }
diff --git a/src/lib/datasrc/zone.h b/src/lib/datasrc/zone.h
index 93d3ca9..ff88746 100644
--- a/src/lib/datasrc/zone.h
+++ b/src/lib/datasrc/zone.h
@@ -667,7 +667,7 @@ public:
     /// \exception std::bad_alloc Resource allocation failure
     ///
     /// \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
     ///
@@ -739,7 +739,7 @@ public:
     /// \exception std::bad_alloc Resource allocation failure
     ///
     /// \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
     ///
diff --git a/src/lib/dns/python/message_python.cc b/src/lib/dns/python/message_python.cc
index 48fff94..2f1e2e5 100644
--- a/src/lib/dns/python/message_python.cc
+++ b/src/lib/dns/python/message_python.cc
@@ -433,7 +433,7 @@ private:
 };
 
 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?)
 PyObject*
diff --git a/src/lib/dns/python/rrset_python.cc b/src/lib/dns/python/rrset_python.cc
index 77d520b..2992522 100644
--- a/src/lib/dns/python/rrset_python.cc
+++ b/src/lib/dns/python/rrset_python.cc
@@ -415,7 +415,7 @@ PyTypeObject rrset_type = {
 };
 
 PyObject*
-createRRsetObject(const RRset& source) {
+createRRsetObject(const AbstractRRset& source) {
 
     // RRsets are noncopyable, so as a workaround we recreate a new one
     // and copy over all content
@@ -450,7 +450,7 @@ PyRRset_Check(PyObject* obj) {
     return (PyObject_TypeCheck(obj, &rrset_type));
 }
 
-RRset&
+AbstractRRset&
 PyRRset_ToRRset(PyObject* rrset_obj) {
     s_RRset* rrset = static_cast<s_RRset*>(rrset_obj);
     return (*rrset->cppobj);
diff --git a/src/lib/dns/python/rrset_python.h b/src/lib/dns/python/rrset_python.h
index 4268678..2435397 100644
--- a/src/lib/dns/python/rrset_python.h
+++ b/src/lib/dns/python/rrset_python.h
@@ -36,7 +36,7 @@ extern PyTypeObject rrset_type;
 /// returns a NULL pointer).
 /// This function is expected to be called within a try block
 /// 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
 ///
@@ -56,7 +56,7 @@ bool PyRRset_Check(PyObject* obj);
 /// may be destroyed, the caller must copy it itself.
 ///
 /// \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
 ///        given Python object.
diff --git a/src/lib/dns/rrset.h b/src/lib/dns/rrset.h
index aad50aa..e43c1f0 100644
--- a/src/lib/dns/rrset.h
+++ b/src/lib/dns/rrset.h
@@ -58,14 +58,14 @@ class RRset;
 ///
 /// This type is commonly used as an argument of various functions defined
 /// 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
 /// object.
 ///
 /// This type is commonly used as an argument of various functions defined
 /// 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.
 typedef boost::shared_ptr<RdataIterator> RdataIteratorPtr;
@@ -400,6 +400,82 @@ public:
     /// object.
     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(const 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>.)
+    ///
+    /// \param sigs Pointer to a RRSIG RRset containing signatures to be added
+    ///             to the RRSIG RRset associated with this class.
+    virtual void addRRsig(const RRsetPtr& sigs) = 0;
+
+    /// \brief Clear the RRSIGs for this RRset
+    virtual void removeRRsig() = 0;
+
+    //@}
 };
 
 /// \brief The \c RdataIterator class is an abstract base class that
@@ -660,6 +736,56 @@ public:
     /// object for the \c BasicRRset class.
     virtual RdataIteratorPtr getRdataIterator() const;
     //@}
+
+    ///
+    /// \name 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.
+    //@{
+    /// \brief Return pointer to this RRset's RRSIG RRset
+    ///
+    /// \exception NotImplemented Always thrown.  Associated RRSIG RRsets are
+    ///            not supported in this class.
+    ///
+    /// \return Null pointer, as this class does not support RRSIG records.
+    virtual RRsetPtr getRRsig() const {
+        return (RRsetPtr());
+    }
+
+    virtual void addRRsig(const rdata::ConstRdataPtr&) {
+        isc_throw(NotImplemented,
+                  "BasicRRset does not implement the addRRsig() method");
+    }
+
+    virtual void addRRsig(const rdata::RdataPtr&) {
+        isc_throw(NotImplemented,
+                  "BasicRRset does not implement the addRRsig() method");
+    }
+
+    virtual void addRRsig(const AbstractRRset&) {
+        isc_throw(NotImplemented,
+                  "BasicRRset does not implement the addRRsig() method");
+    }
+
+    virtual void addRRsig(const ConstRRsetPtr&) {
+        isc_throw(NotImplemented,
+                  "BasicRRset does not implement the addRRsig() method");
+    }
+
+    virtual void addRRsig(const RRsetPtr&) {
+        isc_throw(NotImplemented,
+                  "BasicRRset does not implement the addRRsig() method");
+    }
+
+    virtual void removeRRsig() {
+        isc_throw(NotImplemented,
+                  "BasicRRset does not implement the removeRRsig() method");
+    }
+    //@}
 private:
     BasicRRsetImpl* impl_;
 };
@@ -693,7 +819,7 @@ public:
     }
 
     /// \brief Adds an RRSIG RR to this RRset's signatures
-    virtual void addRRsig(const rdata::ConstRdataPtr rdata) {
+    virtual void addRRsig(const rdata::ConstRdataPtr& rdata) {
         if (!rrsig_) {
             rrsig_ = RRsetPtr(new RRset(getName(), getClass(),
                                         RRType::RRSIG(), getTTL()));
@@ -705,12 +831,12 @@ public:
     // conversion from shared_ptr<X> to shared_ptr<const X>.  Note: we should
     // revisit the interface of managing RRset signatures, at which point this
     // problem may go away.
-    void addRRsig(const rdata::RdataPtr rdata) {
-        addRRsig(static_cast<rdata::ConstRdataPtr>(rdata));
+    virtual void addRRsig(const rdata::RdataPtr& rdata) {
+        addRRsig(static_cast<const rdata::ConstRdataPtr&>(rdata));
     }
 
     /// \brief Adds an RRSIG RRset to this RRset
-    void addRRsig(const AbstractRRset& sigs) {
+    virtual void addRRsig(const AbstractRRset& sigs) {
         RdataIteratorPtr it = sigs.getRdataIterator();
 
         if (!rrsig_) {
@@ -723,13 +849,13 @@ public:
         }
     }
 
-    void addRRsig(ConstRRsetPtr sigs) { addRRsig(*sigs); }
+    virtual void addRRsig(const ConstRRsetPtr& sigs) { addRRsig(*sigs); }
 
     // Another workaround for older boost (see above)
-    void addRRsig(RRsetPtr sigs) { addRRsig(*sigs); }
+    virtual void addRRsig(const RRsetPtr& sigs) { addRRsig(*sigs); }
 
     /// \brief Clear the RRSIGs for this RRset
-    void removeRRsig() { rrsig_ = RRsetPtr(); }
+    virtual void removeRRsig() { rrsig_ = RRsetPtr(); }
 
     /// \brief Return a pointer to this RRset's RRSIG RRset
     RRsetPtr getRRsig() const { return (rrsig_); }
diff --git a/src/lib/nsas/tests/nameserver_address_store_unittest.cc b/src/lib/nsas/tests/nameserver_address_store_unittest.cc
index 4785627..6ddae72 100644
--- a/src/lib/nsas/tests/nameserver_address_store_unittest.cc
+++ b/src/lib/nsas/tests/nameserver_address_store_unittest.cc
@@ -475,7 +475,7 @@ TEST_F(NameserverAddressStoreTest, updateRTT) {
     // for ns.example.com (the nameserver set for example.net in the class
     // initialization).  We'll set two addresses.
     Name ns_example_com(ns_name);
-    RRsetPtr ns_address = boost::shared_ptr<RRset>(new RRset(
+    isc::dns::RRsetPtr ns_address = boost::shared_ptr<RRset>(new RRset(
         ns_example_com, RRClass::IN(), RRType::A(), RRTTL(300)));
     BOOST_FOREACH(string addr, address) {
         ns_address->addRdata(rdata::in::A(addr));




More information about the bind10-changes mailing list