summaryrefslogtreecommitdiffstats
path: root/extensions/libipt_NETMAP.c
diff options
context:
space:
mode:
author/C=EU/ST=EU/CN=Patrick McHardy/emailAddress=kaber@trash.net </C=EU/ST=EU/CN=Patrick McHardy/emailAddress=kaber@trash.net>2007-10-04 16:29:00 +0000
committer/C=EU/ST=EU/CN=Patrick McHardy/emailAddress=kaber@trash.net </C=EU/ST=EU/CN=Patrick McHardy/emailAddress=kaber@trash.net>2007-10-04 16:29:00 +0000
commitb9f8667c366415051abe9f147385bd92562701b5 (patch)
tree9777125dbd44238ad72fbfb4144736cf2339d031 /extensions/libipt_NETMAP.c
parent002261fba0ede5a039d1a65e26d2fa7a37a2f50e (diff)
[PATCH 10/13] 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 <jengelh@gmx.de>
Diffstat (limited to 'extensions/libipt_NETMAP.c')
-rw-r--r--extensions/libipt_NETMAP.c53
1 files changed, 23 insertions, 30 deletions
diff --git a/extensions/libipt_NETMAP.c b/extensions/libipt_NETMAP.c
index 62f69c5..558d557 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);
}