BIND 10 trac2108_3, updated. 65282c50effd9e5a6c846ac50707b73df97381c3 [2108] Remove use of getClass() which doesn't exist in the Impl class
BIND 10 source code commits
bind10-changes at lists.isc.org
Tue Sep 4 07:28:50 UTC 2012
The branch, trac2108_3 has been updated
via 65282c50effd9e5a6c846ac50707b73df97381c3 (commit)
via 1628d5fc238c4d72c43bf7e7c4a535ecfb7c2777 (commit)
via a10c87fb37c4383640a47b358b80211a81dad742 (commit)
via 36acee537796e3a57b2dc96600b5ae55e4acf169 (commit)
via 1c1627f4887f854c26a2ac00122718bdd7a0016c (commit)
via ad45b4e2de7386663a828889d3d09db547b74cb5 (commit)
via c396c0b44213c1f1c236e254fcd34708498498fe (commit)
from 99db6f4f616fb7ab7d66147c661f0efd544e69f1 (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 65282c50effd9e5a6c846ac50707b73df97381c3
Author: Mukund Sivaraman <muks at isc.org>
Date: Tue Sep 4 12:58:26 2012 +0530
[2108] Remove use of getClass() which doesn't exist in the Impl class
commit 1628d5fc238c4d72c43bf7e7c4a535ecfb7c2777
Author: Mukund Sivaraman <muks at isc.org>
Date: Tue Sep 4 12:58:04 2012 +0530
[2108] Port NSEC3PARAM check to the new design
commit a10c87fb37c4383640a47b358b80211a81dad742
Author: Mukund Sivaraman <muks at isc.org>
Date: Tue Sep 4 12:44:08 2012 +0530
[2108] Rename member variable to contain underscore
commit 36acee537796e3a57b2dc96600b5ae55e4acf169
Author: Mukund Sivaraman <muks at isc.org>
Date: Tue Sep 4 12:42:16 2012 +0530
[2108] Update InMemoryClientImpl::add() to use the new design
commit 1c1627f4887f854c26a2ac00122718bdd7a0016c
Author: Mukund Sivaraman <muks at isc.org>
Date: Tue Sep 4 12:41:29 2012 +0530
[2108] Remove name of unused argument
commit ad45b4e2de7386663a828889d3d09db547b74cb5
Author: Mukund Sivaraman <muks at isc.org>
Date: Tue Sep 4 12:41:08 2012 +0530
[2108] Remove an excess argument
commit c396c0b44213c1f1c236e254fcd34708498498fe
Author: Mukund Sivaraman <muks at isc.org>
Date: Tue Sep 4 12:40:51 2012 +0530
[2108] Fix use of member variable
-----------------------------------------------------------------------
Summary of changes:
src/lib/datasrc/memory/memory_client.cc | 170 ++++++++++++++++---------------
1 file changed, 86 insertions(+), 84 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/datasrc/memory/memory_client.cc b/src/lib/datasrc/memory/memory_client.cc
index 8dd8f8d..94c60af 100644
--- a/src/lib/datasrc/memory/memory_client.cc
+++ b/src/lib/datasrc/memory/memory_client.cc
@@ -90,23 +90,23 @@ public:
InMemoryClientImpl(RRClass rrclass) :
rrclass_(rrclass),
zone_count(0),
- zone_table_(ZoneTable::create(local_mem_sgmt, rrclass)),
- file_name_tree_(FileNameTree::create(local_mem_sgmt, false))
+ zone_table_(ZoneTable::create(local_mem_sgmt_, rrclass)),
+ file_name_tree_(FileNameTree::create(local_mem_sgmt_, false))
{}
~InMemoryClientImpl() {
FileNameDeleter deleter;
- FileNameTree::destroy(local_mem_sgmt, file_name_tree_, deleter);
+ FileNameTree::destroy(local_mem_sgmt_, file_name_tree_, deleter);
- ZoneTable::destroy(local_mem_sgmt, zone_table_, rrclass_);
+ ZoneTable::destroy(local_mem_sgmt_, zone_table_, rrclass_);
// see above for the assert().
- assert(local_mem_sgmt.allMemoryDeallocated());
+ assert(local_mem_sgmt_.allMemoryDeallocated());
}
// Memory segment to allocate/deallocate memory for the zone table.
// (This will eventually have to be abstract; for now we hardcode the
// specific derived segment class).
- util::MemorySegmentLocal local_mem_sgmt;
+ util::MemorySegmentLocal local_mem_sgmt_;
RRClass rrclass_;
unsigned int zone_count;
ZoneTable* zone_table_;
@@ -152,14 +152,14 @@ public:
// Ensure a separate level exists for the "wildcarding" name,
// and mark the node as "wild".
ZoneNode *node;
- zone_data.insertName(local_mem_sgmt, wname.split(1), &node);
+ zone_data.insertName(local_mem_sgmt_, wname.split(1), &node);
node->setFlag(ZoneData::WILDCARD_NODE);
// Ensure a separate level exists for the wildcard name.
// Note: for 'name' itself we do this later anyway, but the
// overhead should be marginal because wildcard names should
// be rare.
- zone_data.insertName(local_mem_sgmt, wname, &node);
+ zone_data.insertName(local_mem_sgmt_, wname, &node);
}
}
}
@@ -177,7 +177,7 @@ public:
*
* If such condition is found, it throws AddError.
*/
- void contextCheck(const AbstractRRset& rrset, const Domain& domain) const {
+ void contextCheck(const AbstractRRset& rrset, const RdataSet* set) 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)
@@ -386,7 +386,7 @@ public:
NSEC3Data* nsec3_data = zone_data.getNSEC3Data();
if (nsec3_data == NULL) {
- nsec3_data = NSEC3Data::create(local_mem_sgmt, nsec3_rdata);
+ nsec3_data = NSEC3Data::create(local_mem_sgmt_, nsec3_rdata);
zone_data.setNSEC3Data(nsec3_data);
} else {
size_t salt_len = nsec3_data->getSaltLen();
@@ -408,14 +408,14 @@ public:
::toupper);
ZoneNode *node;
- nsec3_data->insertName(local_mem_sgmt, Name(fst_label), &node);
+ nsec3_data->insertName(local_mem_sgmt_, Name(fst_label), &node);
RdataEncoder encoder;
- RdataSet *set = RdataSet::create(local_mem_sgmt, encoder,
+ RdataSet *set = RdataSet::create(local_mem_sgmt_, encoder,
rrset, ConstRRsetPtr());
RdataSet *old_set = node->setData(set);
if (old_set != NULL) {
- RdataSet::destroy(local_mem_sgmt, rrclass_, old_set);
+ RdataSet::destroy(local_mem_sgmt_, rrclass_, old_set);
}
return (result::SUCCESS);
@@ -454,72 +454,74 @@ public:
// guarantee. (see also the note for contextCheck() below).
addWildcards(zone_name, zone_data, rrset->getName());
- // Get the node
- DomainNode* node;
- DomainTree::Result result =
- zone_data.domains_.insert(zone_data.local_mem_sgmt_,
- rrset->getName(), &node);
- // Just check it returns reasonable results
- assert((result == DomainTree::SUCCESS ||
- result == DomainTree::ALREADYEXISTS) && node!= NULL);
-
- // Now get the domain
- DomainPtr domain;
- // It didn't exist yet, create it
- if (node->isEmpty()) {
- domain.reset(new Domain);
- node->setData(domain);
- } else { // Get existing one
- domain = node->getData();
- }
+ ZoneNode* node;
+ zone_data.insertName(local_mem_sgmt_, rrset->getName(), &node);
+
+ RdataSet* set = node->getData();
// Checks related to the surrounding data.
// Note: when the check fails and the exception is thrown, it may
// break strong exception guarantee. At the moment we prefer
// code simplicity and don't bother to introduce complicated
// recovery code.
- contextCheck(*rrset, *domain);
-
- // Try inserting the rrset there
- if (domain->insert(DomainPair(rrset->getType(), rrset)).second) {
- // Ok, we just put it in
-
- // If this RRset creates a zone cut at this node, mark the node
- // indicating the need for callback in find().
- if (rrset->getType() == RRType::NS() &&
- rrset->getName() != zone_name) {
- node->setFlag(DomainNode::FLAG_CALLBACK);
- // If it is DNAME, we have a callback as well here
- } else if (rrset->getType() == RRType::DNAME()) {
- node->setFlag(DomainNode::FLAG_CALLBACK);
- }
+ contextCheck(*rrset, set);
+
+ if (RdataSet::find(set, rrset->getType()) != NULL) {
+ return (result::EXIST);
+ }
+
+ RdataEncoder encoder;
+ RdataSet *new_set = RdataSet::create(local_mem_sgmt_, encoder,
+ rrset, ConstRRsetPtr());
+ new_set->next = set;
+ node->setData(new_set);
+
+ // Ok, we just put it in
+
+ // If this RRset creates a zone cut at this node, mark the node
+ // indicating the need for callback in find().
+ if (rrset->getType() == RRType::NS() &&
+ rrset->getName() != zone_name) {
+ node->setFlag(DomainNode::FLAG_CALLBACK);
+ // If it is DNAME, we have a callback as well here
+ } else if (rrset->getType() == RRType::DNAME()) {
+ node->setFlag(DomainNode::FLAG_CALLBACK);
+ }
- // If we've added NSEC3PARAM at zone origin, set up NSEC3 specific
- // data or check consistency with already set up parameters.
- if (rrset->getType() == RRType::NSEC3PARAM() &&
- rrset->getName() == zone_name) {
- // We know rrset has exactly one RDATA
- const generic::NSEC3PARAM& param =
- dynamic_cast<const generic::NSEC3PARAM&>(
- rrset->getRdataIterator()->getCurrent());
-
- if (!zone_data.nsec3_data_) {
- zone_data.nsec3_data_.reset(
- new ZoneData::NSEC3Data(param));
- } else if (!zone_data.nsec3_data_->hash_->match(param)) {
- isc_throw(AddError, "NSEC3PARAM with inconsistent "
- "parameters: " << rrset->toText());
+ // If we've added NSEC3PARAM at zone origin, set up NSEC3 specific
+ // data or check consistency with already set up parameters.
+ if (rrset->getType() == RRType::NSEC3PARAM() &&
+ rrset->getName() == zone_name) {
+ // We know rrset has exactly one RDATA
+ const generic::NSEC3PARAM& param =
+ dynamic_cast<const generic::NSEC3PARAM&>
+ (rrset->getRdataIterator()->getCurrent());
+
+ NSEC3Data* nsec3_data = zone_data.getNSEC3Data();
+ if (nsec3_data == NULL) {
+ nsec3_data = NSEC3Data::create(local_mem_sgmt_, nsec3_rdata);
+ zone_data.setNSEC3Data(nsec3_data);
+ } else {
+ size_t salt_len = nsec3_data->getSaltLen();
+ const uint8_t* salt_data = nsec3_data->getSaltData();
+ const vector<uint8_t>& salt_data_2 = nsec3_rdata.getSalt();
+
+ if ((nsec3_rdata.getHashalg() != nsec3_data->hashalg) ||
+ (nsec3_rdata.getIterations() != nsec3_data->iterations) ||
+ (salt_data_2.size() != salt_len) ||
+ (std::memcmp(&salt_data_2[0], salt_data, salt_len) != 0)) {
+ isc_throw(AddError,
+ "NSEC3PARAM with inconsistent parameters: " <<
+ rrset->toText());
}
- } else if (rrset->getType() == RRType::NSEC()) {
- // If it is NSEC signed zone, so we put a flag there
- // (flag is enough)
- zone_data.nsec_signed_ = true;
}
- return (result::SUCCESS);
- } else {
- // The RRSet of given type was already there
- return (result::EXIST);
+ } else if (rrset->getType() == RRType::NSEC()) {
+ // If it is NSEC signed zone, so we put a flag there (flag
+ // is enough)
+ zone_data.setSigned(true);
}
+
+ return (result::SUCCESS);
}
/*
@@ -550,35 +552,35 @@ InMemoryClient::InMemoryClientImpl::load(
boost::function<void(LoadCallback)> rrset_installer)
{
SegmentObjectHolder<ZoneData, RRClass> holder(
- local_mem_sgmt, ZoneData::create(local_mem_sgmt, zone_name), rrclass_);
+ local_mem_sgmt_, ZoneData::create(local_mem_sgmt_, zone_name), rrclass_);
scoped_ptr<ZoneData> tmp(holder.get());
rrset_installer(boost::bind(&InMemoryClientImpl::addFromLoad, this,
_1, zone_name, tmp.get()));
// If the zone is NSEC3-signed, check if it has NSEC3PARAM
- if (tmp->nsec3_data_) {
+ if (tmp->isNSEC3Signed()) {
// Note: origin_data_ is set on creation of ZoneData, and the load
// process only adds new nodes (and their data), so this assertion
// should hold.
- assert(tmp->origin_data_ != NULL && !tmp->origin_data_->isEmpty());
- if (tmp->origin_data_->getData()->find(RRType::NSEC3PARAM()) ==
- tmp->origin_data_->getData()->end()) {
+ const ZoneNode* origin_node = tmp->getOriginNode();
+ const RdataSet* set = origin_node->getData();
+ if (RdataSet::find(set, RRType::NSEC3PARAM()) == NULL) {
LOG_WARN(logger, DATASRC_MEM_NO_NSEC3PARAM).
- arg(origin_).arg(client_.getClass());
+ arg(zone_name).arg(rrclass_);
}
}
LOG_DEBUG(logger, DBG_TRACE_BASIC, DATASRC_MEM_ADD_ZONE).
- arg(zone_name).arg(getClass().toText());
+ arg(zone_name).arg(rrclass_.toText());
- ++impl_->zone_count;
+ ++zone_count;
// Set the filename in file_name_tree_ now, so that getFileName()
// can use it (during zone reloading).
FileNameNode* node(NULL);
- switch (impl_->file_name_tree_->insert(impl_->local_mem_sgmt,
- zone_name, &node)) {
+ switch (file_name_tree_->insert(local_mem_sgmt_,
+ zone_name, &node)) {
case FileNameTree::SUCCESS:
case FileNameTree::ALREADYEXISTS:
// These are OK
@@ -593,11 +595,11 @@ InMemoryClient::InMemoryClientImpl::load(
std::string* tstr = node->setData(new std::string(filename));
delete tstr;
- ZoneTable::AddResult result(zone_table_->addZone(local_mem_sgmt,
+ ZoneTable::AddResult result(zone_table_->addZone(local_mem_sgmt_,
rrclass_, zone_name));
ZoneData *data = zone_table_->setZoneData(zone_name, holder.release());
if (data != NULL) {
- ZoneData::destroy(local_mem_sgmt, data, rrclass_);
+ ZoneData::destroy(local_mem_sgmt_, data, rrclass_);
}
return (result.code);
@@ -674,12 +676,12 @@ InMemoryClient::findZone2(const isc::dns::Name& zone_name) const {
}
isc::datasrc::DataSourceClient::FindResult
-InMemoryClient::findZone(const isc::dns::Name& zone_name) const {
+InMemoryClient::findZone(const isc::dns::Name&) const {
// This variant of findZone() is not implemented and should be
// removed eventually. It currently throws an exception. It is
// required right now to derive from DataSourceClient.
isc_throw(isc::NotImplemented,
- "This variant of findZone() is not implemented.");
+ "This variant of findZone() is not implemented.");
}
result::Result
@@ -721,7 +723,7 @@ InMemoryClient::add(const isc::dns::Name& zone_name,
isc_throw(DataSourceError, "No such zone: " + zone_name.toText());
}
- return (impl_->add(rrset, zone_name, *result.zone_data, NULL));
+ return (impl_->add(rrset, zone_name, *result.zone_data));
}
#if 0
More information about the bind10-changes
mailing list