-
Notifications
You must be signed in to change notification settings - Fork 7
Add socom as SOME/IP abstraction #16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lurtz
wants to merge
90
commits into
eclipse-score:main
Choose a base branch
from
elektrobit-contrib:add-socom-as-someip-abstraction
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
90 commits
Select commit
Hold shift + click to select a range
3e54138
Add socom as SOME/IP abstraction
lurtz fc0376c
Use score::result::ErrorCode and MakeUnexpected
lurtz 8c21e9e
remove result.hpp
lurtz 5676025
remove Result aliases
lurtz 71dc2b1
Client_connector::Event struct for bunding API
lurtz ad77a62
Client_connector event API similar to GenericSkeleton
lurtz b32c677
Client_connector method API similar to GenericSkeleton
lurtz d76ddbd
Server_connector event API similar to GenericSkeleton
lurtz a34dc64
use function to allocate method reply payload
lurtz b1292c0
fix state transition trigger
lurtz 518ccdf
add comment to optional state
lurtz 284a5cc
Revert "use function to allocate method reply payload"
lurtz 60fad1f
Revert "Server_connector event API similar to GenericSkeleton"
lurtz e1d8bfc
Revert "Client_connector method API similar to GenericSkeleton"
lurtz 6f5875b
Revert "Client_connector event API similar to GenericSkeleton"
lurtz d9e8141
Revert "Client_connector::Event struct for bunding API"
lurtz 701ebda
provide reply allocator at method invocation
lurtz 3573800
remove 1:n support
lurtz e0d9677
Remove event subscription acknowledgement
lurtz 5d8e581
remove multi client support from sequence diagrams and documents
lurtz 49d4796
fix copyright header
lurtz bb8c3a7
Add original socom tests and fix found issues (#1)
lurtz f3c7405
Merge remote-tracking branch 'origin/main' into add-socom-as-someip-a…
lurtz 1d1ec03
remove outdated todos
lurtz f788469
Test event payload allocation
lurtz 109beb5
test method event payload allocation
lurtz 703074a
better documentation, no default construction of callbacks
lurtz 3280d28
provide reply payload together with reply callback
lurtz aa2a146
test reply payload transmission
lurtz a182d68
improved payload allocation tests
lurtz ac18211
Suppress thread sanitizer false positives
lurtz 35d2596
fix undefined behavior sanitizer finding
lurtz 981e95b
test subscribe_find_service with vector callback
lurtz e9a3316
migrate from ac to score::socom namespace
lurtz ef5f1a5
move test code into score::socom namespace
lurtz 75160f2
more cleanup
lurtz e6f7f00
clean up test framework from namespace resolution
lurtz 59f81da
small cleanup for consistency
lurtz 7bf2202
Merge branch 'main' into add-socom-as-someip-abstraction
lurtz a118199
Merge branch 'main' into add-socom-as-someip-abstraction
lurtz f3ad2f4
Merge branch 'main' into add-socom-as-someip-abstraction
lurtz ee272df
fix aarch64 compile errors
lurtz c2eaf64
fix aarch64 compiler warnings
lurtz 1862c75
Merge branch 'main' into add-socom-as-someip-abstraction
lurtz 692bf0b
Merge branch 'main' into add-socom-as-someip-abstraction
lurtz af301aa
Make devcontainer work in environment without any QNX setup
lurtz 1ecab42
optional bazel user configuration
lurtz 6423424
Create external symlink based on basename
lurtz 9387ecf
remove sanitizer settings
lurtz 6872456
only create external if it does not exist
lurtz b60ef13
deprecate Runtime::subscribe_find_service()
lurtz a6f96a5
Merge remote-tracking branch 'origin/main' into add-socom-as-someip-a…
lurtz 2b2f4ee
Merge remote-tracking branch 'origin/main' into add-socom-as-someip-a…
lurtz 5491c2f
tighter visibility settings
lurtz 997541c
Rename allocate_method_payload() to allocate_method_call_payload()
lurtz a9a7e96
make Final_action private class
lurtz a4ef7ae
make sure Final_action really destroys the callable in execute()
lurtz cd20996
remove Server_service_interface_configuration::invalid()
lurtz 23531a7
In sequence diagrams
lurtz 2105c3f
move to_num_of_{events, methods}() casts to header
lurtz a9a2241
Rename Service_identifier to Service_instance_identifier
lurtz ef19651
Require that same interfaces have the same number of methods and events
lurtz b9abf5a
take interface and instance by value to make ownership clear
lurtz a3d63e1
Rename Service types
lurtz cd7f41b
Remove is_only_minor_version_incompatible check
lurtz 9d31e53
fix typos in subscribe_find_service() description
lurtz bf7833b
consistent subscribe_find_service behavior with no callback given
lurtz f362f16
clarify meaning of assertion
lurtz b8da04f
Rename callback to subscription_it
lurtz 4d3d904
remove unused variable
lurtz 0359ef0
doygen for cleanup functions
lurtz 320ac1f
switch to unordered_map for faster access times
lurtz 84ef438
remove copy
lurtz 9685e6c
add missing copyright and license information
lurtz 44bc812
Merge remote-tracking branch 'origin/main' into add-socom-as-someip-a…
lurtz 7ad2f9a
Add string registry
lurtz 747177c
Use string registry for instance and identifier ids
lurtz 6026d25
better comments for constructors of service_instance
lurtz 117f768
update score tooling to fix failed copyright checks
lurtz ca35e52
Use move_only_function in FInal_action
lurtz 7f10265
Merge remote-tracking branch 'origin/main' into add-socom-as-someip-a…
lurtz 1720454
Merge branch 'main' into add-socom-as-someip-abstraction
lurtz f724af8
Add Move_only_function_mock
lurtz cd50ea6
convert client_connector callbacks to move_only_function
lurtz fcb25f7
convert server_connector callbacks to move_only_function
lurtz e2f7264
convert Method_reply_callback to move_only_function
lurtz 7d68156
Convert on_deadlock_destruction_callback to move_only_function
lurtz bbf96ae
Merge branch 'main' into add-socom-as-someip-abstraction
lurtz 488990e
move create_runtime() into separate file
lurtz 6f8fb67
Merge branch 'main' into add-socom-as-someip-abstraction
lurtz File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # ******************************************************************************* | ||
| # 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:cc_library.bzl", "cc_library") | ||
| load("@score_baselibs//score/language/safecpp:toolchain_features.bzl", "COMPILER_WARNING_FEATURES") | ||
|
|
||
| filegroup( | ||
| name = "headers", | ||
| srcs = glob(include = ["include/**"]), | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "socom", | ||
| srcs = glob(include = ["src/**"]), | ||
| hdrs = [":headers"], | ||
| defines = [ | ||
| "WITH_SOCOM_DEADLOCK_DETECTION=1", | ||
| ], | ||
| features = COMPILER_WARNING_FEATURES, | ||
| includes = [ | ||
| "include", | ||
| "src/socom/include", | ||
| ], | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| "@score_baselibs//score/result", | ||
| ], | ||
| ) | ||
|
|
||
| filegroup( | ||
| name = "mock_headers", | ||
| srcs = glob(include = ["mock/**"]), | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "mock", | ||
| hdrs = [":mock_headers"], | ||
| includes = ["mock"], | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| ":socom", | ||
| "@googletest//:gtest_for_library", | ||
| ], | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| // ******************************************************************************* | ||
| // 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 | ||
| // ******************************************************************************* | ||
|
|
||
| = Service Oriented Communication (SOCom) | ||
| :description: SOCom | ||
| :docinfo: shared | ||
| :diagramdir: models | ||
| :imagesdir: images | ||
| :toc: left | ||
| :iconsdir: images | ||
| :icons: font | ||
| :sectnums: | ||
| :sectnumlevels: 5 | ||
|
|
||
| The bundle service oriented communication (SOCom) implements components for client/server pattern based communication for the following communication paradigms: | ||
|
|
||
| * remote procedure call; | ||
| * publish/subscribe (event communication). | ||
|
|
||
| SOCom provides interfaces which enable the implementation of service gateways (bridges). | ||
| This allows users to independently implement service bridges for different communication protocols (e.g. IPC, SOME/IP, …). | ||
| SOCom provides intra-process client/server communication only. | ||
|
|
||
| == Design | ||
|
|
||
| See <<doc/design/README.adoc#,design/>> for a high level design. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,81 @@ | ||
| // ******************************************************************************* | ||
| // 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 | ||
| // ******************************************************************************* | ||
|
|
||
| //// | ||
| Every asciidoc file in this document starts with the section level 0, i.e. a section like | ||
| .... | ||
| = Title | ||
| .... | ||
|
|
||
| When the file is included from another file within the document, the levels must be adjusted with the `leveloffset` attribute to the `include` directive at the point of inclusion, e.g. | ||
| .... | ||
| include::file.adoc[leveloffset=+1] | ||
| .... | ||
| //// | ||
|
|
||
| = Structural View | ||
|
|
||
| The bundle service oriented communication (SOCom) implements components for client/server pattern based communication for the following communication paradigms: | ||
|
|
||
| * remote procedure call; | ||
| * publish/subscribe (event communication). | ||
|
|
||
| SOCom provides interfaces which enable the implementation of service gateways (bridges). | ||
| This allows users to independently implement service bridges for different communication protocols (e.g. IPC, SOME/IP, …). | ||
| SOCom provides intra-process client/server communication only. | ||
|
|
||
| .Component diagram of SOCom | ||
| [plantuml, svg, align="center"] | ||
| .... | ||
| include::models/component_diagram_socom.puml[] | ||
| .... | ||
|
|
||
| .Software elements | ||
|
|
||
| * <<runtime_component>>; | ||
| * <<client_connector_component>>; | ||
| * <<server_connector_component>>; | ||
|
|
||
| [#runtime_component] | ||
| == Runtime | ||
|
|
||
| The Runtime creates and connects Client_connectors and Server_connectors. | ||
| In addition to that it has a plugin interface for adding bridges to cross IPC or network boundaries. | ||
| The Runtime must outlive all created Client_connectors and Server_connectors. | ||
|
|
||
| [#client_connector_component] | ||
| == Client connector | ||
|
|
||
| A client application owns and uses this component to join client/server pattern based service oriented communication (SOCom). | ||
| The client connector interacts with the server connector in order perform the supported communication primitives. | ||
| The client connector API provides the following features: | ||
|
|
||
| * service instance state change indications | ||
| * asynchronous remote procedure call | ||
|
|
||
| ** with method reply | ||
| ** without method reply (fire and forget) | ||
|
|
||
| * event subscription | ||
|
|
||
| ** with optional initial value request (required for fields) | ||
|
|
||
| * event subscription acknowledge indication | ||
| * event update indication | ||
| * requested event update indication | ||
|
|
||
| [#server_connector_component] | ||
| == Server connector | ||
|
|
||
| The Server_connector represents a service, which is used by a Client_connector. | ||
| It can send event updates and respond to method calls. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,172 @@ | ||
| // ******************************************************************************* | ||
| // 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 | ||
| // ******************************************************************************* | ||
|
|
||
| //// | ||
| Every asciidoc file in this document starts with the section level 0, i.e. a section like | ||
| .... | ||
| = Title | ||
| .... | ||
|
|
||
| When the file is included from another file within the document, the levels must be adjusted with the `leveloffset` attribute to the `include` directive at the point of inclusion, e.g. | ||
| .... | ||
| include::file.adoc[leveloffset=+1] | ||
| .... | ||
| //// | ||
|
|
||
| = Behavioral View | ||
|
|
||
| This component implements the following state machines: | ||
|
|
||
| * <<event_subscription_state_machine, event subscription state>>; | ||
| * <<service_state_machine, service state>>. | ||
|
|
||
| == Runtime | ||
|
|
||
| The runtime is a (process internal) service instance broker. | ||
| Client connectors and server connectors are created using the runtime (factory), which keeps track of their existence and state. | ||
| Depending on the existence and state of the communication partners, the runtime takes care for connecting/disconnecting service interface and service instance compatible client and server connectors. | ||
| Additionally, it provides a service instance find interface. | ||
|
|
||
| == Server connector | ||
|
|
||
| A server application owns and uses this component to join client/server pattern based service oriented communication (SOCom). | ||
| The server connector interacts with the client connector in order perform the supported communication primitives. | ||
| The server connector API provides the following features: | ||
|
|
||
| * remote procedure called indication; | ||
| * event subscription state changed indication: | ||
|
|
||
| ** on first subscriber; | ||
| ** on last unsubscriber. | ||
|
|
||
| * event update request indication; | ||
| * event mode getter (event with/without initial update); | ||
| * update event; | ||
| * update requested event; | ||
| * acknowledge event subscription. | ||
|
|
||
| == Method Communication | ||
|
|
||
| Methods calls are routed 1:1 from client to server application. | ||
| If a method reply is requested, the calling client is served with the related reply. | ||
| Independent method calls share no state. | ||
|
|
||
| .Interaction diagram: Method communication | ||
| [plantuml, svg, align="center"] | ||
| .... | ||
| include::models/interaction_diagram_method_communication.puml[] | ||
| .... | ||
|
|
||
| == Event Communication | ||
|
|
||
| The client subscribes to an event. | ||
| On the subscription, SOCom informs the server using the request for events. | ||
| If no client is subscribed to an event, the server will not send any event updates. | ||
|
|
||
| After unsubscription of the subscriber, SOCom informs the server that an event is not subscribed anymore. | ||
| SOCom keeps track of subscription states and related clients. | ||
|
|
||
| .Interaction diagram: Event communication | ||
| [plantuml, svg, align="center"] | ||
| .... | ||
| include::models/interaction_diagram_event_communication.puml[] | ||
| .... | ||
|
|
||
| == Field Notification Communication | ||
|
|
||
| A field notification is implemented as an event with event update on subscription. | ||
|
|
||
| NOTE: Additional behavior compared to field communication: | ||
| since SOCom does not save the current event values, SOCom requests an event update from the server for each new subscriber. | ||
|
|
||
| Servers answer this request with update_requested_event(). | ||
| Those updates are indicated to the client which is subscribed and has an initial event update pending. | ||
|
|
||
| Regular update_event() calls update for the events of the subscriber and also fulfills the initial event update use-case. | ||
| Consequently, update_event() satisfies the event update request implicitly. | ||
|
|
||
| .Interaction diagram: Field notification communication | ||
| [plantuml, svg, align="center"] | ||
| .... | ||
| include::models/interaction_diagram_field_notification_communication.puml[] | ||
| .... | ||
|
|
||
| == Service Gateway - find service | ||
|
|
||
| The creation of client connectors is forwarded to bridges as request_service() calls. | ||
| Service bridges look up the required service instance within their domain. | ||
| If available, they connect to the remote counterpart and locally create a proxy server connector (forwarding all communication). | ||
|
|
||
| .Interaction diagram: Service Gateway - find service | ||
| [plantuml, svg, align="center"] | ||
| .... | ||
| include::models/interaction_diagram_service_gateway_find_service.puml[] | ||
| .... | ||
|
|
||
| == Service Gateway - require service | ||
|
|
||
| The creation of client connectors is forwarded to bridges as request_service() calls. | ||
| Service bridges look up the required service instance within their domain. | ||
| If available, they connect to the remote counterpart and locally create a proxy server connector (forwarding all communication). | ||
|
|
||
| .Interaction diagram: Service Gateway - require service | ||
| [plantuml, svg, align="center"] | ||
| .... | ||
| include::models/interaction_diagram_service_gateway_require_service.puml[] | ||
| .... | ||
|
|
||
| == Service Gateway - provide service | ||
|
|
||
| The creation of server connectors is found by service bridges using the SOCom subscribe_find_service() API. | ||
| Service bridges provide this information within their domain. | ||
| If any domain partner requests the service instance, the service bridge creates a proxy client connector (forwarding all communication). | ||
|
|
||
| .Interaction diagram: Service Gateway - provide service | ||
| [plantuml, svg, align="center"] | ||
| .... | ||
| include::models/interaction_diagram_service_gateway_provide_service.puml[] | ||
| .... | ||
|
|
||
| == Deadlock detection | ||
|
|
||
| In order to facilitate deadlock detection, before a callback is called by a Client_connector or | ||
| Server_connector the thread id of the caller is saved. | ||
| After the callback returns, the previously saved thread id is removed. | ||
| If the calling object is destructed prematurely the deadlock is detected by checking if the thread | ||
| id is still present, issuing a warning log and terminating the application. | ||
|
|
||
| == Client_connector deadlocks | ||
|
|
||
| When a running callback destroys the calling Client_connector a deadlock will happen, which will cause the application to be terminated. | ||
|
|
||
| The deadlock is caused because the Client_connector destructor waits for the callback to return. | ||
| The callback on the other hand waits for the destructor to return. | ||
|
|
||
| .Interaction diagram: Client_connector deadlocks | ||
| [plantuml, svg, align="center"] | ||
| .... | ||
| include::models/interaction_diagram_client_connector_deadlocks.puml[] | ||
| .... | ||
|
|
||
| == Server_connector deadlocks | ||
|
|
||
| When a running callback destroys the calling Server_connector a deadlock will happen, which will cause the application to be terminated. | ||
|
|
||
| The deadlock is caused because the Server_connector destructor waits for the callback to return. | ||
| The callback on the other hand waits for the destructor to return. | ||
|
|
||
| .Interaction diagram: Server_connector deadlocks | ||
| [plantuml, svg, align="center"] | ||
| .... | ||
| include::models/interaction_diagram_server_connector_deadlocks.puml[] | ||
| .... |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.