|
RTE RBC 2oo2 Reference Application 0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
|
Open gate of the UTIL relay link (ab-relay-util, ISS-020): bounds how often the A/B cycle thread may try the link's first open while the status service (rte_gateway_c_status) is unreachable. More...
#include <stdbool.h>#include <stdint.h>#include "rte/utils/status/rte_status.h"#include "rte/utils/types/rte_types.h"Go to the source code of this file.
Data Structures | |
| struct | ab_gp_util_link_gate_t |
| Gate state; all-zero (or ab_gp_util_link_gate_init()) allows the first attempt at once. More... | |
Functions | |
| void | ab_gp_util_link_gate_init (ab_gp_util_link_gate_t *gate) |
| Resets the gate: never opened, first attempt allowed at any time. | |
| bool | ab_gp_util_link_gate_is_open (const ab_gp_util_link_gate_t *gate) |
| Whether an open attempt has succeeded (the link is open for good). | |
| bool | ab_gp_util_link_gate_may_attempt (const ab_gp_util_link_gate_t *gate, rte_timestamp_ms_t now_ms) |
| Whether a send (and with it, before the first success, an open attempt) may run now. | |
| void | ab_gp_util_link_gate_on_attempt (ab_gp_util_link_gate_t *gate, rte_timestamp_ms_t now_ms) |
| Records that an open attempt starts now (call right before the send that triggers the open). | |
| void | ab_gp_util_link_gate_on_result (ab_gp_util_link_gate_t *gate, rte_status_t status, rte_timestamp_ms_t now_ms) |
| Feeds back the result of a send that ran under the gate. | |
Open gate of the UTIL relay link (ab-relay-util, ISS-020): bounds how often the A/B cycle thread may try the link's first open while the status service (rte_gateway_c_status) is unreachable.
The UTIL link is opened lazily by Platform_RTE's flow channel service on the first send or read, and each attempt blocks the caller until the peer answers the handshake or the timeout runs out. Its traffic is non-safety (status publish, JRU/diagnostic log forwarding, ADR-001 section 4) and runs on the cycle thread, so an absent status service used to cost one blocking open per INFO log event and per cycle (freedom-from-interference defect ISS-020). This gate allows one attempt, then none until RTE_EXAMPLE_UTIL_REOPEN_BACKOFF_MS has passed since the last failure. Once an open succeeded the link stays open (the flow channel service never closes it again) and the gate always allows.
Pure: no I/O, time is passed in (rte_timer_now() at the call site). The caller owns the instance.
Definition in file ab_gp_util_link_gate.h.
| void ab_gp_util_link_gate_init | ( | ab_gp_util_link_gate_t * | gate | ) |
Resets the gate: never opened, first attempt allowed at any time.
| gate | gate to reset; ignored when NULL |
Definition at line 9 of file ab_gp_util_link_gate.c.
| bool ab_gp_util_link_gate_is_open | ( | const ab_gp_util_link_gate_t * | gate | ) |
Whether an open attempt has succeeded (the link is open for good).
| gate | gate to query |
gate is NULL Definition at line 18 of file ab_gp_util_link_gate.c.
| bool ab_gp_util_link_gate_may_attempt | ( | const ab_gp_util_link_gate_t * | gate, |
| rte_timestamp_ms_t | now_ms ) |
Whether a send (and with it, before the first success, an open attempt) may run now.
| gate | gate to query |
| now_ms | current monotonic time |
now_ms has reached the next allowed attempt time; false otherwise and when gate is NULL Definition at line 29 of file ab_gp_util_link_gate.c.
| void ab_gp_util_link_gate_on_attempt | ( | ab_gp_util_link_gate_t * | gate, |
| rte_timestamp_ms_t | now_ms ) |
Records that an open attempt starts now (call right before the send that triggers the open).
Before the first success this reserves the back-off interval at once, so a nested call during the attempt (the open itself logs INFO lines, which the JRU forwarder republishes over this same link) is refused instead of starting a second attempt. No effect once the link is open.
| gate | gate to update; ignored when NULL |
| now_ms | current monotonic time |
Definition at line 40 of file ab_gp_util_link_gate.c.
| void ab_gp_util_link_gate_on_result | ( | ab_gp_util_link_gate_t * | gate, |
| rte_status_t | status, | ||
| rte_timestamp_ms_t | now_ms ) |
Feeds back the result of a send that ran under the gate.
RTE_STATUS_OK marks the link open for good. Any other status before the first success refuses further attempts until now_ms + RTE_EXAMPLE_UTIL_REOPEN_BACKOFF_MS. A failure after the first success changes nothing (the link stays open in the channel service and a send on it does not block).
| gate | gate to update; ignored when NULL |
| status | result of the send |
| now_ms | current monotonic time (after the attempt) |
Definition at line 48 of file ab_gp_util_link_gate.c.