From 1d5b63d12984d12c8d87242179855e17657be16d Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Thu, 4 Oct 2007 16:29:00 +0000 Subject: Unique names 4/6 Give symbols of libxt targets unique names (2/3). Adds unique prefixes to all functions (most of them - especially the hook functions) so that debugging programs can unambiguously map a symbol to an address. Also unifies the names of the xtables_match/xtables_target structs, (based upon libxt_connmark.c/libip6t_*.c). Signed-off-by: Jan Engelhardt --- extensions/libipt_NETMAP.c | 53 ++++++++++++++++++++-------------------------- 1 file changed, 23 insertions(+), 30 deletions(-) (limited to 'extensions/libipt_NETMAP.c') diff --git a/extensions/libipt_NETMAP.c b/extensions/libipt_NETMAP.c index 62f69c58..558d5579 100644 --- a/extensions/libipt_NETMAP.c +++ b/extensions/libipt_NETMAP.c @@ -13,19 +13,18 @@ #define MODULENAME "NETMAP" -static const struct option opts[] = { +static const struct option NETMAP_opts[] = { { "to", 1, NULL, '1' }, { } }; /* Function which prints out usage message. */ -static void -help(void) +static void NETMAP_help(void) { printf(MODULENAME" v%s options:\n" " --%s address[/mask]\n" " Network address to map to.\n\n", - IPTABLES_VERSION, opts[0].name); + IPTABLES_VERSION, NETMAP_opts[0].name); } static u_int32_t @@ -55,8 +54,7 @@ netmask2bits(u_int32_t netmask) } /* Initialize the target. */ -static void -init(struct xt_entry_target *t) +static void NETMAP_init(struct xt_entry_target *t) { struct ip_nat_multi_range *mr = (struct ip_nat_multi_range *)t->data; @@ -116,10 +114,8 @@ parse_to(char *arg, struct ip_nat_range *range) /* Function which parses command options; returns true if it ate an option */ -static int -parse(int c, char **argv, int invert, unsigned int *flags, - const void *entry, - struct xt_entry_target **target) +static int NETMAP_parse(int c, char **argv, int invert, unsigned int *flags, + const void *entry, struct xt_entry_target **target) { struct ip_nat_multi_range *mr = (struct ip_nat_multi_range *)(*target)->data; @@ -128,7 +124,7 @@ parse(int c, char **argv, int invert, unsigned int *flags, case '1': if (check_inverse(optarg, &invert, NULL, 0)) exit_error(PARAMETER_PROBLEM, - "Unexpected `!' after --%s", opts[0].name); + "Unexpected `!' after --%s", NETMAP_opts[0].name); parse_to(optarg, &mr->range[0]); *flags = 1; @@ -140,18 +136,16 @@ parse(int c, char **argv, int invert, unsigned int *flags, } /* Final check; need --to */ -static void final_check(unsigned int flags) +static void NETMAP_check(unsigned int flags) { if (!flags) exit_error(PARAMETER_PROBLEM, - MODULENAME" needs --%s", opts[0].name); + MODULENAME" needs --%s", NETMAP_opts[0].name); } /* Prints out the targinfo. */ -static void -print(const void *ip, - const struct xt_entry_target *target, - int numeric) +static void NETMAP_print(const void *ip, const struct xt_entry_target *target, + int numeric) { struct ip_nat_multi_range *mr = (struct ip_nat_multi_range *)target->data; @@ -170,29 +164,28 @@ print(const void *ip, } /* Saves the targinfo in parsable form to stdout. */ -static void -save(const void *ip, const struct xt_entry_target *target) +static void NETMAP_save(const void *ip, const struct xt_entry_target *target) { - printf("--%s ", opts[0].name); - print(ip, target, 0); + printf("--%s ", NETMAP_opts[0].name); + NETMAP_print(ip, target, 0); } -static struct iptables_target target_module = { +static struct iptables_target netmap_target = { .name = MODULENAME, .version = IPTABLES_VERSION, .size = IPT_ALIGN(sizeof(struct ip_nat_multi_range)), .userspacesize = IPT_ALIGN(sizeof(struct ip_nat_multi_range)), - .help = &help, - .init = &init, - .parse = &parse, - .final_check = &final_check, - .print = &print, - .save = &save, - .extra_opts = opts + .help = NETMAP_help, + .init = NETMAP_init, + .parse = NETMAP_parse, + .final_check = NETMAP_check, + .print = NETMAP_print, + .save = NETMAP_save, + .extra_opts = NETMAP_opts, }; void _init(void) { - register_target(&target_module); + register_target(&netmap_target); } -- cgit v1.2.3