BIND 10 trac1604, updated. c94e2c8278f93b03d8f25568faf932edfb80ca11 [1604] More simplification of method signatures
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Jan 30 18:51:09 UTC 2012
The branch, trac1604 has been updated
via c94e2c8278f93b03d8f25568faf932edfb80ca11 (commit)
via 33c40df68be6cf370add210228c9e4dc06f21f9f (commit)
via 8a86b9dad4f7f796f100119e3747c04f4e304a66 (commit)
via 149d2cad34c34e7ed21edf3e51b88cb54dfda06f (commit)
via 2da738e9c7b12745b6cfb02051ffbd844803d334 (commit)
from 67b1031ec37365288502d0894cccddec7e12657e (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 c94e2c8278f93b03d8f25568faf932edfb80ca11
Author: Stephen Morris <stephen at isc.org>
Date: Mon Jan 30 18:50:32 2012 +0000
[1604] More simplification of method signatures
commit 33c40df68be6cf370add210228c9e4dc06f21f9f
Author: Stephen Morris <stephen at isc.org>
Date: Mon Jan 30 18:47:50 2012 +0000
[1604] Remove PyRRset_ToRRset
This returned a reference to an RRset. With the RRsetPtr class
now pointing to an AbstractRRset, implementation of this required
a dynamic_cast to allow for the possibility that the object pointed
to was not an RRset. However, other changes have made this function
redundant so it has been removed, so eliminating the assumption.
commit 8a86b9dad4f7f796f100119e3747c04f4e304a66
Author: Stephen Morris <stephen at isc.org>
Date: Mon Jan 30 18:24:20 2012 +0000
[1604] More signature simplification
Modified more method signatures t o take arguments by ConstRRsetPtr.
commit 149d2cad34c34e7ed21edf3e51b88cb54dfda06f
Author: Stephen Morris <stephen at isc.org>
Date: Mon Jan 30 16:40:51 2012 +0000
[1604] Simplified signature of createRRsetObject
Made the argument a ConstRRsetPtr and so removed the need to access
the underlying raw pointer of arguments in the calls to it.
commit 2da738e9c7b12745b6cfb02051ffbd844803d334
Author: Stephen Morris <stephen at isc.org>
Date: Mon Jan 30 14:36:43 2012 +0000
[1604] Base public interfaces on AbstractRRset
As part of the optimization work, a specialised RRset will be
introduced in the in-memory data source. To be able to do this,
public interfaces need to be based on AbstractRRset, not RRset.
This change alters RRsetPtr and ConstRRsetPtr to point to an
AbstractRRset and alters other functions to cope with this change.
-----------------------------------------------------------------------
Summary of changes:
src/bin/auth/query.cc | 44 ++++----
src/bin/auth/query.h | 2 +-
src/bin/auth/tests/query_unittest.cc | 16 ++--
src/lib/cache/local_zone_data.cc | 13 +-
src/lib/cache/local_zone_data.h | 4 +-
src/lib/cache/message_entry.cc | 4 +-
src/lib/cache/resolver_cache.cc | 4 +-
src/lib/cache/rrset_cache.cc | 17 ++--
src/lib/cache/rrset_cache.h | 2 +-
src/lib/cache/rrset_copy.cc | 11 +-
src/lib/cache/rrset_copy.h | 2 +-
src/lib/cache/rrset_entry.cc | 10 +-
src/lib/cache/rrset_entry.h | 2 +-
src/lib/cache/tests/local_zone_data_unittest.cc | 4 +-
src/lib/cache/tests/rrset_cache_unittest.cc | 10 +-
src/lib/cache/tests/rrset_entry_unittest.cc | 16 ++--
src/lib/datasrc/database.cc | 58 +++++-----
src/lib/datasrc/tests/database_unittest.cc | 110 +++++++++---------
src/lib/datasrc/zone.h | 4 +-
src/lib/dns/python/message_python.cc | 11 ++-
src/lib/dns/python/rrset_python.cc | 18 +--
src/lib/dns/python/rrset_python.h | 14 +--
src/lib/dns/rrset.h | 122 +++++++++++++++++++-
.../tests/nameserver_address_store_unittest.cc | 2 +-
src/lib/python/isc/datasrc/finder_python.cc | 6 +-
src/lib/python/isc/datasrc/iterator_python.cc | 4 +-
.../python/isc/datasrc/journal_reader_python.cc | 2 +-
src/lib/python/isc/datasrc/updater_python.cc | 4 +-
28 files changed, 311 insertions(+), 205 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/bin/auth/query.cc b/src/bin/auth/query.cc
index 7d6886c..7641932 100644
--- a/src/bin/auth/query.cc
+++ b/src/bin/auth/query.cc
@@ -70,15 +70,15 @@ namespace isc {
namespace auth {
void
-Query::addAdditional(ZoneFinder& zone, const RRset& rrset) {
- RdataIteratorPtr rdata_iterator(rrset.getRdataIterator());
+Query::addAdditional(ZoneFinder& zone, ConstRRsetPtr rrset) {
+ RdataIteratorPtr rdata_iterator(rrset->getRdataIterator());
for (; !rdata_iterator->isLast(); rdata_iterator->next()) {
const Rdata& rdata(rdata_iterator->getCurrent());
- if (rrset.getType() == RRType::NS()) {
+ if (rrset->getType() == RRType::NS()) {
// Need to perform the search in the "GLUE OK" mode.
const generic::NS& ns = dynamic_cast<const generic::NS&>(rdata);
addAdditionalAddrs(zone, ns.getNSName(), ZoneFinder::FIND_GLUE_OK);
- } else if (rrset.getType() == RRType::MX()) {
+ } else if (rrset->getType() == RRType::MX()) {
const generic::MX& mx(dynamic_cast<const generic::MX&>(rdata));
addAdditionalAddrs(zone, mx.getMXName());
}
@@ -109,7 +109,7 @@ Query::addAdditionalAddrs(ZoneFinder& zone, const Name& qname,
findWrapper(zone.find(qname, RRType::A(), options | dnssec_opt_));
if (a_result.code == ZoneFinder::SUCCESS) {
response_.addRRset(Message::SECTION_ADDITIONAL,
- boost::const_pointer_cast<RRset>(a_result.rrset), dnssec_);
+ boost::const_pointer_cast<AbstractRRset>(a_result.rrset), dnssec_);
}
}
@@ -120,7 +120,7 @@ Query::addAdditionalAddrs(ZoneFinder& zone, const Name& qname,
options | dnssec_opt_));
if (aaaa_result.code == ZoneFinder::SUCCESS) {
response_.addRRset(Message::SECTION_ADDITIONAL,
- boost::const_pointer_cast<RRset>(aaaa_result.rrset),
+ boost::const_pointer_cast<AbstractRRset>(aaaa_result.rrset),
dnssec_);
}
}
@@ -141,7 +141,7 @@ Query::addSOA(ZoneFinder& finder) {
* to insist.
*/
response_.addRRset(Message::SECTION_AUTHORITY,
- boost::const_pointer_cast<RRset>(soa_result.rrset), dnssec_);
+ boost::const_pointer_cast<AbstractRRset>(soa_result.rrset), dnssec_);
}
}
@@ -161,7 +161,7 @@ Query::addNXDOMAINProof(ZoneFinder& finder, ConstRRsetPtr nsec) {
// Add the NSEC proving NXDOMAIN to the authority section.
response_.addRRset(Message::SECTION_AUTHORITY,
- boost::const_pointer_cast<RRset>(nsec), dnssec_);
+ boost::const_pointer_cast<AbstractRRset>(nsec), dnssec_);
// Next, identify the best possible wildcard name that would match
// the query name. It's the longer common suffix with the qname
@@ -199,7 +199,7 @@ Query::addNXDOMAINProof(ZoneFinder& finder, ConstRRsetPtr nsec) {
// for some optimized data source implementations.
if (nsec->getName() != fresult.rrset->getName()) {
response_.addRRset(Message::SECTION_AUTHORITY,
- boost::const_pointer_cast<RRset>(fresult.rrset),
+ boost::const_pointer_cast<AbstractRRset>(fresult.rrset),
dnssec_);
}
}
@@ -217,7 +217,7 @@ Query::addWildcardProof(ZoneFinder& finder) {
isc_throw(BadNSEC, "Unexpected result for wildcard proof");
}
response_.addRRset(Message::SECTION_AUTHORITY,
- boost::const_pointer_cast<RRset>(fresult.rrset),
+ boost::const_pointer_cast<AbstractRRset>(fresult.rrset),
dnssec_);
}
@@ -240,7 +240,7 @@ Query::addWildcardNXRRSETProof(ZoneFinder& finder, ConstRRsetPtr nsec) {
if (nsec->getName() != fresult.rrset->getName()) {
// one NSEC RR proves wildcard_nxrrset that no matched QNAME.
response_.addRRset(Message::SECTION_AUTHORITY,
- boost::const_pointer_cast<RRset>(fresult.rrset),
+ boost::const_pointer_cast<AbstractRRset>(fresult.rrset),
dnssec_);
}
}
@@ -257,9 +257,9 @@ Query::addAuthAdditional(ZoneFinder& finder) {
finder.getOrigin().toText());
} else {
response_.addRRset(Message::SECTION_AUTHORITY,
- boost::const_pointer_cast<RRset>(ns_result.rrset), dnssec_);
+ boost::const_pointer_cast<AbstractRRset>(ns_result.rrset), dnssec_);
// Handle additional for authority section
- addAdditional(finder, *ns_result.rrset);
+ addAdditional(finder, ns_result.rrset);
}
}
@@ -300,7 +300,7 @@ Query::process() {
case ZoneFinder::DNAME: {
// First, put the dname into the answer
response_.addRRset(Message::SECTION_ANSWER,
- boost::const_pointer_cast<RRset>(db_result.rrset),
+ boost::const_pointer_cast<AbstractRRset>(db_result.rrset),
dnssec_);
/*
* Empty DNAME should never get in, as it is impossible to
@@ -351,7 +351,7 @@ Query::process() {
* So, just put it there.
*/
response_.addRRset(Message::SECTION_ANSWER,
- boost::const_pointer_cast<RRset>(db_result.rrset),
+ boost::const_pointer_cast<AbstractRRset>(db_result.rrset),
dnssec_);
// If the answer is a result of wildcard substitution,
@@ -366,16 +366,16 @@ Query::process() {
// into answer section.
BOOST_FOREACH(ConstRRsetPtr rrset, target) {
response_.addRRset(Message::SECTION_ANSWER,
- boost::const_pointer_cast<RRset>(rrset), dnssec_);
+ boost::const_pointer_cast<AbstractRRset>(rrset), dnssec_);
// Handle additional for answer section
- addAdditional(*result.zone_finder, *rrset.get());
+ addAdditional(*result.zone_finder, rrset);
}
} else {
response_.addRRset(Message::SECTION_ANSWER,
- boost::const_pointer_cast<RRset>(db_result.rrset),
+ boost::const_pointer_cast<AbstractRRset>(db_result.rrset),
dnssec_);
// Handle additional for answer section
- addAdditional(*result.zone_finder, *db_result.rrset);
+ addAdditional(*result.zone_finder, db_result.rrset);
}
// If apex NS records haven't been provided in the answer
// section, insert apex NS records into the authority section
@@ -397,9 +397,9 @@ Query::process() {
case ZoneFinder::DELEGATION:
response_.setHeaderFlag(Message::HEADERFLAG_AA, false);
response_.addRRset(Message::SECTION_AUTHORITY,
- boost::const_pointer_cast<RRset>(db_result.rrset),
+ boost::const_pointer_cast<AbstractRRset>(db_result.rrset),
dnssec_);
- addAdditional(*result.zone_finder, *db_result.rrset);
+ addAdditional(*result.zone_finder, db_result.rrset);
break;
case ZoneFinder::NXDOMAIN:
response_.setRcode(Rcode::NXDOMAIN());
@@ -413,7 +413,7 @@ Query::process() {
if (dnssec_) {
if (db_result.isNSECSigned() && db_result.rrset) {
response_.addRRset(Message::SECTION_AUTHORITY,
- boost::const_pointer_cast<RRset>(
+ boost::const_pointer_cast<AbstractRRset>(
db_result.rrset),
dnssec_);
if (db_result.isWildcard()) {
diff --git a/src/bin/auth/query.h b/src/bin/auth/query.h
index 43a8b6b..ac303ce 100644
--- a/src/bin/auth/query.h
+++ b/src/bin/auth/query.h
@@ -109,7 +109,7 @@ private:
/// \param rrset The RRset (i.e., NS or MX rrset) which require additional
/// processing.
void addAdditional(isc::datasrc::ZoneFinder& zone,
- const isc::dns::RRset& rrset);
+ isc::dns::ConstRRsetPtr rrset);
/// \brief Find address records for a specified name.
///
diff --git a/src/bin/auth/tests/query_unittest.cc b/src/bin/auth/tests/query_unittest.cc
index 350bc63..8b70ebc 100644
--- a/src/bin/auth/tests/query_unittest.cc
+++ b/src/bin/auth/tests/query_unittest.cc
@@ -339,12 +339,12 @@ private:
// A helper function that generates a new RRset based on "wild_rrset",
// replacing its owner name with 'real_name'.
ConstRRsetPtr
-substituteWild(const RRset& wild_rrset, const Name& real_name) {
- RRsetPtr rrset(new RRset(real_name, wild_rrset.getClass(),
- wild_rrset.getType(), wild_rrset.getTTL()));
+substituteWild(ConstRRsetPtr wild_rrset, const Name& real_name) {
+ RRsetPtr rrset(new RRset(real_name, wild_rrset->getClass(),
+ wild_rrset->getType(), wild_rrset->getTTL()));
// For simplicity we only consider the case with one RDATA (for now)
- rrset->addRdata(wild_rrset.getRdataIterator()->getCurrent());
- ConstRRsetPtr wild_sig = wild_rrset.getRRsig();
+ rrset->addRdata(wild_rrset->getRdataIterator()->getCurrent());
+ ConstRRsetPtr wild_sig = wild_rrset->getRRsig();
if (wild_sig) {
RRsetPtr sig(new RRset(real_name, wild_sig->getClass(),
wild_sig->getType(), wild_sig->getTTL()));
@@ -543,7 +543,7 @@ MockZoneFinder::find(const Name& name, const RRType& type,
if(found_rrset != domain->second.end()) {
return (FindResult(SUCCESS,
substituteWild(
- *found_rrset->second, name),
+ found_rrset->second, name),
RESULT_WILDCARD |
(use_nsec3_ ?
RESULT_NSEC3_SIGNED :
@@ -561,7 +561,7 @@ MockZoneFinder::find(const Name& name, const RRType& type,
assert(found_rrset != domain->second.end());
return (FindResult(NXRRSET,
substituteWild(
- *found_rrset->second,
+ found_rrset->second,
new_name),
RESULT_WILDCARD |
RESULT_NSEC_SIGNED));
@@ -599,7 +599,7 @@ MockZoneFinder::find(const Name& name, const RRType& type,
domain->second.find(RRType::CNAME());
assert(found_rrset != domain->second.end());
return (FindResult(CNAME,
- substituteWild(*found_rrset->second, name),
+ substituteWild(found_rrset->second, name),
RESULT_WILDCARD |
(use_nsec3_ ? RESULT_NSEC3_SIGNED :
RESULT_NSEC_SIGNED)));
diff --git a/src/lib/cache/local_zone_data.cc b/src/lib/cache/local_zone_data.cc
index 13d1d75..13a8a73 100644
--- a/src/lib/cache/local_zone_data.cc
+++ b/src/lib/cache/local_zone_data.cc
@@ -43,16 +43,15 @@ LocalZoneData::lookup(const isc::dns::Name& name,
}
void
-LocalZoneData::update(const isc::dns::RRset& rrset) {
+LocalZoneData::update(isc::dns::ConstRRsetPtr rrset) {
//TODO Do we really need to recreate the rrset again?
- string key = genCacheEntryName(rrset.getName(), rrset.getType());
+ string key = genCacheEntryName(rrset->getName(), rrset->getType());
LOG_DEBUG(logger, DBG_TRACE_DATA, CACHE_LOCALZONE_UPDATE).arg(key);
- RRset* rrset_copy = new RRset(rrset.getName(), rrset.getClass(),
- rrset.getType(), rrset.getTTL());
+ RRsetPtr rrset_copy = RRsetPtr(new RRset(rrset->getName(), rrset->getClass(),
+ rrset->getType(), rrset->getTTL()));
- rrsetCopy(rrset, *rrset_copy);
- RRsetPtr rrset_ptr(rrset_copy);
- rrsets_map_[key] = rrset_ptr;
+ rrsetCopy(rrset, rrset_copy);
+ rrsets_map_[key] = rrset_copy;
}
} // namespace cache
diff --git a/src/lib/cache/local_zone_data.h b/src/lib/cache/local_zone_data.h
index 3015847..bac1f09 100644
--- a/src/lib/cache/local_zone_data.h
+++ b/src/lib/cache/local_zone_data.h
@@ -44,10 +44,10 @@ public:
/// \brief Update the rrset in the local zone.
///
/// If the rrset doesn't exist, it will be added.
- /// Otherwise, the existed one will be overwritten.
+ /// Otherwise, the existing one will be overwritten.
///
/// \param rrset The rrset to update
- void update(const isc::dns::RRset& rrset);
+ void update(isc::dns::ConstRRsetPtr rrset);
private:
std::map<std::string, isc::dns::RRsetPtr> rrsets_map_; // RRsets of the zone
diff --git a/src/lib/cache/message_entry.cc b/src/lib/cache/message_entry.cc
index d9560a6..44b6370 100644
--- a/src/lib/cache/message_entry.cc
+++ b/src/lib/cache/message_entry.cc
@@ -258,7 +258,7 @@ MessageEntry::parseSection(const isc::dns::Message& msg,
//TODO set proper rrset trust level.
RRsetPtr rrset_ptr = *iter;
RRsetTrustLevel level = getRRsetTrustLevel(msg, rrset_ptr, section);
- RRsetEntryPtr rrset_entry = rrset_cache_->update(*rrset_ptr, level);
+ RRsetEntryPtr rrset_entry = rrset_cache_->update(rrset_ptr, level);
rrsets_.push_back(RRsetRef(rrset_ptr->getName(), rrset_ptr->getType(),
rrset_cache_.get()));
@@ -290,7 +290,7 @@ MessageEntry::parseNegativeResponseAuthoritySection(const isc::dns::Message& msg
rrset_cache_ptr = negative_soa_cache_;
}
- RRsetEntryPtr rrset_entry = rrset_cache_ptr->update(*rrset_ptr, level);
+ RRsetEntryPtr rrset_entry = rrset_cache_ptr->update(rrset_ptr, level);
rrsets_.push_back(RRsetRef(rrset_ptr->getName(),
rrset_ptr->getType(),
rrset_cache_ptr.get()));
diff --git a/src/lib/cache/resolver_cache.cc b/src/lib/cache/resolver_cache.cc
index 20f470e..2708fd3 100644
--- a/src/lib/cache/resolver_cache.cc
+++ b/src/lib/cache/resolver_cache.cc
@@ -141,7 +141,7 @@ ResolverClassCache::updateRRsetCache(const isc::dns::ConstRRsetPtr& rrset_ptr,
level = RRSET_TRUST_PRIM_ZONE_NONGLUE;
}
- rrset_cache_ptr->update((*rrset_ptr.get()), level);
+ rrset_cache_ptr->update(rrset_ptr, level);
return (true);
}
@@ -151,7 +151,7 @@ ResolverClassCache::update(const isc::dns::ConstRRsetPtr& rrset_ptr) {
arg(rrset_ptr->getName()).arg(rrset_ptr->getType()).
arg(rrset_ptr->getClass());
// First update local zone, then update rrset cache.
- local_zone_data_->update((*rrset_ptr.get()));
+ local_zone_data_->update(rrset_ptr);
updateRRsetCache(rrset_ptr, rrsets_cache_);
return (true);
}
diff --git a/src/lib/cache/rrset_cache.cc b/src/lib/cache/rrset_cache.cc
index 1a5fd48..41316e6 100644
--- a/src/lib/cache/rrset_cache.cc
+++ b/src/lib/cache/rrset_cache.cc
@@ -70,25 +70,24 @@ RRsetCache::lookup(const isc::dns::Name& qname,
}
RRsetEntryPtr
-RRsetCache::update(const isc::dns::RRset& rrset,
- const RRsetTrustLevel& level)
+RRsetCache::update(isc::dns::ConstRRsetPtr rrset, const RRsetTrustLevel& level)
{
- LOG_DEBUG(logger, DBG_TRACE_DATA, CACHE_RRSET_UPDATE).arg(rrset.getName()).
- arg(rrset.getType()).arg(rrset.getClass());
+ LOG_DEBUG(logger, DBG_TRACE_DATA, CACHE_RRSET_UPDATE).arg(rrset->getName()).
+ arg(rrset->getType()).arg(rrset->getClass());
// TODO: If the RRset is an NS, we should update the NSAS as well
// lookup first
- RRsetEntryPtr entry_ptr = lookup(rrset.getName(), rrset.getType());
+ RRsetEntryPtr entry_ptr = lookup(rrset->getName(), rrset->getType());
if (entry_ptr) {
if (entry_ptr->getTrustLevel() > level) {
LOG_DEBUG(logger, DBG_TRACE_DATA, CACHE_RRSET_UNTRUSTED).
- arg(rrset.getName()).arg(rrset.getType()).
- arg(rrset.getClass());
+ arg(rrset->getName()).arg(rrset->getType()).
+ arg(rrset->getClass());
// existed rrset entry is more authoritative, just return it
return (entry_ptr);
} else {
LOG_DEBUG(logger, DBG_TRACE_DATA, CACHE_RRSET_REMOVE_OLD).
- arg(rrset.getName()).arg(rrset.getType()).
- arg(rrset.getClass());
+ arg(rrset->getName()).arg(rrset->getType()).
+ arg(rrset->getClass());
// Remove the old rrset entry from the lru list.
rrset_lru_.remove(entry_ptr);
}
diff --git a/src/lib/cache/rrset_cache.h b/src/lib/cache/rrset_cache.h
index 73f9b58..a0e28b3 100644
--- a/src/lib/cache/rrset_cache.h
+++ b/src/lib/cache/rrset_cache.h
@@ -73,7 +73,7 @@ public:
/// \param level trustworthiness of the rrset.
/// \return return the rrset entry in the cache, it may be the
/// new added rrset entry or existed one if it is not replaced.
- RRsetEntryPtr update(const isc::dns::RRset& rrset,
+ RRsetEntryPtr update(isc::dns::ConstRRsetPtr rrset,
const RRsetTrustLevel& level);
/// \short Protected memebers, so they can be accessed by tests.
diff --git a/src/lib/cache/rrset_copy.cc b/src/lib/cache/rrset_copy.cc
index 05b139a..22f6343 100644
--- a/src/lib/cache/rrset_copy.cc
+++ b/src/lib/cache/rrset_copy.cc
@@ -20,17 +20,18 @@ namespace isc {
namespace cache {
void
-rrsetCopy(const isc::dns::RRset& src, isc::dns::RRset& dst) {
- RdataIteratorPtr rdata_itor = src.getRdataIterator();
+rrsetCopy(isc::dns::ConstRRsetPtr src, RRsetPtr dst)
+{
+ RdataIteratorPtr rdata_itor = src->getRdataIterator();
rdata_itor->first();
while(!rdata_itor->isLast()){
- dst.addRdata(rdata_itor->getCurrent());
+ dst->addRdata(rdata_itor->getCurrent());
rdata_itor->next();
}
- RRsetPtr rrsig = src.getRRsig();
+ RRsetPtr rrsig = src->getRRsig();
if (rrsig != NULL){
- dst.addRRsig(rrsig);
+ dst->addRRsig(rrsig);
}
}
diff --git a/src/lib/cache/rrset_copy.h b/src/lib/cache/rrset_copy.h
index b6af8d6..dee612f 100644
--- a/src/lib/cache/rrset_copy.h
+++ b/src/lib/cache/rrset_copy.h
@@ -33,7 +33,7 @@ namespace cache {
/// we have to do the copy.
void
-rrsetCopy(const isc::dns::RRset& src, isc::dns::RRset& dst);
+rrsetCopy(isc::dns::ConstRRsetPtr src, isc::dns::RRsetPtr dst);
} // namespace cache
} // namespace isc
diff --git a/src/lib/cache/rrset_entry.cc b/src/lib/cache/rrset_entry.cc
index c829956..ad3af94 100644
--- a/src/lib/cache/rrset_entry.cc
+++ b/src/lib/cache/rrset_entry.cc
@@ -25,14 +25,14 @@ using namespace isc::dns;
namespace isc {
namespace cache {
-RRsetEntry::RRsetEntry(const isc::dns::RRset& rrset, const RRsetTrustLevel& level):
- entry_name_(genCacheEntryName(rrset.getName(), rrset.getType())),
- expire_time_(time(NULL) + rrset.getTTL().getValue()),
+RRsetEntry::RRsetEntry(isc::dns::ConstRRsetPtr rrset, const RRsetTrustLevel& level):
+ entry_name_(genCacheEntryName(rrset->getName(), rrset->getType())),
+ expire_time_(time(NULL) + rrset->getTTL().getValue()),
trust_level_(level),
- rrset_(new RRset(rrset.getName(), rrset.getClass(), rrset.getType(), rrset.getTTL())),
+ rrset_(new RRset(rrset->getName(), rrset->getClass(), rrset->getType(), rrset->getTTL())),
hash_key_(HashKey(entry_name_, rrset_->getClass()))
{
- rrsetCopy(rrset, *(rrset_.get()));
+ rrsetCopy(rrset, rrset_);
}
isc::dns::RRsetPtr
diff --git a/src/lib/cache/rrset_entry.h b/src/lib/cache/rrset_entry.h
index 09cf79c..d216f47 100644
--- a/src/lib/cache/rrset_entry.h
+++ b/src/lib/cache/rrset_entry.h
@@ -75,7 +75,7 @@ public:
/// \brief Constructor
/// \param rrset The RRset used to initialize the RRset entry.
/// \param level trustworthiness of the RRset.
- RRsetEntry(const isc::dns::RRset& rrset, const RRsetTrustLevel& level);
+ RRsetEntry(isc::dns::ConstRRsetPtr rrset, const RRsetTrustLevel& level);
/// The destructor.
~RRsetEntry() {}
diff --git a/src/lib/cache/tests/local_zone_data_unittest.cc b/src/lib/cache/tests/local_zone_data_unittest.cc
index 6877eae..8875fb5 100644
--- a/src/lib/cache/tests/local_zone_data_unittest.cc
+++ b/src/lib/cache/tests/local_zone_data_unittest.cc
@@ -43,7 +43,7 @@ TEST_F(LocalZoneDataTest, updateAndLookup) {
RRType type = (*rrset_iter)->getType();
EXPECT_FALSE(local_zone_data.lookup(name, type));
- local_zone_data.update((*(*rrset_iter).get()));
+ local_zone_data.update(*rrset_iter);
EXPECT_TRUE(local_zone_data.lookup(name, type));
// Test whether the old one is replaced
@@ -56,7 +56,7 @@ TEST_F(LocalZoneDataTest, updateAndLookup) {
(*rrset_iter)->setTTL(RRTTL(ttl/2));
- local_zone_data.update((*(*rrset_iter).get()));
+ local_zone_data.update(*rrset_iter);
rrset_ptr = local_zone_data.lookup(name, type);
EXPECT_EQ(ttl/2, rrset_ptr->getTTL().getValue());
}
diff --git a/src/lib/cache/tests/rrset_cache_unittest.cc b/src/lib/cache/tests/rrset_cache_unittest.cc
index b61f5c4..d68d459 100644
--- a/src/lib/cache/tests/rrset_cache_unittest.cc
+++ b/src/lib/cache/tests/rrset_cache_unittest.cc
@@ -36,8 +36,8 @@ protected:
RRsetCacheTest():
cache_(1, RRClass::IN().getCode()),
name_("example.com"),
- rrset1_(name_, RRClass::IN(), RRType::A(), RRTTL(20)),
- rrset2_(name_, RRClass::IN(), RRType::A(), RRTTL(10)),
+ rrset1_(new RRset(name_, RRClass::IN(), RRType::A(), RRTTL(20))),
+ rrset2_(new RRset(name_, RRClass::IN(), RRType::A(), RRTTL(10))),
rrset_entry1_(rrset1_, RRSET_TRUST_ADDITIONAL_AA),
rrset_entry2_(rrset2_, RRSET_TRUST_PRIM_ZONE_NONGLUE)
{
@@ -45,8 +45,8 @@ protected:
RRsetCache cache_;
Name name_;
- RRset rrset1_;
- RRset rrset2_;
+ RRsetPtr rrset1_;
+ RRsetPtr rrset2_;
RRsetEntry rrset_entry1_;
RRsetEntry rrset_entry2_;
};
@@ -56,7 +56,7 @@ updateRRsetCache(RRsetCache& cache, Name& rrset_name,
uint32_t ttl = 20,
RRsetTrustLevel level = RRSET_TRUST_ADDITIONAL_AA)
{
- RRset rrset(rrset_name, RRClass::IN(), RRType::A(), RRTTL(ttl));
+ RRsetPtr rrset(new RRset(rrset_name, RRClass::IN(), RRType::A(), RRTTL(ttl)));
cache.update(rrset, level);
}
diff --git a/src/lib/cache/tests/rrset_entry_unittest.cc b/src/lib/cache/tests/rrset_entry_unittest.cc
index c7c3c6e..ab8780e 100644
--- a/src/lib/cache/tests/rrset_entry_unittest.cc
+++ b/src/lib/cache/tests/rrset_entry_unittest.cc
@@ -48,7 +48,7 @@ TEST_F(GenCacheKeyTest, genCacheEntryKey2) {
class DerivedRRsetEntry: public RRsetEntry {
public:
- DerivedRRsetEntry(const isc::dns::RRset& rrset, const RRsetTrustLevel& level) : RRsetEntry(rrset, level) {};
+ DerivedRRsetEntry(isc::dns::ConstRRsetPtr rrset, const RRsetTrustLevel& level) : RRsetEntry(rrset, level) {};
void updateTTLForTest() {
@@ -60,23 +60,23 @@ class RRsetEntryTest : public ::testing::Test {
protected:
RRsetEntryTest():
name("test.example.com"),
- rrset(name, RRClass::IN(), RRType::A(), RRTTL(TEST_TTL)),
+ rrset(new RRset(name, RRClass::IN(), RRType::A(), RRTTL(TEST_TTL))),
trust_level(RRSET_TRUST_ADDITIONAL_AA),
rrset_entry(rrset, trust_level)
{
}
Name name;
- RRset rrset;
+ RRsetPtr rrset;
RRsetTrustLevel trust_level;
RRsetEntry rrset_entry;
};
TEST_F(RRsetEntryTest, constructor) {
EXPECT_EQ(trust_level, rrset_entry.getTrustLevel());
- EXPECT_EQ(rrset.getName(), rrset_entry.getRRset()->getName());
- EXPECT_EQ(rrset.getClass(), rrset_entry.getRRset()->getClass());
- EXPECT_EQ(rrset.getType(), rrset_entry.getRRset()->getType());
- EXPECT_EQ(rrset.getRdataCount(), rrset_entry.getRRset()->getRdataCount());
+ EXPECT_EQ(rrset->getName(), rrset_entry.getRRset()->getName());
+ EXPECT_EQ(rrset->getClass(), rrset_entry.getRRset()->getClass());
+ EXPECT_EQ(rrset->getType(), rrset_entry.getRRset()->getType());
+ EXPECT_EQ(rrset->getRdataCount(), rrset_entry.getRRset()->getRdataCount());
}
TEST_F(RRsetEntryTest, updateTTL) {
@@ -87,7 +87,7 @@ TEST_F(RRsetEntryTest, updateTTL) {
}
TEST_F(RRsetEntryTest, TTLExpire) {
- RRset exp_rrset(name, RRClass::IN(), RRType::A(), RRTTL(1));
+ RRsetPtr exp_rrset(new RRset(name, RRClass::IN(), RRType::A(), RRTTL(1)));
RRsetEntry rrset_entry(exp_rrset, RRSET_TRUST_ANSWER_AA);
sleep(1);
uint32_t ttl = rrset_entry.getTTL();
diff --git a/src/lib/datasrc/database.cc b/src/lib/datasrc/database.cc
index 0f24cff..3c5f6e1 100644
--- a/src/lib/datasrc/database.cc
+++ b/src/lib/datasrc/database.cc
@@ -1107,10 +1107,11 @@ public:
virtual ZoneFinder& getFinder() { return (*finder_); }
- virtual void addRRset(const RRset& rrset);
- virtual void deleteRRset(const RRset& rrset);
+ virtual void addRRset(ConstRRsetPtr rrset);
+ virtual void deleteRRset(ConstRRsetPtr rrset);
virtual void commit();
+
private:
// A short cut typedef only for making the code shorter.
typedef DatabaseAccessor Accessor;
@@ -1135,14 +1136,15 @@ private:
// This is a set of validation checks commonly used for addRRset() and
// deleteRRset to minimize duplicate code logic and to make the main
// code concise.
- void validateAddOrDelete(const char* const op_str, const RRset& rrset,
+ void validateAddOrDelete(const char* const op_str,
+ ConstRRsetPtr rrset,
DiffPhase prev_phase,
DiffPhase current_phase) const;
};
void
DatabaseUpdater::validateAddOrDelete(const char* const op_str,
- const RRset& rrset,
+ ConstRRsetPtr rrset,
DiffPhase prev_phase,
DiffPhase current_phase) const
{
@@ -1150,61 +1152,61 @@ DatabaseUpdater::validateAddOrDelete(const char* const op_str,
isc_throw(DataSourceError, op_str << " attempt after commit to zone: "
<< zone_name_ << "/" << zone_class_);
}
- if (rrset.getRdataCount() == 0) {
+ if (rrset->getRdataCount() == 0) {
isc_throw(DataSourceError, op_str << " attempt with an empty RRset: "
- << rrset.getName() << "/" << zone_class_ << "/"
- << rrset.getType());
+ << rrset->getName() << "/" << zone_class_ << "/"
+ << rrset->getType());
}
- if (rrset.getClass() != zone_class_) {
+ if (rrset->getClass() != zone_class_) {
isc_throw(DataSourceError, op_str << " attempt for a different class "
<< zone_name_ << "/" << zone_class_ << ": "
- << rrset.toText());
+ << rrset->toText());
}
- if (rrset.getRRsig()) {
+ if (rrset->getRRsig()) {
isc_throw(DataSourceError, op_str << " attempt for RRset with RRSIG "
<< zone_name_ << "/" << zone_class_ << ": "
- << rrset.toText());
+ << rrset->toText());
}
if (journaling_) {
- const RRType rrtype(rrset.getType());
+ const RRType rrtype(rrset->getType());
if (rrtype == RRType::SOA() && diff_phase_ != prev_phase) {
isc_throw(isc::BadValue, op_str << " attempt in an invalid "
<< "diff phase: " << diff_phase_ << ", rrset: " <<
- rrset.toText());
+ rrset->toText());
}
if (rrtype != RRType::SOA() && diff_phase_ != current_phase) {
isc_throw(isc::BadValue, "diff state change by non SOA: "
- << rrset.toText());
+ << rrset->toText());
}
}
}
void
-DatabaseUpdater::addRRset(const RRset& rrset) {
+DatabaseUpdater::addRRset(ConstRRsetPtr rrset) {
validateAddOrDelete("add", rrset, DELETE, ADD);
// It's guaranteed rrset has at least one RDATA at this point.
- RdataIteratorPtr it = rrset.getRdataIterator();
+ RdataIteratorPtr it = rrset->getRdataIterator();
string columns[Accessor::ADD_COLUMN_COUNT]; // initialized with ""
- columns[Accessor::ADD_NAME] = rrset.getName().toText();
- columns[Accessor::ADD_REV_NAME] = rrset.getName().reverse().toText();
- columns[Accessor::ADD_TTL] = rrset.getTTL().toText();
- columns[Accessor::ADD_TYPE] = rrset.getType().toText();
+ columns[Accessor::ADD_NAME] = rrset->getName().toText();
+ columns[Accessor::ADD_REV_NAME] = rrset->getName().reverse().toText();
+ columns[Accessor::ADD_TTL] = rrset->getTTL().toText();
+ columns[Accessor::ADD_TYPE] = rrset->getType().toText();
string journal[Accessor::DIFF_PARAM_COUNT];
if (journaling_) {
journal[Accessor::DIFF_NAME] = columns[Accessor::ADD_NAME];
journal[Accessor::DIFF_TYPE] = columns[Accessor::ADD_TYPE];
journal[Accessor::DIFF_TTL] = columns[Accessor::ADD_TTL];
diff_phase_ = ADD;
- if (rrset.getType() == RRType::SOA()) {
+ if (rrset->getType() == RRType::SOA()) {
serial_ =
dynamic_cast<const generic::SOA&>(it->getCurrent()).
getSerial();
}
}
for (; !it->isLast(); it->next()) {
- if (rrset.getType() == RRType::RRSIG()) {
+ if (rrset->getType() == RRType::RRSIG()) {
// XXX: the current interface (based on the current sqlite3
// data source schema) requires a separate "sigtype" column,
// even though it won't be used in a newer implementation.
@@ -1226,7 +1228,7 @@ DatabaseUpdater::addRRset(const RRset& rrset) {
}
void
-DatabaseUpdater::deleteRRset(const RRset& rrset) {
+DatabaseUpdater::deleteRRset(ConstRRsetPtr rrset) {
// If this is the first operation, pretend we are starting a new delete
// sequence after adds. This will simplify the validation below.
if (diff_phase_ == NOT_STARTED) {
@@ -1235,18 +1237,18 @@ DatabaseUpdater::deleteRRset(const RRset& rrset) {
validateAddOrDelete("delete", rrset, ADD, DELETE);
- RdataIteratorPtr it = rrset.getRdataIterator();
+ RdataIteratorPtr it = rrset->getRdataIterator();
string params[Accessor::DEL_PARAM_COUNT]; // initialized with ""
- params[Accessor::DEL_NAME] = rrset.getName().toText();
- params[Accessor::DEL_TYPE] = rrset.getType().toText();
+ params[Accessor::DEL_NAME] = rrset->getName().toText();
+ params[Accessor::DEL_TYPE] = rrset->getType().toText();
string journal[Accessor::DIFF_PARAM_COUNT];
if (journaling_) {
journal[Accessor::DIFF_NAME] = params[Accessor::DEL_NAME];
journal[Accessor::DIFF_TYPE] = params[Accessor::DEL_TYPE];
- journal[Accessor::DIFF_TTL] = rrset.getTTL().toText();
+ journal[Accessor::DIFF_TTL] = rrset->getTTL().toText();
diff_phase_ = DELETE;
- if (rrset.getType() == RRType::SOA()) {
+ if (rrset->getType() == RRType::SOA()) {
serial_ =
dynamic_cast<const generic::SOA&>(it->getCurrent()).
getSerial();
diff --git a/src/lib/datasrc/tests/database_unittest.cc b/src/lib/datasrc/tests/database_unittest.cc
index c56ba40..71d90aa 100644
--- a/src/lib/datasrc/tests/database_unittest.cc
+++ b/src/lib/datasrc/tests/database_unittest.cc
@@ -2520,7 +2520,7 @@ TYPED_TEST(DatabaseClientTest, exceptionFromRollback) {
this->rrset_->addRdata(rdata::createRdata(this->rrset_->getType(),
this->rrset_->getClass(),
"192.0.2.1"));
- this->updater_->addRRset(*this->rrset_);
+ this->updater_->addRRset(this->rrset_);
// destruct without commit. The added name will result in an exception
// in the MockAccessor's rollback method. It shouldn't be propagated.
EXPECT_NO_THROW(this->updater_.reset());
@@ -2536,7 +2536,7 @@ TYPED_TEST(DatabaseClientTest, duplicateCommit) {
TYPED_TEST(DatabaseClientTest, addRRsetToNewZone) {
// Add a single RRset to a fresh empty zone
this->updater_ = this->client_->getUpdater(this->zname_, true);
- this->updater_->addRRset(*this->rrset_);
+ this->updater_->addRRset(this->rrset_);
this->expected_rdatas_.clear();
this->expected_rdatas_.push_back("192.0.2.2");
@@ -2550,8 +2550,8 @@ TYPED_TEST(DatabaseClientTest, addRRsetToNewZone) {
// Similar to the previous case, but with RRSIG
this->updater_.reset();
this->updater_ = this->client_->getUpdater(this->zname_, true);
- this->updater_->addRRset(*this->rrset_);
- this->updater_->addRRset(*this->rrsigset_);
+ this->updater_->addRRset(this->rrset_);
+ this->updater_->addRRset(this->rrsigset_);
// confirm the expected columns were passed to the accessor (if checkable).
const char* const rrsig_added[] = {
@@ -2573,7 +2573,7 @@ TYPED_TEST(DatabaseClientTest, addRRsetToNewZone) {
// Add the non RRSIG RRset again, to see the attempt of adding RRSIG
// causes any unexpected effect, in particular, whether the SIGTYPE
// field might remain.
- this->updater_->addRRset(*this->rrset_);
+ this->updater_->addRRset(this->rrset_);
const char* const rrset_added[] = {
"www.example.org.", "org.example.www.", "3600", "A", "", "192.0.2.2"
};
@@ -2585,7 +2585,7 @@ TYPED_TEST(DatabaseClientTest, addRRsetToCurrentZone) {
boost::shared_ptr<DatabaseClient::Finder> finder(this->getFinder());
this->updater_ = this->client_->getUpdater(this->zname_, false);
- this->updater_->addRRset(*this->rrset_);
+ this->updater_->addRRset(this->rrset_);
// We should see both old and new data.
this->expected_rdatas_.clear();
@@ -2613,7 +2613,7 @@ TYPED_TEST(DatabaseClientTest, addMultipleRRs) {
this->rrset_->addRdata(rdata::createRdata(this->rrset_->getType(),
this->rrset_->getClass(),
"192.0.2.3"));
- this->updater_->addRRset(*this->rrset_);
+ this->updater_->addRRset(this->rrset_);
this->expected_rdatas_.clear();
this->expected_rdatas_.push_back("192.0.2.1");
this->expected_rdatas_.push_back("192.0.2.2");
@@ -2632,7 +2632,7 @@ TYPED_TEST(DatabaseClientTest, addRRsetOfLargerTTL) {
// one.
this->updater_ = this->client_->getUpdater(this->zname_, false);
this->rrset_->setTTL(RRTTL(7200));
- this->updater_->addRRset(*this->rrset_);
+ this->updater_->addRRset(this->rrset_);
this->expected_rdatas_.clear();
this->expected_rdatas_.push_back("192.0.2.1");
@@ -2650,7 +2650,7 @@ TYPED_TEST(DatabaseClientTest, addRRsetOfSmallerTTL) {
// The added TTL should be used by the finder.
this->updater_ = this->client_->getUpdater(this->zname_, false);
this->rrset_->setTTL(RRTTL(1800));
- this->updater_->addRRset(*this->rrset_);
+ this->updater_->addRRset(this->rrset_);
this->expected_rdatas_.clear();
this->expected_rdatas_.push_back("192.0.2.1");
@@ -2674,7 +2674,7 @@ TYPED_TEST(DatabaseClientTest, addSameRR) {
this->rrset_->addRdata(rdata::createRdata(this->rrset_->getType(),
this->rrset_->getClass(),
"192.0.2.1"));
- this->updater_->addRRset(*this->rrset_);
+ this->updater_->addRRset(this->rrset_);
this->expected_rdatas_.clear();
this->expected_rdatas_.push_back("192.0.2.1");
this->expected_rdatas_.push_back("192.0.2.1");
@@ -2695,7 +2695,7 @@ TYPED_TEST(DatabaseClientTest, addDeviantRR) {
this->rrset_->addRdata(rdata::createRdata(this->rrset_->getType(),
this->rrset_->getClass(),
"test text"));
- EXPECT_THROW(this->updater_->addRRset(*this->rrset_), DataSourceError);
+ EXPECT_THROW(this->updater_->addRRset(this->rrset_), DataSourceError);
// Out-of-zone owner name. At a higher level this should be rejected,
// but it doesn't happen in this interface.
@@ -2704,7 +2704,7 @@ TYPED_TEST(DatabaseClientTest, addDeviantRR) {
this->rrset_->addRdata(rdata::createRdata(this->rrset_->getType(),
this->rrset_->getClass(),
"192.0.2.100"));
- this->updater_->addRRset(*this->rrset_);
+ this->updater_->addRRset(this->rrset_);
this->expected_rdatas_.clear();
this->expected_rdatas_.push_back("192.0.2.100");
@@ -2724,19 +2724,19 @@ TYPED_TEST(DatabaseClientTest, addEmptyRRset) {
this->updater_ = this->client_->getUpdater(this->zname_, false);
this->rrset_.reset(new RRset(this->qname_, this->qclass_, this->qtype_,
this->rrttl_));
- EXPECT_THROW(this->updater_->addRRset(*this->rrset_), DataSourceError);
+ EXPECT_THROW(this->updater_->addRRset(this->rrset_), DataSourceError);
}
TYPED_TEST(DatabaseClientTest, addAfterCommit) {
this->updater_ = this->client_->getUpdater(this->zname_, false);
this->updater_->commit();
- EXPECT_THROW(this->updater_->addRRset(*this->rrset_), DataSourceError);
+ EXPECT_THROW(this->updater_->addRRset(this->rrset_), DataSourceError);
}
TYPED_TEST(DatabaseClientTest, addRRsetWithRRSIG) {
this->updater_ = this->client_->getUpdater(this->zname_, false);
this->rrset_->addRRsig(*this->rrsigset_);
- EXPECT_THROW(this->updater_->addRRset(*this->rrset_), DataSourceError);
+ EXPECT_THROW(this->updater_->addRRset(this->rrset_), DataSourceError);
}
TYPED_TEST(DatabaseClientTest, deleteRRset) {
@@ -2750,7 +2750,7 @@ TYPED_TEST(DatabaseClientTest, deleteRRset) {
// Delete one RR from an RRset
this->updater_ = this->client_->getUpdater(this->zname_, false);
- this->updater_->deleteRRset(*this->rrset_);
+ this->updater_->deleteRRset(this->rrset_);
// Delete the only RR of a name
this->rrset_.reset(new RRset(Name("cname.example.org"), this->qclass_,
@@ -2758,7 +2758,7 @@ TYPED_TEST(DatabaseClientTest, deleteRRset) {
this->rrset_->addRdata(rdata::createRdata(this->rrset_->getType(),
this->rrset_->getClass(),
"www.example.org"));
- this->updater_->deleteRRset(*this->rrset_);
+ this->updater_->deleteRRset(this->rrset_);
// The this->updater_ finder should immediately see the deleted results.
{
@@ -2812,7 +2812,7 @@ TYPED_TEST(DatabaseClientTest, deleteRRsetToNXDOMAIN) {
"www.example.org"));
this->updater_ = this->client_->getUpdater(this->zname_, false);
- this->updater_->deleteRRset(*this->rrset_);
+ this->updater_->deleteRRset(this->rrset_);
{
SCOPED_TRACE("delete RRset to NXDOMAIN");
doFindTest(this->updater_->getFinder(), Name("cname.example.org"),
@@ -2833,7 +2833,7 @@ TYPED_TEST(DatabaseClientTest, deleteMultipleRRs) {
"2001:db8::2"));
this->updater_ = this->client_->getUpdater(this->zname_, false);
- this->updater_->deleteRRset(*this->rrset_);
+ this->updater_->deleteRRset(this->rrset_);
{
SCOPED_TRACE("delete multiple RRs");
@@ -2857,7 +2857,7 @@ TYPED_TEST(DatabaseClientTest, partialDelete) {
// deleteRRset should succeed "silently", and subsequent find() should
// find the remaining RR.
this->updater_ = this->client_->getUpdater(this->zname_, false);
- this->updater_->deleteRRset(*this->rrset_);
+ this->updater_->deleteRRset(this->rrset_);
{
SCOPED_TRACE("partial delete");
this->expected_rdatas_.push_back("2001:db8::2");
@@ -2871,7 +2871,7 @@ TYPED_TEST(DatabaseClientTest, deleteNoMatch) {
// similar to the previous test, but there's not even a match in the
// specified RRset. Essentially there's no difference in the result.
this->updater_ = this->client_->getUpdater(this->zname_, false);
- this->updater_->deleteRRset(*this->rrset_);
+ this->updater_->deleteRRset(this->rrset_);
{
SCOPED_TRACE("delete no match");
this->expected_rdatas_.push_back("192.0.2.1");
@@ -2889,7 +2889,7 @@ TYPED_TEST(DatabaseClientTest, deleteWithDifferentTTL) {
this->rrset_->getClass(),
"192.0.2.1"));
this->updater_ = this->client_->getUpdater(this->zname_, false);
- this->updater_->deleteRRset(*this->rrset_);
+ this->updater_->deleteRRset(this->rrset_);
{
SCOPED_TRACE("delete RRset with a different TTL");
doFindTest(this->updater_->getFinder(), this->qname_, this->qtype_,
@@ -2907,7 +2907,7 @@ TYPED_TEST(DatabaseClientTest, deleteDeviantRR) {
this->rrset_->addRdata(rdata::createRdata(this->rrset_->getType(),
this->rrset_->getClass(),
"test text"));
- EXPECT_THROW(this->updater_->deleteRRset(*this->rrset_), DataSourceError);
+ EXPECT_THROW(this->updater_->deleteRRset(this->rrset_), DataSourceError);
// Out-of-zone owner name. At a higher level this should be rejected,
// but it doesn't happen in this interface.
@@ -2916,26 +2916,26 @@ TYPED_TEST(DatabaseClientTest, deleteDeviantRR) {
this->rrset_->addRdata(rdata::createRdata(this->rrset_->getType(),
this->rrset_->getClass(),
"192.0.2.100"));
- EXPECT_NO_THROW(this->updater_->deleteRRset(*this->rrset_));
+ EXPECT_NO_THROW(this->updater_->deleteRRset(this->rrset_));
}
TYPED_TEST(DatabaseClientTest, deleteAfterCommit) {
this->updater_ = this->client_->getUpdater(this->zname_, false);
this->updater_->commit();
- EXPECT_THROW(this->updater_->deleteRRset(*this->rrset_), DataSourceError);
+ EXPECT_THROW(this->updater_->deleteRRset(this->rrset_), DataSourceError);
}
TYPED_TEST(DatabaseClientTest, deleteEmptyRRset) {
this->updater_ = this->client_->getUpdater(this->zname_, false);
this->rrset_.reset(new RRset(this->qname_, this->qclass_, this->qtype_,
this->rrttl_));
- EXPECT_THROW(this->updater_->deleteRRset(*this->rrset_), DataSourceError);
+ EXPECT_THROW(this->updater_->deleteRRset(this->rrset_), DataSourceError);
}
TYPED_TEST(DatabaseClientTest, deleteRRsetWithRRSIG) {
this->updater_ = this->client_->getUpdater(this->zname_, false);
this->rrset_->addRRsig(*this->rrsigset_);
- EXPECT_THROW(this->updater_->deleteRRset(*this->rrset_), DataSourceError);
+ EXPECT_THROW(this->updater_->deleteRRset(this->rrset_), DataSourceError);
}
TYPED_TEST(DatabaseClientTest, compoundUpdate) {
@@ -2947,7 +2947,7 @@ TYPED_TEST(DatabaseClientTest, compoundUpdate) {
this->updater_ = this->client_->getUpdater(this->zname_, false);
// add a new RR to an existing RRset
- this->updater_->addRRset(*this->rrset_);
+ this->updater_->addRRset(this->rrset_);
this->expected_rdatas_.clear();
this->expected_rdatas_.push_back("192.0.2.1");
this->expected_rdatas_.push_back("192.0.2.2");
@@ -2961,7 +2961,7 @@ TYPED_TEST(DatabaseClientTest, compoundUpdate) {
this->rrset_->addRdata(rdata::createRdata(this->rrset_->getType(),
this->rrset_->getClass(),
"192.0.2.1"));
- this->updater_->deleteRRset(*this->rrset_);
+ this->updater_->deleteRRset(this->rrset_);
this->expected_rdatas_.clear();
this->expected_rdatas_.push_back("192.0.2.2");
doFindTest(this->updater_->getFinder(), this->qname_, this->qtype_,
@@ -2969,7 +2969,7 @@ TYPED_TEST(DatabaseClientTest, compoundUpdate) {
this->expected_rdatas_, this->empty_rdatas_);
// re-add it
- this->updater_->addRRset(*this->rrset_);
+ this->updater_->addRRset(this->rrset_);
this->expected_rdatas_.push_back("192.0.2.1");
doFindTest(this->updater_->getFinder(), this->qname_, this->qtype_,
this->qtype_, this->rrttl_, ZoneFinder::SUCCESS,
@@ -2989,7 +2989,7 @@ TYPED_TEST(DatabaseClientTest, compoundUpdate) {
this->rrset_->addRdata(rdata::createRdata(this->rrset_->getType(),
this->rrset_->getClass(),
"2001:db8::11"));
- this->updater_->addRRset(*this->rrset_);
+ this->updater_->addRRset(this->rrset_);
this->expected_rdatas_.clear();
this->expected_rdatas_.push_back("2001:db8::10");
this->expected_rdatas_.push_back("2001:db8::11");
@@ -3003,7 +3003,7 @@ TYPED_TEST(DatabaseClientTest, compoundUpdate) {
this->rrset_->addRdata(rdata::createRdata(this->rrset_->getType(),
this->rrset_->getClass(),
"2001:db8::11"));
- this->updater_->deleteRRset(*this->rrset_);
+ this->updater_->deleteRRset(this->rrset_);
this->expected_rdatas_.clear();
this->expected_rdatas_.push_back("2001:db8::10");
doFindTest(this->updater_->getFinder(), newname, newtype, newtype,
@@ -3093,8 +3093,8 @@ TEST_F(MockDatabaseClientTest, badName) {
*/
TYPED_TEST(DatabaseClientTest, journal) {
this->updater_ = this->client_->getUpdater(this->zname_, false, true);
- this->updater_->deleteRRset(*this->soa_);
- this->updater_->deleteRRset(*this->rrset_);
+ this->updater_->deleteRRset(this->soa_);
+ this->updater_->deleteRRset(this->rrset_);
this->soa_.reset(new RRset(this->zname_, this->qclass_, RRType::SOA(),
this->rrttl_));
this->soa_->addRdata(rdata::createRdata(this->soa_->getType(),
@@ -3102,8 +3102,8 @@ TYPED_TEST(DatabaseClientTest, journal) {
"ns1.example.org. "
"admin.example.org. "
"1235 3600 1800 2419200 7200"));
- this->updater_->addRRset(*this->soa_);
- this->updater_->addRRset(*this->rrset_);
+ this->updater_->addRRset(this->soa_);
+ this->updater_->addRRset(this->rrset_);
ASSERT_NO_THROW(this->updater_->commit());
std::vector<JournalEntry> expected;
expected.push_back(JournalEntry(WRITABLE_ZONE_ID, 1234,
@@ -3138,7 +3138,7 @@ TYPED_TEST(DatabaseClientTest, journalMultiple) {
"1234 3600 1800 2419200 7200";
for (size_t i = 1; i < 100; ++ i) {
// Remove the old SOA
- this->updater_->deleteRRset(*this->soa_);
+ this->updater_->deleteRRset(this->soa_);
expected.push_back(JournalEntry(WRITABLE_ZONE_ID, 1234 + i - 1,
DatabaseAccessor::DIFF_DELETE,
"example.org.", "SOA", "3600",
@@ -3152,7 +3152,7 @@ TYPED_TEST(DatabaseClientTest, journalMultiple) {
this->soa_->getClass(),
soa_rdata));
// Add the new SOA
- this->updater_->addRRset(*this->soa_);
+ this->updater_->addRRset(this->soa_);
expected.push_back(JournalEntry(WRITABLE_ZONE_ID, 1234 + i,
DatabaseAccessor::DIFF_ADD,
"example.org.", "SOA", "3600",
@@ -3177,7 +3177,7 @@ TEST_F(MockDatabaseClientTest, journalBadSequence) {
{
SCOPED_TRACE("Delete A before SOA");
this->updater_ = this->client_->getUpdater(this->zname_, false, true);
- EXPECT_THROW(this->updater_->deleteRRset(*this->rrset_),
+ EXPECT_THROW(this->updater_->deleteRRset(this->rrset_),
isc::BadValue);
// Make sure the journal is empty now
this->checkJournal(expected);
@@ -3186,7 +3186,7 @@ TEST_F(MockDatabaseClientTest, journalBadSequence) {
{
SCOPED_TRACE("Add before delete");
this->updater_ = this->client_->getUpdater(this->zname_, false, true);
- EXPECT_THROW(this->updater_->addRRset(*this->soa_), isc::BadValue);
+ EXPECT_THROW(this->updater_->addRRset(this->soa_), isc::BadValue);
// Make sure the journal is empty now
this->checkJournal(expected);
}
@@ -3195,9 +3195,9 @@ TEST_F(MockDatabaseClientTest, journalBadSequence) {
SCOPED_TRACE("Add A before SOA");
this->updater_ = this->client_->getUpdater(this->zname_, false, true);
// So far OK
- EXPECT_NO_THROW(this->updater_->deleteRRset(*this->soa_));
+ EXPECT_NO_THROW(this->updater_->deleteRRset(this->soa_));
// But we miss the add SOA here
- EXPECT_THROW(this->updater_->addRRset(*this->rrset_), isc::BadValue);
+ EXPECT_THROW(this->updater_->addRRset(this->rrset_), isc::BadValue);
// Make sure the journal contains only the first one
expected.push_back(JournalEntry(WRITABLE_ZONE_ID, 1234,
DatabaseAccessor::DIFF_DELETE,
@@ -3211,7 +3211,7 @@ TEST_F(MockDatabaseClientTest, journalBadSequence) {
SCOPED_TRACE("Commit before add");
this->updater_ = this->client_->getUpdater(this->zname_, false, true);
// So far OK
- EXPECT_NO_THROW(this->updater_->deleteRRset(*this->soa_));
+ EXPECT_NO_THROW(this->updater_->deleteRRset(this->soa_));
// Commit at the wrong time
EXPECT_THROW(updater_->commit(), isc::BadValue);
current_accessor_->checkJournal(expected);
@@ -3221,9 +3221,9 @@ TEST_F(MockDatabaseClientTest, journalBadSequence) {
SCOPED_TRACE("Delete two SOAs");
this->updater_ = this->client_->getUpdater(this->zname_, false, true);
// So far OK
- EXPECT_NO_THROW(this->updater_->deleteRRset(*this->soa_));
+ EXPECT_NO_THROW(this->updater_->deleteRRset(this->soa_));
// Delete the SOA again
- EXPECT_THROW(this->updater_->deleteRRset(*this->soa_), isc::BadValue);
+ EXPECT_THROW(this->updater_->deleteRRset(this->soa_), isc::BadValue);
this->checkJournal(expected);
}
@@ -3231,11 +3231,11 @@ TEST_F(MockDatabaseClientTest, journalBadSequence) {
SCOPED_TRACE("Add two SOAs");
this->updater_ = this->client_->getUpdater(this->zname_, false, true);
// So far OK
- EXPECT_NO_THROW(this->updater_->deleteRRset(*this->soa_));
+ EXPECT_NO_THROW(this->updater_->deleteRRset(this->soa_));
// Still OK
- EXPECT_NO_THROW(this->updater_->addRRset(*this->soa_));
+ EXPECT_NO_THROW(this->updater_->addRRset(this->soa_));
// But this one is added again
- EXPECT_THROW(this->updater_->addRRset(*this->soa_), isc::BadValue);
+ EXPECT_THROW(this->updater_->addRRset(this->soa_), isc::BadValue);
expected.push_back(JournalEntry(WRITABLE_ZONE_ID, 1234,
DatabaseAccessor::DIFF_ADD,
"example.org.", "SOA", "3600",
@@ -3259,12 +3259,12 @@ TYPED_TEST(DatabaseClientTest, journalOnErase) {
*/
TEST_F(MockDatabaseClientTest, journalNotImplemented) {
updater_ = client_->getUpdater(Name("null.example.org"), false, true);
- EXPECT_THROW(updater_->deleteRRset(*soa_), isc::NotImplemented);
+ EXPECT_THROW(updater_->deleteRRset(soa_), isc::NotImplemented);
soa_.reset(new RRset(zname_, qclass_, RRType::SOA(), rrttl_));
soa_->addRdata(rdata::createRdata(soa_->getType(), soa_->getClass(),
"ns1.example.org. admin.example.org. "
"1234 3600 1800 2419201 7200"));
- EXPECT_THROW(updater_->addRRset(*soa_), isc::NotImplemented);
+ EXPECT_THROW(updater_->addRRset(soa_), isc::NotImplemented);
}
/*
@@ -3272,7 +3272,7 @@ TEST_F(MockDatabaseClientTest, journalNotImplemented) {
*/
TEST_F(MockDatabaseClientTest, journalException) {
updater_ = client_->getUpdater(Name("bad.example.org"), false, true);
- EXPECT_THROW(updater_->deleteRRset(*soa_), DataSourceError);
+ EXPECT_THROW(updater_->deleteRRset(soa_), DataSourceError);
}
//
@@ -3286,12 +3286,12 @@ makeSimpleDiff(DataSourceClient& client, const Name& zname,
const RRClass& rrclass, ConstRRsetPtr begin_soa)
{
ZoneUpdaterPtr updater = client.getUpdater(zname, false, true);
- updater->deleteRRset(*begin_soa);
+ updater->deleteRRset(begin_soa);
RRsetPtr soa_end(new RRset(zname, rrclass, RRType::SOA(), RRTTL(3600)));
soa_end->addRdata(rdata::createRdata(RRType::SOA(), rrclass,
"ns1.example.org. admin.example.org. "
"1235 3600 1800 2419200 7200"));
- updater->addRRset(*soa_end);
+ updater->addRRset(soa_end);
updater->commit();
return (soa_end);
@@ -3334,7 +3334,7 @@ TYPED_TEST(DatabaseClientTest, readLargeJournal) {
lexical_cast<std::string>(1234 + i) + " 3600 1800 2419200 7200";
rrset1->addRdata(rdata::createRdata(RRType::SOA(), this->qclass_,
soa_rdata));
- this->updater_->deleteRRset(*rrset1);
+ this->updater_->deleteRRset(rrset1);
expected.push_back(rrset1);
// Create a new SOA, add it, and record it.
@@ -3345,7 +3345,7 @@ TYPED_TEST(DatabaseClientTest, readLargeJournal) {
" 3600 1800 2419200 7200";
rrset2->addRdata(rdata::createRdata(RRType::SOA(), this->qclass_,
soa_rdata));
- this->updater_->addRRset(*rrset2);
+ this->updater_->addRRset(rrset2);
expected.push_back(rrset2);
}
this->updater_->commit();
diff --git a/src/lib/datasrc/zone.h b/src/lib/datasrc/zone.h
index 00b5274..9955ef6 100644
--- a/src/lib/datasrc/zone.h
+++ b/src/lib/datasrc/zone.h
@@ -657,7 +657,7 @@ public:
/// \exception std::bad_alloc Resource allocation failure
///
/// \param rrset The RRset to be added
- virtual void addRRset(const isc::dns::RRset& rrset) = 0;
+ virtual void addRRset(isc::dns::ConstRRsetPtr rrset) = 0;
/// Delete an RRset from a zone via the updater
///
@@ -729,7 +729,7 @@ public:
/// \exception std::bad_alloc Resource allocation failure
///
/// \param rrset The RRset to be deleted
- virtual void deleteRRset(const isc::dns::RRset& rrset) = 0;
+ virtual void deleteRRset(isc::dns::ConstRRsetPtr rrset) = 0;
/// Commit the updates made in the updater to the zone
///
diff --git a/src/lib/dns/python/message_python.cc b/src/lib/dns/python/message_python.cc
index 48fff94..2c48bb5 100644
--- a/src/lib/dns/python/message_python.cc
+++ b/src/lib/dns/python/message_python.cc
@@ -476,9 +476,14 @@ Message_getSection(PyObject* po_self, PyObject* args) {
PyObjectContainer list_container(PyList_New(0));
const Message::Section msgsection =
static_cast<Message::Section>(section);
- for_each(self->cppobj->beginSection(msgsection),
- self->cppobj->endSection(msgsection),
- RRsetInserter(list_container.get(), createRRsetObject));
+ for (RRsetIterator i = self->cppobj->beginSection(msgsection);
+ i != self->cppobj->endSection(msgsection); ++i) {
+ if (PyList_Append(list_container.get(),
+ PyObjectContainer(createRRsetObject(*i)).get()) == -1) {
+ isc_throw(PyCPPWrapperException, "PyList_Append failed, "
+ "probably due to short memory");
+ }
+ }
return (list_container.release());
} catch (const isc::OutOfRange& ex) {
PyErr_SetString(PyExc_OverflowError, ex.what());
diff --git a/src/lib/dns/python/rrset_python.cc b/src/lib/dns/python/rrset_python.cc
index 77d520b..4c06120 100644
--- a/src/lib/dns/python/rrset_python.cc
+++ b/src/lib/dns/python/rrset_python.cc
@@ -37,7 +37,7 @@ using namespace isc::util::python;
namespace {
-// The s_* Class simply coverst one instantiation of the object
+// The s_* Class simply covers one instantiation of the object
// Using a shared_ptr here should not really be necessary (PyObject
// is already reference-counted), however internally on the cpp side,
@@ -415,20 +415,20 @@ PyTypeObject rrset_type = {
};
PyObject*
-createRRsetObject(const RRset& source) {
+createRRsetObject(ConstRRsetPtr source) {
// RRsets are noncopyable, so as a workaround we recreate a new one
// and copy over all content
RRsetPtr new_rrset = isc::dns::RRsetPtr(
- new isc::dns::RRset(source.getName(), source.getClass(),
- source.getType(), source.getTTL()));
+ new isc::dns::RRset(source->getName(), source->getClass(),
+ source->getType(), source->getTTL()));
- isc::dns::RdataIteratorPtr rdata_it(source.getRdataIterator());
+ isc::dns::RdataIteratorPtr rdata_it(source->getRdataIterator());
for (rdata_it->first(); !rdata_it->isLast(); rdata_it->next()) {
new_rrset->addRdata(rdata_it->getCurrent());
}
- isc::dns::RRsetPtr sigs = source.getRRsig();
+ isc::dns::RRsetPtr sigs = source->getRRsig();
if (sigs) {
new_rrset->addRRsig(sigs);
}
@@ -450,12 +450,6 @@ PyRRset_Check(PyObject* obj) {
return (PyObject_TypeCheck(obj, &rrset_type));
}
-RRset&
-PyRRset_ToRRset(PyObject* rrset_obj) {
- s_RRset* rrset = static_cast<s_RRset*>(rrset_obj);
- return (*rrset->cppobj);
-}
-
RRsetPtr
PyRRset_ToRRsetPtr(PyObject* rrset_obj) {
if (rrset_obj == NULL) {
diff --git a/src/lib/dns/python/rrset_python.h b/src/lib/dns/python/rrset_python.h
index 4268678..010d16a 100644
--- a/src/lib/dns/python/rrset_python.h
+++ b/src/lib/dns/python/rrset_python.h
@@ -36,7 +36,7 @@ extern PyTypeObject rrset_type;
/// returns a NULL pointer).
/// This function is expected to be called within a try block
/// followed by necessary setup for python exception.
-PyObject* createRRsetObject(const RRset& source);
+PyObject* createRRsetObject(ConstRRsetPtr source);
/// \brief Checks if the given python object is a RRset object
///
@@ -46,18 +46,6 @@ PyObject* createRRsetObject(const RRset& source);
/// \return true if the object is of type RRset, false otherwise
bool PyRRset_Check(PyObject* obj);
-/// \brief Returns a reference to the RRset object contained within the given
-/// Python object.
-///
-/// \note The given object MUST be of type RRset; this can be checked with
-/// either the right call to ParseTuple("O!"), or with PyRRset_Check()
-///
-/// \note This is not a copy; if the RRset is needed when the PyObject
-/// may be destroyed, the caller must copy it itself.
-///
-/// \param rrset_obj The rrset object to convert
-RRset& PyRRset_ToRRset(PyObject* rrset_obj);
-
/// \brief Returns the shared_ptr of the RRset object contained within the
/// given Python object.
///
diff --git a/src/lib/dns/rrset.h b/src/lib/dns/rrset.h
index 1586465..6846f6c 100644
--- a/src/lib/dns/rrset.h
+++ b/src/lib/dns/rrset.h
@@ -58,14 +58,14 @@ class RRset;
///
/// This type is commonly used as an argument of various functions defined
/// in this library in order to handle RRsets in a polymorphic manner.
-typedef boost::shared_ptr<RRset> RRsetPtr;
+typedef boost::shared_ptr<AbstractRRset> RRsetPtr;
/// \brief A pointer-like type pointing to an (immutable) \c RRset
/// object.
///
/// This type is commonly used as an argument of various functions defined
/// in this library in order to handle RRsets in a polymorphic manner.
-typedef boost::shared_ptr<const RRset> ConstRRsetPtr;
+typedef boost::shared_ptr<const AbstractRRset> ConstRRsetPtr;
/// \brief A pointer-like type point to an \c RdataIterator object.
typedef boost::shared_ptr<RdataIterator> RdataIteratorPtr;
@@ -400,6 +400,58 @@ public:
/// object.
virtual RdataIteratorPtr getRdataIterator() const = 0;
//@}
+
+ ///
+ /// \name Associated RRSIG methods
+ ///
+ /// These methods access an "associated" RRset, that containing the DNSSEC
+ /// signatures for this RRset. It can be argued that this is not a
+ /// fundamental part of the RRset abstraction, since RFC 2181 defined an
+ /// RRset as a group of records with the same label, class and type but
+ /// different data. However, BIND 10 has to deal with DNSSEC and in
+ /// practice, including the information at the AbstractRRset level makes
+ /// implementation easier. (If a class is ever needed that must be
+ /// ignorant of the idea of an associated RRSIG RRset - e.g. a specialised
+ /// RRSIG RRset class - these methods can just throw a "NotImplemented"
+ /// exception.)
+ //@{
+ /// \brief Return pointer to this RRset's RRSIG RRset
+ ///
+ /// \return Pointer to the associated RRSIG RRset or null if there is none.
+ virtual RRsetPtr getRRsig() const = 0;
+
+ /// \brief Adds RRSIG RRset RRs to the associated RRSIG RRset
+ ///
+ /// Adds the (assumed) RRSIG rdata the RRSIG RRset associated with this
+ /// RRset. If one does not exist, it is created using the data given.
+ ///
+ /// \param rdata Pointer to RRSIG rdata to be added.
+ virtual void addRRsig(const rdata::RdataPtr rdata) = 0;
+
+ /// \brief Adds RRSIG RRset RRs to the associated RRSIG RRset
+ ///
+ /// Adds the signatures in the given (assumed) RRSIG RRset to the RRSIG
+ /// RRset associated with this RRset. If one does not exist, it is created
+ /// using the data given.
+ ///
+ /// \param sigs RRSIG RRset containing signatures to be added to the
+ /// RRSIG RRset associated with this class.
+ virtual void addRRsig(AbstractRRset& sigs) = 0;
+
+ /// \brief Adds RRSIG RRset RRs to the associated RRSIG RRset
+ ///
+ /// Adds the signatures in the given (assumed) RRSIG RRset to the RRSIG
+ /// RRset associated with this RRset. If one does not exist, it is created
+ /// using the data given.
+ ///
+ /// \param sigs Pointer to a RRSIG RRset containing signatures to be added
+ /// to the RRSIG RRset associated with this class.
+ virtual void addRRsig(RRsetPtr sigs) = 0;
+
+ /// \brief Clear the RRSIGs for this RRset
+ virtual void removeRRsig() = 0;
+
+ //@}
};
/// \brief The \c RdataIterator class is an abstract base class that
@@ -660,6 +712,72 @@ public:
/// object for the \c BasicRRset class.
virtual RdataIteratorPtr getRdataIterator() const;
//@}
+
+ ///
+ /// \name Associated RRSIG methods
+ ///
+ /// The associated RRSIG RRset is not supported in BasicRRset, so these
+ /// methods throw a NotImplemented exception.
+ //@{
+ /// \brief Return pointer to this RRset's RRSIG RRset
+ ///
+ /// \exception NotImplemented Always thrown. Associated RRSIG RRsets are
+ /// not supported in this class.
+ ///
+ /// \return Never returns normally - always throws a NotImplemented
+ /// exception.
+ virtual RRsetPtr getRRsig() const {
+ isc_throw(NotImplemented,
+ "BasicRRset does not implement the getRRsig() method");
+ }
+
+ /// \brief Adds RRSIG RRset RRs to the associated RRSIG RRset
+ ///
+ /// Not implemented in this class.
+ ///
+ /// \param rdata RRSIG rdata to be added to this RRset
+ ///
+ /// \exception NotImplemented Always thrown. Associated RRSIG RRsets are
+ /// not supported in this class.
+ virtual void addRRsig(const rdata::RdataPtr) {
+ isc_throw(NotImplemented,
+ "BasicRRset does not implement the addRRsig() method");
+ }
+
+ /// \brief Adds RRSIG RRset RRs to the associated RRSIG RRset
+ ///
+ /// Not implemented in this class.
+ ///
+ /// \param sigs RRSIG RRset containing signatures to be added to the
+ /// RRSIG RRset associated with this class.
+ ///
+ /// \exception NotImplemented Always thrown. Associated RRSIG RRsets are
+ /// not supported in this class.
+ virtual void addRRsig(AbstractRRset&) {
+ isc_throw(NotImplemented,
+ "BasicRRset does not implement the addRRsig() method");
+ }
+
+ /// \brief Adds RRSIG RRset RRs to the associated RRSIG RRset
+ ///
+ /// Not implemented in this class.
+ ///
+ /// \param sigs Pointer to a RRSIG RRset containing signatures to be added
+ /// to the RRSIG RRset associated with this class.
+ ///
+ /// \exception NotImplemented Always thrown. Associated RRSIG RRsets are
+ /// not supported in this class.
+ virtual void addRRsig(RRsetPtr) {
+ isc_throw(NotImplemented,
+ "BasicRRset does not implement the addRRsig() method");
+ }
+
+ /// \brief Clear the RRSIGs for this RRset
+ virtual void removeRRsig() {
+ isc_throw(NotImplemented,
+ "BasicRRset does not implement the removeRRsig() method");
+ }
+ //@}
private:
BasicRRsetImpl* impl_;
};
diff --git a/src/lib/nsas/tests/nameserver_address_store_unittest.cc b/src/lib/nsas/tests/nameserver_address_store_unittest.cc
index 4785627..e019145 100644
--- a/src/lib/nsas/tests/nameserver_address_store_unittest.cc
+++ b/src/lib/nsas/tests/nameserver_address_store_unittest.cc
@@ -475,7 +475,7 @@ TEST_F(NameserverAddressStoreTest, updateRTT) {
// for ns.example.com (the nameserver set for example.net in the class
// initialization). We'll set two addresses.
Name ns_example_com(ns_name);
- RRsetPtr ns_address = boost::shared_ptr<RRset>(new RRset(
+ isc::dns::RRsetPtr ns_address = RRsetPtr(new RRset(
ns_example_com, RRClass::IN(), RRType::A(), RRTTL(300)));
BOOST_FOREACH(string addr, address) {
ns_address->addRdata(rdata::in::A(addr));
diff --git a/src/lib/python/isc/datasrc/finder_python.cc b/src/lib/python/isc/datasrc/finder_python.cc
index 5df944f..6fed13b 100644
--- a/src/lib/python/isc/datasrc/finder_python.cc
+++ b/src/lib/python/isc/datasrc/finder_python.cc
@@ -73,7 +73,7 @@ PyObject* ZoneFinder_helper(ZoneFinder* finder, PyObject* args) {
isc::dns::ConstRRsetPtr rrsp = find_result.rrset;
if (rrsp) {
// Use N instead of O so the refcount isn't increased twice
- return (Py_BuildValue("IN", r, createRRsetObject(*rrsp)));
+ return (Py_BuildValue("IN", r, createRRsetObject(rrsp)));
} else {
return (Py_BuildValue("IO", r, Py_None));
}
@@ -116,7 +116,7 @@ PyObject* ZoneFinder_helper_all(ZoneFinder* finder, PyObject* args) {
PyObjectContainer list_container(PyList_New(target.size()));
for (size_t i(0); i < target.size(); ++i) {
PyList_SET_ITEM(list_container.get(), i,
- createRRsetObject(*target[i]));
+ createRRsetObject(target[i]));
}
// Construct the result with the list. The Py_BuildValue
// increases the refcount and the container decreases it
@@ -126,7 +126,7 @@ PyObject* ZoneFinder_helper_all(ZoneFinder* finder, PyObject* args) {
} else {
if (rrsp) {
// Use N instead of O so the refcount isn't increased twice
- return (Py_BuildValue("IN", r, createRRsetObject(*rrsp)));
+ return (Py_BuildValue("IN", r, createRRsetObject(rrsp)));
} else {
return (Py_BuildValue("IO", r, Py_None));
}
diff --git a/src/lib/python/isc/datasrc/iterator_python.cc b/src/lib/python/isc/datasrc/iterator_python.cc
index 9e6900c..8d9190b 100644
--- a/src/lib/python/isc/datasrc/iterator_python.cc
+++ b/src/lib/python/isc/datasrc/iterator_python.cc
@@ -97,7 +97,7 @@ ZoneIterator_getNextRRset(PyObject* po_self, PyObject*) {
if (!rrset) {
Py_RETURN_NONE;
}
- return (createRRsetObject(*rrset));
+ return (createRRsetObject(rrset));
} catch (const isc::Exception& isce) {
// isc::Unexpected is thrown when we call getNextRRset() when we are
// already done iterating ('iterating past end')
@@ -140,7 +140,7 @@ ZoneIterator_getSOA(PyObject* po_self, PyObject*) {
if (!rrset) {
Py_RETURN_NONE;
}
- return (createRRsetObject(*rrset));
+ return (createRRsetObject(rrset));
} catch (const isc::Exception& isce) {
// isc::Unexpected is thrown when we call getNextRRset() when we are
// already done iterating ('iterating past end')
diff --git a/src/lib/python/isc/datasrc/journal_reader_python.cc b/src/lib/python/isc/datasrc/journal_reader_python.cc
index ff398d1..cb4e09a 100644
--- a/src/lib/python/isc/datasrc/journal_reader_python.cc
+++ b/src/lib/python/isc/datasrc/journal_reader_python.cc
@@ -82,7 +82,7 @@ ZoneJournalReader_getNextDiff(PyObject* po_self, PyObject*) {
if (!rrset) {
Py_RETURN_NONE;
}
- return (createRRsetObject(*rrset));
+ return (createRRsetObject(rrset));
} catch (const isc::InvalidOperation& ex) {
PyErr_SetString(PyExc_ValueError, ex.what());
return (NULL);
diff --git a/src/lib/python/isc/datasrc/updater_python.cc b/src/lib/python/isc/datasrc/updater_python.cc
index c528a0c..3a9e9f2 100644
--- a/src/lib/python/isc/datasrc/updater_python.cc
+++ b/src/lib/python/isc/datasrc/updater_python.cc
@@ -102,7 +102,7 @@ ZoneUpdater_addRRset(PyObject* po_self, PyObject* args) {
PyObject* rrset_obj;
if (PyArg_ParseTuple(args, "O!", &rrset_type, &rrset_obj)) {
try {
- self->cppobj->addRRset(PyRRset_ToRRset(rrset_obj));
+ self->cppobj->addRRset(PyRRset_ToRRsetPtr(rrset_obj));
Py_RETURN_NONE;
} catch (const DataSourceError& dse) {
PyErr_SetString(getDataSourceException("Error"), dse.what());
@@ -122,7 +122,7 @@ ZoneUpdater_deleteRRset(PyObject* po_self, PyObject* args) {
PyObject* rrset_obj;
if (PyArg_ParseTuple(args, "O!", &rrset_type, &rrset_obj)) {
try {
- self->cppobj->deleteRRset(PyRRset_ToRRset(rrset_obj));
+ self->cppobj->deleteRRset(PyRRset_ToRRsetPtr(rrset_obj));
Py_RETURN_NONE;
} catch (const DataSourceError& dse) {
PyErr_SetString(getDataSourceException("Error"), dse.what());
More information about the bind10-changes
mailing list