aboutsummaryrefslogtreecommitdiffstats
path: root/value_node.h
blob: b8183bacae9ff9320dcd1e996db4f27a7fdfab5a (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
#pragma once

#include <osmocom/core/linuxlist.h>

/* a single node in the tree of values */
struct value_node {
	/* our element in the parent list */
	struct llist_head list;
	/* the display name */
	const char *name;
	/* additional numeric index (for ifindex matching) */
	int idx;
	/* the value (if any) */
	const char *value;
	/* the children (if value == NULL) */
	struct llist_head children;
};

struct value_node *value_node_add(void *ctx, struct value_node *parent,
				  const char *name, const char *value);
struct value_node *value_node_find(struct value_node *parent, const char *name);
struct value_node *value_node_find_by_idx(struct value_node *parent, int idx);
struct value_node *value_node_find_or_add(struct value_node *parent, const char *name);
void value_node_del(struct value_node *node);