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_redundancy_config.h
Go to the documentation of this file.
1
54#ifndef RTE_REDUNDANCY_CONFIG_H
55#define RTE_REDUNDANCY_CONFIG_H
56
57#include <stdint.h>
58#include <stdbool.h>
61
62#ifdef __cplusplus
63extern "C" {
64#endif
65
67#define RTE_REDUNDANCY_CONFIG_MAX_ROLE_NAME_LEN 16U
68
70#define RTE_REDUNDANCY_CONFIG_MAX_REPLICAS 5U
71
74#define RTE_REDUNDANCY_CONFIG_MAX_FILE_SIZE 8192U
75
77#define RTE_CHANNEL_CONFIG_MAX_CHANNELS 32U
78
80#define RTE_CHANNEL_CONFIG_MAX_NAME_LEN 32U
81
83#define RTE_CHANNEL_CONFIG_MAX_HOST_LEN 64U
84
86typedef enum {
87 RTE_CHANNEL_TRANSPORT_FLOW = 0,
88 RTE_CHANNEL_TRANSPORT_POSIX_NETLINK = 1,
89 RTE_CHANNEL_TRANSPORT_DDS = 2
91
93typedef enum {
94 RTE_CHANNEL_ROLE_LISTEN = 0,
95 RTE_CHANNEL_ROLE_CONNECT = 1
97
99typedef struct {
100 uint32_t id;
102 rte_channel_transport_t transport;
105 uint16_t port;
106 uint32_t message_size;
107 uint32_t connect_timeout_ms;
112 uint32_t rcvbuf_bytes;
117 uint32_t sndbuf_bytes;
119
135
162
186
196
204
215 rte_redundancy_topology_t *out_topology);
216
224
242typedef bool (*rte_redundancy_capability_fn)(rte_redundancy_topology_t topology, uint32_t replica_count,
243 void *context);
244
258
297
309 rte_voter_config_t *voter_cfg);
310
315
320
325 const char *name,
326 rte_channel_def_t *out_channel);
327
332 uint32_t id,
333 rte_channel_def_t *out_channel);
334
339
344
345#ifdef __cplusplus
346}
347#endif
348
349#endif /* RTE_REDUNDANCY_CONFIG_H */
rte_status_t
Common result/status codes.
Definition rte_status.h:27
void rte_redundancy_config_set_active(const rte_redundancy_config_t *config)
Set the active configuration explicitly (or automatically by rte_redundancy_config_load).
#define RTE_CHANNEL_CONFIG_MAX_NAME_LEN
const rte_redundancy_config_t * rte_redundancy_config_get_active(void)
Get the currently active loaded redundancy/channel configuration (if any).
rte_status_t rte_redundancy_config_standby_mode_from_string(const char *name, rte_standby_mode_t *out_mode)
Parse a standby-mode name string ("hot", "warm", "cold") into its enum value.
rte_status_t rte_redundancy_config_find_channel_by_id(const rte_redundancy_config_t *config, uint32_t id, rte_channel_def_t *out_channel)
Find channel definition by ID in the given configuration.
rte_status_t rte_redundancy_config_topology_from_string(const char *name, rte_redundancy_topology_t *out_topology)
Parse a topology name string ("2oo2", "2oo2_redundant", "2oo3", "nmr") into its enum value.
rte_status_t rte_redundancy_config_register_capability(rte_redundancy_capability_fn fn, void *context)
Registers the capability callback rte_redundancy_config_load() consults after successfully parsing a ...
rte_channel_transport_t
const char * rte_redundancy_config_standby_mode_to_string(rte_standby_mode_t mode)
Inverse of rte_redundancy_config_standby_mode_from_string() - for logging/diagnostics.
#define RTE_CHANNEL_CONFIG_MAX_HOST_LEN
#define RTE_CHANNEL_CONFIG_MAX_CHANNELS
const char * rte_redundancy_config_topology_to_string(rte_redundancy_topology_t topology)
Inverse of rte_redundancy_config_topology_from_string() - for logging/diagnostics.
#define RTE_REDUNDANCY_CONFIG_MAX_REPLICAS
rte_status_t rte_channel_config_transport_from_string(const char *name, rte_channel_transport_t *out_transport)
Parse transport name string ("flow", "netlink", "posix", "dds") into enum.
rte_status_t rte_redundancy_config_find_channel_by_name(const rte_redundancy_config_t *config, const char *name, rte_channel_def_t *out_channel)
Find channel definition by name in the given configuration.
rte_status_t rte_channel_config_role_from_string(const char *name, rte_channel_role_t *out_role)
Parse channel role name string ("listen", "connect", "publisher", "subscriber") into enum.
rte_standby_mode_t
How a non-active replica ("standby") keeps itself ready to take over, and how rte_state_transfer (red...
#define RTE_REDUNDANCY_CONFIG_MAX_ROLE_NAME_LEN
rte_status_t rte_redundancy_config_load(const char *path, rte_redundancy_config_t *out_config)
Load a redundancy topology config from a JSON file.
bool(*) rte_redundancy_capability_fn(rte_redundancy_topology_t topology, uint32_t replica_count, void *context)
Integrator-supplied capability query: can THIS application actually run the given topology/replica_co...
rte_redundancy_topology_t
rte_status_t rte_redundancy_config_apply_to_voter(const rte_redundancy_config_t *config, rte_voter_config_t *voter_cfg)
Copy the resolved quorum from a loaded redundancy config into a rte_voter_config_t,...
@ RTE_STANDBY_MODE_WARM
@ RTE_STANDBY_MODE_COLD
@ RTE_STANDBY_MODE_HOT
@ RTE_REDUNDANCY_TOPOLOGY_2OO2_REDUNDANT
@ RTE_REDUNDANCY_TOPOLOGY_2OO3
@ RTE_REDUNDANCY_TOPOLOGY_NMR
@ RTE_REDUNDANCY_TOPOLOGY_2OO2
Common status/error codes returned by every Safe API Framework function. Shared across all OS Abstrac...
N-way voting across registered rte_channel_t links (2oo2/2oo3/NMR).
rte_channel_def_t channels[RTE_CHANNEL_CONFIG_MAX_CHANNELS]
rte_redundancy_topology_t topology
char roles[RTE_REDUNDANCY_CONFIG_MAX_REPLICAS][RTE_REDUNDANCY_CONFIG_MAX_ROLE_NAME_LEN]
Configuration for rte_voter_init().
Definition rte_voter.h:87