|
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
|
File-based configuration for the Safe Communication Framework. More...
Go to the source code of this file.
Data Structures | |
| struct | safecomm_config_entry_t |
| One parsed key/value pair. More... | |
| struct | safecomm_config_t |
| A loaded configuration file. Caller-allocated, opaque in use. More... | |
Macros | |
| #define | SAFECOMM_CONFIG_MAX_ENTRIES 64U |
| #define | SAFECOMM_CONFIG_MAX_KEY_LEN 64U |
| #define | SAFECOMM_CONFIG_MAX_VALUE_LEN 192U |
| #define | SAFECOMM_CONFIG_MAX_LINE_LEN 320U |
Functions | |
| safecomm_status_t | safecomm_config_load (const char *path, safecomm_config_t *out) |
Load path into out (fully overwrites it). | |
| const char * | safecomm_config_get_str (const safecomm_config_t *cfg, const char *key) |
Raw string value for key. | |
| safecomm_status_t | safecomm_config_get_u32 (const safecomm_config_t *cfg, const char *key, uint32_t *out) |
Unsigned-integer value for key. | |
| safecomm_status_t | safecomm_config_get_bool (const safecomm_config_t *cfg, const char *key, bool *out) |
Boolean value for key ("true"/"false"/"1"/"0", case-insensitive). | |
File-based configuration for the Safe Communication Framework.
Every runtime parameter of the stack is read from a plain text file, never hard-coded and never passed as a long argv list — one file per node (A, B, Gateway), same "configuration lives in files" convention as the rest of the RBC_Template workspace (packaging.conf, sim config.json).
Format (deliberately minimal — MISRA-friendly, deterministic, no external parser):
saf.role = responder saf.etcs_id_self = 4661 saf.etcs_id_peer = 0 # 0 = accept any (responder) saf.t_connect_ms = 10000 saf.t_supervision_ms= 20000 saf.seq_window = 8 cfm.profile = euroradio # euroradio | rbc_rbc cfm.peer_host = 10.0.0.7 cfm.peer_port = 7911 cfm.bind_port = 7911 cfm.retry_ms = 5000 keys.kmac_file = /etc/safecomm/kmac_evc.key # 48 hex chars = 24 bytes ale.listen_host = 0.0.0.0 # Gateway only ale.listen_port = 15010 ale.peer_map_file = /etc/safecomm/peers.map
Keys are flat "group.name"; there are no sections (no section-state in the parser). Unknown keys are kept verbatim and ignored by components that do not consume them. A component RANGE-CHECKS every value it reads at init and refuses to start on a bad one — the loader itself performs no semantic validation, so parsing stays non-vital.
REQ-SC-CFG-001..012 — see docs/requirements/SRS.md.
Definition in file config.h.
| #define SAFECOMM_CONFIG_MAX_ENTRIES 64U |
| safecomm_status_t safecomm_config_load | ( | const char * | path, |
| safecomm_config_t * | out ) |
Load path into out (fully overwrites it).
Reads at most SAFECOMM_CONFIG_MAX_ENTRIES key = value lines. Blank lines and lines whose first non-space character is '#' are skipped. Leading/trailing whitespace is trimmed from both key and value; an inline # ... comment after the value is stripped. No semantic checks.
| path | file path (NUL-terminated). Non-NULL. |
| out | receives the parsed entries. Non-NULL. |
| const char * safecomm_config_get_str | ( | const safecomm_config_t * | cfg, |
| const char * | key ) |
| safecomm_status_t safecomm_config_get_u32 | ( | const safecomm_config_t * | cfg, |
| const char * | key, | ||
| uint32_t * | out ) |
Unsigned-integer value for key.
| cfg | loaded config. Non-NULL. |
| key | flat "group.name". Non-NULL. |
| out | receives the value on success. Non-NULL. |
| safecomm_status_t safecomm_config_get_bool | ( | const safecomm_config_t * | cfg, |
| const char * | key, | ||
| bool * | out ) |