Beispiel #1
0
static void rls_trace_subscription(rpc_t *rpc, void *c, rl_subscription_t *s, int details)
{
	virtual_subscription_t *vs;
	int cnt, i;
	
	switch (s->type) {
		case rls_internal_subscription:
			rpc->printf(c, "URI = %.*s", FMT_STR(*s->u.internal.record_id));
			rpc_lf(rpc, c);
			break;
		case rls_external_subscription:
			rpc->printf(c, "URI = %.*s", FMT_STR(s->u.external.record_id));
			rpc_lf(rpc, c);
			break;
	}

	cnt = ptr_vector_size(&s->vs);
	for (i = 0; i < cnt; i++) {
		vs = ptr_vector_get(&s->vs, i);
		if (!vs) continue;
		if (details > 0) trace_vs(rpc, c, vs, details - 1);
	}
	
	rpc_lf(rpc, c);
}
Beispiel #2
0
void
nsec3_load_destroy(nsec3_load_context *context)
{
    for(int i = 0; i <= ptr_vector_last_index(&context->nsec3chain); ++i)
    {
        nsec3_load_context_chain *chain = (nsec3_load_context_chain*)ptr_vector_get(&context->nsec3chain, i);
        nsec3_load_context_chain_delete(chain);
    }
    
    if(!ptr_set_avl_isempty(&context->postponed_rrsig))
    {
        ptr_set_avl_iterator iter;
        ptr_set_avl_iterator_init(&context->postponed_rrsig, &iter);
        while(ptr_set_avl_iterator_hasnext(&iter))
        {
            ptr_node *rrsig_node = ptr_set_avl_iterator_next_node(&iter);
            u8 *key = (u8*)rrsig_node->key;
            if(rrsig_node->key != NULL)
            {
                ZFREE_ARRAY(rrsig_node->key, key[0] + 1);
            }
            rrsig_node->key = NULL;
            rrsig_node->value = NULL;
        }

        ptr_set_avl_destroy(&context->postponed_rrsig);
    }
    
    context->zone = NULL;
}
Beispiel #3
0
void rls_free(rl_subscription_t *s)
{
	int i, cnt;
	virtual_subscription_t *vs;
	
	if (!s) return;

	if (use_db) rls_db_remove(s);
	
	cnt = ptr_vector_size(&s->vs);
	for (i = 0; i < cnt; i++) {
		vs = ptr_vector_get(&s->vs, i);
		if (!vs) continue;
		vs_free(vs);
	}

	if (s->type == rls_external_subscription) {
		sm_release_subscription_nolock(rls_manager, &s->u.external);
		
		/* free ONLY for external subscriptions */
		free_xcap_params_content(&s->xcap_params);
	}
	else {
		/* release_internal_subscription(s); */
		/* don't free xcap_params */
	}

	ptr_vector_destroy(&s->vs);
	str_free_content(&s->from_uid);
	mem_free(s);
}
Beispiel #4
0
static void clear_change_flags(rl_subscription_t *s)
{
	int i, cnt;
	virtual_subscription_t *vs;

	cnt = ptr_vector_size(&s->vs);
	for (i = 0; i < cnt; i++) {
		vs = ptr_vector_get(&s->vs, i);
		if (!vs) continue;
		vs->changed = 0;
	}
	s->changed = 0;
}
static notifier_domain_t *find_domain_nolock(domain_maintainer_t *dm, const str_t *name)
{
	notifier_domain_t *d = NULL;
	int i, cnt;
	
	cnt = ptr_vector_size(&dm->registered_domains);
	for (i = 0; i < cnt; i++) {
		d = ptr_vector_get(&dm->registered_domains, i);
		if (!d) continue;
		if (str_case_equals(&d->name, name) == 0) return d;
	}
	return NULL;
}
static void remove_notifier_domain(domain_maintainer_t *dm, notifier_domain_t *domain)
{
	notifier_domain_t *d = NULL;
	int i, cnt;
	
	cnt = ptr_vector_size(&dm->registered_domains);
	for (i = 0; i < cnt; i++) {
		d = ptr_vector_get(&dm->registered_domains, i);
		if (d == domain) {
			ptr_vector_remove(&dm->registered_domains, i);
			break;
		}
	}
}
Beispiel #7
0
static nsec3_load_context_chain*
nsec3_load_context_get_chain(nsec3_load_context *context, nsec3_context_record *r)
{
    // ptr_node *r_node = ptr_set_avl_insert(&context->nsec3chain, r);
    for(int i = 0; i <= ptr_vector_last_index(&context->nsec3chain); ++i)
    {
        nsec3_load_context_chain *chain = (nsec3_load_context_chain*)ptr_vector_get(&context->nsec3chain, i);
        if(nsec3_load_context_chain_matches(chain, nsec3_load_context_record_rdata(r), r->rdata_size))
        {
            return chain;
        }
    }
    
    nsec3_load_context_chain *chain = nsec3_load_context_chain_new(r);
    
    ptr_vector_append(&context->nsec3chain, chain);
    
    return chain;
}
void destroy_domain_maintainer(domain_maintainer_t *dm) 
{
	int i, cnt;
	notifier_domain_t *d;
	
	if (!dm) return;
			
	DEBUG_LOG("destroying domain maintainer\n");

	cnt = ptr_vector_size(&dm->registered_domains);
	for (i = 0; i < cnt; i++) {
		d = ptr_vector_get(&dm->registered_domains, i);
		if (!d) continue;
		if (remove_reference(&d->ref)) {
			DEBUG_LOG("freeing domain: \'%.*s\'\n", FMT_STR(d->name));
			destroy_notifier_domain(d);
		}
	}
	ptr_vector_destroy(&dm->registered_domains);
	cds_mutex_destroy(&dm->mutex);
	cds_free(dm);
}