|
Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
|
Unified channel factory: opens netlink links internally, wraps sapi_dual_channel_t or a sapi_voter_t over N sapi_channel_t links (ADR-025) - see sapi_safechannel.h and ADR-022. More...
#include "safeapi/redundancy/safechannel/sapi_safechannel.h"#include "safeapi/redundancy/checksum/sapi_checksum.h"#include <string.h>Go to the source code of this file.
Functions | |
| static void | safechannel_close_links (sapi_safechannel_t *channel, uint32_t count) |
| Closes every already-opened link handles[0..count-1] and resets the caller's bookkeeping - used both for the normal close path and to unwind a partial open failure. | |
| static sapi_status_t | safechannel_open_one_endpoint (sapi_netlink_storage_t *storage, const sapi_safechannel_endpoint_t *endpoint, size_t message_size, sapi_duration_ms_t connect_timeout_ms, sapi_netlink_handle_t *out_handle) |
| Opens one endpoint, retrying sapi_netlink_open() with a short fixed delay until connect_timeout_ms elapses - the same retry shape every current hand-rolled CONNECT-role caller in safeAPIRBC2oo2 already implements itself (site.c, etc.). | |
| static sapi_status_t | safechannel_open_dual (sapi_safechannel_t *channel, const sapi_safechannel_dual_config_t *cfg) |
| static sapi_status_t | safechannel_vital_backend_send (void *channel_handle, const void *data, size_t data_size) |
| sapi_channel_config_t::send bridge: casts the opaque channel handle back to the sapi_netlink_handle_t it actually is (this module is the only place that made that handle) and forwards to sapi_netlink_send(). One of these is wired into each of the voter's N individual sapi_channel_t links (ADR-025). | |
| static sapi_status_t | safechannel_vital_backend_recv (void *channel_handle, void *data, size_t data_size, uint32_t timeout_ms) |
| sapi_channel_config_t::recv bridge - see safechannel_vital_backend_send(). | |
| static sapi_status_t | safechannel_open_vital (sapi_safechannel_t *channel, const sapi_safechannel_vital_config_t *cfg) |
| sapi_status_t | sapi_safechannel_open (sapi_safechannel_t *channel, const sapi_safechannel_config_t *config) |
| Opens a channel: opens every configured endpoint via the registered sapi_netlink backend, then initializes the wrapped sapi_dual_channel_t or sapi_channel_t on top of the resulting links (ADR-022 section 2.2). Retries each endpoint's sapi_netlink_open() internally up to config's own connect_timeout_ms, matching the retry pattern every current hand-rolled caller already implemented itself. | |
| sapi_status_t | sapi_safechannel_send (sapi_safechannel_t *channel, const uint8_t *payload, size_t payload_size) |
| Sends payload on the underlying channel - broadcast-with-ACK- wait for DUAL_REDUNDANT (sapi_dual_channel_send()), atomic all-or-nothing broadcast to every registered channel for VITAL_VOTED (sapi_voter_send()). | |
| sapi_status_t | sapi_safechannel_receive (sapi_safechannel_t *channel, uint8_t *out_payload, size_t max_size, sapi_duration_ms_t timeout_ms, size_t *out_size) |
| Returns the most recent inbound payload, actively polling the underlying channel if nothing was already staged. | |
| sapi_safechannel_link_status_t | sapi_safechannel_get_status (const sapi_safechannel_t *channel) |
| Aggregate status across every configured endpoint - DOWN before the first send/receive. | |
| sapi_status_t | sapi_safechannel_close (sapi_safechannel_t *channel) |
| Closes every endpoint this instance opened and releases the wrapped channel. Safe to call on an already-closed/never-opened instance (no-op). | |
Unified channel factory: opens netlink links internally, wraps sapi_dual_channel_t or a sapi_voter_t over N sapi_channel_t links (ADR-025) - see sapi_safechannel.h and ADR-022.
Definition in file sapi_safechannel.c.
|
static |
Closes every already-opened link handles[0..count-1] and resets the caller's bookkeeping - used both for the normal close path and to unwind a partial open failure.
Definition at line 16 of file sapi_safechannel.c.
|
static |
Opens one endpoint, retrying sapi_netlink_open() with a short fixed delay until connect_timeout_ms elapses - the same retry shape every current hand-rolled CONNECT-role caller in safeAPIRBC2oo2 already implements itself (site.c, etc.).
Definition at line 34 of file sapi_safechannel.c.
|
static |
Definition at line 59 of file sapi_safechannel.c.
|
static |
sapi_channel_config_t::send bridge: casts the opaque channel handle back to the sapi_netlink_handle_t it actually is (this module is the only place that made that handle) and forwards to sapi_netlink_send(). One of these is wired into each of the voter's N individual sapi_channel_t links (ADR-025).
Definition at line 117 of file sapi_safechannel.c.
|
static |
sapi_channel_config_t::recv bridge - see safechannel_vital_backend_send().
Definition at line 129 of file sapi_safechannel.c.
|
static |
Definition at line 136 of file sapi_safechannel.c.