1a28f646415a70a9606bba3f083fa411e3e82f85
[project/luci.git] / contrib / fwd / src / fwd_addr.h
1 /*
2  * fwd - OpenWrt firewall daemon - header for rtnetlink communication
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_ADDR_H__
20 #define __FWD_ADDR_H__
21
22 #include <netinet/in.h>
23 #include <sys/socket.h>
24 #include <sys/ioctl.h>
25 #include <net/if.h>
26 #include <linux/netlink.h>
27 #include <linux/rtnetlink.h>
28 #include <arpa/inet.h>
29
30
31 struct fwd_addr_list {
32         char ifname[IFNAMSIZ];
33         char label[IFNAMSIZ];
34         int family;
35         int index;
36         unsigned int prefix;
37         union {
38                 struct in_addr v4;
39                 struct in6_addr v6;
40         } ipaddr;
41         struct fwd_addr_list *next;
42 };
43
44
45 struct fwd_addr_list * fwd_get_addrs(int, int);
46 struct fwd_addr_list * fwd_append_addrs(struct fwd_addr_list *, struct fwd_addr_list *);
47 void fwd_free_addrs(struct fwd_addr_list *);
48
49 #define fwd_foreach_addrs(head, entry) for(entry = head; entry; entry = entry->next)
50
51 #endif
52