ucode: check for errors in ftruncate()
[project/udebug.git] / udebug.h
1 #include <libubox/udebug.h>
2 #include <libubus.h>
3
4 struct udebug_ubus;
5 typedef void (*udebug_config_cb)(struct udebug_ubus *ctx, struct blob_attr *data, bool enabled);
6
7 struct udebug_ubus_ring {
8 struct udebug_buf *buf;
9 const struct udebug_buf_meta *meta;
10 unsigned int size, default_size;
11 unsigned int entries, default_entries;
12 };
13
14 struct udebug_ubus {
15 struct ubus_context *ubus;
16 struct uloop_timeout t;
17 const char *service;
18 struct ubus_subscriber sub;
19 udebug_config_cb cb;
20 };
21
22 void udebug_netlink_msg(struct udebug_buf *buf, uint16_t proto, const void *data, size_t len);
23
24 void udebug_ubus_init(struct udebug_ubus *ctx, struct ubus_context *ubus,
25 const char *service, udebug_config_cb cb);
26 void udebug_ubus_ring_init(struct udebug *ud, struct udebug_ubus_ring *ring);
27 void udebug_ubus_apply_config(struct udebug *ud, struct udebug_ubus_ring *rings, int n,
28 struct blob_attr *data, bool enabled);
29 void udebug_ubus_free(struct udebug_ubus *ctx);