84be97f1f4cefe0e22e0ea76923bf3cc6c8f5145
[feed/routing.git] / babeld / src / ubus.h
1 /*
2 IPC integration of babeld with OpenWrt.
3
4 The ubus interface offers following functions:
5 - get_info
6 - get_neighbours
7 - get_xroutes
8 - get_routes
9
10 All output is divided into IPv4 and IPv6.
11 */
12
13 #include <libubus.h>
14
15 // Whether to enable ubus bindings (boolean option).
16 extern int ubus_bindings;
17
18 /**
19 * Initialize ubus interface.
20 *
21 * Connect to the ubus daemon and expose the ubus functions.
22 *
23 * @return if initializing ubus was successful
24 */
25 bool babeld_add_ubus();
26
27 /**
28 * Add ubus socket to given filedescriptor set.
29 *
30 * We need to check repeatedly if the ubus socket has something to read.
31 * The functions allows to add the ubus socket to the normal while(1)-loop of babeld.
32 *
33 * @param readfs: the filedescriptor set
34 * @param maxfd: the current maximum file descriptor
35 * @return the maximum file descriptor
36 */
37 int babeld_ubus_add_read_sock(fd_set* readfds, int maxfd);
38
39
40 /**
41 * Check and process ubus socket.
42 *
43 * If the ubus-socket signals that data is available, the ubus_handle_event is called.
44 */
45 void babeld_ubus_receive(fd_set* readfds);