]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[5077] Created libkea-http library.
authorMarcin Siodelski <marcin@isc.org>
Tue, 6 Dec 2016 16:36:37 +0000 (17:36 +0100)
committerMarcin Siodelski <marcin@isc.org>
Tue, 13 Dec 2016 12:52:08 +0000 (13:52 +0100)
configure.ac
src/lib/Makefile.am
src/lib/http/.gitignore [new file with mode: 0644]
src/lib/http/Makefile.am [new file with mode: 0644]
src/lib/http/http_log.cc [new file with mode: 0644]
src/lib/http/http_log.h [new file with mode: 0644]
src/lib/http/http_messages.mes [new file with mode: 0644]
src/lib/http/tests/.gitignore [new file with mode: 0644]
src/lib/http/tests/Makefile.am [new file with mode: 0644]
src/lib/http/tests/run_unittests.cc [new file with mode: 0644]

index 47d6c16359ea985e2d173d74260a2424cb86d3d3..8e298eb92a21ffa5873d326de8825930d881804b 100644 (file)
@@ -1621,6 +1621,8 @@ AC_CONFIG_FILES([compatcheck/Makefile
                  src/lib/hooks/tests/Makefile
                  src/lib/hooks/tests/marker_file.h
                  src/lib/hooks/tests/test_libraries.h
+                 src/lib/http/Makefile
+                 src/lib/http/tests/Makefile
                  src/lib/log/Makefile
                  src/lib/log/compiler/Makefile
                  src/lib/log/interprocess/Makefile
index dbbdb8f11bb32da267b1644d490cf7e1399e4a71..031a3498ab48341dce7e10c602ee88b2f718dec5 100644 (file)
@@ -1,3 +1,3 @@
 # The following build order must be maintained.
 SUBDIRS = exceptions util log cryptolink dns cc hooks asiolink testutils dhcp config \
-             stats asiodns dhcp_ddns eval dhcpsrv cfgrpt process
+             stats asiodns dhcp_ddns eval dhcpsrv cfgrpt process http
diff --git a/src/lib/http/.gitignore b/src/lib/http/.gitignore
new file mode 100644 (file)
index 0000000..4aeda87
--- /dev/null
@@ -0,0 +1,3 @@
+/http_messages.cc
+/http_messages.h
+/s-messages
diff --git a/src/lib/http/Makefile.am b/src/lib/http/Makefile.am
new file mode 100644 (file)
index 0000000..a0cba70
--- /dev/null
@@ -0,0 +1,43 @@
+SUBDIRS = . tests
+
+AM_CPPFLAGS  = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
+AM_CPPFLAGS += $(BOOST_INCLUDES)
+AM_CXXFLAGS  = $(KEA_CXXFLAGS)
+
+# Define rule to build logging source files from message file
+http_messages.h http_messages.cc: s-messages
+
+s-messages: http_messages.mes
+       $(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/lib/http/http_messages.mes
+       touch $@
+
+# Tell automake that the message files are built as part of the build process
+# (so that they are built before the main library is built).
+BUILT_SOURCES = http_messages.h http_messages.cc
+
+# Ensure that the message file is included in the distribution
+EXTRA_DIST = http_messages.mes
+
+# Get rid of generated message files on a clean
+CLEANFILES = *.gcno *.gcda http_messages.h http_messages.cc s-messages
+
+lib_LTLIBRARIES = libkea-http.la
+libkea_http_la_SOURCES  = http_log.cc http_log.h
+
+nodist_libkea_http_la_SOURCES = http_messages.cc http_messages.h
+
+libkea_http_la_CXXFLAGS = $(AM_CXXFLAGS)
+libkea_http_la_CPPFLAGS = $(AM_CPPFLAGS)
+libkea_http_la_LDFLAGS  = $(AM_LDFLAGS)
+libkea_http_la_LDFLAGS += -no-undefined -version-info 1:0:0
+
+libkea_http_la_LIBADD  =
+libkea_http_la_LIBADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
+libkea_http_la_LIBADD += $(top_builddir)/src/lib/log/libkea-log.la
+libkea_http_la_LIBADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
+libkea_http_la_LIBADD += $(LOG4CPLUS_LIBS) $(BOOST_LIBS)
+
+# Specify the headers for copying into the installation directory tree.
+libkea_process_includedir = $(pkgincludedir)/http
+libkea_process_include_HEADERS = \
+       http_log.h
diff --git a/src/lib/http/http_log.cc b/src/lib/http/http_log.cc
new file mode 100644 (file)
index 0000000..63f245b
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright (C) 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/.
+
+/// Defines the logger used by the top-level component of kea-dhcp-ddns.
+
+#include <http/http_log.h>
+
+namespace isc {
+namespace process {
+
+/// @brief Defines the logger used within libkea-http library.
+isc::log::Logger http_logger("http");
+
+} // namespace http
+} // namespace isc
+
diff --git a/src/lib/http/http_log.h b/src/lib/http/http_log.h
new file mode 100644 (file)
index 0000000..498c616
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright (C) 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/.
+
+#ifndef HTTP_LOG_H
+#define HTTP_LOG_H
+
+#include <log/logger_support.h>
+#include <log/macros.h>
+#include <http/http_messages.h>
+
+namespace isc {
+namespace http {
+
+/// Define the loggers used within libkea-http library.
+extern isc::log::Logger http_logger;
+
+} // namespace http
+} // namespace isc
+
+#endif // HTTP_LOG_H
diff --git a/src/lib/http/http_messages.mes b/src/lib/http/http_messages.mes
new file mode 100644 (file)
index 0000000..6465f8b
--- /dev/null
@@ -0,0 +1,10 @@
+# Copyright (C) 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/.
+
+$NAMESPACE isc::http
+
+% HTTP_DUMMY a dummy message for libkea-htto
+This is a dummy message.
diff --git a/src/lib/http/tests/.gitignore b/src/lib/http/tests/.gitignore
new file mode 100644 (file)
index 0000000..7100f8e
--- /dev/null
@@ -0,0 +1 @@
+/libhttp_unittests
diff --git a/src/lib/http/tests/Makefile.am b/src/lib/http/tests/Makefile.am
new file mode 100644 (file)
index 0000000..4faa5f0
--- /dev/null
@@ -0,0 +1,37 @@
+SUBDIRS = .
+
+AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
+AM_CPPFLAGS += $(BOOST_INCLUDES)
+AM_CPPFLAGS += -DTEST_DATA_BUILDDIR=\"$(abs_top_builddir)/src/lib/http/tests\"
+AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\"
+
+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 += libhttp_unittests
+
+libhttp_unittests_SOURCES  = run_unittests.cc
+
+libhttp_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES)
+libhttp_unittests_CXXFLAGS = $(AM_CXXFLAGS)
+libhttp_unittests_LDFLAGS  = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
+
+libhttp_unittests_LDADD  = $(top_builddir)/src/lib/http/libkea-http.la
+libhttp_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
+libhttp_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
+libhttp_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
+libhttp_unittests_LDADD += $(LOG4CPLUS_LIBS)
+libhttp_unittests_LDADD += $(BOOST_LIBS) $(GTEST_LDADD)
+endif
+
+noinst_PROGRAMS = $(TESTS)
diff --git a/src/lib/http/tests/run_unittests.cc b/src/lib/http/tests/run_unittests.cc
new file mode 100644 (file)
index 0000000..581febb
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright (C) 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 <log/logger_support.h>
+#include <http/http_log.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);
+}