diff options
| author | Federico Angelilli <code@fedang.net> | 2024-12-03 12:59:28 +0100 |
|---|---|---|
| committer | Federico Angelilli <code@fedang.net> | 2024-12-03 12:59:28 +0100 |
| commit | f139b5f479e2bb04dbd41d97906b2fd48a608f8b (patch) | |
| tree | eb762ff52205c06b6b3b0a2a29a825bb03a847e9 /src/config.h | |
| parent | 5a133f95105a494b9c6131132dcde27305b32a05 (diff) | |
Define constraints
Diffstat (limited to 'src/config.h')
| -rw-r--r-- | src/config.h | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/config.h b/src/config.h index 699fa83..427ad40 100644 --- a/src/config.h +++ b/src/config.h @@ -5,6 +5,7 @@ #include <stdint.h> #include "util.h" +#include "any_log.h" typedef struct block block_t; @@ -23,10 +24,26 @@ typedef enum { CONFIG_LIST, } config_type_t; +typedef enum { + CHECK_NONE, + CHECK_POSITIVE, + CHECK_IN_RANGE, +} config_check_type_t; + +typedef struct { + config_check_type_t type; + union { + struct { + int min, max; + } range; + }; +} config_check_t; + typedef struct { const char *key; config_type_t type; const void *data; + const config_check_t *checks; size_t offset; } config_entry_t; @@ -62,6 +79,8 @@ typedef struct { int value; } config_enum_t; +extern const any_log_formatter_t config_formatters[]; + const char *config_type_to_string(config_type_t type); void config_init(config_t *config); |
