BIND 10 trac1177, updated. 91e77326e2f33dea91529a9157d46c27507f0a1a [1177] Function definiton for finding previous name

BIND 10 source code commits bind10-changes at lists.isc.org
Thu Sep 8 10:51:59 UTC 2011


The branch, trac1177 has been updated
       via  91e77326e2f33dea91529a9157d46c27507f0a1a (commit)
      from  94fc0adc1b01f6a0632bb07a4c882e0cdf876741 (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 91e77326e2f33dea91529a9157d46c27507f0a1a
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date:   Thu Sep 8 12:50:53 2011 +0200

    [1177] Function definiton for finding previous name
    
    It will be needed for DNSSEC logic. Not implemented nor tested:
    * The InMemory just throws NotImplemented
    * The Database one will be done in next commits

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

Summary of changes:
 src/lib/datasrc/database.cc                      |    5 ++++
 src/lib/datasrc/database.h                       |    6 +++++
 src/lib/datasrc/memory_datasrc.cc                |    6 +++++
 src/lib/datasrc/memory_datasrc.h                 |    6 +++++
 src/lib/datasrc/tests/memory_datasrc_unittest.cc |    8 +++++++
 src/lib/datasrc/zone.h                           |   24 +++++++++++++++++++++-
 6 files changed, 54 insertions(+), 1 deletions(-)

-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/database.cc b/src/lib/datasrc/database.cc
index d7fb2f3..bcd2a03 100644
--- a/src/lib/datasrc/database.cc
+++ b/src/lib/datasrc/database.cc
@@ -562,6 +562,11 @@ DatabaseClient::Finder::find(const isc::dns::Name& name,
 }
 
 Name
+DatabaseClient::Finder::findPreviousName(const Name&) const {
+    return (Name::ROOT_NAME()); // TODO Implement
+}
+
+Name
 DatabaseClient::Finder::getOrigin() const {
     return (origin_);
 }
diff --git a/src/lib/datasrc/database.h b/src/lib/datasrc/database.h
index 48f292e..75f8064 100644
--- a/src/lib/datasrc/database.h
+++ b/src/lib/datasrc/database.h
@@ -334,6 +334,12 @@ public:
                                 const FindOptions options = FIND_DEFAULT);
 
         /**
+         * \brief Implementation of ZoneFinder::findPreviousName method.
+         */
+        virtual isc::dns::Name findPreviousName(const isc::dns::Name& query)
+            const;
+
+        /**
          * \brief The zone ID
          *
          * This function provides the stored zone ID as passed to the
diff --git a/src/lib/datasrc/memory_datasrc.cc b/src/lib/datasrc/memory_datasrc.cc
index 1fc9252..4cbaf91 100644
--- a/src/lib/datasrc/memory_datasrc.cc
+++ b/src/lib/datasrc/memory_datasrc.cc
@@ -659,6 +659,12 @@ InMemoryZoneFinder::getFileName() const {
     return (impl_->file_name_);
 }
 
+isc::dns::Name
+InMemoryZoneFinder::findPreviousName(const isc::dns::Name&) const {
+    isc_throw(NotImplemented, "InMemory data source doesn't support DNSSEC "
+              "yet, can't find previous name");
+}
+
 /// Implementation details for \c InMemoryClient hidden from the public
 /// interface.
 ///
diff --git a/src/lib/datasrc/memory_datasrc.h b/src/lib/datasrc/memory_datasrc.h
index 6cd1753..d89b3dd 100644
--- a/src/lib/datasrc/memory_datasrc.h
+++ b/src/lib/datasrc/memory_datasrc.h
@@ -75,6 +75,12 @@ public:
                             isc::dns::RRsetList* target = NULL,
                             const FindOptions options = FIND_DEFAULT);
 
+    /// \brief Imelementation of the ZoneFinder::findPreviousName method
+    ///
+    /// This one throws NotImplemented exception, as InMemory doesn't
+    /// support DNSSEC currently.
+    virtual isc::dns::Name findPreviousName(const isc::dns::Name& query) const;
+
     /// \brief Inserts an rrset into the zone.
     ///
     /// It puts another RRset into the zone.
diff --git a/src/lib/datasrc/tests/memory_datasrc_unittest.cc b/src/lib/datasrc/tests/memory_datasrc_unittest.cc
index f47032f..715b18e 100644
--- a/src/lib/datasrc/tests/memory_datasrc_unittest.cc
+++ b/src/lib/datasrc/tests/memory_datasrc_unittest.cc
@@ -390,6 +390,14 @@ public:
 };
 
 /**
+ * \brief Check that findPreviousName throws as it should now.
+ */
+TEST_F(InMemoryZoneFinderTest, findPreviousName) {
+    EXPECT_THROW(zone_finder_.findPreviousName(Name("www.example.org")),
+                 isc::NotImplemented);
+}
+
+/**
  * \brief Test InMemoryZoneFinder::InMemoryZoneFinder constructor.
  *
  * Takes the created zone finder and checks its properties they are the same
diff --git a/src/lib/datasrc/zone.h b/src/lib/datasrc/zone.h
index 0cbad6a..1c43aa9 100644
--- a/src/lib/datasrc/zone.h
+++ b/src/lib/datasrc/zone.h
@@ -152,7 +152,7 @@ public:
     //@}
 
     ///
-    /// \name Search Method
+    /// \name Search Methods
     ///
     //@{
     /// Search the zone for a given pair of domain name and RR type.
@@ -215,6 +215,28 @@ public:
                             isc::dns::RRsetList* target = NULL,
                             const FindOptions options
                             = FIND_DEFAULT) = 0;
+
+    /// \brief Get previous name in the zone
+    ///
+    /// Gets the previous name in the DNSSEC order. This can be used
+    /// to find the correct NSEC or NSEC3 records for proving nonexistenc
+    /// of domains.
+    ///
+    /// The concrete implementation might throw anything it thinks appropriate,
+    /// however it is recommended to stick to the ones listed here. The user
+    /// of this method should be able to handle any exceptions.
+    ///
+    /// \param query The name for which one we look for a previous one. The
+    ///     queried name doesn't have to exist in the zone.
+    /// \return The preceding name
+    ///
+    /// \throw NotImplemented in case the data source backend doesn't support
+    ///     DNSSEC.
+    /// \throw DataSourceError for low-level or internal datasource errors
+    ///     (like broken connection to database, wrong data living there).
+    /// \throw std::bad_alloc For allocation errors.
+    virtual isc::dns::Name findPreviousName(const isc::dns::Name& query)
+        const = 0;
     //@}
 };
 




More information about the bind10-changes mailing list