From aa37acc1423126f555135935c687eb91995b9440 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Mon, 7 Feb 2011 04:00:50 +0100 Subject: libxtables: guided option parser This patchset seeks to drastically reduce the code in the individual extensions by centralizing their argument parsing (breakdown of strings), validation, and in part, assignment. As a secondary goal, this reduces the number of static storage duration variables in flight. Signed-off-by: Jan Engelhardt --- xshared.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'xshared.h') diff --git a/xshared.h b/xshared.h index 94abb392..be53535b 100644 --- a/xshared.h +++ b/xshared.h @@ -26,6 +26,24 @@ enum { struct xtables_rule_match; struct xtables_target; +/** + * xtables_afinfo - protocol family dependent information + * @kmod: kernel module basename (e.g. "ip_tables") + * @libprefix: prefix of .so library name (e.g. "libipt_") + * @family: nfproto family + * @ipproto: used by setsockopt (e.g. IPPROTO_IP) + * @so_rev_match: optname to check revision support of match + * @so_rev_target: optname to check revision support of target + */ +struct xtables_afinfo { + const char *kmod; + const char *libprefix; + uint8_t family; + uint8_t ipproto; + int so_rev_match; + int so_rev_target; +}; + struct iptables_command_state { union { struct ipt_entry fw; @@ -59,4 +77,6 @@ extern const char *proto_to_name(uint8_t, int); extern struct xtables_match *load_proto(struct iptables_command_state *); extern int subcmd_main(int, char **, const struct subcommand *); +extern const struct xtables_afinfo *afinfo; + #endif /* IPTABLES_XSHARED_H */ -- cgit v1.2.3