diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-12-09 02:15:59 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-12-09 02:15:59 +0000 |
commit | 2e9ac3b3420350737aa37d01c0418bede10ab401 (patch) | |
tree | 352ff51ea0379c7709deb28dc8a18318ba47f806 /contrib/fwd/src/fwd_addr.h | |
parent | e8220d96a52be888db8611e2908cb3ba97dfe2f8 (diff) |
contrib: fwd - initial C implementation of the uci firewall
Diffstat (limited to 'contrib/fwd/src/fwd_addr.h')
-rw-r--r-- | contrib/fwd/src/fwd_addr.h | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/contrib/fwd/src/fwd_addr.h b/contrib/fwd/src/fwd_addr.h new file mode 100644 index 0000000000..1a28f64641 --- /dev/null +++ b/contrib/fwd/src/fwd_addr.h @@ -0,0 +1,52 @@ +/* + * 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_list { + char ifname[IFNAMSIZ]; + char label[IFNAMSIZ]; + int family; + int index; + unsigned int prefix; + union { + struct in_addr v4; + struct in6_addr v6; + } ipaddr; + struct fwd_addr_list *next; +}; + + +struct fwd_addr_list * fwd_get_addrs(int, int); +struct fwd_addr_list * fwd_append_addrs(struct fwd_addr_list *, struct fwd_addr_list *); +void fwd_free_addrs(struct fwd_addr_list *); + +#define fwd_foreach_addrs(head, entry) for(entry = head; entry; entry = entry->next) + +#endif + |