move the instance data structure to instance.h
[project/procd.git] / utils.h
1 #ifndef __PROCD_UTILS_H
2 #define __PROCD_UTILS_H
3
4 #include <libubox/avl.h>
5 #include <libubox/blob.h>
6 #include <libubox/blobmsg.h>
7
8 struct blobmsg_list {
9         struct avl_tree avl;
10         int node_offset;
11         int node_len;
12 };
13
14 struct blobmsg_list_node {
15         struct avl_node avl;
16         struct blob_attr *data;
17 };
18
19 #define blobmsg_list_init(list, type, field) \
20         __blobmsg_list_init(tree, offsetof(type, field), sizeof(type))
21
22 void __blobmsg_list_init(struct blobmsg_list *list, int offset, int len);
23 int blobmsg_list_fill(struct blobmsg_list *list, void *data, int len);
24 void blobmsg_list_free(struct blobmsg_list *list);
25
26 #endif