|
@@ -87,28 +87,24 @@ private:
|
|
|
};
|
|
|
|
|
|
public:
|
|
|
- InMemoryClientImpl(util::MemorySegment& mem_sgmt,
|
|
|
- RRClass rrclass) :
|
|
|
- local_mem_sgmt_(mem_sgmt),
|
|
|
+ InMemoryClientImpl(util::MemorySegment& mem_sgmt, RRClass rrclass) :
|
|
|
+ mem_sgmt_(mem_sgmt),
|
|
|
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(mem_sgmt_, rrclass)),
|
|
|
+ file_name_tree_(FileNameTree::create(mem_sgmt_, false))
|
|
|
{}
|
|
|
~InMemoryClientImpl() {
|
|
|
FileNameDeleter deleter;
|
|
|
- FileNameTree::destroy(local_mem_sgmt_, file_name_tree_, deleter);
|
|
|
+ FileNameTree::destroy(mem_sgmt_, file_name_tree_, deleter);
|
|
|
|
|
|
- ZoneTable::destroy(local_mem_sgmt_, zone_table_, rrclass_);
|
|
|
+ ZoneTable::destroy(mem_sgmt_, zone_table_, rrclass_);
|
|
|
|
|
|
// see above for the assert().
|
|
|
- assert(local_mem_sgmt_.allMemoryDeallocated());
|
|
|
+ assert(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::MemorySegment& local_mem_sgmt_;
|
|
|
+ util::MemorySegment& mem_sgmt_;
|
|
|
const RRClass rrclass_;
|
|
|
unsigned int zone_count_;
|
|
|
ZoneTable* zone_table_;
|
|
@@ -155,14 +151,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(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(mem_sgmt_, wname, &node);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -311,7 +307,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(mem_sgmt_, nsec3_rdata);
|
|
|
zone_data.setNSEC3Data(nsec3_data);
|
|
|
} else {
|
|
|
size_t salt_len = nsec3_data->getSaltLen();
|
|
@@ -332,18 +328,17 @@ public:
|
|
|
transform(fst_label.begin(), fst_label.end(), fst_label.begin(),
|
|
|
::toupper);
|
|
|
|
|
|
- ZoneNode *node;
|
|
|
- nsec3_data->insertName(local_mem_sgmt_, Name(fst_label), &node);
|
|
|
+ ZoneNode* node;
|
|
|
+ nsec3_data->insertName(mem_sgmt_, Name(fst_label), &node);
|
|
|
|
|
|
RdataEncoder encoder;
|
|
|
|
|
|
// We assume that rrsig has already been checked to match rrset
|
|
|
// by the caller.
|
|
|
- RdataSet *set = RdataSet::create(local_mem_sgmt_, encoder,
|
|
|
- rrset, rrsig);
|
|
|
- RdataSet *old_set = node->setData(set);
|
|
|
+ RdataSet* set = RdataSet::create(mem_sgmt_, encoder, rrset, rrsig);
|
|
|
+ RdataSet* old_set = node->setData(set);
|
|
|
if (old_set != NULL) {
|
|
|
- RdataSet::destroy(local_mem_sgmt_, rrclass_, old_set);
|
|
|
+ RdataSet::destroy(mem_sgmt_, rrclass_, old_set);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -393,8 +388,7 @@ public:
|
|
|
addNSEC3(last_rrset_, rrsig, zone_data);
|
|
|
} else {
|
|
|
ZoneNode* node;
|
|
|
- zone_data.insertName(local_mem_sgmt_,
|
|
|
- last_rrset_->getName(), &node);
|
|
|
+ zone_data.insertName(mem_sgmt_, last_rrset_->getName(), &node);
|
|
|
|
|
|
RdataSet* set = node->getData();
|
|
|
|
|
@@ -413,7 +407,7 @@ public:
|
|
|
}
|
|
|
|
|
|
RdataEncoder encoder;
|
|
|
- RdataSet *new_set = RdataSet::create(local_mem_sgmt_, encoder,
|
|
|
+ RdataSet *new_set = RdataSet::create(mem_sgmt_, encoder,
|
|
|
last_rrset_, rrsig);
|
|
|
new_set->next = set;
|
|
|
node->setData(new_set);
|
|
@@ -442,7 +436,7 @@ public:
|
|
|
|
|
|
NSEC3Data* nsec3_data = zone_data.getNSEC3Data();
|
|
|
if (nsec3_data == NULL) {
|
|
|
- nsec3_data = NSEC3Data::create(local_mem_sgmt_, param);
|
|
|
+ nsec3_data = NSEC3Data::create(mem_sgmt_, param);
|
|
|
zone_data.setNSEC3Data(nsec3_data);
|
|
|
} else {
|
|
|
size_t salt_len = nsec3_data->getSaltLen();
|
|
@@ -550,7 +544,7 @@ InMemoryClient::InMemoryClientImpl::load(
|
|
|
boost::function<void(LoadCallback)> rrset_installer)
|
|
|
{
|
|
|
SegmentObjectHolder<ZoneData, RRClass> holder(
|
|
|
- local_mem_sgmt_, ZoneData::create(local_mem_sgmt_, zone_name),
|
|
|
+ mem_sgmt_, ZoneData::create(mem_sgmt_, zone_name),
|
|
|
rrclass_);
|
|
|
|
|
|
assert(!last_rrset_);
|
|
@@ -595,8 +589,7 @@ InMemoryClient::InMemoryClientImpl::load(
|
|
|
// Set the filename in file_name_tree_ now, so that getFileName()
|
|
|
// can use it (during zone reloading).
|
|
|
FileNameNode* node(NULL);
|
|
|
- switch (file_name_tree_->insert(local_mem_sgmt_,
|
|
|
- zone_name, &node)) {
|
|
|
+ switch (file_name_tree_->insert(mem_sgmt_, zone_name, &node)) {
|
|
|
case FileNameTree::SUCCESS:
|
|
|
case FileNameTree::ALREADYEXISTS:
|
|
|
// These are OK
|
|
@@ -611,8 +604,8 @@ InMemoryClient::InMemoryClientImpl::load(
|
|
|
std::string* tstr = node->setData(new std::string(filename));
|
|
|
delete tstr;
|
|
|
|
|
|
- ZoneTable::AddResult result(zone_table_->addZone(local_mem_sgmt_,
|
|
|
- rrclass_, zone_name));
|
|
|
+ ZoneTable::AddResult result(zone_table_->addZone(mem_sgmt_, rrclass_,
|
|
|
+ zone_name));
|
|
|
if (result.code == result::SUCCESS) {
|
|
|
// Only increment the zone count if the zone doesn't already
|
|
|
// exist.
|
|
@@ -623,7 +616,7 @@ InMemoryClient::InMemoryClientImpl::load(
|
|
|
holder.release()));
|
|
|
assert(fr.code == result::SUCCESS);
|
|
|
if (fr.zone_data != NULL) {
|
|
|
- ZoneData::destroy(local_mem_sgmt_, fr.zone_data, rrclass_);
|
|
|
+ ZoneData::destroy(mem_sgmt_, fr.zone_data, rrclass_);
|
|
|
}
|
|
|
|
|
|
return (result.code);
|