From: Tomek Mrugalski Date: Fri, 31 Aug 2018 19:27:59 +0000 (+0200) Subject: [#25,!14] UserContext is now in isc::data, deps updated X-Git-Tag: gitlab116_base~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1315994891d543b9a91a95901b3770f1586535fa;p=thirdparty%2Fkea.git [#25,!14] UserContext is now in isc::data, deps updated --- diff --git a/src/bin/agent/Makefile.am b/src/bin/agent/Makefile.am index 6b346fb159..31a2798d88 100644 --- a/src/bin/agent/Makefile.am +++ b/src/bin/agent/Makefile.am @@ -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 diff --git a/src/bin/agent/tests/Makefile.am b/src/bin/agent/tests/Makefile.am index 4738df87aa..eb8c89849e 100644 --- a/src/bin/agent/tests/Makefile.am +++ b/src/bin/agent/tests/Makefile.am @@ -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 diff --git a/src/bin/d2/Makefile.am b/src/bin/d2/Makefile.am index e2b71a4618..56b180c8de 100644 --- a/src/bin/d2/Makefile.am +++ b/src/bin/d2/Makefile.am @@ -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 diff --git a/src/bin/d2/d2_config.h b/src/bin/d2/d2_config.h index 13bf875321..51a9d4c515 100644 --- a/src/bin/d2/d2_config.h +++ b/src/bin/d2/d2_config.h @@ -257,7 +257,7 @@ typedef boost::shared_ptr 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 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 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 /// diff --git a/src/bin/d2/tests/Makefile.am b/src/bin/d2/tests/Makefile.am index 3738801ff6..3b9635a691 100644 --- a/src/bin/d2/tests/Makefile.am +++ b/src/bin/d2/tests/Makefile.am @@ -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 diff --git a/src/bin/dhcp4/Makefile.am b/src/bin/dhcp4/Makefile.am index c5b1ece1b2..a0da1621b8 100644 --- a/src/bin/dhcp4/Makefile.am +++ b/src/bin/dhcp4/Makefile.am @@ -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 diff --git a/src/bin/dhcp4/ctrl_dhcp4_srv.cc b/src/bin/dhcp4/ctrl_dhcp4_srv.cc index 25a13d88dd..2ebe9d86fc 100644 --- a/src/bin/dhcp4/ctrl_dhcp4_srv.cc +++ b/src/bin/dhcp4/ctrl_dhcp4_srv.cc @@ -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())); diff --git a/src/bin/dhcp4/dhcp4_srv.h b/src/bin/dhcp4/dhcp4_srv.h index c095cdfef0..d2df379604 100644 --- a/src/bin/dhcp4/dhcp4_srv.h +++ b/src/bin/dhcp4/dhcp4_srv.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include @@ -191,7 +191,7 @@ typedef boost::shared_ptr 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. diff --git a/src/bin/dhcp4/main.cc b/src/bin/dhcp4/main.cc index b1997db0a8..6762eac8f6 100644 --- a/src/bin/dhcp4/main.cc +++ b/src/bin/dhcp4/main.cc @@ -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; diff --git a/src/bin/dhcp4/tests/Makefile.am b/src/bin/dhcp4/tests/Makefile.am index cd6eb79226..9e0221d3b5 100644 --- a/src/bin/dhcp4/tests/Makefile.am +++ b/src/bin/dhcp4/tests/Makefile.am @@ -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 diff --git a/src/bin/dhcp6/Makefile.am b/src/bin/dhcp6/Makefile.am index 68652f3335..e82f9c2770 100644 --- a/src/bin/dhcp6/Makefile.am +++ b/src/bin/dhcp6/Makefile.am @@ -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 diff --git a/src/bin/dhcp6/ctrl_dhcp6_srv.cc b/src/bin/dhcp6/ctrl_dhcp6_srv.cc index ffd6ac6e8d..6d614be508 100644 --- a/src/bin/dhcp6/ctrl_dhcp6_srv.cc +++ b/src/bin/dhcp6/ctrl_dhcp6_srv.cc @@ -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())); diff --git a/src/bin/dhcp6/dhcp6_srv.h b/src/bin/dhcp6/dhcp6_srv.h index 0b33638a65..6a580e9913 100644 --- a/src/bin/dhcp6/dhcp6_srv.h +++ b/src/bin/dhcp6/dhcp6_srv.h @@ -23,7 +23,7 @@ #include #include #include -#include +#include #include #include @@ -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. diff --git a/src/bin/dhcp6/main.cc b/src/bin/dhcp6/main.cc index 6d848aa964..c3f6f0f428 100644 --- a/src/bin/dhcp6/main.cc +++ b/src/bin/dhcp6/main.cc @@ -15,6 +15,7 @@ #include #include #include +#include #include @@ -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; diff --git a/src/bin/dhcp6/tests/Makefile.am b/src/bin/dhcp6/tests/Makefile.am index d94f577347..f92c8d77e5 100644 --- a/src/bin/dhcp6/tests/Makefile.am +++ b/src/bin/dhcp6/tests/Makefile.am @@ -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 diff --git a/src/bin/lfc/Makefile.am b/src/bin/lfc/Makefile.am index bc34383568..bebe6bfb8e 100644 --- a/src/bin/lfc/Makefile.am +++ b/src/bin/lfc/Makefile.am @@ -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 diff --git a/src/bin/lfc/tests/Makefile.am b/src/bin/lfc/tests/Makefile.am index 6ab0269e80..0a11ec4b9b 100644 --- a/src/bin/lfc/tests/Makefile.am +++ b/src/bin/lfc/tests/Makefile.am @@ -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 diff --git a/src/hooks/dhcp/high_availability/Makefile.am b/src/hooks/dhcp/high_availability/Makefile.am index 4f7cec02b5..8550cca815 100644 --- a/src/hooks/dhcp/high_availability/Makefile.am +++ b/src/hooks/dhcp/high_availability/Makefile.am @@ -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 diff --git a/src/hooks/dhcp/high_availability/tests/Makefile.am b/src/hooks/dhcp/high_availability/tests/Makefile.am index 40296c828e..c2eb24213b 100644 --- a/src/hooks/dhcp/high_availability/tests/Makefile.am +++ b/src/hooks/dhcp/high_availability/tests/Makefile.am @@ -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 diff --git a/src/hooks/dhcp/lease_cmds/Makefile.am b/src/hooks/dhcp/lease_cmds/Makefile.am index 90abfdad77..841298f4bc 100644 --- a/src/hooks/dhcp/lease_cmds/Makefile.am +++ b/src/hooks/dhcp/lease_cmds/Makefile.am @@ -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 diff --git a/src/hooks/dhcp/lease_cmds/tests/Makefile.am b/src/hooks/dhcp/lease_cmds/tests/Makefile.am index 43bbb56c1c..1795ee953e 100644 --- a/src/hooks/dhcp/lease_cmds/tests/Makefile.am +++ b/src/hooks/dhcp/lease_cmds/tests/Makefile.am @@ -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 diff --git a/src/hooks/dhcp/stat_cmds/tests/Makefile.am b/src/hooks/dhcp/stat_cmds/tests/Makefile.am index d8bda8d298..9d17e66532 100644 --- a/src/hooks/dhcp/stat_cmds/tests/Makefile.am +++ b/src/hooks/dhcp/stat_cmds/tests/Makefile.am @@ -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 diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 0373e3f820..30a5a9fd6d 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -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 diff --git a/src/lib/cc/tests/data_file_unittests.cc b/src/lib/cc/tests/data_file_unittests.cc index 8471849b6e..473664dc2b 100644 --- a/src/lib/cc/tests/data_file_unittests.cc +++ b/src/lib/cc/tests/data_file_unittests.cc @@ -6,7 +6,6 @@ #include #include -#include #include #include #include diff --git a/src/lib/cc/tests/user_context_unittests.cc b/src/lib/cc/tests/user_context_unittests.cc index 50b98ba164..3035e99ade 100644 --- a/src/lib/cc/tests/user_context_unittests.cc +++ b/src/lib/cc/tests/user_context_unittests.cc @@ -9,7 +9,6 @@ #include using namespace isc::data; -using namespace isc::dhcp; namespace { diff --git a/src/lib/cc/user_context.cc b/src/lib/cc/user_context.cc index 74104006ef..3194fcd6ae 100644 --- a/src/lib/cc/user_context.cc +++ b/src/lib/cc/user_context.cc @@ -5,13 +5,11 @@ // file, You can obtain one at http://mozilla.org/MPL/2.0/. #include - #include -using namespace isc::data; namespace isc { -namespace dhcp { +namespace data { void UserContext::contextToElement(ElementPtr map) const { diff --git a/src/lib/cc/user_context.h b/src/lib/cc/user_context.h index 58067b4438..ae795b6753 100644 --- a/src/lib/cc/user_context.h +++ b/src/lib/cc/user_context.h @@ -11,7 +11,7 @@ #include namespace isc { -namespace dhcp { +namespace data { /// @brief Base class for user context /// diff --git a/src/lib/dhcp/option_definition.h b/src/lib/dhcp/option_definition.h index 02e49f7c15..21e021de05 100644 --- a/src/lib/dhcp/option_definition.h +++ b/src/lib/dhcp/option_definition.h @@ -732,7 +732,7 @@ private: /// Collection of data fields within the record. RecordFieldsCollection record_fields_; /// User context - UserContext user_context_; + data::UserContext user_context_; }; diff --git a/src/lib/dhcpsrv/Makefile.am b/src/lib/dhcpsrv/Makefile.am index 7e743aa2a5..fd6125457b 100644 --- a/src/lib/dhcpsrv/Makefile.am +++ b/src/lib/dhcpsrv/Makefile.am @@ -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 \ diff --git a/src/lib/dhcpsrv/cfg_consistency.h b/src/lib/dhcpsrv/cfg_consistency.h index d379b9ffec..c6f31f34f8 100644 --- a/src/lib/dhcpsrv/cfg_consistency.h +++ b/src/lib/dhcpsrv/cfg_consistency.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: diff --git a/src/lib/dhcpsrv/cfg_duid.h b/src/lib/dhcpsrv/cfg_duid.h index e93738eb04..c95c66387c 100644 --- a/src/lib/dhcpsrv/cfg_duid.h +++ b/src/lib/dhcpsrv/cfg_duid.h @@ -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. diff --git a/src/lib/dhcpsrv/cfg_iface.h b/src/lib/dhcpsrv/cfg_iface.h index 6b36045d43..4cb318cbdb 100644 --- a/src/lib/dhcpsrv/cfg_iface.h +++ b/src/lib/dhcpsrv/cfg_iface.h @@ -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. diff --git a/src/lib/dhcpsrv/cfg_option.h b/src/lib/dhcpsrv/cfg_option.h index 1f13106ced..d29914f888 100644 --- a/src/lib/dhcpsrv/cfg_option.h +++ b/src/lib/dhcpsrv/cfg_option.h @@ -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_; diff --git a/src/lib/dhcpsrv/client_class_def.h b/src/lib/dhcpsrv/client_class_def.h index 49fcb2969c..abeda2adfc 100644 --- a/src/lib/dhcpsrv/client_class_def.h +++ b/src/lib/dhcpsrv/client_class_def.h @@ -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 /// diff --git a/src/lib/dhcpsrv/d2_client_cfg.h b/src/lib/dhcpsrv/d2_client_cfg.h index c4bb250400..2c00a9237f 100644 --- a/src/lib/dhcpsrv/d2_client_cfg.h +++ b/src/lib/dhcpsrv/d2_client_cfg.h @@ -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; diff --git a/src/lib/dhcpsrv/host.h b/src/lib/dhcpsrv/host.h index b1e6a5b4b6..149d6f3578 100644 --- a/src/lib/dhcpsrv/host.h +++ b/src/lib/dhcpsrv/host.h @@ -239,7 +239,7 @@ typedef std::pair 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. diff --git a/src/lib/dhcpsrv/lease.h b/src/lib/dhcpsrv/lease.h index 45568dc0d1..c42cfc9a9e 100644 --- a/src/lib/dhcpsrv/lease.h +++ b/src/lib/dhcpsrv/lease.h @@ -32,7 +32,7 @@ typedef boost::shared_ptr 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 { diff --git a/src/lib/dhcpsrv/network.h b/src/lib/dhcpsrv/network.h index ce253cb758..433e80102c 100644 --- a/src/lib/dhcpsrv/network.h +++ b/src/lib/dhcpsrv/network.h @@ -45,7 +45,7 @@ typedef std::vector 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. /// diff --git a/src/lib/dhcpsrv/pool.h b/src/lib/dhcpsrv/pool.h index f6ee8b326b..51488d4311 100644 --- a/src/lib/dhcpsrv/pool.h +++ b/src/lib/dhcpsrv/pool.h @@ -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: diff --git a/src/lib/dhcpsrv/srv_config.cc b/src/lib/dhcpsrv/srv_config.cc index db0bf7ec06..4e4571761e 100644 --- a/src/lib/dhcpsrv/srv_config.cc +++ b/src/lib/dhcpsrv/srv_config.cc @@ -9,6 +9,7 @@ #include #include #include +#include #include #include #include // 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 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); diff --git a/src/lib/dhcpsrv/srv_config.h b/src/lib/dhcpsrv/srv_config.h index 02af78e1c9..e4fbe2f8ae 100644 --- a/src/lib/dhcpsrv/srv_config.h +++ b/src/lib/dhcpsrv/srv_config.h @@ -24,7 +24,7 @@ #include #include #include -#include +#include #include #include #include @@ -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 - /// valid during the lifetime of the @c SrvConfig object which - /// returned them. - /// - //@{ - /// @brief Returns logging specific configuration. - const LoggingInfoStorage& getLoggingInfo() const { - return (logging_info_); - } - - /// @brief Sets logging specific configuration. - /// - /// @param logging_info New logging configuration. - void addLoggingInfo(const LoggingInfo& logging_info) { - logging_info_.push_back(logging_info); - } - /// @brief Returns non-const pointer to interface configuration. /// /// This function returns a non-const pointer to the interface @@ -427,9 +408,6 @@ public: /// be copied. void copy(SrvConfig& new_config) const; - /// @brief Apply logging configuration to log4cplus. - void applyLoggingCfg() const; - /// @name Methods and operators used to compare configurations. /// //@{ @@ -589,9 +567,6 @@ private: /// @brief Sequence number identifying the configuration. uint32_t sequence_; - /// @brief Logging specific information. - LoggingInfoStorage logging_info_; - /// @brief Interface configuration. /// /// Used to select interfaces on which the DHCP server will listen to diff --git a/src/lib/dhcpsrv/subnet.h b/src/lib/dhcpsrv/subnet.h index 140a521bf6..e995283e35 100644 --- a/src/lib/dhcpsrv/subnet.h +++ b/src/lib/dhcpsrv/subnet.h @@ -30,7 +30,7 @@ namespace isc { namespace dhcp { -class Subnet : public virtual UserContext, public data::CfgToElement { +class Subnet : public virtual data::UserContext, public data::CfgToElement { // Assignable network is our friend to allow it to call // @ref Subnet::setSharedNetwork private function. diff --git a/src/lib/dhcpsrv/tests/Makefile.am b/src/lib/dhcpsrv/tests/Makefile.am index 8510186969..2e477b7403 100644 --- a/src/lib/dhcpsrv/tests/Makefile.am +++ b/src/lib/dhcpsrv/tests/Makefile.am @@ -100,8 +100,8 @@ libdhcpsrv_unittests_SOURCES += lease_file_loader_unittest.cc libdhcpsrv_unittests_SOURCES += lease_unittest.cc libdhcpsrv_unittests_SOURCES += lease_mgr_factory_unittest.cc libdhcpsrv_unittests_SOURCES += lease_mgr_unittest.cc -libdhcpsrv_unittests_SOURCES += logging_unittest.cc -libdhcpsrv_unittests_SOURCES += logging_info_unittest.cc +#libdhcpsrv_unittests_SOURCES += logging_unittest.cc +#libdhcpsrv_unittests_SOURCES += logging_info_unittest.cc libdhcpsrv_unittests_SOURCES += generic_lease_mgr_unittest.cc generic_lease_mgr_unittest.h libdhcpsrv_unittests_SOURCES += memfile_lease_mgr_unittest.cc libdhcpsrv_unittests_SOURCES += dhcp_parsers_unittest.cc @@ -174,6 +174,7 @@ libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/eval/libkea-eval.la libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la +libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/process/libkea-process.la libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la libdhcpsrv_unittests_LDADD += $(top_builddir)/src/lib/dhcp/tests/libdhcptest.la diff --git a/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc b/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc index 461cb45686..ba62eb56ed 100644 --- a/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfgmgr_unittest.cc @@ -13,6 +13,7 @@ #include #include #include +#include #include #include @@ -31,6 +32,7 @@ using namespace isc::dhcp; using namespace isc::dhcp::test; using namespace isc::util; using namespace isc::stats; +using namespace isc::process; using namespace isc; // don't import the entire boost namespace. It will unexpectedly hide uint8_t diff --git a/src/lib/dhcpsrv/tests/srv_config_unittest.cc b/src/lib/dhcpsrv/tests/srv_config_unittest.cc index 21f31a9f24..0b555bc27b 100644 --- a/src/lib/dhcpsrv/tests/srv_config_unittest.cc +++ b/src/lib/dhcpsrv/tests/srv_config_unittest.cc @@ -10,12 +10,14 @@ #include #include #include +#include #include #include using namespace isc::asiolink; using namespace isc::dhcp; using namespace isc::data; +using namespace isc::process; // Those are the tests for SrvConfig storage. Right now they are minimal, // but the number is expected to grow significantly once we migrate more