summaryrefslogtreecommitdiffstats
path: root/src/lib/dhcpsrv/cfgmgr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/dhcpsrv/cfgmgr.cc')
-rw-r--r--src/lib/dhcpsrv/cfgmgr.cc62
1 files changed, 14 insertions, 48 deletions
diff --git a/src/lib/dhcpsrv/cfgmgr.cc b/src/lib/dhcpsrv/cfgmgr.cc
index 6f37ffafde..2896b8bc4a 100644
--- a/src/lib/dhcpsrv/cfgmgr.cc
+++ b/src/lib/dhcpsrv/cfgmgr.cc
@@ -1,4 +1,4 @@
-// Copyright (C) 2012-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2012-2017 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -10,14 +10,11 @@
#include <dhcp/libdhcp++.h>
#include <dhcpsrv/cfgmgr.h>
#include <dhcpsrv/dhcpsrv_log.h>
-#include <dhcpsrv/subnet_id.h>
-#include <stats/stats_mgr.h>
#include <sstream>
#include <string>
using namespace isc::asiolink;
using namespace isc::util;
-using namespace isc::stats;
namespace isc {
namespace dhcp {
@@ -30,35 +27,6 @@ CfgMgr::instance() {
return (cfg_mgr);
}
-void
-CfgMgr::addOptionSpace4(const OptionSpacePtr& space) {
- if (!space) {
- isc_throw(InvalidOptionSpace,
- "provided option space object is NULL.");
- }
- OptionSpaceCollection::iterator it = spaces4_.find(space->getName());
- if (it != spaces4_.end()) {
- isc_throw(InvalidOptionSpace, "option space " << space->getName()
- << " already added.");
- }
- spaces4_.insert(make_pair(space->getName(), space));
-}
-
-void
-CfgMgr::addOptionSpace6(const OptionSpacePtr& space) {
- if (!space) {
- isc_throw(InvalidOptionSpace,
- "provided option space object is NULL.");
- }
- OptionSpaceCollection::iterator it = spaces6_.find(space->getName());
- if (it != spaces6_.end()) {
- isc_throw(InvalidOptionSpace, "option space " << space->getName()
- << " already added.");
- }
- spaces6_.insert(make_pair(space->getName(), space));
-}
-
-
std::string CfgMgr::getDataDir() const {
return (datadir_);
}
@@ -68,21 +36,19 @@ CfgMgr::setDataDir(const std::string& datadir) {
datadir_ = datadir;
}
-bool
-CfgMgr::isDuplicate(const Subnet6& subnet) const {
- for (Subnet6Collection::const_iterator subnet_it = subnets6_.begin();
- subnet_it != subnets6_.end(); ++subnet_it) {
- if ((*subnet_it)->getID() == subnet.getID()) {
- return (true);
- }
- }
- return (false);
-}
-
-
void
CfgMgr::setD2ClientConfig(D2ClientConfigPtr& new_config) {
+ ensureCurrentAllocated();
+ // Note that D2ClientMgr::setD2Config() actually attempts to apply the
+ // configuration by stopping its sender and opening a new one and so
+ // forth per the new configuration.
d2_client_mgr_.setD2ClientConfig(new_config);
+
+ // Manager will throw if the set fails, if it succeeds
+ // we'll update our SrvConfig, configuration_, with the D2ClientConfig
+ // used. This is largely bookkeeping in case we ever want to compare
+ // configuration_ to another SrvConfig.
+ configuration_->setD2ClientConfig(new_config);
}
bool
@@ -184,7 +150,7 @@ CfgMgr::revert(const size_t index) {
commit();
}
-ConstSrvConfigPtr
+SrvConfigPtr
CfgMgr::getCurrentCfg() {
ensureCurrentAllocated();
return (configuration_);
@@ -201,8 +167,8 @@ CfgMgr::getStagingCfg() {
}
CfgMgr::CfgMgr()
- : datadir_(DHCP_DATA_DIR), echo_v4_client_id_(true),
- d2_client_mgr_(), verbose_mode_(false) {
+ : datadir_(DHCP_DATA_DIR), d2_client_mgr_(),
+ verbose_mode_(false), family_(AF_INET) {
// DHCP_DATA_DIR must be set set with -DDHCP_DATA_DIR="..." in Makefile.am
// Note: the definition of DHCP_DATA_DIR needs to include quotation marks
// See AM_CPPFLAGS definition in Makefile.am