From be8fab9d8bd303ddb7a877afb7b188db87985e4d Mon Sep 17 00:00:00 2001 From: rmaddikery Date: Thu, 19 Nov 2026 12:59:53 +0100 Subject: [PATCH 01/17] build(datarouter): make configurator_commands and libdrconfighdrs public - Both targets only carry constants (command and return codes, socket and client names) that form the contract between datarouter and the clients configuring it. --- score/datarouter/BUILD | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/score/datarouter/BUILD b/score/datarouter/BUILD index a8ac86e88..dc58607cf 100644 --- a/score/datarouter/BUILD +++ b/score/datarouter/BUILD @@ -285,9 +285,8 @@ cc_library( hdrs = ["include/daemon/data_router_cfg.h"], features = COMPILER_WARNING_FEATURES, strip_include_prefix = "include/daemon", - visibility = [ - "//platform/aas/log_and_trace/datarouterconf:__subpackages__", - ], + # Public: socket and client names shared with datarouter clients. + visibility = ["//visibility:public"], ) ## =========================================================================== @@ -330,10 +329,8 @@ cc_library( hdrs = [ "include/daemon/configurator_commands.h", ], - visibility = [ - "//platform/aas/log_and_trace/datarouterconf:__subpackages__", - "@score_logging//score/datarouter:__subpackages__", - ], + # Public: command and return codes shared with datarouter clients. + visibility = ["//visibility:public"], ) filegroup( From c70e0c5607dfdba32ef4b1d4a68e005ab1d11c7e Mon Sep 17 00:00:00 2001 From: rmaddikery Date: Thu, 19 Nov 2026 13:00:13 +0100 Subject: [PATCH 02/17] build(datarouter): make unixdomain_common public - External datarouter clients use UnixDomainSockAddr, SendSocketMessage and RecvSocketMessage to talk to the datarouter socket, which is most of the public surface of this target. --- score/datarouter/BUILD | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/score/datarouter/BUILD b/score/datarouter/BUILD index dc58607cf..3c5dbba77 100644 --- a/score/datarouter/BUILD +++ b/score/datarouter/BUILD @@ -71,10 +71,8 @@ cc_library( ], features = COMPILER_WARNING_FEATURES, strip_include_prefix = "include", - visibility = [ - "//platform/aas/log_and_trace/datarouterconf:__subpackages__", - "@score_logging//score/datarouter:__subpackages__", - ], + # Public: socket send/receive helpers used by datarouter clients. + visibility = ["//visibility:public"], deps = [ "@score_baselibs//score/language/futurecpp", "@score_baselibs//score/os:socket", From 68db466907a3fbfafc1f262378ea420095261539 Mon Sep 17 00:00:00 2001 From: rmaddikery Date: Thu, 19 Nov 2026 13:00:41 +0100 Subject: [PATCH 03/17] build(datarouter): drop visibility entries naming an external package - Remove the entries instead of leaving lists that suggest access which is not granted. --- score/datarouter/dlt_filetransfer_trigger_lib/BUILD | 2 -- score/datarouter/test/ut/etc/BUILD | 1 - 2 files changed, 3 deletions(-) diff --git a/score/datarouter/dlt_filetransfer_trigger_lib/BUILD b/score/datarouter/dlt_filetransfer_trigger_lib/BUILD index a654d5c2e..408936517 100644 --- a/score/datarouter/dlt_filetransfer_trigger_lib/BUILD +++ b/score/datarouter/dlt_filetransfer_trigger_lib/BUILD @@ -27,7 +27,6 @@ cc_library( ], features = COMPILER_WARNING_FEATURES, visibility = [ - "//platform/aas/log_and_trace/datarouterconf/src/services:__pkg__", "//platform/aas/pas/crash_handler:__pkg__", "//platform/aas/test/pas:__subpackages__", "//score/datarouter/test:__subpackages__", @@ -49,7 +48,6 @@ cc_library( ], features = COMPILER_WARNING_FEATURES, visibility = [ - "//platform/aas/log_and_trace/datarouterconf/src/filetransfer:__subpackages__", "//platform/aas/pas/crash_handler:__subpackages__", "//score/mw/log/legacy_non_verbose_api:__pkg__", "@score_logging//score/datarouter:__subpackages__", diff --git a/score/datarouter/test/ut/etc/BUILD b/score/datarouter/test/ut/etc/BUILD index 9fe118dc0..cd932ac2d 100644 --- a/score/datarouter/test/ut/etc/BUILD +++ b/score/datarouter/test/ut/etc/BUILD @@ -23,7 +23,6 @@ filegroup( "datarouter/persistent-logging_test_6.json", ], visibility = [ - "//platform/aas/log_and_trace/datarouterconf:__subpackages__", "@score_logging//score/datarouter:__subpackages__", ], ) From c2bdbe81733d9a13a720c9d4826a00c82d15f5fa Mon Sep 17 00:00:00 2001 From: rmaddikery Date: Thu, 19 Nov 2026 13:02:35 +0100 Subject: [PATCH 04/17] fix(datarouter): make data_router_cfg.h self-contained Include and define the constants inline. This makes the header self-contained and avoids per-translation-unit copies. --- score/datarouter/include/daemon/data_router_cfg.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/score/datarouter/include/daemon/data_router_cfg.h b/score/datarouter/include/daemon/data_router_cfg.h index 2fa3061b3..b7462590d 100644 --- a/score/datarouter/include/daemon/data_router_cfg.h +++ b/score/datarouter/include/daemon/data_router_cfg.h @@ -14,6 +14,8 @@ #ifndef SCORE_DATAROUTER_INCLUDE_DAEMON_DATA_ROUTER_CFG_H #define SCORE_DATAROUTER_INCLUDE_DAEMON_DATA_ROUTER_CFG_H +#include + #include namespace score @@ -22,8 +24,8 @@ namespace logging { namespace config { -static const std::string kSocketAddress{"datarouter_socket"}; -static constexpr const score::cpp::string_view kDltConfigClientName{"_dlt_config"}; +inline const std::string kSocketAddress{"datarouter_socket"}; +inline constexpr score::cpp::string_view kDltConfigClientName{"_dlt_config"}; } // namespace config } // namespace logging } // namespace score From 8de1121ad7bf5e50756e04c85b4fda8d5d269b7b Mon Sep 17 00:00:00 2001 From: rmaddikery Date: Thu, 19 Nov 2026 13:04:31 +0100 Subject: [PATCH 05/17] build(datarouter): make dlt_filetransfer_trigger_lib public - The target is the client API for triggering DLT file transfers. --- score/datarouter/dlt_filetransfer_trigger_lib/BUILD | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/score/datarouter/dlt_filetransfer_trigger_lib/BUILD b/score/datarouter/dlt_filetransfer_trigger_lib/BUILD index 408936517..d6f9c51ae 100644 --- a/score/datarouter/dlt_filetransfer_trigger_lib/BUILD +++ b/score/datarouter/dlt_filetransfer_trigger_lib/BUILD @@ -26,13 +26,8 @@ cc_library( "include/ifile_transfer.h", ], features = COMPILER_WARNING_FEATURES, - visibility = [ - "//platform/aas/pas/crash_handler:__pkg__", - "//platform/aas/test/pas:__subpackages__", - "//score/datarouter/test:__subpackages__", - "//score/test/component:__subpackages__", - "@score_baselibs//score/logging:__pkg__", - ], + # Public: client API to trigger DLT file transfers. + visibility = ["//visibility:public"], deps = [ "filetransfer_message_types", "//score/mw/log/legacy_non_verbose_api", From d761836c17938e666da6302d347edc4d42703975 Mon Sep 17 00:00:00 2001 From: rmaddikery Date: Thu, 19 Nov 2026 13:17:09 +0100 Subject: [PATCH 06/17] docs(datarouter): rename DatarouterConf in IPC diagram Use "Datarouter Configurator Client" as the IPC diagram node label. --- score/datarouter/doc/design/uml/detail-ipc.puml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/score/datarouter/doc/design/uml/detail-ipc.puml b/score/datarouter/doc/design/uml/detail-ipc.puml index 95e59d5c6..d32f9ea27 100644 --- a/score/datarouter/doc/design/uml/detail-ipc.puml +++ b/score/datarouter/doc/design/uml/detail-ipc.puml @@ -23,7 +23,7 @@ node "Datarouter" { component UnixDomainServer } -node "DatarouterConf" { +node "Datarouter Configurator Client" { component UnixDomainClient as config_client } From 0235e5810ba5e66712493fb2ae872a53d70a51f0 Mon Sep 17 00:00:00 2001 From: rmaddikery Date: Thu, 19 Nov 2026 13:22:32 +0100 Subject: [PATCH 07/17] build(datarouter): alias libdrconfighdrs to data_router_cfg Introduce data_router_cfg as the canonical target. Preserve the libdrconfighdrs label with an alias and retain the short include path until external consumers migrate. --- score/datarouter/BUILD | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/score/datarouter/BUILD b/score/datarouter/BUILD index 3c5dbba77..c313ea5b5 100644 --- a/score/datarouter/BUILD +++ b/score/datarouter/BUILD @@ -279,14 +279,22 @@ cc_library( ## --------------------------------------------------------------------------- cc_library( - name = "libdrconfighdrs", + name = "data_router_cfg", hdrs = ["include/daemon/data_router_cfg.h"], features = COMPILER_WARNING_FEATURES, - strip_include_prefix = "include/daemon", + # Transitional: keeps the short include "data_router_cfg.h" working until consumers use the full path. + includes = ["include/daemon"], # Public: socket and client names shared with datarouter clients. visibility = ["//visibility:public"], ) +# Legacy label, kept until consumers depend on :data_router_cfg. +alias( + name = "libdrconfighdrs", + actual = ":data_router_cfg", + visibility = ["//visibility:public"], +) + ## =========================================================================== ## Datarouter ## --------------------------------------------------------------------------- From 3e1d2e282c0fd7657b433bfa80ab6b58e822f9d7 Mon Sep 17 00:00:00 2001 From: rmaddikery Date: Thu, 19 Nov 2026 13:24:23 +0100 Subject: [PATCH 08/17] build(datarouter): use data_router_cfg and its full include path in-repo - Switch the in-repo dependencies from the libdrconfighdrs alias to data_router_cfg and include the header via its repo-root-relative path, so only external consumers still rely on the transitional alias and includes. --- score/datarouter/BUILD | 6 +++--- score/datarouter/include/StructDataSource | 2 +- score/datarouter/src/daemon/socketserver.cpp | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/score/datarouter/BUILD b/score/datarouter/BUILD index c313ea5b5..51998a8e2 100644 --- a/score/datarouter/BUILD +++ b/score/datarouter/BUILD @@ -322,7 +322,7 @@ cc_library( strip_include_prefix = "include", visibility = ["//visibility:private"], deps = [ - ":libdrconfighdrs", + ":data_router_cfg", ], ) @@ -583,10 +583,10 @@ cc_library( visibility = ["//visibility:private"], deps = [ ":configurator_commands", + ":data_router_cfg", ":datarouter_feature_config", ":dlt_log_channel_lib", ":dltserver_common", - ":libdrconfighdrs", ":log_entry_deserialization", ":log_sender", ":logchannel_utility", @@ -1039,12 +1039,12 @@ cc_library( ":udpoutput_mock", # buildifier on ":unixdomain_mock", + ":data_router_cfg", ":datarouter_feature_config_testing", ":datarouter_types", ":diagnostic_job_handler_mock", ":diagnostic_job_parser_mock", ":dlt_log_server_mock", - ":libdrconfighdrs", ":log_entry_deserialization", ":log_sender_mock", ":logparser_testing", diff --git a/score/datarouter/include/StructDataSource b/score/datarouter/include/StructDataSource index fa93fe76c..2fcc7c1e1 100644 --- a/score/datarouter/include/StructDataSource +++ b/score/datarouter/include/StructDataSource @@ -11,4 +11,4 @@ * SPDX-License-Identifier: Apache-2.0 ********************************************************************************/ -#include +#include "score/datarouter/include/daemon/data_router_cfg.h" diff --git a/score/datarouter/src/daemon/socketserver.cpp b/score/datarouter/src/daemon/socketserver.cpp index df3324607..b0711448b 100644 --- a/score/datarouter/src/daemon/socketserver.cpp +++ b/score/datarouter/src/daemon/socketserver.cpp @@ -32,7 +32,7 @@ #include "score/concurrency/thread_pool.h" // Constants -#include "data_router_cfg.h" +#include "score/datarouter/include/daemon/data_router_cfg.h" #include #include From a41c6fd698471a6cfdf107b3442d44e1c5de0861 Mon Sep 17 00:00:00 2001 From: rmaddikery Date: Thu, 19 Nov 2026 13:36:28 +0100 Subject: [PATCH 09/17] build(datarouter): drop stale filetransfer message visibility Remove the visibility label for a package that does not exist in this repository. Consumers depend on dlt_filetransfer_trigger_lib and do not use these message headers directly. --- score/datarouter/dlt_filetransfer_trigger_lib/BUILD | 1 - 1 file changed, 1 deletion(-) diff --git a/score/datarouter/dlt_filetransfer_trigger_lib/BUILD b/score/datarouter/dlt_filetransfer_trigger_lib/BUILD index d6f9c51ae..fe57876a9 100644 --- a/score/datarouter/dlt_filetransfer_trigger_lib/BUILD +++ b/score/datarouter/dlt_filetransfer_trigger_lib/BUILD @@ -43,7 +43,6 @@ cc_library( ], features = COMPILER_WARNING_FEATURES, visibility = [ - "//platform/aas/pas/crash_handler:__subpackages__", "//score/mw/log/legacy_non_verbose_api:__pkg__", "@score_logging//score/datarouter:__subpackages__", ], From 591d6925fcfc00f45f1634342ec8d03be063da18 Mon Sep 17 00:00:00 2001 From: rmaddikery Date: Thu, 19 Nov 2026 14:24:22 +0100 Subject: [PATCH 10/17] build(datarouter): add unixdomain_internal and use it in-repo - Add a datarouter-private target and header for the unix domain declarations that are not part of the client API. - Migrate the client, the server and their tests to it. The header still forwards to unix_domain_common.h, so no declaration moves yet. --- score/datarouter/BUILD | 16 ++++++++++++++++ .../unix_domain/unix_domain_internal.h | 19 +++++++++++++++++++ .../src/unix_domain/unix_domain_client.cpp | 1 + .../src/unix_domain/unix_domain_server.cpp | 1 + score/datarouter/test/ut/ut_logging/BUILD | 2 ++ .../ut/ut_logging/test_unix_domain_common.cpp | 1 + .../ut/ut_logging/test_unix_domain_server.cpp | 1 + 7 files changed, 41 insertions(+) create mode 100644 score/datarouter/include/unix_domain/unix_domain_internal.h diff --git a/score/datarouter/BUILD b/score/datarouter/BUILD index 51998a8e2..750cc212a 100644 --- a/score/datarouter/BUILD +++ b/score/datarouter/BUILD @@ -81,6 +81,19 @@ cc_library( ], ) +cc_library( + name = "unixdomain_internal", + hdrs = [ + "include/unix_domain/unix_domain_internal.h", + ], + features = COMPILER_WARNING_FEATURES, + strip_include_prefix = "include", + visibility = ["@score_logging//score/datarouter:__subpackages__"], + deps = [ + ":unixdomain_common", + ], +) + cc_library( name = "unixdomain_client", srcs = [ @@ -94,6 +107,7 @@ cc_library( visibility = ["//visibility:private"], deps = [ ":unixdomain_common", + ":unixdomain_internal", "@score_baselibs//score/language/futurecpp", "@score_baselibs//score/os:pthread", ], @@ -115,6 +129,7 @@ cc_library( ], deps = [ ":unixdomain_common", + ":unixdomain_internal", "//score/datarouter/src/configuration/dynamic_config:i_session", "@score_baselibs//score/os:pthread", "@score_baselibs//score/os:sys_poll", @@ -135,6 +150,7 @@ cc_library( visibility = ["//score/datarouter/test:__subpackages__"], deps = [ ":unixdomain_client", + ":unixdomain_internal", "//score/datarouter/src/configuration/dynamic_config:i_session", "@score_baselibs//score/os:pthread", "@score_baselibs//score/os:sys_poll", diff --git a/score/datarouter/include/unix_domain/unix_domain_internal.h b/score/datarouter/include/unix_domain/unix_domain_internal.h new file mode 100644 index 000000000..40e232258 --- /dev/null +++ b/score/datarouter/include/unix_domain/unix_domain_internal.h @@ -0,0 +1,19 @@ +/******************************************************************************** + * Copyright (c) 2025 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Apache License Version 2.0 which is available at + * https://www.apache.org/licenses/LICENSE-2.0 + * + * SPDX-License-Identifier: Apache-2.0 + ********************************************************************************/ + +#ifndef SCORE_DATAROUTER_INCLUDE_UNIX_DOMAIN_UNIX_DOMAIN_INTERNAL_H +#define SCORE_DATAROUTER_INCLUDE_UNIX_DOMAIN_UNIX_DOMAIN_INTERNAL_H + +#include "unix_domain/unix_domain_common.h" + +#endif // SCORE_DATAROUTER_INCLUDE_UNIX_DOMAIN_UNIX_DOMAIN_INTERNAL_H diff --git a/score/datarouter/src/unix_domain/unix_domain_client.cpp b/score/datarouter/src/unix_domain/unix_domain_client.cpp index 38d9ec7ae..f93cc4655 100644 --- a/score/datarouter/src/unix_domain/unix_domain_client.cpp +++ b/score/datarouter/src/unix_domain/unix_domain_client.cpp @@ -12,6 +12,7 @@ ********************************************************************************/ #include "unix_domain/unix_domain_client.h" +#include "unix_domain/unix_domain_internal.h" #include "score/os/pthread.h" #include "score/os/socket.h" #include "score/os/unistd.h" diff --git a/score/datarouter/src/unix_domain/unix_domain_server.cpp b/score/datarouter/src/unix_domain/unix_domain_server.cpp index bf7d2feaf..62de2724f 100644 --- a/score/datarouter/src/unix_domain/unix_domain_server.cpp +++ b/score/datarouter/src/unix_domain/unix_domain_server.cpp @@ -12,6 +12,7 @@ ********************************************************************************/ #include "unix_domain/unix_domain_server.h" +#include "unix_domain/unix_domain_internal.h" #include "score/os/pthread.h" #include "score/os/socket.h" diff --git a/score/datarouter/test/ut/ut_logging/BUILD b/score/datarouter/test/ut/ut_logging/BUILD index 304bd9850..8157a8ace 100644 --- a/score/datarouter/test/ut/ut_logging/BUILD +++ b/score/datarouter/test/ut/ut_logging/BUILD @@ -374,6 +374,7 @@ cc_test( "@score_baselibs//score/os/mocklib:sys_poll_mock", "@score_baselibs//score/os/mocklib:unistd_mock", "@score_baselibs//score/os/utils/mocklib:signal_mock", + "@score_logging//score/datarouter:unixdomain_internal", "@score_logging//score/datarouter:unixdomain_server", ], ) @@ -433,6 +434,7 @@ cc_test( "@googletest//:gtest_main", "@score_baselibs//score/os/mocklib:socket_mock", "@score_logging//score/datarouter:unixdomain_common", + "@score_logging//score/datarouter:unixdomain_internal", ], ) diff --git a/score/datarouter/test/ut/ut_logging/test_unix_domain_common.cpp b/score/datarouter/test/ut/ut_logging/test_unix_domain_common.cpp index 219353635..a9206a706 100644 --- a/score/datarouter/test/ut/ut_logging/test_unix_domain_common.cpp +++ b/score/datarouter/test/ut/ut_logging/test_unix_domain_common.cpp @@ -13,6 +13,7 @@ #include "score/os/mocklib/socketmock.h" #include "unix_domain/unix_domain_common.h" +#include "unix_domain/unix_domain_internal.h" #include #include #include diff --git a/score/datarouter/test/ut/ut_logging/test_unix_domain_server.cpp b/score/datarouter/test/ut/ut_logging/test_unix_domain_server.cpp index 645aeb2b5..7d9d9bf42 100644 --- a/score/datarouter/test/ut/ut_logging/test_unix_domain_server.cpp +++ b/score/datarouter/test/ut/ut_logging/test_unix_domain_server.cpp @@ -19,6 +19,7 @@ #include "score/os/socket.h" #include "score/os/unistd.h" #include "score/os/utils/mocklib/signalmock.h" +#include "unix_domain/unix_domain_internal.h" #include "unix_domain/unix_domain_server.h" #include From 7db9c05708d8b464011d04484885c9eaeda1108b Mon Sep 17 00:00:00 2001 From: rmaddikery Date: Thu, 19 Nov 2026 14:28:53 +0100 Subject: [PATCH 11/17] refactor(datarouter): narrow unix_domain_common.h to the client API - Move internals to unix_domain_internal.h. The public header keeps UnixDomainSockAddr, SendSocketMessage and RecvSocketMessage, so existing external consumers need no change. --- score/datarouter/BUILD | 3 ++ .../include/unix_domain/unix_domain_common.h | 26 ------------ .../unix_domain/unix_domain_internal.h | 42 +++++++++++++++++++ .../src/unix_domain/unix_domain_common.cpp | 1 + 4 files changed, 46 insertions(+), 26 deletions(-) diff --git a/score/datarouter/BUILD b/score/datarouter/BUILD index 750cc212a..7e2782fcf 100644 --- a/score/datarouter/BUILD +++ b/score/datarouter/BUILD @@ -64,6 +64,7 @@ cc_library( cc_library( name = "unixdomain_common", srcs = [ + "include/unix_domain/unix_domain_internal.h", "src/unix_domain/unix_domain_common.cpp", ], hdrs = [ @@ -91,6 +92,8 @@ cc_library( visibility = ["@score_logging//score/datarouter:__subpackages__"], deps = [ ":unixdomain_common", + "@score_baselibs//score/language/futurecpp", + "@score_baselibs//score/os/utils:signal", ], ) diff --git a/score/datarouter/include/unix_domain/unix_domain_common.h b/score/datarouter/include/unix_domain/unix_domain_common.h index f9838f3b5..10b55ebc2 100644 --- a/score/datarouter/include/unix_domain/unix_domain_common.h +++ b/score/datarouter/include/unix_domain/unix_domain_common.h @@ -24,8 +24,6 @@ #include #include -#include "score/os/utils/signal.h" - namespace score { namespace platform @@ -34,19 +32,6 @@ namespace internal { using SharedMemoryFileHandle = std::int32_t; -enum class MessageType : std::uint8_t -{ - kDefault = 0, - kSharedMemoryFileHandle = 1, -}; - -struct SocketMessangerHeader // __attribute__((packed)) // TODO: deal with packed -{ - uint16_t len; - MessageType type; - std::int32_t pid; -}; - class UnixDomainSockAddr { public: @@ -74,9 +59,6 @@ void SendSocketMessage(std::int32_t connection_file_descriptor, std::string_view message, score::cpp::optional file_handle = score::cpp::nullopt); -/* @data - data to be send over the socket */ -void SendAncillaryDataOverSocket(int connection_file_descriptor, score::cpp::span data); - /* Returns: Message string. Possibly zero-sized when pinging or timeout occurs. score::cpp::nullopt is returned when error * occurs. * @ancillary_data_process - callback may be used to convert ancillary data to file descriptor but it is not the only @@ -87,14 +69,6 @@ std::optional RecvSocketMessage( std::int32_t socket_fd, AncillaryDataFileHandleReceptionCallback ancillary_data_process = AncillaryDataFileHandleReceptionCallback{}); -std::optional RecvSocketMessage( - std::int32_t socket_fd, - score::cpp::optional& file_handle, - score::cpp::optional& peer_pid, - AncillaryDataFileHandleReceptionCallback ancillary_data_process = AncillaryDataFileHandleReceptionCallback{}); - -void SetupSignals(const std::unique_ptr& signal); - } // namespace internal } // namespace platform } // namespace score diff --git a/score/datarouter/include/unix_domain/unix_domain_internal.h b/score/datarouter/include/unix_domain/unix_domain_internal.h index 40e232258..ed8fa2441 100644 --- a/score/datarouter/include/unix_domain/unix_domain_internal.h +++ b/score/datarouter/include/unix_domain/unix_domain_internal.h @@ -14,6 +14,48 @@ #ifndef SCORE_DATAROUTER_INCLUDE_UNIX_DOMAIN_UNIX_DOMAIN_INTERNAL_H #define SCORE_DATAROUTER_INCLUDE_UNIX_DOMAIN_UNIX_DOMAIN_INTERNAL_H +#include +#include + +#include +#include + +#include "score/os/utils/signal.h" #include "unix_domain/unix_domain_common.h" +namespace score +{ +namespace platform +{ +namespace internal +{ + +enum class MessageType : std::uint8_t +{ + kDefault = 0, + kSharedMemoryFileHandle = 1, +}; + +struct SocketMessangerHeader // __attribute__((packed)) // TODO: deal with packed +{ + uint16_t len; + MessageType type; + std::int32_t pid; +}; + +/* @data - data to be send over the socket */ +void SendAncillaryDataOverSocket(int connection_file_descriptor, score::cpp::span data); + +std::optional RecvSocketMessage( + std::int32_t socket_fd, + score::cpp::optional& file_handle, + score::cpp::optional& peer_pid, + AncillaryDataFileHandleReceptionCallback ancillary_data_process = AncillaryDataFileHandleReceptionCallback{}); + +void SetupSignals(const std::unique_ptr& signal); + +} // namespace internal +} // namespace platform +} // namespace score + #endif // SCORE_DATAROUTER_INCLUDE_UNIX_DOMAIN_UNIX_DOMAIN_INTERNAL_H diff --git a/score/datarouter/src/unix_domain/unix_domain_common.cpp b/score/datarouter/src/unix_domain/unix_domain_common.cpp index 5785a913b..ddcb06a73 100644 --- a/score/datarouter/src/unix_domain/unix_domain_common.cpp +++ b/score/datarouter/src/unix_domain/unix_domain_common.cpp @@ -12,6 +12,7 @@ ********************************************************************************/ #include "unix_domain/unix_domain_common.h" +#include "score/datarouter/include/unix_domain/unix_domain_internal.h" #include "score/os/errno.h" #include "score/os/socket.h" #include "score/os/utils/signal.h" From 20925c25acda590a870e5d65476383e4101fb652 Mon Sep 17 00:00:00 2001 From: rmaddikery Date: Thu, 19 Nov 2026 15:07:24 +0100 Subject: [PATCH 12/17] build(datarouter): use implementation_deps in unixdomain_common - avoid leaking transitive deps for public targets --- score/datarouter/BUILD | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/score/datarouter/BUILD b/score/datarouter/BUILD index 7e2782fcf..e5923e741 100644 --- a/score/datarouter/BUILD +++ b/score/datarouter/BUILD @@ -71,14 +71,16 @@ cc_library( "include/unix_domain/unix_domain_common.h", ], features = COMPILER_WARNING_FEATURES, + implementation_deps = [ + "@score_baselibs//score/os:socket", + "@score_baselibs//score/os/utils:signal", + "@score_baselibs//score/quality/compiler_warnings", + ], strip_include_prefix = "include", # Public: socket send/receive helpers used by datarouter clients. visibility = ["//visibility:public"], deps = [ "@score_baselibs//score/language/futurecpp", - "@score_baselibs//score/os:socket", - "@score_baselibs//score/os/utils:signal", - "@score_baselibs//score/quality/compiler_warnings", ], ) @@ -113,6 +115,9 @@ cc_library( ":unixdomain_internal", "@score_baselibs//score/language/futurecpp", "@score_baselibs//score/os:pthread", + "@score_baselibs//score/os:socket", + "@score_baselibs//score/os:unistd", + "@score_baselibs//score/os/utils:signal", ], ) @@ -135,7 +140,10 @@ cc_library( ":unixdomain_internal", "//score/datarouter/src/configuration/dynamic_config:i_session", "@score_baselibs//score/os:pthread", + "@score_baselibs//score/os:socket", "@score_baselibs//score/os:sys_poll", + "@score_baselibs//score/os:unistd", + "@score_baselibs//score/os/utils:signal", "@score_baselibs//score/quality/compiler_warnings", ], ) @@ -156,7 +164,10 @@ cc_library( ":unixdomain_internal", "//score/datarouter/src/configuration/dynamic_config:i_session", "@score_baselibs//score/os:pthread", + "@score_baselibs//score/os:socket", "@score_baselibs//score/os:sys_poll", + "@score_baselibs//score/os:unistd", + "@score_baselibs//score/os/utils:signal", "@score_baselibs//score/quality/compiler_warnings", ], ) From 2e34cb9913ff462218d39ddb44e6791e9fe7c14d Mon Sep 17 00:00:00 2001 From: rmaddikery Date: Thu, 19 Nov 2026 15:24:40 +0100 Subject: [PATCH 13/17] refactor(datarouter): move unix domain API to unix_domain namespace --- score/datarouter/BUILD | 1 + .../doc/design/uml/package-datarouter.puml | 5 ++- .../include/unix_domain/unix_domain_client.h | 2 +- .../include/unix_domain/unix_domain_common.h | 4 +-- .../unix_domain/unix_domain_internal.h | 7 ++++ .../include/unix_domain/unix_domain_server.h | 2 +- .../mocks/unix_domain/unix_domain_client.h | 2 +- .../mocks/unix_domain/unix_domain_server.h | 2 +- score/datarouter/src/daemon/socketserver.cpp | 2 +- .../src/unix_domain/unix_domain_common.cpp | 32 +++++++++++++++---- .../test/ut/ut_logging/tracingTest.cpp | 2 +- 11 files changed, 46 insertions(+), 15 deletions(-) diff --git a/score/datarouter/BUILD b/score/datarouter/BUILD index e5923e741..0ca7513fb 100644 --- a/score/datarouter/BUILD +++ b/score/datarouter/BUILD @@ -186,6 +186,7 @@ cc_library( ], deps = [ ":unixdomain_common", + ":unixdomain_internal", "//score/datarouter/src/configuration/dynamic_config:i_session", "@googletest//:gtest_main", ], diff --git a/score/datarouter/doc/design/uml/package-datarouter.puml b/score/datarouter/doc/design/uml/package-datarouter.puml index 853dbe357..3d8e4e8bf 100644 --- a/score/datarouter/doc/design/uml/package-datarouter.puml +++ b/score/datarouter/doc/design/uml/package-datarouter.puml @@ -35,12 +35,15 @@ package "score::platform::internal" { class MessagePassingServer class MessagePassingServer::ISession class UnixDomainClient - class UnixDomainSockAddr class UnixDomainServer class UnixDomainServer::SessionHandle class UnixDomainServer::SessionWrapper } +package "score::platform::unix_domain" { + class UnixDomainSockAddr +} + package "score::logging::dltserver" { class DltLogServer class DltVerboseHandler diff --git a/score/datarouter/include/unix_domain/unix_domain_client.h b/score/datarouter/include/unix_domain/unix_domain_client.h index 2d90aa6bc..5458989f3 100644 --- a/score/datarouter/include/unix_domain/unix_domain_client.h +++ b/score/datarouter/include/unix_domain/unix_domain_client.h @@ -14,7 +14,7 @@ #ifndef SCORE_DATAROUTER_INCLUDE_UNIX_DOMAIN_UNIX_DOMAIN_CLIENT_H #define SCORE_DATAROUTER_INCLUDE_UNIX_DOMAIN_UNIX_DOMAIN_CLIENT_H -#include "unix_domain/unix_domain_common.h" +#include "unix_domain/unix_domain_internal.h" #include diff --git a/score/datarouter/include/unix_domain/unix_domain_common.h b/score/datarouter/include/unix_domain/unix_domain_common.h index 10b55ebc2..61dde78d1 100644 --- a/score/datarouter/include/unix_domain/unix_domain_common.h +++ b/score/datarouter/include/unix_domain/unix_domain_common.h @@ -28,7 +28,7 @@ namespace score { namespace platform { -namespace internal +namespace unix_domain { using SharedMemoryFileHandle = std::int32_t; @@ -69,7 +69,7 @@ std::optional RecvSocketMessage( std::int32_t socket_fd, AncillaryDataFileHandleReceptionCallback ancillary_data_process = AncillaryDataFileHandleReceptionCallback{}); -} // namespace internal +} // namespace unix_domain } // namespace platform } // namespace score diff --git a/score/datarouter/include/unix_domain/unix_domain_internal.h b/score/datarouter/include/unix_domain/unix_domain_internal.h index ed8fa2441..fcee4fc20 100644 --- a/score/datarouter/include/unix_domain/unix_domain_internal.h +++ b/score/datarouter/include/unix_domain/unix_domain_internal.h @@ -30,6 +30,13 @@ namespace platform namespace internal { +// Public API names used unqualified by the implementation in this namespace. +using unix_domain::AncillaryDataFileHandleReceptionCallback; +using unix_domain::RecvSocketMessage; +using unix_domain::SendSocketMessage; +using unix_domain::SharedMemoryFileHandle; +using unix_domain::UnixDomainSockAddr; + enum class MessageType : std::uint8_t { kDefault = 0, diff --git a/score/datarouter/include/unix_domain/unix_domain_server.h b/score/datarouter/include/unix_domain/unix_domain_server.h index 8606af894..69f424a92 100644 --- a/score/datarouter/include/unix_domain/unix_domain_server.h +++ b/score/datarouter/include/unix_domain/unix_domain_server.h @@ -15,7 +15,7 @@ #define SCORE_DATAROUTER_INCLUDE_UNIX_DOMAIN_UNIX_DOMAIN_SERVER_H #include "i_session.h" -#include "unix_domain/unix_domain_common.h" +#include "unix_domain/unix_domain_internal.h" #include #include diff --git a/score/datarouter/mocks/unix_domain/unix_domain_client.h b/score/datarouter/mocks/unix_domain/unix_domain_client.h index e9c6330a7..a390a097b 100644 --- a/score/datarouter/mocks/unix_domain/unix_domain_client.h +++ b/score/datarouter/mocks/unix_domain/unix_domain_client.h @@ -14,7 +14,7 @@ #ifndef UNIX_DOMAIN_CLIENT_H_ #define UNIX_DOMAIN_CLIENT_H_ -#include "unix_domain/unix_domain_common.h" +#include "unix_domain/unix_domain_internal.h" #include #include diff --git a/score/datarouter/mocks/unix_domain/unix_domain_server.h b/score/datarouter/mocks/unix_domain/unix_domain_server.h index d7403ef42..ce23a5ad9 100644 --- a/score/datarouter/mocks/unix_domain/unix_domain_server.h +++ b/score/datarouter/mocks/unix_domain/unix_domain_server.h @@ -15,7 +15,7 @@ #define SCORE_DATAROUTER_MOCKS_UNIX_DOMAIN_UNIX_DOMAIN_SERVER_H #include "i_session.h" -#include "unix_domain/unix_domain_common.h" +#include "unix_domain/unix_domain_internal.h" #include #include diff --git a/score/datarouter/src/daemon/socketserver.cpp b/score/datarouter/src/daemon/socketserver.cpp index b0711448b..b72ff0580 100644 --- a/score/datarouter/src/daemon/socketserver.cpp +++ b/score/datarouter/src/daemon/socketserver.cpp @@ -47,7 +47,7 @@ namespace datarouter { using score::platform::internal::MessagePassingServer; -using score::platform::internal::UnixDomainSockAddr; +using score::platform::unix_domain::UnixDomainSockAddr; namespace { diff --git a/score/datarouter/src/unix_domain/unix_domain_common.cpp b/score/datarouter/src/unix_domain/unix_domain_common.cpp index ddcb06a73..eb26b7f06 100644 --- a/score/datarouter/src/unix_domain/unix_domain_common.cpp +++ b/score/datarouter/src/unix_domain/unix_domain_common.cpp @@ -92,6 +92,11 @@ int32_t* CmsgDataSuppressWarning(struct cmsghdr* cmsg) return fdptr; } +} // namespace internal + +namespace unix_domain +{ + UnixDomainSockAddr::UnixDomainSockAddr(const std::string& path, bool is_abstract) : addr() { addr.sun_family = static_cast(AF_UNIX); @@ -101,6 +106,11 @@ UnixDomainSockAddr::UnixDomainSockAddr(const std::string& path, bool is_abstract std::copy_n(path.begin(), len, addr_iter); } +} // namespace unix_domain + +namespace internal +{ + void SendAncillaryDataOverSocket(int connection_file_descriptor, score::cpp::span data) { int pid = getpid(); @@ -155,6 +165,11 @@ void SendAncillaryDataOverSocket(int connection_file_descriptor, score::cpp::spa } } +} // namespace internal + +namespace unix_domain +{ + /* Send message without file descriptor option * * One of the function is to pass a handle to shared memory file */ void SendSocketMessage(std::int32_t connection_file_descriptor, @@ -169,8 +184,8 @@ void SendSocketMessage(std::int32_t connection_file_descriptor, } int pid = getpid(); - SocketMessangerHeader messanger_header{}; - messanger_header.type = MessageType::kDefault; + internal::SocketMessangerHeader messanger_header{}; + messanger_header.type = internal::MessageType::kDefault; messanger_header.len = static_cast(message.size() + 1U); messanger_header.pid = pid; @@ -207,7 +222,7 @@ void SendSocketMessage(std::int32_t connection_file_descriptor, - char array has predefined size kSocketCmsgSpace, thus false positive */ // coverity[autosar_cpp14_a9_6_1_violation : FALSE] - char buf[kSocketCmsgSpace]; // NOLINT(modernize-avoid-c-arrays) see comment above + char buf[internal::kSocketCmsgSpace]; // NOLINT(modernize-avoid-c-arrays) see comment above struct cmsghdr align; /* Deviation from Rule A9-5-1: @@ -237,8 +252,8 @@ void SendSocketMessage(std::int32_t connection_file_descriptor, cmsg = CMSG_FIRSTHDR(&msg); cmsg->cmsg_level = SOL_SOCKET; cmsg->cmsg_type = SCM_RIGHTS; - CmsgLenSuppressWarnings(cmsg, num_fds); - std::int32_t* fdptr = CmsgDataSuppressWarning(cmsg); + internal::CmsgLenSuppressWarnings(cmsg, num_fds); + std::int32_t* fdptr = internal::CmsgDataSuppressWarning(cmsg); if (num_fds > 0) { // Disable maybe uninitialized warning for optional. @@ -281,9 +296,14 @@ std::optional RecvSocketMessage(std::int32_t socket_fd, { score::cpp::optional discard_file_handle = score::cpp::nullopt; score::cpp::optional discard_pid = score::cpp::nullopt; - return RecvSocketMessage(socket_fd, discard_file_handle, discard_pid, std::move(ancillary_data_process)); + return internal::RecvSocketMessage(socket_fd, discard_file_handle, discard_pid, std::move(ancillary_data_process)); } +} // namespace unix_domain + +namespace internal +{ + std::optional RecvSocketMessage(std::int32_t socket_fd, score::cpp::optional& file_handle, score::cpp::optional& peer_pid, diff --git a/score/datarouter/test/ut/ut_logging/tracingTest.cpp b/score/datarouter/test/ut/ut_logging/tracingTest.cpp index 1721fa0af..0bcdb2ed9 100644 --- a/score/datarouter/test/ut/ut_logging/tracingTest.cpp +++ b/score/datarouter/test/ut/ut_logging/tracingTest.cpp @@ -34,7 +34,7 @@ TEST_F(TracingTest, TracingLifeCycleStart) { // EXPECT_CALL(appconfigmock_, getApplicationId().Times(AtLeast(1)).WillOnce(Return("SMOKE")); //--TODO expectations need to be added after the below mocks are available - // score::platform::internal::UnixDomainSockAddr + // score::platform::unix_domain::UnixDomainSockAddr // score::platform::logger // score::platform::internal::MwsrDataReadAcquired // score::platform::internal::MwsrDataReadReleased From 4acead98ce54bcfb57e0da13b3d2f953df24b5de Mon Sep 17 00:00:00 2001 From: rmaddikery Date: Thu, 19 Nov 2026 15:35:42 +0100 Subject: [PATCH 14/17] docs(datarouter): use an identifier as the IPC diagram node name --- score/datarouter/doc/design/uml/detail-ipc.puml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/score/datarouter/doc/design/uml/detail-ipc.puml b/score/datarouter/doc/design/uml/detail-ipc.puml index d32f9ea27..fbf5b379a 100644 --- a/score/datarouter/doc/design/uml/detail-ipc.puml +++ b/score/datarouter/doc/design/uml/detail-ipc.puml @@ -23,7 +23,7 @@ node "Datarouter" { component UnixDomainServer } -node "Datarouter Configurator Client" { +node "DatarouterConfiguratorClient" { component UnixDomainClient as config_client } From 286a93bf229e88b940e8903a029613dba66fcc68 Mon Sep 17 00:00:00 2001 From: rmaddikery Date: Fri, 20 Nov 2026 10:56:24 +0100 Subject: [PATCH 15/17] build(datarouter): remove unused libstructdatasource and its header - The target is private and has no dependents, and nothing includes the extension-less StructDataSource header that it exports. - Drop the target from the datarouter dependency report scope as well. --- score/datarouter/BUILD | 11 ----------- score/datarouter/include/StructDataSource | 14 -------------- .../dependency_report_datarouter.json | 2 +- 3 files changed, 1 insertion(+), 26 deletions(-) delete mode 100644 score/datarouter/include/StructDataSource diff --git a/score/datarouter/BUILD b/score/datarouter/BUILD index 0ca7513fb..d29f61603 100644 --- a/score/datarouter/BUILD +++ b/score/datarouter/BUILD @@ -346,17 +346,6 @@ cc_library( ], ) -cc_library( - name = "libstructdatasource", - hdrs = ["include/StructDataSource"], - features = COMPILER_WARNING_FEATURES, - strip_include_prefix = "include", - visibility = ["//visibility:private"], - deps = [ - ":data_router_cfg", - ], -) - ## =========================================================================== ## Datarouter ## --------------------------------------------------------------------------- diff --git a/score/datarouter/include/StructDataSource b/score/datarouter/include/StructDataSource deleted file mode 100644 index 2fcc7c1e1..000000000 --- a/score/datarouter/include/StructDataSource +++ /dev/null @@ -1,14 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2025 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Apache License Version 2.0 which is available at - * https://www.apache.org/licenses/LICENSE-2.0 - * - * SPDX-License-Identifier: Apache-2.0 - ********************************************************************************/ - -#include "score/datarouter/include/daemon/data_router_cfg.h" diff --git a/scripts/dependency_reports/dependency_report_datarouter.json b/scripts/dependency_reports/dependency_report_datarouter.json index fddcc2428..83f20bedc 100644 --- a/scripts/dependency_reports/dependency_report_datarouter.json +++ b/scripts/dependency_reports/dependency_report_datarouter.json @@ -17,7 +17,7 @@ }, { "name": "Log parser and DLT handlers", - "scope": "//score/datarouter:logparser + //score/datarouter:logparser_interface + //score/datarouter:logparser_factory_interface + //score/datarouter:log_entry_deserialization + //score/datarouter:libstructdatasource + //score/datarouter/src/dlt/nonverbose_dlt_impl:nonverbose_dlt_handler + //score/datarouter/src/dlt/nonverbose_dlt_stub:nonverbose_dlt_handler_stub" + "scope": "//score/datarouter:logparser + //score/datarouter:logparser_interface + //score/datarouter:logparser_factory_interface + //score/datarouter:log_entry_deserialization + //score/datarouter/src/dlt/nonverbose_dlt_impl:nonverbose_dlt_handler + //score/datarouter/src/dlt/nonverbose_dlt_stub:nonverbose_dlt_handler_stub" }, { "name": "DLT server and channels", From 6fad91fbf7bc55a404dfe6e88468b5cb291deebc Mon Sep 17 00:00:00 2001 From: rmaddikery Date: Fri, 20 Nov 2026 11:04:19 +0100 Subject: [PATCH 16/17] docs(datarouter): document wire layout of SocketMessangerHeader - The header is sent as raw bytes, and packing it would change the wire format. --- score/datarouter/include/unix_domain/unix_domain_internal.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/score/datarouter/include/unix_domain/unix_domain_internal.h b/score/datarouter/include/unix_domain/unix_domain_internal.h index fcee4fc20..8036432c1 100644 --- a/score/datarouter/include/unix_domain/unix_domain_internal.h +++ b/score/datarouter/include/unix_domain/unix_domain_internal.h @@ -43,7 +43,9 @@ enum class MessageType : std::uint8_t kSharedMemoryFileHandle = 1, }; -struct SocketMessangerHeader // __attribute__((packed)) // TODO: deal with packed +// Sent as raw bytes, so both ends must agree on this layout (8 bytes, padding after type). +// Packing it would change the wire format. +struct SocketMessangerHeader { uint16_t len; MessageType type; From e8759d053d7bd8998fd9f7fd724b80dc6a687168 Mon Sep 17 00:00:00 2001 From: rmaddikery Date: Fri, 20 Nov 2026 11:06:32 +0100 Subject: [PATCH 17/17] Adds deprecation warning for legacy label - Fix deprecation warning comment for legacy label --- score/datarouter/BUILD | 1 + score/mw/log/BUILD | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/score/datarouter/BUILD b/score/datarouter/BUILD index d29f61603..29408da8f 100644 --- a/score/datarouter/BUILD +++ b/score/datarouter/BUILD @@ -323,6 +323,7 @@ cc_library( alias( name = "libdrconfighdrs", actual = ":data_router_cfg", + deprecation = "Usage of target '@score_logging//score/datarouter:libdrconfighdrs' is deprecated. Please use '@score_logging//score/datarouter:data_router_cfg' instead.", visibility = ["//visibility:public"], ) diff --git a/score/mw/log/BUILD b/score/mw/log/BUILD index 33939c66c..77e50436e 100644 --- a/score/mw/log/BUILD +++ b/score/mw/log/BUILD @@ -21,7 +21,7 @@ COMPILER_WARNING_FEATURES = [ cc_library( name = "log", - deprecation = "Usage of target '@score_logging//score/mw/log' is deprecated and will be removed in the v0.8 release. Please use '@score_baselibs//score/mw/log' instead.", + deprecation = "Usage of target '@score_logging//score/mw/log' is deprecated. Please use '@score_baselibs//score/mw/log' instead.", features = COMPILER_WARNING_FEATURES, tags = ["FFI"], visibility = ["//visibility:public"],