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
channel_configuration_example.c File Reference

Example: How users configure channels for online/standby redundancy. More...

#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include <stdio.h>
#include "rte/channel_link/rte_channel.h"
#include "rte/voter/rte_voter.h"
#include "rte/status/rte_status.h"
Include dependency graph for channel_configuration_example.c:

Go to the source code of this file.

Data Structures

struct  tcp_channel_config_t
struct  udp_channel_config_t
struct  shm_channel_config_t
struct  fifo_channel_config_t
struct  channel_wrapper_t

Enumerations

enum  channel_type_t { CHANNEL_TYPE_TCP , CHANNEL_TYPE_UDP , CHANNEL_TYPE_SHM , CHANNEL_TYPE_FIFO }

Functions

static rte_status_t app_backend_send (void *channel, const void *data, size_t size)
 Dispatcher send callback Routes to appropriate transport based on channel type.
static rte_status_t app_backend_recv (void *channel, void *data, size_t size, uint32_t timeout_ms)
 Dispatcher receive callback Routes to appropriate transport based on channel type.
void example_tcp_based_redundancy (void)
void example_local_redundancy (void)
void example_hybrid_configuration (void)
int main (void)

Detailed Description

Example: How users configure channels for online/standby redundancy.

This example shows:

  1. Creating different channel types with user-specified parameters
  2. TCP/IP for remote standby communication (primary use case)
  3. Optional fallback channels (UDP, shared memory for local)
  4. Wrapping in rte_voter for voting/redundancy (ADR-025)
  5. Dispatcher pattern for mixed transport types

User responsibility: Provide configuration values (IPs, ports, paths) Framework responsibility: Voting, health tracking, safe-state OS integrator responsibility: Actual send/recv implementations

Definition in file channel_configuration_example.c.

Enumeration Type Documentation

◆ channel_type_t

enum channel_type_t

Definition at line 85 of file channel_configuration_example.c.

Function Documentation

◆ app_backend_send()

rte_status_t app_backend_send ( void * channel,
const void * data,
size_t size )
static

Dispatcher send callback Routes to appropriate transport based on channel type.

Definition at line 110 of file channel_configuration_example.c.

◆ app_backend_recv()

rte_status_t app_backend_recv ( void * channel,
void * data,
size_t size,
uint32_t timeout_ms )
static

Dispatcher receive callback Routes to appropriate transport based on channel type.

Definition at line 152 of file channel_configuration_example.c.

◆ example_tcp_based_redundancy()

void example_tcp_based_redundancy ( void )

Definition at line 195 of file channel_configuration_example.c.

◆ example_local_redundancy()

void example_local_redundancy ( void )

Definition at line 400 of file channel_configuration_example.c.

◆ example_hybrid_configuration()

void example_hybrid_configuration ( void )

Definition at line 432 of file channel_configuration_example.c.

◆ main()

int main ( void )

Definition at line 446 of file channel_configuration_example.c.