]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[3175] Moved StateModel class from D2 to libkea-util.
authorMarcin Siodelski <marcin@isc.org>
Tue, 6 Dec 2016 18:59:52 +0000 (19:59 +0100)
committerMarcin Siodelski <marcin@isc.org>
Tue, 6 Dec 2016 18:59:52 +0000 (19:59 +0100)
17 files changed:
src/bin/d2/Makefile.am
src/bin/d2/d2.dox
src/bin/d2/nc_trans.cc
src/bin/d2/nc_trans.h
src/bin/d2/tests/Makefile.am
src/bin/d2/tests/d2_update_mgr_unittests.cc
src/bin/d2/tests/nc_add_unittests.cc
src/bin/d2/tests/nc_remove_unittests.cc
src/bin/d2/tests/nc_trans_unittests.cc
src/lib/util/Makefile.am
src/lib/util/labeled_value.cc [moved from src/bin/d2/labeled_value.cc with 95% similarity]
src/lib/util/labeled_value.h [moved from src/bin/d2/labeled_value.h with 98% similarity]
src/lib/util/state_model.cc [moved from src/bin/d2/state_model.cc with 98% similarity]
src/lib/util/state_model.h [moved from src/bin/d2/state_model.h with 99% similarity]
src/lib/util/tests/Makefile.am
src/lib/util/tests/labeled_value_unittest.cc [moved from src/bin/d2/tests/labeled_value_unittests.cc with 96% similarity]
src/lib/util/tests/state_model_unittest.cc [moved from src/bin/d2/tests/state_model_unittests.cc with 99% similarity]

index 17c240f4989ea2e8ba7508e02d29b8de27abe3c4..895865e4daa0da6673396883b1a026c635c3c3a4 100644 (file)
@@ -69,11 +69,9 @@ 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 += 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
index 518898e5d5e6fffe2f4320499358e01146ce2cca..8e92fd732e54734c160dfa0d534b7cc0b35b53c8 100644 (file)
@@ -215,7 +215,7 @@ The transaction classes are shown in the following diagram:
 
 - isc::d2::NameAddTransaction - carries out a @c NameChangeRequest to add entries
 - isc::d2::NameRemoveTransaction - carries out a @c NameChangeRequest to remove entries
-- isc::d2::StateModel - abstract state model described in @ref d2StateModel
+- isc::util::StateModel - abstract state model described in @ref d2StateModel
 
 The state models for these two transactions implement DDNS with conflict
 resolution as described in <a href="https://tools.ietf.org/html/rfc4703">RFC 4703</a>.
@@ -244,7 +244,7 @@ a common library.
 
 @image html state_model_classes.svg "State Model Classes"
 
-- isc::d2::StateModel - provides the mechanics for executing a state model
+- isc::util::StateModel - provides the mechanics for executing a state model
 described by a dictionary events and states.  It provides methods to:
     - initialize the model - constructs the dictionary of events and states
     - start the model - sets the model to its initial state, posts a "start"
index f0ac67d537f7b40ec3b9433c2ffce2328c6bb351..793410d3684346b7a56d4a36a4177d192aa04287 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
@@ -12,6 +12,8 @@
 
 #include <sstream>
 
+using namespace isc::util;
+
 namespace isc {
 namespace d2 {
 
index 4fc70e9cc24e6a24dfeb66719d9c4802c5afe13a..77f8fb3fb7e1d259379fc1c0a54572f7b09ee755 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
@@ -13,9 +13,9 @@
 #include <exceptions/exceptions.h>
 #include <d2/d2_cfg_mgr.h>
 #include <d2/dns_client.h>
-#include <d2/state_model.h>
 #include <dhcp_ddns/ncr_msg.h>
 #include <dns/tsig.h>
+#include <util/state_model.h>
 
 #include <boost/shared_ptr.hpp>
 #include <map>
@@ -74,7 +74,7 @@ typedef isc::dhcp_ddns::D2Dhcid TransactionKey;
 /// as needed, but it must support the common set.  NameChangeTransaction
 /// does not supply any state handlers.  These are the sole responsibility of
 /// derivations.
-class NameChangeTransaction : public DNSClient::Callback, public StateModel {
+class NameChangeTransaction : public DNSClient::Callback, public util::StateModel {
 public:
 
     //@{ States common to all transactions.
index 7ab1c65fe7971660a732a5cf156a149c2f549caf..a28ed6e8631df21478becce5ae6f91454c55d7cd 100644 (file)
@@ -50,12 +50,10 @@ 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 += 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_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
index 25bfe96fe2d04b634329f2d0ad45627408240d14..b1492ca3c4712c7eef549567efbc40e752c49410 100644 (file)
@@ -24,6 +24,7 @@ using namespace isc;
 using namespace isc::dhcp_ddns;
 using namespace isc::d2;
 using namespace isc::process;
+using namespace isc::util;
 
 namespace {
 
index 6d17ba0f819af66f21bb6f3e0267a1f540030775..9bc90aa935b6172bd2fdb7251c9501b7f04e7421 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
@@ -20,6 +20,7 @@
 using namespace std;
 using namespace isc;
 using namespace isc::d2;
+using namespace isc::util;
 
 namespace {
 
index 71b996abf6975c5bafea3ffe3d597e9d48ed37af..0b8c07f808ac26f5d56f9ac3d9697d46f195f9fe 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
@@ -20,6 +20,8 @@
 using namespace std;
 using namespace isc;
 using namespace isc::d2;
+using namespace isc::util;
+
 
 namespace {
 
index a4fe05dc0f26fdcd5e2d21c8c794996e890b2cbe..ff0179581d50c628618f9398a77bcef3ff407b69 100644 (file)
@@ -24,6 +24,7 @@
 using namespace std;
 using namespace isc;
 using namespace isc::d2;
+using namespace isc::util;
 using namespace boost::posix_time;
 
 namespace {
index 2f2b5350b4c1560840f2cd7450d3a7f181d69bab..e897fe743fc13a391fc0b91e79eb6f0a9515b79d 100644 (file)
@@ -8,11 +8,10 @@ AM_CXXFLAGS = $(KEA_CXXFLAGS)
 
 lib_LTLIBRARIES = libkea-util.la
 libkea_util_la_SOURCES  = boost_time_utils.h boost_time_utils.cc
+libkea_util_la_SOURCES += buffer.h io_utilities.h
 libkea_util_la_SOURCES += csv_file.h csv_file.cc
 libkea_util_la_SOURCES += filename.h filename.cc
-libkea_util_la_SOURCES += strutil.h strutil.cc
-libkea_util_la_SOURCES += buffer.h io_utilities.h
-libkea_util_la_SOURCES += time_utilities.h time_utilities.cc
+libkea_util_la_SOURCES += labeled_value.h labeled_value.cc
 libkea_util_la_SOURCES += memory_segment.h
 libkea_util_la_SOURCES += memory_segment_local.h memory_segment_local.cc
 libkea_util_la_SOURCES += optional_value.h
@@ -22,8 +21,11 @@ libkea_util_la_SOURCES += process_spawn.h process_spawn.cc
 libkea_util_la_SOURCES += range_utilities.h
 libkea_util_la_SOURCES += signal_set.cc signal_set.h
 libkea_util_la_SOURCES += staged_value.h
+libkea_util_la_SOURCES += state_model.cc state_model.h
 libkea_util_la_SOURCES += stopwatch.cc stopwatch.h
 libkea_util_la_SOURCES += stopwatch_impl.cc stopwatch_impl.h
+libkea_util_la_SOURCES += strutil.h strutil.cc
+libkea_util_la_SOURCES += time_utilities.h time_utilities.cc
 libkea_util_la_SOURCES += versioned_csv_file.h versioned_csv_file.cc
 libkea_util_la_SOURCES += watch_socket.cc watch_socket.h
 libkea_util_la_SOURCES += encode/base16_from_binary.h
similarity index 95%
rename from src/bin/d2/labeled_value.cc
rename to src/lib/util/labeled_value.cc
index 6483b9453ca2239a5dc1a3c7cb4ad2b93390124d..137c639e0cc257bcac596bdd7d6e75bb1569a03d 100644 (file)
@@ -1,13 +1,13 @@
-// 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
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-#include <d2/labeled_value.h>
+#include <util/labeled_value.h>
 
 namespace isc {
-namespace d2 {
+namespace util {
 
 /**************************** LabeledValue ****************************/
 
@@ -111,5 +111,5 @@ LabeledValueSet::getLabel(const int value) const {
     return (std::string(UNDEFINED_LABEL));
 }
 
-} // namespace isc::d2
+} // namespace isc::util
 } // namespace isc
similarity index 98%
rename from src/bin/d2/labeled_value.h
rename to src/lib/util/labeled_value.h
index baf2f1cdbd418f7b1fddbaea5ddb2a75ef99ba19..e85b5379046c4b18f719b363f8b2f982667be044 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
@@ -18,7 +18,7 @@
 /// LabeledValueSet.
 
 namespace isc {
-namespace d2 {
+namespace util {
 
 /// @brief Thrown if an error is encountered handling a LabeledValue.
 class LabeledValueError : public isc::Exception {
@@ -171,6 +171,6 @@ private:
     LabeledValueMap map_;
 };
 
-} // namespace isc::d2
+} // namespace isc::util
 } // namespace isc
 #endif
similarity index 98%
rename from src/bin/d2/state_model.cc
rename to src/lib/util/state_model.cc
index 57f8e0948c43f705fe9cd3a8fe84b1c54fa63842..80c163b32e4aaeb3cab1e53388d21dac1e62584a 100644 (file)
@@ -1,18 +1,16 @@
-// 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
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #include <config.h>
-
-#include <d2/d2_log.h>
-#include <d2/state_model.h>
-
+#include <util/state_model.h>
+#include <boost/bind.hpp>
 #include <string>
 
 namespace isc {
-namespace d2 {
+namespace util {
 
 /********************************** State *******************************/
 
@@ -377,5 +375,5 @@ StateModel::getPrevContextStr() const {
     return(stream.str());
 }
 
-} // namespace isc::d2
+} // namespace isc::util
 } // namespace isc
similarity index 99%
rename from src/bin/d2/state_model.h
rename to src/lib/util/state_model.h
index 8b07bd0335016901ca35257f61aecc40cf186f81..832670b02d7f85e003d4c003a02312343d7e547f 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
 /// @file state_model.h This file defines the class StateModel.
 
 #include <exceptions/exceptions.h>
-#include <d2/d2_config.h>
-#include <d2/dns_client.h>
-#include <d2/labeled_value.h>
-#include <dhcp_ddns/ncr_msg.h>
-
+#include <util/labeled_value.h>
+#include <boost/function.hpp>
 #include <boost/shared_ptr.hpp>
 #include <map>
 #include <string>
 
 namespace isc {
-namespace d2 {
+namespace util {
 
 /// @brief Thrown if the state machine encounters a general error.
 class StateModelError : public isc::Exception {
@@ -666,6 +663,6 @@ private:
 /// @brief Defines a pointer to a StateModel.
 typedef boost::shared_ptr<StateModel> StateModelPtr;
 
-} // namespace isc::d2
+} // namespace isc::util
 } // namespace isc
 #endif
index 96cd389fd61d2080cfe89c6c807dfa7802831e82..6bd1727ffb3c2c5644528e4d6e4e27cba01b5064 100644 (file)
@@ -36,6 +36,7 @@ run_unittests_SOURCES += fd_tests.cc
 run_unittests_SOURCES += filename_unittest.cc
 run_unittests_SOURCES += hex_unittest.cc
 run_unittests_SOURCES += io_utilities_unittest.cc
+run_unittests_SOURCES += labeled_value_unittest.cc
 run_unittests_SOURCES += memory_segment_local_unittest.cc
 run_unittests_SOURCES += memory_segment_common_unittest.h
 run_unittests_SOURCES += memory_segment_common_unittest.cc
@@ -46,6 +47,7 @@ run_unittests_SOURCES += qid_gen_unittest.cc
 run_unittests_SOURCES += random_number_generator_unittest.cc
 run_unittests_SOURCES += socketsession_unittest.cc
 run_unittests_SOURCES += staged_value_unittest.cc
+run_unittests_SOURCES += state_model_unittest.cc
 run_unittests_SOURCES += strutil_unittest.cc
 run_unittests_SOURCES += time_utilities_unittest.cc
 run_unittests_SOURCES += range_utilities_unittest.cc
similarity index 96%
rename from src/bin/d2/tests/labeled_value_unittests.cc
rename to src/lib/util/tests/labeled_value_unittest.cc
index a13e20b5aaf288a4f9c913707f291bf48ddc66a1..5ef6af59d08092f8e920a0874f46366dee0a863f 100644 (file)
@@ -1,16 +1,16 @@
-// 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
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
-#include <d2/labeled_value.h>
+#include <util/labeled_value.h>
 
 #include <gtest/gtest.h>
 
 using namespace std;
 using namespace isc;
-using namespace isc::d2;
+using namespace isc::util;
 
 namespace {
 
similarity index 99%
rename from src/bin/d2/tests/state_model_unittests.cc
rename to src/lib/util/tests/state_model_unittest.cc
index d812bff243065f428269e5186b1653d2067ce8db..5dfcd7be367af3aed86a5a3ca164bfffeafbde29 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,7 +6,7 @@
 
 #include <config.h>
 
-#include <d2/state_model.h>
+#include <util/state_model.h>
 
 #include <boost/function.hpp>
 #include <boost/bind.hpp>
@@ -14,7 +14,7 @@
 
 using namespace std;
 using namespace isc;
-using namespace isc::d2;
+using namespace isc::util;
 
 namespace {