summaryrefslogtreecommitdiffhomepage
path: root/contrib/fwd/src/fwd_addr.h
blob: 3cabe09a016128df40e671fade4c70c86591101f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/*
 * fwd - OpenWrt firewall daemon - header for rtnetlink communication
 *
 *   Copyright (C) 2009 Jo-Philipp Wich <xm@subsignal.org>
 *
 * The fwd program is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License version 2
 * as published by the Free Software Foundation.
 *
 * The fwd program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License along
 * with the fwd program. If not, see http://www.gnu.org/licenses/.
 */

#ifndef __FWD_ADDR_H__
#define __FWD_ADDR_H__

#include <netinet/in.h>
#include <sys/socket.h>
#include <sys/ioctl.h>
#include <net/if.h>
#include <linux/netlink.h>
#include <linux/rtnetlink.h>
#include <arpa/inet.h>


struct fwd_addr {
	char ifname[IFNAMSIZ];
	char label[IFNAMSIZ];
	int family;
	int index;
	struct fwd_cidr ipaddr;
	struct fwd_addr *next;
};


struct fwd_addr * fwd_get_addrs(int, int);
struct fwd_addr * fwd_append_addrs(struct fwd_addr *, struct fwd_addr *);
void fwd_free_addrs(struct fwd_addr *);

struct fwd_cidr * fwd_lookup_addr(struct fwd_addr *, const char *);

#define fwd_foreach_addrs(head, entry) for(entry = head; entry; entry = entry->next)

#endif