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.h
Go to the documentation of this file.
1
27
28#ifndef RTE_CROSS_COMPARATOR_H
29#define RTE_CROSS_COMPARATOR_H
30
31#include <stdint.h>
32#include <stdbool.h>
33#include <stddef.h>
34
39
40#ifdef __cplusplus
41extern "C" {
42#endif
43
80
82#define RTE_CROSS_COMPARATOR_MAX_MESSAGE_SIZE 256U
83
88typedef struct {
90 rte_channel_t *channel_a;
91 rte_channel_t *channel_b;
92 uint32_t registered_count;
93 uint32_t total_disagreements;
94 bool initialized;
96
99
112 const rte_cross_comparator_config_t *config);
113
133 rte_channel_t *channel);
134
170 rte_voting_result_t *result,
171 void *out_data, size_t *out_size);
172
223 const void *local_data, const void *peer_data,
224 size_t data_size,
225 rte_voting_result_t *result,
226 void *out_data, size_t *out_size);
227
241 uint32_t *healthy_count,
242 uint32_t *total_disagreements);
243
252
253#ifdef __cplusplus
254}
255#endif
256
258
259#endif /* RTE_CROSS_COMPARATOR_H */
rte_safestate_level_t
Safe-state severity levels (ADR-004 section 2.1).
uint16_t rte_safestate_reason_t
Diagnostic reason code accompanying a safe-state transition.
rte_status_t
Common result/status codes.
Definition rte_status.h:27
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).
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_init(rte_cross_comparator_storage_t *storage, const rte_cross_comparator_config_t *config)
Initializes a cross-comparator with zero registered channels.
rte_cross_comparator_storage_t rte_cross_comparator_t
Opaque handle to a cross-comparator instance.
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_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-...
rte_status_t rte_cross_comparator_destroy(rte_cross_comparator_t *cmp)
Destroys a cross-comparator instance.
rte_voting_result_t
Outcome of one rte_voter_receive() call.
Definition rte_voter.h:54
bool(*) rte_voter_compare_fn(const void *a, const void *b, size_t size, void *user_ctx)
Optional custom comparison callback.
Definition rte_voter.h:82
A single redundant "channel": an opaque transport handle plus send/receive callbacks,...
Safe-state transitions and checked assertions (ADR-004).
Common status/error codes returned by every Safe API Framework function. Shared across all OS Abstrac...
N-way voting across registered rte_channel_t links (2oo2/2oo3/NMR).
Configuration for rte_cross_comparator_init().
rte_safestate_reason_t safestate_reason
void(*) on_disagreement(void *context, rte_voting_result_t result)
rte_safestate_level_t safestate_level
Storage for one cross-comparator instance (opaque to caller). No dynamic memory.