add early handler
[project/procd.git] / procd.h
1 #ifndef __PROCD_H
2 #define __PROCD_H
3
4 #include <libubox/uloop.h>
5 #include <libubox/utils.h>
6 #include <libubus.h>
7 #include <stdio.h>
8
9 #define __init __attribute__((constructor))
10
11 #define DPRINTF(fmt, ...) do { \
12         if (debug) \
13                 fprintf(stderr, "DEBUG %s(%d): " fmt, __func__, __LINE__, ## __VA_ARGS__); \
14         } while (0)
15
16 #define DEBUG(level, fmt, ...) do { \
17         if (debug >= level) \
18                 fprintf(stderr, "DEBUG %s(%d): " fmt, __func__, __LINE__, ## __VA_ARGS__); \
19         } while (0)
20
21 extern int debug;
22 extern char *ubus_socket;
23 void procd_connect_ubus(void);
24 void procd_init_service(struct ubus_context *ctx);
25
26 #endif