Skip to content
Draft
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
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 @@ -97,3 +97,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<ServiceElementConfiguration>),
(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
154 changes: 154 additions & 0 deletions score/mw/com/gateway/transport_layer/sample/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# *******************************************************************************
# 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 = "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",
"//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",
],
visibility = [
"//score/mw/com/gateway:__subpackages__",
],
deps = [
"@score_baselibs//score/os:unistd",
],
)

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_unit_test(
name = "bidirectional_transport_test",
srcs = [
"bidirectional_transport_test.cpp",
"sample_transport_test_resources.h",
],
features = COMPILER_WARNING_FEATURES,
visibility = [
"//score/mw/com/gateway:__subpackages__",
],
deps = [
":bidirectional_transport",
"@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",
],
)
32 changes: 32 additions & 0 deletions score/mw/com/gateway/transport_layer/sample/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!----
*******************************************************************************
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
*******************************************************************************
-->

# Gateway Transport Layer Sample Implementation

This module provides a sample implementation of a mw::com gateway's transport layer based on regular POSIX network sockets
for communication. Since this communication mechanism should be available in most HyperVisor environments, we decided to
add this as a sample implementation.

## Vendor-specific implementation details

Parts that interact with the underlying shared memory have not been implemented as part of this sample implementation,
as these parts are vendor-specific and depend on the used HyperVisor and its shared memory abilities.
This includes the following methods:

- `ShmPaths score::mw::com::gateway::ResolveShmPaths(const impl::InstanceSpecifier&)` where a path to access the HV-shared memory region has to be created.
- `ShmSizes score::mw::com::gateway::GetShmSizes(const impl::InstanceSpecifier&)` where the size of the shared memory region has to be determined.
- `void SampleHyperVisorTransport::PreCreateInterVmSharedMemory(const impl::InstanceSpecifier& specifier,
std::uint32_t shm_control_size,
std::uint32_t shm_data_size)` where the shared memory region needs to be opened
Loading
Loading