blob: b8183bacae9ff9320dcd1e996db4f27a7fdfab5a [file] [log] [blame]
Harald Welte1a36f332018-06-04 17:36:33 +02001#pragma once
2
3#include <osmocom/core/linuxlist.h>
4
5/* a single node in the tree of values */
6struct value_node {
7 /* our element in the parent list */
8 struct llist_head list;
9 /* the display name */
10 const char *name;
Harald Welteb6718f72018-06-04 20:08:21 +020011 /* additional numeric index (for ifindex matching) */
12 int idx;
Harald Welte1a36f332018-06-04 17:36:33 +020013 /* the value (if any) */
14 const char *value;
15 /* the children (if value == NULL) */
16 struct llist_head children;
17};
18
19struct value_node *value_node_add(void *ctx, struct value_node *parent,
20 const char *name, const char *value);
Harald Welte3a964a42018-06-04 19:40:26 +020021struct value_node *value_node_find(struct value_node *parent, const char *name);
Harald Welteb6718f72018-06-04 20:08:21 +020022struct value_node *value_node_find_by_idx(struct value_node *parent, int idx);
Harald Welte3a964a42018-06-04 19:40:26 +020023struct value_node *value_node_find_or_add(struct value_node *parent, const char *name);
Harald Welte1a36f332018-06-04 17:36:33 +020024void value_node_del(struct value_node *node);