Transport Requirements

This section defines requirements for the transport layer implementation in OpenSOMEIP, including UDP and TCP transports.

Overview

The transport layer provides:

  1. UDP transport with multicast support

  2. TCP transport with connection management

  3. Abstract transport interface for extensibility

Requirements

UDP Transport

Requirement: UDP Bind and Unicast Send/Receive REQ_TRANSPORT_001a
status: implemented
priority: high
satisfies: feat_req_someip_32, feat_req_someip_318, feat_req_someip_319, feat_req_someip_33

The implementation shall provide UDP transport that supports binding to local address and port, sending messages to unicast destinations, and receiving messages from any source.

Rationale: UDP unicast is the foundation for SOME/IP point-to-point communication.

Code Location: src/transport/udp_transport.cpp

Requirement: UDP Multicast Support REQ_TRANSPORT_001b
status: implemented
priority: high
satisfies: feat_req_someip_584, feat_req_someip_811, feat_req_someip_315, feat_req_someip_316

The implementation shall support sending to multicast destinations and multicast group join/leave for receiving multicast traffic.

Rationale: Multicast is required for Service Discovery and eventgroup subscriptions.

Code Location: src/transport/udp_transport.cpp

Requirement: Non-Blocking I/O and Thread Safety REQ_TRANSPORT_001c
status: implemented
priority: high
satisfies: feat_req_someip_659, feat_req_someip_664, feat_req_someip_317

The implementation shall provide non-blocking I/O with configurable timeouts and thread-safe operation for concurrent send/receive.

Rationale: Non-blocking I/O and thread safety enable integration with event loops and multi-threaded applications.

Code Location: src/transport/udp_transport.cpp

TCP Transport

Requirement: TCP Client/Server Modes REQ_TRANSPORT_002a
status: implemented
priority: high
satisfies: feat_req_someip_32, feat_req_someip_325, feat_req_someip_323, feat_req_someip_324

The implementation shall provide a TCP transport (TcpTransport) that supports client mode (connect to remote server) and server mode (accept incoming connections).

Rationale: Client and server modes cover both initiator and responder roles in TCP communication.

Code Location: src/transport/tcp_transport.cpp

Requirement: TCP Framing and State Management REQ_TRANSPORT_002b
status: implemented
priority: high
satisfies: feat_req_someip_585, feat_req_someip_644, feat_req_someip_645, feat_req_someip_661

The implementation shall provide message framing over TCP streams, connection state management, automatic reconnection (configurable), and thread-safe operation.

Rationale: TCP streams require framing to delimit messages; state management enables robust reconnection.

Code Location: src/transport/tcp_transport.cpp

Connection Management

Requirement: Connection State Tracking and Notification REQ_TRANSPORT_003a
status: implemented
priority: medium
satisfies: feat_req_someip_326, feat_req_someip_644, feat_req_someip_646

The TCP transport shall track connection state (disconnected, connecting, connected) and notify listeners of connection state changes.

Rationale: State tracking and notifications enable applications to react to connection lifecycle events.

Code Location: src/transport/tcp_transport.cpp

Requirement: Graceful Shutdown and Error Handling REQ_TRANSPORT_003b
status: implemented
priority: medium
satisfies: feat_req_someip_647, feat_req_someip_678, feat_req_someip_679, feat_req_someip_680

The TCP transport shall support graceful connection shutdown, handle connection errors and timeouts, and support multiple simultaneous connections (server mode).

Rationale: Graceful shutdown and error handling ensure clean resource release and predictable behavior on failures.

Code Location: src/transport/tcp_transport.cpp

Error Recovery

Requirement: Retry Send on Transient Errors REQ_TRANSPORT_004a
status: implemented
priority: medium
satisfies: feat_req_someip_429, feat_req_someip_430, feat_req_someip_434, feat_req_someip_435

The transport layer shall retry send operations on transient errors (e.g., EAGAIN, EWOULDBLOCK) according to configurable retry policy.

Rationale: Transient errors are common in non-blocking I/O and often resolve on retry.

Code Location: src/transport/udp_transport.cpp, src/transport/tcp_transport.cpp

Requirement: Socket Close/Reopen on Persistent Errors REQ_TRANSPORT_004b
status: implemented
priority: medium
satisfies: feat_req_someip_436, feat_req_someip_437, feat_req_someip_438

The transport layer shall close and reopen sockets when persistent errors occur (e.g., connection reset, broken pipe).

Rationale: Persistent errors indicate the socket is unusable; reopening restores communication.

Code Location: src/transport/udp_transport.cpp, src/transport/tcp_transport.cpp

Requirement: Error Logging with Detail REQ_TRANSPORT_004c
status: implemented
priority: medium
satisfies: feat_req_someip_439, feat_req_someip_440, feat_req_someip_441

The transport layer shall log errors with sufficient detail for diagnosis (errno, endpoint, operation context).

Rationale: Detailed error logs enable rapid troubleshooting in production environments.

Code Location: src/transport/udp_transport.cpp, src/transport/tcp_transport.cpp

Requirement: Return Error Codes and Configurable Retry REQ_TRANSPORT_004d
status: implemented
priority: medium
satisfies: feat_req_someip_326, feat_req_someip_371, feat_req_someip_442, feat_req_someip_443

The transport layer shall return appropriate error codes to callers and support configurable retry policies (count, delay).

Rationale: Error codes allow application-layer handling; configurable retry adapts to different deployment requirements.

Code Location: src/transport/udp_transport.cpp, src/transport/tcp_transport.cpp

Transport Interface

Requirement: Abstract Transport Interface REQ_TRANSPORT_005
status: implemented
priority: high
satisfies: feat_req_someip_32, feat_req_someip_56, feat_req_someip_31

The implementation shall provide an abstract transport interface (ITransport) that defines:

  • start(): Initialize and start the transport

  • stop(): Stop the transport and release resources

  • send(Message&, Endpoint&): Send a message

  • set_listener(ITransportListener*): Set message listener

  • is_running(): Check transport state

Rationale: Abstract interface enables transport-agnostic application code and testing.

Code Location: include/transport/transport.h

Endpoint Configuration

Requirement: Endpoint Configuration REQ_TRANSPORT_006
status: implemented
priority: medium
satisfies: feat_req_someip_32, feat_req_someip_659, feat_req_someip_660, feat_req_someip_661, feat_req_someip_733

The implementation shall provide endpoint configuration:

  • IP address (IPv4 and IPv6)

  • Port number

  • Protocol type (UDP/TCP)

  • Validation of endpoint parameters

  • String representation for logging

Rationale: Proper endpoint handling is fundamental to network communication.

Code Location: include/transport/endpoint.h

Transport Protocol Binding

Requirement: nPDU Feature Support REQ_TRANSPORT_010
status: implemented
priority: high
satisfies: feat_req_someip_702, feat_req_someip_741, feat_req_someip_663

The software shall support transporting more than one SOME/IP message in a single transport layer PDU (nPDU feature). For cyclic senders, nPDU shall be supported without explicit configuration.

Rationale: nPDU reduces per-message overhead for high-frequency communication.

Code Location: src/transport/udp_transport.cpp (send_data, receive_loop)

Requirement: UDP Multicast Support REQ_TRANSPORT_011
status: implemented
priority: high
satisfies: feat_req_someip_811, feat_req_someip_812, feat_req_someip_814

The software shall support UDP unicast and multicast transmission. Multicast eventgroups shall use unicast for initial field events. Clients shall support receiving via unicast and/or multicast.

Rationale: Multicast reduces bandwidth for events delivered to many subscribers.

Code Location: src/transport/udp_transport.cpp (join_multicast_group, configure_multicast)

Requirement: Multicast Threshold Switching REQ_TRANSPORT_012
status: draft
priority: medium
satisfies: feat_req_someip_813

The software shall support dynamic switching of eventgroups between unicast and multicast based on the Multicast-Threshold configuration.

Rationale: Dynamic switching optimizes bandwidth based on actual subscriber count.

Code Location: src/transport/udp_transport.cpp, include/sd/sd_types.h

Requirement: Internal Message Multiplexing REQ_TRANSPORT_013
status: draft
priority: high
satisfies: feat_req_someip_732

The software shall support internal de/multiplexing of SOME/IP messages independent of the number of controllers, cores, and IP addresses.

Rationale: Internal multiplexing decouples service routing from physical network topology.

Code Location: src/rpc/rpc_server.cpp (service_id_ filtering), src/sd/sd_server.cpp

Requirement: Port Configuration REQ_TRANSPORT_014
status: implemented
priority: high
satisfies: feat_req_someip_658, feat_req_someip_676, feat_req_someip_733

The software shall read port numbers from configuration files. Port 30490 shall only be used for SOME/IP-SD, not application communication.

Rationale: Configuration-driven ports ensure deterministic network resource allocation.

Code Location: include/transport/udp_transport.h (UdpTransportConfig), include/sd/sd_types.h (SdConfig)

Requirement: Ephemeral Port Range REQ_TRANSPORT_015
status: implemented
priority: medium
satisfies: feat_req_someip_661

The software shall use IETF/IANA ephemeral port range (49152-65535) for dynamic ports.

Rationale: Ephemeral port range compliance avoids conflicts with well-known services.

Code Location: include/transport/endpoint.h, src/transport/udp_transport.cpp

TCP Connection Management

Requirement: Client-Initiated TCP Connection REQ_TRANSPORT_016
status: implemented
priority: high
satisfies: feat_req_someip_646, feat_req_someip_647

The software shall open TCP connections from the client side when the first method call or notification subscription is needed. The client is responsible for re-establishing failed connections.

Rationale: Client-initiated connections simplify server-side connection management.

Code Location: src/transport/tcp_transport.cpp (connect_internal)

Requirement: TCP Connection Sharing REQ_TRANSPORT_017
status: implemented
priority: high
satisfies: feat_req_someip_644, feat_req_someip_645

The software shall use a single TCP connection for all methods, events, and notifications of a service instance. TCP connections shall be shared across services to minimize connection count.

Rationale: Connection sharing minimizes TCP connection overhead and OS resource usage.

Code Location: src/transport/tcp_transport.cpp (connection sharing logic)

Requirement: TCP Connection Closure REQ_TRANSPORT_018
status: implemented
priority: high
satisfies: feat_req_someip_678, feat_req_someip_679, feat_req_someip_680

TCP connections shall be closed by the client when no longer required or when all services are unavailable. The server shall not close connections preemptively.

Rationale: Client-controlled closure prevents servers from disrupting active communication.

Code Location: src/transport/tcp_transport.cpp (disconnect, disconnect_internal)

Requirement: TCP Timeout on Connection Loss REQ_TRANSPORT_019
status: implemented
priority: high
satisfies: feat_req_someip_326, feat_req_someip_681

The software shall treat outstanding requests as timeouts when the TCP connection is lost.

Rationale: Timeout handling prevents clients from waiting indefinitely for responses on broken connections.

Code Location: src/transport/tcp_transport.cpp (connection_monitor_loop)

Service Instance Binding

Requirement: Multiple Service Instance Port Binding REQ_TRANSPORT_022
status: implemented
priority: high
satisfies: feat_req_someip_445, feat_req_someip_636, feat_req_someip_967, feat_req_someip_1079, feat_req_someip_444

The software shall support multiple service instances on different ECUs and on the same ECU. Multiple instances of the same service on one ECU shall listen on different ports.

Rationale: Multi-port binding enables horizontal scaling of service instances.

Code Location: src/sd/sd_server.cpp (offer_service per instance), include/sd/sd_types.h

Requirement: Client Server Address Resolution REQ_TRANSPORT_023
status: implemented
priority: high
satisfies: feat_req_someip_660, feat_req_someip_665

The client shall use the IP address and port number announced by the server via SOME/IP-SD for communication.

Rationale: SD-announced address resolution ensures clients connect to the correct server endpoint.

Code Location: src/sd/sd_client.cpp (process_offer_entry, ip_address from option)

Requirement: Unaligned Message Reception REQ_TRANSPORT_024
status: implemented
priority: medium
satisfies: feat_req_someip_664, feat_req_someip_668

The software shall be capable of receiving unaligned SOME/IP messages when multiple messages are transported in a single UDP or TCP PDU.

Rationale: Unaligned message handling supports nPDU and multi-message PDUs.

Code Location: src/transport/tcp_transport.cpp (parse_message_from_buffer), src/transport/udp_transport.cpp

Traceability

Implementation Files

  • include/transport/transport.h - Transport interface

  • include/transport/udp_transport.h - UDP transport interface

  • include/transport/tcp_transport.h - TCP transport interface

  • include/transport/endpoint.h - Endpoint structure

  • src/transport/udp_transport.cpp - UDP implementation

  • src/transport/tcp_transport.cpp - TCP implementation

Test Files

  • tests/test_udp_transport.cpp - UDP transport tests

  • tests/test_tcp_transport.cpp - TCP transport tests

Examples

  • examples/basic/hello_world_client.cpp - Basic UDP client

  • examples/basic/hello_world_server.cpp - Basic UDP server

  • examples/advanced/tcp_client.cpp - TCP client example

  • examples/advanced/tcp_server.cpp - TCP server example