diff options
author | Jamal Hadi Salim <hadi@cyberus.ca> | 2009-02-11 12:58:54 +0100 |
---|---|---|
committer | Patrick McHardy <kaber@trash.net> | 2009-02-11 12:58:54 +0100 |
commit | 8e90ce66a99e5dc9b055a9fd14e8e9216f90233c (patch) | |
tree | 11a43cdd816117b323d1897ed55f408810e58f59 /xtables.c | |
parent | 300e2909ba4714abc6093cba0ed860708282bd3e (diff) |
libxtables: Introduce global params structuring
introduce a new struct,xtables_globals, so as to
localize the globals used and help in symbol renames.
The applications must invoke xtables_set_params() before starting
to use any iptables APIs.
xtables_set_params() is intended to free xtables from depending
(as it does right now) on existence of such externally definitions
(from iptables/iptables6 etc). At the moment, xtables wont even
compile without presence of at least one of {iptables/iptables6 etc}
Signed-off-by: Jamal Hadi Salim <hadi@cyberus.ca>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'xtables.c')
-rw-r--r-- | xtables.c | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -46,6 +46,28 @@ #define PROC_SYS_MODPROBE "/proc/sys/kernel/modprobe" #endif +struct xtables_globals *xt_params; +/** + * xtables_set_params - set the global parameters used by xtables + * @xtp: input xtables_globals structure + * + * The app is expected to pass a valid xtables_globals data-filled + * with proper values + * @xtp cannot be NULL + * + * Returns -1 on failure to set and 0 on success + */ +int xtables_set_params(struct xtables_globals *xtp) +{ + if (!xtp) { + fprintf(stderr, "%s: Illegal global params\n",__func__); + return -1; + } + + xt_params = xtp; + return 0; +} + /** * xtables_afinfo - protocol family dependent information * @kmod: kernel module basename (e.g. "ip_tables") |