|
RTE RBC 2oo2 Reference Application 0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
|
West/East site identity and the per-site config derived from it (ports, container host lookup) - see common_config.h for the raw port bases/offsets this module turns into concrete per-site values. More...
#include <stdbool.h>#include <stdint.h>Go to the source code of this file.
Macros | |
| #define | RTE_EXAMPLE_RELAY_KIND_COUNT 4 |
Enumerations | |
| enum | rte_example_site_t { RTE_EXAMPLE_SITE_WEST = 0 , RTE_EXAMPLE_SITE_EAST = 1 } |
| enum | rte_example_relay_kind_t { RTE_EXAMPLE_RELAY_KIND_TRAIN = 0 , RTE_EXAMPLE_RELAY_KIND_IL = 1 , RTE_EXAMPLE_RELAY_KIND_CTC = 2 , RTE_EXAMPLE_RELAY_KIND_UTIL = 3 } |
| Which client type a C<->A/C<->B relay link/port belongs to - this project's own dedicated-channel-per-client-type design: each client type gets its own real, separate TCP connection (C never multiplexes Train/IL/CTC-originated traffic onto one link to A and one to B), so AB's own train/il/ctc modules (AB/train/, AB/GA/il/, AB/GA/ctc/) can each own their own link and never need to inspect an envelope's own kind just to know which module it belongs to (the LINK it arrived on already answers that). Shared between monitor_c.c (C's own relay-link array index) and ab_gp_channel_io.c (A/B's own connect target) - see each file's own doc for how it uses this. More... | |
Functions | |
| bool | site_config_parse (const char *arg, rte_example_site_t *out_site) |
| Parses a site name argument ("WEST"/"EAST", case-insensitive). | |
| const char * | site_config_name (rte_example_site_t site) |
| uint16_t | site_config_ab_port (rte_example_site_t site) |
| uint16_t | site_config_ab_crosscompare_port (rte_example_site_t site) |
| uint16_t | site_config_c_port_for_a (rte_example_site_t site, rte_example_relay_kind_t kind) |
C's listen port for A's dedicated kind relay link, for this site (rte_example_relay_kind_t's own doc) - ONE real TCP link per {kind}, so routing between C and A/B is purely structural (which channel a byte arrived on), never by inspecting message content. ADR-036: Train and IL are no longer per-instance - every train's traffic multiplexes onto the one link and A/B route by the envelope's own train_id. | |
| uint16_t | site_config_c_port_for_b (rte_example_site_t site, rte_example_relay_kind_t kind) |
| uint16_t | site_config_c_port_for_train (rte_example_site_t site) |
| C's single listen port for the Train sim, for this site (ADR-036: one multiplexed connection carries every train, demuxed by the envelope's train_id). | |
| uint16_t | site_config_c_port_for_il (rte_example_site_t site) |
| uint16_t | site_config_c_port_for_ctc (rte_example_site_t site) |
| uint16_t | site_config_c_port_for_broker (rte_example_site_t site, rte_example_relay_kind_t gw_kind) |
| ADR-038: the status/broker service's LISTEN port for one local gateway service to CONNECT and publish status on. | |
| const char * | site_config_host (const char *env_var_name) |
| Resolves a CONNECT-role link's target host for this process. | |
West/East site identity and the per-site config derived from it (ports, container host lookup) - see common_config.h for the raw port bases/offsets this module turns into concrete per-site values.
Hot standby (per project decision): both West and East always run their own full A/B/C group regardless of negotiated role; only C's reported output differs (ACTIVE vs SUPPRESSED) based on the site's own live role, negotiated directly between A and B - see AB/main/ab_gp_channel.h.
Definition in file site_config.h.
| #define RTE_EXAMPLE_RELAY_KIND_COUNT 4 |
Definition at line 50 of file site_config.h.
| enum rte_example_site_t |
| Enumerator | |
|---|---|
| RTE_EXAMPLE_SITE_WEST | |
| RTE_EXAMPLE_SITE_EAST | |
Definition at line 19 of file site_config.h.
Which client type a C<->A/C<->B relay link/port belongs to - this project's own dedicated-channel-per-client-type design: each client type gets its own real, separate TCP connection (C never multiplexes Train/IL/CTC-originated traffic onto one link to A and one to B), so AB's own train/il/ctc modules (AB/train/, AB/GA/il/, AB/GA/ctc/) can each own their own link and never need to inspect an envelope's own kind just to know which module it belongs to (the LINK it arrived on already answers that). Shared between monitor_c.c (C's own relay-link array index) and ab_gp_channel_io.c (A/B's own connect target) - see each file's own doc for how it uses this.
| Enumerator | |
|---|---|
| RTE_EXAMPLE_RELAY_KIND_TRAIN | |
| RTE_EXAMPLE_RELAY_KIND_IL | |
| RTE_EXAMPLE_RELAY_KIND_CTC | |
| RTE_EXAMPLE_RELAY_KIND_UTIL | |
Definition at line 38 of file site_config.h.
| bool site_config_parse | ( | const char * | arg, |
| rte_example_site_t * | out_site ) |
Parses a site name argument ("WEST"/"EAST", case-insensitive).
| arg | Null-terminated argument string. Must not be NULL. |
| out_site | Receives the parsed site. Must not be NULL. |
Global functions
Definition at line 33 of file site_config.c.
| const char * site_config_name | ( | rte_example_site_t | site | ) |
Definition at line 52 of file site_config.c.
| uint16_t site_config_ab_port | ( | rte_example_site_t | site | ) |
Definition at line 57 of file site_config.c.
| uint16_t site_config_ab_crosscompare_port | ( | rte_example_site_t | site | ) |
Definition at line 62 of file site_config.c.
| uint16_t site_config_c_port_for_a | ( | rte_example_site_t | site, |
| rte_example_relay_kind_t | kind ) |
C's listen port for A's dedicated kind relay link, for this site (rte_example_relay_kind_t's own doc) - ONE real TCP link per {kind}, so routing between C and A/B is purely structural (which channel a byte arrived on), never by inspecting message content. ADR-036: Train and IL are no longer per-instance - every train's traffic multiplexes onto the one link and A/B route by the envelope's own train_id.
Definition at line 67 of file site_config.c.
| uint16_t site_config_c_port_for_b | ( | rte_example_site_t | site, |
| rte_example_relay_kind_t | kind ) |
kind relay link, for this site - same contract as site_config_c_port_for_a(). Definition at line 76 of file site_config.c.
| uint16_t site_config_c_port_for_train | ( | rte_example_site_t | site | ) |
C's single listen port for the Train sim, for this site (ADR-036: one multiplexed connection carries every train, demuxed by the envelope's train_id).
| site | WEST or EAST. |
Definition at line 85 of file site_config.c.
| uint16_t site_config_c_port_for_il | ( | rte_example_site_t | site | ) |
Definition at line 90 of file site_config.c.
| uint16_t site_config_c_port_for_ctc | ( | rte_example_site_t | site | ) |
Definition at line 95 of file site_config.c.
| uint16_t site_config_c_port_for_broker | ( | rte_example_site_t | site, |
| rte_example_relay_kind_t | gw_kind ) |
ADR-038: the status/broker service's LISTEN port for one local gateway service to CONNECT and publish status on.
| gw_kind | RELAY_KIND_TRAIN / _IL / _CTC. Any other value -> the TRAIN broker port. |
Definition at line 100 of file site_config.c.
| const char * site_config_host | ( | const char * | env_var_name | ) |
Resolves a CONNECT-role link's target host for this process.
Every CONNECT-role endpoint in this example (B's own peer link to A, C-forwarding links, and each channel's own EAST->WEST inter-site negotiation link) used to hardcode RTE_EXAMPLE_LOCALHOST - fine when every role ran as a plain OS process on one host, not once A, B, and C become genuinely separate containers/machines. Each of this example's env vars (RTE_EXAMPLE_C_HOST_ENV etc. - see common_config.h) overrides ONE specific link's target host; unset (the default for etc/run_all.sh/.claude/skills/run-safeAPIRBC2oo2/ smoke.sh, both still fully localhost-based) falls back to RTE_EXAMPLE_LOCALHOST, so the existing local/manual launch path needs zero changes. Docker Compose sets these per-service to the peer container's own service-DNS name (see docker-compose.yml).
| env_var_name | Name of the environment variable to consult (one of the RTE_EXAMPLE_*_HOST_ENV constants). Must not be NULL. |
Definition at line 120 of file site_config.c.