Safe API Framework
Layered API framework for safety-related applications (ERTMS RBC reference targeting CENELEC EN 50128 SIL 4)
Loading...
Searching...
No Matches
sapi_cross_comparator.h File Reference

Pairwise comparison between exactly 2 registered sapi_channel_t links (ADR-025). More...

#include <stdint.h>
#include <stdbool.h>
#include <stddef.h>
#include "safeapi/utils/status/sapi_status.h"
#include "safeapi/redundancy/channel_link/sapi_channel.h"
#include "safeapi/redundancy/voter/sapi_voter.h"
Include dependency graph for sapi_cross_comparator.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  sapi_cross_comparator_config_t
 Configuration for sapi_cross_comparator_init(). More...
struct  sapi_cross_comparator_storage_t
 Storage for one cross-comparator instance (opaque to caller). No dynamic memory. More...

Macros

#define SAPI_CROSS_COMPARATOR_MAX_MESSAGE_SIZE   256U
 Maximum payload size sapi_cross_comparator_execute() supports.

Typedefs

typedef sapi_cross_comparator_storage_t sapi_cross_comparator_t
 Opaque handle to a cross-comparator instance.

Functions

sapi_status_t sapi_cross_comparator_init (sapi_cross_comparator_storage_t *storage, const sapi_cross_comparator_config_t *config)
 Initializes a cross-comparator with zero registered channels.
sapi_status_t sapi_cross_comparator_register_channel (sapi_cross_comparator_t *cmp, sapi_channel_t *channel)
 Registers one already-initialized channel (channel A, then B).
sapi_status_t sapi_cross_comparator_execute (sapi_cross_comparator_t *cmp, size_t data_size, sapi_voting_result_t *result, void *out_data, size_t *out_size)
 Receives from both registered channels and compares them.
sapi_status_t sapi_cross_comparator_get_aggregated_health (const sapi_cross_comparator_t *cmp, uint32_t *healthy_count, uint32_t *total_disagreements)
 Aggregated health across both registered channels.
sapi_status_t sapi_cross_comparator_destroy (sapi_cross_comparator_t *cmp)
 Destroys a cross-comparator instance.

Detailed Description

Pairwise comparison between exactly 2 registered sapi_channel_t links (ADR-025).

Distinct from sapi_voter: a voter does N-modular-redundancy voting on channels that are expected to carry the same computation (pick the majority value). A cross-comparator checks consistency between two independent channels/peers whose agreement is a diagnostic invariant, not a value to pick a winner from - generalizes the pattern safeAPIRBC2oo2's channel_ab_crosscompare.c hand-rolls today.

Definition in file sapi_cross_comparator.h.