]> git.ipfire.org Git - thirdparty/iptables.git/commitdiff
xtables: add multi-registration functions
authorJan Engelhardt <jengelh@medozas.de>
Thu, 25 Jun 2009 15:13:46 +0000 (17:13 +0200)
committerJan Engelhardt <jengelh@medozas.de>
Fri, 26 Jun 2009 19:13:10 +0000 (21:13 +0200)
Similar to the ones that are present in the kernel.

Signed-off-by: Jan Engelhardt <jengelh@medozas.de>
include/xtables.h.in
xtables.c

index 037fae19c738b1f2ed02ff07a06b3d71cc072149..222e2a9f2d8d3908fef65cf1a0b7a9d592f08e43 100644 (file)
@@ -233,7 +233,9 @@ extern struct xtables_target *xtables_find_target(const char *name,
 
 /* Your shared library should call one of these. */
 extern void xtables_register_match(struct xtables_match *me);
+extern void xtables_register_matches(struct xtables_match *, unsigned int);
 extern void xtables_register_target(struct xtables_target *me);
+extern void xtables_register_targets(struct xtables_target *, unsigned int);
 
 extern bool xtables_strtoul(const char *, char **, unsigned long *,
        unsigned long, unsigned long);
index 05154dd8c1f92741a88b160f1fdf8437b81f9582..1ff6e82b19285b0cf43d6c9b6e91d7313a349554 100644 (file)
--- a/xtables.c
+++ b/xtables.c
@@ -794,6 +794,13 @@ void xtables_register_match(struct xtables_match *me)
        me->mflags = 0;
 }
 
+void xtables_register_matches(struct xtables_match *match, unsigned int n)
+{
+       do {
+               xtables_register_match(&match[--n]);
+       } while (n > 0);
+}
+
 void xtables_register_target(struct xtables_target *me)
 {
        struct xtables_target *old;
@@ -868,6 +875,13 @@ void xtables_register_target(struct xtables_target *me)
        me->tflags = 0;
 }
 
+void xtables_register_targets(struct xtables_target *target, unsigned int n)
+{
+       do {
+               xtables_register_target(&target[--n]);
+       } while (n > 0);
+}
+
 /**
  * xtables_param_act - act on condition
  * @status:    a constant from enum xtables_exittype