]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#4248] Checkpoint added logger
authorFrancis Dupont <fdupont@isc.org>
Fri, 5 Dec 2025 14:16:30 +0000 (15:16 +0100)
committerFrancis Dupont <fdupont@isc.org>
Tue, 9 Dec 2025 22:15:37 +0000 (23:15 +0100)
src/lib/dhcp/.gitattributes [new file with mode: 0644]
src/lib/dhcp/dhcp_log.cc [new file with mode: 0644]
src/lib/dhcp/dhcp_log.h [new file with mode: 0644]
src/lib/dhcp/dhcp_messages.cc [new file with mode: 0644]
src/lib/dhcp/dhcp_messages.h [new file with mode: 0644]
src/lib/dhcp/dhcp_messages.mes [new file with mode: 0644]
src/lib/dhcp/meson.build

diff --git a/src/lib/dhcp/.gitattributes b/src/lib/dhcp/.gitattributes
new file mode 100644 (file)
index 0000000..6663fc5
--- /dev/null
@@ -0,0 +1,2 @@
+/dhcp_messages.cc -diff merge=ours
+/dhcp_messages.h  -diff merge=ours
diff --git a/src/lib/dhcp/dhcp_log.cc b/src/lib/dhcp/dhcp_log.cc
new file mode 100644 (file)
index 0000000..731d8a1
--- /dev/null
@@ -0,0 +1,18 @@
+// Copyright (C) 2025 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 "dhcp/dhcp_log.h"
+
+namespace isc {
+namespace dhcp {
+
+isc::log::Logger dhcp_logger("dhcp");
+
+} // namespace dhcp
+} // namespace isc
+
diff --git a/src/lib/dhcp/dhcp_log.h b/src/lib/dhcp/dhcp_log.h
new file mode 100644 (file)
index 0000000..b4f9032
--- /dev/null
@@ -0,0 +1,26 @@
+// Copyright (C) 2025 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 DHCP_LOG_H
+#define DHCP_LOG_H
+
+#include <dhcp/dhcp_messages.h>
+#include <log/macros.h>
+
+namespace isc {
+namespace dhcp {
+
+/// \brief DHCP library Logger
+///
+/// Define the logger used to log messages.  We could define it in multiple
+/// modules, but defining in a single module and linking to it saves time and
+/// space.
+extern isc::log::Logger dhcp_logger;
+
+} // namespace dhcp
+} // namespace isc
+
+#endif // DHCP_LOG_H
diff --git a/src/lib/dhcp/dhcp_messages.cc b/src/lib/dhcp/dhcp_messages.cc
new file mode 100644 (file)
index 0000000..3180325
--- /dev/null
@@ -0,0 +1,23 @@
+// File created from src/lib/dhcp/dhcp_messages.mes
+
+#include <cstddef>
+#include <log/message_types.h>
+#include <log/message_initializer.h>
+
+namespace isc {
+namespace dhcp {
+
+
+} // namespace dhcp
+} // namespace isc
+
+namespace {
+
+const char* values[] = {
+    NULL
+};
+
+const isc::log::MessageInitializer initializer(values);
+
+} // Anonymous namespace
+
diff --git a/src/lib/dhcp/dhcp_messages.h b/src/lib/dhcp/dhcp_messages.h
new file mode 100644 (file)
index 0000000..a320114
--- /dev/null
@@ -0,0 +1,15 @@
+// File created from src/lib/dhcp/dhcp_messages.mes
+
+#ifndef DHCP_MESSAGES_H
+#define DHCP_MESSAGES_H
+
+#include <log/message_types.h>
+
+namespace isc {
+namespace dhcp {
+
+
+} // namespace dhcp
+} // namespace isc
+
+#endif // DHCP_MESSAGES_H
diff --git a/src/lib/dhcp/dhcp_messages.mes b/src/lib/dhcp/dhcp_messages.mes
new file mode 100644 (file)
index 0000000..19b6e6b
--- /dev/null
@@ -0,0 +1,8 @@
+# Copyright (C) 2025 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::dhcp
+
index 5c32ebdf9c44d1b55bf7779530cb5c814558bc85..2e1f710c4680333daf9e18ac609c0088add73564 100644 (file)
@@ -13,6 +13,8 @@ endif
 kea_dhcp_lib = shared_library(
     'kea-dhcp',
     'classify.cc',
+    'dhcp_log.cc',
+    'dhcp_messages.cc',
     'duid.cc',
     'duid_factory.cc',
     'hwaddr.cc',
@@ -69,6 +71,8 @@ kea_dhcp_headers = [
     'classify.h',
     'dhcp4.h',
     'dhcp6.h',
+    'dhcp_log.h',
+    'dhcp_messages.h',
     'docsis3_option_defs.h',
     'duid.h',
     'duid_factory.h',
@@ -123,3 +127,17 @@ kea_dhcp_headers = [
     'std_option_defs.h',
 ]
 install_headers(kea_dhcp_headers, preserve_path: true, subdir: 'kea/dhcp')
+
+if KEA_MSG_COMPILER.found()
+    current_source_dir = meson.current_source_dir()
+    target_gen_messages = run_target(
+        'src-lib-dhcp-dhcp_messages',
+        command: [
+            CD_AND_RUN,
+            TOP_SOURCE_DIR,
+            KEA_MSG_COMPILER,
+            'src/lib/dhcp/dhcp_messages.mes',
+        ],
+    )
+    TARGETS_GEN_MESSAGES += [target_gen_messages]
+endif