And provide accessor methods to them.
#include <datasrc/memory_datasrc.h>
#include <datasrc/static_datasrc.h>
#include <datasrc/sqlite3_datasrc.h>
+#include <datasrc/client_list.h>
#include <xfr/xfrout_client.h>
/// The TSIG keyring
const boost::shared_ptr<TSIGKeyRing>* keyring_;
+ /// The client list
+ boost::shared_ptr<ClientList> client_list_;
+
/// Bind the ModuleSpec object in config_session_ with
/// isc:config::ModuleSpec::validateStatistics.
void registerStatisticsValidator();
// enable or disable the cache
cache_.setEnabled(use_cache);
+
+ // Create the (yet empty) data source list
+ client_list_.reset(new ConfigurableClientList());
}
AuthSrvImpl::~AuthSrvImpl() {
AuthSrv::setTSIGKeyRing(const boost::shared_ptr<TSIGKeyRing>* keyring) {
impl_->keyring_ = keyring;
}
+
+void
+AuthSrv::setClientList(const boost::shared_ptr<ClientList>& list) {
+ if (!list) {
+ isc_throw(BadValue, "The client list must not be NULL");
+ }
+ impl_->client_list_ = list;
+}
+
+const ClientList&
+AuthSrv::getClientList() const {
+ return (*impl_->client_list_);
+}
}
namespace datasrc {
class InMemoryClient;
+class ClientList;
}
namespace xfr {
class AbstractXfroutClient;
void setTSIGKeyRing(const boost::shared_ptr<isc::dns::TSIGKeyRing>*
keyring);
+ /// \brief Replaces the current client list with a different one.
+ ///
+ /// Replaces the internally used client list with a new one.
+ //
+ /// \param list Shared pointer to the client list. Must not be NULL.
+ ///
+ /// \throw BadValue if it is NULL.
+ void setClientList(const boost::shared_ptr<isc::datasrc::ClientList>&
+ list);
+
+ /// \brief Returns the currently used client list.
+ ///
+ /// Note that the server is constructed with an empty one, so this
+ /// is always valid, even before calling setClientList.
+ const isc::datasrc::ClientList& getClientList() const;
+
private:
AuthSrvImpl* impl_;
isc::asiolink::SimpleCallback* checkin_;
#include <server_common/keyring.h>
#include <datasrc/memory_datasrc.h>
+#include <datasrc/client_list.h>
#include <auth/auth_srv.h>
#include <auth/common.h>
#include <auth/statistics.h>
EXPECT_FALSE(ddns_forwarder.isConnected());
}
+// Check the client list accessors
+TEST_F(AuthSrvTest, clientList) {
+ // The server is created with a working client list. So calling the
+ // function will not crash.
+ server.getClientList();
+ // It is the correct type
+ EXPECT_NO_THROW(dynamic_cast<const isc::datasrc::ConfigurableClientList&>(
+ server.getClientList())) << "The client list has a wrong type";
+ // Now prepare a new client list and replace it
+ boost::shared_ptr<isc::datasrc::ConfigurableClientList>
+ list(new isc::datasrc::ConfigurableClientList());
+ server.setClientList(list);
+ // And it is kept there.
+ EXPECT_EQ(list.get(), &server.getClientList());
+ // But putting NULL there would not work and the original is preserved
+ EXPECT_THROW(server.setClientList(
+ boost::shared_ptr<isc::datasrc::ConfigurableClientList>()),
+ isc::BadValue);
+ EXPECT_EQ(list.get(), &server.getClientList());
+}
+
}