contrib: add WoL application to menuconfig
[project/luci.git] / contrib / fwd / src / fwd_ipc.h
1 /*
2 * fwd - OpenWrt firewall daemon - unix domain socket headers
3 *
4 * Copyright (C) 2009 Jo-Philipp Wich <xm@subsignal.org>
5 *
6 * The fwd program is free software: you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License version 2
8 * as published by the Free Software Foundation.
9 *
10 * The fwd program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13 * See the GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with the fwd program. If not, see http://www.gnu.org/licenses/.
17 */
18
19 #ifndef __FWD_IPC_H__
20 #define __FWD_IPC_H__
21
22 #include <unistd.h>
23 #include <fcntl.h>
24 #include <errno.h>
25
26 #include <sys/socket.h>
27 #include <sys/un.h>
28
29 #define FWD_SOCKET_PATH "/var/run/fwd.sock"
30
31
32 enum fwd_ipc_msgtype {
33 FWD_IPC_OK = 0,
34 FWD_IPC_ERROR = 1,
35 FWD_IPC_FLUSH = 2,
36 FWD_IPC_BUILD = 3,
37 FWD_IPC_RELOAD = 4,
38 FWD_IPC_ADDIF = 5,
39 FWD_IPC_DELIF = 6
40 };
41
42 struct fwd_ipc_msg {
43 enum fwd_ipc_msgtype type;
44 union {
45 char network[256];
46 } data;
47 };
48
49 int fwd_ipc_listen(void);
50 int fwd_ipc_accept(int);
51
52 int fwd_ipc_connect(void);
53
54 int fwd_ipc_recvmsg(int, void *, int);
55 int fwd_ipc_sendmsg(int, void *, int);
56
57 void fwd_ipc_shutdown(int);
58
59 int fwd_ipc_sendtype(int, enum fwd_ipc_msgtype);
60
61 #endif