From: Francis Dupont Date: Sat, 23 May 2015 09:20:36 +0000 (+0200) Subject: [3634a] merged #3513, #3859 and #3882 X-Git-Tag: trac3634a_base X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=adb54c69fefbc01c2b59e119c91bfbfeb3c2febd;p=thirdparty%2Fkea.git [3634a] merged #3513, #3859 and #3882 --- diff --git a/configure.ac b/configure.ac index 1fcb031f77..cede2620bb 100644 --- a/configure.ac +++ b/configure.ac @@ -1412,7 +1412,7 @@ AC_CONFIG_FILES([compatcheck/Makefile doc/version.ent ext/asio/asio/Makefile ext/asio/Makefile - ext/gtest/Makefile + ext/gtest/Makefile ext/Makefile m4macros/Makefile Makefile @@ -1423,6 +1423,7 @@ AC_CONFIG_FILES([compatcheck/Makefile src/bin/d2/tests/Makefile src/bin/d2/tests/d2_process_tests.sh src/bin/d2/tests/test_data_files_config.h + src/bin/cfgrpt/Makefile src/bin/dhcp4/Makefile src/bin/dhcp4/spec_config.h.pre src/bin/dhcp4/tests/Makefile @@ -1455,7 +1456,7 @@ AC_CONFIG_FILES([compatcheck/Makefile src/bin/admin/tests/mysql_tests.sh src/bin/admin/scripts/mysql/Makefile src/bin/admin/scripts/mysql/upgrade_1.0_to_2.0.sh - src/bin/admin/scripts/mysql/upgrade_2.0_to_3.0.sh + src/bin/admin/scripts/mysql/upgrade_2.0_to_3.0.sh src/bin/admin/scripts/pgsql/Makefile src/hooks/Makefile src/hooks/dhcp/Makefile @@ -1680,6 +1681,10 @@ Developer: END +# Create config_report.cc with embedded config.report +chmod +x ${srcdir}/tools/mk_cfgrpt.sh +${srcdir}/tools/mk_cfgrpt.sh ${srcdir}/src/bin/cfgrpt/config_report.cc + cat config.report cat < + + As for any Kea executable binary, the config.report + file produced by ./configure is embbeded. + The command extracting it is: + +strings path/kea-dhcp-ddns | sed -n 's/;;;; //p' + + Beware the path to use for a binary + in the build tree finishes by .libs. + + Upon start up the module will load its configuration and begin listening for NCRs based on that configuration. diff --git a/doc/guide/dhcp4-srv.xml b/doc/guide/dhcp4-srv.xml index 7c802d3841..6e8e18cdd7 100644 --- a/doc/guide/dhcp4-srv.xml +++ b/doc/guide/dhcp4-srv.xml @@ -57,6 +57,17 @@ + + As for any Kea executable binary, the config.report + file produced by ./configure is embbeded. + The command extracting it is: + +strings path/kea-dhcp4 | sed -n 's/;;;; //p' + + Beware the path to use for a binary + in the build tree finishes by .libs. + + When running in a console, the server can be shut down by pressing ctrl-c. It detects the key combination and shuts diff --git a/doc/guide/dhcp6-srv.xml b/doc/guide/dhcp6-srv.xml index 9c4496a3c1..d10e99c39d 100644 --- a/doc/guide/dhcp6-srv.xml +++ b/doc/guide/dhcp6-srv.xml @@ -55,6 +55,17 @@ + + As for any Kea executable binary, the config.report + file produced by ./configure is embbeded. + The command extracting it is: + +strings path/kea-dhcp6 | sed -n 's/;;;; //p' + + Beware the path to use for a binary + in the build tree finishes by .libs. + + When running in a console, the server can be shut down by pressing ctrl-c. It detects the key combination and shuts diff --git a/doc/guide/install.xml b/doc/guide/install.xml index edfb374a98..b620f03575 100644 --- a/doc/guide/install.xml +++ b/doc/guide/install.xml @@ -334,6 +334,12 @@ Debian and Ubuntu: dependencies. + + ./configure when it succeeds displays a report + with the building parameters. This report is saved into + config.report and embedded into executable + binaries, e.g., kea-dhcp4. + diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index c254189add..220f7755ea 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -1,5 +1,5 @@ # The following build order must be maintained. -SUBDIRS = dhcp4 dhcp6 d2 perfdhcp admin lfc +SUBDIRS = cfgrpt dhcp4 dhcp6 d2 perfdhcp admin lfc if CONFIG_BACKEND_JSON SUBDIRS += keactrl diff --git a/src/bin/d2/Makefile.am b/src/bin/d2/Makefile.am index b1a837bb0b..40d9716bb8 100644 --- a/src/bin/d2/Makefile.am +++ b/src/bin/d2/Makefile.am @@ -3,6 +3,12 @@ SUBDIRS = . tests AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin AM_CPPFLAGS += $(BOOST_INCLUDES) +if HAVE_MYSQL +AM_CPPFLAGS += $(MYSQL_CPPFLAGS) +endif +if HAVE_PGSQL +AM_CPPFLAGS += $(PGSQL_CPPFLAGS) +endif AM_CXXFLAGS = $(KEA_CXXFLAGS) if USE_CLANGPP @@ -97,6 +103,8 @@ kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/util/libkea-util.la kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la +kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la +kea_dhcp_ddns_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la kea_dhcp_ddnsdir = $(pkgdatadir) kea_dhcp_ddns_DATA = dhcp-ddns.spec diff --git a/src/bin/d2/d_controller.cc b/src/bin/d2/d_controller.cc index 9c20ce18d9..f7dfc03e5f 100644 --- a/src/bin/d2/d_controller.cc +++ b/src/bin/d2/d_controller.cc @@ -19,6 +19,19 @@ #include #include #include +#include +#include +#include + +#ifdef HAVE_MYSQL +#include +#else +#ifdef HAVE_PGSQL +#include +#else +#include +#endif +#endif #include #include @@ -441,22 +454,34 @@ DControllerBase::usage(const std::string & text) DControllerBase::~DControllerBase() { } -}; // namespace isc::d2 - -}; // namespace isc +// Refer to config_report so it will be embedded in the binary +const char* const* d2_config_report = isc::detail::config_report; std::string -isc::dhcp::Daemon::getVersion(bool extended) { +DControllerBase::getVersion(bool extended) { std::stringstream tmp; tmp << VERSION; if (extended) { - tmp << std::endl << EXTENDED_VERSION; - - // @todo print more details (is it Botan or OpenSSL build, - // with or without MySQL/Postgres? What compilation options were - // used? etc) + tmp << std::endl << EXTENDED_VERSION << std::endl; + tmp << "linked with " << log::Logger::getVersion() << std::endl; + tmp << "and " << cryptolink::CryptoLink::getVersion() + << std::endl; +#ifdef HAVE_MYSQL + tmp << "database: " << isc::dhcp::MySqlLeaseMgr::getDBVersion(); +#else +#ifdef HAVE_PGSQL + tmp << "database: " << isc::dhcp::PgSqlLeaseMgr::getDBVersion(); +#else + tmp << "database: " << isc::dhcp::Memfile_LeaseMgr::getDBVersion(); +#endif +#endif + // @todo: more details about database runtime } return (tmp.str()); } + +}; // namespace isc::d2 + +}; // namespace isc diff --git a/src/bin/d2/d_controller.h b/src/bin/d2/d_controller.h index 6d1c4fc187..7f730480db 100644 --- a/src/bin/d2/d_controller.h +++ b/src/bin/d2/d_controller.h @@ -113,6 +113,10 @@ public: /// @brief Destructor virtual ~DControllerBase(); + /// @brief returns Kea version on stdout and exit. + /// redeclaration/redefinition. @ref Daemon::getVersion()) + static std::string getVersion(bool extended); + /// @brief Acts as the primary entry point into the controller execution /// and provides the outermost application control logic: /// diff --git a/src/bin/d2/tests/Makefile.am b/src/bin/d2/tests/Makefile.am index c4b98b1900..cacc9324bd 100644 --- a/src/bin/d2/tests/Makefile.am +++ b/src/bin/d2/tests/Makefile.am @@ -94,6 +94,7 @@ d2_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.l d2_unittests_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la d2_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la d2_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la +d2_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la endif diff --git a/src/bin/dhcp4/Makefile.am b/src/bin/dhcp4/Makefile.am index f085122bcd..c190c0a6f8 100644 --- a/src/bin/dhcp4/Makefile.am +++ b/src/bin/dhcp4/Makefile.am @@ -3,6 +3,12 @@ SUBDIRS = . tests AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin AM_CPPFLAGS += $(BOOST_INCLUDES) +if HAVE_MYSQL +AM_CPPFLAGS += $(MYSQL_CPPFLAGS) +endif +if HAVE_PGSQL +AM_CPPFLAGS += $(PGSQL_CPPFLAGS) +endif AM_CXXFLAGS = $(KEA_CXXFLAGS) if USE_CLANGPP @@ -82,6 +88,8 @@ kea_dhcp4_LDADD += $(top_builddir)/src/lib/log/libkea-log.la kea_dhcp4_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la kea_dhcp4_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la kea_dhcp4_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la +kea_dhcp4_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la +kea_dhcp4_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la kea_dhcp4dir = $(pkgdatadir) kea_dhcp4_DATA = dhcp4.spec diff --git a/src/bin/dhcp4/dhcp4_srv.cc b/src/bin/dhcp4/dhcp4_srv.cc index b9924e9f26..53fcbcf8b3 100644 --- a/src/bin/dhcp4/dhcp4_srv.cc +++ b/src/bin/dhcp4/dhcp4_srv.cc @@ -41,6 +41,19 @@ #include #include #include +#include +#include +#include + +#ifdef HAVE_MYSQL +#include +#else +#ifdef HAVE_PGSQL +#include +#else +#include +#endif +#endif #include #include @@ -51,6 +64,7 @@ using namespace isc; using namespace isc::asiolink; +using namespace isc::cryptolink; using namespace isc::dhcp; using namespace isc::dhcp_ddns; using namespace isc::hooks; @@ -2209,17 +2223,28 @@ Dhcpv4Srv::d2ClientErrorHandler(const CfgMgr::instance().getD2ClientMgr().suspendUpdates(); } +// Refer to config_report so it will be embedded in the binary +const char* const* dhcp4_config_report = isc::detail::config_report; + std::string -Daemon::getVersion(bool extended) { +Dhcpv4Srv::getVersion(bool extended) { std::stringstream tmp; tmp << VERSION; if (extended) { - tmp << endl << EXTENDED_VERSION; - - // @todo print more details (is it Botan or OpenSSL build, - // with or without MySQL/Postgres? What compilation options were - // used? etc) + tmp << endl << EXTENDED_VERSION << endl; + tmp << "linked with " << Logger::getVersion() << endl; + tmp << "and " << CryptoLink::getVersion() << endl; +#ifdef HAVE_MYSQL + tmp << "database: " << MySqlLeaseMgr::getDBVersion(); +#else +#ifdef HAVE_PGSQL + tmp << "database: " << PgSqlLeaseMgr::getDBVersion(); +#else + tmp << "database: " << Memfile_LeaseMgr::getDBVersion(); +#endif +#endif + // @todo: more details about database runtime } return (tmp.str()); diff --git a/src/bin/dhcp4/dhcp4_srv.h b/src/bin/dhcp4/dhcp4_srv.h index 73622c437e..51bb6b2ce0 100644 --- a/src/bin/dhcp4/dhcp4_srv.h +++ b/src/bin/dhcp4/dhcp4_srv.h @@ -186,6 +186,10 @@ public: /// @brief Destructor. Used during DHCPv4 service shutdown. virtual ~Dhcpv4Srv(); + /// @brief returns Kea version on stdout and exit. + /// redeclaration/redefinition. @ref Daemon::getVersion()) + static std::string getVersion(bool extended); + /// @brief Main server processing loop. /// /// Main server processing loop. Receives incoming packets, verifies diff --git a/src/bin/dhcp4/main.cc b/src/bin/dhcp4/main.cc index bf6ce7b890..efaa4de26b 100644 --- a/src/bin/dhcp4/main.cc +++ b/src/bin/dhcp4/main.cc @@ -76,11 +76,11 @@ main(int argc, char* argv[]) { break; case 'v': - cout << Daemon::getVersion(false) << endl; + cout << Dhcpv4Srv::getVersion(false) << endl; return (EXIT_SUCCESS); case 'V': - cout << Daemon::getVersion(true) << endl; + cout << Dhcpv4Srv::getVersion(true) << endl; return (EXIT_SUCCESS); case 'p': diff --git a/src/bin/dhcp4/tests/Makefile.am b/src/bin/dhcp4/tests/Makefile.am index a48e3a9dcc..2ad1c0e3a3 100644 --- a/src/bin/dhcp4/tests/Makefile.am +++ b/src/bin/dhcp4/tests/Makefile.am @@ -118,6 +118,7 @@ dhcp4_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la dhcp4_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la dhcp4_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.la dhcp4_unittests_LDADD += $(top_builddir)/src/lib/util/io/libkea-util-io.la +dhcp4_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la endif noinst_EXTRA_DIST = configs-list.txt diff --git a/src/bin/dhcp6/Makefile.am b/src/bin/dhcp6/Makefile.am index 4c7827c55e..cc9e9a863a 100644 --- a/src/bin/dhcp6/Makefile.am +++ b/src/bin/dhcp6/Makefile.am @@ -4,6 +4,12 @@ AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin AM_CPPFLAGS += -I$(top_srcdir)/src/lib/cc -I$(top_builddir)/src/lib/cc AM_CPPFLAGS += $(BOOST_INCLUDES) +if HAVE_MYSQL +AM_CPPFLAGS += $(MYSQL_CPPFLAGS) +endif +if HAVE_PGSQL +AM_CPPFLAGS += $(PGSQL_CPPFLAGS) +endif AM_CXXFLAGS = $(KEA_CXXFLAGS) if USE_CLANGPP @@ -84,6 +90,8 @@ kea_dhcp6_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la kea_dhcp6_LDADD += $(top_builddir)/src/lib/log/libkea-log.la kea_dhcp6_LDADD += $(top_builddir)/src/lib/util/libkea-util.la kea_dhcp6_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la +kea_dhcp6_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la +kea_dhcp6_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la kea_dhcp6dir = $(pkgdatadir) kea_dhcp6_DATA = dhcp6.spec diff --git a/src/bin/dhcp6/dhcp6_srv.cc b/src/bin/dhcp6/dhcp6_srv.cc index 0fdd23f207..d171100aeb 100644 --- a/src/bin/dhcp6/dhcp6_srv.cc +++ b/src/bin/dhcp6/dhcp6_srv.cc @@ -46,6 +46,19 @@ #include #include #include +#include +#include +#include + +#ifdef HAVE_MYSQL +#include +#else +#ifdef HAVE_PGSQL +#include +#else +#include +#endif +#endif #include @@ -62,9 +75,11 @@ using namespace isc; using namespace isc::asiolink; -using namespace isc::dhcp_ddns; +using namespace isc::cryptolink; using namespace isc::dhcp; +using namespace isc::dhcp_ddns; using namespace isc::hooks; +using namespace isc::log; using namespace isc::util; using namespace std; @@ -2753,17 +2768,29 @@ Dhcpv6Srv::d2ClientErrorHandler(const CfgMgr::instance().getD2ClientMgr().suspendUpdates(); } +// Refer to config_report so it will be embedded in the binary +const char* const* dhcp6_config_report = isc::detail::config_report; + std::string -Daemon::getVersion(bool extended) { +Dhcpv6Srv::getVersion(bool extended) { std::stringstream tmp; tmp << VERSION; if (extended) { tmp << endl << EXTENDED_VERSION; - - // @todo print more details (is it Botan or OpenSSL build, - // with or without MySQL/Postgres? What compilation options were - // used? etc) + tmp << endl << EXTENDED_VERSION << endl; + tmp << "linked with " << Logger::getVersion() << endl; + tmp << "and " << CryptoLink::getVersion() << endl; +#ifdef HAVE_MYSQL + tmp << "database: " << MySqlLeaseMgr::getDBVersion(); +#else +#ifdef HAVE_PGSQL + tmp << "database: " << PgSqlLeaseMgr::getDBVersion(); +#else + tmp << "database: " << Memfile_LeaseMgr::getDBVersion(); +#endif +#endif + // @todo: more details about database runtime } return (tmp.str()); diff --git a/src/bin/dhcp6/dhcp6_srv.h b/src/bin/dhcp6/dhcp6_srv.h index 0099b7ea86..384d1a92e7 100644 --- a/src/bin/dhcp6/dhcp6_srv.h +++ b/src/bin/dhcp6/dhcp6_srv.h @@ -77,6 +77,10 @@ public: /// @brief Destructor. Used during DHCPv6 service shutdown. virtual ~Dhcpv6Srv(); + /// @brief returns Kea version on stdout and exit. + /// redeclaration/redefinition. @ref Daemon::getVersion()) + static std::string getVersion(bool extended); + /// @brief Returns server-indentifier option. /// /// @return server-id option diff --git a/src/bin/dhcp6/main.cc b/src/bin/dhcp6/main.cc index 9c74921f9a..902c3a65d3 100644 --- a/src/bin/dhcp6/main.cc +++ b/src/bin/dhcp6/main.cc @@ -78,11 +78,11 @@ main(int argc, char* argv[]) { break; case 'v': - cout << Daemon::getVersion(false) << endl; + cout << Dhcpv6Srv::getVersion(false) << endl; return (EXIT_SUCCESS); case 'V': - cout << Daemon::getVersion(true) << endl; + cout << Dhcpv6Srv::getVersion(true) << endl; return (EXIT_SUCCESS); case 'p': // port number diff --git a/src/bin/dhcp6/tests/Makefile.am b/src/bin/dhcp6/tests/Makefile.am index eca758b340..e0b4a35530 100644 --- a/src/bin/dhcp6/tests/Makefile.am +++ b/src/bin/dhcp6/tests/Makefile.am @@ -118,6 +118,7 @@ dhcp6_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la dhcp6_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la dhcp6_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la dhcp6_unittests_LDADD += $(top_builddir)/src/lib/util/io/libkea-util-io.la +dhcp6_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la endif noinst_PROGRAMS = $(TESTS) diff --git a/src/bin/lfc/Makefile.am b/src/bin/lfc/Makefile.am index ed1c2ca440..693605028f 100644 --- a/src/bin/lfc/Makefile.am +++ b/src/bin/lfc/Makefile.am @@ -64,5 +64,6 @@ kea_lfc_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la kea_lfc_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la kea_lfc_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la kea_lfc_LDADD += $(top_builddir)/src/lib/util/libkea-util.la +kea_lfc_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la kea_lfcdir = $(pkgdatadir) diff --git a/src/bin/lfc/lfc_controller.cc b/src/bin/lfc/lfc_controller.cc index 926a46a9df..49a260975a 100644 --- a/src/bin/lfc/lfc_controller.cc +++ b/src/bin/lfc/lfc_controller.cc @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -45,6 +46,9 @@ const uint32_t MAX_LEASE_ERRORS = 100; namespace isc { namespace lfc { +// Refer to config_report so it will be embedded in the binary +const char* const* lfc_config_report = isc::detail::config_report; + /// @brief Defines the application name, it may be used to locate /// configuration data and appears in log statements. const char* LFCController::lfc_app_name_ = "DhcpLFC"; diff --git a/src/bin/lfc/tests/Makefile.am b/src/bin/lfc/tests/Makefile.am index 9e799a2d81..5b14846ea1 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/asiolink/libkea-asiolink.la lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la lfc_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la +lfc_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la endif diff --git a/src/bin/perfdhcp/Makefile.am b/src/bin/perfdhcp/Makefile.am index 9e59de9da4..5aaf80154f 100644 --- a/src/bin/perfdhcp/Makefile.am +++ b/src/bin/perfdhcp/Makefile.am @@ -1,6 +1,7 @@ SUBDIRS = . tests AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib +AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin AM_CPPFLAGS += -I$(top_srcdir)/src/lib/log -I$(top_builddir)/src/lib/log AM_CPPFLAGS += $(BOOST_INCLUDES) @@ -47,7 +48,7 @@ perfdhcp_LDADD = libperfdhcp.la perfdhcp_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la perfdhcp_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la perfdhcp_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la - +perfdhcp_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la # ... and the documentation EXTRA_DIST = perfdhcp_internals.dox diff --git a/src/bin/perfdhcp/command_options.cc b/src/bin/perfdhcp/command_options.cc index 5c169bcad5..f1940bb0b5 100644 --- a/src/bin/perfdhcp/command_options.cc +++ b/src/bin/perfdhcp/command_options.cc @@ -18,6 +18,7 @@ #include #include #include +#include #include #include @@ -35,6 +36,9 @@ using namespace isc; namespace isc { namespace perfdhcp { +// Refer to config_report so it will be embedded in the binary +const char* const* perfdhcp_config_report = isc::detail::config_report; + CommandOptions::LeaseType::LeaseType() : type_(ADDRESS) { } diff --git a/src/bin/perfdhcp/tests/Makefile.am b/src/bin/perfdhcp/tests/Makefile.am index 2576302478..36ac901e94 100644 --- a/src/bin/perfdhcp/tests/Makefile.am +++ b/src/bin/perfdhcp/tests/Makefile.am @@ -47,6 +47,7 @@ run_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la run_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la run_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la run_unittests_LDADD += $(top_builddir)/src/lib/util/unittests/libutil_unittests.la +run_unittests_LDADD += $(top_builddir)/src/bin/cfgrpt/libcfgrpt.la run_unittests_LDADD += $(GTEST_LDADD) endif diff --git a/src/lib/cryptolink/botan_link.cc b/src/lib/cryptolink/botan_link.cc index ede4f33124..01f192f3ea 100644 --- a/src/lib/cryptolink/botan_link.cc +++ b/src/lib/cryptolink/botan_link.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2011, 2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2011, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -43,6 +43,11 @@ CryptoLink::initialize() { } } +std::string +CryptoLink::getVersion() { + return (Botan::version_string()); +} + } // namespace cryptolink } // namespace isc diff --git a/src/lib/cryptolink/cryptolink.h b/src/lib/cryptolink/cryptolink.h index 69e1cc2d97..b9490e7c77 100644 --- a/src/lib/cryptolink/cryptolink.h +++ b/src/lib/cryptolink/cryptolink.h @@ -1,4 +1,4 @@ -// Copyright (C) 2011, 2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2011, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -161,6 +161,9 @@ public: /// static void initialize(); + /// \brief Get version string + static std::string getVersion(); + /// \brief Factory function for Hash objects /// /// CryptoLink objects cannot be constructed directly. This diff --git a/src/lib/cryptolink/openssl_link.cc b/src/lib/cryptolink/openssl_link.cc index dd6a732e3f..af47b0b30e 100644 --- a/src/lib/cryptolink/openssl_link.cc +++ b/src/lib/cryptolink/openssl_link.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -16,6 +16,8 @@ #include #include +#include + namespace isc { namespace cryptolink { @@ -46,6 +48,11 @@ CryptoLink::initialize() { } } +std::string +CryptoLink::getVersion() { + return (SSLeay_version(SSLEAY_VERSION)); +} + } // namespace cryptolink } // namespace isc diff --git a/src/lib/cryptolink/tests/crypto_unittests.cc b/src/lib/cryptolink/tests/crypto_unittests.cc index fa5b429c72..d08a8250c9 100644 --- a/src/lib/cryptolink/tests/crypto_unittests.cc +++ b/src/lib/cryptolink/tests/crypto_unittests.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2011, 2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2011, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -22,6 +22,11 @@ using namespace isc::cryptolink; +// Test get version +TEST(CryptoLinkTest, Version) { + EXPECT_NO_THROW(CryptoLink::getVersion()); +} + // Tests whether getCryptoLink() returns a singleton instance TEST(CryptoLinkTest, Singleton) { const CryptoLink& c1 = CryptoLink::getCryptoLink(); diff --git a/src/lib/dhcpsrv/daemon.cc b/src/lib/dhcpsrv/daemon.cc index b6ab33b51f..2733b926cd 100644 --- a/src/lib/dhcpsrv/daemon.cc +++ b/src/lib/dhcpsrv/daemon.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -92,5 +92,9 @@ void Daemon::loggerInit(const char* name, bool verbose) { isc::log::setDefaultLoggingOutput(verbose); } +std::string Daemon::getVersion(bool /*extended*/) { + isc_throw(isc::NotImplemented, "Daemon::getVersion() called"); +} + }; }; diff --git a/src/lib/dhcpsrv/daemon.h b/src/lib/dhcpsrv/daemon.h index 8009a796af..7766472053 100644 --- a/src/lib/dhcpsrv/daemon.h +++ b/src/lib/dhcpsrv/daemon.h @@ -153,6 +153,10 @@ public: /// also additional information about sources. It is expected to /// return extra information about dependencies and used DB backends. /// + /// As there is no static virtual methods in C++ this class method + /// has to be redefined in derived classes and called with the + /// derived class name or a child name. + /// /// @param extended print additional information? /// @return text string static std::string getVersion(bool extended); diff --git a/src/lib/dhcpsrv/lease_mgr.cc b/src/lib/dhcpsrv/lease_mgr.cc index 2190f42da0..57b64f0dfe 100644 --- a/src/lib/dhcpsrv/lease_mgr.cc +++ b/src/lib/dhcpsrv/lease_mgr.cc @@ -61,5 +61,10 @@ LeaseMgr::getLease6(Lease::Type type, const DUID& duid, return (*col.begin()); } +std::string +LeaseMgr::getDBVersion() { + isc_throw(NotImplemented, "LeaseMgr::getDBVersion() called"); +} + } // namespace isc::dhcp } // namespace isc diff --git a/src/lib/dhcpsrv/lease_mgr.h b/src/lib/dhcpsrv/lease_mgr.h index 7b0674d11e..edacec1c57 100644 --- a/src/lib/dhcpsrv/lease_mgr.h +++ b/src/lib/dhcpsrv/lease_mgr.h @@ -152,6 +152,10 @@ public: virtual ~LeaseMgr() {} + /// @brief Class method to return extended version info + /// This class method must be redeclared and redefined in derived classes + static std::string getDBVersion(); + /// @brief Adds an IPv4 lease. /// /// @param lease lease to be added diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.cc b/src/lib/dhcpsrv/memfile_lease_mgr.cc index 0afb22149e..f797413b99 100644 --- a/src/lib/dhcpsrv/memfile_lease_mgr.cc +++ b/src/lib/dhcpsrv/memfile_lease_mgr.cc @@ -265,6 +265,14 @@ Memfile_LeaseMgr::~Memfile_LeaseMgr() { } } +std::string +Memfile_LeaseMgr::getDBVersion() { + std::stringstream tmp; + tmp << "Memfile backend " << MAJOR_VERSION; + tmp << "." << MINOR_VERSION; + return (tmp.str()); +} + bool Memfile_LeaseMgr::addLease(const Lease4Ptr& lease) { LOG_DEBUG(dhcpsrv_logger, DHCPSRV_DBG_TRACE_DETAIL, diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.h b/src/lib/dhcpsrv/memfile_lease_mgr.h index 75a9089fc5..053b13ce66 100644 --- a/src/lib/dhcpsrv/memfile_lease_mgr.h +++ b/src/lib/dhcpsrv/memfile_lease_mgr.h @@ -134,6 +134,9 @@ public: /// @brief Destructor (closes file) virtual ~Memfile_LeaseMgr(); + /// @brief Local version of getDBVersion() class method + static std::string getDBVersion(); + /// @brief Adds an IPv4 lease. /// /// @param lease lease to be added diff --git a/src/lib/dhcpsrv/mysql_lease_mgr.cc b/src/lib/dhcpsrv/mysql_lease_mgr.cc index 34f91bdf01..40d7565837 100644 --- a/src/lib/dhcpsrv/mysql_lease_mgr.cc +++ b/src/lib/dhcpsrv/mysql_lease_mgr.cc @@ -1265,6 +1265,15 @@ MySqlLeaseMgr::~MySqlLeaseMgr() { // closed in the destructor of the mysql_ member variable. } +std::string +MySqlLeaseMgr::getDBVersion() { + std::stringstream tmp; + tmp << "MySQL backend " << CURRENT_VERSION_VERSION; + tmp << "." << CURRENT_VERSION_MINOR; + tmp << " library " << mysql_get_client_info(); + return (tmp.str()); +} + // Time conversion methods. // diff --git a/src/lib/dhcpsrv/mysql_lease_mgr.h b/src/lib/dhcpsrv/mysql_lease_mgr.h index 9845e6f82d..66dbbe1f2c 100644 --- a/src/lib/dhcpsrv/mysql_lease_mgr.h +++ b/src/lib/dhcpsrv/mysql_lease_mgr.h @@ -122,6 +122,9 @@ public: /// @brief Destructor (closes database) virtual ~MySqlLeaseMgr(); + /// @brief Local version of getDBVersion() class method + static std::string getDBVersion(); + /// @brief Adds an IPv4 lease /// /// @param lease lease to be added diff --git a/src/lib/dhcpsrv/pgsql_lease_mgr.cc b/src/lib/dhcpsrv/pgsql_lease_mgr.cc index da41047618..629cef4011 100644 --- a/src/lib/dhcpsrv/pgsql_lease_mgr.cc +++ b/src/lib/dhcpsrv/pgsql_lease_mgr.cc @@ -965,6 +965,15 @@ PgSqlLeaseMgr::~PgSqlLeaseMgr() { } } +std::string +PgSqlLeaseMgr::getDBVersion() { + std::stringstream tmp; + tmp << "PostgreSQL backend " << PG_CURRENT_VERSION; + tmp << "." << PG_CURRENT_MINOR; + tmp << " library " << PQlibVersion(); + return (tmp.str()); +} + void PgSqlLeaseMgr::prepareStatements() { for(int i = 0; tagged_statements[i].text != NULL; ++ i) { diff --git a/src/lib/dhcpsrv/pgsql_lease_mgr.h b/src/lib/dhcpsrv/pgsql_lease_mgr.h index 8b53f293d3..9df59a515e 100644 --- a/src/lib/dhcpsrv/pgsql_lease_mgr.h +++ b/src/lib/dhcpsrv/pgsql_lease_mgr.h @@ -151,6 +151,9 @@ public: /// @brief Destructor (closes database) virtual ~PgSqlLeaseMgr(); + /// @brief Local version of getDBVersion() class method + static std::string getDBVersion(); + /// @brief Adds an IPv4 lease /// /// @param lease lease to be added diff --git a/src/lib/dhcpsrv/tests/daemon_unittest.cc b/src/lib/dhcpsrv/tests/daemon_unittest.cc index 059f7940a0..f9e6ccba32 100644 --- a/src/lib/dhcpsrv/tests/daemon_unittest.cc +++ b/src/lib/dhcpsrv/tests/daemon_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2014, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -27,7 +27,16 @@ using namespace isc; using namespace isc::dhcp; using namespace isc::data; -std::string isc::dhcp::Daemon::getVersion(bool extended) { +namespace isc { +namespace dhcp { + +// @brief Derived Daemon class +class DaemonImpl : public Daemon { +public: + static std::string getVersion(bool extended); +}; + +std::string DaemonImpl::getVersion(bool extended) { if (extended) { return (std::string("EXTENDED")); } else { @@ -35,6 +44,9 @@ std::string isc::dhcp::Daemon::getVersion(bool extended) { } } +}; +}; + namespace { /// @brief Daemon Test test fixture class @@ -105,6 +117,15 @@ TEST_F(DaemonTest, parsingConsoleOutput) { EXPECT_EQ("stdout" , storage->getLoggingInfo()[0].destinations_[0].output_); } +// Test the getVersion() redefinition +TEST_F(DaemonTest, getVersion) { + EXPECT_THROW(Daemon::getVersion(false), NotImplemented); + + ASSERT_NO_THROW(DaemonImpl::getVersion(false)); + + EXPECT_EQ(DaemonImpl::getVersion(true), "EXTENDED"); +} + // More tests will appear here as we develop Daemon class. diff --git a/src/lib/log/logger.cc b/src/lib/log/logger.cc index c9840febb4..7979dc6684 100644 --- a/src/lib/log/logger.cc +++ b/src/lib/log/logger.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2011, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -50,6 +50,12 @@ Logger::~Logger() { loggerptr_ = 0; } +// Get Version +std::string +Logger::getVersion() { + return (LoggerImpl::getVersion()); +} + // Get Name of Logger std::string diff --git a/src/lib/log/logger.h b/src/lib/log/logger.h index 0b24ae6288..d9126abb97 100644 --- a/src/lib/log/logger.h +++ b/src/lib/log/logger.h @@ -1,4 +1,4 @@ -// Copyright (C) 2011, 2014 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2011, 2014, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -200,6 +200,9 @@ public: /// \brief Destructor virtual ~Logger(); + /// \brief Version + static std::string getVersion(); + /// \brief The formatter used to replace placeholders typedef isc::log::Formatter Formatter; diff --git a/src/lib/log/logger_impl.cc b/src/lib/log/logger_impl.cc index 0905e98122..c705aaeecd 100644 --- a/src/lib/log/logger_impl.cc +++ b/src/lib/log/logger_impl.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2011,2014-2015 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2011, 2014-2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -19,10 +19,12 @@ #include #include #include +#include #include #include #include +#include #include #include @@ -84,6 +86,15 @@ LoggerImpl::~LoggerImpl() { delete sync_; } +/// \brief Version +std::string +LoggerImpl::getVersion() { + std::ostringstream ver; + ver << "log4plus "; + ver << log4cplus::versionStr; + return (ver.str()); +} + // Set the severity for logging. void LoggerImpl::setSeverity(isc::log::Severity severity, int dbglevel) { diff --git a/src/lib/log/logger_impl.h b/src/lib/log/logger_impl.h index d63141fb21..3e47b62ae0 100644 --- a/src/lib/log/logger_impl.h +++ b/src/lib/log/logger_impl.h @@ -1,4 +1,4 @@ -// Copyright (C) 2011 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2011, 2015 Internet Systems Consortium, Inc. ("ISC") // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above @@ -77,6 +77,10 @@ public: virtual ~LoggerImpl(); + /// \brief Version + static std::string getVersion(); + + /// \brief Get the full name of the logger (including the root name) virtual std::string getName() { return (name_); diff --git a/src/lib/log/tests/logger_unittest.cc b/src/lib/log/tests/logger_unittest.cc index 2848b54142..b9cae00661 100644 --- a/src/lib/log/tests/logger_unittest.cc +++ b/src/lib/log/tests/logger_unittest.cc @@ -48,6 +48,11 @@ public: } }; +// Check version + +TEST_F(LoggerTest, Version) { + EXPECT_NO_THROW(Logger::getVersion()); +} // Checks that the logger is named correctly.