Implement the SOME/IP stack

The SOME/IP stack manages low-level SOME/IP transport logic through an Android Interface Definition Language (AIDL) interface. This stack sends and receives SOME/IP events and Remote Procedure Calls (RPCs). This document describes the following concepts:

  • Reference implementation: SDV provides a non-production reference sample implementation for a SOME/IP stack.

  • Binder API: The ISomeIpStack interface defines methods for interacting with a SOME/IP stack instance.

  • SELinux: A sample SELinux configuration for the reference stack enables binder communication and granular file system access.

While this stack reads the SOME/IP wire format, it leaves the payload as opaque binary blobs and forwards the payload to the SOME/IP broker.

The SOME/IP standard provides no definition of the stack or stack API layer. SDV provides an AIDL API that operates within the familiar definitions of the standard and requires a minimal amount of code to adapt existing stacks.

This API lets you select different implementations of the stack and simplifies the integration of the stack with other components in the system.

Reference implementation

SDV provides a non-production reference sample implementation for a SOME/IP stack, and consists of a thin wrapper atop the open source COVESA vsomeip library. The system deploys the reference stack only to sdv_core_cf and sdv_core_arm64 targets, and init.rc starts it on the VM with CID=3.

on property:dev.bootcomplete=1 && property:ro.sdv.vsock_local_cid=3
    start sdv_someip_stack_agent

Define the production deployment configuration for your OEM-defined stack. To learn more, see Integrate SOME/IP with SDV.

Configuration

The reference stack declares a configuration for the vSomeIP library. See Configuration File Structure for a description of the configuration structure. As part of the configuration, we specify SOME/IP SD parameters, such as a multicast address and the port used by the stack.

Binder API

The ISomeIpStack interface is declared in core_services/some_ip/aidl/google/sdv/someip. The ISomeIpStack interface defines methods for interacting with a SOME/IP stack instance and provides essential qualities for these items.

Service availability

  • register_availability_callback Registers a callback for service availability changes.

  • monitor_service Instructs the stack to monitor a specific service's availability.

  • unregister_availability_callback Unregisters the availability callback.

  • on_sdv_service_availability Indicates a change in SDV service availability.

Remote procedure calls (RPC)

You can send an RPC request with:

  • rpc_transact to wait for a response
  • rpc_oneway to not wait for a response

For RPC request handling:

  • register_rpc_request_callback Registers a callback for incoming RPC requests.

  • unregister_rpc_request_callback Unregisters the RPC request callback.

Event notification

  • register_event_notification_callback Registers a callback for subscribed event notifications.

  • unregister_event_notification_callback Unregisters the event notification callback.

  • on_sdv_topic_availability Indicates a change in SDV topic availability.

  • subscribe Subscribes to a specific event from an event group.

  • unsubscribe Unsubscribes from a specific event.

  • publish Publishes an event with a given payload.

SELinux

The device/google/sdv/sdv_core_base/sepolicy/samples/vendor/ folder contains a sample SELinux configuration for the reference stack:

  • sdv_someip_stack_default.te defines the sdv_someip_stack_default type and maps it to attributes and contexts.

  • file_contexts maps binary and data folders to appropriate contexts.

The configuration enables Binder communication between the stack and the broker, allowing access to networking qualities and granular access to the file system of the device.