|
Safe API Framework 0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
|
N-way voting across registered rte_channel_t links (2oo2/2oo3/NMR). More...
#include <stdint.h>#include <stdbool.h>#include <stddef.h>#include "rte/utils/status/rte_status.h"#include "rte/utils/safestate/rte_safestate.h"#include "rte/redundancy/channel_link/rte_channel.h"Go to the source code of this file.
Data Structures | |
| struct | rte_voter_config_t |
| Configuration for rte_voter_init(). More... | |
| struct | rte_voter_storage_t |
| Storage for one voter instance (opaque to caller). No dynamic memory. More... | |
Macros | |
| #define | RTE_VOTER_MAX_CHANNELS 8U |
| Maximum number of channels a single voter can register. | |
| #define | RTE_VOTER_MAX_MESSAGE_SIZE 256U |
| Maximum payload size rte_voter_send()/_receive() supports. | |
Typedefs | |
| typedef bool(*) | rte_voter_compare_fn(const void *a, const void *b, size_t size, void *user_ctx) |
| Optional custom comparison callback. | |
| typedef rte_voter_storage_t | rte_voter_t |
| Opaque handle to a voter instance. | |
Enumerations | |
| enum | rte_voting_strategy_t { RTE_VOTING_2OO2 = 1 , RTE_VOTING_2OO3 = 2 , RTE_VOTING_NMR = 3 } |
| Voting strategy: how many registered channels must agree. More... | |
| enum | rte_voting_result_t { RTE_VOTING_AGREED = 0 , RTE_VOTING_DISAGREED = 1 , RTE_VOTING_TIMEOUT = 2 , RTE_VOTING_INSUFFICIENT_QUORUM = 3 } |
| Outcome of one rte_voter_receive() call. More... | |
Functions | |
| rte_status_t | rte_voter_init (rte_voter_storage_t *storage, const rte_voter_config_t *config) |
| Initializes a voter with zero registered channels. | |
| rte_status_t | rte_voter_register_channel (rte_voter_t *voter, rte_channel_t *channel) |
| Registers one already-initialized channel with this voter. | |
| rte_status_t | rte_voter_send (rte_voter_t *voter, const void *data, size_t data_size) |
| Broadcasts data to every registered, healthy channel. | |
| rte_status_t | rte_voter_receive (rte_voter_t *voter, void *data, size_t data_size, rte_voting_result_t *result, size_t *bytes_received) |
| Receives from every registered, healthy channel and votes. | |
| rte_status_t | rte_voter_vote_buffers (rte_voter_t *voter, const void *const *buffers, uint32_t buffer_count, size_t data_size, rte_voting_result_t *result, void *out_data, size_t *out_size) |
N-way vote on caller-collected buffers, without any registered-channel I/O (ADR-039's N-way cross-compare half: rte_voter used directly, buffer-based, matching rte_cross_comparator_execute_buffers()'s existing shape - decided over building a separate primitive). Same grouping/quorum logic as rte_voter_receive() (REQ-VOTER-004), applied to buffers instead of polling registered channels - this function performs no I/O and ignores any channels registered on voter (same posture rte_cross_comparator_execute_buffers() already established for its own module: a Voter (N-way channel voting) with zero registered channels is a legitimate, expected call shape here). | |
| rte_status_t | rte_voter_get_aggregated_health (const rte_voter_t *voter, uint32_t *healthy_count, uint32_t *total_disagreements) |
| Aggregated health across every registered channel. | |
| uint32_t | rte_voter_get_channel_count (const rte_voter_t *voter) |
| Number of channels currently registered with this voter. | |
| rte_channel_t * | rte_voter_get_channel (const rte_voter_t *voter, uint32_t index) |
| Direct access to one registered channel, by index. | |
| rte_channel_t * | rte_voter_get_channel_by_name (const rte_voter_t *voter, const char *name) |
| Direct access to one registered channel, by name (e.g. "ChannelAtoB") - the name each channel was given via rte_channel_config_t::name at its own rte_channel_init() time. | |
| rte_status_t | rte_voter_destroy (rte_voter_t *voter) |
| Destroys a voter instance. | |
N-way voting across registered rte_channel_t links (2oo2/2oo3/NMR).
ADR-025: this is the voting engine that used to live inside rte_channel before that type was split into a single-link primitive. Register 1..RTE_VOTER_MAX_CHANNELS already-initialized rte_channel_t instances, then use rte_voter_send()/ _receive() the way rte_channel_send()/_receive() used to work.
RCA/OCORA PI-API compatibility note (see docs/rca/RCA_CONCEPT.dox at the workspace root, section 3 "OCORA terminology", and rte_cross_comparator.h's own identical note): per OCORA's Safe Computing Platform model, the Platform - not the application - owns the decision to transition to a safe state on disagreement. rte_voter_receive() therefore ALWAYS enters config->safestate_level on a DISAGREED result; an application can no longer opt out.
Definition in file rte_voter.h.