|
Safe API Framework 0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
|
Multi-Site 2oo2 Redundancy with Active/Standby Failover. More...
#include <stdint.h>#include <stdbool.h>Go to the source code of this file.
Data Structures | |
| struct | train_command_t |
| struct | site_channels_t |
| struct | site_stats_t |
| struct | site_context_t |
| struct | multi_site_config_t |
| struct | multi_site_voter_t |
Enumerations | |
| enum | site_id_t { SITE_WEST = 0 , SITE_EAST = 1 } |
| enum | site_state_t { SITE_STATE_ONLINE = 0 , SITE_STATE_STANDBY = 1 , SITE_STATE_ISOLATED = 2 , SITE_STATE_FAULTY = 3 } |
Functions | |
| int | multi_site_voter_init (multi_site_voter_t *voter, const multi_site_config_t *config) |
| Initialize multi-site voter with West online, East standby. | |
| int | multi_site_vote_cycle (multi_site_voter_t *voter, site_id_t site, const train_command_t *cmd_a, const train_command_t *cmd_b) |
| Process voting cycle on one site. | |
| site_id_t | multi_site_heartbeat (multi_site_voter_t *voter) |
| Check heartbeat between sites and trigger failover if needed. | |
| int | multi_site_failover_request (multi_site_voter_t *voter, site_id_t new_active) |
| Trigger manual failover (for maintenance). | |
| int | multi_site_get_active_command (multi_site_voter_t *voter, train_command_t *cmd_out) |
| Get voted command from currently active site. | |
| int | multi_site_get_service_output (multi_site_voter_t *voter, char *output_buf, uint32_t buf_size) |
| Get service output from active site (for printf, logging). | |
| void | multi_site_print_stats (const multi_site_voter_t *voter) |
| Print multi-site statistics for diagnostics. | |
| int | multi_site_voter_shutdown (multi_site_voter_t *voter) |
| Shutdown multi-site voter. | |
Multi-Site 2oo2 Redundancy with Active/Standby Failover.
Implements geographic redundancy for railway control systems:
Typical deployment: ERTMS RBC with dual control centers
Definition in file redundancy_multi_site.h.
| enum site_id_t |
Definition at line 32 of file redundancy_multi_site.h.
| enum site_state_t |
Definition at line 37 of file redundancy_multi_site.h.
| int multi_site_voter_init | ( | multi_site_voter_t * | voter, |
| const multi_site_config_t * | config ) |
Initialize multi-site voter with West online, East standby.
| voter | Multi-site voter state |
| config | Configuration |
Definition at line 138 of file redundancy_multi_site.c.
| int multi_site_vote_cycle | ( | multi_site_voter_t * | voter, |
| site_id_t | site, | ||
| const train_command_t * | cmd_a, | ||
| const train_command_t * | cmd_b ) |
Process voting cycle on one site.
Each site independently:
| voter | Multi-site state |
| site | Which site (WEST or EAST) |
| cmd_a | Channel A command |
| cmd_b | Channel B command |
Definition at line 173 of file redundancy_multi_site.c.
| site_id_t multi_site_heartbeat | ( | multi_site_voter_t * | voter | ) |
Check heartbeat between sites and trigger failover if needed.
Called periodically to:
| voter | Multi-site state |
Definition at line 195 of file redundancy_multi_site.c.
| int multi_site_failover_request | ( | multi_site_voter_t * | voter, |
| site_id_t | new_active ) |
Trigger manual failover (for maintenance).
| voter | Multi-site state |
| new_active | New active site |
Allows graceful switchover without waiting for timeout. Example: "Switch to East for maintenance on West"
Definition at line 254 of file redundancy_multi_site.c.
| int multi_site_get_active_command | ( | multi_site_voter_t * | voter, |
| train_command_t * | cmd_out ) |
Get voted command from currently active site.
| voter | Multi-site state |
| cmd_out | Receives voted command |
Definition at line 285 of file redundancy_multi_site.c.
| int multi_site_get_service_output | ( | multi_site_voter_t * | voter, |
| char * | output_buf, | ||
| uint32_t | buf_size ) |
Get service output from active site (for printf, logging).
| voter | Multi-site state |
| output_buf | Buffer to receive output |
| buf_size | Size of buffer |
Definition at line 303 of file redundancy_multi_site.c.
| void multi_site_print_stats | ( | const multi_site_voter_t * | voter | ) |
Print multi-site statistics for diagnostics.
| voter | Multi-site state |
Definition at line 324 of file redundancy_multi_site.c.
| int multi_site_voter_shutdown | ( | multi_site_voter_t * | voter | ) |
Shutdown multi-site voter.
| voter | Multi-site state |
Definition at line 364 of file redundancy_multi_site.c.