summaryrefslogtreecommitdiff
path: root/config.h
blob: 30be385e53912690d588b5b01d718d2c59c203d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#ifndef fooconfighfoo
#define fooconfighfoo

enum cfg_value_type {
	CFG_VAL_TYPE_INVALID,
	CFG_VAL_TYPE_STRING,
	CFG_VAL_TYPE_UINT16,
	CFG_VAL_TYPE_ADDRS,
};

struct cfg_key_value_map {
	const char *key_name;
	int key_value;
	enum cfg_value_type value_type;
};

union cfg_value {
	const char *str;
	uint16_t uint16;
	struct list_head addr_list; /* FIXME: addrs */
};

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