diff options
author | Francis Dupont <fdupont@isc.org> | 2021-07-06 13:32:55 +0200 |
---|---|---|
committer | Francis Dupont <fdupont@isc.org> | 2021-07-09 19:29:00 +0200 |
commit | 49e7250b2125e254c82b0bb0ecf1e911e454e5df (patch) | |
tree | 57d129baca3d52f5be705a2702001ccf5ac2ac77 | |
parent | [#1957] Updated the .dox (diff) | |
download | kea-49e7250b2125e254c82b0bb0ecf1e911e454e5df.tar.xz kea-49e7250b2125e254c82b0bb0ecf1e911e454e5df.zip |
[#1963] Moved code from D2CfgContextPtr
44 files changed, 218 insertions, 113 deletions
diff --git a/configure.ac b/configure.ac index 15e4e6b50f..3520af5c08 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/src/bin/d2/.gitattributes b/src/bin/d2/.gitattributes index 321e14cfaf..accd257fe9 100644 --- a/src/bin/d2/.gitattributes +++ b/src/bin/d2/.gitattributes @@ -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 diff --git a/src/bin/d2/Makefile.am b/src/bin/d2/Makefile.am index 28acbaf2e8..b3167d095c 100644 --- a/src/bin/d2/Makefile.am +++ b/src/bin/d2/Makefile.am @@ -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. diff --git a/src/bin/d2/d2_parser.h b/src/bin/d2/d2_parser.h index 3a051e7516..78e9da7c0b 100644 --- a/src/bin/d2/d2_parser.h +++ b/src/bin/d2/d2_parser.h @@ -48,10 +48,10 @@ #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; diff --git a/src/bin/d2/d2_parser.yy b/src/bin/d2/d2_parser.yy index 8d7213e253..1f6427306f 100644 --- a/src/bin/d2/d2_parser.yy +++ b/src/bin/d2/d2_parser.yy @@ -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> diff --git a/src/bin/d2/d2_process.cc b/src/bin/d2/d2_process.cc index 615a0b5077..8285b04f98 100644 --- a/src/bin/d2/d2_process.cc +++ b/src/bin/d2/d2_process.cc @@ -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> diff --git a/src/bin/d2/d2_queue_mgr.cc b/src/bin/d2/d2_queue_mgr.cc index c16880851e..71949b3bcf 100644 --- a/src/bin/d2/d2_queue_mgr.cc +++ b/src/bin/d2/d2_queue_mgr.cc @@ -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 { diff --git a/src/bin/d2/d2_update_mgr.h b/src/bin/d2/d2_update_mgr.h index 8ef128c66b..a06d787dcc 100644 --- a/src/bin/d2/d2_update_mgr.h +++ b/src/bin/d2/d2_update_mgr.h @@ -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 @@ -10,11 +10,11 @@ /// @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> diff --git a/src/bin/d2/dns_client.cc b/src/bin/d2/dns_client.cc index 73ffa61054..1d4e4d62c8 100644 --- a/src/bin/d2/dns_client.cc +++ b/src/bin/d2/dns_client.cc @@ -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> diff --git a/src/bin/d2/main.cc b/src/bin/d2/main.cc index 83b1964a6a..da7be90dc4 100644 --- a/src/bin/d2/main.cc +++ b/src/bin/d2/main.cc @@ -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> diff --git a/src/bin/d2/nc_add.cc b/src/bin/d2/nc_add.cc index b4692a8614..4a1661ac77 100644 --- a/src/bin/d2/nc_add.cc +++ b/src/bin/d2/nc_add.cc @@ -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> diff --git a/src/bin/d2/nc_remove.cc b/src/bin/d2/nc_remove.cc index cd0b14bb59..8c158598d3 100644 --- a/src/bin/d2/nc_remove.cc +++ b/src/bin/d2/nc_remove.cc @@ -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> diff --git a/src/bin/d2/nc_trans.cc b/src/bin/d2/nc_trans.cc index 8699685947..371d8a90fd 100644 --- a/src/bin/d2/nc_trans.cc +++ b/src/bin/d2/nc_trans.cc @@ -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> diff --git a/src/bin/d2/nc_trans.h b/src/bin/d2/nc_trans.h index 4634027f03..ba8ddad760 100644 --- a/src/bin/d2/nc_trans.h +++ b/src/bin/d2/nc_trans.h @@ -10,11 +10,11 @@ /// @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> diff --git a/src/bin/d2/simple_add.cc b/src/bin/d2/simple_add.cc index 6ca7a3cfe2..957e67bc1e 100644 --- a/src/bin/d2/simple_add.cc +++ b/src/bin/d2/simple_add.cc @@ -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> diff --git a/src/bin/d2/simple_remove.cc b/src/bin/d2/simple_remove.cc index 63de0e3ab1..e780080d71 100644 --- a/src/bin/d2/simple_remove.cc +++ b/src/bin/d2/simple_remove.cc @@ -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> diff --git a/src/bin/d2/tests/Makefile.am b/src/bin/d2/tests/Makefile.am index d1210383e9..9f8673a296 100644 --- a/src/bin/d2/tests/Makefile.am +++ b/src/bin/d2/tests/Makefile.am @@ -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 diff --git a/src/bin/d2/tests/d2_cfg_mgr_unittests.cc b/src/bin/d2/tests/d2_cfg_mgr_unittests.cc index e022f48da2..3bb348abfa 100644 --- a/src/bin/d2/tests/d2_cfg_mgr_unittests.cc +++ b/src/bin/d2/tests/d2_cfg_mgr_unittests.cc @@ -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> diff --git a/src/bin/d2/tests/d2_simple_parser_unittest.cc b/src/bin/d2/tests/d2_simple_parser_unittest.cc index 686d7fae8c..0ba5ba50a4 100644 --- a/src/bin/d2/tests/d2_simple_parser_unittest.cc +++ b/src/bin/d2/tests/d2_simple_parser_unittest.cc @@ -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> diff --git a/src/bin/d2/tests/d2_unittests.cc b/src/bin/d2/tests/d2_unittests.cc index adf63af5f9..4607550005 100644 --- a/src/bin/d2/tests/d2_unittests.cc +++ b/src/bin/d2/tests/d2_unittests.cc @@ -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 diff --git a/src/bin/d2/tests/d2_update_message_unittests.cc b/src/bin/d2/tests/d2_update_message_unittests.cc index 6e6fa5d949..1320e377a3 100644 --- a/src/bin/d2/tests/d2_update_message_unittests.cc +++ b/src/bin/d2/tests/d2_update_message_unittests.cc @@ -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> diff --git a/src/bin/d2/tests/get_config_unittest.cc b/src/bin/d2/tests/get_config_unittest.cc index 74c152447e..3f265beabc 100644 --- a/src/bin/d2/tests/get_config_unittest.cc +++ b/src/bin/d2/tests/get_config_unittest.cc @@ -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> diff --git a/src/bin/d2/tests/nc_add_unittests.cc b/src/bin/d2/tests/nc_add_unittests.cc index a6a906478a..0ef94ddf6b 100644 --- a/src/bin/d2/tests/nc_add_unittests.cc +++ b/src/bin/d2/tests/nc_add_unittests.cc @@ -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> diff --git a/src/bin/d2/tests/nc_remove_unittests.cc b/src/bin/d2/tests/nc_remove_unittests.cc index 4a1ee5c22d..d335e101a5 100644 --- a/src/bin/d2/tests/nc_remove_unittests.cc +++ b/src/bin/d2/tests/nc_remove_unittests.cc @@ -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> diff --git a/src/bin/d2/tests/nc_test_utils.cc b/src/bin/d2/tests/nc_test_utils.cc index f6392e07a2..87b60468e1 100644 --- a/src/bin/d2/tests/nc_test_utils.cc +++ b/src/bin/d2/tests/nc_test_utils.cc @@ -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> diff --git a/src/bin/d2/tests/simple_add_unittests.cc b/src/bin/d2/tests/simple_add_unittests.cc index 2d7a884c4e..5d8f4d5653 100644 --- a/src/bin/d2/tests/simple_add_unittests.cc +++ b/src/bin/d2/tests/simple_add_unittests.cc @@ -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> diff --git a/src/bin/d2/tests/simple_remove_unittests.cc b/src/bin/d2/tests/simple_remove_unittests.cc index 2e4238e553..64ce75834a 100644 --- a/src/bin/d2/tests/simple_remove_unittests.cc +++ b/src/bin/d2/tests/simple_remove_unittests.cc @@ -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> diff --git a/src/lib/Makefile.am b/src/lib/Makefile.am index 7189389916..d984df2115 100644 --- a/src/lib/Makefile.am +++ b/src/lib/Makefile.am @@ -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 index 0000000000..784616b535 --- /dev/null +++ b/src/lib/d2srv/.gitattributes @@ -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 index 0000000000..1ab1e8f839 --- /dev/null +++ b/src/lib/d2srv/Makefile.am @@ -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 diff --git a/src/bin/d2/d2_cfg_mgr.cc b/src/lib/d2srv/d2_cfg_mgr.cc index 0e70b1b2ed..351b9caa67 100644 --- a/src/bin/d2/d2_cfg_mgr.cc +++ b/src/lib/d2srv/d2_cfg_mgr.cc @@ -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> diff --git a/src/bin/d2/d2_cfg_mgr.h b/src/lib/d2srv/d2_cfg_mgr.h index 00f5827f32..eade86cbff 100644 --- a/src/bin/d2/d2_cfg_mgr.h +++ b/src/lib/d2srv/d2_cfg_mgr.h @@ -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> diff --git a/src/bin/d2/d2_config.cc b/src/lib/d2srv/d2_config.cc index 74ff793f95..68fd48e5af 100644 --- a/src/bin/d2/d2_config.cc +++ b/src/lib/d2srv/d2_config.cc @@ -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> diff --git a/src/bin/d2/d2_config.h b/src/lib/d2srv/d2_config.h index 2d7b5e10e2..2d7b5e10e2 100644 --- a/src/bin/d2/d2_config.h +++ b/src/lib/d2srv/d2_config.h diff --git a/src/bin/d2/d2_log.cc b/src/lib/d2srv/d2_log.cc index 643e819a17..a56640b879 100644 --- a/src/bin/d2/d2_log.cc +++ b/src/lib/d2srv/d2_log.cc @@ -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 { diff --git a/src/bin/d2/d2_log.h b/src/lib/d2srv/d2_log.h index 2333a0c962..2b408e07a7 100644 --- a/src/bin/d2/d2_log.h +++ b/src/lib/d2srv/d2_log.h @@ -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 { diff --git a/src/bin/d2/d2_messages.cc b/src/lib/d2srv/d2_messages.cc index 117ca0adf1..117ca0adf1 100644 --- a/src/bin/d2/d2_messages.cc +++ b/src/lib/d2srv/d2_messages.cc diff --git a/src/bin/d2/d2_messages.h b/src/lib/d2srv/d2_messages.h index 5b76287c04..5b76287c04 100644 --- a/src/bin/d2/d2_messages.h +++ b/src/lib/d2srv/d2_messages.h diff --git a/src/bin/d2/d2_messages.mes b/src/lib/d2srv/d2_messages.mes index 4b3d47dd0a..4b3d47dd0a 100644 --- a/src/bin/d2/d2_messages.mes +++ b/src/lib/d2srv/d2_messages.mes diff --git a/src/bin/d2/d2_simple_parser.cc b/src/lib/d2srv/d2_simple_parser.cc index 5f0b5a42a2..15cfd67ab2 100644 --- a/src/bin/d2/d2_simple_parser.cc +++ b/src/lib/d2srv/d2_simple_parser.cc @@ -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> diff --git a/src/bin/d2/d2_simple_parser.h b/src/lib/d2srv/d2_simple_parser.h index d3e061f443..49f0d8a4ba 100644 --- a/src/bin/d2/d2_simple_parser.h +++ b/src/lib/d2srv/d2_simple_parser.h @@ -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 index 0000000000..3ab5a5578a --- /dev/null +++ b/src/lib/d2srv/tests/.gitignore @@ -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 index 0000000000..864c4d8cba --- /dev/null +++ b/src/lib/d2srv/tests/Makefile.am @@ -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 index 0000000000..768319e3fa --- /dev/null +++ b/src/lib/d2srv/tests/run_unittests.cc @@ -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); +} |