Safe API Framework 0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
rte_channel.h File Reference

A single redundant "channel": an opaque transport handle plus send/receive callbacks, with basic health bookkeeping. More...

#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include "rte/utils/status/rte_status.h"
Include dependency graph for rte_channel.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  rte_channel_health_t
 Health statistics for one vital channel. More...
struct  rte_channel_config_t
 Configuration for rte_channel_init(). More...
struct  rte_channel_storage_t
 Storage for one vital channel instance (opaque to caller). More...

Typedefs

typedef rte_status_t(*) rte_channel_send_fn(void *channel_handle, const void *data, size_t data_size)
 OSAdapter send callback: transmits on this channel's underlying transport.
typedef rte_status_t(*) rte_channel_recv_fn(void *channel_handle, void *data, size_t data_size, uint32_t timeout_ms)
 OSAdapter receive callback: reads from this channel's underlying transport.
typedef rte_channel_storage_t rte_channel_t
 Opaque handle to a vital channel instance.

Functions

rte_status_t rte_channel_init (rte_channel_storage_t *storage, const rte_channel_config_t *config)
 Initializes one vital channel over a caller-supplied transport.
rte_status_t rte_channel_send (rte_channel_t *handle, const void *data, size_t data_size)
 Sends data on this channel via its OSAdapter send callback.
rte_status_t rte_channel_receive (rte_channel_t *handle, void *data, size_t data_size, uint32_t timeout_ms)
 Receives data on this channel via its OSAdapter receive callback.
rte_status_t rte_channel_get_health (const rte_channel_t *handle, rte_channel_health_t *out_health)
 Queries this channel's health statistics.
const char * rte_channel_get_name (const rte_channel_t *handle)
 Returns this channel's name, as given in rte_channel_config_t::name at rte_channel_init() time.
rte_status_t rte_channel_set_healthy (rte_channel_t *handle, bool is_healthy)
 Marks this channel healthy/unhealthy.
rte_status_t rte_channel_destroy (rte_channel_t *handle)
 Destroys a vital channel instance.

Detailed Description

A single redundant "channel": an opaque transport handle plus send/receive callbacks, with basic health bookkeeping.

REDESIGNED (ADR-025): prior to this, rte_channel_t wrapped N redundant channels and did 2oo2/2oo3/NMR voting between them in one type. That voting engine has moved to rte_voter (register N rte_channel_t instances into a rte_voter_t); a new rte_cross_comparator does the same for exactly 2 channels. This type is now the unit both of those register: one link, validated dispatch to its OSAdapter, nothing more - the same "validate then dispatch to an OSAdapter callback" shape as rte_timer/rte_nvm elsewhere in this codebase, just with the OSAdapter supplied directly in the config (no separate register_osadapter() call, since a channel has exactly one OSAdapter for its whole lifetime, unlike a process-global OAL service).

Definition in file rte_channel.h.