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_election.h
Go to the documentation of this file.
1
48#ifndef RTE_ELECTION_H
49#define RTE_ELECTION_H
50
51#include <stdbool.h>
52#include <stdint.h>
53
57
58#ifdef __cplusplus
59extern "C" {
60#endif
61
68typedef struct
69{
73 uint32_t id;
82
87typedef struct rte_election_s
88{
89 uint32_t own_id;
90 rte_dual_state_t own_last_state;
91
92 uint32_t winner_id;
93 bool have_winner;
95
97typedef struct
98{
104 uint32_t own_id;
106
115
132 uint32_t candidate_count);
133
142
151rte_status_t rte_election_get_winner_id(const rte_election_t *election, uint32_t *out_id);
152
153#ifdef __cplusplus
154}
155#endif
156
157#endif /* RTE_ELECTION_H */
158
rte_dual_state_t
State of one instance in a dual (two-redundant-instance) relationship, as decided by rte_dual_negotia...
rte_dual_state_t rte_election_get_own_state(const rte_election_t *election)
Returns this instance's own current rte_dual_state_t, as of the last rte_election_execute() call.
rte_status_t rte_election_init(rte_election_t *election, const rte_election_config_t *config)
Initializes a rte_election_t. own_last_state starts at RTE_DUAL_STATE_IDLE (never yet evaluated).
rte_status_t rte_election_get_winner_id(const rte_election_t *election, uint32_t *out_id)
Returns the last-elected winner's id.
rte_status_t rte_election_execute(rte_election_t *election, const rte_election_candidate_t *candidates, uint32_t candidate_count)
Evaluates one round of election against the caller-supplied candidate snapshot (REQ-ELECTION-002 thro...
rte_status_t
Common result/status codes.
Definition rte_status.h:27
Shared enums for the rte_dual module (ADR-020): dual-instance state negotiation and the redundant,...
Application-level redundancy topology configuration (2oo2 / 2oo2 with redundancy / 2oo3 / NMR),...
Common status/error codes returned by every Safe API Framework function. Shared across all OS Abstrac...
One candidate's info for one rte_election_execute() call. The caller builds this array fresh each cal...
Configuration for rte_election_init().
One rte_election_t instance's state. Caller-owned storage; every field is private - reach it only thr...