From cf87432e410cbe2ee61e90b8f4c2e8d2a75f09ca Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Fri, 5 Jun 2020 16:27:31 +0200 Subject: Split config into generic and dir watching parts --- config.h | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) (limited to 'config.h') diff --git a/config.h b/config.h index c70c6ef..30be385 100644 --- a/config.h +++ b/config.h @@ -1,12 +1,29 @@ #ifndef fooconfighfoo #define fooconfighfoo -void scfg_monitor_dir(struct cfg *cfg); +enum cfg_value_type { + CFG_VAL_TYPE_INVALID, + CFG_VAL_TYPE_STRING, + CFG_VAL_TYPE_UINT16, + CFG_VAL_TYPE_ADDRS, +}; -void inotify_refdump(struct inotify_ev *iev); +struct cfg_key_value_map { + const char *key_name; + int key_value; + enum cfg_value_type value_type; +}; -void scfg_stop_monitor_dir(struct cfg *cfg); +union cfg_value { + const char *str; + uint16_t uint16; + struct list_head addr_list; /* FIXME: addrs */ +}; -void scfg_read_all(struct cfg *cfg); +bool config_parse_line(struct cfg *cfg, char **buf, + struct cfg_key_value_map *kvmap, + int *key, union cfg_value *value); + +bool config_parse_header(struct cfg *cfg, const char *title, char **buf); #endif -- cgit v1.2.3