BIND 10 trac2218_2, updated. 5f39840cf5f96ee91f826aa801d934864a55d444 [2218] Add a createNSEC3RRset() and remove code duplication
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Sep 24 06:18:51 UTC 2012
The branch, trac2218_2 has been updated
via 5f39840cf5f96ee91f826aa801d934864a55d444 (commit)
from 0fc1237c7ba1edd9128387ba1db1bae9e7aacc27 (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 5f39840cf5f96ee91f826aa801d934864a55d444
Author: Mukund Sivaraman <muks at isc.org>
Date: Mon Sep 24 11:48:26 2012 +0530
[2218] Add a createNSEC3RRset() and remove code duplication
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/memory/zone_finder.cc | 40 ++++++++++++++++++---------------
1 file changed, 22 insertions(+), 18 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/zone_finder.cc b/src/lib/datasrc/memory/zone_finder.cc
index f57fe7a..935db2b 100644
--- a/src/lib/datasrc/memory/zone_finder.cc
+++ b/src/lib/datasrc/memory/zone_finder.cc
@@ -145,6 +145,25 @@ bool cutCallback(const ZoneNode& node, FindState* state) {
return (false);
}
+/// Creates a NSEC3 ConstRRsetPtr for the given ZoneNode inside the
+/// NSEC3 tree, for the given RRClass.
+///
+/// It asserts that the node contains data (RdataSet) and is of type
+/// NSEC3.
+///
+/// \param node The ZoneNode inside the NSEC3 tree
+/// \param rrclass The RRClass as passed by the client
+ConstRRsetPtr
+createNSEC3RRset(const ZoneNode* node, const RRClass& rrclass) {
+ const RdataSet* rdataset = node->getData();
+ // Only NSEC3 ZoneNodes are allowed to be passed to this method. We
+ // assert that these have data, and also are of type NSEC3.
+ assert(rdataset != NULL);
+ assert(rdataset->type == RRType::NSEC3());
+
+ return (createTreeNodeRRset(node, rdataset, rrclass));
+}
+
// convenience function to fill in the final details
//
// Set up ZoneFinderResultContext object as a return value of find(),
@@ -647,20 +666,10 @@ InMemoryZoneFinder::findNSEC3(const isc::dns::Name& name, bool recursive) {
if (result == ZoneTree::EXACTMATCH) {
// We found an exact match.
- const RdataSet* rdataset = node->getData();
- assert(rdataset != NULL);
- assert(rdataset->type == RRType::NSEC3());
-
- ConstRRsetPtr closest = createTreeNodeRRset(node, rdataset,
- getClass());
+ ConstRRsetPtr closest = createNSEC3RRset(node, getClass());
ConstRRsetPtr next;
if (covering_node != NULL) {
- rdataset = covering_node->getData();
- assert(rdataset != NULL);
- assert(rdataset->type == RRType::NSEC3());
-
- next = createTreeNodeRRset(covering_node, rdataset,
- getClass());
+ next = createNSEC3RRset(covering_node, getClass());
}
LOG_DEBUG(logger, DBG_TRACE_BASIC,
@@ -680,12 +689,7 @@ InMemoryZoneFinder::findNSEC3(const isc::dns::Name& name, bool recursive) {
if (!recursive) { // in non recursive mode, we are done.
ConstRRsetPtr closest;
if (covering_node != NULL) {
- const RdataSet* rdataset = covering_node->getData();
- assert(rdataset != NULL);
- assert(rdataset->type == RRType::NSEC3());
-
- closest = createTreeNodeRRset(covering_node, rdataset,
- getClass());
+ closest = createNSEC3RRset(covering_node, getClass());
LOG_DEBUG(logger, DBG_TRACE_BASIC,
DATASRC_MEM_FINDNSEC3_COVER).
More information about the bind10-changes
mailing list