Skip to content
Open
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
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
<!----
*******************************************************************************
Copyright (c) 2026 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
*******************************************************************************
-->

# Communication Module (LoLa)

[![Eclipse Score](https://img.shields.io/badge/Eclipse-Score-orange.svg)](https://eclipse-score.github.io/score/main/modules/communication/index.html)
Expand Down
18 changes: 18 additions & 0 deletions quality/coverage/coverage_justifications.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -72,3 +72,21 @@ justifications:
- file: score/mw/com/impl/generic_skeleton_event.cpp
line_start: 29
line_end: 29

- id: gateway-clear-nonblock-on-accepted-socket
category: defensive_programming
reason: >
Defensive programming: Posix system call can only go wrong if the socket file descriptor is invalid,
but socket has just been accepted in an earlier step.

- id: gateway-handle-response-only-ack-response
category: defensive_programming
reason: >
Defensive programming: Type has already been checked before this function has been called.

- id: gateway-dispatch-loop-calls-handler
category: tool_false_positive
reason: >
Coverage tool incorrectly marks this line as not covered. Lines immediately before and after are covered.
Covered by the test BidirectionalTransportSocketFixture.DispatchThreadDeliversQueuedMessageToHandler
inside score/mw/com/gateway/transport_layer/sample/bidirectional_transport_test.cpp
14 changes: 14 additions & 0 deletions score/mw/com/README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
<!---- *******************************************************************************
Copyright (c) 2026 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
*******************************************************************************
-->

# Communication Middleware (mw::com)

## Overview
Expand Down
13 changes: 13 additions & 0 deletions score/mw/com/gateway/gateway_application/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -115,3 +115,16 @@ cc_unit_test(
"@score_baselibs//score/result",
],
)

cc_library(
name = "gateway_core_mock",
hdrs = ["gateway_core_mock.h"],
features = COMPILER_WARNING_FEATURES,
visibility = [
"//score/mw/com/gateway:__subpackages__",
],
deps = [
":gateway_core",
"@googletest//:gtest",
],
)
49 changes: 49 additions & 0 deletions score/mw/com/gateway/gateway_application/gateway_core_mock.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/********************************************************************************
* Copyright (c) 2026 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_MW_COM_GATEWAY_CORE_MOCK_H
#define SCORE_MW_COM_GATEWAY_CORE_MOCK_H

#include "score/mw/com/gateway/gateway_application/gateway_core.h"

#include <gmock/gmock.h>

namespace score::mw::com::gateway
{

class GatewayCoreMock : public GatewayCore
{
public:
MOCK_METHOD((score::Result<void>),
ProvideService,
(impl::InstanceSpecifier, std::vector<impl::EventInfo>),
(override));
MOCK_METHOD((score::Result<void>), OfferService, (impl::InstanceSpecifier), (override));
MOCK_METHOD(void, StopOfferService, (impl::InstanceSpecifier), (override));
MOCK_METHOD((score::Result<void>),
NotifyUpdate,
(impl::InstanceSpecifier, impl::ServiceElementType, std::string),
(override));
MOCK_METHOD((score::Result<void>),
RegisterUpdateNotification,
(impl::InstanceSpecifier, impl::ServiceElementType, std::string),
(override));
MOCK_METHOD((score::Result<void>),
UnregisterUpdateNotification,
(impl::InstanceSpecifier, impl::ServiceElementType, std::string),
(override));
};

} // namespace score::mw::com::gateway

#endif // SCORE_MW_COM_GATEWAY_CORE_MOCK_H
3 changes: 3 additions & 0 deletions score/mw/com/gateway/transport_layer/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ cc_library(
deps = [
":transport",
"//score/mw/com/gateway/gateway_application:gateway_core",
"//score/mw/com/gateway/transport_layer/sample:bidirectional_transport",
"//score/mw/com/gateway/transport_layer/sample:sample_hypervisor_transport",
"//score/mw/com/gateway/transport_layer/sample/configuration:hypervisor_socket_configuration",
"//score/mw/com/gateway/transport_layer/sample/configuration:sample_transport_config_parser",
],
)
Expand Down
232 changes: 232 additions & 0 deletions score/mw/com/gateway/transport_layer/sample/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,232 @@
# *******************************************************************************
# Copyright (c) 2026 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("//quality/unit_testing:unit_testing.bzl", "cc_unit_test")
load("//score/mw:common_features.bzl", "COMPILER_WARNING_FEATURES")

cc_library(
name = "i_bidirectional_transport",
hdrs = ["i_bidirectional_transport.h"],
features = COMPILER_WARNING_FEATURES,
visibility = [
"//score/mw/com/gateway:__subpackages__",
],
deps = [
"//score/mw/com/gateway/transport_layer/sample/messages:gateway_messages",
"@score_baselibs//score/result",
],
)

cc_library(
name = "message_framer",
srcs = ["message_framer.cpp"],
hdrs = [
"i_message_framer.h",
"message_framer.h",
],
features = COMPILER_WARNING_FEATURES,
implementation_deps = [
"@score_baselibs//score/mw/log",
"@score_baselibs//score/os:socket",
],
visibility = [
"//score/mw/com/gateway:__subpackages__",
],
deps = [
"//score/mw/com/gateway/transport_layer:transport_error",
"//score/mw/com/gateway/transport_layer/sample/messages:gateway_messages",
"@score_baselibs//score/result",
],
)

cc_library(
name = "pending_request_tracker",
srcs = ["pending_request_tracker.cpp"],
hdrs = [
"i_pending_request_tracker.h",
"pending_request_tracker.h",
],
features = COMPILER_WARNING_FEATURES,
implementation_deps = [
"@score_baselibs//score/mw/log",
],
visibility = [
"//score/mw/com/gateway:__subpackages__",
],
deps = [
"//score/mw/com/gateway/transport_layer:transport_error",
"@score_baselibs//score/result",
],
)

cc_library(
name = "bidirectional_transport",
srcs = ["bidirectional_transport.cpp"],
hdrs = [
"bidirectional_transport.h",
],
features = COMPILER_WARNING_FEATURES,
implementation_deps = [
"@score_baselibs//score/mw/log",
"@score_baselibs//score/os:socket",
],
visibility = [
"//score/mw/com/gateway:__subpackages__",
],
deps = [
":i_bidirectional_transport",
":message_framer",
":pending_request_tracker",
"//score/mw/com/gateway/transport_layer:transport_error",
"//score/mw/com/gateway/transport_layer/sample:unique_socket",
"//score/mw/com/gateway/transport_layer/sample/configuration:hypervisor_socket_configuration",
"//score/mw/com/gateway/transport_layer/sample/messages:gateway_messages",
"@score_baselibs//score/concurrency:long_running_threads_container",
"@score_baselibs//score/os:unistd",
],
)

cc_library(
name = "sample_hypervisor_transport",
srcs = ["sample_hypervisor_transport.cpp"],
hdrs = [
"sample_hypervisor_transport.h",
],
features = COMPILER_WARNING_FEATURES,
implementation_deps = [
"//score/mw/com/gateway/transport_layer/sample/messages:gateway_messages",
"//score/mw/com/impl:runtime",
"@score_baselibs//score/mw/log",
],
visibility = [
"//score/mw/com/gateway:__subpackages__",
],
deps = [
"//score/mw/com/gateway/gateway_application:gateway_core",
"//score/mw/com/gateway/transport_layer:transport",
"//score/mw/com/gateway/transport_layer/sample:i_bidirectional_transport",
],
)

cc_library(
name = "unique_socket",
srcs = ["unique_socket.cpp"],
hdrs = [
"unique_socket.h",
],
features = COMPILER_WARNING_FEATURES,
implementation_deps = [
"@score_baselibs//score/mw/log",
"@score_baselibs//score/os:socket",
],
visibility = [
"//score/mw/com/gateway:__subpackages__",
],
deps = [
"@score_baselibs//score/os:unistd",
],
)

cc_unit_test(
name = "pending_request_tracker_test",
srcs = ["pending_request_tracker_test.cpp"],
features = COMPILER_WARNING_FEATURES,
visibility = [
"//score/mw/com/gateway:__subpackages__",
],
deps = [
":pending_request_tracker",
],
)

cc_unit_test(
name = "message_framer_test",
srcs = ["message_framer_test.cpp"],
features = COMPILER_WARNING_FEATURES,
visibility = [
"//score/mw/com/gateway:__subpackages__",
],
deps = [
":message_framer",
"@score_baselibs//score/os/mocklib:socket_mock",
],
)

cc_unit_test(
name = "unique_socket_test",
srcs = ["unique_socket_test.cpp"],
features = COMPILER_WARNING_FEATURES,
visibility = [
"//score/mw/com/gateway:__subpackages__",
],
deps = [
":unique_socket",
"@score_baselibs//score/os/mocklib:unistd_mock",
],
)

cc_test(
name = "bidirectional_transport_test",
timeout = "long",
srcs = [
"bidirectional_transport_test.cpp",
"mock_message_framer.h",
"mock_pending_request_tracker.h",
"sample_transport_test_resources.h",
],
features = COMPILER_WARNING_FEATURES,
tags = [
"unit",
],
target_compatible_with = ["@platforms//os:linux"], # @todo: Test works also under QNX, but in rare cases timeout of cc_unit_test is too strict.
visibility = [
"//score/mw/com/gateway:__subpackages__",
],
deps = [
":bidirectional_transport",
"@googletest//:gtest_main",
"@score_baselibs//score/os/mocklib:socket_mock",
],
)

cc_unit_test(
name = "sample_hypervisor_transport_test",
srcs = ["sample_hypervisor_transport_test.cpp"],
features = COMPILER_WARNING_FEATURES,
visibility = [
"//score/mw/com/gateway:__subpackages__",
],
deps = [
":bidirectional_transport_mock",
":sample_hypervisor_transport",
"//score/mw/com/gateway/gateway_application:gateway_core_mock",
"//score/mw/com/gateway/transport_layer:transport_error",
"//score/mw/com/impl/test:dummy_instance_identifier_builder",
"//score/mw/com/impl/test:runtime_mock_guard",
"@score_baselibs//score/mw/log",
"@score_baselibs//score/mw/log:recorder_mock",
],
)

cc_library(
name = "bidirectional_transport_mock",
hdrs = ["bidirectional_transport_mock.h"],
features = COMPILER_WARNING_FEATURES,
visibility = [
"//score/mw/com/gateway:__subpackages__",
],
deps = [
":i_bidirectional_transport",
"@googletest//:gtest",
],
)
Loading
Loading