RTE RBC 2oo2 Reference Application
0.1.0 build 0006685
SIL 4 2oo2 Dual-Site Fault-Tolerant ERTMS Radio Block Centre Reference Architecture
Toggle main menu visibility
Loading...
Searching...
No Matches
ab_gp_util_link_gate.h
Go to the documentation of this file.
1
15
#ifndef AB_GP_UTIL_LINK_GATE_H
16
#define AB_GP_UTIL_LINK_GATE_H
17
18
#include <stdbool.h>
19
#include <stdint.h>
20
21
#include "rte/utils/status/rte_status.h"
22
#include "rte/utils/types/rte_types.h"
23
25
typedef
struct
26
{
27
bool
ever_opened
;
28
rte_timestamp_ms_t
next_attempt_ms
;
29
}
ab_gp_util_link_gate_t
;
30
35
void
ab_gp_util_link_gate_init
(
ab_gp_util_link_gate_t
*gate);
36
42
bool
ab_gp_util_link_gate_is_open
(
const
ab_gp_util_link_gate_t
*gate);
43
51
bool
ab_gp_util_link_gate_may_attempt
(
const
ab_gp_util_link_gate_t
*gate, rte_timestamp_ms_t now_ms);
52
62
void
ab_gp_util_link_gate_on_attempt
(
ab_gp_util_link_gate_t
*gate, rte_timestamp_ms_t now_ms);
63
74
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);
75
76
#endif
/* AB_GP_UTIL_LINK_GATE_H */
ab_gp_util_link_gate_is_open
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).
Definition
ab_gp_util_link_gate.c:18
ab_gp_util_link_gate_on_attempt
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).
Definition
ab_gp_util_link_gate.c:40
ab_gp_util_link_gate_on_result
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.
Definition
ab_gp_util_link_gate.c:48
ab_gp_util_link_gate_init
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.
Definition
ab_gp_util_link_gate.c:9
ab_gp_util_link_gate_may_attempt
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.
Definition
ab_gp_util_link_gate.c:29
ab_gp_util_link_gate_t
Gate state; all-zero (or ab_gp_util_link_gate_init()) allows the first attempt at once.
Definition
ab_gp_util_link_gate.h:26
ab_gp_util_link_gate_t::next_attempt_ms
rte_timestamp_ms_t next_attempt_ms
Definition
ab_gp_util_link_gate.h:28
ab_gp_util_link_gate_t::ever_opened
bool ever_opened
Definition
ab_gp_util_link_gate.h:27
src
application
AB
GP
com
ab_gp_util_link_gate.h
Generated by
1.18.0