]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#1963] Moved code from D2CfgContextPtr
authorFrancis Dupont <fdupont@isc.org>
Tue, 6 Jul 2021 11:32:55 +0000 (13:32 +0200)
committerFrancis Dupont <fdupont@isc.org>
Fri, 9 Jul 2021 17:29:00 +0000 (19:29 +0200)
44 files changed:
configure.ac
src/bin/d2/.gitattributes
src/bin/d2/Makefile.am
src/bin/d2/d2_parser.h
src/bin/d2/d2_parser.yy
src/bin/d2/d2_process.cc
src/bin/d2/d2_queue_mgr.cc
src/bin/d2/d2_update_mgr.h
src/bin/d2/dns_client.cc
src/bin/d2/main.cc
src/bin/d2/nc_add.cc
src/bin/d2/nc_remove.cc
src/bin/d2/nc_trans.cc
src/bin/d2/nc_trans.h
src/bin/d2/simple_add.cc
src/bin/d2/simple_remove.cc
src/bin/d2/tests/Makefile.am
src/bin/d2/tests/d2_cfg_mgr_unittests.cc
src/bin/d2/tests/d2_simple_parser_unittest.cc
src/bin/d2/tests/d2_unittests.cc
src/bin/d2/tests/d2_update_message_unittests.cc
src/bin/d2/tests/get_config_unittest.cc
src/bin/d2/tests/nc_add_unittests.cc
src/bin/d2/tests/nc_remove_unittests.cc
src/bin/d2/tests/nc_test_utils.cc
src/bin/d2/tests/simple_add_unittests.cc
src/bin/d2/tests/simple_remove_unittests.cc
src/lib/Makefile.am
src/lib/d2srv/.gitattributes [new file with mode: 0644]
src/lib/d2srv/Makefile.am [new file with mode: 0644]
src/lib/d2srv/d2_cfg_mgr.cc [moved from src/bin/d2/d2_cfg_mgr.cc with 99% similarity]
src/lib/d2srv/d2_cfg_mgr.h [moved from src/bin/d2/d2_cfg_mgr.h with 99% similarity]
src/lib/d2srv/d2_config.cc [moved from src/bin/d2/d2_config.cc with 99% similarity]
src/lib/d2srv/d2_config.h [moved from src/bin/d2/d2_config.h with 100% similarity]
src/lib/d2srv/d2_log.cc [moved from src/bin/d2/d2_log.cc with 86% similarity]
src/lib/d2srv/d2_log.h [moved from src/bin/d2/d2_log.h with 85% similarity]
src/lib/d2srv/d2_messages.cc [moved from src/bin/d2/d2_messages.cc with 100% similarity]
src/lib/d2srv/d2_messages.h [moved from src/bin/d2/d2_messages.h with 100% similarity]
src/lib/d2srv/d2_messages.mes [moved from src/bin/d2/d2_messages.mes with 100% similarity]
src/lib/d2srv/d2_simple_parser.cc [moved from src/bin/d2/d2_simple_parser.cc with 99% similarity]
src/lib/d2srv/d2_simple_parser.h [moved from src/bin/d2/d2_simple_parser.h with 97% similarity]
src/lib/d2srv/tests/.gitignore [new file with mode: 0644]
src/lib/d2srv/tests/Makefile.am [new file with mode: 0644]
src/lib/d2srv/tests/run_unittests.cc [new file with mode: 0644]

index 15e4e6b50f8208c0aee1fb39f693cd1f88095b33..3520af5c08e5b3ac02b19ad92eb884c4a25875f6 100644 (file)
@@ -1764,6 +1764,8 @@ AC_CONFIG_FILES([src/lib/config_backend/Makefile])
 AC_CONFIG_FILES([src/lib/config_backend/tests/Makefile])
 AC_CONFIG_FILES([src/lib/cryptolink/Makefile])
 AC_CONFIG_FILES([src/lib/cryptolink/tests/Makefile])
+AC_CONFIG_FILES([src/lib/d2srv/Makefile])
+AC_CONFIG_FILES([src/lib/d2srv/tests/Makefile])
 AC_CONFIG_FILES([src/lib/database/Makefile])
 AC_CONFIG_FILES([src/lib/database/tests/Makefile])
 AC_CONFIG_FILES([src/lib/database/testutils/Makefile])
index 321e14cfafc3147dca0ae7ddbd7782efa077b6ee..accd257fe9935dd4ff8a038253834dd1500387d3 100644 (file)
@@ -1,6 +1,4 @@
 /d2_lexer.cc                     -diff merge=ours
-/d2_messages.cc                  -diff merge=ours
-/d2_messages.h                   -diff merge=ours
 /d2_parser.cc                    -diff merge=ours
 /d2_parser.h                     -diff merge=ours
 /location.hh                     -diff merge=ours
index 28acbaf2e8bcedc241933a76823443bc69d04a2d..b3167d095c6f5cfb3659c1a0fef4e0f5d1b6b301 100644 (file)
@@ -29,14 +29,10 @@ EXTRA_DIST += images/trans_classes.svg images/update_exec_classes.svg
 noinst_LTLIBRARIES = libd2.la
 
 libd2_la_SOURCES  =
-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
-libd2_la_SOURCES += d2_cfg_mgr.cc d2_cfg_mgr.h
 libd2_la_SOURCES += d2_lexer.ll location.hh position.hh stack.hh
 libd2_la_SOURCES += d2_parser.cc d2_parser.h
 libd2_la_SOURCES += d2_queue_mgr.cc d2_queue_mgr.h
-libd2_la_SOURCES += d2_simple_parser.cc d2_simple_parser.h
 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
@@ -46,10 +42,8 @@ libd2_la_SOURCES += nc_remove.cc nc_remove.h
 libd2_la_SOURCES += nc_trans.cc nc_trans.h
 libd2_la_SOURCES += d2_controller.cc d2_controller.h
 libd2_la_SOURCES += parser_context.cc parser_context.h parser_context_decl.h
-libd2_la_SOURCES += d2_messages.h d2_messages.cc
 libd2_la_SOURCES += simple_add.cc simple_add.h
 libd2_la_SOURCES += simple_remove.cc simple_remove.h
-EXTRA_DIST += d2_messages.mes
 
 sbin_PROGRAMS = kea-dhcp-ddns
 
@@ -57,6 +51,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/d2srv/libkea-d2srv.la
 kea_dhcp_ddns_LDADD += $(top_builddir)/src/lib/process/libkea-process.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
@@ -80,39 +75,6 @@ kea_dhcp_ddns_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS)
 
 kea_dhcp_ddnsdir = $(pkgdatadir)
 
-# If we want to get rid of all generated messages files, we need to use
-# make maintainer-clean. The proper way to introduce custom commands for
-# that operation is to define maintainer-clean-local target. However,
-# make maintainer-clean also removes Makefile, so running configure script
-# is required.  To make it easy to rebuild messages without going through
-# reconfigure, a new target messages-clean has been added.
-maintainer-clean-local:
-       rm -f d2_messages.h d2_messages.cc
-
-# To regenerate messages files, one can do:
-#
-# make messages-clean
-# make messages
-#
-# This is needed only when a .mes file is modified.
-messages-clean: maintainer-clean-local
-
-if GENERATE_MESSAGES
-
-# Define rule to build logging source files from message file
-messages: d2_messages.h d2_messages.cc
-       @echo Message files regenerated
-
-d2_messages.h d2_messages.cc: d2_messages.mes
-       $(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/bin/d2/d2_messages.mes
-
-else
-
-messages d2_messages.h d2_messages.cc:
-       @echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
-
-endif
-
 if GENERATE_PARSER
 
 # Generate parser first.
index 3a051e75160ad71c3c7fadfe885c3fe5e3b88ad7..78e9da7c0ba4bb5a3f09f0fdd63f488e6023c874 100644 (file)
 #line 17 "d2_parser.yy"
 
 #include <string>
-#include <cc/data.h>
-#include <d2/d2_config.h>
 #include <boost/lexical_cast.hpp>
+#include <cc/data.h>
 #include <d2/parser_context_decl.h>
+#include <d2srv/d2_config.h>
 
 using namespace isc::d2;
 using namespace isc::data;
index 8d7213e2532d76b6f0c75d69c53daa6ec7890ca2..1f6427306fb81248c5a27b653748ceedb57c59e3 100644 (file)
@@ -17,7 +17,7 @@
 {
 #include <string>
 #include <cc/data.h>
-#include <d2/d2_config.h>
+#include <d2srv/d2_config.h>
 #include <boost/lexical_cast.hpp>
 #include <d2/parser_context_decl.h>
 
index 615a0b5077a0d23052f7351b2fcb57938f59ba59..8285b04f980080762d8abc5cbf528449ae7eef1c 100644 (file)
@@ -8,10 +8,10 @@
 #include <asiolink/asio_wrapper.h>
 #include <cc/command_interpreter.h>
 #include <config/command_mgr.h>
-#include <d2/d2_log.h>
-#include <d2/d2_cfg_mgr.h>
 #include <d2/d2_controller.h>
 #include <d2/d2_process.h>
+#include <d2srv/d2_cfg_mgr.h>
+#include <d2srv/d2_log.h>
 #include <hooks/hooks.h>
 #include <hooks/hooks_manager.h>
 
index c16880851e382d1295d580581807344077e7b8a5..71949b3bcfa4d5da06f52a2114169bfcf323309c 100644 (file)
@@ -1,12 +1,12 @@
-// Copyright (C) 2013-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2021 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/d2_queue_mgr.h>
+#include <d2srv/d2_log.h>
 #include <dhcp_ddns/ncr_udp.h>
 
 namespace isc {
index 8ef128c66b592deec391f3202ce2a794dd5a3abc..a06d787dccaeb02e49be87adaa9b23789c67bf51 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2021 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 d2_update_mgr.h This file defines the class D2UpdateMgr.
 
 #include <asiolink/io_service.h>
-#include <exceptions/exceptions.h>
-#include <d2/d2_log.h>
 #include <d2/d2_queue_mgr.h>
-#include <d2/d2_cfg_mgr.h>
 #include <d2/nc_trans.h>
+#include <d2srv/d2_cfg_mgr.h>
+#include <d2srv/d2_log.h>
+#include <exceptions/exceptions.h>
 
 #include <boost/noncopyable.hpp>
 #include <boost/shared_ptr.hpp>
index 73ffa610549112a03df0ee7e3a9d8377e6010d92..1d4e4d62c8d5c5f26556c5d417614b55b61b5422 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015,2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2021 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/dns_client.h>
-#include <d2/d2_log.h>
+#include <d2srv/d2_log.h>
 #include <dns/messagerenderer.h>
 #include <limits>
 
index 83b1964a6a73a215c83af68f3e91927b8e9ce3ba..da7be90dc46550b6fece223c74e9a0422019fdd2 100644 (file)
@@ -5,11 +5,11 @@
 // file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 #include <config.h>
-#include <d2/d2_log.h>
 #include <d2/d2_controller.h>
+#include <d2srv/d2_log.h>
 #include <exceptions/exceptions.h>
-#include <log/logger_support.h>
 #include <log/logger_manager.h>
+#include <log/logger_support.h>
 
 #include <iostream>
 
index b4692a8614ca1d4c5d1e9e795a429f40f785fea4..4a1661ac77b6dfd1f384336052e06b2a89b972f4 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2021 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 <d2/d2_log.h>
-#include <d2/d2_cfg_mgr.h>
 #include <d2/nc_add.h>
+#include <d2srv/d2_cfg_mgr.h>
+#include <d2srv/d2_log.h>
 
 #include <util/buffer.h>
 #include <dns/rdataclass.h>
index cd0b14bb59dc0a1be3eea51dcfcc92fa3b312446..8c158598d32e15ebb5ac59909c31633929bfd8bc 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2021 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 <d2/d2_log.h>
-#include <d2/d2_cfg_mgr.h>
 #include <d2/nc_remove.h>
+#include <d2srv/d2_cfg_mgr.h>
+#include <d2srv/d2_log.h>
 
 #include <functional>
 
index 86996859473971d719c1c04777c5d0e3ad258a71..371d8a90fde0049cf93ef8f2e652020b38cfe7cf 100644 (file)
@@ -6,8 +6,8 @@
 
 #include <config.h>
 
-#include <d2/d2_log.h>
 #include <d2/nc_trans.h>
+#include <d2srv/d2_log.h>
 #include <dns/qid_gen.h>
 #include <dns/rdata.h>
 
index 4634027f0370f29777131a424db73958e483ed2d..ba8ddad76007f740fab8a92074f1cfc832db91de 100644 (file)
 /// @file nc_trans.h This file defines the class NameChangeTransaction.
 
 #include <asiolink/io_service.h>
-#include <exceptions/exceptions.h>
-#include <d2/d2_cfg_mgr.h>
 #include <d2/dns_client.h>
+#include <d2srv/d2_cfg_mgr.h>
 #include <dhcp_ddns/ncr_msg.h>
 #include <dns/tsig.h>
+#include <exceptions/exceptions.h>
 #include <util/state_model.h>
 
 #include <boost/shared_ptr.hpp>
index 6ca7a3cfe2ddde0e93918a661f939da8ae6b6b60..957e67bc1ee9817c3a34045b1490f3fd58842d52 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2020-2021 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 <d2/d2_log.h>
-#include <d2/d2_cfg_mgr.h>
 #include <d2/simple_add.h>
+#include <d2srv/d2_cfg_mgr.h>
+#include <d2srv/d2_log.h>
 
 #include <util/buffer.h>
 #include <dns/rdataclass.h>
index 63de0e3ab1552e81ce8c8afa43f1eb4c44d33d2c..e780080d71b478c2910646c0925e5184782c507c 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2021 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 <d2/d2_log.h>
-#include <d2/d2_cfg_mgr.h>
 #include <d2/simple_remove.h>
+#include <d2srv/d2_cfg_mgr.h>
+#include <d2srv/d2_log.h>
 
 #include <functional>
 
index d1210383e9c2a52c4671cd46d1d454a033fc1e87..9f8673a2966e17244db648c5eea1a7f5da9b3ab5 100644 (file)
@@ -75,6 +75,7 @@ endif
 d2_unittests_LDFLAGS += $(GTEST_LDFLAGS)
 
 d2_unittests_LDADD = $(top_builddir)/src/bin/d2/libd2.la
+d2_unittests_LDADD += $(top_builddir)/src/lib/d2srv/libkea-d2srv.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
index e022f48da299e22dd308fcbfcbf742fb6a0d78df..3bb348abfa4320c877bf7c0baf28689038f877d7 100644 (file)
@@ -6,12 +6,12 @@
 
 #include <config.h>
 
-#include <d2/d2_config.h>
-#include <d2/d2_cfg_mgr.h>
-#include <d2/d2_simple_parser.h>
 #include <d2/parser_context.h>
 #include <d2/tests/parser_unittest.h>
 #include <d2/tests/test_libraries.h>
+#include <d2srv/d2_cfg_mgr.h>
+#include <d2srv/d2_config.h>
+#include <d2srv/d2_simple_parser.h>
 #include <dhcpsrv/testutils/config_result_check.h>
 #include <process/testutils/d_test_stubs.h>
 #include <test_data_files_config.h>
index 686d7fae8c5397ca37fcec3dcd4314a98d9ec09e..0ba5ba50a4d9e5454b2113ef6a259f8e84dacafd 100644 (file)
@@ -6,9 +6,9 @@
 
 #include <config.h>
 #include <gtest/gtest.h>
-#include <d2/d2_simple_parser.h>
-#include <d2/tests/parser_unittest.h>
 #include <cc/data.h>
+#include <d2/tests/parser_unittest.h>
+#include <d2srv/d2_simple_parser.h>
 #include <testutils/test_to_element.h>
 
 #include <boost/lexical_cast.hpp>
index adf63af5f998adc486662c94359ce157623f49ab..460755000577413859807e06fd87f0bd811939fb 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2021 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,8 +6,8 @@
 
 #include <config.h>
 
+#include <d2srv/d2_log.h>
 #include <log/logger_support.h>
-#include <d2/d2_log.h>
 #include <gtest/gtest.h>
 
 int
index 6e6fa5d94984535b73b0f632b32cddcb3c64deba..1320e377a36c0bf1cca0ef58919029c4e089df64 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2017 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2021 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,12 +6,12 @@
 
 #include <config.h>
 
-#include <d2/d2_config.h>
 #include <d2/d2_update_message.h>
 #include <d2/d2_zone.h>
+#include <d2srv/d2_config.h>
 #include <dns/messagerenderer.h>
-#include <dns/rdataclass.h>
 #include <dns/rdata.h>
+#include <dns/rdataclass.h>
 #include <dns/rrttl.h>
 
 #include <boost/scoped_ptr.hpp>
index 74c152447e332838301f0328225c0fa8f4b4a8cf..3f265beabcfa3301f146e68f8f08464c060fdbcd 100644 (file)
@@ -6,13 +6,13 @@
 
 #include <config.h>
 
-#include <cc/data.h>
 #include <cc/command_interpreter.h>
-#include <testutils/user_context_utils.h>
-#include <process/testutils/d_test_stubs.h>
-#include <d2/d2_config.h>
-#include <d2/d2_cfg_mgr.h>
+#include <cc/data.h>
 #include <d2/parser_context.h>
+#include <d2srv/d2_cfg_mgr.h>
+#include <d2srv/d2_config.h>
+#include <process/testutils/d_test_stubs.h>
+#include <testutils/user_context_utils.h>
 #include <gtest/gtest.h>
 
 #include <iostream>
index a6a906478ae8a7fc133b1664b03107fb5b5ec5f6..0ef94ddf6b6786672a58280ff15bb9472823dd91 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2021 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 <d2/d2_cfg_mgr.h>
 #include <d2/nc_add.h>
+#include <d2srv/d2_cfg_mgr.h>
 #include <dns/messagerenderer.h>
 #include <nc_test_utils.h>
 
index 4a1ee5c22dfb4f1605758304a5ef52319683cfea..d335e101a5ba72caf65c4587967734a812507214 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2021 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 <d2/d2_cfg_mgr.h>
 #include <d2/nc_remove.h>
+#include <d2srv/d2_cfg_mgr.h>
 #include <dns/messagerenderer.h>
 #include <nc_test_utils.h>
 
index f6392e07a22ddc99137ade653d42cefe36f8ddc0..87b60468e129c9d69276438033f3e05900aa4a43 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2021 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 @@
 #include <config.h>
 #include <asiolink/asio_wrapper.h>
 #include <asiolink/udp_endpoint.h>
-#include <d2/d2_cfg_mgr.h>
-#include <dns/opcode.h>
+#include <d2srv/d2_cfg_mgr.h>
 #include <dns/messagerenderer.h>
+#include <dns/opcode.h>
 #include <nc_test_utils.h>
 #include <util/encode/base64.h>
 
index 2d7a884c4efc6d58e4aca5300482c440c1aa4701..5d8f4d56530cbeefe79b021ff2481c2cf72ca92e 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2020-2021 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 <d2/d2_cfg_mgr.h>
 #include <d2/simple_add.h>
+#include <d2srv/d2_cfg_mgr.h>
 #include <dns/messagerenderer.h>
 #include <nc_test_utils.h>
 
index 2e4238e5533bea026d4c46b0dd7e85cd59702881..64ce75834a7fa7079a11f5ff4841c2c333b3bae8 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2020-2021 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 <d2/d2_cfg_mgr.h>
 #include <d2/simple_remove.h>
+#include <d2srv/d2_cfg_mgr.h>
 #include <dns/messagerenderer.h>
 #include <nc_test_utils.h>
 
index 7189389916ec59b48adbaf6353142a6a44c73200..d984df2115a5b32083ae445f0923ba9cfdc9a578 100644 (file)
@@ -19,4 +19,4 @@ if HAVE_SYSREPO
 SUBDIRS += yang
 endif
 
-SUBDIRS += asiodns dhcp_ddns eval cfgrpt process dhcpsrv
+SUBDIRS += asiodns dhcp_ddns eval cfgrpt process dhcpsrv d2srv
diff --git a/src/lib/d2srv/.gitattributes b/src/lib/d2srv/.gitattributes
new file mode 100644 (file)
index 0000000..784616b
--- /dev/null
@@ -0,0 +1,2 @@
+/d2_messages.cc                  -diff merge=ours
+/d2_messages.h                   -diff merge=ours
diff --git a/src/lib/d2srv/Makefile.am b/src/lib/d2srv/Makefile.am
new file mode 100644 (file)
index 0000000..1ab1e8f
--- /dev/null
@@ -0,0 +1,83 @@
+SUBDIRS = . tests
+
+AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib
+AM_CPPFLAGS += $(BOOST_INCLUDES)
+
+AM_CXXFLAGS = $(KEA_CXXFLAGS)
+
+EXTRA_DIST  =
+
+CLEANFILES = *.gcno *.gcda
+
+lib_LTLIBRARIES = libkea-d2srv.la
+libkea_d2srv_la_SOURCES  =
+libkea_d2srv_la_SOURCES += d2_cfg_mgr.cc d2_cfg_mgr.h
+libkea_d2srv_la_SOURCES += d2_config.cc d2_config.h
+libkea_d2srv_la_SOURCES += d2_log.cc d2_log.h
+libkea_d2srv_la_SOURCES += d2_messages.cc d2_messages.h
+libkea_d2srv_la_SOURCES += d2_simple_parser.cc d2_simple_parser.h
+EXTRA_DIST += d2_messages.mes
+
+libkea_d2srv_la_CXXFLAGS = $(AM_CXXFLAGS)
+libkea_d2srv_la_CPPFLAGS = $(AM_CPPFLAGS)
+
+libkea_d2srv_la_LIBADD  =
+libkea_d2srv_la_LIBADD += $(top_builddir)/src/lib/cfgrpt/libcfgrpt.la
+libkea_d2srv_la_LIBADD += $(top_builddir)/src/lib/process/libkea-process.la
+libkea_d2srv_la_LIBADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
+libkea_d2srv_la_LIBADD += $(top_builddir)/src/lib/http/libkea-http.la
+libkea_d2srv_la_LIBADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
+libkea_d2srv_la_LIBADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
+libkea_d2srv_la_LIBADD += $(top_builddir)/src/lib/database/libkea-database.la
+libkea_d2srv_la_LIBADD += $(top_builddir)/src/lib/cc/libkea-cc.la
+libkea_d2srv_la_LIBADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
+libkea_d2srv_la_LIBADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
+libkea_d2srv_la_LIBADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
+libkea_d2srv_la_LIBADD += $(top_builddir)/src/lib/log/libkea-log.la
+libkea_d2srv_la_LIBADD += $(top_builddir)/src/lib/util/libkea-util.la
+libkea_d2srv_la_LIBADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
+libkea_d2srv_la_LIBADD += $(LOG4CPLUS_LIBS) $(CRYPTO_LIBS) $(BOOST_LIBS)
+
+libkea_d2srv_la_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS)
+
+# If we want to get rid of all generated messages files, we need to use
+# make maintainer-clean. The proper way to introduce custom commands for
+# that operation is to define maintainer-clean-local target. However,
+# make maintainer-clean also removes Makefile, so running configure script
+# is required.  To make it easy to rebuild messages without going through
+# reconfigure, a new target messages-clean has been added.
+maintainer-clean-local:
+       rm -f d2_messages.h d2_messages.cc
+
+# To regenerate messages files, one can do:
+#
+# make messages-clean
+# make messages
+#
+# This is needed only when a .mes file is modified.
+messages-clean: maintainer-clean-local
+
+if GENERATE_MESSAGES
+
+# Define rule to build logging source files from message file
+messages: d2_messages.h d2_messages.cc
+       @echo Message files regenerated
+
+d2_messages.h d2_messages.cc: d2_messages.mes
+       $(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/bin/d2/d2_messages.mes
+
+else
+
+messages d2_messages.h d2_messages.cc:
+       @echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
+
+endif
+
+# Specify the headers for copying into the installation directory tree.
+libkea_d2srv_includedir = $(pkgincludedir)/d2srv
+libkea_d2srv_include_HEADERS =
+       d2_cfg_mgr.h \
+       d2_config.h \
+       d2_log.h \
+       d2_messages.h \
+       d2_simple_parser.h
similarity index 99%
rename from src/bin/d2/d2_cfg_mgr.cc
rename to src/lib/d2srv/d2_cfg_mgr.cc
index 0e70b1b2ed36106a9659f6d4680ad0a924fef5d6..351b9caa67accdf7e4b02da903ae0d5ed3a85b51 100644 (file)
@@ -6,9 +6,9 @@
 
 #include <config.h>
 
-#include <d2/d2_log.h>
-#include <d2/d2_cfg_mgr.h>
-#include <d2/d2_simple_parser.h>
+#include <d2srv/d2_log.h>
+#include <d2srv/d2_cfg_mgr.h>
+#include <d2srv/d2_simple_parser.h>
 #include <cc/command_interpreter.h>
 #include <util/encode/hex.h>
 
similarity index 99%
rename from src/bin/d2/d2_cfg_mgr.h
rename to src/lib/d2srv/d2_cfg_mgr.h
index 00f5827f3202008a88cc597863b1edd809f2deba..eade86cbffab460be2d1a2c5981a465eb92a0631 100644 (file)
@@ -10,7 +10,7 @@
 #include <asiolink/io_service.h>
 #include <cc/data.h>
 #include <exceptions/exceptions.h>
-#include <d2/d2_config.h>
+#include <d2srv/d2_config.h>
 #include <hooks/hooks_config.h>
 #include <process/d_cfg_mgr.h>
 
similarity index 99%
rename from src/bin/d2/d2_config.cc
rename to src/lib/d2srv/d2_config.cc
index 74ff793f958e2a375642f543fe9a20a71d825053..68fd48e5afbcab10bb2d8bbcf2edfa8cb31aa4a9 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2020 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2021 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,8 +6,8 @@
 
 #include <config.h>
 
-#include <d2/d2_log.h>
-#include <d2/d2_cfg_mgr.h>
+#include <d2srv/d2_log.h>
+#include <d2srv/d2_cfg_mgr.h>
 #include <dhcpsrv/parsers/dhcp_parsers.h>
 #include <exceptions/exceptions.h>
 #include <asiolink/io_error.h>
similarity index 86%
rename from src/bin/d2/d2_log.cc
rename to src/lib/d2srv/d2_log.cc
index 643e819a17f423a13ef8a038895b61ddcea18706..a56640b8799c31d4eb43a26d7bcb91d65834a46a 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2016 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2021 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 <config.h>
 
-#include <d2/d2_log.h>
+#include <d2srv/d2_log.h>
 
 namespace isc {
 namespace d2 {
similarity index 85%
rename from src/bin/d2/d2_log.h
rename to src/lib/d2srv/d2_log.h
index 2333a0c962970325dd2a0cb90f392539b0fa3cdf..2b408e07a769daacdf47df6fa0ffcc09b23136d0 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2013-2015 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2013-2021 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 <log/logger_support.h>
 #include <log/macros.h>
-#include <d2/d2_messages.h>
+#include <d2srv/d2_messages.h>
 
 namespace isc {
 namespace d2 {
similarity index 99%
rename from src/bin/d2/d2_simple_parser.cc
rename to src/lib/d2srv/d2_simple_parser.cc
index 5f0b5a42a294fb0c1561c649382bda6c5d591d72..15cfd67ab2150251f55b43c308dfffb8a8f4cbef 100644 (file)
@@ -6,8 +6,8 @@
 
 #include <config.h>
 
-#include <d2/d2_config.h>
-#include <d2/d2_simple_parser.h>
+#include <d2srv/d2_config.h>
+#include <d2srv/d2_simple_parser.h>
 #include <cc/data.h>
 #include <hooks/hooks_manager.h>
 #include <hooks/hooks_parser.h>
similarity index 97%
rename from src/bin/d2/d2_simple_parser.h
rename to src/lib/d2srv/d2_simple_parser.h
index d3e061f443b987151927f5a2610b354fd1a13e1b..49f0d8a4ba1e7cf94c0473ef6d314a96d4344a25 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2017-2018 Internet Systems Consortium, Inc. ("ISC")
+// Copyright (C) 2017-2021 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 @@
 #define D2_SIMPLE_PARSER_H
 
 #include <cc/simple_parser.h>
-#include <d2/d2_cfg_mgr.h>
+#include <d2srv/d2_cfg_mgr.h>
 
 namespace isc {
 namespace d2 {
diff --git a/src/lib/d2srv/tests/.gitignore b/src/lib/d2srv/tests/.gitignore
new file mode 100644 (file)
index 0000000..3ab5a55
--- /dev/null
@@ -0,0 +1 @@
+/libd2srv_unittests
diff --git a/src/lib/d2srv/tests/Makefile.am b/src/lib/d2srv/tests/Makefile.am
new file mode 100644 (file)
index 0000000..864c4d8
--- /dev/null
@@ -0,0 +1,36 @@
+SUBDIRS = .
+
+AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
+AM_CPPFLAGS += $(BOOST_INCLUDES)
+
+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 += libd2srv_unittests
+
+libd2srv_unittests_SOURCES  = run_unittests.cc
+#libd2srv_unittests_SOURCES += 
+
+libd2srv_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
+libd2srv_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
+
+libd2srv_unittests_LDADD  = $(top_builddir)/src/lib/process/libkea-process.la
+libd2srv_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
+libd2srv_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
+libd2srv_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
+libd2srv_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
+libd2srv_unittests_LDADD += $(LOG4CPLUS_LIBS) $(BOOST_LIBS) $(GTEST_LDADD)
+
+endif
+
+noinst_PROGRAMS = $(TESTS)
diff --git a/src/lib/d2srv/tests/run_unittests.cc b/src/lib/d2srv/tests/run_unittests.cc
new file mode 100644 (file)
index 0000000..768319e
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright (C) 2012-2021 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 <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);
+}