111#define SAPI_VOTER_MAX_CHANNELS 8U
114#define SAPI_VOTER_MAX_MESSAGE_SIZE 256U
122 uint32_t channel_count;
123 uint32_t total_disagreements;
241 uint32_t *healthy_count,
242 uint32_t *total_disagreements);
sapi_status_t
Common result/status codes.
sapi_channel_storage_t sapi_channel_t
Opaque handle to a vital channel instance.
sapi_status_t sapi_voter_destroy(sapi_voter_t *voter)
Destroys a voter instance.
sapi_voter_storage_t sapi_voter_t
Opaque handle to a voter instance.
sapi_voting_result_t
Outcome of one sapi_voter_receive() call.
uint32_t sapi_voter_get_channel_count(const sapi_voter_t *voter)
Number of channels currently registered with this voter.
sapi_status_t sapi_voter_register_channel(sapi_voter_t *voter, sapi_channel_t *channel)
Registers one already-initialized channel with this voter.
sapi_channel_t * sapi_voter_get_channel(const sapi_voter_t *voter, uint32_t index)
Direct access to one registered channel, by index.
sapi_channel_t * sapi_voter_get_channel_by_name(const sapi_voter_t *voter, const char *name)
Direct access to one registered channel, by name (e.g. "ChannelAtoB") - the name each channel was giv...
sapi_status_t sapi_voter_send(sapi_voter_t *voter, const void *data, size_t data_size)
Broadcasts data to every registered, healthy channel.
sapi_status_t sapi_voter_init(sapi_voter_storage_t *storage, const sapi_voter_config_t *config)
Initializes a voter with zero registered channels.
bool(*) sapi_voter_compare_fn(const void *a, const void *b, size_t size, void *user_ctx)
Optional custom comparison callback.
sapi_status_t sapi_voter_receive(sapi_voter_t *voter, void *data, size_t data_size, sapi_voting_result_t *result, size_t *bytes_received)
Receives from every registered, healthy channel and votes.
#define SAPI_VOTER_MAX_CHANNELS
Maximum number of channels a single voter can register.
sapi_status_t sapi_voter_get_aggregated_health(const sapi_voter_t *voter, uint32_t *healthy_count, uint32_t *total_disagreements)
Aggregated health across every registered channel.
sapi_voting_strategy_t
Voting strategy: how many registered channels must agree.
@ SAPI_VOTING_INSUFFICIENT_QUORUM
A single redundant "channel": an opaque transport handle plus send/receive callbacks,...
Common status/error codes returned by every Safe API Framework function. Shared across all OS Abstrac...
Configuration for sapi_voter_init().
sapi_voter_compare_fn compare
bool trigger_safestate_on_disagreement
sapi_voting_strategy_t voting_strategy
void(*) on_disagreement(void *context, sapi_voting_result_t result)
uint32_t channel_timeout_ms
void * disagreement_context
Storage for one voter instance (opaque to caller). No dynamic memory.