From: Shawn Routhier Date: Fri, 16 Jan 2015 05:32:11 +0000 (-0800) Subject: [trac3664] Scaffolding for the lfc program X-Git-Tag: trac3712_base~38^2~9 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=6b345dcbf68297b41fa19eb2fad550019c63da51;p=thirdparty%2Fkea.git [trac3664] Scaffolding for the lfc program Add the lfc directory and update the auto tool files to process it. --- diff --git a/configure.ac b/configure.ac index a583ae05b0..b49136501a 100644 --- a/configure.ac +++ b/configure.ac @@ -1393,6 +1393,8 @@ AC_CONFIG_FILES([compatcheck/Makefile src/bin/keactrl/keactrl.conf src/bin/keactrl/tests/Makefile src/bin/keactrl/tests/keactrl_tests.sh + src/bin/lfc/Makefile + src/bin/lfc/tests/Makefile src/bin/perfdhcp/Makefile src/bin/perfdhcp/tests/Makefile src/bin/perfdhcp/tests/testdata/Makefile diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am index 372b59b4a0..c254189add 100644 --- a/src/bin/Makefile.am +++ b/src/bin/Makefile.am @@ -1,5 +1,5 @@ # The following build order must be maintained. -SUBDIRS = dhcp4 dhcp6 d2 perfdhcp admin +SUBDIRS = dhcp4 dhcp6 d2 perfdhcp admin lfc if CONFIG_BACKEND_JSON SUBDIRS += keactrl diff --git a/src/bin/lfc/Makefile.am b/src/bin/lfc/Makefile.am new file mode 100644 index 0000000000..eb9527f891 --- /dev/null +++ b/src/bin/lfc/Makefile.am @@ -0,0 +1,75 @@ +#SUBDIRS = . tests +SUBDIRS = . + +AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib +AM_CPPFLAGS += -I$(top_srcdir)/src/bin -I$(top_builddir)/src/bin +AM_CPPFLAGS += $(BOOST_INCLUDES) + +AM_CXXFLAGS = $(KEA_CXXFLAGS) +if USE_CLANGPP +# Disable unused parameter warning caused by some Boost headers when compiling with clang +AM_CXXFLAGS += -Wno-unused-parameter +endif + +if USE_STATIC_LINK +AM_LDFLAGS = -static +endif + +CLEANFILES = lfc_messages.h lfc_messages.cc s-messages + +man_MANS = kea-lfc.8 +DISTCLEANFILES = $(man_MANS) +EXTRA_DIST = $(man_MANS) kea-lfc.xml + +if GENERATE_DOCS +kea-lfc.8: kea-lfc.xml + @XSLTPROC@ --novalid --xinclude --nonet -o $@ \ + http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \ + $(srcdir)/kea-lfc.xml + +else + +$(man_MANS): + @echo Man generation disabled. Creating dummy $@. Configure with --enable-generate-docs to enable it. + @echo Man generation disabled. Remove this file, configure with --enable-generate-docs, and rebuild Kea > $@ + +endif + +lfc_messages.h lfc_messages.cc: s-messages + +s-messages: lfc_messages.mes + $(top_builddir)/src/lib/log/compiler/message $(top_srcdir)/src/bin/lfc/lfc_messages.mes + touch $@ + +BUILT_SOURCES = lfc_messages.h lfc_messages.cc + +# convenience archive + +noinst_LTLIBRARIES = liblfc.la + +liblfc_la_SOURCES = +liblfc_la_SOURCES += lfc_lfc.h +liblfc_la_SOURCES += lfc_lfc.cc + +nodist_liblfc_la_SOURCES = lfc_messages.h lfc_messages.cc +EXTRA_DIST += lfc_messages.mes + +sbin_PROGRAMS = kea-lfc + +kea_lfc_SOURCES = main.cc + +kea_lfc_LDADD = liblfc.la +kea_lfc_LDADD += $(top_builddir)/src/lib/log/libkea-log.la +kea_lfc_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la +kea_lfc_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la +kea_lfc_LDADD += $(top_builddir)/src/lib/asiodns/libkea-asiodns.la +kea_lfc_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la +kea_lfc_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la +kea_lfc_LDADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la +kea_lfc_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la +kea_lfc_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la +kea_lfc_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la +kea_lfc_LDADD += $(top_builddir)/src/lib/util/libkea-util.la +kea_lfc_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la + +kea_lfcdir = $(pkgdatadir) diff --git a/src/bin/lfc/lfc_lfc.cc b/src/bin/lfc/lfc_lfc.cc new file mode 100644 index 0000000000..6ded0e4e5c --- /dev/null +++ b/src/bin/lfc/lfc_lfc.cc @@ -0,0 +1,22 @@ +// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +#include + +namespace isc { +namespace lfc { + + +}; // namespace isc::lfc +}; // namespace isc diff --git a/src/bin/lfc/lfc_lfc.h b/src/bin/lfc/lfc_lfc.h new file mode 100644 index 0000000000..06c6136052 --- /dev/null +++ b/src/bin/lfc/lfc_lfc.h @@ -0,0 +1,29 @@ +// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +#ifndef LFC_LFC_H +#define LFC_LFC_H + +#include + +#include + +namespace isc { +namespace lfc { + +}; // namespace isc:lfc +}; // namespace isc + +#endif + diff --git a/src/bin/lfc/lfc_messages.mes b/src/bin/lfc/lfc_messages.mes new file mode 100644 index 0000000000..94c6f46373 --- /dev/null +++ b/src/bin/lfc/lfc_messages.mes @@ -0,0 +1,17 @@ +# Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted, provided that the above +# copyright notice and this permission notice appear in all copies. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. + +$NAMESPACE isc::lfc +% LFC_TEST_MESSAGE test messages +This is a test and placeholder debug message diff --git a/src/bin/lfc/main.cc b/src/bin/lfc/main.cc new file mode 100644 index 0000000000..2b3d06f5cf --- /dev/null +++ b/src/bin/lfc/main.cc @@ -0,0 +1,50 @@ +// Copyright (C) 2015 Internet Systems Consortium, Inc. ("ISC") +// +// Permission to use, copy, modify, and/or distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH +// REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +// AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, +// INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +// LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE +// OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +// PERFORMANCE OF THIS SOFTWARE. + +#include +#include +#include +#include +#include + +#include + +using namespace isc::lfc; +using namespace std; + +/// This file contains the entry point (main() function for the +/// standard LFC process, kea-lfc, component of the Kea software suite. +/// It fetches the lfccontroller singleton instance and invokes its launch +/// method. +/// The exit value of the program will be EXIT_SUCCESS if there were no +/// errors, EXIT_FAILURE otherwise. +int main(int argc, char* argv[]) { + int ret = EXIT_SUCCESS; + + // Instantiate/fetch the lfc application controller singleton. + // DControllerBasePtr& controller = D2Controller::instance(); + + // Launch the controller passing in command line arguments. + // Exit program with the controller's return code. + try { + // 'false' value disables test mode. + //controller->launch(argc, argv, false); + std::cerr << "Service started:" << std::endl; + } catch (const isc::Exception& ex) { + std::cerr << "Service failed:" << ex.what() << std::endl; + ret = EXIT_FAILURE; + } + + return (ret); +} diff --git a/src/bin/lfc/tests/Makefile.am b/src/bin/lfc/tests/Makefile.am new file mode 100644 index 0000000000..42b0d5beff --- /dev/null +++ b/src/bin/lfc/tests/Makefile.am @@ -0,0 +1,69 @@ +SHTESTS = + +noinst_SCRIPTS = lfc_tests.sh + +EXTRA_DIST = lfc_tests.sh.in + +# test using command-line arguments, so use check-local target instead of TESTS +check-local: + for shtest in $(SHTESTS) ; do \ + echo Running test: $$shtest ; \ + export KEA_LOCKFILE_DIR=$(abs_top_builddir); \ + ${SHELL} $(abs_builddir)/$$shtest || exit ; \ + done + +AM_CPPFLAGS = -I$(top_srcdir)/src/lib -I$(top_builddir)/src/lib +AM_CPPFLAGS += -I$(top_builddir)/src/bin # for generated spec_config.h header +AM_CPPFLAGS += -I$(top_srcdir)/src/bin +AM_CPPFLAGS += -I$(top_builddir)/src/lib/cc +AM_CPPFLAGS += -I$(top_srcdir)/src/lib/asiolink +AM_CPPFLAGS += $(BOOST_INCLUDES) +AM_CPPFLAGS += -DTEST_DATA_DIR=\"$(abs_top_srcdir)/src/lib/testutils/testdata\" +AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_top_builddir)/src/bin/lfc/tests\" +AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\" + +CLEANFILES = $(builddir)/interfaces.txt $(builddir)/logger_lockfile + +DISTCLEANFILES = lfc_process_tests.sh + +AM_CXXFLAGS = $(KEA_CXXFLAGS) +if USE_CLANGPP +# Disable unused parameter warning caused by some Boost headers when compiling with clang +AM_CXXFLAGS += -Wno-unused-parameter +endif + +if USE_STATIC_LINK +AM_LDFLAGS = -static +endif + +TESTS_ENVIRONMENT = \ + $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND) + +TESTS = +if HAVE_GTEST + +TESTS += lfc_unittests + +#lfc_unittests_SOURCES = d_test_stubs.cc d_test_stubs.h + +lfc_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) +lfc_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS) +lfc_unittests_LDADD = $(GTEST_LDADD) +lfc_unittests_LDADD += $(top_builddir)/src/bin/d2/libd2.la +lfc_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la +lfc_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la +lfc_unittests_LDADD += $(top_builddir)/src/lib/asiodns/libkea-asiodns.la +lfc_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la +lfc_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la +lfc_unittests_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la +lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la +lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la +lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la +lfc_unittests_LDADD += $(top_builddir)/src/lib/dhcpsrv/testutils/libdhcpsrvtest.la +lfc_unittests_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la +lfc_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la +lfc_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la + +endif + +noinst_PROGRAMS = $(TESTS)