2
0
mirror of https://gitlab.isc.org/isc-projects/kea synced 2025-08-29 04:57:52 +00:00

[#3242] Added bare-bones perfmon hook library

New files:
    arm/hooks-perfmon.rst
	src/hooks/dhcp/perfmon/.gitattributes
	src/hooks/dhcp/perfmon/.gitignore
	src/hooks/dhcp/perfmon/Makefile.am
	src/hooks/dhcp/perfmon/libloadtests/.gitignore
	src/hooks/dhcp/perfmon/libloadtests/Makefile.am
	src/hooks/dhcp/perfmon/libloadtests/load_unload_unittests.cc
	src/hooks/dhcp/perfmon/libloadtests/run_unittests.cc
	src/hooks/dhcp/perfmon/perfmon.dox
	src/hooks/dhcp/perfmon/perfmon_callouts.cc
	src/hooks/dhcp/perfmon/perfmon_log.cc
	src/hooks/dhcp/perfmon/perfmon_log.h
	src/hooks/dhcp/perfmon/perfmon_messages.cc
	src/hooks/dhcp/perfmon/perfmon_messages.h
	src/hooks/dhcp/perfmon/perfmon_messages.mes
	src/hooks/dhcp/perfmon/tests/.gitignore
	src/hooks/dhcp/perfmon/tests/Makefile.am
	src/hooks/dhcp/perfmon/tests/run_unittests.cc
	src/hooks/dhcp/perfmon/version.cc

Modified:
	configure.ac
	arm/hooks-perfmon.rst
	arm/hooks.rst
	arm/logging.rst
	arm/rst_arm_sources.mk
	conf.py
	src/hooks/dhcp/Makefile.am
This commit is contained in:
Thomas Markwalder 2024-02-06 10:40:27 -05:00
parent 1a0f209cfd
commit 7202da7530
25 changed files with 615 additions and 1 deletions

View File

@ -1581,6 +1581,9 @@ AC_CONFIG_FILES([src/hooks/dhcp/stat_cmds/tests/Makefile])
AC_CONFIG_FILES([src/hooks/dhcp/user_chk/Makefile])
AC_CONFIG_FILES([src/hooks/dhcp/user_chk/tests/Makefile])
AC_CONFIG_FILES([src/hooks/dhcp/user_chk/tests/test_data_files_config.h])
AC_CONFIG_FILES([src/hooks/dhcp/perfmon/Makefile])
AC_CONFIG_FILES([src/hooks/dhcp/perfmon/libloadtests/Makefile])
AC_CONFIG_FILES([src/hooks/dhcp/perfmon/tests/Makefile])
AC_CONFIG_FILES([src/lib/Makefile])
AC_CONFIG_FILES([src/lib/asiodns/Makefile])
AC_CONFIG_FILES([src/lib/asiodns/tests/Makefile])

View File

@ -0,0 +1,39 @@
.. ischooklib:: libdhcp_perfmon.so
.. _hooks-perfmon:
``libdhcp_perfmon.so``: PerfMon
===============================
This hook library can be loaded by either kea-dhcp4 or kea-dhcp6 servers
to extend them with the ability to track and report performance related data.
.. note::
This library is currently under development and not yet functional.
Overview
~~~~~~~~
The library, added in Kea 2.5.6, can be loaded by the :iscman:`kea-dhcp4` or
:iscman:`kea-dhcp6` daemon by adding it to the ``hooks-libraries`` element of
the server's configuration:
.. code-block:: javascript
{
"hooks-libraries": [
{
"library": "/usr/local/lib/libdhcp_perfmon.so",
"parameters": {
...
}
},
...
],
...
}
Configuration
~~~~~~~~~~~~~
TBD

View File

@ -527,6 +527,10 @@ loaded by the correct process per the table below.
| | | a repository for the Kea configuration information. Kea |
| | | servers use this library to fetch their configurations. |
+-----------------------------------------------------------+--------------+--------------------------------------------------------------+
| :ref:`PerfMon <hooks-perfmon>` | Kea open | With this hook library, :iscman:`kea-dhcp4` server and |
| | source | :iscman:`kea-dhcp6` servers can track and report performance |
| | | data. CURRENTLY UNDER DEVELOPMENT |
+-----------------------------------------------------------+--------------+--------------------------------------------------------------+
| :ref:`Ping Check <hooks-ping-check>` | ISC support | With this hook library, :iscman:`kea-dhcp4` server can |
| | customers | perform ping checks of candidate lease addresses before |
| | | offering them to clients. |
@ -611,6 +615,7 @@ sections.
.. include:: hooks-legal-log.rst
.. include:: hooks-limits.rst
.. include:: hooks-cb-mysql.rst
.. include:: hooks-perfmon.rst
.. include:: hooks-ping-check.rst
.. include:: hooks-cb-pgsql.rst
.. include:: hooks-radius.rst

View File

@ -427,6 +427,10 @@ libraries), or hook libraries (open source or premium).
| | | message carried in |
| | | the packet is parsed. |
+----------------------------------+---------------------------------------+--------------------------------+
| ``kea-dhcp4.perfmon-hooks`` | :ischooklib:`libdhcp_perfmon.so` | Used |
| ``kea-dhcp6.perfmon-hooks`` | open-source hook library | to log messages related to |
| | | performan monitoring. |
+----------------------------------+---------------------------------------+--------------------------------+
| ``kea-dhcp4.ping-check-hooks`` | :ischooklib:`libdhcp_ping_check.so` | Used |
| | subscription hook library | to log messages related to |
| | | carrying out pre-offer ping |

View File

@ -31,6 +31,7 @@ rst_arm_sources += arm/hooks-limits.rst
rst_arm_sources += arm/hooks-cb-mysql.rst
rst_arm_sources += arm/hooks-cb-pgsql.rst
rst_arm_sources += arm/hooks-legal-log.rst
rst_arm_sources += arm/hooks-perfmon.rst
rst_arm_sources += arm/hooks-ping-check.rst
rst_arm_sources += arm/hooks-radius.rst
rst_arm_sources += arm/hooks-rbac.rst

View File

@ -96,6 +96,7 @@ exclude_patterns = [
'arm/hooks-lease-cmds.rst',
'arm/hooks-lease-query.rst',
'arm/hooks-limits.rst',
'arm/hooks-perfmon.rst',
'arm/hooks-ping-check.rst',
'arm/hooks-radius.rst',
'arm/hooks-rbac.rst',

View File

@ -1,4 +1,4 @@
SUBDIRS = bootp flex_option high_availability lease_cmds
SUBDIRS = bootp flex_option high_availability lease_cmds perfmon
if HAVE_MYSQL
SUBDIRS += mysql_cb

2
src/hooks/dhcp/perfmon/.gitattributes vendored Normal file
View File

@ -0,0 +1,2 @@
/perfmon_messages.cc -diff merge=ours
/perfmon_messages.h -diff merge=ours

1
src/hooks/dhcp/perfmon/.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/html

View File

@ -0,0 +1,86 @@
SUBDIRS = . tests libloadtests
AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
AM_CPPFLAGS += $(BOOST_INCLUDES)
AM_CXXFLAGS = $(KEA_CXXFLAGS)
# Ensure that the message file and doxygen file is included in the distribution
EXTRA_DIST = perfmon_messages.mes
EXTRA_DIST += perfmon.dox
CLEANFILES = *.gcno *.gcda
# convenience archive
noinst_LTLIBRARIES = libperfmon.la
libperfmon_la_SOURCES = perfmon_callouts.cc
libperfmon_la_SOURCES += perfmon_log.cc perfmon_log.h
libperfmon_la_SOURCES += perfmon_messages.cc perfmon_messages.h
libperfmon_la_SOURCES += version.cc
libperfmon_la_CXXFLAGS = $(AM_CXXFLAGS)
libperfmon_la_CPPFLAGS = $(AM_CPPFLAGS)
# install the shared object into $(libdir)/kea/hooks
lib_hooksdir = $(libdir)/kea/hooks
lib_hooks_LTLIBRARIES = libdhcp_perfmon.la
libdhcp_perfmon_la_SOURCES =
libdhcp_perfmon_la_LDFLAGS = $(AM_LDFLAGS)
libdhcp_perfmon_la_LDFLAGS += -avoid-version -export-dynamic -module
libdhcp_perfmon_la_LIBADD = libperfmon.la
libdhcp_perfmon_la_LIBADD += $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
libdhcp_perfmon_la_LIBADD += $(top_builddir)/src/lib/process/libkea-process.la
libdhcp_perfmon_la_LIBADD += $(top_builddir)/src/lib/eval/libkea-eval.la
libdhcp_perfmon_la_LIBADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la
libdhcp_perfmon_la_LIBADD += $(top_builddir)/src/lib/stats/libkea-stats.la
libdhcp_perfmon_la_LIBADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
libdhcp_perfmon_la_LIBADD += $(top_builddir)/src/lib/http/libkea-http.la
libdhcp_perfmon_la_LIBADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
libdhcp_perfmon_la_LIBADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
libdhcp_perfmon_la_LIBADD += $(top_builddir)/src/lib/database/libkea-database.la
libdhcp_perfmon_la_LIBADD += $(top_builddir)/src/lib/cc/libkea-cc.la
libdhcp_perfmon_la_LIBADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
libdhcp_perfmon_la_LIBADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
libdhcp_perfmon_la_LIBADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
libdhcp_perfmon_la_LIBADD += $(top_builddir)/src/lib/log/libkea-log.la
libdhcp_perfmon_la_LIBADD += $(top_builddir)/src/lib/util/libkea-util.la
libdhcp_perfmon_la_LIBADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
libdhcp_perfmon_la_LIBADD += $(LOG4CPLUS_LIBS)
libdhcp_perfmon_la_LIBADD += $(CRYPTO_LIBS)
libdhcp_perfmon_la_LIBADD += $(BOOST_LIBS)
# 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 perfmon_messages.h perfmon_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: perfmon_messages.h perfmon_messages.cc
@echo Message files regenerated
perfmon_messages.h perfmon_messages.cc: perfmon_messages.mes
$(top_builddir)/src/lib/log/compiler/kea-msg-compiler $(top_srcdir)/src/hooks/dhcp/perfmon/perfmon_messages.mes
else
messages perfmon_messages.h perfmon_messages.cc:
@echo Messages generation disabled. Configure with --enable-generate-messages to enable it.
endif

View File

@ -0,0 +1 @@
hook_load_unittests

View File

@ -0,0 +1,55 @@
SUBDIRS = .
AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
AM_CPPFLAGS += -I$(top_builddir)/src/hooks/dhcp/perfmon -I$(top_srcdir)/src/hooks/dhcp/perfmon
AM_CPPFLAGS += $(BOOST_INCLUDES)
AM_CPPFLAGS += -DLIBDHCP_PERFMON_SO=\"$(abs_top_builddir)/src/hooks/dhcp/perfmon/.libs/libdhcp_perfmon.so\"
AM_CXXFLAGS = $(KEA_CXXFLAGS)
if USE_STATIC_LINK
AM_LDFLAGS = -static
endif
EXTRA_DIST =
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = \
$(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
if HAVE_GTEST
TESTS = hook_load_unittests
hook_load_unittests_SOURCES =
hook_load_unittests_SOURCES += load_unload_unittests.cc
hook_load_unittests_SOURCES += run_unittests.cc
hook_load_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) $(LOG4CPLUS_INCLUDES)
hook_load_unittests_CXXFLAGS = $(AM_CXXFLAGS)
hook_load_unittests_LDFLAGS = $(AM_LDFLAGS) $(GTEST_LDFLAGS)
hook_load_unittests_LDADD = $(top_builddir)/src/lib/dhcpsrv/libkea-dhcpsrv.la
hook_load_unittests_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
hook_load_unittests_LDADD += $(top_builddir)/src/lib/eval/libkea-eval.la
hook_load_unittests_LDADD += $(top_builddir)/src/lib/dhcp_ddns/libkea-dhcp_ddns.la
hook_load_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
hook_load_unittests_LDADD += $(top_builddir)/src/lib/config/libkea-cfgclient.la
hook_load_unittests_LDADD += $(top_builddir)/src/lib/http/libkea-http.la
hook_load_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
hook_load_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
hook_load_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
hook_load_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
hook_load_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
hook_load_unittests_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
hook_load_unittests_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
hook_load_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
hook_load_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
hook_load_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
hook_load_unittests_LDADD += $(LOG4CPLUS_LIBS)
hook_load_unittests_LDADD += $(CRYPTO_LIBS)
hook_load_unittests_LDADD += $(BOOST_LIBS)
hook_load_unittests_LDADD += $(GTEST_LDADD)
noinst_PROGRAMS = $(TESTS)
endif

View File

@ -0,0 +1,64 @@
// Copyright (C) 2024 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/.
/// @file This file contains tests which exercise the load and unload
/// functions in the perfmon hook library. In order to test the load
/// function, one must be able to pass it hook library parameters. The
/// the only way to populate these parameters is by actually loading the
/// library via HooksManager::loadLibraries().
#include <config.h>
#include <cc/data.h>
#include <dhcpsrv/cfgmgr.h>
#include <hooks/hooks_manager.h>
#include <process/daemon.h>
#include <testutils/gtest_utils.h>
#include <testutils/lib_load_test_fixture.h>
#include <gtest/gtest.h>
#include <errno.h>
using namespace std;
using namespace isc;
using namespace isc::hooks;
using namespace isc::data;
using namespace isc::dhcp;
using namespace isc::process;
namespace {
/// @brief Test fixture for testing loading and unloading the stat cmds library
class PerfMonLibLoadTest : public isc::test::LibLoadTest {
public:
/// @brief Constructor
PerfMonLibLoadTest() : LibLoadTest(LIBDHCP_PERFMON_SO) {
}
/// @brief Destructor
virtual ~PerfMonLibLoadTest() {
unloadLibraries();
}
};
// Simple V4 test that checks the library can be loaded and unloaded several times.
TEST_F(PerfMonLibLoadTest, validLoad4) {
validDaemonTest("kea-dhcp4");
}
// Simple V6 test that checks the library can be loaded and unloaded several times.
TEST_F(PerfMonLibLoadTest, validLoad6) {
validDaemonTest("kea-dhcp6", AF_INET6);
}
// Simple V6 test that checks the library cannot by loaded by invalid daemons.
TEST_F(PerfMonLibLoadTest, invalidDaemonLoad) {
invalidDaemonTest("kea-ctrl-agent");
invalidDaemonTest("kea-dhcp-ddns");
invalidDaemonTest("bogus");
}
} // end of anonymous namespace

View File

@ -0,0 +1,20 @@
// Copyright (C) 2022 Internet Systems Consortium, Inc. ("ISC")
//
// This Source Code Form is subject to the terms of the End User License
// Agreement. See COPYING file in the premium/ directory.
#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);
}

View File

@ -0,0 +1,43 @@
// Copyright (C) 2024 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/.
/**
@page libdhcp_perfmon Kea PerfMon Hooks Library
@section libdhcp_perfmonIntro Introduction
Welcome to Kea PerfMon Hooks Library. This documentation is addressed to
developers who are interested in the internal operation of the PerfMon
library. This file provides information needed to understand and perhaps extend
this library.
This documentation is stand-alone: you should have read and understood the <a
href="https://reports.kea.isc.org/dev_guide/">Kea Developer's Guide</a> and in
particular its section about hooks.
@section perfmon PerfMon Overview
PerfMon (or perfmon) is a Hook library that can be loaded by
either kea-dhcp4 and kea-dhcp6 servers to extend them with the
ability to track and report performance related data.
The initial purpose of this library is provide supplemental data and
commands for monitoring the performance of kea-dhcp4 and kea-dhcp6
servers in real time.
THIS LIBRARY IS CURRENTLY UNDER DEVELOPMENT
@section perfmonMTCompatibility Multi-Threading Compatibility
The PerfMon Hook library is compatible with multi-threading.
*/

View File

@ -0,0 +1,98 @@
// Copyright (C) 2024 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/.
// Functions accessed by the hooks framework use C linkage to avoid the name
// mangling that accompanies use of the C++ compiler as well as to avoid
// issues related to namespaces.
#include <config.h>
#include <perfmon_log.h>
#include <cc/command_interpreter.h>
#include <dhcpsrv/cfgmgr.h>
#include <hooks/hooks.h>
#include <process/daemon.h>
using namespace isc::dhcp;
using namespace isc::hooks;
using namespace isc::process;
using namespace isc::perfmon;
extern "C" {
/// @brief This callout is called at the "pkt4_send" hook.
///
/// @param handle CalloutHandle which provides access to context.
///
/// @return 0 upon success, non-zero otherwise.
int pkt4_send(CalloutHandle& handle) {
CalloutHandle::CalloutNextStep status = handle.getStatus();
if (status == CalloutHandle::NEXT_STEP_DROP ||
status == CalloutHandle::NEXT_STEP_SKIP) {
return (0);
}
return (0);
}
/// @brief This callout is called at the "pkt6_send" hook.
///
/// @param handle CalloutHandle which provides access to context.
///
/// @return 0 upon success, non-zero otherwise.
int pkt6_send(CalloutHandle& handle) {
CalloutHandle::CalloutNextStep status = handle.getStatus();
if (status == CalloutHandle::NEXT_STEP_DROP ||
status == CalloutHandle::NEXT_STEP_SKIP) {
return (0);
}
return (0);
}
/// @brief This function is called when the library is loaded.
///
/// @param handle library handle
/// @return 0 when initialization is successful, 1 otherwise
int load(LibraryHandle& /* handle */) {
// Make the hook library not loadable by d2 or ca.
uint16_t family = CfgMgr::instance().getFamily();
const std::string& proc_name = Daemon::getProcName();
if (family == AF_INET) {
if (proc_name != "kea-dhcp4") {
isc_throw(isc::Unexpected, "Bad process name: " << proc_name
<< ", expected kea-dhcp4");
}
} else {
if (proc_name != "kea-dhcp6") {
isc_throw(isc::Unexpected, "Bad process name: " << proc_name
<< ", expected kea-dhcp6");
}
}
/// @todo register commands
/// handle.registerCommandCallout("command-here", handler_here);
LOG_INFO(perfmon_logger, PERFMON_INIT_OK);
return (0);
}
/// @brief This function is called when the library is unloaded.
///
/// @return 0 if deregistration was successful, 1 otherwise
int unload() {
LOG_INFO(perfmon_logger, PERFMON_DEINIT_OK);
return (0);
}
/// @brief This function is called to retrieve the multi-threading compatibility.
///
/// @return 1 which means compatible with multi-threading.
int multi_threading_compatible() {
return (1);
}
} // end extern "C"

View File

@ -0,0 +1,18 @@
// Copyright (C) 2024 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 <perfmon_log.h>
namespace isc {
namespace perfmon {
isc::log::Logger perfmon_logger("perfmon-hooks");
}
}

View File

@ -0,0 +1,23 @@
// Copyright (C) 2024 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 PERFMON_LOG_H
#define PERFMON_LOG_H
#include <log/logger_support.h>
#include <log/macros.h>
#include <perfmon_messages.h>
namespace isc {
namespace perfmon {
extern isc::log::Logger perfmon_logger;
} // end of isc::perfmon
} // end of isc namespace
#endif

View File

@ -0,0 +1,25 @@
// File created from ../../../../src/hooks/dhcp/perfmon/perfmon_messages.mes
#include <cstddef>
#include <log/message_types.h>
#include <log/message_initializer.h>
extern const isc::log::MessageID PERFMON_DEINIT_FAILED = "PERFMON_DEINIT_FAILED";
extern const isc::log::MessageID PERFMON_DEINIT_OK = "PERFMON_DEINIT_OK";
extern const isc::log::MessageID PERFMON_INIT_FAILED = "PERFMON_INIT_FAILED";
extern const isc::log::MessageID PERFMON_INIT_OK = "PERFMON_INIT_OK";
namespace {
const char* values[] = {
"PERFMON_DEINIT_FAILED", "unloading PerfMon hooks library failed: %1",
"PERFMON_DEINIT_OK", "unloading PerfMon hooks library successful",
"PERFMON_INIT_FAILED", "loading PerfMon hooks library failed: %1",
"PERFMON_INIT_OK", "loading PerfMon hooks library successful",
NULL
};
const isc::log::MessageInitializer initializer(values);
} // Anonymous namespace

View File

@ -0,0 +1,13 @@
// File created from ../../../../src/hooks/dhcp/perfmon/perfmon_messages.mes
#ifndef PERFMON_MESSAGES_H
#define PERFMON_MESSAGES_H
#include <log/message_types.h>
extern const isc::log::MessageID PERFMON_DEINIT_FAILED;
extern const isc::log::MessageID PERFMON_DEINIT_OK;
extern const isc::log::MessageID PERFMON_INIT_FAILED;
extern const isc::log::MessageID PERFMON_INIT_OK;
#endif // PERFMON_MESSAGES_H

View File

@ -0,0 +1,19 @@
# Copyright (C) 2024 Internet Systems Consortium, Inc. ("ISC")
% PERFMON_DEINIT_FAILED unloading PerfMon hooks library failed: %1
This error message indicates an error unloading the PerfMon hooks
library. The details of the error are provided as argument of
the log message.
% PERFMON_DEINIT_OK unloading PerfMon hooks library successful
This info message indicates that the PerfMon hooks library has been
removed successfully.
% PERFMON_INIT_FAILED loading PerfMon hooks library failed: %1
This error message indicates an error during loading the PerfMon
hooks library. The details of the error are provided as argument of
the log message.
% PERFMON_INIT_OK loading PerfMon hooks library successful
This info message indicates that the PerfMon hooks library has been
loaded successfully. Enjoy!

View File

@ -0,0 +1 @@
perfmon_unittests

View File

@ -0,0 +1,56 @@
SUBDIRS = .
AM_CPPFLAGS = -I$(top_builddir)/src/lib -I$(top_srcdir)/src/lib
AM_CPPFLAGS += -I$(top_builddir)/src/hooks/dhcp/perfmon -I$(top_srcdir)/src/hooks/dhcp/perfmon
AM_CPPFLAGS += $(BOOST_INCLUDES)
AM_CPPFLAGS += -DPERFMON_LIB_SO=\"$(abs_top_builddir)/src/hooks/dhcp/perfmon/.libs/libdhcp_perfmon.so\"
AM_CPPFLAGS += -DINSTALL_PROG=\"$(abs_top_srcdir)/install-sh\"
AM_CXXFLAGS = $(KEA_CXXFLAGS)
if USE_STATIC_LINK
AM_LDFLAGS = -static
endif
# Unit test data files need to get installed.
EXTRA_DIST =
CLEANFILES = *.gcno *.gcda
TESTS_ENVIRONMENT = $(LIBTOOL) --mode=execute $(VALGRIND_COMMAND)
LOG_COMPILER = $(LIBTOOL)
AM_LOG_FLAGS = --mode=execute
TESTS =
if HAVE_GTEST
TESTS += perfmon_unittests
perfmon_unittests_SOURCES = run_unittests.cc
#perfmon_unittests_SOURCES += perfmon_unittests.cc
perfmon_unittests_CPPFLAGS = $(AM_CPPFLAGS) $(GTEST_INCLUDES) $(LOG4CPLUS_INCLUDES)
perfmon_unittests_LDFLAGS = $(AM_LDFLAGS) $(CRYPTO_LDFLAGS) $(GTEST_LDFLAGS)
perfmon_unittests_CXXFLAGS = $(AM_CXXFLAGS)
perfmon_unittests_LDADD = $(top_builddir)/src/hooks/dhcp/perfmon/libperfmon.la
perfmon_unittests_LDADD += $(top_builddir)/src/lib/process/libkea-process.la
perfmon_unittests_LDADD += $(top_builddir)/src/lib/stats/libkea-stats.la
perfmon_unittests_LDADD += $(top_builddir)/src/lib/dhcp/libkea-dhcp++.la
perfmon_unittests_LDADD += $(top_builddir)/src/lib/hooks/libkea-hooks.la
perfmon_unittests_LDADD += $(top_builddir)/src/lib/database/libkea-database.la
perfmon_unittests_LDADD += $(top_builddir)/src/lib/cc/libkea-cc.la
perfmon_unittests_LDADD += $(top_builddir)/src/lib/asiolink/libkea-asiolink.la
perfmon_unittests_LDADD += $(top_builddir)/src/lib/dns/libkea-dns++.la
perfmon_unittests_LDADD += $(top_builddir)/src/lib/cryptolink/libkea-cryptolink.la
perfmon_unittests_LDADD += $(top_builddir)/src/lib/log/libkea-log.la
perfmon_unittests_LDADD += $(top_builddir)/src/lib/util/libkea-util.la
perfmon_unittests_LDADD += $(top_builddir)/src/lib/exceptions/libkea-exceptions.la
perfmon_unittests_LDADD += $(LOG4CPLUS_LIBS)
perfmon_unittests_LDADD += $(CRYPTO_LIBS)
perfmon_unittests_LDADD += $(BOOST_LIBS)
perfmon_unittests_LDADD += $(GTEST_LDADD)
endif
noinst_PROGRAMS = $(TESTS)

View File

@ -0,0 +1,19 @@
// Copyright (C) 2018 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);
}

View File

@ -0,0 +1,17 @@
// Copyright (C) 2018 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 <hooks/hooks.h>
extern "C" {
/// @brief returns Kea hooks version.
int version() {
return (KEA_HOOKS_VERSION);
}
}