Safe Communication Framework 0.1.0 build feea4f9
ERTMS/ETCS safe communication (Subset-037 EuroRadio, Subset-098 RBC/RBC), CENELEC EN 50128 SIL 4 oriented
Loading...
Searching...
No Matches
ale.c File Reference

Application Layer Entity — config + peer-map data model. More...

#include "safecomm/ale/ale.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
Include dependency graph for ale.c:

Go to the source code of this file.

Functions

static bool parse_peer_line (const char *line, safecomm_ale_peer_t *out)
static safecomm_status_t load_peer_map (const char *path, safecomm_ale_t *ale)
safecomm_status_t safecomm_ale_from_config (const safecomm_config_t *cfg, safecomm_ale_t *out)
 Build an ALE from a loaded config (ale.* keys) + its peer map.
const safecomm_ale_peer_t * safecomm_ale_lookup (const safecomm_ale_t *ale, uint32_t peer_id)
 Resolve a peer id to its A/B endpoint pair.

Detailed Description

Application Layer Entity — config + peer-map data model.

The listener / relay I/O lives in the consumer (e.g. CommServer); this module owns the non-vital data model: parse ale.* config and the peer map, resolve a peer id to its A/B endpoints.

Definition in file ale.c.

Function Documentation

◆ parse_peer_line()

bool parse_peer_line ( const char * line,
safecomm_ale_peer_t * out )
static

Parse one peer-map line: "<peer_id> <a_host> <b_host> <ab_port>".

Definition at line 16 of file ale.c.

◆ load_peer_map()

safecomm_status_t load_peer_map ( const char * path,
safecomm_ale_t * ale )
static

Definition at line 42 of file ale.c.

◆ safecomm_ale_from_config()

safecomm_status_t safecomm_ale_from_config ( const safecomm_config_t * cfg,
safecomm_ale_t * out )

Build an ALE from a loaded config (ale.* keys) + its peer map.

Parameters
cfgloaded configuration (ale.listen_host, ale.listen_port, ale.peer_map_file). Non-NULL.
outreceives the ALE. Non-NULL.
Returns
SAFECOMM_STATUS_OK / _INVALID_PARAM / _TRANSPORT (peer map unreadable) / _NOT_IMPLEMENTED.
Note
REQ-SC-ALE-003.

Definition at line 72 of file ale.c.

◆ safecomm_ale_lookup()

const safecomm_ale_peer_t * safecomm_ale_lookup ( const safecomm_ale_t * ale,
uint32_t peer_id )

Resolve a peer id to its A/B endpoint pair.

Returns
the peer entry, or NULL if peer_id is not in the map.
Note
REQ-SC-ALE-006.

Definition at line 104 of file ale.c.