|
Safe API Framework 0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
|
Data Structures | |
| struct | rte_channel_def_t |
| struct | rte_redundancy_config_t |
Macros | |
| #define | RTE_REDUNDANCY_CONFIG_MAX_ROLE_NAME_LEN 16U |
| #define | RTE_REDUNDANCY_CONFIG_MAX_REPLICAS 5U |
| #define | RTE_REDUNDANCY_CONFIG_MAX_FILE_SIZE 8192U |
| #define | RTE_CHANNEL_CONFIG_MAX_CHANNELS 32U |
| #define | RTE_CHANNEL_CONFIG_MAX_NAME_LEN 32U |
| #define | RTE_CHANNEL_CONFIG_MAX_HOST_LEN 64U |
Typedefs | |
| typedef 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_count combination? This is how an integrator (e.g. RBC_GP) declares what it supports to the Platform, instead of the Platform (or the integrator's own call site) hardcoding a topology allowlist - matches OCORA's own "Platform decides" posture already used throughout this module and rte_voter/rte_cross_comparator's own safestate-transition ownership. | |
Enumerations | |
| enum | rte_channel_transport_t { RTE_CHANNEL_TRANSPORT_FLOW = 0 , RTE_CHANNEL_TRANSPORT_POSIX_NETLINK = 1 , RTE_CHANNEL_TRANSPORT_DDS = 2 } |
| enum | rte_channel_role_t { RTE_CHANNEL_ROLE_LISTEN = 0 , RTE_CHANNEL_ROLE_CONNECT = 1 } |
| enum | rte_redundancy_topology_t { RTE_REDUNDANCY_TOPOLOGY_2OO2 = 0 , RTE_REDUNDANCY_TOPOLOGY_2OO2_REDUNDANT = 1 , RTE_REDUNDANCY_TOPOLOGY_2OO3 = 2 , RTE_REDUNDANCY_TOPOLOGY_NMR = 3 } |
| enum | rte_standby_mode_t { RTE_STANDBY_MODE_HOT = 0 , RTE_STANDBY_MODE_WARM = 1 , RTE_STANDBY_MODE_COLD = 2 } |
| How a non-active replica ("standby") keeps itself ready to take over, and how rte_state_transfer (redundancy/state_transfer/ rte_state_transfer.h) gets used, if at all. This is a CADENCE policy only - it says nothing about WHAT data is registered (that stays the integrator's own rte_state_transfer_register_field() calls) or how a promotion is detected (that stays e.g. rte_dual_negotiator_t's own job). More... | |
Functions | |
| 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. | |
| 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. | |
| 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. | |
| const char * | rte_redundancy_config_topology_to_string (rte_redundancy_topology_t topology) |
| Inverse of rte_redundancy_config_topology_from_string() - for logging/diagnostics. | |
| 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 file, before returning RTE_STATUS_OK. Call once at startup, before load(). No callback registered (the default) means load() accepts any successfully-parsed, internally-consistent config - the same behavior this module had before this function existed. | |
| 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. | |
| 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, leaving every other field of voter_cfg untouched (compare()/context/timeouts/safestate fields remain the caller's own responsibility to set). | |
| 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_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_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_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. | |
| const rte_redundancy_config_t * | rte_redundancy_config_get_active (void) |
| Get the currently active loaded redundancy/channel configuration (if any). | |
| 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_REDUNDANCY_CONFIG_MAX_ROLE_NAME_LEN 16U |
Longest role name (including terminator) accepted in the "roles" array.
Definition at line 67 of file rte_redundancy_config.h.
| #define RTE_REDUNDANCY_CONFIG_MAX_REPLICAS 5U |
Largest replica count (and "roles" array length) this module accepts.
Definition at line 70 of file rte_redundancy_config.h.
| #define RTE_REDUNDANCY_CONFIG_MAX_FILE_SIZE 8192U |
Largest config file this loader will read - a bounded, static buffer, no dynamic allocation; a larger file is rejected as invalid.
Definition at line 74 of file rte_redundancy_config.h.
| #define RTE_CHANNEL_CONFIG_MAX_CHANNELS 32U |
Largest channel count accepted in the "channels" array.
Definition at line 77 of file rte_redundancy_config.h.
| #define RTE_CHANNEL_CONFIG_MAX_NAME_LEN 32U |
Longest channel name (including terminator).
Definition at line 80 of file rte_redundancy_config.h.
| #define RTE_CHANNEL_CONFIG_MAX_HOST_LEN 64U |
Longest host name (including terminator).
Definition at line 83 of file rte_redundancy_config.h.
| typedef 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_count combination? This is how an integrator (e.g. RBC_GP) declares what it supports to the Platform, instead of the Platform (or the integrator's own call site) hardcoding a topology allowlist - matches OCORA's own "Platform decides" posture already used throughout this module and rte_voter/rte_cross_comparator's own safestate-transition ownership.
| [in] | topology | The loaded config's topology. |
| [in] | replica_count | The loaded config's replica_count. |
| [in] | context | Whatever rte_redundancy_config_register_capability() was given. |
Definition at line 242 of file rte_redundancy_config.h.
Channel transport type.
Definition at line 86 of file rte_redundancy_config.h.
| enum rte_channel_role_t |
Channel endpoint role.
Definition at line 93 of file rte_redundancy_config.h.
Voting/replication topology, matching the OCORA/RCA-discussed options.
Definition at line 121 of file rte_redundancy_config.h.
| enum rte_standby_mode_t |
How a non-active replica ("standby") keeps itself ready to take over, and how rte_state_transfer (redundancy/state_transfer/ rte_state_transfer.h) gets used, if at all. This is a CADENCE policy only - it says nothing about WHAT data is registered (that stays the integrator's own rte_state_transfer_register_field() calls) or how a promotion is detected (that stays e.g. rte_dual_negotiator_t's own job).
| Enumerator | |
|---|---|
| RTE_STANDBY_MODE_HOT | Standby computes independently every cycle from the same live inputs as the active replica, so it is never behind - no transfer is needed at all, ever. The integrator simply never calls rte_state_transfer_encode()/_decode() in this mode. |
| RTE_STANDBY_MODE_WARM | Standby is periodically refreshed (an integrator-chosen interval, not specified by this module) so a promotion only needs a short catch-up, not a full cold transfer. |
| RTE_STANDBY_MODE_COLD | Standby is not refreshed until the moment of promotion - the default. RBC_GP implements it and runs WARM and HOT alike as a snapshot sync before each commit (rte_site_role standby_sync, no independent computation; see that product's ab_gp_channel_negotiate.c). |
Definition at line 145 of file rte_redundancy_config.h.
| 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.
| [in] | name | NUL-terminated; case-sensitive. |
| [out] | out_mode | Set on success; untouched on failure. |
Definition at line 476 of file rte_redundancy_config.c.
| 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.
| [in] | mode | Any value of rte_standby_mode_t. |
Definition at line 496 of file rte_redundancy_config.c.
| 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.
| [in] | name | NUL-terminated topology name; case-sensitive, exactly one of the four strings above. |
| [out] | out_topology | Set on success; untouched on failure. |
Definition at line 428 of file rte_redundancy_config.c.
| const char * rte_redundancy_config_topology_to_string | ( | rte_redundancy_topology_t | topology | ) |
Inverse of rte_redundancy_config_topology_from_string() - for logging/diagnostics.
| [in] | topology | Any value of rte_redundancy_topology_t. |
Definition at line 452 of file rte_redundancy_config.c.
| 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 file, before returning RTE_STATUS_OK. Call once at startup, before load(). No callback registered (the default) means load() accepts any successfully-parsed, internally-consistent config - the same behavior this module had before this function existed.
| [in] | fn | May be NULL to clear a previously registered callback (load() then accepts any config again). |
| [in] | context | Passed verbatim to fn on every call; may be NULL. |
Definition at line 21 of file rte_redundancy_config.c.
| 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.
| [in] | path | NUL-terminated filesystem path. |
| [out] | out_config | Filled on success; untouched on failure. |
Default quorum_size when "quorum" is absent from the file:
"standby_mode" ("hot"/"warm"/"cold") is optional; defaults to RTE_STANDBY_MODE_COLD when absent (see that enum's own doc).
Per channel, "rcvbuf_bytes" and "sndbuf_bytes" are optional; absent gives 0 (OS default) in rte_channel_def_t (REQ-REDCFG-001).
Definition at line 660 of file rte_redundancy_config.c.
| 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, leaving every other field of voter_cfg untouched (compare()/context/timeouts/safestate fields remain the caller's own responsibility to set).
| [in] | config | A config previously filled by rte_redundancy_config_load(), non-NULL. |
| [in,out] | voter_cfg | Non-NULL; only ::quorum_size is written. |
Definition at line 716 of file rte_redundancy_config.c.
| 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.
Definition at line 245 of file rte_redundancy_config.c.
| 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.
Definition at line 265 of file rte_redundancy_config.c.
| 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.
Definition at line 726 of file rte_redundancy_config.c.
| 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.
Definition at line 744 of file rte_redundancy_config.c.
| const rte_redundancy_config_t * rte_redundancy_config_get_active | ( | void | ) |
Get the currently active loaded redundancy/channel configuration (if any).
Definition at line 765 of file rte_redundancy_config.c.
| void rte_redundancy_config_set_active | ( | const rte_redundancy_config_t * | config | ) |
Set the active configuration explicitly (or automatically by rte_redundancy_config_load).
Definition at line 770 of file rte_redundancy_config.c.