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
Toggle main menu visibility
Loading...
Searching...
No Matches
config.h
Go to the documentation of this file.
1
38
#ifndef SAFECOMM_CONFIG_H
39
#define SAFECOMM_CONFIG_H
40
41
#include <stdbool.h>
42
#include <stddef.h>
43
#include <stdint.h>
44
45
#include "
safecomm/status.h
"
46
47
#ifdef __cplusplus
48
extern
"C"
{
49
#endif
50
52
#define SAFECOMM_CONFIG_MAX_ENTRIES 64U
53
#define SAFECOMM_CONFIG_MAX_KEY_LEN 64U
54
#define SAFECOMM_CONFIG_MAX_VALUE_LEN 192U
55
#define SAFECOMM_CONFIG_MAX_LINE_LEN 320U
56
58
typedef
struct
59
{
60
char
key[SAFECOMM_CONFIG_MAX_KEY_LEN];
61
char
value[SAFECOMM_CONFIG_MAX_VALUE_LEN];
62
}
safecomm_config_entry_t
;
63
65
typedef
struct
66
{
67
safecomm_config_entry_t
entries[
SAFECOMM_CONFIG_MAX_ENTRIES
];
68
uint32_t count;
69
}
safecomm_config_t
;
70
87
safecomm_status_t
safecomm_config_load
(
const
char
*path,
safecomm_config_t
*out);
88
94
const
char
*
safecomm_config_get_str
(
const
safecomm_config_t
*cfg,
const
char
*key);
95
105
safecomm_status_t
safecomm_config_get_u32
(
const
safecomm_config_t
*cfg,
const
char
*key, uint32_t *out);
106
112
safecomm_status_t
safecomm_config_get_bool
(
const
safecomm_config_t
*cfg,
const
char
*key,
bool
*out);
113
114
#ifdef __cplusplus
115
}
116
#endif
117
118
#endif
/* SAFECOMM_CONFIG_H */
safecomm_config_load
safecomm_status_t safecomm_config_load(const char *path, safecomm_config_t *out)
Load path into out (fully overwrites it).
Definition
config.c:74
SAFECOMM_CONFIG_MAX_ENTRIES
#define SAFECOMM_CONFIG_MAX_ENTRIES
Definition
config.h:52
safecomm_config_get_str
const char * safecomm_config_get_str(const safecomm_config_t *cfg, const char *key)
Raw string value for key.
Definition
config.c:141
safecomm_config_get_bool
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).
Definition
config.c:178
safecomm_config_get_u32
safecomm_status_t safecomm_config_get_u32(const safecomm_config_t *cfg, const char *key, uint32_t *out)
Unsigned-integer value for key.
Definition
config.c:159
status.h
Common status codes for the Safe Communication Framework.
safecomm_status_t
safecomm_status_t
Result of a Safe Communication Framework operation.
Definition
status.h:17
safecomm_config_entry_t
One parsed key/value pair.
Definition
config.h:59
safecomm_config_t
A loaded configuration file. Caller-allocated, opaque in use.
Definition
config.h:66
include
safecomm
config
config.h
Generated by
1.18.0