From e57d6caa8ddbe268adea991bcf6e58dc6ca43389 Mon Sep 17 00:00:00 2001 From: Jozsef Kadlecsik Date: Thu, 5 Jan 2012 21:30:20 +0100 Subject: Set types moved into libipset library The libipset library is complete by this step, and "ipset" just a CLI interface based on the lib. --- lib/types.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) (limited to 'lib/types.c') diff --git a/lib/types.c b/lib/types.c index e93b4bd..0b5826e 100644 --- a/lib/types.c +++ b/lib/types.c @@ -19,6 +19,22 @@ #include /* STREQ */ #include /* prototypes */ +/* The known set types: (typename, revision, family) is unique */ +extern struct ipset_type ipset_bitmap_ip0; +extern struct ipset_type ipset_bitmap_ipmac0; +extern struct ipset_type ipset_bitmap_port0; +extern struct ipset_type ipset_hash_ip0; +extern struct ipset_type ipset_hash_net0; +extern struct ipset_type ipset_hash_net1; +extern struct ipset_type ipset_hash_netport1; +extern struct ipset_type ipset_hash_netport2; +extern struct ipset_type ipset_hash_netiface0; +extern struct ipset_type ipset_hash_ipport1; +extern struct ipset_type ipset_hash_ipportip1; +extern struct ipset_type ipset_hash_ipportnet1; +extern struct ipset_type ipset_hash_ipportnet2; +extern struct ipset_type ipset_list_set0; + /* Userspace cache of sets which exists in the kernel */ struct ipset { @@ -554,3 +570,31 @@ ipset_cache_fini(void) free(set); } } + +/** + * ipset_load_types - load known set types + * + * Load in (register) all known set types for the system + */ + void + ipset_load_types(void) + { + if (typelist != NULL) + return; + + ipset_type_add(&ipset_bitmap_ip0); + ipset_type_add(&ipset_bitmap_ipmac0); + ipset_type_add(&ipset_bitmap_port0); + ipset_type_add(&ipset_hash_ip0); + ipset_type_add(&ipset_hash_net0); + ipset_type_add(&ipset_hash_net1); + ipset_type_add(&ipset_hash_netport1); + ipset_type_add(&ipset_hash_netport2); + ipset_type_add(&ipset_hash_netiface0); + ipset_type_add(&ipset_hash_ipport1); + ipset_type_add(&ipset_hash_ipportip1); + ipset_type_add(&ipset_hash_ipportnet1); + ipset_type_add(&ipset_hash_ipportnet2); + ipset_type_add(&ipset_list_set0); +} + \ No newline at end of file -- cgit v1.2.3