diff options
author | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2012-01-05 21:30:20 +0100 |
---|---|---|
committer | Jozsef Kadlecsik <kadlec@blackhole.kfki.hu> | 2012-01-05 21:30:20 +0100 |
commit | e57d6caa8ddbe268adea991bcf6e58dc6ca43389 (patch) | |
tree | 187e09fd0bcb6d4e536a7aa27e4f4c6976c622be /lib/types.c | |
parent | f4b2c3b617333b5a0f359edccc9a9be34d9f36bd (diff) |
Set types moved into libipset library
The libipset library is complete by this step, and "ipset" just
a CLI interface based on the lib.
Diffstat (limited to 'lib/types.c')
-rw-r--r-- | lib/types.c | 44 |
1 files changed, 44 insertions, 0 deletions
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 <libipset/utils.h> /* STREQ */ #include <libipset/types.h> /* 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 |