4 #include <sys/socket.h>
10 #include <libubox/uloop.h>
17 #define DEFAULT_MAIN_PATH "./dummy"
18 #define DEFAULT_HOTPLUG_PATH "./scripts/hotplug-cmd"
19 #define DEFAULT_RESOLV_CONF "./tmp/resolv.conf"
21 #define DEFAULT_MAIN_PATH "/lib/netifd"
22 #define DEFAULT_HOTPLUG_PATH "/sbin/hotplug-cmd"
23 #define DEFAULT_RESOLV_CONF "/tmp/resolv.conf.auto"
26 extern const char *resolv_conf;
27 extern char *hotplug_cmd_path;
28 extern unsigned int debug_mask;
37 #define DPRINTF(format, ...) fprintf(stderr, "%s(%d): " format, __func__, __LINE__, ## __VA_ARGS__)
38 #define D(level, format, ...) do { \
39 if (debug_mask & (1 << (DEBUG_ ## level))) \
40 DPRINTF(format, ##__VA_ARGS__); \
43 #define DPRINTF(format, ...) no_debug(0, format, ## __VA_ARGS__)
44 #define D(level, format, ...) no_debug(DEBUG_ ## level, format, ## __VA_ARGS__)
47 #define LOG_BUF_SIZE 256
49 static inline void no_debug(int level, const char *fmt, ...)
54 struct list_head list;
55 struct netifd_process *proc;
59 struct netifd_process {
60 struct list_head list;
61 struct uloop_process uloop;
62 void (*cb)(struct netifd_process *, int ret);
65 struct netifd_fd log_fd;
66 struct uloop_fd log_uloop;
67 const char *log_prefix;
73 void netifd_log_message(int priority, const char *format, ...);
75 int netifd_start_process(const char **argv, char **env, struct netifd_process *proc);
76 void netifd_kill_process(struct netifd_process *proc);
78 void netifd_fd_add(struct netifd_fd *fd);
79 void netifd_fd_delete(struct netifd_fd *fd);
84 extern const char *main_path;
85 void netifd_restart(void);
86 void netifd_reload(void);