Harald Welte | 1a36f33 | 2018-06-04 17:36:33 +0200 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <osmocom/core/linuxlist.h> |
| 4 | |
| 5 | /* a single node in the tree of values */ |
| 6 | struct value_node { |
| 7 | /* our element in the parent list */ |
| 8 | struct llist_head list; |
| 9 | /* the display name */ |
| 10 | const char *name; |
Harald Welte | b6718f7 | 2018-06-04 20:08:21 +0200 | [diff] [blame] | 11 | /* additional numeric index (for ifindex matching) */ |
| 12 | int idx; |
Harald Welte | 1a36f33 | 2018-06-04 17:36:33 +0200 | [diff] [blame] | 13 | /* the value (if any) */ |
| 14 | const char *value; |
| 15 | /* the children (if value == NULL) */ |
| 16 | struct llist_head children; |
| 17 | }; |
| 18 | |
Max | f41973e | 2019-01-25 18:40:11 +0100 | [diff] [blame] | 19 | struct value_node *value_node_add(struct value_node *parent, |
Harald Welte | 1a36f33 | 2018-06-04 17:36:33 +0200 | [diff] [blame] | 20 | const char *name, const char *value); |
Harald Welte | 3a964a4 | 2018-06-04 19:40:26 +0200 | [diff] [blame] | 21 | struct value_node *value_node_find(struct value_node *parent, const char *name); |
Harald Welte | b6718f7 | 2018-06-04 20:08:21 +0200 | [diff] [blame] | 22 | struct value_node *value_node_find_by_idx(struct value_node *parent, int idx); |
Harald Welte | 3a964a4 | 2018-06-04 19:40:26 +0200 | [diff] [blame] | 23 | struct value_node *value_node_find_or_add(struct value_node *parent, const char *name); |
Harald Welte | 1a36f33 | 2018-06-04 17:36:33 +0200 | [diff] [blame] | 24 | void value_node_del(struct value_node *node); |