BIND 10 trac1758, updated. 69d99618a538d70a3626a2aa403b9aa5d0977b03 [1758] Provide future test method
BIND 10 source code commits
bind10-changes at lists.isc.org
Fri Mar 16 13:58:13 UTC 2012
The branch, trac1758 has been updated
via 69d99618a538d70a3626a2aa403b9aa5d0977b03 (commit)
via fde67b3671c8bbb24f12dce63cc14fd8ffc599a4 (commit)
via c387dc0811456b30f4c4e12a9973e246dab385e1 (commit)
from 2bb6957f057d02e70338d1c8586d53bbda7f7d33 (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 69d99618a538d70a3626a2aa403b9aa5d0977b03
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Mar 16 14:54:40 2012 +0100
[1758] Provide future test method
For the findPreviousNSEC3Hash.
Also, renamed the nsec_namespace_ variable to more correct
nsec3_namespace_.
commit fde67b3671c8bbb24f12dce63cc14fd8ffc599a4
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Mar 16 14:42:24 2012 +0100
[1758] Provide NotImplemented-throwing methods
This is for the newly introduced interface. It makes stuff compile, it
complained about pure virtual methods.
commit c387dc0811456b30f4c4e12a9973e246dab385e1
Author: Michal 'vorner' Vaner <michal.vaner at nic.cz>
Date: Fri Mar 16 14:36:08 2012 +0100
[1758] Interface for getting previous name
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/database.h | 31 ++++++++++++++++++++++++++++
src/lib/datasrc/sqlite3_accessor.cc | 5 ++++
src/lib/datasrc/sqlite3_accessor.h | 5 ++++
src/lib/datasrc/tests/database_unittest.cc | 28 +++++++++++++++++++++---
4 files changed, 65 insertions(+), 4 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/database.h b/src/lib/datasrc/database.h
index ba7b0e0..d9d6dfa 100644
--- a/src/lib/datasrc/database.h
+++ b/src/lib/datasrc/database.h
@@ -253,6 +253,9 @@ public:
/// The iterator might be empty (containing no RRs) in case the zone is not
/// signed by NSEC3.
///
+ /// \note In case there are multiple NSEC3 chains and they collide
+ /// (unlikely, but it can happen), this can return multiple NSEC3
+ /// records.
/// \exception any Since any implementaion can be used, the caller should
/// expect any exception to be thrown.
/// \exception isc::NotImplemented in case the database does not support
@@ -675,6 +678,34 @@ public:
/// apex of the zone).
virtual std::string findPreviousName(int zone_id,
const std::string& rname) const = 0;
+
+ /// \brief It returns the previous hash in the NSEC3 chain.
+ ///
+ /// This is used to find previous NSEC3 hashes, to find covering NSEC3 in
+ /// case none match exactly.
+ ///
+ /// In case a hash before before the lowest or the lowest is provided,
+ /// this should return the largest one in the zone (NSEC3 needs a
+ /// wrap-around semantics).
+ ///
+ /// \param zone_id Specifies the zone to look into, as returned by getZone.
+ /// \param hash The hash to look before.
+ /// \return The nearest smaller hash than the provided one, or the largest
+ /// hash in the zone if something smaller or equal to the lowest one
+ /// is provided.
+ /// \note If the zone contains multiple NSEC3 chains, you should check that
+ /// the returned result contains the NSEC3 for correct parameters. If
+ /// not, query again and get something smaller - this will eventually
+ /// get to the correct one. This interface and semantics might change
+ /// in future.
+ ///
+ /// \throw DataSourceError if there's a problem with the database or if
+ /// this zone is not signed with NSEC3.
+ /// \throw NotImplemented if this database doesn't support NSEC3.
+ /// \throw anything else, as this might be any implementation.
+ virtual std::string findPreviousNSEC3Hash(int zone_id,
+ const std::string& hash)
+ const = 0;
};
/// \brief Concrete data source client oriented at database backends.
diff --git a/src/lib/datasrc/sqlite3_accessor.cc b/src/lib/datasrc/sqlite3_accessor.cc
index 23613ab..5fe2b67 100644
--- a/src/lib/datasrc/sqlite3_accessor.cc
+++ b/src/lib/datasrc/sqlite3_accessor.cc
@@ -1098,5 +1098,10 @@ SQLite3Accessor::findPreviousName(int zone_id, const std::string& rname)
return (result);
}
+std::string
+SQLite3Accessor::findPreviousNSEC3Hash(int, const std::string&) const {
+ isc_throw(NotImplemented, "Not implemented yet, see #1760");
+}
+
} // end of namespace datasrc
} // end of namespace isc
diff --git a/src/lib/datasrc/sqlite3_accessor.h b/src/lib/datasrc/sqlite3_accessor.h
index 38d13d8..efaec0e 100644
--- a/src/lib/datasrc/sqlite3_accessor.h
+++ b/src/lib/datasrc/sqlite3_accessor.h
@@ -239,6 +239,11 @@ public:
virtual std::string findPreviousName(int zone_id, const std::string& rname)
const;
+ /// \brief Conrete implemantion of the pure virtual method of
+ /// DatabaseAccessor
+ virtual std::string findPreviousNSEC3Hash(int zone_id,
+ const std::string& hash) const;
+
private:
/// \brief Private database data
boost::scoped_ptr<SQLite3Parameters> dbparameters_;
diff --git a/src/lib/datasrc/tests/database_unittest.cc b/src/lib/datasrc/tests/database_unittest.cc
index 8a019a2..8ffd3c7 100644
--- a/src/lib/datasrc/tests/database_unittest.cc
+++ b/src/lib/datasrc/tests/database_unittest.cc
@@ -282,6 +282,11 @@ public:
isc_throw(isc::NotImplemented,
"This data source doesn't support DNSSEC");
}
+
+ virtual std::string findPreviousNSEC3Hash(int, const std::string&) const {
+ isc_throw(isc::NotImplemented,
+ "This test database knows nothing about NSEC3 nor order");
+ }
private:
const std::string database_name_;
@@ -647,8 +652,8 @@ public:
virtual IteratorContextPtr getNSEC3Records(const std::string& hash,
int) const
{
- Domains::const_iterator it(nsec_namespace_.find(hash));
- if (it == nsec_namespace_.end()) {
+ Domains::const_iterator it(nsec3_namespace_.find(hash));
+ if (it == nsec3_namespace_.end()) {
return (IteratorContextPtr(new EmptyIteratorContext()));
} else {
return (IteratorContextPtr(new DomainIterator(it->second)));
@@ -792,6 +797,21 @@ public:
isc_throw(isc::Unexpected, "Unknown zone ID");
}
}
+ virtual std::string findPreviousNSEC3Hash(int,
+ const std::string& hash) const
+ {
+ // TODO: Provide some broken data, but it is not known yet how broken
+ // they'll have to be.
+ Domains::const_iterator it(nsec3_namespace_.lower_bound(hash));
+ // We got just after the one we want
+ if (it == nsec3_namespace_.begin()) {
+ // Hmm, we got something really small. So we wrap around.
+ // This is one after the last, so after decreasing it we'll get
+ // the biggest.
+ it = nsec3_namespace_.end();
+ }
+ return ((--it)->first);
+ }
virtual void addRecordDiff(int id, uint32_t serial,
DiffOperation operation,
const std::string (&data)[DIFF_PARAM_COUNT])
@@ -876,7 +896,7 @@ private:
const Domains* empty_records_;
// The NSEC3 namespace. The above trick will be added once it is needed.
- Domains nsec_namespace_;
+ Domains nsec3_namespace_;
// The journal data
std::vector<JournalEntry> journal_entries_master_;
@@ -942,7 +962,7 @@ private:
// the NSEC3 namespace. You don't provide the full name, only
// the hash part.
void addCurHash(const std::string& hash) {
- ASSERT_EQ(0, nsec_namespace_.count(hash));
+ ASSERT_EQ(0, nsec3_namespace_.count(hash));
// Append the name to all of them
for (std::vector<std::vector<std::string> >::iterator
i = cur_name_.begin(); i != cur_name_.end(); ++ i) {
More information about the bind10-changes
mailing list