]> granicus.if.org Git - ipset/commitdiff
Move ipset_port_usage() into lib
authorNeutron Soutmun <neo.neutron@gmail.com>
Sun, 6 May 2012 20:18:52 +0000 (22:18 +0200)
committerJozsef Kadlecsik <kadlec@blackhole.kfki.hu>
Sun, 6 May 2012 20:18:52 +0000 (22:18 +0200)
Make_global.am
include/libipset/ui.h
lib/Makefile.am
lib/libipset.map
lib/ui.c [new file with mode: 0644]
src/ui.c

index 0e81226e21e55275469a551d18107e2b78d4ea1f..667436c96682de3bd7aff5c2dd148b77f7b7aa33 100644 (file)
@@ -68,7 +68,7 @@
 # as -version-info 2:0:0. This release has a new, but backwards incompatible
 # interface. 
 
-LIBVERSION = 2:0:0
+LIBVERSION = 2:1:0
 
 AM_CPPFLAGS = $(kinclude_CFLAGS) $(all_includes) -I$(top_srcdir)/include \
        -I/usr/local/include
index 4c9a163a6b616b474d3386f9f9e9854152667920..aa3979ffe6e41b7b2848750b18fb5feaed12818b 100644 (file)
@@ -7,6 +7,7 @@
 #ifndef LIBIPSET_UI_H
 #define LIBIPSET_UI_H
 
+#include <stdbool.h>                           /* bool */
 #include <libipset/linux_ip_set.h>             /* enum ipset_cmd */
 
 /* Commands in userspace */
index 3d4352333503b6cb7ff8b1fa6bd99af3128ddc3a..eedd99439b2d96a63a1e2d6a67b0a2748805cdf1 100644 (file)
@@ -16,6 +16,7 @@ libipset_la_SOURCES = \
        print.c \
        session.c \
        types.c \
+       ui.c \
        ipset_bitmap_ip.c \
        ipset_bitmap_ipmac.c \
        ipset_bitmap_port.c \
index 677c0552a42132e6be05e0904f6536a0c61aff1a..86bb923cb9e2bc7342ccabcee9a8bccb36b71e00 100644 (file)
@@ -106,7 +106,6 @@ global:
   ipset_match_option;
   ipset_match_envopt;
   ipset_shift_argv;
-  ipset_port_usage;
   
 local: *;
 };
@@ -114,4 +113,5 @@ local: *;
 LIBIPSET_2.0 {
 global:
   ipset_load_types;
+  ipset_port_usage;
 } LIBIPSET_1.0;
diff --git a/lib/ui.c b/lib/ui.c
new file mode 100644 (file)
index 0000000..7cb4bc2
--- /dev/null
+++ b/lib/ui.c
@@ -0,0 +1,42 @@
+/* Copyright 2007-2010 Jozsef Kadlecsik (kadlec@blackhole.kfki.hu)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#include <stdio.h>             /* printf */
+#include <libipset/icmp.h>     /* id_to_icmp */
+#include <libipset/icmpv6.h>   /* id_to_icmpv6 */
+#include <libipset/ui.h>       /* prototypes */
+
+/**
+ * ipset_port_usage - prints the usage for the port parameter
+ *
+ * Print the usage for the port parameter to stdout.
+ */
+void
+ipset_port_usage(void)
+{
+       int i;
+       const char *name;
+
+       printf("      [PROTO:]PORT is a valid pattern of the following:\n"
+              "           PORTNAME         TCP port name from /etc/services\n"
+              "           PORTNUMBER       TCP port number identifier\n"
+              "           tcp|sctp|udp|udplite:PORTNAME|PORTNUMBER\n"
+              "           icmp:CODENAME    supported ICMP codename\n"
+              "           icmp:TYPE/CODE   ICMP type/code value\n"
+              "           icmpv6:CODENAME  supported ICMPv6 codename\n"
+              "           icmpv6:TYPE/CODE ICMPv6 type/code value\n"
+              "           PROTO:0          all other protocols\n\n");
+
+       printf("           Supported ICMP codenames:\n");
+       i = 0;
+       while ((name = id_to_icmp(i++)) != NULL)
+               printf("               %s\n", name);
+       printf("           Supported ICMPv6 codenames:\n");
+       i = 0;
+       while ((name = id_to_icmpv6(i++)) != NULL)
+               printf("               %s\n", name);
+}
index d139707cf0df5c968a526ee8e10568dd350ae047..7e40bde69e13769c616a2934f02734c5774238fd 100644 (file)
--- a/src/ui.c
+++ b/src/ui.c
@@ -256,34 +256,3 @@ ipset_shift_argv(int *argc, char *argv[], int from)
        (*argc)--;
        return;
 }
-
-/**
- * ipset_port_usage - prints the usage for the port parameter
- *
- * Print the usage for the port parameter to stdout.
- */
-void
-ipset_port_usage(void)
-{
-       int i;
-       const char *name;
-
-       printf("      [PROTO:]PORT is a valid pattern of the following:\n"
-              "           PORTNAME         TCP port name from /etc/services\n"
-              "           PORTNUMBER       TCP port number identifier\n"
-              "           tcp|sctp|udp|udplite:PORTNAME|PORTNUMBER\n"
-              "           icmp:CODENAME    supported ICMP codename\n"
-              "           icmp:TYPE/CODE   ICMP type/code value\n"
-              "           icmpv6:CODENAME  supported ICMPv6 codename\n"
-              "           icmpv6:TYPE/CODE ICMPv6 type/code value\n"
-              "           PROTO:0          all other protocols\n\n");
-
-       printf("           Supported ICMP codenames:\n");
-       i = 0;
-       while ((name = id_to_icmp(i++)) != NULL)
-               printf("               %s\n", name);
-       printf("           Supported ICMPv6 codenames:\n");
-       i = 0;
-       while ((name = id_to_icmpv6(i++)) != NULL)
-               printf("               %s\n", name);
-}