use /lib/netifd as main path when dummy mode is disabled
[project/netifd.git] / netifd.h
1 #ifndef __NETIFD_H
2 #define __NETIFD_H
3
4 #include <sys/socket.h>
5 #include <net/if.h>
6
7 #include <stdbool.h>
8 #include <stdio.h>
9
10 #include <libubox/uloop.h>
11
12 #include <libubus.h>
13
14 #include "utils.h"
15
16 #ifdef DUMMY_MODE
17 #define DEFAULT_MAIN_PATH       "."
18 #define DEFAULT_HOTPLUG_PATH    "./scripts/hotplug-cmd"
19 #else
20 #define DEFAULT_MAIN_PATH       "/lib/netifd"
21 #define DEFAULT_HOTPLUG_PATH    "/sbin/hotplug-cmd"
22 #endif
23
24 extern char *hotplug_cmd_path;
25 extern unsigned int debug_mask;
26
27 enum {
28         DEBUG_SYSTEM    = 0,
29         DEBUG_DEVICE    = 1,
30         DEBUG_INTERFACE = 2,
31 };
32
33 #ifdef DEBUG
34 #define DPRINTF(format, ...) fprintf(stderr, "%s(%d): " format, __func__, __LINE__, ## __VA_ARGS__)
35 #define D(level, format, ...) do { \
36                 if (debug_mask & (1 << (DEBUG_ ## level))) \
37                                 DPRINTF(format, ##__VA_ARGS__); \
38         } while (0)
39 #else
40 #define DPRINTF(format, ...) no_debug(0, format, ## __VA_ARGS__)
41 #define D(level, format, ...) no_debug(DEBUG_ ## level, format, ## __VA_ARGS__)
42 #endif
43
44 static inline void no_debug(int level, const char *fmt, ...)
45 {
46 }
47
48 struct device;
49 struct interface;
50
51 extern const char *main_path;
52 void netifd_restart(void);
53 void netifd_reload(void);
54
55 #endif