Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# *******************************************************************************
# 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
# *******************************************************************************

load("@rules_cc//cc:defs.bzl", "cc_library")
load("@score_baselibs//score/language/safecpp:toolchain_features.bzl", "COMPILER_WARNING_FEATURES")

[
cc_library(
name = "dynamic_config_session" + name,
testonly = test_only,
hdrs = [
"dynamic_config_session.h",
"dynamic_config_session_factory.h",
],
features = COMPILER_WARNING_FEATURES,
strip_include_prefix = ".",
visibility = visibility,
deps = deps + [
"//score/datarouter/src/configuration/dynamic_config:i_session",
],
)
for name, test_only, visibility, deps in [
(
"",
False,
[
"@score_logging//score/datarouter:__pkg__",
"@score_logging//score/datarouter:__subpackages__",
],
[
"@score_logging//score/datarouter:unixdomain_server",
"//score/datarouter/src/configuration/dynamic_config:config_session_factory",
],
),
(
"_testing",
True,
[
"@score_logging//score/datarouter:__pkg__",
"//score/datarouter/test:__subpackages__",
],
[
"@score_logging//score/datarouter:unixdomain_mock",
"//score/datarouter/src/configuration/dynamic_config:config_session_factory_testing",
],
),
]
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
/********************************************************************************
* 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 DYNAMIC_CONFIG_SESSION_H
#define DYNAMIC_CONFIG_SESSION_H

#include "unix_domain/unix_domain_server.h"
#include <functional>
namespace score
{
namespace logging
{
namespace daemon
{

class ConfigSession final : public score::platform::internal::UnixDomainServer::ISession
{
public:
template <typename Handler>
ConfigSession(score::platform::internal::UnixDomainServer::SessionHandle handle, Handler&& handler)
: handle_(std::move(handle)), handler_(std::forward<Handler>(handler))
{
}

~ConfigSession() override = default;

private:
// Not called from production code.
// LCOV_EXCL_START
bool Tick() override
{
return false;
}
// LCOV_EXCL_STOP
void OnCommand(const std::string& command) override final
{
auto response = handler_(command);
handle_.PassMessage(response);
}

score::platform::internal::UnixDomainServer::SessionHandle handle_;
std::function<std::string(const std::string&)> handler_;
};

} // namespace daemon
} // namespace logging
} // namespace score

#endif // DYNAMIC_CONFIG_SESSION_H
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/********************************************************************************
* 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 DYNAMIC_CONFIG_SESSION_FACTORY_H
#define DYNAMIC_CONFIG_SESSION_FACTORY_H

#include "config_session_factory.hpp"
#include "dynamic_config_session.h"

namespace score
{
namespace logging
{
namespace daemon
{

class DynamicConfigSessionFactory : public ConfigSessionFactory<DynamicConfigSessionFactory>
{
public:
template <typename Handler>
std::unique_ptr<ISession> CreateConcreteSession(score::platform::internal::UnixDomainServer::SessionHandle handle,
Handler&& handler)
{
return std::make_unique<ConfigSession>(std::move(handle), std::forward<Handler>(handler));
}
};

} // namespace daemon
} // namespace logging
} // namespace score

#endif // DYNAMIC_CONFIG_SESSION_FACTORY_H
1 change: 1 addition & 0 deletions score/datarouter/src/daemon/dlt_log_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#include "score/datarouter/include/daemon/configurator_commands.h"
#include "score/datarouter/include/daemon/diagnostic_job_parser.h"
#include "score/datarouter/include/daemon/i_diagnostic_job_handler.h"
#include "score/mw/log/logging.h"

#include <algorithm>
#include <sstream>
Expand Down
64 changes: 64 additions & 0 deletions score/datarouter/src/file_transfer/file_transfer_impl/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# *******************************************************************************
# 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
# *******************************************************************************

load("@rules_cc//cc:defs.bzl", "cc_library")
load("@score_baselibs//score/language/safecpp:toolchain_features.bzl", "COMPILER_WARNING_FEATURES")

cc_library(
name = "file_transfer_stream_handler_factory",
hdrs = [
"file_transfer_stream_handler_factory.h",
],
features = COMPILER_WARNING_FEATURES,
visibility = [
"//score/datarouter/test:__subpackages__",
],
deps = [
":file_transfer_stream_handler",
"//score/datarouter/src/file_transfer:file_transfer_handler_factory",
"@score_logging//score/datarouter:logparser",
],
)

[
cc_library(
name = "file_transfer_stream_handler" + name,
testonly = test_only,
srcs = [
"filetransfer_stream.cpp",
],
hdrs = [
"filetransfer_stream.h",
],
features = COMPILER_WARNING_FEATURES,
visibility = [
"@score_logging//score/datarouter:__pkg__",
],
deps = [
"@score_baselibs//score/mw/log",
"@score_baselibs//score/os:stat",
"@score_baselibs//score/os:stdio",
"@score_baselibs//score/os/utils:thread",
"@score_logging//score/datarouter:dltprotocol",
"@score_logging//score/datarouter:dltserver_common",
"@score_logging//score/datarouter:logparser",
udp_dep,
"//score/datarouter/dlt_filetransfer_trigger_lib:filetransfer_message_types",
"@score_baselibs//score/language/futurecpp",
],
)
for name, udp_dep, test_only in [
("", "@score_logging//score/datarouter:udp_stream_output", False),
("_testing", "@score_logging//score/datarouter:udpoutput_mock", True),
]
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
/********************************************************************************
* 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 PAS_LOGGING_FILE_TRANSFER_STREAM_HANDLER_FACTORY_H
#define PAS_LOGGING_FILE_TRANSFER_STREAM_HANDLER_FACTORY_H

#include "logparser/logparser.h"
#include "score/datarouter/src/file_transfer/file_transfer_handler_factory.hpp"
#include "score/datarouter/src/file_transfer/file_transfer_impl/filetransfer_stream.h"

namespace score
{
namespace logging
{
namespace dltserver
{

// implementation of the IOutput interface.
class Output : public FileTransferStreamHandler::IOutput
{
public:
~Output() = default;
void SendFtVerbose(score::cpp::span<const std::uint8_t> data,
mw::log::LogLevel loglevel,
DltidT app_id,
DltidT ctx_id,
uint8_t nor,
uint32_t time_tmsp) override
{
// The implementation for this method is not agreed currently.
// To be discussed: Ticket-211317
std::ignore = data;
std::ignore = loglevel;
std::ignore = app_id;
std::ignore = ctx_id;
std::ignore = nor;
std::ignore = time_tmsp;
}
bool IsOutputEnabled() const noexcept override
{
return true;
}
};

/**
* @brief Concrete factory that creates FileTransferStreamHandler instances.
*/
class FileTransferStreamHandlerFactory : public FileTransferHandlerFactory<FileTransferStreamHandlerFactory>
{
public:
explicit FileTransferStreamHandlerFactory(Output& output) : output_(output) {}

std::unique_ptr<LogParser::TypeHandler> CreateConcreteHandler()
{
return std::make_unique<FileTransferStreamHandler>(output_);
}

private:
Output& output_;
};

} // namespace dltserver
} // namespace logging
} // namespace score

#endif // PAS_LOGGING_FILE_TRANSFER_STREAM_HANDLER_FACTORY_H
Loading
Loading