17static struct ec_dict *pools = NULL;
28void ip_pool_exit(
void)
33static void __ip_pool_free(
void *_pool)
35 struct ip_pool *pool = _pool;
45struct ip_pool *ip_pool(
const char *name)
47 struct ip_pool *pool = NULL;
54 pool = calloc(1,
sizeof(*pool));
59 if (pool->addrs == NULL)
62 if (
ec_dict_set(pools, name, pool, __ip_pool_free) < 0)
73struct ip_pool *ip_pool_lookup(
const char *name)
81 struct ec_dict_elt_ref *iter = NULL;
104void ip_pool_free(
const char *name)
106 struct ip_pool *pool;
116int ip_pool_addr_add(
struct ip_pool *pool,
const char *addr)
123 if (
ec_dict_set(pool->addrs, addr, NULL, NULL) < 0)
130int ip_pool_addr_del(
struct ip_pool *pool,
const char *addr)
136struct ec_strvec *ip_pool_addr_list(
const struct ip_pool *pool)
138 struct ec_dict_elt_ref *iter = NULL;
bool ec_dict_has_key(const struct ec_dict *dict, const char *key)
void ec_dict_free(struct ec_dict *dict)
struct ec_dict * ec_dict(void)
struct ec_dict_elt_ref * ec_dict_iter_next(struct ec_dict_elt_ref *iter)
void * ec_dict_get(const struct ec_dict *dict, const char *key)
const char * ec_dict_iter_get_key(const struct ec_dict_elt_ref *iter)
struct ec_dict_elt_ref * ec_dict_iter(const struct ec_dict *dict)
int ec_dict_del(struct ec_dict *dict, const char *key)
int ec_dict_set(struct ec_dict *dict, const char *key, void *val, ec_dict_elt_free_t free_cb)
void ec_strvec_free(struct ec_strvec *strvec)
struct ec_strvec * ec_strvec(void)
int ec_strvec_add(struct ec_strvec *strvec, const char *s)