ubus: store rule origin as comment
[project/firewall3.git] / xtables-10.h
index 6b52fff..aeb67d7 100644 (file)
 #ifndef __FW3_XTABLES_10_H
 #define __FW3_XTABLES_10_H
 
+extern struct xtables_match *xtables_pending_matches;
+extern struct xtables_target *xtables_pending_targets;
+
+static inline void
+fw3_xt_reset(void)
+{
+       xtables_matches = NULL;
+       xtables_targets = NULL;
+
+       xtables_pending_matches = NULL;
+       xtables_pending_targets = NULL;
+}
+
+
 static inline const char *
 fw3_xt_get_match_name(struct xtables_match *m)
 {
@@ -111,4 +125,32 @@ fw3_xt_merge_target_options(struct xtables_globals *g, struct xtables_target *t)
                                                t->extra_opts, &t->option_offset);
 }
 
+static inline void
+fw3_xt_print_matches(void *ip, struct xtables_rule_match *matches)
+{
+       struct xtables_rule_match *rm;
+       struct xtables_match *m;
+
+       for (rm = matches; rm; rm = rm->next)
+       {
+               m = rm->match;
+               printf(" -m %s", fw3_xt_get_match_name(m));
+
+               if (m->save)
+                       m->save(ip, m->m);
+       }
+}
+
+static inline void
+fw3_xt_print_target(void *ip, struct xtables_target *target)
+{
+       if (target)
+       {
+               printf(" -j %s", fw3_xt_get_target_name(target));
+
+               if (target->save)
+                       target->save(ip, target->t);
+       }
+}
+
 #endif