aboutsummaryrefslogtreecommitdiffstats
path: root/radix-trie.h
diff options
context:
space:
mode:
authorThomas Gschwantner <tharre3@gmail.com>2019-09-28 19:53:53 +0200
committerThomas Gschwantner <tharre3@gmail.com>2019-12-11 06:22:17 +0100
commitadeaad2b73ceadb795e6ca7b95a33aa00cd67c02 (patch)
tree399a6fb38898ffd0a748676fbe73fb467d383350 /radix-trie.h
parentFix random_bounded() to always be in [0, bound) (diff)
downloadwg-dynamic-adeaad2b73ceadb795e6ca7b95a33aa00cd67c02.tar.xz
wg-dynamic-adeaad2b73ceadb795e6ca7b95a33aa00cd67c02.zip
Rename struct ip_pool to be more descriptive
Diffstat (limited to '')
-rw-r--r--radix-trie.h37
1 files changed, 19 insertions, 18 deletions
diff --git a/radix-trie.h b/radix-trie.h
index a72ee50..4fa909b 100644
--- a/radix-trie.h
+++ b/radix-trie.h
@@ -10,37 +10,38 @@
#include <stdbool.h>
#include <stdint.h>
-struct ip_pool {
+struct ipns {
+ /* Total amount of available addresses over all pools */
uint64_t totall_ipv6;
uint32_t totalh_ipv6, total_ipv4;
+
struct radix_node *ip4_root, *ip6_root;
- struct radix_pool *ip4_pool, *ip6_pool;
+ struct radix_pool *ip4_pools, *ip6_pools;
};
-void ipp_init(struct ip_pool *pool);
-void ipp_free(struct ip_pool *pool);
+void ipp_init(struct ipns *ns);
+void ipp_free(struct ipns *ns);
-int ipp_add_v4(struct ip_pool *pool, const struct in_addr *ip, uint8_t cidr);
-int ipp_add_v6(struct ip_pool *pool, const struct in6_addr *ip, uint8_t cidr);
+int ipp_add_v4(struct ipns *ns, const struct in_addr *ip, uint8_t cidr);
+int ipp_add_v6(struct ipns *ns, const struct in6_addr *ip, uint8_t cidr);
-int ipp_del_v4(struct ip_pool *pool, const struct in_addr *ip, uint8_t cidr);
-int ipp_del_v6(struct ip_pool *pool, const struct in6_addr *ip, uint8_t cidr);
+int ipp_del_v4(struct ipns *ns, const struct in_addr *ip, uint8_t cidr);
+int ipp_del_v6(struct ipns *ns, const struct in6_addr *ip, uint8_t cidr);
-void ipp_addnth_v4(struct ip_pool *pool, struct in_addr *dest, uint32_t index);
-void ipp_addnth_v6(struct ip_pool *pool, struct in6_addr *dest,
- uint32_t index_low, uint64_t index_high);
+void ipp_addnth_v4(struct ipns *ns, struct in_addr *dest, uint32_t index);
+void ipp_addnth_v6(struct ipns *ns, struct in6_addr *dest, uint32_t index_low,
+ uint64_t index_high);
-int ipp_addpool_v4(struct ip_pool *ipp, const struct in_addr *ip, uint8_t cidr);
-int ipp_addpool_v6(struct ip_pool *ipp, const struct in6_addr *ip,
- uint8_t cidr);
+int ipp_addpool_v4(struct ipns *ns, const struct in_addr *ip, uint8_t cidr);
+int ipp_addpool_v6(struct ipns *ns, const struct in6_addr *ip, uint8_t cidr);
-int ipp_removepool_v4(struct ip_pool *pool, const struct in_addr *ip);
-int ipp_removepool_v6(struct ip_pool *pool, const struct in6_addr *ip);
+int ipp_removepool_v4(struct ipns *ns, const struct in_addr *ip);
+int ipp_removepool_v6(struct ipns *ns, const struct in6_addr *ip);
#ifdef DEBUG
void node_to_str(struct radix_node *node, char *buf, uint8_t bits);
-void debug_print_trie_v4(struct ip_pool *pool);
-void debug_print_trie_v6(struct ip_pool *pool);
+void debug_print_trie_v4(struct ipns *ns);
+void debug_print_trie_v6(struct ipns *ns);
#endif
#endif