From d91beb059087bc166fbfaa4354b0291945198a53 Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Mon, 14 Dec 2009 02:25:55 +0000 Subject: contrib/fwd: initial xtables binding --- contrib/fwd/src/fwd_xtables.h | 66 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 contrib/fwd/src/fwd_xtables.h (limited to 'contrib/fwd/src/fwd_xtables.h') diff --git a/contrib/fwd/src/fwd_xtables.h b/contrib/fwd/src/fwd_xtables.h new file mode 100644 index 0000000000..126746a79f --- /dev/null +++ b/contrib/fwd/src/fwd_xtables.h @@ -0,0 +1,66 @@ +/* + * fwd - OpenWrt firewall daemon - libiptc/libxtables interface headers + * + * Copyright (C) 2009 Jo-Philipp Wich + * + * 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_XTABLES_H__ +#define __FWD_XTABLES_H__ + +#include +#include +#include + +#include +#include + +#include +#include + + + +struct fwd_xt_rule { + struct iptc_handle *iptc; + struct ipt_entry *entry; + struct xtables_rule_match *matches; + struct xtables_target *target; +}; + + +/* Required by certain extensions like SNAT and DNAT */ +extern int kernel_version; +extern void get_kernel_version(void); + + +void fwd_xt_init(void); + +struct fwd_xt_rule * fwd_xt_init_rule(const char *table); + +void fwd_xt_parse_proto(struct fwd_xt_rule *r, struct fwd_proto *p, int inv); +void fwd_xt_parse_in(struct fwd_xt_rule *r, struct fwd_network_list *n, int inv); +void fwd_xt_parse_out(struct fwd_xt_rule *r, struct fwd_network_list *n, int inv); +void fwd_xt_parse_src(struct fwd_xt_rule *r, struct fwd_cidr *c, int inv); +void fwd_xt_parse_dest(struct fwd_xt_rule *r, struct fwd_cidr *c, int inv); + +struct xtables_match * fwd_xt_get_match(struct fwd_xt_rule *r, const char *name); +void fwd_xt_parse_match(struct fwd_xt_rule *r, struct xtables_match *m, const char *opt, const char *val); + +struct xtables_target * fwd_xt_get_target(struct fwd_xt_rule *r, const char *name); +void fwd_xt_parse_target(struct fwd_xt_rule *r, struct xtables_target *t, const char *opt, const char *val); + +int fwd_xt_exec_rule(struct fwd_xt_rule *r, const char *chain); + +#endif -- cgit v1.2.3