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
cfm.h File Reference

Communication Functional Module (CFM). More...

Include dependency graph for cfm.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  safecomm_cfm_t
 A CFM instance. Caller-allocated, opaque. More...

Enumerations

enum  safecomm_cfm_profile_t { SAFECOMM_CFM_PROFILE_EURORADIO = 0 , SAFECOMM_CFM_PROFILE_RBC_RBC }
 Which communication-layer profile the CFM runs. More...

Functions

safecomm_status_t safecomm_cfm_from_config (const safecomm_config_t *cfg, const safecomm_transport_t *lower, safecomm_cfm_t *out)
 Build a CFM from a loaded config (cfm.* keys).
safecomm_status_t safecomm_cfm_transport (safecomm_cfm_t *cfm, safecomm_transport_t *out)
 Expose the CFM to the SFM above it as a transport.

Detailed Description

Communication Functional Module (CFM).

The lower half of the EuroRadio stack: it owns the bearer connection (open / close / redial / retry, keep-alive, the SS-037-vs-SS-098 communication-layer differences) and presents the SFM above it a framed byte pipe as a safecomm_transport_t.

Deployment (ADR-002): CFM is linked into the vital A/B channel (rte_example) alongside the SFM, per direct instruction. Its socket I/O runs on its own, but the interface it exposes UP to the SFM is discrete and cycle-aligned (one "PDU available" / "send this PDU" event at a time) so bearer non-determinism never enters the 2oo2 cross-compared path.

The bearer BELOW the CFM:

  • SS-098: a fixed TCP connection to the peer RBC.
  • SS-037: a GSM-R / packet-switched / FRMCS bearer — out of scope, stubbed to a TCP relay via the Gateway ALE.

REQ-SC-CFM-001..015 — see docs/requirements/SRS.md.

Definition in file cfm.h.

Enumeration Type Documentation

◆ safecomm_cfm_profile_t

Which communication-layer profile the CFM runs.

Enumerator
SAFECOMM_CFM_PROFILE_EURORADIO 

SS-037 comms layer (bearer stubbed).

SAFECOMM_CFM_PROFILE_RBC_RBC 

SS-098 comms layer: fixed IP.

Definition at line 36 of file cfm.h.

Function Documentation

◆ safecomm_cfm_from_config()

safecomm_status_t safecomm_cfm_from_config ( const safecomm_config_t * cfg,
const safecomm_transport_t * lower,
safecomm_cfm_t * out )

Build a CFM from a loaded config (cfm.* keys).

Reads cfm.profile, cfm.peer_host, cfm.peer_port, cfm.bind_port, cfm.retry_ms; range-checks each; leaves out ready but not connected.

Parameters
cfgloaded configuration. Non-NULL.
lowerthe bearer the CFM sends/receives over (for the SS-037 stub this is the Gateway-relay transport; for SS-098 it is an OAL/TCP transport). Non-NULL, .send/.recv non-NULL.
outreceives the CFM. Non-NULL.
Returns
SAFECOMM_STATUS_OK / _INVALID_PARAM / _NOT_IMPLEMENTED.
Note
REQ-SC-CFM-003.

Definition at line 12 of file cfm.c.

◆ safecomm_cfm_transport()

safecomm_status_t safecomm_cfm_transport ( safecomm_cfm_t * cfm,
safecomm_transport_t * out )

Expose the CFM to the SFM above it as a transport.

The returned transport's send/recv carry whole SaF PDUs; the CFM handles framing, keep-alive and reconnect underneath.

Parameters
cfma CFM from safecomm_cfm_from_config(). Non-NULL.
outreceives the upward-facing transport. Non-NULL.
Returns
SAFECOMM_STATUS_OK / _INVALID_PARAM / _NOT_IMPLEMENTED.
Note
REQ-SC-CFM-008.

Definition at line 70 of file cfm.c.