RTE RBC 2oo2 Reference Application 0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
Loading...
Searching...
No Matches
ab_gp_proc_dispatch.h File Reference

Glue between RBC_MSG_ERTMS_ENVELOPE wire frames and the real Subset-026 procedure engine (ab_gp_ertms_engine.h + the ab_gp_proc_*.c modules) - the missing piece that turns that already-built engine from ticking-but-unreachable scaffolding into something the live Train relay channel actually drives. More...

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include "../db/ab_gp_db.h"
#include "../com/ab_gp_channel.h"
#include "../train/ab_gp_train.h"
Include dependency graph for ab_gp_proc_dispatch.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

bool ab_gp_proc_dispatch_train_inbound (ab_gp_channel_handle_t channel, ab_gp_train_session_t sessions[], ab_gp_db_t *db, uint8_t train_id, const uint8_t *payload, size_t payload_len, uint32_t cycle, uint32_t timestamp_ms)
 Decodes one RBC_MSG_ERTMS_ENVELOPE payload and dispatches it into the ertms_procedures/ engine, staging any resulting reply via ab_gp_channel_stage_relay() (ADR-034: staged, not sent - only actually transmitted once this cycle's A/B checkpoint agrees, same gate every other Train-channel send goes through).

Detailed Description

Glue between RBC_MSG_ERTMS_ENVELOPE wire frames and the real Subset-026 procedure engine (ab_gp_ertms_engine.h + the ab_gp_proc_*.c modules) - the missing piece that turns that already-built engine from ticking-but-unreachable scaffolding into something the live Train relay channel actually drives.

Deliberately its own file, not folded into ab_gp_train.c: that file owns the flat ADR-029 wire scheme (P0/M136/M24_M15/M3/M146/ TRAIN_DISCONNECT) and its own file-static codec; this is a distinct, additive concern - real Subset-026 messages/packets riding a single new wrapper kind (RBC_MSG_ERTMS_ENVELOPE, rbc_wire_types.h) on the SAME already-connected (via P0) Train channel. See that kind's own doc for the wire shape (2-byte kind+train_id prefix, then the codec's own frame verbatim).

Definition in file ab_gp_proc_dispatch.h.

Function Documentation

◆ ab_gp_proc_dispatch_train_inbound()

bool ab_gp_proc_dispatch_train_inbound ( ab_gp_channel_handle_t channel,
ab_gp_train_session_t sessions[],
ab_gp_db_t * db,
uint8_t train_id,
const uint8_t * payload,
size_t payload_len,
uint32_t cycle,
uint32_t timestamp_ms )

Decodes one RBC_MSG_ERTMS_ENVELOPE payload and dispatches it into the ertms_procedures/ engine, staging any resulting reply via ab_gp_channel_stage_relay() (ADR-034: staged, not sent - only actually transmitted once this cycle's A/B checkpoint agrees, same gate every other Train-channel send goes through).

Parameters
channelHandle to stage a reply through - see ab_gp_channel_stage_relay()'s own doc.
sessionsTrain sessions array to maintain 2oo2 crosscompare and CTC indications sync.
dbTrain/route database - route lookups for Msg 132's MA-request glue, same teardown primitives RBC_MSG_TRAIN_DISCONNECT's own handler already uses for Msg 156.
train_idThis wrapper's own train_id byte (session-slot index, 1..RTE_EXAMPLE_MAX_TRAINS) - NOT the codec's own decoded nid_engine field. See RBC_MSG_ERTMS_ENVELOPE's own doc for why routing uses the wrapper's byte, not an nid_engine lookup.
payloadThe codec's own frame, starting at its nid_message byte - the wrapper's 2-byte kind+train_id prefix already stripped by the caller.
payload_lenRemaining buffer length available to the codec (the fixed physical slot size minus the 2-byte prefix) - NOT how many bytes are "real"; the codec's own l_message header field says that.
cycleCurrent AB execution cycle (passed through to the engine - REQ-CHECKPOINT determinism: never derive this from wall-clock time here).
timestamp_msCurrent cycle timestamp in milliseconds.
Returns
true if a real, known nid_message was decoded and dispatched (whether or not a reply was warranted this cycle); false on a decode failure or an unrecognized nid_message - REQ-RBC-002: rejected and logged by the caller, never silently ignored.

Definition at line 390 of file ab_gp_proc_dispatch.c.