]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5074] Created libkea-process library.
authorMarcin Siodelski <marcin@isc.org>
Wed, 30 Nov 2016 12:38:18 +0000 (13:38 +0100)
committerMarcin Siodelski <marcin@isc.org>
Thu, 1 Dec 2016 11:40:12 +0000 (12:40 +0100)
39 files changed:
configure.ac
src/bin/d2/.gitignore
src/bin/d2/Makefile.am
src/bin/d2/d2_cfg_mgr.h
src/bin/d2/d2_config.h
src/bin/d2/d2_controller.cc
src/bin/d2/d2_controller.h
src/bin/d2/d2_messages.mes
src/bin/d2/d2_process.h
src/bin/d2/tests/Makefile.am
src/bin/d2/tests/d2_cfg_mgr_unittests.cc
src/bin/d2/tests/d2_controller_unittests.cc
src/bin/d2/tests/d2_process_tests.sh.in
src/bin/d2/tests/d2_process_unittests.cc
src/bin/d2/tests/d2_update_mgr_unittests.cc
src/bin/keactrl/tests/keactrl_tests.sh.in
src/lib/Makefile.am
src/lib/process/.gitignore [new file with mode: 0644]
src/lib/process/Makefile.am [new file with mode: 0644]
src/lib/process/d2_log.cc [new file with mode: 0644]
src/lib/process/d2_log.h [new file with mode: 0644]
src/lib/process/d_cfg_mgr.cc [moved from src/bin/d2/d_cfg_mgr.cc with 98% similarity]
src/lib/process/d_cfg_mgr.h [moved from src/bin/d2/d_cfg_mgr.h with 100% similarity]
src/lib/process/d_controller.cc [moved from src/bin/d2/d_controller.cc with 94% similarity]
src/lib/process/d_controller.h [moved from src/bin/d2/d_controller.h with 99% similarity]
src/lib/process/d_process.h [moved from src/bin/d2/d_process.h with 98% similarity]
src/lib/process/io_service_signal.cc [moved from src/bin/d2/io_service_signal.cc with 94% similarity]
src/lib/process/io_service_signal.h [moved from src/bin/d2/io_service_signal.h with 100% similarity]
src/lib/process/process_messages.mes [new file with mode: 0644]
src/lib/process/spec_config.h.pre.in [moved from src/bin/d2/spec_config.h.pre.in with 100% similarity]
src/lib/process/tests/.gitignore [new file with mode: 0644]
src/lib/process/tests/Makefile.am [new file with mode: 0644]
src/lib/process/tests/d_cfg_mgr_unittests.cc [moved from src/bin/d2/tests/d_cfg_mgr_unittests.cc with 99% similarity]
src/lib/process/tests/d_controller_unittests.cc [moved from src/bin/d2/tests/d_controller_unittests.cc with 99% similarity]
src/lib/process/tests/io_service_signal_unittests.cc [moved from src/bin/d2/tests/io_service_signal_unittests.cc with 98% similarity]
src/lib/process/tests/run_unittests.cc [new file with mode: 0644]
src/lib/process/testutils/Makefile.am [new file with mode: 0644]
src/lib/process/testutils/d_test_stubs.cc [moved from src/bin/d2/tests/d_test_stubs.cc with 98% similarity]
src/lib/process/testutils/d_test_stubs.h [moved from src/bin/d2/tests/d_test_stubs.h with 99% similarity]

index 23c438bde559927e5b2a252665c7ac45e72c563d..ebb259e8b1c825054900ca7237a7000d8ac9db2f 100644 (file)
@@ -1498,7 +1498,6 @@ AC_CONFIG_FILES([compatcheck/Makefile
                  src/Makefile
                  src/bin/Makefile
                  src/bin/d2/Makefile
-                 src/bin/d2/spec_config.h.pre
                  src/bin/d2/tests/Makefile
                  src/bin/d2/tests/d2_process_tests.sh
                  src/bin/d2/tests/test_data_files_config.h
@@ -1585,6 +1584,10 @@ AC_CONFIG_FILES([compatcheck/Makefile
                  src/lib/log/tests/logger_lock_test.sh
                  src/lib/log/tests/severity_test.sh
                  src/lib/log/tests/tempdir.h
+                 src/lib/process/Makefile
+                 src/lib/process/spec_config.h.pre
+                 src/lib/process/tests/Makefile
+                 src/lib/process/testutils/Makefile
                  src/lib/testutils/Makefile
                  src/lib/testutils/dhcp_test_lib.sh
                  src/lib/stats/Makefile
index b4c3aa3a7747320224e3a29521ab279cddaa1073..06446ddf48495bfa51515177d579b7101a43a0d3 100644 (file)
@@ -2,6 +2,4 @@
 /kea-dhcp-ddns.8
 /d2_messages.cc
 /d2_messages.h
-/spec_config.h
-/spec_config.h.pre
 /s-messages
index 0b4e7d58626583c41fe3945fab6a6f6a92ed1f33..17c240f4989ea2e8ba7508e02d29b8de27abe3c4 100644 (file)
@@ -19,7 +19,7 @@ if USE_STATIC_LINK
 AM_LDFLAGS = -static
 endif
 
-CLEANFILES  = *.gcno *.gcda spec_config.h d2_messages.h d2_messages.cc s-messages
+CLEANFILES  = *.gcno *.gcda d2_messages.h d2_messages.cc s-messages
 
 man_MANS = kea-dhcp-ddns.8
 DISTCLEANFILES = $(man_MANS)
@@ -47,25 +47,19 @@ $(man_MANS):
 
 endif
 
-spec_config.h: spec_config.h.pre
-       $(SED) -e "s|@@LOCALSTATEDIR@@|$(localstatedir)|" spec_config.h.pre >$@
-
 d2_messages.h d2_messages.cc: s-messages
 
 s-messages: d2_messages.mes
        $(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/bin/d2/d2_messages.mes
        touch $@
 
-BUILT_SOURCES = spec_config.h d2_messages.h d2_messages.cc
+BUILT_SOURCES = d2_messages.h d2_messages.cc
 
 # convenience archive
 
 noinst_LTLIBRARIES = libd2.la
 
 libd2_la_SOURCES  =
-libd2_la_SOURCES += d_process.h
-libd2_la_SOURCES += d_controller.cc d_controller.h
-libd2_la_SOURCES += d_cfg_mgr.cc d_cfg_mgr.h
 libd2_la_SOURCES += d2_log.cc d2_log.h
 libd2_la_SOURCES += d2_process.cc d2_process.h
 libd2_la_SOURCES += d2_config.cc d2_config.h
@@ -75,13 +69,11 @@ libd2_la_SOURCES += d2_update_message.cc d2_update_message.h
 libd2_la_SOURCES += d2_update_mgr.cc d2_update_mgr.h
 libd2_la_SOURCES += d2_zone.cc d2_zone.h
 libd2_la_SOURCES += dns_client.cc dns_client.h
-libd2_la_SOURCES += io_service_signal.cc io_service_signal.h
 libd2_la_SOURCES += labeled_value.cc labeled_value.h
 libd2_la_SOURCES += nc_add.cc nc_add.h
 libd2_la_SOURCES += nc_remove.cc nc_remove.h
 libd2_la_SOURCES += nc_trans.cc nc_trans.h
 libd2_la_SOURCES += state_model.cc state_model.h
-
 libd2_la_SOURCES += d2_controller.cc d2_controller.h
 
 nodist_libd2_la_SOURCES = d2_messages.h d2_messages.cc
@@ -93,6 +85,7 @@ 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
index b3a2dd4bf774737a58208662efc450d86e520ac9..3a39786c03cae9a2d6d593a81a5cbf18420426aa 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -10,8 +10,8 @@
 #include <asiolink/io_service.h>
 #include <cc/data.h>
 #include <exceptions/exceptions.h>
-#include <d2/d_cfg_mgr.h>
 #include <d2/d2_config.h>
+#include <process/d_cfg_mgr.h>
 
 #include <stdint.h>
 #include <string>
index 197574dc3b9dba70115da6774ae36c0355f16779..d890abf19aba640b5535122b256e828839539375 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -9,10 +9,10 @@
 
 #include <asiolink/io_service.h>
 #include <cc/data.h>
-#include <d2/d_cfg_mgr.h>
 #include <dhcpsrv/parsers/dhcp_parsers.h>
 #include <dns/tsig.h>
 #include <exceptions/exceptions.h>
+#include <process/d_cfg_mgr.h>
 
 #include <boost/foreach.hpp>
 
index 8a4561262819f93e8a1a63b859d0d019b4745c9b..090f5260d444bf6cef2fb0ab8edfea40c7b16a59 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -8,7 +8,7 @@
 
 #include <d2/d2_controller.h>
 #include <d2/d2_process.h>
-#include <d2/spec_config.h>
+#include <process/spec_config.h>
 
 #include <stdlib.h>
 
index 661cb55383e6ee9c05fb9d24254cd1d14f756430..437e7c8074c07be296a69bb2166553769fd4657b 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -7,7 +7,7 @@
 #ifndef D2_CONTROLLER_H
 #define D2_CONTROLLER_H
 
-#include <d2/d_controller.h>
+#include <process/d_controller.h>
 
 namespace isc {
 namespace d2 {
index 2491d2d37f31ded7168be180fac70f8b8df6d03d..736e8df2fd5e1b684a0c3b4742c101ed3bdbcf88 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+# Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 #
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -6,83 +6,6 @@
 
 $NAMESPACE isc::d2
 
-% DCTL_CCSESSION_ENDING %1 ending control channel session
-This debug message is issued just before the controller attempts
-to disconnect from its session with the Kea control channel.
-
-% DCTL_CCSESSION_STARTING %1 starting control channel session, specfile: %2
-This debug message is issued just before the controller attempts
-to establish a session with the Kea control channel.
-
-% DCTL_COMMAND_RECEIVED %1 received command: %2, arguments: %3
-A debug message listing the command (and possible arguments) received
-from the Kea control system by the controller.
-
-% DCTL_CONFIG_COMPLETE server has completed configuration: %1
-This is an informational message announcing the successful processing of a
-new configuration. It is output during server startup, and when an updated
-configuration is committed by the administrator.  Additional information
-may be provided.
-
-% DCTL_CONFIG_FILE_LOAD_FAIL %1 reason: %2
-This fatal error message indicates that the application attempted to load its
-initial configuration from file and has failed. The service will exit.
-
-% DCTL_CONFIG_LOAD_FAIL %1 configuration failed to load: %2
-This critical error message indicates that the initial application
-configuration has failed. The service will start, but will not
-process requests until the configuration has been corrected.
-
-% DCTL_CONFIG_START parsing new configuration: %1
-A debug message indicating that the application process has received an
-updated configuration and has passed it to its configuration manager
-for parsing.
-
-% DCTL_CONFIG_STUB %1 configuration stub handler called
-This debug message is issued when the dummy handler for configuration
-events is called.  This only happens during initial startup.
-
-% DCTL_CONFIG_UPDATE %1 updated configuration received: %2
-A debug message indicating that the controller has received an
-updated configuration from the Kea configuration system.
-
-% DCTL_INIT_PROCESS %1 initializing the application
-This debug message is issued just before the controller attempts
-to create and initialize its application instance.
-
-% DCTL_INIT_PROCESS_FAIL %1 application initialization failed: %2
-This error message is issued if the controller could not initialize the
-application and will exit.
-
-% DCTL_NOT_RUNNING %1 application instance is not running
-A warning message is issued when an attempt is made to shut down the
-application when it is not running.
-
-% DCTL_PARSER_FAIL : %1
-On receipt of a new configuration, the server failed to create a parser to
-decode the contents of the named configuration element, or the creation
-succeeded but the parsing actions and committal of changes failed.
-The reason for the failure is given in the message.
-
-% DCTL_PROCESS_FAILED %1 application execution failed: %2
-The controller has encountered a fatal error while running the
-application and is terminating. The reason for the failure is
-included in the message.
-
-% DCTL_RUN_PROCESS %1 starting application event loop
-This debug message is issued just before the controller invokes
-the application run method.
-
-% DCTL_SESSION_FAIL %1 controller failed to establish Kea session: %1
-The controller has failed to establish communication with the rest of
-Kea and will exit.
-
-% DCTL_STANDALONE %1 skipping message queue, running standalone
-This is a debug message indicating that the controller is running in the
-application in standalone mode. This means it will not connected to the Kea
-message queue. Standalone mode is only useful during program development,
-and should not be used in a production environment.
-
 % DHCP_DDNS_ADD_FAILED DHCP_DDNS Request ID %1: Transaction outcome %2
 This is an error message issued after DHCP_DDNS attempts to submit DNS mapping
 entry additions have failed.  The precise reason for the failure should be
@@ -106,16 +29,6 @@ the DHCP_DDNS process name, the second contains the PID and PID file.
 This is a debug message that indicates that the application has DHCP_DDNS
 requests in the queue but is working as many concurrent requests as allowed.
 
-% DHCP_DDNS_CFG_FILE_RELOAD_ERROR configuration reload failed: %1, reverting to current configuration.
-This is an error message indicating that the application attempted to reload
-its configuration from file and encountered an error.  This is likely due to
-invalid content in the configuration file.  The application should continue
-to operate under its current configuration.
-
-% DHCP_DDNS_CFG_FILE_RELOAD_SIGNAL_RECVD OS signal %1 received, reloading configuration from file: %2
-This is an informational message indicating the application has received a signal
-instructing it to reload its configuration from file.
-
 % DHCP_DDNS_CLEARED_FOR_SHUTDOWN application has met shutdown criteria for shutdown type: %1
 This is a debug message issued when the application has been instructed
 to shutdown and has met the required criteria to exit.
@@ -280,15 +193,6 @@ no configured DDNS domains in the DHCP_DDNS configuration.  Either the DHCP_DDNS
 configuration needs to be updated or the source of the FQDN itself should be
 investigated.
 
-% DHCP_DDNS_PID_FILE_ERROR %1 could not create a PID file: %2
-This is an error message that occurs when DHCP_DDNS is unable to create
-its PID file.  The log message should contain details sufficient to
-determine the underlying cause.  The most likely culprits are that
-some portion of the pathname does not exist or a permissions issue. The
-default path is determined by --localstatedir configure parameter but
-may be overridden by setting environment variable, KEA_PIDFILE_DIR.  The
-first argument is the DHCP_DDNS process name.
-
 % DHCP_DDNS_PROCESS_INIT application init invoked
 This is a debug message issued when the DHCP-DDNS application enters
 its initialization method.
@@ -448,33 +352,15 @@ reverse update will not performed.
 This is a debug message issued when the DHCP-DDNS server exits its
 event lo
 
-% DHCP_DDNS_SHUTDOWN DHCP-DDNS has shut down
-This is an informational message indicating that the DHCP-DDNS service
-has shut down.
-
 % DHCP_DDNS_SHUTDOWN_COMMAND application received shutdown command with args: %1
 This is a debug message issued when the application has been instructed
 to shut down by the controller.
 
-% DHCP_DDNS_SHUTDOWN_SIGNAL_RECVD OS signal %1 received, starting shutdown
-This is a debug message indicating the application has received a signal
-instructing it to shutdown.
-
-% DHCP_DDNS_SIGNAL_ERROR signal handler for signal %1, threw an unexpected exception: %2
-This is an error message indicating that the application encountered an unexpected
-error after receiving a signal.  This is a programmatic error and should be
-reported.  While The application will likely continue to operating, it may be
-unable to respond correctly to signals.
-
 % DHCP_DDNS_STARTED Kea DHCP-DDNS server version %1 started
 This informational message indicates that the DHCP-DDNS server has
 processed all configuration information and is ready to begin processing.
 The version is also printed.
 
-% DHCP_DDNS_STARTING DHCP-DDNS starting, pid: %1, version: %2
-This is an informational message issued when controller for the
-service first starts. Version is also reported.
-
 % DHCP_DDNS_STARTING_TRANSACTION Request ID %1:
 This is a debug message issued when DHCP-DDNS has begun a transaction for
 a given request.
@@ -491,12 +377,6 @@ message but the attempt to send it suffered an unexpected error. This is most
 likely a programmatic error, rather than a communications issue. Some or all
 of the DNS updates requested as part of this request did not succeed.
 
-% DHCP_DDNS_UNSUPPORTED_SIGNAL ignoring reception of unsupported signal: %1
-This is a debug message indicating that the application received an
-unsupported signal.  This is a programming error indicating that the
-application has registered to receive the signal but no associated
-processing logic has been added.
-
 % DHCP_DDNS_UPDATE_REQUEST_SENT Request ID %1: %2 to server: %3
 This is a debug message issued when DHCP_DDNS sends a DNS request to a DNS
 server.
index 2ec6b520e8c85cf30ec8dae8d1eda2fd39ee9696..49d3841a7619726a0e851af707def46223671684 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -7,9 +7,9 @@
 #ifndef D2_PROCESS_H
 #define D2_PROCESS_H
 
-#include <d2/d_process.h>
 #include <d2/d2_queue_mgr.h>
 #include <d2/d2_update_mgr.h>
+#include <process/d_process.h>
 
 namespace isc {
 namespace d2 {
index dc18d81d5edbdfea0b560d0b536f13297c413ed1..7ab1c65fe7971660a732a5cf156a149c2f549caf 100644 (file)
@@ -42,26 +42,21 @@ if HAVE_GTEST
 
 TESTS += d2_unittests
 
-d2_unittests_SOURCES = d_test_stubs.cc d_test_stubs.h
-d2_unittests_SOURCES += d2_unittests.cc
+d2_unittests_SOURCES  = d2_unittests.cc
 d2_unittests_SOURCES += d2_process_unittests.cc
-d2_unittests_SOURCES += d_cfg_mgr_unittests.cc
 d2_unittests_SOURCES += d2_cfg_mgr_unittests.cc
 d2_unittests_SOURCES += d2_queue_mgr_unittests.cc
 d2_unittests_SOURCES += d2_update_message_unittests.cc
 d2_unittests_SOURCES += d2_update_mgr_unittests.cc
 d2_unittests_SOURCES += d2_zone_unittests.cc
 d2_unittests_SOURCES += dns_client_unittests.cc
-d2_unittests_SOURCES += io_service_signal_unittests.cc
 d2_unittests_SOURCES += labeled_value_unittests.cc
 d2_unittests_SOURCES += nc_add_unittests.cc
 d2_unittests_SOURCES += nc_remove_unittests.cc
 d2_unittests_SOURCES += nc_test_utils.cc nc_test_utils.h
 d2_unittests_SOURCES += nc_trans_unittests.cc
 d2_unittests_SOURCES += state_model_unittests.cc
-
 d2_unittests_SOURCES += d2_controller_unittests.cc
-d2_unittests_SOURCES += d_controller_unittests.cc
 
 d2_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
 d2_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS)
@@ -77,7 +72,9 @@ endif
 d2_unittests_LDFLAGS += $(GTEST_LDFLAGS)
 
 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
index 1e90575ac1e64f8c62cd9034bf08eb4796610556..d8e1072923becc9981126bc5f9ab3e4930951fd2 100644 (file)
@@ -9,10 +9,10 @@
 #include <config/module_spec.h>
 #include <d2/d2_config.h>
 #include <d2/d2_cfg_mgr.h>
-#include <d_test_stubs.h>
+#include <dhcpsrv/testutils/config_result_check.h>
+#include <process/testutils/d_test_stubs.h>
 #include <test_data_files_config.h>
 #include <util/encode/base64.h>
-#include <dhcpsrv/testutils/config_result_check.h>
 
 #include <boost/foreach.hpp>
 #include <boost/scoped_ptr.hpp>
index f51ebcf19f6206939fe14a7cdadf948dc2b604cd..08084bbe8f760fc88c3ee3eeec8a19ea47faeacf 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -7,10 +7,10 @@
 #include <config.h>
 
 #include <cc/command_interpreter.h>
-#include <d_test_stubs.h>
 #include <d2/d2_controller.h>
 #include <d2/d2_process.h>
-#include <d2/spec_config.h>
+#include <process/spec_config.h>
+#include <process/testutils/d_test_stubs.h>
 
 #include <boost/pointer_cast.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
@@ -232,7 +232,7 @@ TEST_F(D2ControllerTest, invalidConfigReload) {
 
     // Context is still available post launch.
     // Check to see that our configuration matches the original per
-    // valid_d2_config (see d_test_stubs.cc)
+    // valid_d2_config (see src/lib/process/testutils/d_test_stubs.cc)
     D2CfgMgrPtr d2_cfg_mgr = getD2CfgMgr();
     D2ParamsPtr d2_params = d2_cfg_mgr->getD2Params();
     ASSERT_TRUE(d2_params);
index db77362da1bf4c0edac9641306bd52d00a7e08bb..61127315c9adcd0929ac4aef6e5c81ede262e030 100644 (file)
@@ -115,7 +115,7 @@ dynamic_reconfiguration_test() {
     send_signal 1 ${bin}
 
     # Wait up to 10s for the D2Controller to log reload signal received.
-    wait_for_message 10 "DHCP_DDNS_CFG_FILE_RELOAD_SIGNAL_RECVD"  1
+    wait_for_message 10 "DCTL_CFG_FILE_RELOAD_SIGNAL_RECVD"  1
     if [ ${_WAIT_FOR_MESSAGE} -eq 0 ]; then
         printf "ERROR: D2 did report the reload signal receipt.\n"
         clean_exit 1
@@ -124,7 +124,7 @@ dynamic_reconfiguration_test() {
     # After receiving SIGHUP the server should try to reconfigure itself.
     # The configuration provided is invalid so it should result in
     # reconfiguration failure but the server should still be running.
-    wait_for_message 10 "DHCP_DDNS_CFG_FILE_RELOAD_ERROR" 1
+    wait_for_message 10 "DCTL_CFG_FILE_RELOAD_ERROR" 1
     if [ ${_WAIT_FOR_MESSAGE} -eq 0 ]; then
         printf "ERROR: D2 did not report reload error.\n"
         clean_exit 1
@@ -213,7 +213,7 @@ shutdown_test() {
     send_signal ${signum} ${bin}
 
     # Now wait for process to log that it is exiting.
-    wait_for_message 10 "DHCP_DDNS_SHUTDOWN" 1
+    wait_for_message 10 "DCTL_SHUTDOWN" 1
     if [ ${_WAIT_FOR_MESSAGE} -eq 0 ]; then
         printf "ERROR: DHCP-DDNS did not log shutdown.\n"
         clean_exit 1
@@ -227,7 +227,7 @@ shutdown_test() {
     test_finish 0
 }
 
-server_pid_file_test "${CONFIG}" DHCP_DDNS_ALREADY_RUNNING
+server_pid_file_test "${CONFIG}" DCTL_ALREADY_RUNNING
 dynamic_reconfiguration_test
 shutdown_test "dhcp-ddns.sigterm_test" 15
 shutdown_test "dhcp-ddns.sigint_test" 2
index fb37f7c730923c3fc256a831e59ce27340df533d..965aa0fb54269ff155c1dd214849e60110390522 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -10,7 +10,7 @@
 #include <cc/command_interpreter.h>
 #include <d2/d2_process.h>
 #include <dhcp_ddns/ncr_io.h>
-#include <d_test_stubs.h>
+#include <process/testutils/d_test_stubs.h>
 
 #include <boost/bind.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
index 9574b6f8531c56761d4df955a778710a1038d249..883c6fab11b56de86d1847f4cba46c82f5061961 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -8,9 +8,9 @@
 
 #include <asiolink/io_service.h>
 #include <d2/d2_update_mgr.h>
-#include <util/time_utilities.h>
-#include <d_test_stubs.h>
 #include <nc_test_utils.h>
+#include <process/testutils/d_test_stubs.h>
+#include <util/time_utilities.h>
 
 #include <boost/function.hpp>
 #include <boost/bind.hpp>
index 0533f3caf3a9326c5baa6c4d4d25d6badd011790..774742429c559ecad36c43431b6494f92f2e3cc4 100644 (file)
@@ -211,7 +211,7 @@ Expected wait_for_message return %d, returned %d."
 Expected wait_for_message return %d, returned %d."
 
     # Wait up to 10s for the D2 server to stop.
-    wait_for_message 10 "DHCP_DDNS_SHUTDOWN" 1
+    wait_for_message 10 "DCTL_SHUTDOWN" 1
     assert_eq 1 ${_WAIT_FOR_MESSAGE} \
         "Timeout waiting for ${d2_name} to shutdown. \
 Expected wait_for_message return %d, returned %d."
@@ -315,7 +315,7 @@ Expected wait_for_message return %d, returned %d."
 Expected wait_for_message return %d, returned %d."
 
     # Wait up to 10s for the D2 server to stop.
-    wait_for_message 10 "DHCP_DDNS_SHUTDOWN" 1
+    wait_for_message 10 "DCTL_SHUTDOWN" 1
     assert_eq 1 ${_WAIT_FOR_MESSAGE} \
         "Timeout waiting for ${d2_name} to shutdown. \
 Expected wait_for_message return %d, returned %d."
@@ -627,7 +627,7 @@ Expected wait_for_message return %d, returned %d."
 Expected wait_for_message return %d, returned %d."
 
     # Wait up to 10s for the D2 server to stop.
-    wait_for_message 10 "DHCP_DDNS_SHUTDOWN" 1
+    wait_for_message 10 "DCTL_SHUTDOWN" 1
     assert_eq 1 ${_WAIT_FOR_MESSAGE} \
         "Timeout waiting for ${d2_name} to shutdown. \
 Expected wait_for_message return %d, returned %d."
@@ -781,7 +781,7 @@ Expected wait_for_message return %d, returned %d."
 Expected wait_for_message return %d, returned %d."
 
     # Wait up to 10s for the d2 server to stop.
-    wait_for_message 10 "DHCP_DDNS_SHUTDOWN" 1
+    wait_for_message 10 "DCTL_SHUTDOWN" 1
     assert_eq 1 ${_WAIT_FOR_MESSAGE} \
         "Timeout waiting for ${d2_name} to shutdown. \
 Expected wait_for_message return %d, returned %d."
@@ -920,7 +920,7 @@ Expected wait_for_message return %d, returned %d."
     assert_eq 0 ${ret} "Expected keactrl to return %d, returned value was %d."
 
     # Wait up to 10s for the D2 server to stop.
-    wait_for_message 10 "DHCP_DDNS_SHUTDOWN" 1
+    wait_for_message 10 "DCTL_SHUTDOWN" 1
     assert_eq 1 ${_WAIT_FOR_MESSAGE} \
         "Timeout waiting for ${d2_name} to shutdown. \
 Expected wait_for_message return %d, returned %d."
index 99d35053f39e525e4842f78ead2c2163d751599d..dbbdb8f11bb32da267b1644d490cf7e1399e4a71 100644 (file)
@@ -1,3 +1,3 @@
 # The following build order must be maintained.
 SUBDIRS = exceptions util log cryptolink dns cc hooks asiolink testutils dhcp config \
-             stats asiodns dhcp_ddns eval dhcpsrv cfgrpt
+             stats asiodns dhcp_ddns eval dhcpsrv cfgrpt process
diff --git a/src/lib/process/.gitignore b/src/lib/process/.gitignore
new file mode 100644 (file)
index 0000000..8dabb6a
--- /dev/null
@@ -0,0 +1,5 @@
+/process_messages.cc
+/process_messages.h
+/spec_config.h
+/spec_config.h.pre
+/s-messages
diff --git a/src/lib/process/Makefile.am b/src/lib/process/Makefile.am
new file mode 100644 (file)
index 0000000..04eb4a3
--- /dev/null
@@ -0,0 +1,72 @@
+SUBDIRS = . testutils tests
+
+AM_CPPFLAGS  = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
+AM_CPPFLAGS += $(BOOST_INCLUDES)
+
+if HAVE_MYSQL
+AM_CPPFLAGS += $(MYSQL_CPPFLAGS)
+endif
+if HAVE_PGSQL
+AM_CPPFLAGS += $(PGSQL_CPPFLAGS)
+endif
+if HAVE_CQL
+AM_CPPFLAGS += $(CQL_CPPFLAGS)
+endif
+
+AM_CXXFLAGS  = $(KEA_CXXFLAGS)
+
+# Define rule to build logging source files from message file
+process_messages.h process_messages.cc: s-messages
+
+s-messages: process_messages.mes
+       $(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/lib/process/process_messages.mes
+       touch $@
+
+spec_config.h: spec_config.h.pre
+       $(SED) -e "s|@@LOCALSTATEDIR@@|$(localstatedir)|" spec_config.h.pre >$@
+
+# Tell automake that the message files are built as part of the build process
+# (so that they are built before the main library is built).
+BUILT_SOURCES = spec_config.h process_messages.h process_messages.cc
+
+# Ensure that the message file is included in the distribution
+EXTRA_DIST = process_messages.mes
+
+# Get rid of generated message files on a clean
+CLEANFILES = *.gcno *.gcda spec_config.h process_messages.h process_messages.cc s-messages
+
+lib_LTLIBRARIES = libkea-process.la
+libkea_process_la_SOURCES  = d2_log.cc d2_log.h
+libkea_process_la_SOURCES += d_cfg_mgr.cc d_cfg_mgr.h
+libkea_process_la_SOURCES += d_controller.cc d_controller.h
+libkea_process_la_SOURCES += d_process.h
+libkea_process_la_SOURCES += io_service_signal.cc io_service_signal.h
+
+nodist_libkea_process_la_SOURCES = process_messages.cc process_messages.h
+
+libkea_process_la_CXXFLAGS = $(AM_CXXFLAGS)
+libkea_process_la_CPPFLAGS = $(AM_CPPFLAGS)
+libkea_process_la_LDFLAGS  = $(AM_LDFLAGS)
+libkea_process_la_LDFLAGS += -no-undefined -version-info 1:0:0
+
+libkea_process_la_LIBADD  =
+libkea_process_la_LIBADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
+libkea_process_la_LIBADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
+libkea_process_la_LIBADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
+libkea_process_la_LIBADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
+libkea_process_la_LIBADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
+libkea_process_la_LIBADD += $(top_builddir)/src/lib/cc/libkea-cc.la
+libkea_process_la_LIBADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
+libkea_process_la_LIBADD += $(top_builddir)/src/lib/log/libkea-log.la
+libkea_process_la_LIBADD += $(top_builddir)/src/lib/util/libkea-util.la
+libkea_process_la_LIBADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
+libkea_process_la_LIBADD += $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS) $(BOOST_LIBS)
+
+# Specify the headers for copying into the installation directory tree.
+libkea_process_includedir = $(pkgincludedir)/process
+libkea_process_include_HEADERS = \
+       d2_log.h \
+       d_cfg_mgr.h \
+       d_controller.h \
+       d_process.h \
+       io_service_signal.h
diff --git a/src/lib/process/d2_log.cc b/src/lib/process/d2_log.cc
new file mode 100644 (file)
index 0000000..456b84c
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+/// Defines the logger used by the top-level component of kea-dhcp-ddns.
+
+#include <process/d2_log.h>
+
+namespace isc {
+namespace d2 {
+
+/// @brief Defines the logger used within libkea-process library.
+isc::log::Logger dctl_logger("dhcpddns");
+
+} // namespace d2
+} // namespace isc
+
diff --git a/src/lib/process/d2_log.h b/src/lib/process/d2_log.h
new file mode 100644 (file)
index 0000000..6aecd7c
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#ifndef D2_LOG_H
+#define D2_LOG_H
+
+#include <log/logger_support.h>
+#include <log/macros.h>
+#include <process/process_messages.h>
+
+namespace isc {
+namespace d2 {
+
+/// Define the loggers used within libkea-process library.
+extern isc::log::Logger dctl_logger;
+
+} // namespace d2
+} // namespace isc
+
+#endif // D2_LOG_H
similarity index 98%
rename from src/bin/d2/d_cfg_mgr.cc
rename to src/lib/process/d_cfg_mgr.cc
index c7e9d9e25b722b1dc1d8743fb63aa4033f5d68a4..b401512369752b78b6f25c2559b2bb55e92848eb 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -7,10 +7,10 @@
 #include <config.h>
 
 #include <cc/command_interpreter.h>
-#include <d2/d2_log.h>
 #include <dhcp/libdhcp++.h>
-#include <d2/d_cfg_mgr.h>
 #include <dhcpsrv/parsers/dhcp_parsers.h>
+#include <process/d2_log.h>
+#include <process/d_cfg_mgr.h>
 #include <util/encode/hex.h>
 #include <util/strutil.h>
 
similarity index 94%
rename from src/bin/d2/d_controller.cc
rename to src/lib/process/d_controller.cc
index 00e1eabfe842988621f6963769b16c0160ec8dca..a775babf61682e46f79d85b649a23d6183f6eefb 100644 (file)
@@ -5,15 +5,15 @@
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #include <config.h>
-#include <d2/d2_log.h>
 #include <cc/command_interpreter.h>
-#include <d2/d_controller.h>
-#include <exceptions/exceptions.h>
-#include <log/logger_support.h>
-#include <dhcpsrv/cfgmgr.h>
+#include <cfgrpt/config_report.h>
 #include <cryptolink/cryptolink.h>
+#include <dhcpsrv/cfgmgr.h>
+#include <exceptions/exceptions.h>
 #include <log/logger.h>
-#include <cfgrpt/config_report.h>
+#include <log/logger_support.h>
+#include <process/d2_log.h>
+#include <process/d_controller.h>
 
 #ifdef HAVE_MYSQL
 #include <dhcpsrv/mysql_lease_mgr.h>
@@ -87,19 +87,18 @@ DControllerBase::launch(int argc, char* argv[], const bool test_mode) {
     try {
         createPIDFile();
     } catch (const dhcp::DaemonPIDExists& ex) {
-        LOG_FATAL(dctl_logger, DHCP_DDNS_ALREADY_RUNNING)
+        LOG_FATAL(dctl_logger, DCTL_ALREADY_RUNNING)
                   .arg(bin_name_).arg(ex.what());
         isc_throw (LaunchError, "Launch Failed: " << ex.what());
     } catch (const std::exception& ex) {
-        LOG_FATAL(dctl_logger, DHCP_DDNS_PID_FILE_ERROR)
+        LOG_FATAL(dctl_logger, DCTL_PID_FILE_ERROR)
                   .arg(app_name_).arg(ex.what());
         isc_throw (LaunchError, "Launch failed: " << ex.what());
     }
 
-    // Log the starting of the service.  Although this is the controller
-    // module, use a "DHCP_DDNS_" prefix to the module (to conform to the
-    // principle of least astonishment).
-    LOG_INFO(dctl_logger, DHCP_DDNS_STARTING).arg(getpid()).arg(VERSION);
+    // Log the starting of the service.
+    LOG_INFO(dctl_logger, DCTL_STARTING)
+        .arg(app_name_).arg(getpid()).arg(VERSION);
     try {
         // Step 2 is to create and initialize the application process object.
         initProcess();
@@ -136,9 +135,9 @@ DControllerBase::launch(int argc, char* argv[], const bool test_mode) {
                    "Application process event loop failed: " << ex.what());
     }
 
-    // All done, so bail out.  Log the event (using a DHCP_DDNS_ prefix
-    // for the same reason as used for DHCP_DDNS_STARTING).
-    LOG_INFO(dctl_logger, DHCP_DDNS_SHUTDOWN);
+    // All done, so bail out.
+    LOG_INFO(dctl_logger, DCTL_SHUTDOWN)
+        .arg(app_name_).arg(getpid()).arg(VERSION);
 }
 
 void
@@ -414,14 +413,14 @@ DControllerBase::processSignal(int signum) {
     switch (signum) {
         case SIGHUP:
         {
-            LOG_INFO(dctl_logger, DHCP_DDNS_CFG_FILE_RELOAD_SIGNAL_RECVD)
+            LOG_INFO(dctl_logger, DCTL_CFG_FILE_RELOAD_SIGNAL_RECVD)
                      .arg(signum).arg(getConfigFile());
             int rcode;
             isc::data::ConstElementPtr comment = isc::config::
                                                  parseAnswer(rcode,
                                                              configFromFile());
             if (rcode != 0) {
-                LOG_ERROR(dctl_logger, DHCP_DDNS_CFG_FILE_RELOAD_ERROR)
+                LOG_ERROR(dctl_logger, DCTL_CFG_FILE_RELOAD_ERROR)
                           .arg(comment->stringValue());
             }
 
@@ -432,14 +431,14 @@ DControllerBase::processSignal(int signum) {
         case SIGTERM:
         {
             LOG_DEBUG(dctl_logger, DBGLVL_START_SHUT,
-                      DHCP_DDNS_SHUTDOWN_SIGNAL_RECVD).arg(signum);
+                      DCTL_SHUTDOWN_SIGNAL_RECVD).arg(signum);
             isc::data::ElementPtr arg_set;
             executeCommand(SHUT_DOWN_COMMAND, arg_set);
             break;
         }
 
         default:
-            LOG_WARN(dctl_logger, DHCP_DDNS_UNSUPPORTED_SIGNAL).arg(signum);
+            LOG_WARN(dctl_logger, DCTL_UNSUPPORTED_SIGNAL).arg(signum);
             break;
     }
 }
similarity index 99%
rename from src/bin/d2/d_controller.h
rename to src/lib/process/d_controller.h
index 69cbecae741ed8e5013bcd0ee61d278e8115bd9c..071ab7a29f69e4eb43bb19bce0a886ed47d4eeab 100644 (file)
@@ -9,12 +9,12 @@
 
 #include <asiolink/io_service.h>
 #include <cc/data.h>
-#include <d2/d2_log.h>
-#include <d2/d_process.h>
-#include <d2/io_service_signal.h>
 #include <dhcpsrv/daemon.h>
 #include <exceptions/exceptions.h>
 #include <log/logger_support.h>
+#include <process/d2_log.h>
+#include <process/d_process.h>
+#include <process/io_service_signal.h>
 
 #include <boost/shared_ptr.hpp>
 #include <boost/noncopyable.hpp>
similarity index 98%
rename from src/bin/d2/d_process.h
rename to src/lib/process/d_process.h
index afd829f501df58806adaaf3b5cf091e0c8f7819a..6c317d39632c127057a10a35e2f76a6834facae9 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -9,7 +9,7 @@
 
 #include <asiolink/io_service.h>
 #include <cc/data.h>
-#include <d2/d_cfg_mgr.h>
+#include <process/d_cfg_mgr.h>
 
 #include <boost/shared_ptr.hpp>
 
similarity index 94%
rename from src/bin/d2/io_service_signal.cc
rename to src/lib/process/io_service_signal.cc
index 888567654777c17e16d374a4bf6f0651f9c2565a..98c3309fb394518fb69268dbb2bdd2259cd5f980 100644 (file)
@@ -1,12 +1,12 @@
-// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #include <asiolink/interval_timer.h>
-#include <d2/d2_log.h>
-#include <d2/io_service_signal.h>
+#include <process/d2_log.h>
+#include <process/io_service_signal.h>
 
 namespace isc {
 namespace d2 {
@@ -50,7 +50,7 @@ IOSignal::TimerCallback::operator()() {
         handler_(sequence_id_);
     } catch (const std::exception& ex) {
         // We log it and swallow it so we don't undermine IOService::run.
-        LOG_ERROR(dctl_logger, DHCP_DDNS_SIGNAL_ERROR)
+        LOG_ERROR(dctl_logger, DCTL_SIGNAL_ERROR)
                   .arg(sequence_id_).arg(ex.what());
     }
 
diff --git a/src/lib/process/process_messages.mes b/src/lib/process/process_messages.mes
new file mode 100644 (file)
index 0000000..c7c1d3b
--- /dev/null
@@ -0,0 +1,137 @@
+# Copyright (C) 2016 Internet Systems Consortium, Inc. ("ISC")
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+$NAMESPACE isc::d2
+
+% DCTL_ALREADY_RUNNING %1 already running? %2
+This is an error message that occurs when a module encounters a pre-existing
+PID file which contains the PID of a running process.  This most likely
+indicates an attempt to start a second instance of a module using the
+same configuration file.  It is possible, though unlikely, that the PID file
+is a remnant left behind by a server crash or power failure and the PID
+it contains refers to a process other than Kea process.  In such an event,
+it would be necessary to manually remove the PID file.  The first argument is
+the process name, the second contains the PID and PID file.
+
+% DCTL_CCSESSION_ENDING %1 ending control channel session
+This debug message is issued just before the controller attempts
+to disconnect from its session with the Kea control channel.
+
+% DCTL_CCSESSION_STARTING %1 starting control channel session, specfile: %2
+This debug message is issued just before the controller attempts
+to establish a session with the Kea control channel.
+
+% DCTL_COMMAND_RECEIVED %1 received command: %2, arguments: %3
+A debug message listing the command (and possible arguments) received
+from the Kea control system by the controller.
+
+% DCTL_CONFIG_COMPLETE server has completed configuration: %1
+This is an informational message announcing the successful processing of a
+new configuration. It is output during server startup, and when an updated
+configuration is committed by the administrator.  Additional information
+may be provided.
+
+% DCTL_CONFIG_FILE_LOAD_FAIL %1 reason: %2
+This fatal error message indicates that the application attempted to load its
+initial configuration from file and has failed. The service will exit.
+
+% DCTL_CONFIG_LOAD_FAIL %1 configuration failed to load: %2
+This critical error message indicates that the initial application
+configuration has failed. The service will start, but will not
+process requests until the configuration has been corrected.
+
+% DCTL_CONFIG_START parsing new configuration: %1
+A debug message indicating that the application process has received an
+updated configuration and has passed it to its configuration manager
+for parsing.
+
+% DCTL_CONFIG_STUB %1 configuration stub handler called
+This debug message is issued when the dummy handler for configuration
+events is called.  This only happens during initial startup.
+
+% DCTL_CONFIG_UPDATE %1 updated configuration received: %2
+A debug message indicating that the controller has received an
+updated configuration from the Kea configuration system.
+
+% DCTL_INIT_PROCESS %1 initializing the application
+This debug message is issued just before the controller attempts
+to create and initialize its application instance.
+
+% DCTL_INIT_PROCESS_FAIL %1 application initialization failed: %2
+This error message is issued if the controller could not initialize the
+application and will exit.
+
+% DCTL_NOT_RUNNING %1 application instance is not running
+A warning message is issued when an attempt is made to shut down the
+application when it is not running.
+
+% DCTL_PARSER_FAIL : %1
+On receipt of a new configuration, the server failed to create a parser to
+decode the contents of the named configuration element, or the creation
+succeeded but the parsing actions and committal of changes failed.
+The reason for the failure is given in the message.
+
+% DCTL_PID_FILE_ERROR %1 could not create a PID file: %2
+This is an error message that occurs when the server is unable to create
+its PID file.  The log message should contain details sufficient to
+determine the underlying cause.  The most likely culprits are that
+some portion of the pathname does not exist or a permissions issue. The
+default path is determined by --localstatedir configure parameter but
+may be overridden by setting environment variable, KEA_PIDFILE_DIR.  The
+first argument is the process name.
+
+% DCTL_PROCESS_FAILED %1 application execution failed: %2
+The controller has encountered a fatal error while running the
+application and is terminating. The reason for the failure is
+included in the message.
+
+% DCTL_CFG_FILE_RELOAD_ERROR configuration reload failed: %1, reverting to current configuration.
+This is an error message indicating that the application attempted to reload
+its configuration from file and encountered an error.  This is likely due to
+invalid content in the configuration file.  The application should continue
+to operate under its current configuration.
+
+% DCTL_CFG_FILE_RELOAD_SIGNAL_RECVD OS signal %1 received, reloading configuration from file: %2
+This is an informational message indicating the application has received a signal
+instructing it to reload its configuration from file.
+
+% DCTL_RUN_PROCESS %1 starting application event loop
+This debug message is issued just before the controller invokes
+the application run method.
+
+% DCTL_SESSION_FAIL %1 controller failed to establish Kea session: %1
+The controller has failed to establish communication with the rest of
+Kea and will exit.
+
+% DCTL_SHUTDOWN %1 has shut down, pid: %2, version: %3
+This is an informational message indicating that the service has shut
+down. The argument specifies a name of the service.
+
+% DCTL_SHUTDOWN_SIGNAL_RECVD OS signal %1 received, starting shutdown
+This is a debug message indicating the application has received a signal
+instructing it to shutdown.
+
+% DCTL_SIGNAL_ERROR signal handler for signal %1, threw an unexpected exception: %2
+This is an error message indicating that the application encountered an unexpected
+error after receiving a signal.  This is a programmatic error and should be
+reported.  While The application will likely continue to operating, it may be
+unable to respond correctly to signals.
+
+% DCTL_STANDALONE %1 skipping message queue, running standalone
+This is a debug message indicating that the controller is running in the
+application in standalone mode. This means it will not connected to the Kea
+message queue. Standalone mode is only useful during program development,
+and should not be used in a production environment.
+
+% DCTL_STARTING %1 starting, pid: %2, version: %3
+This is an informational message issued when controller for the
+service first starts. Version is also reported.
+
+% DCTL_UNSUPPORTED_SIGNAL ignoring reception of unsupported signal: %1
+This is a debug message indicating that the application received an
+unsupported signal.  This is a programming error indicating that the
+application has registered to receive the signal but no associated
+processing logic has been added.
diff --git a/src/lib/process/tests/.gitignore b/src/lib/process/tests/.gitignore
new file mode 100644 (file)
index 0000000..21c391e
--- /dev/null
@@ -0,0 +1 @@
+/libprocess_unittests
diff --git a/src/lib/process/tests/Makefile.am b/src/lib/process/tests/Makefile.am
new file mode 100644 (file)
index 0000000..00dcc6c
--- /dev/null
@@ -0,0 +1,50 @@
+SUBDIRS = .
+
+AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
+AM_CPPFLAGS += $(BOOST_INCLUDES)
+AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_top_builddir)/src/lib/process/tests\"
+AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\"
+
+AM_CXXFLAGS = $(KEA_CXXFLAGS)
+
+if USE_STATIC_LINK
+AM_LDFLAGS = -static
+endif
+
+CLEANFILES = *.gcno *.gcda
+
+TESTS_ENVIRONMENT = \
+       $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
+
+TESTS =
+if HAVE_GTEST
+TESTS += libprocess_unittests
+
+libprocess_unittests_SOURCES  = d_cfg_mgr_unittests.cc
+libprocess_unittests_SOURCES += d_controller_unittests.cc
+libprocess_unittests_SOURCES += io_service_signal_unittests.cc
+libprocess_unittests_SOURCES += run_unittests.cc
+
+libprocess_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
+
+libprocess_unittests_CXXFLAGS = $(AM_CXXFLAGS)
+
+libprocess_unittests_LDFLAGS  = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
+
+libprocess_unittests_LDADD  = $(top_builddir)/src/lib/process/testutils/libprocesstest.la
+libprocess_unittests_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
+libprocess_unittests_LDADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
+libprocess_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
+libprocess_unittests_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
+libprocess_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
+libprocess_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
+libprocess_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
+libprocess_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
+libprocess_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
+libprocess_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
+libprocess_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
+libprocess_unittests_LDADD += $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS)
+libprocess_unittests_LDADD += $(BOOST_LIBS) $(GTEST_LDADD)
+endif
+
+noinst_PROGRAMS = $(TESTS)
similarity index 99%
rename from src/bin/d2/tests/d_cfg_mgr_unittests.cc
rename to src/lib/process/tests/d_cfg_mgr_unittests.cc
index 5bb11e3ebe7bf274abcdc6dde6415a490cbb7804..b09a690b756e27c3ab72d0ddba5bf2849cef265f 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -9,8 +9,8 @@
 #include <cc/command_interpreter.h>
 #include <config/module_spec.h>
 #include <dhcpsrv/parsers/dhcp_parsers.h>
-#include <d2/d_cfg_mgr.h>
-#include <d_test_stubs.h>
+#include <process/testutils/d_test_stubs.h>
+#include <process/d_cfg_mgr.h>
 
 #include <boost/foreach.hpp>
 #include <boost/date_time/posix_time/posix_time.hpp>
similarity index 99%
rename from src/bin/d2/tests/d_controller_unittests.cc
rename to src/lib/process/tests/d_controller_unittests.cc
index f39b4bafa5859b028dfb41f5900e7922cd8338cf..e0595a026df5299e7984aa79f9c0668296c060cf 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -7,8 +7,8 @@
 #include <config.h>
 
 #include <cc/command_interpreter.h>
-#include <d_test_stubs.h>
-#include <d2/spec_config.h>
+#include <process/spec_config.h>
+#include <process/testutils/d_test_stubs.h>
 
 #include <boost/date_time/posix_time/posix_time.hpp>
 #include <gtest/gtest.h>
similarity index 98%
rename from src/bin/d2/tests/io_service_signal_unittests.cc
rename to src/lib/process/tests/io_service_signal_unittests.cc
index 11e82e1973e32334d9bfd31905c70671158b688b..7c0b4dc55db7f43a6206d4311db3264a55515d2d 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2014-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2014-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -7,8 +7,8 @@
 #include <config.h>
 
 #include <asiolink/io_service.h>
-#include <d_test_stubs.h>
-#include <d2/io_service_signal.h>
+#include <process/io_service_signal.h>
+#include <process/testutils/d_test_stubs.h>
 
 #include <gtest/gtest.h>
 
diff --git a/src/lib/process/tests/run_unittests.cc b/src/lib/process/tests/run_unittests.cc
new file mode 100644 (file)
index 0000000..5cb81c4
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright (C) 2011-2015 Internet Systems Consortium, Inc. ("ISC")
+//
+// This Source Code Form is subject to the terms of the Mozilla Public
+// License, v. 2.0. If a copy of the MPL was not distributed with this
+// file, You can obtain one at http://mozilla.org/MPL/2.0/.
+
+#include <log/logger_support.h>
+
+#include <gtest/gtest.h>
+
+int
+main(int argc, char* argv[]) {
+    ::testing::InitGoogleTest(&argc, argv);
+    isc::log::initLogger();
+
+    int result = RUN_ALL_TESTS();
+
+    return (result);
+}
diff --git a/src/lib/process/testutils/Makefile.am b/src/lib/process/testutils/Makefile.am
new file mode 100644 (file)
index 0000000..42ed4da
--- /dev/null
@@ -0,0 +1,27 @@
+SUBDIRS = .
+
+AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
+AM_CPPFLAGS += -DDATABASE_SCRIPTS_DIR=\"$(abs_top_srcdir)/src/share/database/scripts\"
+AM_CPPFLAGS += $(BOOST_INCLUDES)
+
+AM_CXXFLAGS = $(KEA_CXXFLAGS)
+
+CLEANFILES = *.gcno *.gcda
+
+if HAVE_GTEST
+
+noinst_LTLIBRARIES = libprocesstest.la
+
+libprocesstest_la_SOURCES  = d_test_stubs.cc d_test_stubs.h
+
+libprocesstest_la_CXXFLAGS = $(AM_CXXFLAGS)
+libprocesstest_la_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
+libprocesstest_la_LDFLAGS  = $(AM_LDFLAGS)
+
+libprocesstest_la_LIBADD   = $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
+libprocesstest_la_LIBADD  += $(top_builddir)/src/lib/cc/libkea-cc.la
+libprocesstest_la_LIBADD  += $(top_builddir)/src/lib/log/libkea-log.la
+libprocesstest_la_LIBADD  += $(top_builddir)/src/lib/process/libkea-process.la
+libprocesstest_la_LIBADD  += $(LOG4CPLUS_LIBS) $(BOOST_LIBS)
+
+endif
similarity index 98%
rename from src/bin/d2/tests/d_test_stubs.cc
rename to src/lib/process/testutils/d_test_stubs.cc
index d52a18b9f382cac723e3e8ae868aa67894fbcd94..2fa9171c851d28a43bf36e8599763fb3593598cb 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
@@ -6,9 +6,9 @@
 
 #include <config.h>
 #include <asiolink/io_service.h>
-#include <d2/d2_log.h>
-#include <d2/spec_config.h>
-#include <d2/tests/d_test_stubs.h>
+#include <process/d2_log.h>
+#include <process/spec_config.h>
+#include <process/testutils/d_test_stubs.h>
 
 using namespace boost::asio;
 
similarity index 99%
rename from src/bin/d2/tests/d_test_stubs.h
rename to src/lib/process/testutils/d_test_stubs.h
index 2e0a2252657d3a06f4567aaf38b62122654a7e4c..3aaac0237ea11382ee61be24c1b0d2d2f9919d34 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
 //
 // This Source Code Form is subject to the terms of the Mozilla Public
 // License, v. 2.0. If a copy of the MPL was not distributed with this
 #include <cc/data.h>
 #include <cc/command_interpreter.h>
 
-#include <d2/d_controller.h>
-#include <d2/d_cfg_mgr.h>
-
 #include <log/logger_support.h>
 
+#include <process/d_controller.h>
+#include <process/d_cfg_mgr.h>
+
 #include <boost/date_time/posix_time/posix_time.hpp>
 
 using namespace boost::posix_time;