Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
sapi_voter_config_t Struct Reference

Configuration for sapi_voter_init(). More...

#include <sapi_voter.h>

Data Fields

sapi_voting_strategy_t voting_strategy
uint32_t quorum_size
uint32_t channel_timeout_ms
sapi_voter_compare_fn compare
void * compare_context
bool log_disagreements
bool trigger_safestate_on_disagreement
void(*) on_disagreement (void *context, sapi_voting_result_t result)
void * disagreement_context

Detailed Description

Configuration for sapi_voter_init().

Definition at line 78 of file sapi_voter.h.

Field Documentation

◆ voting_strategy

sapi_voting_strategy_t sapi_voter_config_t::voting_strategy

Voting strategy.

Definition at line 80 of file sapi_voter.h.

◆ quorum_size

uint32_t sapi_voter_config_t::quorum_size

Required agreeing-channel count for SAPI_VOTING_NMR (ignored for 2OO2/2OO3, which have a fixed quorum of 2).

Definition at line 83 of file sapi_voter.h.

◆ channel_timeout_ms

uint32_t sapi_voter_config_t::channel_timeout_ms

Timeout for each channel's receive operation (milliseconds).

Definition at line 85 of file sapi_voter.h.

◆ compare

sapi_voter_compare_fn sapi_voter_config_t::compare

Optional custom comparison callback; NULL -> memcmp default.

Definition at line 87 of file sapi_voter.h.

◆ compare_context

void* sapi_voter_config_t::compare_context

User context passed to compare().

Definition at line 89 of file sapi_voter.h.

◆ log_disagreements

bool sapi_voter_config_t::log_disagreements

Log a disagreement via sapi_log_write() when it occurs.

Definition at line 91 of file sapi_voter.h.

◆ trigger_safestate_on_disagreement

bool sapi_voter_config_t::trigger_safestate_on_disagreement

If true (default expected), a DISAGREED result also triggers SAPI_SAFESTATE(SAPI_SAFESTATE_LEVEL_SAFE, ...) before sapi_voter_receive() returns - matching the pre-ADR-025 sapi_channel behavior. Set false for a voter instance that is not itself on a safety-decision path and wants to handle disagreement entirely through on_disagreement below instead.

Definition at line 98 of file sapi_voter.h.

◆ on_disagreement

void(*) sapi_voter_config_t::on_disagreement(void *context, sapi_voting_result_t result)

Optional callback invoked whenever sapi_voter_receive() does not return SAPI_VOTING_AGREED (DISAGREED/TIMEOUT/INSUFFICIENT_QUORUM). Invoked after safestate (if triggered above) would already not have returned, so in practice this only fires when trigger_safestate_on_disagreement is false or the result is TIMEOUT/INSUFFICIENT_QUORUM (which never triggers safestate).

Definition at line 105 of file sapi_voter.h.

◆ disagreement_context

void* sapi_voter_config_t::disagreement_context

User context passed to on_disagreement().

Definition at line 107 of file sapi_voter.h.


The documentation for this struct was generated from the following file: