Lines Matching refs:tcl
53 struct tcl_list* tcl = (struct tcl_list*)calloc(1, in tcl_list_create() local
55 if(!tcl) in tcl_list_create()
57 tcl->region = regional_create(); in tcl_list_create()
58 if(!tcl->region) { in tcl_list_create()
59 tcl_list_delete(tcl); in tcl_list_create()
62 return tcl; in tcl_list_create()
76 tcl_list_delete(struct tcl_list* tcl) in tcl_list_delete() argument
78 if(!tcl) in tcl_list_delete()
80 traverse_postorder(&tcl->tree, tcl_list_free_node, NULL); in tcl_list_delete()
81 regional_destroy(tcl->region); in tcl_list_delete()
82 free(tcl); in tcl_list_delete()
87 tcl_list_insert(struct tcl_list* tcl, struct sockaddr_storage* addr, in tcl_list_insert() argument
91 struct tcl_addr* node = regional_alloc_zero(tcl->region, in tcl_list_insert()
97 if(!addr_tree_insert(&tcl->tree, &node->node, addr, addrlen, net)) { in tcl_list_insert()
106 tcl_list_str_cfg(struct tcl_list* tcl, const char* str, const char* s2, in tcl_list_str_cfg() argument
122 if(!tcl_list_insert(tcl, &addr, addrlen, net, limit, in tcl_list_str_cfg()
132 read_tcl_list(struct tcl_list* tcl, struct config_file* cfg) in read_tcl_list() argument
137 if(!tcl_list_str_cfg(tcl, p->str, p->str2, 1)) in read_tcl_list()
144 tcl_list_apply_cfg(struct tcl_list* tcl, struct config_file* cfg) in tcl_list_apply_cfg() argument
146 regional_free_all(tcl->region); in tcl_list_apply_cfg()
147 addr_tree_init(&tcl->tree); in tcl_list_apply_cfg()
148 if(!read_tcl_list(tcl, cfg)) in tcl_list_apply_cfg()
150 addr_tree_init_parents(&tcl->tree); in tcl_list_apply_cfg()
155 tcl_new_connection(struct tcl_addr* tcl) in tcl_new_connection() argument
157 if(tcl) { in tcl_new_connection()
159 lock_quick_lock(&tcl->lock); in tcl_new_connection()
160 if(tcl->count >= tcl->limit) in tcl_new_connection()
163 tcl->count++; in tcl_new_connection()
164 lock_quick_unlock(&tcl->lock); in tcl_new_connection()
171 tcl_close_connection(struct tcl_addr* tcl) in tcl_close_connection() argument
173 if(tcl) { in tcl_close_connection()
174 lock_quick_lock(&tcl->lock); in tcl_close_connection()
175 log_assert(tcl->count > 0); in tcl_close_connection()
176 tcl->count--; in tcl_close_connection()
177 lock_quick_unlock(&tcl->lock); in tcl_close_connection()
182 tcl_addr_lookup(struct tcl_list* tcl, struct sockaddr_storage* addr, in tcl_addr_lookup() argument
185 return (struct tcl_addr*)addr_tree_lookup(&tcl->tree, in tcl_addr_lookup()
190 tcl_list_get_mem(struct tcl_list* tcl) in tcl_list_get_mem() argument
192 if(!tcl) return 0; in tcl_list_get_mem()
193 return sizeof(*tcl) + regional_get_mem(tcl->region); in tcl_list_get_mem()