summaryrefslogtreecommitdiffstats
path: root/ipset_portmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'ipset_portmap.c')
-rw-r--r--ipset_portmap.c40
1 files changed, 25 insertions, 15 deletions
diff --git a/ipset_portmap.c b/ipset_portmap.c
index 1d4f807..1237e52 100644
--- a/ipset_portmap.c
+++ b/ipset_portmap.c
@@ -34,14 +34,16 @@
#define OPT_ADDDEL_PORT 0x01U
/* Initialize the create. */
-void create_init(void *data)
+static void
+create_init(void *data)
{
DP("create INIT");
/* Nothing */
}
/* Function which parses command options; returns true if it ate an option */
-int create_parse(int c, char *argv[], void *data, unsigned *flags)
+static int
+create_parse(int c, char *argv[], void *data, unsigned *flags)
{
struct ip_set_req_portmap_create *mydata =
(struct ip_set_req_portmap_create *) data;
@@ -77,7 +79,8 @@ int create_parse(int c, char *argv[], void *data, unsigned *flags)
}
/* Final check; exit if not ok. */
-void create_final(void *data, unsigned int flags)
+static void
+create_final(void *data, unsigned int flags)
{
struct ip_set_req_portmap_create *mydata =
(struct ip_set_req_portmap_create *) data;
@@ -107,14 +110,15 @@ void create_final(void *data, unsigned int flags)
}
/* Create commandline options */
-static struct option create_opts[] = {
- {"from", 1, 0, '1'},
- {"to", 1, 0, '2'},
- {0}
+static const struct option create_opts[] = {
+ {.name = "from", .has_arg = required_argument, .val = '1'},
+ {.name = "to", .has_arg = required_argument, .val = '2'},
+ {NULL},
};
/* Add, del, test parser */
-ip_set_ip_t adt_parser(unsigned cmd, const char *optarg, void *data)
+static ip_set_ip_t
+adt_parser(unsigned cmd, const char *optarg, void *data)
{
struct ip_set_req_portmap *mydata =
(struct ip_set_req_portmap *) data;
@@ -129,7 +133,8 @@ ip_set_ip_t adt_parser(unsigned cmd, const char *optarg, void *data)
* Print and save
*/
-void initheader(struct set *set, const void *data)
+static void
+initheader(struct set *set, const void *data)
{
struct ip_set_req_portmap_create *header =
(struct ip_set_req_portmap_create *) data;
@@ -141,7 +146,8 @@ void initheader(struct set *set, const void *data)
map->last_port = header->to;
}
-void printheader(struct set *set, unsigned options)
+static void
+printheader(struct set *set, unsigned options)
{
struct ip_set_portmap *mysetdata =
(struct ip_set_portmap *) set->settype->header;
@@ -150,7 +156,8 @@ void printheader(struct set *set, unsigned options)
printf(" to: %s\n", port_tostring(mysetdata->last_port, options));
}
-void printports_sorted(struct set *set, void *data, size_t len, unsigned options)
+static void
+printports_sorted(struct set *set, void *data, size_t len, unsigned options)
{
struct ip_set_portmap *mysetdata =
(struct ip_set_portmap *) set->settype->header;
@@ -164,12 +171,14 @@ void printports_sorted(struct set *set, void *data, size_t len, unsigned options
}
}
-char * binding_port_tostring(struct set *set, ip_set_ip_t ip, unsigned options)
+static char *
+binding_port_tostring(struct set *set, ip_set_ip_t ip, unsigned options)
{
return port_tostring(ip, options);
}
-void saveheader(struct set *set, unsigned options)
+static void
+saveheader(struct set *set, unsigned options)
{
struct ip_set_portmap *mysetdata =
(struct ip_set_portmap *) set->settype->header;
@@ -182,7 +191,8 @@ void saveheader(struct set *set, unsigned options)
port_tostring(mysetdata->last_port, options));
}
-void saveports(struct set *set, void *data, size_t len, unsigned options)
+static void
+saveports(struct set *set, void *data, size_t len, unsigned options)
{
struct ip_set_portmap *mysetdata =
(struct ip_set_portmap *) set->settype->header;
@@ -197,7 +207,7 @@ void saveports(struct set *set, void *data, size_t len, unsigned options)
}
}
-void usage(void)
+static void usage(void)
{
printf
("-N set portmap --from PORT --to PORT\n"