Commit 13159948 authored by Tomek Mrugalski's avatar Tomek Mrugalski 🛰

[#25,!14] UserContext is now in isc::data, deps updated

parent 1c29e58e
......@@ -68,7 +68,6 @@ kea_ctrl_agent_SOURCES = main.cc
kea_ctrl_agent_LDADD = libagent.la
kea_ctrl_agent_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
kea_ctrl_agent_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
kea_ctrl_agent_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
kea_ctrl_agent_LDADD += $(top_builddir)/src/lib/eval/libkea-eval.la
kea_ctrl_agent_LDADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la
kea_ctrl_agent_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
......
......@@ -61,7 +61,6 @@ ca_unittests_LDADD = $(top_builddir)/src/bin/agent/libagent.la
ca_unittests_LDADD += $(top_builddir)/src/lib/process/testutils/libprocesstest.la
ca_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
ca_unittests_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
ca_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
ca_unittests_LDADD += $(top_builddir)/src/lib/eval/libkea-eval.la
ca_unittests_LDADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la
ca_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
......
......@@ -89,7 +89,6 @@ kea_dhcp_ddns_SOURCES = main.cc
kea_dhcp_ddns_LDADD = libd2.la
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/eval/libkea-eval.la
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la
kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/asiodns/libkea-asiodns.la
......
......@@ -257,7 +257,7 @@ typedef boost::shared_ptr<D2Params> D2ParamsPtr;
/// instance of the actual key (@ref isc::dns::TSIGKey) that can be used
/// by the IO layer for signing and verifying messages.
///
class TSIGKeyInfo : public isc::dhcp::UserContext, public isc::data::CfgToElement {
class TSIGKeyInfo : public isc::data::UserContext, public isc::data::CfgToElement {
public:
/// @brief Defines string values for the supported TSIG algorithms
//@{
......@@ -412,7 +412,7 @@ typedef boost::shared_ptr<TSIGKeyInfoMap> TSIGKeyInfoMapPtr;
/// belongs to a list of servers supporting DNS for a given domain. It will
/// be used to establish communications with the server to carry out DNS
/// updates.
class DnsServerInfo : public isc::dhcp::UserContext, public isc::data::CfgToElement {
class DnsServerInfo : public isc::data::UserContext, public isc::data::CfgToElement {
public:
/// @brief defines DNS standard port value
static const uint32_t STANDARD_DNS_PORT = 53;
......@@ -522,7 +522,7 @@ typedef boost::shared_ptr<DnsServerInfoStorage> DnsServerInfoStoragePtr;
/// @todo Currently the name entry for a domain is just an std::string. It
/// may be worthwhile to change this to a dns::Name for purposes of better
/// validation and matching capabilities.
class DdnsDomain : public isc::dhcp::UserContext, public isc::data::CfgToElement {
class DdnsDomain : public isc::data::UserContext, public isc::data::CfgToElement {
public:
/// @brief Constructor
///
......
......@@ -76,7 +76,6 @@ d2_unittests_LDADD = $(top_builddir)/src/bin/d2/libd2.la
d2_unittests_LDADD += $(top_builddir)/src/lib/process/testutils/libprocesstest.la
d2_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
d2_unittests_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
d2_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
d2_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.la
d2_unittests_LDADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la
d2_unittests_LDADD += $(top_builddir)/src/lib/testutils/libkea-testutils.la
......
......@@ -94,6 +94,7 @@ kea_dhcp4_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
kea_dhcp4_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
kea_dhcp4_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
kea_dhcp4_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
kea_dhcp4_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
kea_dhcp4_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
kea_dhcp4_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
kea_dhcp4_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
......
......@@ -276,7 +276,8 @@ ControlledDhcpv4Srv::commandConfigWriteHandler(const string&,
// Ok, it's time to write the file.
size_t size = 0;
try {
size = writeConfigFile(filename);
ConstElementPtr cfg = CfgMgr::instance().getCurrentCfg()->toElement();
size = writeConfigFile(filename, cfg);
} catch (const isc::Exception& ex) {
return (createAnswer(CONTROL_RESULT_ERROR, string("Error during write-config:")
+ ex.what()));
......
......@@ -22,7 +22,7 @@
#include <dhcpsrv/network_state.h>
#include <dhcpsrv/subnet.h>
#include <hooks/callout_handle.h>
#include <dhcpsrv/daemon.h>
#include <process/daemon.h>
#include <boost/noncopyable.hpp>
......@@ -191,7 +191,7 @@ typedef boost::shared_ptr<Dhcpv4Exchange> Dhcpv4ExchangePtr;
/// This class does not support any controlling mechanisms directly.
/// See the derived \ref ControlledDhcpv4Srv class for support for
/// command and configuration updates over msgq.
class Dhcpv4Srv : public Daemon {
class Dhcpv4Srv : public process::Daemon {
private:
/// @brief Pointer to IO service used by the server.
......
......@@ -22,6 +22,7 @@
using namespace isc::data;
using namespace isc::dhcp;
using namespace isc::process;
using namespace std;
/// This file contains entry point (main() function) for standard DHCPv4 server
......@@ -228,7 +229,7 @@ main(int argc, char* argv[]) {
LOG_INFO(dhcp4_logger, DHCP4_SHUTDOWN);
} catch (const isc::dhcp::DaemonPIDExists& ex) {
} catch (const isc::process::DaemonPIDExists& ex) {
// First, we print the error on stderr (that should always work)
cerr << DHCP4_NAME << " already running? " << ex.what()
<< endl;
......
......@@ -149,6 +149,7 @@ dhcp4_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
dhcp4_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
......
......@@ -95,6 +95,7 @@ kea_dhcp6_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
kea_dhcp6_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
kea_dhcp6_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
kea_dhcp6_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
kea_dhcp6_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
kea_dhcp6_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
kea_dhcp6_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
kea_dhcp6_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
......
......@@ -278,7 +278,8 @@ ControlledDhcpv6Srv::commandConfigWriteHandler(const string&, ConstElementPtr ar
// Ok, it's time to write the file.
size_t size = 0;
try {
size = writeConfigFile(filename);
ConstElementPtr cfg = CfgMgr::instance().getCurrentCfg()->toElement();
size = writeConfigFile(filename, cfg);
} catch (const isc::Exception& ex) {
return (createAnswer(CONTROL_RESULT_ERROR, string("Error during write-config:")
+ ex.what()));
......
......@@ -23,7 +23,7 @@
#include <dhcpsrv/network_state.h>
#include <dhcpsrv/subnet.h>
#include <hooks/callout_handle.h>
#include <dhcpsrv/daemon.h>
#include <process/daemon.h>
#include <functional>
#include <iostream>
......@@ -56,7 +56,7 @@ public:
/// that is going to be used as server-identifier, receives incoming
/// packets, processes them, manages leases assignment and generates
/// appropriate responses.
class Dhcpv6Srv : public Daemon {
class Dhcpv6Srv : public process::Daemon {
private:
/// @brief Pointer to IO service used by the server.
......
......@@ -15,6 +15,7 @@
#include <log/logger_manager.h>
#include <exceptions/exceptions.h>
#include <cfgrpt/config_report.h>
#include <process/daemon.h>
#include <boost/lexical_cast.hpp>
......@@ -22,6 +23,7 @@
using namespace isc::data;
using namespace isc::dhcp;
using namespace isc::process;
using namespace std;
/// This file contains entry point (main() function) for standard DHCPv6 server
......@@ -136,7 +138,7 @@ main(int argc, char* argv[]) {
// This is just a test, so we don't care about lockfile.
setenv("KEA_LOCKFILE_DIR", "none", 0);
CfgMgr::instance().setDefaultLoggerName(DHCP6_ROOT_LOGGER_NAME);
Daemon::loggerInit(DHCP6_ROOT_LOGGER_NAME, verbose_mode);
isc::process::Daemon::loggerInit(DHCP6_ROOT_LOGGER_NAME, verbose_mode);
// Check the syntax first.
Parser6Context parser;
......@@ -236,7 +238,7 @@ main(int argc, char* argv[]) {
LOG_INFO(dhcp6_logger, DHCP6_SHUTDOWN);
} catch (const isc::dhcp::DaemonPIDExists& ex) {
} catch (const isc::process::DaemonPIDExists& ex) {
// First, we print the error on stderr (that should always work)
cerr << DHCP6_NAME << " already running? " << ex.what()
<< endl;
......
......@@ -129,6 +129,7 @@ dhcp6_unittests_LDADD += $(top_builddir)/src/lib/testutils/libkea-testutils.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
dhcp6_unittests_LDADD += $(top_builddir)/src/lib/dhcp/tests/libdhcptest.la
if HAVE_MYSQL
......
......@@ -56,6 +56,7 @@ kea_lfc_LDADD = liblfc.la
kea_lfc_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
kea_lfc_LDADD += $(top_builddir)/src/lib/eval/libkea-eval.la
kea_lfc_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
kea_lfc_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
kea_lfc_LDADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la
kea_lfc_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
kea_lfc_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
......
......@@ -57,6 +57,7 @@ lfc_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
lfc_unittests_LDADD += $(top_builddir)/src/lib/eval/libkea-eval.la
lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la
lfc_unittests_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
lfc_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
lfc_unittests_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
......
......@@ -53,6 +53,7 @@ libdhcp_ha_la_LDFLAGS += -avoid-version -export-dynamic -module
libdhcp_ha_la_LIBADD = libha.la
libdhcp_ha_la_LIBADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
libdhcp_ha_la_LIBADD += $(top_builddir)/src/lib/process/libkea-process.la
libdhcp_ha_la_LIBADD += $(top_builddir)/src/lib/eval/libkea-eval.la
libdhcp_ha_la_LIBADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la
libdhcp_ha_la_LIBADD += $(top_builddir)/src/lib/stats/libkea-stats.la
......
......@@ -41,6 +41,7 @@ ha_unittests_CXXFLAGS = $(AM_CXXFLAGS)
ha_unittests_LDADD = $(top_builddir)/src/hooks/dhcp/high_availability/libha.la
ha_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
ha_unittests_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
ha_unittests_LDADD += $(top_builddir)/src/lib/eval/libkea-eval.la
ha_unittests_LDADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la
ha_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
......
......@@ -45,6 +45,7 @@ libdhcp_lease_cmds_la_LDFLAGS = $(AM_LDFLAGS)
libdhcp_lease_cmds_la_LDFLAGS += -avoid-version -export-dynamic -module
libdhcp_lease_cmds_la_LIBADD = liblease_cmds.la
libdhcp_lease_cmds_la_LIBADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
libdhcp_lease_cmds_la_LIBADD += $(top_builddir)/src/lib/process/libkea-process.la
libdhcp_lease_cmds_la_LIBADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
libdhcp_lease_cmds_la_LIBADD += $(top_builddir)/src/lib/cc/libkea-cc.la
libdhcp_lease_cmds_la_LIBADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
......
......@@ -35,6 +35,7 @@ lease_cmds_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) $(GTEST_LDFLAGS)
lease_cmds_unittests_CXXFLAGS = $(AM_CXXFLAGS)
lease_cmds_unittests_LDADD = $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
lease_cmds_unittests_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
lease_cmds_unittests_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
lease_cmds_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
lease_cmds_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
......
......@@ -35,6 +35,7 @@ stat_cmds_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) $(GTEST_LDFLAGS)
stat_cmds_unittests_CXXFLAGS = $(AM_CXXFLAGS)
stat_cmds_unittests_LDADD = $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
stat_cmds_unittests_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
stat_cmds_unittests_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
stat_cmds_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
stat_cmds_unittests_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
......
......@@ -14,5 +14,4 @@ SUBDIRS += cql
endif
SUBDIRS += testutils hooks dhcp config stats asiodns dhcp_ddns eval \
dhcpsrv cfgrpt \
process http
cfgrpt process dhcpsrv process http
......@@ -6,7 +6,6 @@
#include <config.h>
#include <exceptions/exceptions.h>
#include <dhcpsrv/daemon.h>
#include <gtest/gtest.h>
#include <cc/data.h>
#include <fstream>
......
......@@ -9,7 +9,6 @@
#include <gtest/gtest.h>
using namespace isc::data;
using namespace isc::dhcp;
namespace {
......
......@@ -5,13 +5,11 @@
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
#include <config.h>
#include <cc/user_context.h>
using namespace isc::data;
namespace isc {
namespace dhcp {
namespace data {
void
UserContext::contextToElement(ElementPtr map) const {
......
......@@ -11,7 +11,7 @@
#include <boost/shared_ptr.hpp>
namespace isc {
namespace dhcp {
namespace data {
/// @brief Base class for user context
///
......
......@@ -732,7 +732,7 @@ private:
/// Collection of data fields within the record.
RecordFieldsCollection record_fields_;
/// User context
UserContext user_context_;
data::UserContext user_context_;
};
......
......@@ -132,8 +132,6 @@ libkea_dhcpsrv_la_SOURCES += lease_file_loader.h
libkea_dhcpsrv_la_SOURCES += lease_file_stats.h
libkea_dhcpsrv_la_SOURCES += lease_mgr.cc lease_mgr.h
libkea_dhcpsrv_la_SOURCES += lease_mgr_factory.cc lease_mgr_factory.h
libkea_dhcpsrv_la_SOURCES += logging.cc logging.h
libkea_dhcpsrv_la_SOURCES += logging_info.cc logging_info.h
libkea_dhcpsrv_la_SOURCES += memfile_lease_mgr.cc memfile_lease_mgr.h
libkea_dhcpsrv_la_SOURCES += memfile_lease_storage.h
......@@ -298,8 +296,6 @@ libkea_dhcpsrv_include_HEADERS = \
lease_file_stats.h \
lease_mgr.h \
lease_mgr_factory.h \
logging.h \
logging_info.h \
memfile_lease_mgr.h \
memfile_lease_storage.h \
ncr_generator.h \
......
......@@ -16,7 +16,7 @@ namespace dhcp {
/// @brief Parameters for various consistency checks.
///
class CfgConsistency : public isc::dhcp::UserContext, public isc::data::CfgToElement {
class CfgConsistency : public isc::data::UserContext, public isc::data::CfgToElement {
public:
......
......@@ -27,7 +27,7 @@ namespace dhcp {
/// generate. It also allows for overriding entire default DUID or parts of
/// it via configuration file. This class holds the DUID configuration
/// specified in the server configuration file.
class CfgDUID : public UserContext, public isc::data::CfgToElement {
class CfgDUID : public data::UserContext, public isc::data::CfgToElement {
public:
/// @brief Constructor.
......
......@@ -127,7 +127,7 @@ public:
/// to which it is bound. It is allowed to select multiple addresses on the
/// particular interface explicitly, e.g. "eth0/192.168.8.1",
/// "eth0/192.168.8.2".
class CfgIface : public UserContext, public isc::data::CfgToElement {
class CfgIface : public isc::data::UserContext, public isc::data::CfgToElement {
public:
/// @brief Socket type used by the DHCPv4 server.
......
......@@ -31,7 +31,7 @@ namespace dhcp {
/// for this option. This information comprises whether this option is sent
/// to DHCP client only on request (persistent = false) or always
/// (persistent = true).
class OptionDescriptor : public UserContext {
class OptionDescriptor : public data::UserContext {
public:
/// @brief Option instance.
OptionPtr option_;
......
......@@ -42,7 +42,7 @@ public:
};
/// @brief Embodies a single client class definition
class ClientClassDef : public UserContext, public isc::data::CfgToElement {
class ClientClassDef : public data::UserContext, public isc::data::CfgToElement {
public:
/// @brief Constructor
///
......
......@@ -50,7 +50,7 @@ public:
/// parameters associated with DHCP-DDNS and acting as a client of D2.
/// Instances of this class may be constructed through configuration parsing.
///
class D2ClientConfig : public UserContext, public isc::data::CfgToElement {
class D2ClientConfig : public data::UserContext, public isc::data::CfgToElement {
public:
/// @brief Default configuration constants.
static const char* DFT_SERVER_IP;
......
......@@ -239,7 +239,7 @@ typedef std::pair<IPv6ResrvIterator, IPv6ResrvIterator> IPv6ResrvRange;
/// - disable IPv4 reservation without a need to set it to the 0.0.0.0 address
/// Note that the last three operations are mainly required for managing
/// host reservations which will be implemented later.
class Host : public UserContext {
class Host : public data::UserContext {
public:
/// @brief Type of the host identifier.
......
......@@ -32,7 +32,7 @@ typedef boost::shared_ptr<Lease> LeasePtr;
///
/// This structure holds all information that is common between IPv4 and IPv6
/// leases.
struct Lease : public UserContext, public isc::data::CfgToElement {
struct Lease : public isc::data::UserContext, public isc::data::CfgToElement {
/// @brief Type of lease or pool
typedef enum {
......
......@@ -45,7 +45,7 @@ typedef std::vector<isc::asiolink::IOAddress> IOAddressList;
/// class provides an abstract interface that must be implemented by derived
/// classes and, where appropriate, implements common methods used by the
/// derived classes.
class Network : public virtual UserContext, public data::CfgToElement {
class Network : public virtual isc::data::UserContext, public isc::data::CfgToElement {
public:
/// @brief Holds optional information about relay.
///
......
......@@ -26,7 +26,7 @@ namespace dhcp {
///
/// Stores information about pool of IPv4 or IPv6 addresses.
/// That is a basic component of a configuration.
class Pool : public UserContext {
class Pool : public isc::data::UserContext {
public:
/// @note:
......
......@@ -9,6 +9,7 @@
#include <dhcpsrv/srv_config.h>
#include <dhcpsrv/lease_mgr_factory.h>
#include <dhcpsrv/cfg_hosts_util.h>
#include <process/logging_info.h>
#include <log/logger_manager.h>
#include <log/logger_specification.h>
#include <dhcp/pkt.h> // Needed for HWADDR_SOURCE_*
......@@ -17,6 +18,7 @@
using namespace isc::log;
using namespace isc::data;
using namespace isc::process;
namespace isc {
namespace dhcp {
......@@ -105,12 +107,8 @@ SrvConfig::sequenceEquals(const SrvConfig& other) {
void
SrvConfig::copy(SrvConfig& new_config) const {
// We will entirely replace loggers in the new configuration.
new_config.logging_info_.clear();
for (LoggingInfoStorage::const_iterator it = logging_info_.begin();
it != logging_info_.end(); ++it) {
new_config.addLoggingInfo(*it);
}
ConfigBase::copy(new_config);
// Replace interface configuration.
new_config.cfg_iface_.reset(new CfgIface(*cfg_iface_));
// Replace option definitions.
......@@ -130,44 +128,13 @@ SrvConfig::copy(SrvConfig& new_config) const {
}
}
void
SrvConfig::applyLoggingCfg() const {
std::list<LoggerSpecification> specs;
for (LoggingInfoStorage::const_iterator it = logging_info_.begin();
it != logging_info_.end(); ++it) {
specs.push_back(it->toSpec());
}
LoggerManager manager;
manager.process(specs.begin(), specs.end());
}
bool
SrvConfig::equals(const SrvConfig& other) const {
// If number of loggers is different, then configurations aren't equal.
if (logging_info_.size() != other.logging_info_.size()) {
if (!ConfigBase::equals(other)) {
return (false);
}
// Pass through all loggers and try to find the match for each of them
// with the loggers from the other configuration. The order doesn't
// matter so we can't simply compare the vectors.
for (LoggingInfoStorage::const_iterator this_it =
logging_info_.begin(); this_it != logging_info_.end();
++this_it) {
bool match = false;
for (LoggingInfoStorage::const_iterator other_it =
other.logging_info_.begin();
other_it != other.logging_info_.end(); ++other_it) {
if (this_it->equals(*other_it)) {
match = true;
break;
}
}
// No match found for the particular logger so return false.
if (!match) {
return (false);
}
}
// Logging information is equal between objects, so check other values.
if ((*cfg_iface_ != *other.cfg_iface_) ||
(*cfg_option_def_ != *other.cfg_option_def_) ||
......@@ -210,7 +177,7 @@ SrvConfig::updateStatistics() {
}
}
void
void
SrvConfig::extractConfiguredGlobals(isc::data::ConstElementPtr config) {
if (config->getType() != Element::map) {
isc_throw(BadValue, "extractConfiguredGlobals must be given a map element");
......@@ -227,15 +194,16 @@ SrvConfig::extractConfiguredGlobals(isc::data::ConstElementPtr config) {
ElementPtr
SrvConfig::toElement() const {
// Toplevel map
ElementPtr result = ConfigBase::toElement();
// Get family for the configuration manager
uint16_t family = CfgMgr::instance().getFamily();
// Toplevel map
ElementPtr result = Element::createMap();
// DhcpX global map
ElementPtr dhcp = Element::createMap();
// Add in explicitly configured globals.
dhcp->setValue(configured_globals_->mapValue());
dhcp->setValue(configured_globals_->mapValue());
// Set user-context
contextToElement(dhcp);
......@@ -342,7 +310,7 @@ SrvConfig::toElement() const {
}
}
// Host reservations
// Host reservations
CfgHostsList resv_list;
resv_list.internalize(cfg_hosts_->toElement());
......@@ -411,20 +379,6 @@ SrvConfig::toElement() const {
// Set DhcpX
result->set(family == AF_INET ? "Dhcp4" : "Dhcp6", dhcp);
// Logging global map (skip if empty)
if (!logging_info_.empty()) {
ElementPtr logging = Element::createMap();
// Set loggers list
ElementPtr loggers = Element::createList();
for (LoggingInfoStorage::const_iterator logger =
logging_info_.cbegin();
logger != logging_info_.cend(); ++logger) {
loggers->add(logger->toElement());
}
logging->set("loggers", loggers);
result->set("Logging", logging);
}
ConstElementPtr cfg_consist = cfg_consist_->toElement();
dhcp->set("sanity-checks", cfg_consist);
......
......@@ -24,7 +24,7 @@
#include <dhcpsrv/cfg_consistency.h>
#include <dhcpsrv/client_class_def.h>
#include <dhcpsrv/d2_client_cfg.h>
#include <dhcpsrv/logging_info.h>
#include <process/config_base.h>
#include <hooks/hooks_config.h>
#include <cc/data.h>
#include <cc/user_context.h>
......@@ -41,7 +41,7 @@ class CfgMgr;
/// @brief Specifies current DHCP configuration
///
/// @todo Migrate all other configuration parameters from cfgmgr.h here
class SrvConfig : public UserContext, public isc::data::CfgToElement {
class SrvConfig : public process::ConfigBase {
public:
/// @name Constants for selection of parameters returned by @c getConfigSummary
///
......@@ -117,25 +117,6 @@ public:
/// @return true if sequence numbers are equal.
bool sequenceEquals(const SrvConfig& other);
/// @name Modifiers and accesors for the configuration objects.
///
/// @warning References to the objects returned by accessors are only