Safe API Framework 0.1.0 build 384e6ae
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
rte_cross_comparator.c File Reference

Pairwise channel comparison (ADR-025): validates parameters, receives from both registered channels, and compares them. More...

Include dependency graph for rte_cross_comparator.c:

Go to the source code of this file.

Functions

static bool cross_comparator_data_equal (const rte_cross_comparator_t *cmp, const void *a, const void *b, size_t size)
rte_status_t rte_cross_comparator_init (rte_cross_comparator_storage_t *storage, const rte_cross_comparator_config_t *config)
 Initializes a cross-comparator with zero registered channels.
rte_status_t rte_cross_comparator_register_channel (rte_cross_comparator_t *cmp, rte_channel_t *channel)
 Registers one already-initialized channel (channel A, then B).
static rte_status_t cross_comparator_finish (rte_cross_comparator_t *cmp, rte_voting_result_t local_result, const void *agreed_data, size_t data_size, rte_voting_result_t *result, void *out_data, size_t *out_size)
rte_status_t rte_cross_comparator_execute (rte_cross_comparator_t *cmp, size_t data_size, rte_voting_result_t *result, void *out_data, size_t *out_size)
 Receives from both registered channels and compares them.
rte_status_t rte_cross_comparator_execute_buffers (rte_cross_comparator_t *cmp, const void *local_data, const void *peer_data, size_t data_size, rte_voting_result_t *result, void *out_data, size_t *out_size)
 Compares two already-in-hand data buffers directly, with the same on_disagreement-then-unconditional-safestate semantics as rte_cross_comparator_execute() - no rte_channel_t registration needed. Added per direct request as part of the RCA/OCORA compatibility initiative's Phase 2b (see docs/rca/ at the workspace root and TODO.dox): an integrator whose local/peer data already arrived through its own transport (e.g. RBC_GP's kind-multiplexed peer_channel, which carries cross-compare traffic alongside checkpoint/site-state frames on one shared link - not something a generic comparator API can transparently subsume) no longer needs to hand-wire two pure in-memory rte_channel_t "already arrived" adapters (send() that is never called, recv() that just returns a buffer) purely to satisfy rte_cross_comparator_execute()'s channel-based interface - this collapses that boilerplate to one call.
rte_status_t rte_cross_comparator_get_aggregated_health (const rte_cross_comparator_t *cmp, uint32_t *healthy_count, uint32_t *total_disagreements)
 Aggregated health across both registered channels.
rte_status_t rte_cross_comparator_destroy (rte_cross_comparator_t *cmp)
 Destroys a cross-comparator instance.

Detailed Description

Pairwise channel comparison (ADR-025): validates parameters, receives from both registered channels, and compares them.

Definition in file rte_cross_comparator.c.

Function Documentation

◆ cross_comparator_data_equal()

bool cross_comparator_data_equal ( const rte_cross_comparator_t * cmp,
const void * a,
const void * b,
size_t size )
static

Definition at line 14 of file rte_cross_comparator.c.

◆ cross_comparator_finish()

rte_status_t cross_comparator_finish ( rte_cross_comparator_t * cmp,
rte_voting_result_t local_result,
const void * agreed_data,
size_t data_size,
rte_voting_result_t * result,
void * out_data,
size_t * out_size )
static

Shared tail for both rte_cross_comparator_execute() and rte_cross_comparator_execute_buffers(): given a computed local_result, applies the exact same AGREED/DISAGREED/other handling (callback, unconditional safestate on DISAGREED) both public entry points must have identically - see rte_cross_comparator.h's own RCA/OCORA PI-API compatibility note for why this exists.

Definition at line 102 of file rte_cross_comparator.c.