]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3634a] merged #3513, #3859 and #3882 trac3634a_base
authorFrancis Dupont <fdupont@isc.org>
Sat, 23 May 2015 09:20:36 +0000 (11:20 +0200)
committerFrancis Dupont <fdupont@isc.org>
Sat, 23 May 2015 09:20:36 +0000 (11:20 +0200)
46 files changed:
configure.ac
doc/guide/ddns.xml
doc/guide/dhcp4-srv.xml
doc/guide/dhcp6-srv.xml
doc/guide/install.xml
src/bin/Makefile.am
src/bin/d2/Makefile.am
src/bin/d2/d_controller.cc
src/bin/d2/d_controller.h
src/bin/d2/tests/Makefile.am
src/bin/dhcp4/Makefile.am
src/bin/dhcp4/dhcp4_srv.cc
src/bin/dhcp4/dhcp4_srv.h
src/bin/dhcp4/main.cc
src/bin/dhcp4/tests/Makefile.am
src/bin/dhcp6/Makefile.am
src/bin/dhcp6/dhcp6_srv.cc
src/bin/dhcp6/dhcp6_srv.h
src/bin/dhcp6/main.cc
src/bin/dhcp6/tests/Makefile.am
src/bin/lfc/Makefile.am
src/bin/lfc/lfc_controller.cc
src/bin/lfc/tests/Makefile.am
src/bin/perfdhcp/Makefile.am
src/bin/perfdhcp/command_options.cc
src/bin/perfdhcp/tests/Makefile.am
src/lib/cryptolink/botan_link.cc
src/lib/cryptolink/cryptolink.h
src/lib/cryptolink/openssl_link.cc
src/lib/cryptolink/tests/crypto_unittests.cc
src/lib/dhcpsrv/daemon.cc
src/lib/dhcpsrv/daemon.h
src/lib/dhcpsrv/lease_mgr.cc
src/lib/dhcpsrv/lease_mgr.h
src/lib/dhcpsrv/memfile_lease_mgr.cc
src/lib/dhcpsrv/memfile_lease_mgr.h
src/lib/dhcpsrv/mysql_lease_mgr.cc
src/lib/dhcpsrv/mysql_lease_mgr.h
src/lib/dhcpsrv/pgsql_lease_mgr.cc
src/lib/dhcpsrv/pgsql_lease_mgr.h
src/lib/dhcpsrv/tests/daemon_unittest.cc
src/lib/log/logger.cc
src/lib/log/logger.h
src/lib/log/logger_impl.cc
src/lib/log/logger_impl.h
src/lib/log/tests/logger_unittest.cc

index 1fcb031f776113c76ae05b54303f4a95f90587cf..cede2620bb8209a114bbb7d910c6e6aa754affd0 100644 (file)
@@ -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 <<EOF
 
index 213847e53640cbab7a2f8c3ad412bdaad81229dd..a2a5fb948e9f947020726994b80833e65219b31b 100644 (file)
           </listitem>
       </itemizedlist>
 
+      <para>
+      As for any Kea executable binary, the <filename>config.report</filename>
+      file produced by <userinput>./configure</userinput> is embbeded.
+      The command extracting it is:
+<screen>
+strings <userinput>path</userinput>/kea-dhcp-ddns | sed -n 's/;;;; //p'
+</screen>
+      Beware the <userinput>path</userinput> to use for a binary
+      in the build tree finishes by <filename>.libs</filename>.
+      </para>
+
       <para>
       Upon start up the module will load its configuration and begin listening
       for NCRs based on that configuration.
index 7c802d38415419e04e32c610534b6d7d1e3eaeea..6e8e18cdd7769bca543d8e393a7e9a898dd6e828 100644 (file)
           </listitem>
       </itemizedlist>
 
+      <para>
+            As for any Kea executable binary, the <filename>config.report</filename>
+            file produced by <userinput>./configure</userinput> is embbeded.
+            The command extracting it is:
+<screen>
+strings <userinput>path</userinput>/kea-dhcp4 | sed -n 's/;;;; //p'
+</screen>
+            Beware the <userinput>path</userinput> to use for a binary
+            in the build tree finishes by <filename>.libs</filename>.
+      </para>
+
       <para>
            When running in a console, the server can be shut down by
            pressing ctrl-c. It detects the key combination and shuts
index 9c4496a3c1208d4711fdbfaa8023a21268b994a0..d10e99c39db230b3839f4d51389235597c338b55 100644 (file)
           </listitem>
       </itemizedlist>
 
+      <para>
+            As for any Kea executable binary, the <filename>config.report</filename>
+            file produced by <userinput>./configure</userinput> is embbeded.
+            The command extracting it is:
+<screen>
+strings <userinput>path</userinput>/kea-dhcp6 | sed -n 's/;;;; //p'
+</screen>
+            Beware the <userinput>path</userinput> to use for a binary
+            in the build tree finishes by <filename>.libs</filename>.
+      </para>
+
       <para>
            When running in a console, the server can be shut down by
            pressing ctrl-c. It detects the key combination and shuts
index edfb374a984be83abcefea3f3ca6630cae82f9d0..b620f03575925a47ad72c1d5639ec0b4e113d710 100644 (file)
@@ -334,6 +334,12 @@ Debian and Ubuntu:
           dependencies.
         </para>
 
+        <para>
+          <userinput>./configure</userinput> when it succeeds displays a report
+          with the building parameters. This report is saved into 
+          <filename>config.report</filename> and embedded into executable
+          binaries, e.g., <userinput>kea-dhcp4</userinput>.
+        </para>
 
       </section>
 
index c254189addcdefe3234359d864c7114b455fe15d..220f7755ea669b747e3e6413033d8e18635745fe 100644 (file)
@@ -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
index b1a837bb0b9f280cd4a0245bbe924e849bb6f4a7..40d9716bb8559853d2195a1416d20569218f005c 100644 (file)
@@ -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
index 9c20ce18d9604bfc65decc0a2944c94a5d2cff37..f7dfc03e5f9320fae38f5bb92f6328a1f0049892 100644 (file)
 #include <exceptions/exceptions.h>
 #include <log/logger_support.h>
 #include <dhcpsrv/cfgmgr.h>
+#include <cryptolink/cryptolink.h>
+#include <log/logger.h>
+#include <cfgrpt/config_report.h>
+
+#ifdef HAVE_MYSQL
+#include <dhcpsrv/mysql_lease_mgr.h>
+#else
+#ifdef HAVE_PGSQL
+#include <dhcpsrv/pgsql_lease_mgr.h>
+#else
+#include <dhcpsrv/memfile_lease_mgr.h>
+#endif
+#endif
 
 #include <sstream>
 #include <unistd.h>
@@ -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
index 6d1c4fc18746323c5c8574d7a9d06e34e32094ab..7f730480dbf2e32eb39cce5fce6588c16c8daf80 100644 (file)
@@ -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:
     ///
index c4b98b19002ceab14878fddfbc6edd7b344e57c1..cacc9324bdefef73826609d24461c14a604ae180 100644 (file)
@@ -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
 
index f085122bcdd42234c3231fbe1d29eaa1f187c321..c190c0a6f8089e3c26790d4e35361da3bfec70be 100644 (file)
@@ -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
index b9924e9f264448512fac7754f012ebde156a8fe6..53fcbcf8b3b287fe22c437b8208006212618bfee 100644 (file)
 #include <hooks/hooks_log.h>
 #include <hooks/hooks_manager.h>
 #include <util/strutil.h>
+#include <log/logger.h>
+#include <cryptolink/cryptolink.h>
+#include <cfgrpt/config_report.h>
+
+#ifdef HAVE_MYSQL
+#include <dhcpsrv/mysql_lease_mgr.h>
+#else
+#ifdef HAVE_PGSQL
+#include <dhcpsrv/pgsql_lease_mgr.h>
+#else
+#include <dhcpsrv/memfile_lease_mgr.h>
+#endif
+#endif
 
 #include <asio.hpp>
 #include <boost/bind.hpp>
@@ -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());
index 73622c437ece81a654da6367e14c26bff1d4f904..51bb6b2ce031d84dad53de4b76190ed49d8a90cf 100644 (file)
@@ -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
index bf6ce7b8905842d23ab64922e0f624426bb5d1ac..efaa4de26b872785d0789a9f8a34fadb8e52a9a7 100644 (file)
@@ -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':
index a48e3a9dcc35e03631d8c65b1bdd08a0a3017b46..2ad1c0e3a3d3c9d616b9fea616c112f1bc6040f9 100644 (file)
@@ -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
index 4c7827c55eea88968962c86db10e8ec8b58c7552..cc9e9a863a3ce8a00ab67d1d40dd3b6f5265277b 100644 (file)
@@ -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
index 0fdd23f20795c9878db249950c569d28588dd3b1..d171100aebe6d148d0cc3056337b2040c1864dc0 100644 (file)
 #include <util/encode/hex.h>
 #include <util/io_utilities.h>
 #include <util/range_utilities.h>
+#include <log/logger.h>
+#include <cryptolink/cryptolink.h>
+#include <cfgrpt/config_report.h>
+
+#ifdef HAVE_MYSQL
+#include <dhcpsrv/mysql_lease_mgr.h>
+#else
+#ifdef HAVE_PGSQL
+#include <dhcpsrv/pgsql_lease_mgr.h>
+#else
+#include <dhcpsrv/memfile_lease_mgr.h>
+#endif
+#endif
 
 #include <asio.hpp>
 
 
 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());
index 0099b7ea865182cf6ace4625530f741dbf53937a..384d1a92e72fce9092993a1bc7e443d9a9c5804e 100644 (file)
@@ -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
index 9c74921f9ad52ac313a999ac5a5fd447d8382ef2..902c3a65d3722db19fdb2c8bbdcdb76ff3ac856b 100644 (file)
@@ -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
index eca758b3403d3561cc27c4a393a2232d33756aec..e0b4a35530cd558670adc6f7375e91224b643469 100644 (file)
@@ -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)
index ed1c2ca44006161efed04d2b5f9a68ee4cf8fc61..693605028fb3fcf3b9bde8aab79fa9e6f62f5551 100644 (file)
@@ -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)
index 926a46a9df4e90c921efab6b5c2334caa2d912d1..49a260975a2f91429e2b2b0132945cfd4df3cc17 100644 (file)
@@ -25,6 +25,7 @@
 #include <dhcpsrv/lease_file_loader.h>
 #include <log/logger_manager.h>
 #include <log/logger_name.h>
+#include <cfgrpt/config_report.h>
 
 #include <iostream>
 #include <sstream>
@@ -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";
index 9e799a2d81a79f9b0b63d86ec505ec863f915e55..5b14846ea1ebf8b587a878b56d6b96d690c2ecd2 100644 (file)
@@ -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
 
index 9e59de9da418bd3fc1701f24a597f2befacad646..5aaf80154fa46c43ccda970e188ec53732327f2a 100644 (file)
@@ -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
index 5c169bcad520d8684ce06f0677966598e177dcb1..f1940bb0b5b7d5179f21344aa90f44dd31e8cd1f 100644 (file)
@@ -18,6 +18,7 @@
 #include <exceptions/exceptions.h>
 #include <dhcp/iface_mgr.h>
 #include <dhcp/duid.h>
+#include <cfgrpt/config_report.h>
 
 #include <boost/lexical_cast.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
@@ -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) {
 }
index 2576302478f73c9a1db800590001a8c1597db65e..36ac901e941d07b16697d0d20b5409fabd926d8c 100644 (file)
@@ -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
 
index ede4f33124c5c2c1d22bba357c6248d97ad02d15..01f192f3ea8eaaf72f86eba47310b4b6e0188968 100644 (file)
@@ -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
 
index 69e1cc2d97e5a1257646c7077c6b81c60b776d0c..b9490e7c777bb70abe6634c31aa36764b8640ca7 100644 (file)
@@ -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
index dd6a732e3ff7868f9140addbbcb658cd26472a80..af47b0b30ee5290737d32a80c5e154b1dc22c5f4 100644 (file)
@@ -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 <cryptolink/crypto_hash.h>
 #include <cryptolink/crypto_hmac.h>
 
+#include <openssl/crypto.h>
+
 namespace isc {
 namespace cryptolink {
 
@@ -46,6 +48,11 @@ CryptoLink::initialize() {
     }
 }
 
+std::string
+CryptoLink::getVersion() {
+    return (SSLeay_version(SSLEAY_VERSION));
+}
+
 } // namespace cryptolink
 } // namespace isc
 
index fa5b429c72544fd17bbf653414668f5905b49f41..d08a8250c9901d81fad2703d9f5ce47a59d13738 100644 (file)
@@ -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
 
 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();
index b6ab33b51fa762f60a7e7fb456331dafd07ad3b6..2733b926cd97fcc60abac9c8e1b5af8157a3c718 100644 (file)
@@ -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");
+}
+
 };
 };
index 8009a796af67edd58905d45f4cd159f14d5791bd..77664720533fb9059b5abb87e6a32d8e2d80357a 100644 (file)
@@ -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);
index 2190f42da0eec65e76833f8ed44dc38772e33439..57b64f0dfecdd1dfb580a1ba44b41a8db75f96e1 100644 (file)
@@ -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
index 7b0674d11eebbe4f9b0dc2cfcc559f945b2731a9..edacec1c571e51926caa0b421ff12a8b14c2354d 100644 (file)
@@ -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
index 0afb22149e292060b31fd7c8792a14b8b1e19f2c..f797413b99998485229029471a23d97c1e918cd4 100644 (file)
@@ -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,
index 75a9089fc5506b809c520fde4332ab6c5162cde8..053b13ce665ef6ea42e75740b20a1b700004456e 100644 (file)
@@ -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
index 34f91bdf019594610f055ed819667c7f542de7e5..40d756583720e92596d018c8add342fb031d58aa 100644 (file)
@@ -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.
 //
index 9845e6f82d75eca76ee2fb6eac0e112c6f7565ca..66dbbe1f2c8d8432ca64430b56386b639b8c4e43 100644 (file)
@@ -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
index da41047618e469212de56a6a9a7ae8cdb1c52700..629cef4011c7cddaa688e2e58821cdcfae19bb63 100644 (file)
@@ -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) {
index 8b53f293d35e48ce1695317170709dd2d6e0f7ee..9df59a515e695d6cfb64845d533d00e1a759b102 100644 (file)
@@ -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
index 059f7940a04dc23984f370397c4de623d38bd751..f9e6ccba326510337c05b98c13396b1cdcf35878 100644 (file)
@@ -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.
 
index c9840febb462663f13c49ca524b344a78ee991c3..7979dc668450c13c5dcb86b4df0bf77d8bd7532f 100644 (file)
@@ -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
index 0b24ae6288ccd63f1a32b3a19da892aa7bbcb9b4..d9126abb9759f237d8f64e6b2a0e24010fbbfaa6 100644 (file)
@@ -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<Logger> Formatter;
 
index 0905e9812205066fe6b550e4c3d55a431579d6c5..c705aaeecdc46f21b8a22daa581815736f0b4a43 100644 (file)
@@ -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
 #include <stdarg.h>
 #include <stdio.h>
 #include <cstring>
+#include <sstream>
 #include <boost/lexical_cast.hpp>
 #include <boost/static_assert.hpp>
 #include <boost/algorithm/string.hpp>
 
+#include <log4cplus/version.h>
 #include <log4cplus/configurator.h>
 #include <log4cplus/loggingmacros.h>
 
@@ -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) {
index d63141fb21ae69b29d0679026b2ce00ad7df654e..3e47b62ae0a1f82676c752351e95a12be1580d32 100644 (file)
@@ -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_);
index 2848b541421a23dba30b01f7a523dfc7623cf6a5..b9cae00661d7859a312dc1bb2048cefe0986e495 100644 (file)
@@ -48,6 +48,11 @@ public:
     }
 };
 
+// Check version
+
+TEST_F(LoggerTest, Version) {
+    EXPECT_NO_THROW(Logger::getVersion());
+}
 
 // Checks that the logger is named correctly.