Commit abe0b529 authored by Jelte Jansen's avatar Jelte Jansen
Browse files

applying two fixed for solaris; remove 'using namespace boost' where we use...

applying two fixed for solaris; remove 'using namespace boost' where we use uint32_t, and adds jeremy's check for the multithreading flag
(also added the latter to jinmei's ac_try_link call)
should not compile yet, we are still looking for a good solution for the -Wno-missing-initializers problem


git-svn-id: svn://bind10.isc.org/svn/bind10/trunk@3872 e5f2f494-b856-4b98-b285-d166d9295462
parent 78219015
......@@ -201,11 +201,20 @@ werror_ok=0
# (http://blogs.sun.com/sga/entry/boost_mini_howto)
if test "$SUNCXX" = "yes"; then
CXXFLAGS="$CXXFLAGS -library=stlport4 -features=tmplife -features=tmplrefstatic"
MULTITHREADING_FLAG="-mt"
fi
# gcc specific settings:
if test "X$GXX" = "Xyes"; then
B10_CXXFLAGS="-Wall -Wextra -Wwrite-strings -Woverloaded-virtual -Wno-sign-compare"
case "$host" in
*-solaris*)
MULTITHREADING_FLAG=-pthreads
;;
*)
MULTITHREADING_FLAG=-pthread
;;
esac
# Certain versions of gcc (g++) have a bug that incorrectly warns about
# the use of anonymous name spaces even if they're closed in a single
......@@ -333,7 +342,7 @@ AC_SUBST(BOOST_INCLUDES)
AC_MSG_CHECKING(for boost::mutex)
CPPFLAGS_SAVES="$CPPFLAGS"
LIBS_SAVES="$LIBS"
CPPFLAGS="$BOOST_INCLUDES $CPPFLAGS"
CPPFLAGS="$BOOST_INCLUDES $CPPFLAGS $MULTITHREADING_FLAG"
need_libboost_thread=0
AC_TRY_LINK([
#include <boost/thread.hpp>
......@@ -423,6 +432,8 @@ PTHREAD_LDFLAGS=
AC_CHECK_LIB(pthread, pthread_create,[ PTHREAD_LDFLAGS=-lpthread ], [])
AC_SUBST(PTHREAD_LDFLAGS)
AC_SUBST(MULTITHREADING_FLAG)
#
# ASIO: we extensively use it as the C++ event management module.
#
......
SUBDIRS = . tests
AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
AM_CPPFLAGS += $(BOOST_INCLUDES)
AM_CPPFLAGS += $(BOOST_INCLUDES) $(MULTITHREADING_FLAG)
AM_CPPFLAGS += -I$(top_srcdir)/src/lib/dns -I$(top_builddir)/src/lib/dns
AM_CPPFLAGS += -I$(top_srcdir)/src/lib/nsas -I$(top_builddir)/src/lib/nsas
AM_CPPFLAGS += $(SQLITE_CFLAGS)
......
......@@ -33,7 +33,6 @@
using namespace isc::dns;
using namespace std;
using namespace boost;
namespace isc {
namespace nsas {
......@@ -44,7 +43,7 @@ namespace nsas {
// hash table, on the assumption that three elements is the longest linear
// search we want to do when looking up names in the hash table.
NameserverAddressStore::NameserverAddressStore(
shared_ptr<ResolverInterface> resolver, uint32_t zonehashsize,
boost::shared_ptr<ResolverInterface> resolver, uint32_t zonehashsize,
uint32_t nshashsize) :
zone_hash_(new HashTable<ZoneEntry>(new NsasEntryCompare<ZoneEntry>,
zonehashsize)),
......@@ -65,13 +64,13 @@ namespace {
* no need to copy anything. In that case, the bind should not be
* called at all to create the object, just call the function.
*/
shared_ptr<ZoneEntry>
newZone(const shared_ptr<ResolverInterface>* resolver, const string* zone,
boost::shared_ptr<ZoneEntry>
newZone(const boost::shared_ptr<ResolverInterface>* resolver, const string* zone,
const RRClass* class_code,
const shared_ptr<HashTable<NameserverEntry> >* ns_hash,
const shared_ptr<LruList<NameserverEntry> >* ns_lru)
const boost::shared_ptr<HashTable<NameserverEntry> >* ns_hash,
const boost::shared_ptr<LruList<NameserverEntry> >* ns_lru)
{
shared_ptr<ZoneEntry> result(new ZoneEntry(*resolver, *zone, *class_code,
boost::shared_ptr<ZoneEntry> result(new ZoneEntry(*resolver, *zone, *class_code,
*ns_hash, *ns_lru));
return (result);
}
......@@ -80,9 +79,9 @@ newZone(const shared_ptr<ResolverInterface>* resolver, const string* zone,
void
NameserverAddressStore::lookup(const string& zone, const RRClass& class_code,
shared_ptr<AddressRequestCallback> callback, AddressFamily family)
boost::shared_ptr<AddressRequestCallback> callback, AddressFamily family)
{
pair<bool, shared_ptr<ZoneEntry> > zone_obj(zone_hash_->getOrAdd(HashKey(
pair<bool, boost::shared_ptr<ZoneEntry> > zone_obj(zone_hash_->getOrAdd(HashKey(
zone, class_code), boost::bind(newZone, &resolver_, &zone, &class_code,
&nameserver_hash_, &nameserver_lru_)));
if (zone_obj.first) {
......
......@@ -41,7 +41,6 @@ using namespace asiolink;
using namespace isc::nsas;
using namespace isc::dns;
using namespace std;
using namespace boost;
namespace isc {
namespace nsas {
......@@ -49,7 +48,7 @@ namespace nsas {
namespace {
// Just shorter type alias
typedef recursive_mutex::scoped_lock Lock;
typedef boost::recursive_mutex::scoped_lock Lock;
}
......@@ -100,7 +99,7 @@ NameserverEntry::getAddresses(AddressVector& addresses,
return (getState());
}
shared_ptr<NameserverEntry> self(shared_from_this());
boost::shared_ptr<NameserverEntry> self(shared_from_this());
// If any address is OK, just pass everything we have
if (family == ANY_OK) {
BOOST_FOREACH(const AddressEntry& entry, addresses_[V6_ONLY]) {
......@@ -202,7 +201,7 @@ NameserverEntry::setAddressUnreachable(const IOAddress& address) {
*/
class NameserverEntry::ResolverCallback : public ResolverInterface::Callback {
public:
ResolverCallback(shared_ptr<NameserverEntry> entry,
ResolverCallback(boost::shared_ptr<NameserverEntry> entry,
AddressFamily family, const RRType& type) :
entry_(entry),
family_(family),
......@@ -214,7 +213,7 @@ class NameserverEntry::ResolverCallback : public ResolverInterface::Callback {
* This extracts the addresses out from the response and puts them
* inside the entry. It tries to reuse the address entries from before (if there were any), to keep their RTTs.
*/
virtual void success(const shared_ptr<AbstractRRset>& response) {
virtual void success(const boost::shared_ptr<AbstractRRset>& response) {
time_t now = time(NULL);
Lock lock(entry_->mutex_);
......@@ -295,7 +294,7 @@ class NameserverEntry::ResolverCallback : public ResolverInterface::Callback {
failureInternal(lock);
}
private:
shared_ptr<NameserverEntry> entry_;
boost::shared_ptr<NameserverEntry> entry_;
AddressFamily family_;
RRType type_;
......@@ -309,7 +308,7 @@ class NameserverEntry::ResolverCallback : public ResolverInterface::Callback {
!entry_->expect_address_[ANY_OK];
// Sort out the callbacks we want
vector<CallbackPair> keep;
vector<shared_ptr<NameserverEntry::Callback> > dispatch;
vector<boost::shared_ptr<NameserverEntry::Callback> > dispatch;
BOOST_FOREACH(const CallbackPair &callback, entry_->callbacks_)
{
if (callback.first == family_ || (dispatch_any &&
......@@ -331,7 +330,7 @@ class NameserverEntry::ResolverCallback : public ResolverInterface::Callback {
* FIXME: This is not completely exception safe. If there's an
* exception in a callback, we lose the rest of them.
*/
BOOST_FOREACH(const shared_ptr<NameserverEntry::Callback>&
BOOST_FOREACH(const boost::shared_ptr<NameserverEntry::Callback>&
callback, dispatch)
{
(*callback)(entry_);
......@@ -364,19 +363,19 @@ class NameserverEntry::ResolverCallback : public ResolverInterface::Callback {
};
void
NameserverEntry::askIP(shared_ptr<ResolverInterface> resolver,
NameserverEntry::askIP(boost::shared_ptr<ResolverInterface> resolver,
const RRType& type, AddressFamily family)
{
QuestionPtr question(new Question(Name(getName()), RRClass(getClass()),
type));
shared_ptr<ResolverCallback> callback(new ResolverCallback(
boost::shared_ptr<ResolverCallback> callback(new ResolverCallback(
shared_from_this(), family, type));
resolver->resolve(question, callback);
}
void
NameserverEntry::askIP(shared_ptr<ResolverInterface> resolver,
shared_ptr<Callback> callback, AddressFamily family)
NameserverEntry::askIP(boost::shared_ptr<ResolverInterface> resolver,
boost::shared_ptr<Callback> callback, AddressFamily family)
{
Lock lock(mutex_);
......
SUBDIRS = .
AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
AM_CPPFLAGS += $(BOOST_INCLUDES)
AM_CPPFLAGS += $(BOOST_INCLUDES) $(MULTITHREADING_FLAG)
AM_CPPFLAGS += -I$(top_srcdir)/src/lib/dns -I$(top_builddir)/src/lib/dns
AM_CPPFLAGS += -I$(top_srcdir)/src/lib/nsas -I$(top_builddir)/src/lib/nsas
AM_CXXFLAGS = $(B10_CXXFLAGS)
AM_LDFLAGS =
AM_LDFLAGS = $(PTHREAD_LDFLAGS)
if USE_STATIC_LINK
AM_LDFLAGS += -static
endif
......
......@@ -41,7 +41,6 @@
using namespace isc::dns;
using namespace std;
using namespace boost;
namespace isc {
namespace nsas {
......@@ -57,7 +56,7 @@ public:
///
/// \param hashsize Size of the zone hash table
/// \param lrusize Size of the zone hash table
DerivedNsas(shared_ptr<TestResolver> resolver, uint32_t hashsize,
DerivedNsas(boost::shared_ptr<TestResolver> resolver, uint32_t hashsize,
uint32_t lrusize) :
NameserverAddressStore(resolver, hashsize, lrusize),
resolver_(resolver)
......@@ -87,8 +86,8 @@ public:
* if it is asked for by the resolver.
*/
void lookupAndAnswer(const string& name, const RRClass& class_code,
shared_ptr<AbstractRRset> authority,
shared_ptr<AddressRequestCallback> callback)
boost::shared_ptr<AbstractRRset> authority,
boost::shared_ptr<AddressRequestCallback> callback)
{
size_t size(resolver_->requests.size());
NameserverAddressStore::lookup(name, class_code, callback, ANY_OK);
......@@ -102,7 +101,7 @@ public:
}
}
private:
shared_ptr<TestResolver> resolver_;
boost::shared_ptr<TestResolver> resolver_;
};
......@@ -133,8 +132,8 @@ protected:
std::string name = "zone" + boost::lexical_cast<std::string>(i);
zones_.push_back(boost::shared_ptr<ZoneEntry>(new ZoneEntry(
resolver_, name, RRClass(40 + i),
shared_ptr<HashTable<NameserverEntry> >(),
shared_ptr<LruList<NameserverEntry> >())));
boost::shared_ptr<HashTable<NameserverEntry> >(),
boost::shared_ptr<LruList<NameserverEntry> >())));
}
// A nameserver serving data
......@@ -151,7 +150,7 @@ protected:
RRsetPtr authority_, empty_authority_;
shared_ptr<TestResolver> resolver_;
boost::shared_ptr<TestResolver> resolver_;
class NSASCallback : public AddressRequestCallback {
public:
......
......@@ -31,7 +31,6 @@ namespace nsas {
using namespace dns;
using namespace rdata;
using namespace boost;
#define TEST_ADDRESS_INDEX 1
......@@ -48,8 +47,8 @@ public:
rrv4_->addRdata(ConstRdataPtr(new RdataTest<A>("9.10.11.12")));
ns_.reset(new NameserverEntry(name_.toText(), RRClass::IN()));
shared_ptr<TestResolver> resolver(new TestResolver);
ns_->askIP(resolver, shared_ptr<Callback>(new Callback), ANY_OK);
boost::shared_ptr<TestResolver> resolver(new TestResolver);
ns_->askIP(resolver, boost::shared_ptr<Callback>(new Callback), ANY_OK);
resolver->asksIPs(name_, 0, 1);
resolver->requests[0].second->success(rrv4_);
}
......@@ -74,12 +73,12 @@ public:
private:
Name name_; ///< Name of the sample
shared_ptr<BasicRRset> rrv4_; ///< Standard RRSet - IN, A, lowercase name
boost::shared_ptr<BasicRRset> rrv4_; ///< Standard RRSet - IN, A, lowercase name
boost::shared_ptr<NameserverEntry> ns_; ///< Shared_ptr that points to a NameserverEntry object
class Callback : public NameserverEntry::Callback {
public:
virtual void operator()(shared_ptr<NameserverEntry>) { }
virtual void operator()(boost::shared_ptr<NameserverEntry>) { }
};
};
......
......@@ -43,7 +43,6 @@ using namespace asiolink;
using namespace std;
using namespace isc::dns;
using namespace rdata;
using namespace boost;
namespace {
......@@ -53,7 +52,7 @@ protected:
/// \short Just a really stupid callback counting times called
struct Callback : public NameserverEntry::Callback {
size_t count;
virtual void operator()(shared_ptr<NameserverEntry>) {
virtual void operator()(boost::shared_ptr<NameserverEntry>) {
count ++;
}
Callback() : count(0) { }
......@@ -69,8 +68,8 @@ private:
* \param set The answer. If the pointer is empty, it is taken
* as a failure.
*/
void fillSet(shared_ptr<TestResolver> resolver, size_t index,
shared_ptr<BasicRRset> set)
void fillSet(boost::shared_ptr<TestResolver> resolver, size_t index,
boost::shared_ptr<BasicRRset> set)
{
if (set) {
resolver->requests[index].second->success(set);
......@@ -80,12 +79,12 @@ private:
}
protected:
/// Fills the nameserver entry with data trough ask IP
void fillNSEntry(shared_ptr<NameserverEntry> entry,
shared_ptr<BasicRRset> rrv4, shared_ptr<BasicRRset> rrv6)
void fillNSEntry(boost::shared_ptr<NameserverEntry> entry,
boost::shared_ptr<BasicRRset> rrv4, boost::shared_ptr<BasicRRset> rrv6)
{
// Prepare data to run askIP
shared_ptr<TestResolver> resolver(new TestResolver);
shared_ptr<Callback> callback(new Callback);
boost::shared_ptr<TestResolver> resolver(new TestResolver);
boost::shared_ptr<Callback> callback(new Callback);
// Let it ask for data
entry->askIP(resolver, callback, ANY_OK);
// Check it really asked and sort the queries
......@@ -114,7 +113,7 @@ TEST_F(NameserverEntryTest, DefaultConstructor) {
TEST_F(NameserverEntryTest, InitialRTT) {
// Get the RTT for the different addresses
shared_ptr<NameserverEntry> alpha(new NameserverEntry(EXAMPLE_CO_UK,
boost::shared_ptr<NameserverEntry> alpha(new NameserverEntry(EXAMPLE_CO_UK,
RRClass::IN()));
fillNSEntry(alpha, rrv4_, rrv6_);
NameserverEntry::AddressVector vec;
......@@ -133,7 +132,7 @@ TEST_F(NameserverEntryTest, InitialRTT) {
TEST_F(NameserverEntryTest, SetRTT) {
// Get the RTT for the different addresses
shared_ptr<NameserverEntry> alpha(new NameserverEntry(EXAMPLE_CO_UK,
boost::shared_ptr<NameserverEntry> alpha(new NameserverEntry(EXAMPLE_CO_UK,
RRClass::IN()));
fillNSEntry(alpha, rrv4_, rrv6_);
NameserverEntry::AddressVector vec;
......@@ -168,7 +167,7 @@ TEST_F(NameserverEntryTest, SetRTT) {
TEST_F(NameserverEntryTest, Unreachable) {
// Get the RTT for the different addresses
shared_ptr<NameserverEntry> alpha(new NameserverEntry(EXAMPLE_CO_UK,
boost::shared_ptr<NameserverEntry> alpha(new NameserverEntry(EXAMPLE_CO_UK,
RRClass::IN()));
fillNSEntry(alpha, rrv4_, rrv6_);
NameserverEntry::AddressVector vec;
......@@ -211,21 +210,21 @@ TEST_F(NameserverEntryTest, ExpirationTime) {
time_t expiration = 0;
// Test where there is a single TTL
shared_ptr<NameserverEntry> alpha(new NameserverEntry(EXAMPLE_CO_UK,
boost::shared_ptr<NameserverEntry> alpha(new NameserverEntry(EXAMPLE_CO_UK,
RRClass::IN()));
fillNSEntry(alpha, rrv4_, shared_ptr<BasicRRset>());
fillNSEntry(alpha, rrv4_, boost::shared_ptr<BasicRRset>());
expiration = alpha->getExpiration();
EXPECT_EQ(expiration, curtime + rrv4_->getTTL().getValue());
shared_ptr<NameserverEntry> beta(new NameserverEntry(EXAMPLE_CO_UK,
boost::shared_ptr<NameserverEntry> beta(new NameserverEntry(EXAMPLE_CO_UK,
RRClass::IN()));
fillNSEntry(beta, shared_ptr<BasicRRset>(), rrv6_);
fillNSEntry(beta, boost::shared_ptr<BasicRRset>(), rrv6_);
expiration = beta->getExpiration();
EXPECT_EQ(expiration, curtime + rrv6_->getTTL().getValue());
// Test where there are two different TTLs
EXPECT_NE(rrv4_->getTTL().getValue(), rrv6_->getTTL().getValue());
shared_ptr<NameserverEntry> gamma(new NameserverEntry(EXAMPLE_CO_UK,
boost::shared_ptr<NameserverEntry> gamma(new NameserverEntry(EXAMPLE_CO_UK,
RRClass::IN()));
fillNSEntry(gamma, rrv4_, rrv6_);
uint32_t minttl = min(rrv4_->getTTL().getValue(), rrv6_->getTTL().getValue());
......@@ -236,9 +235,9 @@ TEST_F(NameserverEntryTest, ExpirationTime) {
// that the expiration time should be greater than the TTL (as the current
// time is greater than zero).
shared_ptr<NameserverEntry> delta(new NameserverEntry(EXAMPLE_CO_UK,
boost::shared_ptr<NameserverEntry> delta(new NameserverEntry(EXAMPLE_CO_UK,
RRClass::IN()));
fillNSEntry(delta, rrv4_, shared_ptr<BasicRRset>());
fillNSEntry(delta, rrv4_, boost::shared_ptr<BasicRRset>());
EXPECT_GT(delta->getExpiration(), rrv4_->getTTL().getValue());
}
......@@ -262,10 +261,10 @@ TEST_F(NameserverEntryTest, CheckClass) {
// Tests if it asks the IP addresses and calls callbacks when it comes
// including the right addresses are returned and that they expire
TEST_F(NameserverEntryTest, IPCallbacks) {
shared_ptr<NameserverEntry> entry(new NameserverEntry(EXAMPLE_CO_UK,
boost::shared_ptr<NameserverEntry> entry(new NameserverEntry(EXAMPLE_CO_UK,
RRClass::IN()));
shared_ptr<Callback> callback(new Callback);
shared_ptr<TestResolver> resolver(new TestResolver);
boost::shared_ptr<Callback> callback(new Callback);
boost::shared_ptr<TestResolver> resolver(new TestResolver);
entry->askIP(resolver, callback, ANY_OK);
// Ensure it becomes IN_PROGRESS
......@@ -311,10 +310,10 @@ TEST_F(NameserverEntryTest, IPCallbacks) {
// Test the callback is called even when the address is unreachable
TEST_F(NameserverEntryTest, IPCallbacksUnreachable) {
shared_ptr<NameserverEntry> entry(new NameserverEntry(EXAMPLE_CO_UK,
boost::shared_ptr<NameserverEntry> entry(new NameserverEntry(EXAMPLE_CO_UK,
RRClass::IN()));
shared_ptr<Callback> callback(new Callback);
shared_ptr<TestResolver> resolver(new TestResolver);
boost::shared_ptr<Callback> callback(new Callback);
boost::shared_ptr<TestResolver> resolver(new TestResolver);
// Ask for its IP
entry->askIP(resolver, callback, ANY_OK);
......@@ -339,18 +338,18 @@ TEST_F(NameserverEntryTest, IPCallbacksUnreachable) {
* from resolve.
*/
TEST_F(NameserverEntryTest, DirectAnswer) {
shared_ptr<NameserverEntry> entry(new NameserverEntry(EXAMPLE_CO_UK,
boost::shared_ptr<NameserverEntry> entry(new NameserverEntry(EXAMPLE_CO_UK,
RRClass::IN()));
shared_ptr<Callback> callback(new Callback);
shared_ptr<TestResolver> resolver(new TestResolver);
boost::shared_ptr<Callback> callback(new Callback);
boost::shared_ptr<TestResolver> resolver(new TestResolver);
resolver->addPresetAnswer(Question(Name(EXAMPLE_CO_UK), RRClass::IN(),
RRType::A()), rrv4_);
resolver->addPresetAnswer(Question(Name(EXAMPLE_CO_UK), RRClass::IN(),
RRType::AAAA()), rrv6_);
resolver->addPresetAnswer(Question(Name(EXAMPLE_NET), RRClass::IN(),
RRType::A()), shared_ptr<AbstractRRset>());
RRType::A()), boost::shared_ptr<AbstractRRset>());
resolver->addPresetAnswer(Question(Name(EXAMPLE_NET), RRClass::IN(),
RRType::AAAA()), shared_ptr<AbstractRRset>());
RRType::AAAA()), boost::shared_ptr<AbstractRRset>());
// A successfull test first
entry->askIP(resolver, callback, ANY_OK);
......@@ -376,10 +375,10 @@ TEST_F(NameserverEntryTest, DirectAnswer) {
* data is received the next time.
*/
TEST_F(NameserverEntryTest, ChangedExpired) {
shared_ptr<NameserverEntry> entry(new NameserverEntry(EXAMPLE_CO_UK,
boost::shared_ptr<NameserverEntry> entry(new NameserverEntry(EXAMPLE_CO_UK,
RRClass::IN()));
shared_ptr<Callback> callback(new Callback);
shared_ptr<TestResolver> resolver(new TestResolver);
boost::shared_ptr<Callback> callback(new Callback);
boost::shared_ptr<TestResolver> resolver(new TestResolver);
// Ask the first time
entry->askIP(resolver, callback, V4_ONLY);
......@@ -426,10 +425,10 @@ TEST_F(NameserverEntryTest, ChangedExpired) {
* When the data expire and is asked again, the original RTT is kept.
*/
TEST_F(NameserverEntryTest, KeepRTT) {
shared_ptr<NameserverEntry> entry(new NameserverEntry(EXAMPLE_CO_UK,
boost::shared_ptr<NameserverEntry> entry(new NameserverEntry(EXAMPLE_CO_UK,
RRClass::IN()));
shared_ptr<Callback> callback(new Callback);
shared_ptr<TestResolver> resolver(new TestResolver);
boost::shared_ptr<Callback> callback(new Callback);
boost::shared_ptr<TestResolver> resolver(new TestResolver);
// Ask the first time
entry->askIP(resolver, callback, V4_ONLY);
......@@ -482,7 +481,7 @@ TEST_F(NameserverEntryTest, KeepRTT) {
// Test the RTT is updated smoothly
TEST_F(NameserverEntryTest, UpdateRTT) {
shared_ptr<NameserverEntry> ns(new NameserverEntry(EXAMPLE_CO_UK,
boost::shared_ptr<NameserverEntry> ns(new NameserverEntry(EXAMPLE_CO_UK,
RRClass::IN()));
fillNSEntry(ns, rrv4_, rrv6_);
NameserverEntry::AddressVector vec;
......
......@@ -35,7 +35,6 @@
using namespace isc::nsas;
using namespace asiolink;
using namespace std;
using namespace boost;
using namespace isc::dns;
namespace {
......@@ -43,10 +42,10 @@ namespace {
/// \brief Inherited version with access into its internals for tests
class InheritedZoneEntry : public ZoneEntry {
public:
InheritedZoneEntry(shared_ptr<ResolverInterface> resolver,
InheritedZoneEntry(boost::shared_ptr<ResolverInterface> resolver,
const std::string& name, const RRClass& class_code,
shared_ptr<HashTable<NameserverEntry> > nameserver_table,
shared_ptr<LruList<NameserverEntry> > nameserver_lru) :
boost::shared_ptr<HashTable<NameserverEntry> > nameserver_table,
boost::shared_ptr<LruList<NameserverEntry> > nameserver_lru) :
ZoneEntry(resolver, name, class_code, nameserver_table,
nameserver_lru)
{ }
......@@ -67,10 +66,10 @@ protected:
callback_(new Callback)
{ }
/// \brief Tables of nameservers to pass into zone entry constructor
shared_ptr<HashTable<NameserverEntry> > nameserver_table_;
shared_ptr<LruList<NameserverEntry> > nameserver_lru_;
boost::shared_ptr<HashTable<NameserverEntry> > nameserver_table_;
boost::shared_ptr<LruList<NameserverEntry> > nameserver_lru_;
/// \brief The resolver
shared_ptr<TestResolver> resolver_;
boost::shared_ptr<TestResolver> resolver_;
/**
* \short A callback we use into the zone.
......@@ -86,15 +85,15 @@ protected:
successes_.push_back(address);
}
};
shared_ptr<Callback> callback_;
boost::shared_ptr<Callback> callback_;
// Empty callback to pass to nameserver entry, to do injection of them
struct NseCallback : public NameserverEntry::Callback {
virtual void operator()(shared_ptr<NameserverEntry>) { }
virtual void operator()(boost::shared_ptr<NameserverEntry>) { }
};
shared_ptr<NseCallback> nseCallback() {
return (shared_ptr<NseCallback>(new NseCallback));
boost::shared_ptr<NseCallback> nseCallback() {
return (boost::shared_ptr<NseCallback>(new NseCallback));
}
/**
......@@ -102,8 +101,8 @@ protected:
*
* Convenience funcion, just creating a new zone, to shorten the code.
*/
shared_ptr<InheritedZoneEntry> getZone() {
return (shared_ptr<InheritedZoneEntry>(new InheritedZoneEntry(
boost::shared_ptr<InheritedZoneEntry> getZone() {
return (boost::shared_ptr<InheritedZoneEntry>(new InheritedZoneEntry(
resolver_, EXAMPLE_CO_UK, RRClass::IN(), nameserver_table_,
nameserver_lru_)));
}
......@@ -115,8 +114,8 @@ protected:
* hash table already contains the NameserverEntry. This function
* creates one and puts it into the hash table.
*/
shared_ptr<NameserverEntry> injectEntry() {
shared_ptr<NameserverEntry> nse(new NameserverEntry(ns_name_.toText(),
boost::shared_ptr<NameserverEntry> injectEntry() {
boost::shared_ptr<NameserverEntry> nse(new NameserverEntry(ns_name_.toText(),
RRClass::IN()));
nameserver_table_->add(nse, HashKey(ns_name_.toText(), RRClass::IN()));
EXPECT_EQ(Fetchable::NOT_ASKED, nse->getState());
......@@ -148,7 +147,7 @@ protected:
size_t failure_count = 0)
{
// Create the zone and check it acts correctly
shared_ptr<InheritedZoneEntry> zone(getZone());
boost::shared_ptr<InheritedZoneEntry> zone(getZone());
resolver_->addPresetAnswer(Question(Name(EXAMPLE_CO_UK), RRClass::IN(),
RRType::NS()), rr_single_);
zone->addCallback(callback_, ANY_OK);
......@@ -192,7 +191,7 @@ TEST_F(ZoneEntryTest, DefaultConstructor) {
* should be generated anywhere and the failure should be provided).
*/
TEST_F(ZoneEntryTest, CallbackNoNS) {
shared_ptr<InheritedZoneEntry> zone(getZone());
boost::shared_ptr<InheritedZoneEntry> zone(getZone());
EXPECT_EQ(Fetchable::NOT_ASKED, zone->getState());
// feed it with a callback
zone->addCallback(callback_, ANY_OK);
......@@ -220,7 +219,7 @@ TEST_F(ZoneEntryTest, CallbackNoNS) {
TEST_F(ZoneEntryTest, ChangedNS) {
// Make it zero TTL, so it expires right away
rr_single_->setTTL(RRTTL(0));
shared_ptr<InheritedZoneEntry> zone(getZone());
boost::shared_ptr<InheritedZoneEntry> zone(getZone());
EXPECT_EQ(Fetchable::NOT_ASKED, zone->getState());
// Feed it with callback
zone->addCallback(callback_, ANY_OK);
......@@ -283,7 +282,7 @@ TEST_F(ZoneEntryTest, ChangedNS) {
* provided.
*/
TEST_F(ZoneEntryTest, CallbacksAnswered) {
shared_ptr<InheritedZoneEntry> zone(getZone());
boost::shared_ptr<InheritedZoneEntry> zone(getZone());
EXPECT_EQ(Fetchable::NOT_ASKED, zone->getState());
// Feed it with a callback
zone->addCallback(callback_, ANY_OK);
......@@ -343,7 +342,7 @@ TEST_F(ZoneEntryTest, CallbacksAnswered) {
* fail.
*/
TEST_F(ZoneEntryTest, CallbacksAOnly) {
shared_ptr<InheritedZoneEntry> zone(getZone());
boost::shared_ptr<InheritedZoneEntry> zone(getZone());
EXPECT_EQ(Fetchable::NOT_ASKED, zone->getState());
zone->addCallback(callback_, ANY_OK);