From de4d2d3b716d83a6d3831aaf902c5adb5d1d14c9 Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sat, 27 Aug 2011 12:50:32 +0200 Subject: libiptc: use a family-invariant xtc_ops struct for code reduction Signed-off-by: Jan Engelhardt --- include/libiptc/libip6tc.h | 2 ++ include/libiptc/libiptc.h | 2 ++ include/libiptc/xtcshared.h | 13 +++++++++++++ 3 files changed, 17 insertions(+) (limited to 'include') diff --git a/include/libiptc/libip6tc.h b/include/libiptc/libip6tc.h index 61c1e7f5..c656bc43 100644 --- a/include/libiptc/libip6tc.h +++ b/include/libiptc/libip6tc.h @@ -159,4 +159,6 @@ int ipv6_prefix_length(const struct in6_addr *a); extern void dump_entries6(struct xtc_handle *const); +extern const struct xtc_ops ip6tc_ops; + #endif /* _LIBIP6TC_H */ diff --git a/include/libiptc/libiptc.h b/include/libiptc/libiptc.h index 6f64f5a9..24cdbdb7 100644 --- a/include/libiptc/libiptc.h +++ b/include/libiptc/libiptc.h @@ -162,6 +162,8 @@ const char *iptc_strerror(int err); extern void dump_entries(struct xtc_handle *const); +extern const struct xtc_ops iptc_ops; + #ifdef __cplusplus } #endif diff --git a/include/libiptc/xtcshared.h b/include/libiptc/xtcshared.h index 89a51511..773ebc4c 100644 --- a/include/libiptc/xtcshared.h +++ b/include/libiptc/xtcshared.h @@ -3,5 +3,18 @@ typedef char xt_chainlabel[32]; struct xtc_handle; +struct xt_counters; + +struct xtc_ops { + int (*commit)(struct xtc_handle *); + void (*free)(struct xtc_handle *); + int (*builtin)(const char *, struct xtc_handle *const); + int (*is_chain)(const char *, struct xtc_handle *const); + int (*flush_entries)(const xt_chainlabel, struct xtc_handle *); + int (*create_chain)(const xt_chainlabel, struct xtc_handle *); + int (*set_policy)(const xt_chainlabel, const xt_chainlabel, + struct xt_counters *, struct xtc_handle *); + const char *(*strerror)(int); +}; #endif /* _LIBXTC_SHARED_H */ -- cgit v1.2.3