|
RTE RBC 2oo2 Reference Application 0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
|
Modular type definitions for AB channel components (Com, Train, DB, Redundancy). More...
#include <stdbool.h>#include <stdint.h>#include "rte/app/appmanager/rte_appmanager.h"#include "rte/redundancy/channel_service/rte_channel_service.h"#include "rte/redundancy/channel_link/rte_channel.h"#include "rte/redundancy/checksum/rte_checksum.h"#include "rte/redundancy/cross_comparator/rte_cross_comparator.h"#include "rte/redundancy/config/rte_redundancy_config.h"#include "rte/redundancy/dual/rte_dual_channel.h"#include "rte/redundancy/dual/rte_dual_negotiator.h"#include "rte/redundancy/site_role/rte_site_role.h"#include "rte/oal/memory/rte_mem_util.h"#include "rte/oal/netlink/rte_netlink.h"#include "rte/utils/status/rte_status.h"#include "rte/oal/timer/rte_timer.h"#include "rte/utils/types/rte_types.h"#include "rte/redundancy/voter/rte_voter.h"#include "rte/redundancy/watchdog/rte_watchdog.h"#include "../../common/rbc_wire_types.h"#include "../../common/site_config.h"#include "ab_gp_config.h"#include "../db/ab_gp_db.h"#include "../train/ab_gp_train.h"#include "ab_gp_saf_train.h"#include "ab_gp_util_link_gate.h"#include "ab_gp_cycle_ticks.h"#include "ab_gp_sibling_state.h"Go to the source code of this file.
Data Structures | |
| struct | ab_gp_staged_send_t |
| struct | ab_gp_com_t |
| Communication transport abstraction holding only network service channels. More... | |
| struct | ab_gp_channel_context_t |
| Central application context owned by composition root (main.c). More... | |
Macros | |
| #define | AB_SAMPLE_WIRE_SIZE (4U + ((uint32_t)RTE_EXAMPLE_MAX_TRAINS * RTE_EXAMPLE_TRAIN_SESSION_WIRE_SIZE) + 8U) |
| #define | PEER_MSG_KIND_AB_SAMPLE 1U |
| #define | PEER_MSG_KIND_CHECKPOINT_REQUEST 2U |
| #define | PEER_MSG_KIND_CHECKPOINT_REPLY 3U |
| #define | PEER_MSG_KIND_SITE_STATE 4U |
| #define | PEER_MSG_KIND_KM114_DIGEST 5U |
| #define | PEER_MSG_KIND_SAF_RB 6U |
| #define | PEER_MSG_KIND_STARTUP_TS 7U |
| #define | PEER_LINK_PAYLOAD_SIZE ((AB_SAMPLE_WIRE_SIZE > sizeof(rte_vital_message_t)) ? AB_SAMPLE_WIRE_SIZE : sizeof(rte_vital_message_t)) |
| #define | PEER_WIRE_FRAME_SIZE (1U + PEER_LINK_PAYLOAD_SIZE) |
| #define | AB_GP_DEFERRED_PEER_FRAMES 4U |
| Capacity of ab_gp_channel_context_t::deferred_peer_frames. | |
| #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, not just the peer cross-compare/vital-message traffic PEER_WIRE_FRAME_SIZE was originally sized for. ab_gp_proc_dispatch.c's own build_and_stage_reply() stages a full RBC_TRAIN_ENVELOPE_WIRE_SIZE (512-byte) RBC_MSG_ERTMS_ENVELOPE frame on the Train relay - found live: with this left at the old PEER_WIRE_FRAME_SIZE-only width, stage_entry()'s own bounds check (size > sizeof(entry->bytes)) silently rejected every ERTMS reply (RTE_STATUS_INVALID_PARAM), and build_and_stage_reply()'s callers all discard that return value with (void) - GP kept dispatching and "sending" Msg 24 replies with no visible error anywhere, but nothing ever actually reached the wire. | |
| #define | AB_GP_MAX_STAGED_SENDS_PER_CYCLE 16U |
| Stage-then-commit output queue (ADR-034) - see ab_gp_channel_stage.h. | |
Typedefs | |
| typedef void(*) | ab_gp_com_envelope_cb(void *user_ctx, rte_example_relay_kind_t kind, uint8_t index, const uint8_t *bytes) |
| typedef void(*) | ab_gp_com_peer_frame_cb(void *user_ctx, uint8_t kind, const uint8_t *payload, size_t size) |
Enumerations | |
| enum | ab_gp_stage_dest_kind_t { AB_GP_STAGE_DEST_PEER = 0 , AB_GP_STAGE_DEST_RELAY = 1 , AB_GP_STAGE_DEST_CROSSCOMPARE = 2 } |
Functions | |
| void | ab_gp_channel_sleep_ms (unsigned int ms) |
| rte_status_t | ab_gp_channel_shutdown (void *context) |
| rte_appmanager_operations_t::shutdown hook. | |
Modular type definitions for AB channel components (Com, Train, DB, Redundancy).
Conforming to CENELEC EN 50128 SIL 4 and Single Responsibility Principle (SRP).
Definition in file ab_gp_channel_types.h.
| #define AB_SAMPLE_WIRE_SIZE (4U + ((uint32_t)RTE_EXAMPLE_MAX_TRAINS * RTE_EXAMPLE_TRAIN_SESSION_WIRE_SIZE) + 8U) |
Definition at line 41 of file ab_gp_channel_types.h.
| #define PEER_MSG_KIND_AB_SAMPLE 1U |
Definition at line 44 of file ab_gp_channel_types.h.
| #define PEER_MSG_KIND_CHECKPOINT_REQUEST 2U |
Definition at line 45 of file ab_gp_channel_types.h.
| #define PEER_MSG_KIND_CHECKPOINT_REPLY 3U |
Definition at line 46 of file ab_gp_channel_types.h.
| #define PEER_MSG_KIND_SITE_STATE 4U |
Definition at line 47 of file ab_gp_channel_types.h.
| #define PEER_MSG_KIND_KM114_DIGEST 5U |
Step 3 of Platform_Protocol_KM114's consumption design (see that product's own CLAUDE.md): A and B each decode ADD_AUTHENTICATION_KEY independently, then cross-check the result over this trusted link, the same free correctness check the train-session cross-compare already gives the vital data path - see ab_gp_km114_client.c. Payload: 4-byte snum + the 24-byte plaintext KMAC (never logged, only whether the two sides agree).
Definition at line 52 of file ab_gp_channel_types.h.
| #define PEER_MSG_KIND_SAF_RB 6U |
Train-link SaF (ab_gp_saf_train.h): A sends B the responder random RB it drew for a train's AU1, so both channels derive the same session key and emit identical AU2/AR/Sa-DATA frames. Payload: train_id(1) + RA(8) + RB(8). Sent immediately, like PEER_MSG_KIND_KM114_DIGEST.
Definition at line 56 of file ab_gp_channel_types.h.
| #define PEER_MSG_KIND_STARTUP_TS 7U |
Site startup timestamp agreement (ADR-040 step 5a, ab_gp_startup_timestamp.h): at start-up each channel asks its A/B sibling for the site's startup timestamp before rte_site_role is initialised (exchange_startup_timestamp() in ab_gp_channel_negotiate.c), so both channels present one timestamp to their inter-site tie-break. Payload: is_reply(1) + timestamp_ms(8, little endian). A request (is_reply 0) carries the sender's own clock and is answered with a reply (is_reply 1) carrying the answering channel's agreed timestamp: by the exchange itself while it waits, and later (the sibling restarted) by on_peer_frame_received() and poll_for_checkpoint_frame(). Sent immediately, like PEER_MSG_KIND_SAF_RB.
Definition at line 64 of file ab_gp_channel_types.h.
| #define PEER_LINK_PAYLOAD_SIZE ((AB_SAMPLE_WIRE_SIZE > sizeof(rte_vital_message_t)) ? AB_SAMPLE_WIRE_SIZE : sizeof(rte_vital_message_t)) |
Definition at line 66 of file ab_gp_channel_types.h.
| #define PEER_WIRE_FRAME_SIZE (1U + PEER_LINK_PAYLOAD_SIZE) |
Definition at line 69 of file ab_gp_channel_types.h.
| #define AB_GP_DEFERRED_PEER_FRAMES 4U |
Capacity of ab_gp_channel_context_t::deferred_peer_frames.
Definition at line 72 of file ab_gp_channel_types.h.
| #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, not just the peer cross-compare/vital-message traffic PEER_WIRE_FRAME_SIZE was originally sized for. ab_gp_proc_dispatch.c's own build_and_stage_reply() stages a full RBC_TRAIN_ENVELOPE_WIRE_SIZE (512-byte) RBC_MSG_ERTMS_ENVELOPE frame on the Train relay - found live: with this left at the old PEER_WIRE_FRAME_SIZE-only width, stage_entry()'s own bounds check (size > sizeof(entry->bytes)) silently rejected every ERTMS reply (RTE_STATUS_INVALID_PARAM), and build_and_stage_reply()'s callers all discard that return value with (void) - GP kept dispatching and "sending" Msg 24 replies with no visible error anywhere, but nothing ever actually reached the wire.
Definition at line 87 of file ab_gp_channel_types.h.
| #define AB_GP_MAX_STAGED_SENDS_PER_CYCLE 16U |
Stage-then-commit output queue (ADR-034) - see ab_gp_channel_stage.h.
Only this cycle's own DECISION output (the peer AB_SAMPLE and the train/CTC/IL relay messages built from this cycle's own ma_logic result) is staged here, gated on the checkpoint confirming both channels took the same program path this cycle. Protocol/liveness traffic that must keep flowing regardless (the CHECKPOINT_REPLY reply to the peer's own request, IL keepalives, the SITE_STATE echo) is deliberately NOT staged - it still goes out immediately via ab_gp_channel_send_peer()/_send_relay(), unchanged - see those two decision-output call sites' own comments in post_execute.c for which category each one is.
Sized generously above one cycle's realistic maximum (1 AB_SAMPLE + up to AB_GP_TRAIN_MAX_PENDING_OUTPUTS train + a handful of CTC/IL outputs
Definition at line 112 of file ab_gp_channel_types.h.
| typedef void(*) ab_gp_com_envelope_cb(void *user_ctx, rte_example_relay_kind_t kind, uint8_t index, const uint8_t *bytes) |
Callbacks for non-blocking packet delivery. index is retained for source-compat but is always 0 since ADR-036 (one link per kind).
Definition at line 148 of file ab_gp_channel_types.h.
| typedef void(*) ab_gp_com_peer_frame_cb(void *user_ctx, uint8_t kind, const uint8_t *payload, size_t size) |
Definition at line 149 of file ab_gp_channel_types.h.
| Enumerator | |
|---|---|
| AB_GP_STAGE_DEST_PEER | |
| AB_GP_STAGE_DEST_RELAY | |
| AB_GP_STAGE_DEST_CROSSCOMPARE | |
Definition at line 114 of file ab_gp_channel_types.h.
| void ab_gp_channel_sleep_ms | ( | unsigned int | ms | ) |
Local makros Local types declarations Local variables declarations Global variables declarations Local function declarations Global functions
Definition at line 29 of file ab_gp_channel_util.c.
| rte_status_t ab_gp_channel_shutdown | ( | void * | context | ) |
rte_appmanager_operations_t::shutdown hook.
Definition at line 1343 of file ab_gp_channel.c.