146#include "rte/app/appmanager/rte_appmanager.h"
147#include "rte/oal/log/rte_log.h"
148#include "rte/oal/memory/rte_mem_util.h"
149#include "rte/posix_osadapter/rte_posix_osadapter.h"
158#include "rte/core/rte_core_version.h"
159#include "rte_rbc2oo2_version.h"
195 rte_appmanager_config_t config;
196 const char *framework_actual_version;
206 framework_actual_version = rte_core_get_version();
207 (void)fprintf(stdout,
"%s version %s (framework %s, expected %s)\n", argv[0], RTE_RBC2OO2_VERSION,
208 framework_actual_version, RTE_FRAMEWORK_EXPECTED_VERSION);
209 if (strcmp(framework_actual_version, RTE_FRAMEWORK_EXPECTED_VERSION) != 0)
211 (void)fprintf(stderr,
212 "WARNING: linked safeAPIFreamwork version (%s) does not match what this binary was "
213 "built against (%s) - a stale library archive or wrong framework dist/ may be linked in\n",
214 framework_actual_version, RTE_FRAMEWORK_EXPECTED_VERSION);
219 (void)fprintf(stderr,
"usage: %s {A|B} {WEST|EAST}\n", argv[0]);
224 (void)fprintf(stderr,
"unknown site '%s' - expected WEST or EAST\n", argv[2]);
227 if (strcmp(argv[1],
"A") == 0)
231 else if (strcmp(argv[1],
"B") == 0)
237 (void)fprintf(stderr,
"unknown role '%s' - expected A or B\n", argv[1]);
242 if (status != RTE_STATUS_OK)
260 if (status != RTE_STATUS_OK)
265 (void)snprintf(msg,
sizeof(msg),
"channel open failed: %s", rte_status_to_string(status));
266 rte_log_write(RTE_LOG_LEVEL_ERROR,
"MAIN", msg);
276 if (status != RTE_STATUS_OK)
282 if (status != RTE_STATUS_OK)
290 if (status != RTE_STATUS_OK)
296 if (status != RTE_STATUS_OK)
306 if (status != RTE_STATUS_OK)
312 if (status != RTE_STATUS_OK)
318 return rte_appmanager_run(&config);
334 (void)snprintf(msg,
sizeof(msg),
"%s failed: %s", step, rte_status_to_string(status));
335 rte_log_write(RTE_LOG_LEVEL_ERROR,
"MAIN", msg);
358 static const rte_appmanager_operations_t ops = {
368 rte_appmanager_config_t config;
370 rte_mem_set(&config, 0,
sizeof(config));
372 config.context = (
void *)handle;
373 config.max_iterations = 0U;
374 config.error_threshold = 0U;
393 return "safeAPIRBC2oo2-AB";
rte_status_t ab_gp_channel_saf_train_setup(ab_gp_channel_handle_t handle)
Reads RTE_SAFECOMM_TRAIN_RBC_ID and sets up the train-link SaF termination: unset leaves it off (plai...
rte_status_t ab_gp_channel_open_link(bool is_role_a, rte_example_site_t site, ab_gp_channel_handle_t *out_handle)
Opens this process's own A<->B peer channel and C relay channels.
void ab_gp_channel_relay_queues_setup(ab_gp_channel_handle_t handle)
Initializes relay queues (no-op in single-threaded channel_service).
rte_status_t ab_gp_channel_cycle_timer_setup(ab_gp_channel_handle_t handle)
Creates and starts periodic cycle timer.
void ab_gp_channel_close_link(ab_gp_channel_handle_t handle)
Full teardown of a channel opened by ab_gp_channel_open_link().
rte_status_t ab_gp_channel_ga_setup(ab_gp_channel_handle_t handle)
GA registration for ma_logic_adaptation / il / ctc.
rte_status_t ab_gp_channel_negotiate_setup(ab_gp_channel_handle_t handle)
Opens inter-site negotiation link and runs startup tie-break.
const rte_appmanager_checkpoint_config_t * ab_gp_channel_checkpoint_config(ab_gp_channel_handle_t handle)
Accessor for checkpoint config.
rte_status_t ab_gp_channel_shutdown(void *context)
rte_appmanager_operations_t::shutdown hook.
rte_status_t ab_gp_channel_crosscompare_setup(ab_gp_channel_handle_t handle)
Creates cross-comparator on an already-open channel.
rte_status_t ab_gp_channel_dual_setup(ab_gp_channel_handle_t handle)
Wires dual-transfer liveness watchdog.
rte_status_t ab_gp_channel_init(void *context)
rte_appmanager_operations_t::init hook.
rte_status_t ab_gp_channel_checkpoint_setup(ab_gp_channel_handle_t handle)
Wires AppManager checkpoint mechanism onto peer channel.
rte_status_t ab_gp_channel_train_codec_setup(ab_gp_channel_handle_t handle)
GP-internal registration for train codec.
rte_status_t ab_gp_channel_watchdog_setup(ab_gp_channel_handle_t handle)
Arms general health watchdog.
struct ab_gp_channel_context_s * ab_gp_channel_handle_t
Opaque handle over this component's own static per-process context.
Shared declarations for the four rte_appmanager_operations_t cyclic-executive hooks this component's ...
rte_status_t ab_gp_channel_pre_execute(void *context)
rte_status_t ab_gp_channel_execute(void *context)
rte_status_t ab_gp_channel_post_execute(void *context)
rte_status_t ab_gp_channel_on_checkpoint_result(void *context, bool committed)
rte_appmanager_operations_t::on_checkpoint_result for the AB channel (ADR-034) - flushes or discards ...
rte_status_t ab_gp_jru_forward_install(const rte_osadapter_log_t *delegate)
Wraps delegate (the real local log OSAdapter, e.g. rte_posix_osadapter_log()) and registers the wrapp...
void ab_gp_jru_forward_set_channel(ab_gp_channel_handle_t handle, uint8_t source_id)
Attaches the open AB<->C relay channel: from this call on, write() also republishes INFO+ events to G...
A/B -> Gateway log-event forwarding (Platform_Protocol_JRU/CLAUDE.md's "Wiring" section)....
rte_status_t app_main_common_init(int argc, char **argv)
Runs this process's one-time runtime setup, common to every role: unbuffered stdout,...
Process-wide runtime setup shared by every one of this example's binaries (main.c for A/B,...
static const char * ab_gp_channel_get_name(void)
static int fatal_setup_step_failed(const char *step, rte_status_t status, ab_gp_channel_handle_t handle)
static rte_appmanager_config_t ab_gp_channel_make_config(ab_gp_channel_handle_t handle)
Builds the rte_appmanager_config_t for running an already-opened, already-wired channel (ab_gp_channe...
static const char * ab_gp_channel_get_version(void)
int rte_gp_run(int argc, char **argv)
ADR-038: the wire frame for the A/B<->C util side channel (RTE_EXAMPLE_RELAY_KIND_UTIL) and the C-sid...
The one function librte_gp (this project's own shared library, see CMakeLists.txt's own doc on why rt...
bool site_config_parse(const char *arg, rte_example_site_t *out_site)
Parses a site name argument ("WEST"/"EAST", case-insensitive).
West/East site identity and the per-site config derived from it (ports, container host lookup) - see ...