BIND 10 trac2268, updated. 27be672609dde261c85ffc671f1026277cfc3e9a [2268] Just remove obsolete comment

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Oct 4 19:17:15 UTC 2012


The branch, trac2268 has been updated
       via  27be672609dde261c85ffc671f1026277cfc3e9a (commit)
       via  18cff787ef721f58322db5c5662ab7980357fe68 (commit)
       via  34020849e9b1d560fdc21b25ac0fe03c64f71a01 (commit)
       via  ae53c8fd697e2cd037facfccc8205d580b27f04e (commit)
       via  97fb03f6b015205da25e9c5be3cd90d4f9948d04 (commit)
       via  23d2eaf5f8e5febc4732f3fdc851e1b04914daf8 (commit)
      from  1137e979e1a22465feb03ee0a48499bebcdf6aae (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 27be672609dde261c85ffc671f1026277cfc3e9a
Author: Mukund Sivaraman <muks at isc.org>
Date:   Fri Oct 5 00:34:12 2012 +0530

    [2268] Just remove obsolete comment

commit 18cff787ef721f58322db5c5662ab7980357fe68
Author: Mukund Sivaraman <muks at isc.org>
Date:   Fri Oct 5 00:32:30 2012 +0530

    [2268] Rename method to addToZoneData()

commit 34020849e9b1d560fdc21b25ac0fe03c64f71a01
Author: Mukund Sivaraman <muks at isc.org>
Date:   Fri Oct 5 00:28:18 2012 +0530

    [2268] Move LoadCallback typedef to an internal namespace

commit ae53c8fd697e2cd037facfccc8205d580b27f04e
Author: Mukund Sivaraman <muks at isc.org>
Date:   Fri Oct 5 00:16:58 2012 +0530

    [2268] Move Loader to live under ZoneDataUpdater

commit 97fb03f6b015205da25e9c5be3cd90d4f9948d04
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Oct 4 23:52:29 2012 +0530

    [2268] Update comment about unnamed namespace

commit 23d2eaf5f8e5febc4732f3fdc851e1b04914daf8
Author: Mukund Sivaraman <muks at isc.org>
Date:   Thu Oct 4 23:29:10 2012 +0530

    [2268] Use a single NSEC3Hash instance inside ZoneDataUpdater

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

Summary of changes:
 src/lib/datasrc/memory/memory_client.cc            |  119 ++--------------
 src/lib/datasrc/memory/memory_client.h             |   18 +--
 src/lib/datasrc/memory/zone_data_updater.cc        |  104 ++++++++++++--
 src/lib/datasrc/memory/zone_data_updater.h         |   59 +++++++-
 .../datasrc/tests/memory/zone_finder_unittest.cc   |  147 ++++++++++----------
 5 files changed, 242 insertions(+), 205 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/memory_client.cc b/src/lib/datasrc/memory/memory_client.cc
index e1c1089..de1b91d 100644
--- a/src/lib/datasrc/memory/memory_client.cc
+++ b/src/lib/datasrc/memory/memory_client.cc
@@ -36,11 +36,8 @@
 #include <dns/masterload.h>
 
 #include <boost/bind.hpp>
-#include <boost/foreach.hpp>
-#include <boost/noncopyable.hpp>
 
 #include <algorithm>
-#include <map>
 #include <utility>
 #include <cctype>
 #include <cassert>
@@ -65,119 +62,19 @@ public:
     }
 };
 
-// A helper internal class for load().  make it non-copyable to avoid
-// accidental copy.
-//
-// The current internal implementation expects that both a normal
-// (non RRSIG) RRset and (when signed) its RRSIG are added at once.
-// Also in the current implementation, the input sequence of RRsets
-// are grouped with their owner name (so once a new owner name is encountered,
-// no subsequent RRset has the previous owner name), but the ordering
-// in the same group is not fixed.  So we hold all RRsets of the same
-// owner name in node_rrsets_ and node_rrsigsets_, and add the matching
-// pairs of RRsets to the zone when we see a new owner name.
-//
-// The caller is responsible for adding the RRsets of the last group
-// in the input sequence by explicitly calling flushNodeRRsets() at the
-// end.  It's cleaner and more robust if we let the destructor of this class
-// do it, but since we cannot guarantee the adding operation is exception free,
-// we don't choose that option to maintain the common expectation for
-// destructors.
-class InMemoryClient::Loader : boost::noncopyable {
-    typedef std::map<RRType, ConstRRsetPtr> NodeRRsets;
-    typedef NodeRRsets::value_type NodeRRsetsVal;
-public:
-    Loader(util::MemorySegment& mem_sgmt, const RRClass rrclass,
-           const Name& zone_name, ZoneData& zone_data) :
-        updater_(mem_sgmt, rrclass, zone_name, zone_data)
-    {}
-    void addFromLoad(const ConstRRsetPtr& rrset) {
-        // If we see a new name, flush the temporary holders, adding the
-        // pairs of RRsets and RRSIGs of the previous name to the zone.
-        if ((!node_rrsets_.empty() || !node_rrsigsets_.empty()) &&
-            getCurrentName() != rrset->getName()) {
-            flushNodeRRsets();
-        }
-
-        // Store this RRset until it can be added to the zone.  The current
-        // implementation requires RRs of the same RRset should be added at
-        // once, so we check the "duplicate" here.
-        const bool is_rrsig = rrset->getType() == RRType::RRSIG();
-        NodeRRsets& node_rrsets = is_rrsig ? node_rrsigsets_ : node_rrsets_;
-        const RRType& rrtype = is_rrsig ?
-            getCoveredType(rrset) : rrset->getType();
-        if (!node_rrsets.insert(NodeRRsetsVal(rrtype, rrset)).second) {
-            isc_throw(ZoneDataUpdater::AddError,
-                      "Duplicate add of the same type of"
-                      << (is_rrsig ? " RRSIG" : "") << " RRset: "
-                      << rrset->getName() << "/" << rrtype);
-        }
-    }
-    void flushNodeRRsets() {
-        BOOST_FOREACH(NodeRRsetsVal val, node_rrsets_) {
-            // Identify the corresponding RRSIG for the RRset, if any.
-            // If found add both the RRset and its RRSIG at once.
-            ConstRRsetPtr sig_rrset;
-            NodeRRsets::iterator sig_it =
-                node_rrsigsets_.find(val.first);
-            if (sig_it != node_rrsigsets_.end()) {
-                sig_rrset = sig_it->second;
-                node_rrsigsets_.erase(sig_it);
-            }
-            updater_.add(val.second, sig_rrset);
-        }
-
-        // Right now, we don't accept RRSIG without covered RRsets (this
-        // should eventually allowed, but to do so we'll need to update the
-        // finder).
-        if (!node_rrsigsets_.empty()) {
-            isc_throw(ZoneDataUpdater::AddError,
-                      "RRSIG is added without covered RRset for "
-                      << getCurrentName());
-        }
-
-        node_rrsets_.clear();
-        node_rrsigsets_.clear();
-    }
-private:
-    // A helper to identify the covered type of an RRSIG.
-    static RRType getCoveredType(const ConstRRsetPtr& sig_rrset) {
-        RdataIteratorPtr it = sig_rrset->getRdataIterator();
-        // Empty RRSIG shouldn't be passed either via a master file or another
-        // data source iterator, but it could still happen if the iterator
-        // has a bug.  We catch and reject such cases.
-        if (it->isLast()) {
-            isc_throw(isc::Unexpected,
-                      "Empty RRset is passed in-memory loader, name: "
-                      << sig_rrset->getName());
-        }
-        return (dynamic_cast<const generic::RRSIG&>(it->getCurrent()).
-                typeCovered());
-    }
-    const Name& getCurrentName() const {
-        if (!node_rrsets_.empty()) {
-            return (node_rrsets_.begin()->second->getName());
-        }
-        assert(!node_rrsigsets_.empty());
-        return (node_rrsigsets_.begin()->second->getName());
-    }
-
-private:
-    NodeRRsets node_rrsets_;
-    NodeRRsets node_rrsigsets_;
-    ZoneDataUpdater updater_;
-};
-
 result::Result
 InMemoryClient::load(const Name& zone_name,
                      const string& filename,
-                     boost::function<void(LoadCallback)> rrset_installer)
+                     boost::function<void(internal::LoadCallback)>
+                         rrset_installer)
 {
     SegmentObjectHolder<ZoneData, RRClass> holder(
         mem_sgmt_, ZoneData::create(mem_sgmt_, zone_name), rrclass_);
 
-    Loader loader(mem_sgmt_, rrclass_, zone_name, *holder.get());
-    rrset_installer(boost::bind(&Loader::addFromLoad, &loader, _1));
+    ZoneDataUpdater::Loader loader(mem_sgmt_, rrclass_,
+                                   zone_name, *holder.get());
+    rrset_installer(boost::bind(&ZoneDataUpdater::Loader::addFromLoad,
+                                &loader, _1));
     // Add any last RRsets that were left
     loader.flushNodeRRsets();
 
@@ -247,7 +144,7 @@ namespace {
 void
 masterLoadWrapper(const char* const filename, const Name& origin,
                   const RRClass& zone_class,
-                  InMemoryClient::LoadCallback callback)
+                  internal::LoadCallback callback)
 {
     masterLoad(filename, origin, zone_class, boost::bind(callback, _1));
 }
@@ -255,7 +152,7 @@ masterLoadWrapper(const char* const filename, const Name& origin,
 // The installer called from load() for the iterator version of load().
 void
 generateRRsetFromIterator(ZoneIterator* iterator,
-                          InMemoryClient::LoadCallback callback)
+                          internal::LoadCallback callback)
 {
     ConstRRsetPtr rrset;
     while ((rrset = iterator->getNextRRset()) != NULL) {
diff --git a/src/lib/datasrc/memory/memory_client.h b/src/lib/datasrc/memory/memory_client.h
index 438e3fb..262cbb7 100644
--- a/src/lib/datasrc/memory/memory_client.h
+++ b/src/lib/datasrc/memory/memory_client.h
@@ -36,6 +36,14 @@ class RRsetList;
 namespace datasrc {
 namespace memory {
 
+namespace internal {
+    // Please don't use anything from here outside the InMemoryClient
+    // implementation.
+
+    // A functor type used for loading.
+    typedef boost::function<void(isc::dns::ConstRRsetPtr)> LoadCallback;
+} // end of internal namespace
+
 /// \brief A data source client that holds all necessary data in memory.
 ///
 /// The \c InMemoryClient class provides an access to a conceptual data
@@ -206,9 +214,6 @@ public:
     getJournalReader(const isc::dns::Name& zone, uint32_t begin_serial,
                      uint32_t end_serial) const;
 
-    // A functor type used for loading.
-    typedef boost::function<void(isc::dns::ConstRRsetPtr)> LoadCallback;
-
 private:
     // Some type aliases
     typedef DomainTree<std::string> FileNameTree;
@@ -224,7 +229,8 @@ private:
     // loaded from another data source.
     result::Result load(const isc::dns::Name& zone_name,
                         const std::string& filename,
-                        boost::function<void(LoadCallback)> rrset_installer);
+                        boost::function<void(internal::LoadCallback)>
+                            rrset_installer);
 
     util::MemorySegment& mem_sgmt_;
     const isc::dns::RRClass rrclass_;
@@ -235,10 +241,6 @@ private:
     // A helper internal class used by the memory client, used for
     // deleting filenames stored in an internal tree.
     class FileNameDeleter;
-
-    // A helper internal class used by load().  It maintains some intermediate
-    // states while loading RRs of the zone.
-    class Loader;
 };
 
 } // namespace memory
diff --git a/src/lib/datasrc/memory/zone_data_updater.cc b/src/lib/datasrc/memory/zone_data_updater.cc
index 8cd93ba..f5a85a4 100644
--- a/src/lib/datasrc/memory/zone_data_updater.cc
+++ b/src/lib/datasrc/memory/zone_data_updater.cc
@@ -16,9 +16,9 @@
 #include <datasrc/zone.h>
 
 #include <dns/rdataclass.h>
-#include <dns/nsec3hash.h>
 
 #include <boost/scoped_ptr.hpp>
+#include <boost/foreach.hpp>
 
 using namespace isc::dns;
 using namespace isc::dns::rdata;
@@ -27,7 +27,7 @@ namespace isc {
 namespace datasrc {
 namespace memory {
 
-namespace { // anonymous namespace
+namespace { // unnamed namespace
 
 // Returns a value-less than, or greater-than zero if 'a' is less-than
 // or greater-than 'b'. If they are equal, it returns 0. The comparison
@@ -72,7 +72,7 @@ compareTypes(const RdataSet* a, const RdataSet* b) {
     return (-1);
 }
 
-} // end of anonymous namespace
+} // end of unnamed namespace
 
 void
 ZoneDataUpdater::addWildcards(const Name& name) {
@@ -231,6 +231,22 @@ ZoneDataUpdater::validate(const isc::dns::ConstRRsetPtr rrset) const {
     }
 }
 
+const NSEC3Hash*
+ZoneDataUpdater::getNSEC3Hash() {
+    if (hash_ == NULL) {
+        NSEC3Data* nsec3_data = zone_data_.getNSEC3Data();
+        // This should never be NULL in this codepath.
+        assert(nsec3_data != NULL);
+
+        hash_ = NSEC3Hash::create(nsec3_data->hashalg,
+                                  nsec3_data->iterations,
+                                  nsec3_data->getSaltData(),
+                                  nsec3_data->getSaltLen());
+    }
+
+    return (hash_);
+}
+
 template <typename T>
 void
 ZoneDataUpdater::setupNSEC3(const ConstRRsetPtr rrset) {
@@ -245,12 +261,7 @@ ZoneDataUpdater::setupNSEC3(const ConstRRsetPtr rrset) {
         zone_data_.setNSEC3Data(nsec3_data);
         zone_data_.setSigned(true);
     } else {
-        const boost::scoped_ptr<NSEC3Hash> hash
-            (NSEC3Hash::create(nsec3_data->hashalg,
-                               nsec3_data->iterations,
-                               nsec3_data->getSaltData(),
-                               nsec3_data->getSaltLen()));
-
+        const NSEC3Hash* hash = getNSEC3Hash();
         if (!hash->match(nsec3_rdata)) {
             isc_throw(AddError,
                       rrset->getType() << " with inconsistent parameters: "
@@ -375,6 +386,81 @@ ZoneDataUpdater::add(const ConstRRsetPtr& rrset,
     addRdataSet(rrset, sig_rrset);
 }
 
+
+void
+ZoneDataUpdater::Loader::addFromLoad(const ConstRRsetPtr& rrset) {
+    // If we see a new name, flush the temporary holders, adding the
+    // pairs of RRsets and RRSIGs of the previous name to the zone.
+    if ((!node_rrsets_.empty() || !node_rrsigsets_.empty()) &&
+        (getCurrentName() != rrset->getName())) {
+        flushNodeRRsets();
+    }
+
+    // Store this RRset until it can be added to the zone.  The current
+    // implementation requires RRs of the same RRset should be added at
+    // once, so we check the "duplicate" here.
+    const bool is_rrsig = rrset->getType() == RRType::RRSIG();
+    NodeRRsets& node_rrsets = is_rrsig ? node_rrsigsets_ : node_rrsets_;
+    const RRType& rrtype = is_rrsig ? getCoveredType(rrset) : rrset->getType();
+    if (!node_rrsets.insert(NodeRRsetsVal(rrtype, rrset)).second) {
+        isc_throw(ZoneDataUpdater::AddError,
+                  "Duplicate add of the same type of"
+                  << (is_rrsig ? " RRSIG" : "") << " RRset: "
+                  << rrset->getName() << "/" << rrtype);
+    }
+}
+
+void
+ZoneDataUpdater::Loader::flushNodeRRsets() {
+    BOOST_FOREACH(NodeRRsetsVal val, node_rrsets_) {
+        // Identify the corresponding RRSIG for the RRset, if any.  If
+        // found add both the RRset and its RRSIG at once.
+        ConstRRsetPtr sig_rrset;
+        NodeRRsets::iterator sig_it = node_rrsigsets_.find(val.first);
+        if (sig_it != node_rrsigsets_.end()) {
+            sig_rrset = sig_it->second;
+            node_rrsigsets_.erase(sig_it);
+        }
+        updater_.add(val.second, sig_rrset);
+    }
+
+    // Right now, we don't accept RRSIG without covered RRsets (this
+    // should eventually allowed, but to do so we'll need to update the
+    // finder).
+    if (!node_rrsigsets_.empty()) {
+        isc_throw(ZoneDataUpdater::AddError,
+                  "RRSIG is added without covered RRset for "
+                  << getCurrentName());
+    }
+
+    node_rrsets_.clear();
+    node_rrsigsets_.clear();
+}
+
+RRType
+ZoneDataUpdater::Loader::getCoveredType(const ConstRRsetPtr& sig_rrset) {
+    RdataIteratorPtr it = sig_rrset->getRdataIterator();
+    // Empty RRSIG shouldn't be passed either via a master file or
+    // another data source iterator, but it could still happen if the
+    // iterator has a bug.  We catch and reject such cases.
+    if (it->isLast()) {
+        isc_throw(isc::Unexpected,
+                  "Empty RRset is passed in-memory loader, name: "
+                  << sig_rrset->getName());
+    }
+    return (dynamic_cast<const generic::RRSIG&>(it->getCurrent()).
+            typeCovered());
+}
+
+const Name&
+ZoneDataUpdater::Loader::getCurrentName() const {
+    if (!node_rrsets_.empty()) {
+        return (node_rrsets_.begin()->second->getName());
+    }
+    assert(!node_rrsigsets_.empty());
+    return (node_rrsigsets_.begin()->second->getName());
+}
+
 } // namespace memory
 } // namespace datasrc
 } // namespace isc
diff --git a/src/lib/datasrc/memory/zone_data_updater.h b/src/lib/datasrc/memory/zone_data_updater.h
index 5bb03a1..1c00aef 100644
--- a/src/lib/datasrc/memory/zone_data_updater.h
+++ b/src/lib/datasrc/memory/zone_data_updater.h
@@ -20,9 +20,11 @@
 #include <dns/name.h>
 #include <dns/rrclass.h>
 #include <dns/rrset.h>
+#include <dns/nsec3hash.h>
 #include <util/memory_segment.h>
 
 #include <boost/noncopyable.hpp>
+#include <map>
 
 namespace isc {
 namespace datasrc {
@@ -37,12 +39,14 @@ public:
        mem_sgmt_(mem_sgmt),
        rrclass_(rrclass),
        zone_name_(zone_name),
-       zone_data_(zone_data)
+       zone_data_(zone_data),
+       hash_(NULL)
     {}
 
     /// The destructor.
-    ~ZoneDataUpdater()
-    {}
+    ~ZoneDataUpdater() {
+        delete hash_;
+    }
 
     //@}
 
@@ -81,6 +85,10 @@ public:
     void add(const isc::dns::ConstRRsetPtr& rrset,
              const isc::dns::ConstRRsetPtr& sig_rrset);
 
+    // A helper internal class used by InMemoryClient::load(). It
+    // maintains some intermediate states while loading RRs of the zone.
+    class Loader;
+
 private:
     // Add the necessary magic for any wildcard contained in 'name'
     // (including itself) to be found in the zone.
@@ -109,6 +117,7 @@ private:
     // the strong exception guarantee.
     void validate(const isc::dns::ConstRRsetPtr rrset) const;
 
+    const isc::dns::NSEC3Hash* getNSEC3Hash();
     template <typename T>
     void setupNSEC3(const isc::dns::ConstRRsetPtr rrset);
     void addNSEC3(const isc::dns::ConstRRsetPtr rrset,
@@ -121,6 +130,50 @@ private:
     const isc::dns::Name& zone_name_;
     ZoneData& zone_data_;
     RdataEncoder encoder_;
+    isc::dns::NSEC3Hash* hash_;
+};
+
+// A helper internal class for load().  make it non-copyable to avoid
+// accidental copy.
+//
+// The current internal implementation expects that both a normal
+// (non RRSIG) RRset and (when signed) its RRSIG are added at once.
+// Also in the current implementation, the input sequence of RRsets
+// are grouped with their owner name (so once a new owner name is encountered,
+// no subsequent RRset has the previous owner name), but the ordering
+// in the same group is not fixed.  So we hold all RRsets of the same
+// owner name in node_rrsets_ and node_rrsigsets_, and add the matching
+// pairs of RRsets to the zone when we see a new owner name.
+//
+// The caller is responsible for adding the RRsets of the last group
+// in the input sequence by explicitly calling flushNodeRRsets() at the
+// end.  It's cleaner and more robust if we let the destructor of this class
+// do it, but since we cannot guarantee the adding operation is exception free,
+// we don't choose that option to maintain the common expectation for
+// destructors.
+class ZoneDataUpdater::Loader : boost::noncopyable {
+public:
+    Loader(util::MemorySegment& mem_sgmt, const isc::dns::RRClass rrclass,
+           const isc::dns::Name& zone_name, ZoneData& zone_data) :
+        updater_(mem_sgmt, rrclass, zone_name, zone_data)
+    {}
+
+    void addFromLoad(const isc::dns::ConstRRsetPtr& rrset);
+    void flushNodeRRsets();
+
+private:
+    typedef std::map<isc::dns::RRType, isc::dns::ConstRRsetPtr> NodeRRsets;
+    typedef NodeRRsets::value_type NodeRRsetsVal;
+
+    // A helper to identify the covered type of an RRSIG.
+    static isc::dns::RRType getCoveredType
+        (const isc::dns::ConstRRsetPtr& sig_rrset);
+    const isc::dns::Name& getCurrentName() const;
+
+private:
+    NodeRRsets node_rrsets_;
+    NodeRRsets node_rrsigsets_;
+    ZoneDataUpdater updater_;
 };
 
 } // namespace memory
diff --git a/src/lib/datasrc/tests/memory/zone_finder_unittest.cc b/src/lib/datasrc/tests/memory/zone_finder_unittest.cc
index f950ccb..4cd08c0 100644
--- a/src/lib/datasrc/tests/memory/zone_finder_unittest.cc
+++ b/src/lib/datasrc/tests/memory/zone_finder_unittest.cc
@@ -192,8 +192,7 @@ public:
         ZoneData::destroy(mem_sgmt_, zone_data_, RRClass::IN());
     }
 
-    // simplified version of 'loading' data
-    void addZoneData(const ConstRRsetPtr rrset) {
+    void addToZoneData(const ConstRRsetPtr rrset) {
         updater_.add(rrset, rrset->getRRsig());
     }
 
@@ -419,7 +418,7 @@ TEST_F(InMemoryZoneFinderTest, constructor) {
 
 TEST_F(InMemoryZoneFinderTest, findCNAME) {
     // install CNAME RR
-    addZoneData(rr_cname_);
+    addToZoneData(rr_cname_);
 
     // Find A RR of the same.  Should match the CNAME
     findTest(rr_cname_->getName(), RRType::NS(), ZoneFinder::CNAME, true,
@@ -434,10 +433,10 @@ TEST_F(InMemoryZoneFinderTest, findCNAMEUnderZoneCut) {
     // There's nothing special when we find a CNAME under a zone cut
     // (with FIND_GLUE_OK).  The behavior is different from BIND 9,
     // so we test this case explicitly.
-    addZoneData(rr_child_ns_);
+    addToZoneData(rr_child_ns_);
     ConstRRsetPtr rr_cname_under_cut_ = textToRRset(
         "cname.child.example.org. 300 IN CNAME target.child.example.org.");
-    addZoneData(rr_cname_under_cut_);
+    addToZoneData(rr_cname_under_cut_);
     findTest(Name("cname.child.example.org"), RRType::AAAA(),
              ZoneFinder::CNAME, true, rr_cname_under_cut_,
              ZoneFinder::RESULT_DEFAULT, NULL, ZoneFinder::FIND_GLUE_OK);
@@ -445,7 +444,7 @@ TEST_F(InMemoryZoneFinderTest, findCNAMEUnderZoneCut) {
 
 // Search under a DNAME record. It should return the DNAME
 TEST_F(InMemoryZoneFinderTest, findBelowDNAME) {
-    EXPECT_NO_THROW(addZoneData(rr_dname_));
+    EXPECT_NO_THROW(addToZoneData(rr_dname_));
     findTest(Name("below.dname.example.org"), RRType::A(), ZoneFinder::DNAME,
              true, rr_dname_);
 }
@@ -453,8 +452,8 @@ TEST_F(InMemoryZoneFinderTest, findBelowDNAME) {
 // Search at the domain with DNAME. It should act as DNAME isn't there, DNAME
 // influences only the data below (see RFC 2672, section 3)
 TEST_F(InMemoryZoneFinderTest, findAtDNAME) {
-    EXPECT_NO_THROW(addZoneData(rr_dname_));
-    EXPECT_NO_THROW(addZoneData(rr_dname_a_));
+    EXPECT_NO_THROW(addToZoneData(rr_dname_));
+    EXPECT_NO_THROW(addToZoneData(rr_dname_a_));
 
     const Name dname_name(rr_dname_->getName());
     findTest(dname_name, RRType::A(), ZoneFinder::SUCCESS, true, rr_dname_a_);
@@ -466,8 +465,8 @@ TEST_F(InMemoryZoneFinderTest, findAtDNAME) {
 // Try searching something that is both under NS and DNAME, without and with
 // GLUE_OK mode (it should stop at the NS and DNAME respectively).
 TEST_F(InMemoryZoneFinderTest, DNAMEUnderNS) {
-    addZoneData(rr_child_ns_);
-    addZoneData(rr_child_dname_);
+    addToZoneData(rr_child_ns_);
+    addToZoneData(rr_child_dname_);
 
     Name lowName("below.dname.child.example.org.");
 
@@ -479,10 +478,10 @@ TEST_F(InMemoryZoneFinderTest, DNAMEUnderNS) {
 // Test adding child zones and zone cut handling
 TEST_F(InMemoryZoneFinderTest, delegationNS) {
     // add in-zone data
-    EXPECT_NO_THROW(addZoneData(rr_ns_));
+    EXPECT_NO_THROW(addToZoneData(rr_ns_));
 
     // install a zone cut
-    EXPECT_NO_THROW(addZoneData(rr_child_ns_));
+    EXPECT_NO_THROW(addToZoneData(rr_child_ns_));
 
     // below the zone cut
     findTest(Name("www.child.example.org"), RRType::A(),
@@ -499,7 +498,7 @@ TEST_F(InMemoryZoneFinderTest, delegationNS) {
     findTest(origin_, RRType::NS(), ZoneFinder::SUCCESS, true, rr_ns_);
 
     // unusual case of "nested delegation": the highest cut should be used.
-    EXPECT_NO_THROW(addZoneData(rr_grandchild_ns_));
+    EXPECT_NO_THROW(addToZoneData(rr_grandchild_ns_));
     findTest(Name("www.grand.child.example.org"), RRType::A(),
              // note: !rr_grandchild_ns_
              ZoneFinder::DELEGATION, true, rr_child_ns_);
@@ -508,9 +507,9 @@ TEST_F(InMemoryZoneFinderTest, delegationNS) {
 TEST_F(InMemoryZoneFinderTest, delegationWithDS) {
     // Similar setup to the previous one, but with DS RR at the delegation
     // point.
-    addZoneData(rr_ns_);
-    addZoneData(rr_child_ns_);
-    addZoneData(rr_child_ds_);
+    addToZoneData(rr_ns_);
+    addToZoneData(rr_child_ns_);
+    addToZoneData(rr_child_ds_);
 
     // Normal types of query should result in delegation, but DS query
     // should be considered in-zone (but only exactly at the delegation point).
@@ -528,9 +527,9 @@ TEST_F(InMemoryZoneFinderTest, delegationWithDS) {
 }
 
 TEST_F(InMemoryZoneFinderTest, findAny) {
-    EXPECT_NO_THROW(addZoneData(rr_a_));
-    EXPECT_NO_THROW(addZoneData(rr_ns_));
-    EXPECT_NO_THROW(addZoneData(rr_child_glue_));
+    EXPECT_NO_THROW(addToZoneData(rr_a_));
+    EXPECT_NO_THROW(addToZoneData(rr_ns_));
+    EXPECT_NO_THROW(addToZoneData(rr_child_glue_));
 
     vector<ConstRRsetPtr> expected_sets;
 
@@ -549,7 +548,7 @@ TEST_F(InMemoryZoneFinderTest, findAny) {
     findAllTest(rr_child_glue_->getName(), ZoneFinder::SUCCESS, expected_sets);
 
     // add zone cut
-    EXPECT_NO_THROW(addZoneData(rr_child_ns_));
+    EXPECT_NO_THROW(addToZoneData(rr_child_ns_));
 
     // zone cut
     findAllTest(rr_child_ns_->getName(), ZoneFinder::DELEGATION,
@@ -565,16 +564,16 @@ TEST_F(InMemoryZoneFinderTest, findAny) {
 TEST_F(InMemoryZoneFinderTest, glue) {
     // install zone data:
     // a zone cut
-    EXPECT_NO_THROW(addZoneData(rr_child_ns_));
+    EXPECT_NO_THROW(addToZoneData(rr_child_ns_));
     // glue for this cut
-    EXPECT_NO_THROW(addZoneData(rr_child_glue_));
+    EXPECT_NO_THROW(addToZoneData(rr_child_glue_));
     // a nested zone cut (unusual)
-    EXPECT_NO_THROW(addZoneData(rr_grandchild_ns_));
+    EXPECT_NO_THROW(addToZoneData(rr_grandchild_ns_));
     // glue under the deeper zone cut
-    EXPECT_NO_THROW(addZoneData(rr_grandchild_glue_));
+    EXPECT_NO_THROW(addToZoneData(rr_grandchild_glue_));
     // glue 'at the' zone cut
-    EXPECT_NO_THROW(addZoneData(rr_ns_a_));
-    EXPECT_NO_THROW(addZoneData(rr_ns_ns_));
+    EXPECT_NO_THROW(addToZoneData(rr_ns_a_));
+    EXPECT_NO_THROW(addToZoneData(rr_ns_ns_));
 
     // by default glue is hidden due to the zone cut
     findTest(rr_child_glue_->getName(), RRType::A(), ZoneFinder::DELEGATION,
@@ -630,16 +629,16 @@ InMemoryZoneFinderTest::findCheck(ZoneFinder::FindResultFlags expected_flags,
     rr_a_->addRRsig(createRdata(RRType::RRSIG(), RRClass::IN(),
                                 "A 5 3 3600 20120814220826 20120715220826 "
                                 "1234 example.com. FAKE"));
-    EXPECT_NO_THROW(addZoneData(rr_ns_));
-    EXPECT_NO_THROW(addZoneData(rr_ns_a_));
-    EXPECT_NO_THROW(addZoneData(rr_ns_aaaa_));
-    EXPECT_NO_THROW(addZoneData(rr_a_));
+    EXPECT_NO_THROW(addToZoneData(rr_ns_));
+    EXPECT_NO_THROW(addToZoneData(rr_ns_a_));
+    EXPECT_NO_THROW(addToZoneData(rr_ns_aaaa_));
+    EXPECT_NO_THROW(addToZoneData(rr_a_));
     if ((expected_flags & ZoneFinder::RESULT_NSEC3_SIGNED) != 0) {
-        addZoneData(rr_nsec3_);
+        addToZoneData(rr_nsec3_);
         zone_data_->setSigned(true);
     }
     if ((expected_flags & ZoneFinder::RESULT_NSEC_SIGNED) != 0) {
-        addZoneData(rr_nsec_);
+        addToZoneData(rr_nsec_);
         zone_data_->setSigned(true);
     }
 
@@ -686,7 +685,7 @@ InMemoryZoneFinderTest::findCheck(ZoneFinder::FindResultFlags expected_flags,
              expected_nsec, expected_flags, NULL, find_options);
 
     if ((expected_flags & ZoneFinder::RESULT_NSEC_SIGNED) != 0) {
-        addZoneData(rr_ns_nsec_);
+        addToZoneData(rr_ns_nsec_);
         zone_data_->setSigned(true);
         if ((find_options & ZoneFinder::FIND_DNSSEC) != 0) {
             expected_nsec = rr_ns_nsec_;
@@ -722,8 +721,8 @@ InMemoryZoneFinderTest::findNSECENTCheck(const Name& ent_name,
     ConstRRsetPtr expected_nsec,
     ZoneFinder::FindResultFlags expected_flags)
 {
-    addZoneData(rr_emptywild_);
-    addZoneData(rr_under_wild_);
+    addToZoneData(rr_emptywild_);
+    addToZoneData(rr_under_wild_);
 
     // Sanity check: Should result in NXRRSET
     findTest(ent_name, RRType::A(), ZoneFinder::NXRRSET, true,
@@ -735,10 +734,10 @@ InMemoryZoneFinderTest::findNSECENTCheck(const Name& ent_name,
 
     // Now add the NSEC rrs making it a 'complete' zone (in terms of NSEC,
     // there are no sigs)
-    addZoneData(rr_nsec_);
-    addZoneData(rr_ent_nsec2_);
-    addZoneData(rr_ent_nsec3_);
-    addZoneData(rr_ent_nsec4_);
+    addToZoneData(rr_nsec_);
+    addToZoneData(rr_ent_nsec2_);
+    addToZoneData(rr_ent_nsec3_);
+    addToZoneData(rr_ent_nsec4_);
     zone_data_->setSigned(true);
 
     // Should result in NXRRSET, and RESULT_NSEC_SIGNED
@@ -796,14 +795,14 @@ InMemoryZoneFinderTest::emptyNodeCheck(
     for (int i = 0; names[i] != NULL; ++i) {
         ConstRRsetPtr rrset = textToRRset(string(names[i]) +
                                           " 300 IN A 192.0.2.1");
-        addZoneData(rrset);
+        addToZoneData(rrset);
     }
     if ((expected_flags & ZoneFinder::RESULT_NSEC3_SIGNED) != 0) {
-        addZoneData(rr_nsec3_);
+        addToZoneData(rr_nsec3_);
         zone_data_->setSigned(true);
     }
     if ((expected_flags & ZoneFinder::RESULT_NSEC_SIGNED) != 0) {
-        addZoneData(rr_nsec_);
+        addToZoneData(rr_nsec_);
         zone_data_->setSigned(true);
     }
 
@@ -870,15 +869,15 @@ InMemoryZoneFinderTest::wildcardCheck(
                                             "RRSIG CNAME " +
                                             string(rrsig_common)));
     }
-    addZoneData(rr_wild_);
-    addZoneData(rr_cnamewild_);
+    addToZoneData(rr_wild_);
+    addToZoneData(rr_cnamewild_);
     // If the zone is expected to be "signed" with NSEC3, add an NSEC3.
     // (the content of the NSEC3 shouldn't matter)
     if ((expected_flags & ZoneFinder::RESULT_NSEC3_SIGNED) != 0) {
-        addZoneData(rr_nsec3_);
+        addToZoneData(rr_nsec3_);
     }
     if ((expected_flags & ZoneFinder::RESULT_NSEC_SIGNED) != 0) {
-        addZoneData(rr_nsec_);
+        addToZoneData(rr_nsec_);
     }
 
     // Search at the parent. The parent will not have the A, but it will
@@ -954,7 +953,7 @@ InMemoryZoneFinderTest::wildcardCheck(
                  wild_expected_flags, NULL, find_options, wild_ok);
     }
 
-    addZoneData(rr_under_wild_);
+    addToZoneData(rr_under_wild_);
     {
         SCOPED_TRACE("Search under non-wildcard");
         findTest(Name("bar.foo.wild.example.org"), RRType::A(),
@@ -971,7 +970,7 @@ InMemoryZoneFinderTest::wildcardCheck(
     // NO_WILDCARD effect itself can be checked by the result code (NXDOMAIN).
     ConstRRsetPtr expected_wild_nsec; // by default it's NULL
     if ((expected_flags & ZoneFinder::RESULT_NSEC_SIGNED) != 0) {
-        addZoneData(rr_wild_nsec_);
+        addToZoneData(rr_wild_nsec_);
         expected_wild_nsec = rr_wild_nsec_;
     }
     {
@@ -1008,8 +1007,8 @@ TEST_F(InMemoryZoneFinderTest, wildcardDisabledWithoutNSEC) {
  *     the wildcard defaults."
  */
 TEST_F(InMemoryZoneFinderTest, delegatedWildcard) {
-    addZoneData(rr_child_wild_);
-    addZoneData(rr_child_ns_);
+    addToZoneData(rr_child_wild_);
+    addToZoneData(rr_child_ns_);
 
     {
         SCOPED_TRACE("Looking under delegation point");
@@ -1030,12 +1029,12 @@ void
 InMemoryZoneFinderTest::anyWildcardCheck(
     ZoneFinder::FindResultFlags expected_flags)
 {
-    addZoneData(rr_wild_);
+    addToZoneData(rr_wild_);
     if ((expected_flags & ZoneFinder::RESULT_NSEC3_SIGNED) != 0) {
-        addZoneData(rr_nsec3_);
+        addToZoneData(rr_nsec3_);
     }
     if ((expected_flags & ZoneFinder::RESULT_NSEC_SIGNED) != 0) {
-        addZoneData(rr_nsec_);
+        addToZoneData(rr_nsec_);
     }
 
     vector<ConstRRsetPtr> expected_sets;
@@ -1087,12 +1086,12 @@ InMemoryZoneFinderTest::emptyWildcardCheck(
      *                 *
      *               wild
      */
-    addZoneData(rr_emptywild_);
+    addToZoneData(rr_emptywild_);
     if ((expected_flags & ZoneFinder::RESULT_NSEC3_SIGNED) != 0) {
-        addZoneData(rr_nsec3_);
+        addToZoneData(rr_nsec3_);
     }
     if ((expected_flags & ZoneFinder::RESULT_NSEC_SIGNED) != 0) {
-        addZoneData(rr_nsec_);
+        addToZoneData(rr_nsec_);
     }
 
     {
@@ -1144,7 +1143,7 @@ TEST_F(InMemoryZoneFinderTest, emptyWildcardNSEC) {
 
 // Same as emptyWildcard, but with multiple * in the path.
 TEST_F(InMemoryZoneFinderTest, nestedEmptyWildcard) {
-    addZoneData(rr_nested_emptywild_);
+    addToZoneData(rr_nested_emptywild_);
 
     {
         SCOPED_TRACE("Asking for the original record under wildcards");
@@ -1275,8 +1274,8 @@ InMemoryZoneFinderTest::doCancelWildcardCheck(
  * shouldn't be canceled isn't.
  */
 TEST_F(InMemoryZoneFinderTest, cancelWildcard) {
-    addZoneData(rr_wild_);
-    addZoneData(rr_not_wild_);
+    addToZoneData(rr_wild_);
+    addToZoneData(rr_not_wild_);
 
     {
         SCOPED_TRACE("Runnig with single entry under foo.wild.example.org");
@@ -1286,7 +1285,7 @@ TEST_F(InMemoryZoneFinderTest, cancelWildcard) {
     // Try putting another one under foo.wild....
     // The result should be the same but it will be done in another way in the
     // code, because the foo.wild.example.org will exist in the tree.
-    addZoneData(rr_not_wild_another_);
+    addToZoneData(rr_not_wild_another_);
     {
         SCOPED_TRACE("Runnig with two entries under foo.wild.example.org");
         doCancelWildcardCheck();
@@ -1295,15 +1294,15 @@ TEST_F(InMemoryZoneFinderTest, cancelWildcard) {
 
 // Same tests as cancelWildcard for NSEC3-signed zone
 TEST_F(InMemoryZoneFinderTest, cancelWildcardNSEC3) {
-    addZoneData(rr_wild_);
-    addZoneData(rr_not_wild_);
-    addZoneData(rr_nsec3_);
+    addToZoneData(rr_wild_);
+    addToZoneData(rr_not_wild_);
+    addToZoneData(rr_nsec3_);
 
     {
         SCOPED_TRACE("Runnig with single entry under foo.wild.example.org");
         doCancelWildcardCheck(ZoneFinder::RESULT_NSEC3_SIGNED);
     }
-    addZoneData(rr_not_wild_another_);
+    addToZoneData(rr_not_wild_another_);
     {
         SCOPED_TRACE("Runnig with two entries under foo.wild.example.org");
         doCancelWildcardCheck(ZoneFinder::RESULT_NSEC3_SIGNED);
@@ -1314,9 +1313,9 @@ TEST_F(InMemoryZoneFinderTest, cancelWildcardNSEC3) {
 // or without FIND_DNSSEC option.  NSEC should be returned only when the option
 // is given.
 TEST_F(InMemoryZoneFinderTest, cancelWildcardNSEC) {
-    addZoneData(rr_wild_);
-    addZoneData(rr_not_wild_);
-    addZoneData(rr_nsec_);
+    addToZoneData(rr_wild_);
+    addToZoneData(rr_not_wild_);
+    addToZoneData(rr_nsec_);
 
     {
         SCOPED_TRACE("Runnig with single entry under foo.wild.example.org");
@@ -1324,7 +1323,7 @@ TEST_F(InMemoryZoneFinderTest, cancelWildcardNSEC) {
                               ZoneFinder::FIND_DNSSEC);
         doCancelWildcardCheck(ZoneFinder::RESULT_NSEC_SIGNED);
     }
-    addZoneData(rr_not_wild_another_);
+    addToZoneData(rr_not_wild_another_);
     {
         SCOPED_TRACE("Runnig with two entries under foo.wild.example.org");
         doCancelWildcardCheck(ZoneFinder::RESULT_NSEC_SIGNED,
@@ -1345,7 +1344,7 @@ TEST_F(InMemoryZoneFinderTest, findNSEC3ForBadZone) {
                  DataSourceError);
 
     // Only having NSEC3PARAM isn't enough
-    addZoneData(textToRRset("example.org. 300 IN NSEC3PARAM "
+    addToZoneData(textToRRset("example.org. 300 IN NSEC3PARAM "
                             "1 0 12 aabbccdd"));
     EXPECT_THROW(zone_finder_.findNSEC3(Name("www.example.org"), true),
                  DataSourceError);
@@ -1354,7 +1353,7 @@ TEST_F(InMemoryZoneFinderTest, findNSEC3ForBadZone) {
     // is guaranteed.
     const string ns1_nsec3_text = string(ns1_hash) + ".example.org." +
         string(nsec3_common);
-    addZoneData(textToRRset(ns1_nsec3_text));
+    addToZoneData(textToRRset(ns1_nsec3_text));
     EXPECT_THROW(zone_finder_.findNSEC3(Name("www.example.org"), true),
                  DataSourceError);
 }
@@ -1373,16 +1372,16 @@ public:
         // zzz.example.org:     hash=R5..
         const string apex_nsec3_text = string(apex_hash) + ".example.org." +
             string(nsec3_common);
-        addZoneData(textToRRset(apex_nsec3_text));
+        addToZoneData(textToRRset(apex_nsec3_text));
         const string ns1_nsec3_text = string(ns1_hash) + ".example.org." +
             string(nsec3_common);
-        addZoneData(textToRRset(ns1_nsec3_text));
+        addToZoneData(textToRRset(ns1_nsec3_text));
         const string w_nsec3_text = string(w_hash) + ".example.org." +
             string(nsec3_common);
-        addZoneData(textToRRset(w_nsec3_text));
+        addToZoneData(textToRRset(w_nsec3_text));
         const string zzz_nsec3_text = string(zzz_hash) + ".example.org." +
             string(nsec3_common);
-        addZoneData(textToRRset(zzz_nsec3_text));
+        addToZoneData(textToRRset(zzz_nsec3_text));
     }
 
 private:



More information about the bind10-changes mailing list