Safe Communication Framework 0.1.0 build feea4f9
ERTMS/ETCS safe communication (Subset-037 EuroRadio, Subset-098 RBC/RBC), CENELEC EN 50128 SIL 4 oriented
Loading...
Searching...
No Matches
transport.c File Reference

Transports built on safeAPIFreamwork's channel API. More...

Include dependency graph for transport.c:

Go to the source code of this file.

Functions

safecomm_status_t safecomm_transport_from_channel_service (safecomm_transport_t *out, safecomm_transport_channel_ctx_t *ctx, void *channel, uint32_t recv_timeout_ms)
 Populate out with a transport that runs over an already-open, caller-owned Platform_RTE named channel (rte_channel_service_t) — e.g. RBC_GP's own train or IL relay channel, opened and closed by the caller for its own reasons independent of this transport's lifetime. Unlike safecomm_transport_oal_tcp, this does not open a bearer itself: it wraps one the caller already has, which is the shape RBC_GP's vital A/B processes need (the relay channel is shared infrastructure, not something the SaF layer should own or close).
safecomm_status_t safecomm_transport_oal_tcp (safecomm_transport_t *out, const char *host, uint16_t port, uint32_t recv_timeout_ms)
 Populate out with an OAL/TCP transport built on safeAPIFreamwork.

Detailed Description

Transports built on safeAPIFreamwork's channel API.

The ONLY file in this library that references safeAPIFreamwork's OAL — the SaF / MAC logic stays framework-free and unit-testable. Compiled with SAFECOMM_HAVE_FRAMEWORK defined only when SAFECOMM_USE_INSTALLED_FRAMEWORK links rte::channels (see CMakeLists.txt); otherwise every function here returns SAFECOMM_STATUS_NOT_IMPLEMENTED, so a pure SaF/MAC unit test build never needs the framework present at all.

Definition in file transport.c.

Function Documentation

◆ safecomm_transport_from_channel_service()

safecomm_status_t safecomm_transport_from_channel_service ( safecomm_transport_t * out,
safecomm_transport_channel_ctx_t * ctx,
void * channel,
uint32_t recv_timeout_ms )

Populate out with a transport that runs over an already-open, caller-owned Platform_RTE named channel (rte_channel_service_t) — e.g. RBC_GP's own train or IL relay channel, opened and closed by the caller for its own reasons independent of this transport's lifetime. Unlike safecomm_transport_oal_tcp, this does not open a bearer itself: it wraps one the caller already has, which is the shape RBC_GP's vital A/B processes need (the relay channel is shared infrastructure, not something the SaF layer should own or close).

channel must point to an already-set-up rte_channel_service_t (opaque void* here so this public header does not depend on Platform_RTE's own headers — only this function's .c file does, and only when built with the framework present).

This transport's own close() is a deliberate no-op: closing the underlying channel remains the caller's responsibility, since other traffic (or the plain, unauthenticated path during migration, REQ-SC integration plan step 6) may still need it after a SaF session ends.

Parameters
outreceives the transport. Non-NULL.
ctxcaller-owned storage this transport's callbacks close over. Non-NULL, must outlive out.
channelan already-open rte_channel_service_t*, owned by the caller. Non-NULL.
recv_timeout_msper-recv supervision timeout passed straight through to rte_channel_service_read_ex(), 0 = block forever.
Returns
SAFECOMM_STATUS_OK / _INVALID_PARAM, or SAFECOMM_STATUS_NOT_IMPLEMENTED when this library was not built with the framework present (SAFECOMM_USE_INSTALLED_FRAMEWORK).
Note
REQ-SC-TRANSPORT-004.

Definition at line 84 of file transport.c.

◆ safecomm_transport_oal_tcp()

safecomm_status_t safecomm_transport_oal_tcp ( safecomm_transport_t * out,
const char * host,
uint16_t port,
uint32_t recv_timeout_ms )

Populate out with an OAL/TCP transport built on safeAPIFreamwork.

Parameters
outreceives the transport. Non-NULL.
hostpeer host (NUL-terminated). Non-NULL.
portpeer TCP port.
recv_timeout_msper-recv supervision timeout, 0 = block forever.
Returns
SAFECOMM_STATUS_OK / _INVALID_PARAM / _TRANSPORT / _NOT_IMPLEMENTED.
Note
REQ-SC-TRANSPORT-004. Only meaningful when the framework dependency is present; a pure SaF/MAC unit test does not need it.

Definition at line 99 of file transport.c.