|
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
|
Transport abstraction for the Safe Communication Framework. More...
Go to the source code of this file.
Data Structures | |
| struct | safecomm_transport_t |
| A consumer-supplied bearer the SaF layer runs over. More... | |
| struct | safecomm_transport_channel_ctx_t |
Caller-owned storage for safecomm_transport_from_channel_service. No dynamic memory (MISRA): the caller allocates this, typically embedded in its own per-link state, the same way it allocates an rte_channel_service_t. More... | |
Typedefs | |
| typedef safecomm_status_t(*) | safecomm_transport_send_fn(void *user, const uint8_t *buf, size_t len) |
Blocking send of exactly len bytes. | |
| typedef safecomm_status_t(*) | safecomm_transport_recv_fn(void *user, uint8_t *buf, size_t cap, size_t *out_len) |
Blocking receive of up to cap bytes. | |
| typedef void(*) | safecomm_transport_close_fn(void *user) |
| Release the underlying bearer. Idempotent. | |
Functions | |
| 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. | |
| 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). | |
Transport abstraction for the Safe Communication Framework.
The SaF sub-layer never opens a socket. The consumer supplies a safecomm_transport_t with blocking send / recv / close callbacks over an already-established bearer:
An OAL-backed default built on safeAPIFreamwork's channel API is provided by safecomm_transport_oal_tcp() for the common case.
REQ-SC-TRANSPORT-001..006 — see docs/requirements/SRS.md.
Definition in file transport.h.
| typedef safecomm_status_t(*) safecomm_transport_send_fn(void *user, const uint8_t *buf, size_t len) |
Blocking send of exactly len bytes.
| user | the safecomm_transport_t::user pointer. |
| buf | bytes to send. Non-NULL when len > 0. |
| len | byte count. |
Definition at line 38 of file transport.h.
| typedef safecomm_status_t(*) safecomm_transport_recv_fn(void *user, uint8_t *buf, size_t cap, size_t *out_len) |
Blocking receive of up to cap bytes.
| user | the safecomm_transport_t::user pointer. |
| buf | destination. Non-NULL when cap > 0. |
| cap | capacity of buf. |
| out_len | receives the number of bytes read (> 0 on success). Non-NULL. |
Definition at line 49 of file transport.h.
| typedef void(*) safecomm_transport_close_fn(void *user) |
Release the underlying bearer. Idempotent.
Definition at line 52 of file transport.h.
| 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.
| out | receives the transport. Non-NULL. |
| host | peer host (NUL-terminated). Non-NULL. |
| port | peer TCP port. |
| recv_timeout_ms | per-recv supervision timeout, 0 = block forever. |
Definition at line 99 of file transport.c.
| 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.
| out | receives the transport. Non-NULL. |
| ctx | caller-owned storage this transport's callbacks close over. Non-NULL, must outlive out. |
| channel | an already-open rte_channel_service_t*, owned by the caller. Non-NULL. |
| recv_timeout_ms | per-recv supervision timeout passed straight through to rte_channel_service_read_ex(), 0 = block forever. |
Definition at line 84 of file transport.c.