From 2e0ec4fa0fb5162c441cd666f55fe76777e40d5e Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Sun, 6 Mar 2011 16:24:43 +0100 Subject: libxtables: linked-list name<->id map This consolidates the maps from libxt_devgroup and libxt_realm. Signed-off-by: Jan Engelhardt --- include/xtables.h.in | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'include/xtables.h.in') diff --git a/include/xtables.h.in b/include/xtables.h.in index c361bdbd..30d9e73b 100644 --- a/include/xtables.h.in +++ b/include/xtables.h.in @@ -134,6 +134,16 @@ struct xt_fcheck_call { unsigned int xflags; }; +/** + * A "linear"/linked-list based name<->id map, for files similar to + * /etc/iproute2/. + */ +struct xtables_lmap { + char *name; + int id; + struct xtables_lmap *next; +}; + /* Include file for additions: new matches and targets. */ struct xtables_match { @@ -418,6 +428,11 @@ extern void xtables_option_mfcall(struct xtables_match *); extern void xtables_options_fcheck(const char *, unsigned int, const struct xt_option_entry *); +extern struct xtables_lmap *xtables_lmap_init(const char *); +extern void xtables_lmap_free(struct xtables_lmap *); +extern int xtables_lmap_name2id(const struct xtables_lmap *, const char *); +extern const char *xtables_lmap_id2name(const struct xtables_lmap *, int); + #ifdef XTABLES_INTERNAL /* Shipped modules rely on this... */ -- cgit v1.2.3