diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-12-14 02:25:55 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-12-14 02:25:55 +0000 |
commit | d91beb059087bc166fbfaa4354b0291945198a53 (patch) | |
tree | e4f41420b78156615257eabeb299ad8641b4a5f0 /contrib/fwd/src/fwd_xtables.h | |
parent | 1a403dfcd6ffd4f14e4ffa9d6c3037d07066ee5a (diff) |
contrib/fwd: initial xtables binding
Diffstat (limited to 'contrib/fwd/src/fwd_xtables.h')
-rw-r--r-- | contrib/fwd/src/fwd_xtables.h | 66 |
1 files changed, 66 insertions, 0 deletions
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 <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_XTABLES_H__ +#define __FWD_XTABLES_H__ + +#include <iptables.h> +#include <xtables.h> +#include <libiptc/libxtc.h> + +#include <dlfcn.h> +#include <errno.h> + +#include <sys/stat.h> +#include <sys/utsname.h> + + + +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 |