Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
ISC Open Source Projects
Kea
Commits
ab7c9a97
Commit
ab7c9a97
authored
Dec 06, 2016
by
Marcin Siodelski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[3175] Moved StateModel class from D2 to libkea-util.
parent
80abf3c9
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
45 additions
and
43 deletions
+45
-43
src/bin/d2/Makefile.am
src/bin/d2/Makefile.am
+0
-2
src/bin/d2/d2.dox
src/bin/d2/d2.dox
+2
-2
src/bin/d2/nc_trans.cc
src/bin/d2/nc_trans.cc
+3
-1
src/bin/d2/nc_trans.h
src/bin/d2/nc_trans.h
+3
-3
src/bin/d2/tests/Makefile.am
src/bin/d2/tests/Makefile.am
+0
-2
src/bin/d2/tests/d2_update_mgr_unittests.cc
src/bin/d2/tests/d2_update_mgr_unittests.cc
+1
-0
src/bin/d2/tests/nc_add_unittests.cc
src/bin/d2/tests/nc_add_unittests.cc
+2
-1
src/bin/d2/tests/nc_remove_unittests.cc
src/bin/d2/tests/nc_remove_unittests.cc
+3
-1
src/bin/d2/tests/nc_trans_unittests.cc
src/bin/d2/tests/nc_trans_unittests.cc
+1
-0
src/lib/util/Makefile.am
src/lib/util/Makefile.am
+5
-3
src/lib/util/labeled_value.cc
src/lib/util/labeled_value.cc
+4
-4
src/lib/util/labeled_value.h
src/lib/util/labeled_value.h
+3
-3
src/lib/util/state_model.cc
src/lib/util/state_model.cc
+5
-7
src/lib/util/state_model.h
src/lib/util/state_model.h
+5
-8
src/lib/util/tests/Makefile.am
src/lib/util/tests/Makefile.am
+2
-0
src/lib/util/tests/labeled_value_unittest.cc
src/lib/util/tests/labeled_value_unittest.cc
+3
-3
src/lib/util/tests/state_model_unittest.cc
src/lib/util/tests/state_model_unittest.cc
+3
-3
No files found.
src/bin/d2/Makefile.am
View file @
ab7c9a97
...
...
@@ -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
...
...
src/bin/d2/d2.dox
View file @
ab7c9a97
...
...
@@ -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"
...
...
src/bin/d2/nc_trans.cc
View file @
ab7c9a97
// Copyright (C) 2013-201
5
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-201
6
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
{
...
...
src/bin/d2/nc_trans.h
View file @
ab7c9a97
// Copyright (C) 2013-201
5
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-201
6
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.
...
...
src/bin/d2/tests/Makefile.am
View file @
ab7c9a97
...
...
@@ -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)
...
...
src/bin/d2/tests/d2_update_mgr_unittests.cc
View file @
ab7c9a97
...
...
@@ -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
{
...
...
src/bin/d2/tests/nc_add_unittests.cc
View file @
ab7c9a97
// Copyright (C) 2013-201
5
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-201
6
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
{
...
...
src/bin/d2/tests/nc_remove_unittests.cc
View file @
ab7c9a97
// Copyright (C) 2013-201
5
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-201
6
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
{
...
...
src/bin/d2/tests/nc_trans_unittests.cc
View file @
ab7c9a97
...
...
@@ -24,6 +24,7 @@
using
namespace
std
;
using
namespace
isc
;
using
namespace
isc
::
d2
;
using
namespace
isc
::
util
;
using
namespace
boost
::
posix_time
;
namespace
{
...
...
src/lib/util/Makefile.am
View file @
ab7c9a97
...
...
@@ -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
...
...
src/
bin/d2
/labeled_value.cc
→
src/
lib/util
/labeled_value.cc
View file @
ab7c9a97
// Copyright (C) 2013-201
5
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-201
6
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
src/
bin/d2
/labeled_value.h
→
src/
lib/util
/labeled_value.h
View file @
ab7c9a97
// Copyright (C) 2013-201
5
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-201
6
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
src/
bin/d2
/state_model.cc
→
src/
lib/util
/state_model.cc
View file @
ab7c9a97
// Copyright (C) 2013-201
5
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-201
6
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
src/
bin/d2
/state_model.h
→
src/
lib/util
/state_model.h
View file @
ab7c9a97
// Copyright (C) 2013-201
5
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-201
6
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,17 +10,14 @@
/// @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
src/lib/util/tests/Makefile.am
View file @
ab7c9a97
...
...
@@ -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
...
...
src/
bin/d2
/tests/labeled_value_unittest
s
.cc
→
src/
lib/util
/tests/labeled_value_unittest.cc
View file @
ab7c9a97
// Copyright (C) 2013-201
5
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-201
6
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
{
...
...
src/
bin/d2
/tests/state_model_unittest
s
.cc
→
src/
lib/util
/tests/state_model_unittest.cc
View file @
ab7c9a97
// Copyright (C) 2013-201
5
Internet Systems Consortium, Inc. ("ISC")
// Copyright (C) 2013-201
6
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
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment