1#ifndef RTE_EXAMPLE_AB_GP_CHANNEL_TYPES_H
2#define RTE_EXAMPLE_AB_GP_CHANNEL_TYPES_H
14#include "rte/app/appmanager/rte_appmanager.h"
15#include "rte/redundancy/channel_service/rte_channel_service.h"
16#include "rte/redundancy/channel_link/rte_channel.h"
17#include "rte/redundancy/checksum/rte_checksum.h"
18#include "rte/redundancy/cross_comparator/rte_cross_comparator.h"
19#include "rte/redundancy/config/rte_redundancy_config.h"
20#include "rte/redundancy/dual/rte_dual_channel.h"
21#include "rte/redundancy/dual/rte_dual_negotiator.h"
22#include "rte/redundancy/site_role/rte_site_role.h"
23#include "rte/oal/memory/rte_mem_util.h"
24#include "rte/oal/netlink/rte_netlink.h"
25#include "rte/utils/status/rte_status.h"
26#include "rte/oal/timer/rte_timer.h"
27#include "rte/utils/types/rte_types.h"
28#include "rte/redundancy/voter/rte_voter.h"
29#include "rte/redundancy/watchdog/rte_watchdog.h"
41#define AB_SAMPLE_WIRE_SIZE \
42 (4U + ((uint32_t)RTE_EXAMPLE_MAX_TRAINS * RTE_EXAMPLE_TRAIN_SESSION_WIRE_SIZE) + 8U)
44#define PEER_MSG_KIND_AB_SAMPLE 1U
45#define PEER_MSG_KIND_CHECKPOINT_REQUEST 2U
46#define PEER_MSG_KIND_CHECKPOINT_REPLY 3U
47#define PEER_MSG_KIND_SITE_STATE 4U
52#define PEER_MSG_KIND_KM114_DIGEST 5U
56#define PEER_MSG_KIND_SAF_RB 6U
64#define PEER_MSG_KIND_STARTUP_TS 7U
66#define PEER_LINK_PAYLOAD_SIZE \
67 ((AB_SAMPLE_WIRE_SIZE > sizeof(rte_vital_message_t)) ? AB_SAMPLE_WIRE_SIZE : sizeof(rte_vital_message_t))
69#define PEER_WIRE_FRAME_SIZE (1U + PEER_LINK_PAYLOAD_SIZE)
72#define AB_GP_DEFERRED_PEER_FRAMES 4U
87#define AB_GP_STAGED_SEND_BYTES_SIZE \
88 ((PEER_WIRE_FRAME_SIZE > (uint32_t)RBC_TRAIN_ENVELOPE_WIRE_SIZE) ? PEER_WIRE_FRAME_SIZE \
89 : (uint32_t)RBC_TRAIN_ENVELOPE_WIRE_SIZE)
112#define AB_GP_MAX_STAGED_SENDS_PER_CYCLE 16U
133typedef struct ab_gp_com_s
154typedef struct ab_gp_channel_context_s
rte_status_t ab_gp_channel_shutdown(void *context)
rte_appmanager_operations_t::shutdown hook.
#define PEER_WIRE_FRAME_SIZE
#define AB_GP_STAGED_SEND_BYTES_SIZE
The staged-send queue's own per-entry buffer width - must fit the WIDEST frame ANY caller ever stages...
#define AB_GP_MAX_STAGED_SENDS_PER_CYCLE
Stage-then-commit output queue (ADR-034) - see ab_gp_channel_stage.h.
@ AB_GP_STAGE_DEST_CROSSCOMPARE
#define AB_GP_DEFERRED_PEER_FRAMES
Capacity of ab_gp_channel_context_t::deferred_peer_frames.
void(*) ab_gp_com_peer_frame_cb(void *user_ctx, uint8_t kind, const uint8_t *payload, size_t size)
void ab_gp_channel_sleep_ms(unsigned int ms)
void(*) ab_gp_com_envelope_cb(void *user_ctx, rte_example_relay_kind_t kind, uint8_t index, const uint8_t *bytes)
Zero-dependency, statically-allocated configuration parser for Role A/B.
A/B cycle tick count shared by the cycle timer callback and the cycle thread (ISS-051).
A/B's own simplified Train/Route database - fixed-size arrays describing the domain objects logic/ (p...
Train link safe communication (Subset-037 SaF) terminated inside A and B - REQ-SC-001,...
The A/B sibling's last site-state frame (PEER_MSG_KIND_SITE_STATE), kept raw and handed to Platform_R...
A/B's own train lifecycle handling against db/'s runtime table.
Open gate of the UTIL relay link (ab-relay-util, ISS-020): bounds how often the A/B cycle thread may ...
#define RTE_EXAMPLE_SITE_EXTRA_PAYLOAD_SIZE
#define RTE_EXAMPLE_MAX_TRAINS
The RBC Train/IL/CTC scenario's shared wire envelope (ADR-029) - one fixed-size struct/frame reused f...
West/East site identity and the per-site config derived from it (ports, container host lookup) - see ...
#define RTE_EXAMPLE_RELAY_KIND_COUNT
rte_example_relay_kind_t
Which client type a C<->A/C<->B relay link/port belongs to - this project's own dedicated-channel-per...
Central application context owned by composition root (main.c).
rte_site_role_t site_role
uint8_t deferred_peer_frames[AB_GP_DEFERRED_PEER_FRAMES][PEER_WIRE_FRAME_SIZE]
ab_gp_sibling_state_t peer_site_state
uint32_t last_accepted_peer_cycle
rte_appmanager_checkpoint_config_t checkpoint_cfg
uint32_t last_peer_checkpoint_cycle
uint8_t last_sent_checkpoint_arrival[sizeof(rte_vital_message_t)]
ab_gp_train_session_t sessions[RTE_EXAMPLE_MAX_TRAINS]
bool cyc_position_reply_due[RTE_EXAMPLE_MAX_TRAINS]
rte_timestamp_ms_t sibling_startup_timestamp_ms
ab_gp_cycle_ticks_t cycle_ticks
uint8_t adopt_pending[RTE_EXAMPLE_MAX_TRAINS]
bool has_cached_checkpoint_request
uint32_t staged_send_count
rte_channel_t checkpoint_vc
uint32_t cyc_msg_type_due[RTE_EXAMPLE_MAX_TRAINS]
uint32_t join_window_cycles_left
rte_timestamp_ms_t startup_timestamp_ms
uint8_t site_role_rx[RTE_EXAMPLE_SITE_EXTRA_PAYLOAD_SIZE]
rte_redundancy_config_t redundancy
rte_cross_comparator_t xcompare_cmp
uint32_t last_relay_rx_cycle
uint32_t xcompare_skew_skips
ab_gp_train_session_t cyc_peer_sessions[RTE_EXAMPLE_MAX_TRAINS]
char checkpoint_channel_name_buf[16]
bool have_sibling_startup_timestamp
void * checkpoint_channel_handle
rte_timestamp_ms_t checkpoint_relaxed_until_ms
bool has_last_sent_checkpoint_arrival
bool cyc_have_channel_data
uint8_t cached_checkpoint_reply[sizeof(rte_vital_message_t)]
ab_gp_saf_train_t saf_train
uint8_t xcompare_skip_count[RTE_EXAMPLE_MAX_TRAINS]
rte_timer_handle_t cycle_timer_handle
uint8_t deferred_peer_count
uint8_t cached_checkpoint_request[sizeof(rte_vital_message_t)]
bool has_cached_checkpoint_reply
rte_timestamp_ms_t last_cycle_wall_ms
char site_role_peer_tag[16]
uint32_t last_peer_sample_cycle
uint8_t site_role_tx[RTE_EXAMPLE_SITE_EXTRA_PAYLOAD_SIZE]
rte_voter_t checkpoint_voter
ab_gp_staged_send_t staged_sends[AB_GP_MAX_STAGED_SENDS_PER_CYCLE]
rte_timer_storage_t cycle_timer_storage
Communication transport abstraction holding only network service channels.
ab_gp_util_link_gate_t util_gate
rte_channel_service_t relay_channel[RTE_EXAMPLE_RELAY_KIND_COUNT]
rte_channel_service_t peer_channel
rte_channel_service_t crosscompare_channel
Tick count and the mutex that guards it. Not volatile: every access to count holds the mutex.
One channel's train-link SaF termination.
ab_gp_stage_dest_kind_t dest_kind
uint8_t bytes[AB_GP_STAGED_SEND_BYTES_SIZE]
rte_example_relay_kind_t relay_kind
Gate state; all-zero (or ab_gp_util_link_gate_init()) allows the first attempt at once.