/** Destroy sink object. @param[in] sink pointer of sink to destroy. */ void vqec_sink_destroy (vqec_sink_t * sink) { if (!sink) { return; } MCALL(sink, vqec_sink_flush); #ifdef HAVE_SCHED_JITTER_HISTOGRAM zone_release(s_inp_delay_hist_pool, sink->inp_delay_hist); zone_release(s_reader_hist_pool, sink->reader_jitter_hist); #endif /* HAVE_SCHED_JITTER_HISTOGRAM */ zone_release(s_vqec_sink_pool, sink); }
/** * Deinitialize the graph module. * * NOTE: Graph instances must be destroyed individually by their creators * before this call is made, or else the pointers to these instances * will be lost. */ void vqec_dp_graph_deinit_module (void) { int i; /* destroy any remaining allocations in graph pool */ for (i = 0; i < graph_index; i++) { if (s_graph_cache[i]) { vqec_dp_graph_destroy(s_graph_cache[i]->id); } } /* deinitialize id_mgr table */ vqec_dp_graph_deinit_id_table(); /* dealloc resource zone */ if (s_vqec_graph_pool) { (void) zone_instance_put(s_vqec_graph_pool); s_vqec_graph_pool = NULL; } /* release and dealloc graph cache zone */ if (s_graph_cache) { zone_release(s_graph_cache_pool, s_graph_cache); s_graph_cache = NULL; } if (s_graph_cache_pool) { (void)zone_instance_put(s_graph_cache_pool); s_graph_cache_pool = NULL; } }
static void* database_service_zone_unload_thread(void *parms) { database_service_zone_unload_parms_s *database_service_zone_unload_parms = (database_service_zone_unload_parms_s*)parms; zdb_zone *zone = database_service_zone_unload_parms->zone; u8 origin[MAX_DOMAIN_LENGTH]; if(zone->origin != NULL) { dnsname_copy(origin, zone->origin); } else { memcpy(origin, "\004NULL", 6); } log_debug("database-service: %{dnsname}: releasing old instance of zone", origin); log_debug7("database-service: %{dnsname}: rc=%i", origin, zone->rc); zdb_zone_release(zone); zone = NULL; zdb_zone_garbage_run(); zone_release(database_service_zone_unload_parms->zone_desc); free(database_service_zone_unload_parms); return NULL; }
/** * vqec_pak_hdr_free() * * Releases a packet header structure back to its pool of origin * * @param[in] hdr Packet header to free */ void vqec_pak_hdr_free (vqec_pak_hdr_t *hdr) { if (!hdr || (hdr->pool != VQEC_PAK_HDR_POOLID)) { return; } /* Release the hdr */ zone_release(s_pak_hdr_pool, hdr); }
void rtcp_delete_object(rtcp_memory_t *memory, rtcp_mem_obj_t type, void *object) { if (!memory) { return; } if (!(type >= RTCP_MIN_OBJ && type <= RTCP_MAX_OBJ)) { return; } zone_release(memory->pool[type].zone, object); memory->pool[type].pool_stats.allocations--; memory->allocated -= zm_elem_size(memory->pool[type].zone); }
static ya_result config_section_zone_finalise(struct config_section_descriptor_s *csd) { if(csd != NULL) { if(csd->base != NULL) { zone_desc_s *zone_desc = (zone_desc_s*)csd->base; zone_release(zone_desc); #ifdef DEBUG csd->base = NULL; #endif } free(csd); } return SUCCESS; }
/** * Delete a channel from a flowgraph. If this is the only channel * mapped to a flowgraph, the flowgraph is deleted as well. */ vqec_dp_error_t vqec_dp_graph_destroy (vqec_dp_graphid_t id) { vqec_dp_graph_t *graph; /* get pointer from id_mgr */ graph = vqec_dp_graph_id_to_graph(id); if (!graph) { return VQEC_DP_ERR_INVALIDARGS; } /* destroy any existing components in the graph */ vqec_dp_graph_deinit(graph); /* remove handle from id_mgr */ id_delete(id, vqec_dp_graph_id_table_key); zone_release(s_vqec_graph_pool, graph); graph_index--; s_graph_cache[graph_index] = NULL; return VQEC_DP_ERR_OK; }
static ya_result config_section_zone_stop(struct config_section_descriptor_s *csd) { #if CONFIG_SETTINGS_DEBUG formatln("config: section: zone: stop"); #endif // NOP zone_desc_s *zone_desc = (zone_desc_s*)csd->base; ya_result return_code; // ensure the descriptor is valid if(ISOK(return_code = zone_complete_settings(zone_desc))) { zone_setdefaults(zone_desc); if(logger_is_running()) { log_debug("config: %{dnsname}: zone section parsed", zone_desc->origin); } // load the descriptor (most likely offline) if(config_section_zone_filter(zone_desc, config_section_zone_filter_params) == 1) { if(logger_is_running()) { log_debug("config: %{dnsname}: sending zone to service", zone_desc->origin); } database_zone_desc_load(zone_desc); } else { zone_desc_s *current_zone_desc = zone_acquirebydnsname(zone_desc->origin); if(current_zone_desc != NULL) { if(logger_is_running()) { log_debug("config: %{dnsname}: clearing original zone drop status", zone_desc->origin); } zone_lock(current_zone_desc, ZONE_LOCK_REPLACE_DESC); zone_clear_status(current_zone_desc, ZONE_STATUS_DROP_AFTER_RELOAD); zone_unlock(current_zone_desc, ZONE_LOCK_REPLACE_DESC); zone_release(current_zone_desc); } zone_release(zone_desc); } } else { zone_release(zone_desc); } csd->base = NULL; return return_code; }
/*! * \brief free all the game related structures */ void PurgeWorld(void) { zone_release(lz_end); }
/** Create sink object. @return pointer of sink allocated. */ vqec_sink_t * vqec_sink_create (uint32_t max_q_depth, uint32_t max_paksize) { vqec_sink_t * sink; sink = (vqec_sink_t *) zone_acquire(s_vqec_sink_pool); if (!sink) { return (NULL); } memset(sink, 0, sizeof(vqec_sink_t)); sink->__func_table = &vqec_sink_fcn_table; #ifdef HAVE_SCHED_JITTER_HISTOGRAM sink->reader_jitter_hist = zone_acquire(s_reader_hist_pool); if (!sink->reader_jitter_hist) { zone_release(s_vqec_sink_pool, sink); return (NULL); } if (vam_hist_create_ranges(sink->reader_jitter_hist, s_reader_jitter_ranges, s_reader_jitter_num_ranges, "Reader exit-to-enter jitter")) { zone_release(s_reader_hist_pool, sink->reader_jitter_hist); zone_release(s_vqec_sink_pool, sink); return (NULL); } sink->inp_delay_hist = zone_acquire(s_inp_delay_hist_pool); if (!sink->inp_delay_hist) { zone_release(s_reader_hist_pool, sink->reader_jitter_hist); zone_release(s_vqec_sink_pool, sink); return (NULL); } if (vam_hist_create_ranges(sink->inp_delay_hist, s_inp_delay_ranges, s_inp_delay_num_ranges, "Input jitter")) { zone_release(s_inp_delay_hist_pool, sink->inp_delay_hist); zone_release(s_reader_hist_pool, sink->reader_jitter_hist); zone_release(s_vqec_sink_pool, sink); return (NULL); } #endif /* HAVE_SCHED_JITTER_HISTOGRAM */ VQE_TAILQ_INIT(&sink->pak_queue); sink->hdr_pool = s_pak_hdr_poolid; sink->queue_size = max_q_depth; sink->max_paksize = max_paksize; return sink; }
/** * Build the flowgraph for the given channel descriptor. A new * graph may be built, or an existing flowgraph may be used. A new * graph is built per channel unless SSRC multiplexing is in use. * The flow of data through the graph is started, once the graph * has been built within the context of this call. The identifier of * the flowgraph which contains the channel is returned in *id. */ vqec_dp_error_t vqec_dp_graph_create (vqec_dp_chan_desc_t *chan, vqec_dp_tunerid_t tid, vqec_dp_encap_type_t tuner_encap, vqec_dp_graphinfo_t *graphinfo) { vqec_dp_graph_t *graph; vqec_dp_graphid_t id; vqec_dp_error_t ret = VQEC_DP_ERR_OK; if (!chan) { return VQEC_DP_ERR_INVALIDARGS; } /* if the graph doesn't already exist, create a new one */ graph = (vqec_dp_graph_t *) zone_acquire(s_vqec_graph_pool); if (!graph || (graph_index == s_graphs_max)) { id = VQEC_DP_GRAPHID_INVALID; ret = VQEC_DP_ERR_NOMEM; goto bail; } s_graph_cache[graph_index] = graph; graph_index++; memset(graph, 0, sizeof(vqec_dp_graph_t)); /* * Register graph in id_mgr - must have a channel id at time of * channel init. */ id = id_get(graph, vqec_dp_graph_id_table_key); if (id == VQEC_DP_GRAPHID_INVALID) { ret = VQEC_DP_ERR_NOMEM; goto bail; } graph->id = id; /* initialize graph and build all components */ if (vqec_dp_graph_init(graph, chan, graphinfo) != VQEC_DP_ERR_OK) { VQEC_DP_SYSLOG_PRINT(ERROR, "graph initialization failed"); ret = VQEC_DP_ERR_NOMEM; goto bail; } /* add_tuner() to the graph */ if (vqec_dp_graph_add_tuner(graph->id, tid) != VQEC_DP_ERR_OK) { VQEC_DP_SYSLOG_PRINT(ERROR, "graph add_tuner failed"); ret = VQEC_DP_ERR_NOMEM; goto bail; } /* cache channel info inside the tuner */ vqec_dp_output_shim_tuner_cache_channel(tid, chan); /* make IS-OS connections */ if (vqec_dp_graph_connect(graph, chan->fallback) != VQEC_DP_ERR_OK) { VQEC_DP_SYSLOG_PRINT(ERROR, "graph connection failed"); ret = VQEC_DP_ERR_NOMEM; goto bail; } return VQEC_DP_ERR_OK; bail: if (id != VQEC_DP_GRAPHID_INVALID) { vqec_dp_graph_destroy(id); id = VQEC_DP_GRAPHID_INVALID; } else if (graph) { zone_release(s_vqec_graph_pool, graph); s_graph_cache[graph_index] = NULL; graph_index--; } return ret; }
void database_load_zone_desc(zone_desc_s *zone_desc) { yassert(zone_desc != NULL); log_debug1("database_load_zone_desc(%{dnsname}@%p=%i)", zone_desc->origin, zone_desc, zone_desc->rc); s32 err = zone_register(&database_zone_desc, zone_desc); if(ISOK(err)) { log_info("zone: %{dnsname}: %p: config: registered", zone_desc->origin, zone_desc); zone_lock(zone_desc, ZONE_LOCK_LOAD_DESC); zone_set_status(zone_desc, ZONE_STATUS_REGISTERED); zone_clear_status(zone_desc, ZONE_STATUS_DROP_AFTER_RELOAD); zone_unlock(zone_desc, ZONE_LOCK_LOAD_DESC); // newly registered zone // used to be message->origin if(database_service_started()) { database_zone_load(zone_desc->origin); // before this I should set the file name #if HAS_MASTER_SUPPORT if(zone_desc->type == ZT_MASTER) { if(!host_address_empty(zone_desc->slaves)) { log_info("zone: %{dnsname}: %p: config: notifying slaves", zone_desc->origin, zone_desc); host_address *slaves = host_address_copy_list(zone_desc->slaves); notify_host_list(zone_desc, slaves, CLASS_CTRL); } } else #endif { } } } else { switch(err) { case DATABASE_ZONE_MISSING_DOMAIN: { log_err("zone: ?: %p: config: no domain set (not loaded)", zone_desc); if(zone_get_status(zone_desc) & ZONE_STATUS_PROCESSING) { log_err("zone: ?: %p: is processed by %s (releasing)", zone_desc, database_service_operation_get_name(zone_desc->last_processor)); } zone_release(zone_desc); break; } case DATABASE_ZONE_MISSING_MASTER: { log_err("zone: %{dnsname}: %p: config: slave but no master setting (not loaded)", zone_desc->origin, zone_desc); if(zone_get_status(zone_desc) & ZONE_STATUS_PROCESSING) { log_err("zone: ?: %p: is processed by %s (releasing)", zone_desc, database_service_operation_get_name(zone_desc->last_processor)); } zone_release(zone_desc); break; } case DATABASE_ZONE_CONFIG_CLONE: // Exact copy { log_debug("zone: %{dnsname}: %p: config: has already been set (same settings)", zone_desc->origin, zone_desc); zone_desc_s* current = zone_acquirebydnsname(zone_desc->origin); zone_lock(current, ZONE_LOCK_REPLACE_DESC); zone_clear_status(current, ZONE_STATUS_DROP_AFTER_RELOAD); zone_unlock(current, ZONE_LOCK_REPLACE_DESC); zone_release(current); // whatever has been decided above, loading the zone file (if it changed) should be queued database_zone_load(zone_desc->origin); zone_release(zone_desc); break; } case DATABASE_ZONE_CONFIG_DUP: // Not an exact copy { log_debug("zone: %{dnsname}: %p: config: has already been set (different settings)", zone_desc->origin, zone_desc); // basically, most of the changes require a stop, restart of // any task linked to the zone // so let's make this a rule, whatever changed notify_clear(zone_desc->origin); zone_desc_s *current = zone_acquirebydnsname(zone_desc->origin); #if HAS_DYNAMIC_PROVISIONING host_address *notify_slaves_then_delete = NULL; host_address *notify_slaves = NULL; #endif if(current != zone_desc) { zone_lock(current, ZONE_LOCK_REPLACE_DESC); if(zone_get_status(current) & ZONE_STATUS_PROCESSING) { log_err("zone: ?: %p: is processed by %s (overwriting)", zone_desc, database_service_operation_get_name(zone_desc->last_processor)); } // what happens if the change is on : // domain: impossible /// @todo 20131203 edf -- compare before replace // file_name : try to load the new file (will happen anyway) if((current->file_name != NULL) && (zone_desc->file_name != NULL)) { if(strcmp(current->file_name, zone_desc->file_name) != 0) { zone_set_status(current, ZONE_STATUS_MODIFIED); } } else if(current->file_name != zone_desc->file_name) // at least one of them is NULL { zone_set_status(current, ZONE_STATUS_MODIFIED); } free(current->file_name); current->file_name = zone_desc->file_name; zone_desc->file_name = NULL; // masters : log_debug7("updating %p (%u) with %p (%u): masters", current, current->lock_owner, zone_desc, zone_desc->lock_owner); if(host_address_list_equals(current->masters, zone_desc->masters)) { host_address_delete_list(zone_desc->masters); } else { host_address_delete_list(current->masters); current->masters = zone_desc->masters; } zone_desc->masters = NULL; // notifies : log_debug7("updating %p (%u) with %p (%u): notifies", current, current->lock_owner, zone_desc, zone_desc->lock_owner); if(host_address_list_equals(current->notifies, zone_desc->notifies)) { host_address_delete_list(zone_desc->notifies); } else { host_address_delete_list(current->notifies); current->notifies = zone_desc->notifies; } zone_desc->notifies = NULL; #if HAS_DYNAMIC_PROVISIONING log_debug7("updating %p (%u) with %p (%u): slaves", current, current->lock_owner, zone_desc, zone_desc->lock_owner); if(host_address_list_equals(current->slaves, zone_desc->slaves)) { #if HAS_MASTER_SUPPORT if((current->type == ZT_MASTER) || (zone_desc->type == ZT_MASTER)) { notify_slaves_then_delete = zone_desc->slaves; } else #endif { host_address_delete_list(zone_desc->slaves); } } else { #if HAS_MASTER_SUPPORT if(current->type == ZT_MASTER) { notify_slaves_then_delete = current->slaves; } else { host_address_delete_list(current->slaves); } if(zone_desc->type == ZT_MASTER) { notify_slaves = zone_desc->slaves; } #else host_address_delete_list(current->slaves); #endif current->slaves = zone_desc->slaves; } zone_desc->slaves = NULL; #endif // type : ? log_debug7("updating %p (%u) with %p (%u): type", current, current->lock_owner, zone_desc, zone_desc->lock_owner); current->type = zone_desc->type; #if HAS_ACL_SUPPORT // ac : apply the new one, update the zone access log_debug7("updating %p (%u) with %p (%u): ac@%p with ac@%p", current, current->lock_owner, zone_desc, zone_desc->lock_owner, ¤t->ac, &zone_desc->ac); #ifdef DEBUG log_debug7("old@%p:", current); log_debug7(" notify@%p",current->ac.allow_notify.ipv4.items); log_debug7(" query@%p",current->ac.allow_query.ipv4.items); log_debug7(" transfer@%p",current->ac.allow_transfer.ipv4.items); log_debug7(" update@%p",current->ac.allow_update.ipv4.items); log_debug7("forwarding@%p",current->ac.allow_update_forwarding.ipv4.items); log_debug7(" control@%p",current->ac.allow_control.ipv4.items); log_debug7("new@%p:", zone_desc); log_debug7(" notify@%p",zone_desc->ac.allow_notify.ipv4.items); log_debug7(" query@%p",zone_desc->ac.allow_query.ipv4.items); log_debug7(" transfer@%p",zone_desc->ac.allow_transfer.ipv4.items); log_debug7(" update@%p",zone_desc->ac.allow_update.ipv4.items); log_debug7("forwarding@%p",zone_desc->ac.allow_update_forwarding.ipv4.items); log_debug7(" control@%p",zone_desc->ac.allow_control.ipv4.items); #endif acl_unmerge_access_control(¤t->ac, &g_config->ac); acl_empties_access_control(¤t->ac); memcpy(¤t->ac, &zone_desc->ac, sizeof(access_control)); ZEROMEMORY(&zone_desc->ac, sizeof(access_control)); #endif // notify : reset, restart log_debug7("updating %p (%u) with %p (%u): notify", current, current->lock_owner, zone_desc, zone_desc->lock_owner); memcpy(¤t->notify, &zone_desc->notify, sizeof(zone_notify_s)); #if HAS_DNSSEC_SUPPORT #if HAS_RRSIG_MANAGEMENT_SUPPORT // signature : reset, restart log_debug7("updating %p (%u) with %p (%u): signature", current, current->lock_owner, zone_desc, zone_desc->lock_owner); memcpy(¤t->signature, &zone_desc->signature, sizeof(zone_signature_s)); #endif // dnssec_mode : drop everything related to the zone, load the new config log_debug7("updating %p (%u) with %p (%u): dnssec_mode", current, current->lock_owner, zone_desc, zone_desc->lock_owner); current->dnssec_mode = zone_desc->dnssec_mode; #endif // refresh : update the "alarms" log_debug7("updating %p (%u) with %p (%u): refresh", current, current->lock_owner, zone_desc, zone_desc->lock_owner); memcpy(¤t->refresh, &zone_desc->refresh, sizeof(zone_refresh_s)); // dynamic_provisioning : ? log_debug7("updating %p (%u) with %p (%u): dynamic_provisioning", current, current->lock_owner, zone_desc, zone_desc->lock_owner); memcpy(¤t->dynamic_provisioning, &zone_desc->dynamic_provisioning, sizeof(dynamic_provisioning_s)); // slaves : update the list zone_unlock(current, ZONE_LOCK_REPLACE_DESC); } // whatever has been decided above, loading the zone file should be queued database_zone_load(zone_desc->origin); #if HAS_DYNAMIC_PROVISIONING // if asking for a load of the zone_data on a master should trigger a notify of its slaves log_debug7("handling dynamic provisioning"); if(!host_address_empty(notify_slaves_then_delete)) { log_info("zone load desc: %{dnsname}: notifying slaves: %{hostaddrlist}", zone_desc->origin, notify_slaves_then_delete); notify_host_list(current, notify_slaves_then_delete, CLASS_CTRL); notify_slaves_then_delete = NULL; } if(!host_address_empty(notify_slaves)) { log_info("zone load desc: %{dnsname}: notifying slaves: %{hostaddrlist}", zone_desc->origin, notify_slaves); host_address *notify_slaves_copy = host_address_copy_list(notify_slaves); notify_host_list(current, notify_slaves_copy, CLASS_CTRL); notify_slaves = NULL; } #endif #if HAS_MASTER_SUPPORT && HAS_DNSSEC_SUPPORT && HAS_RRSIG_MANAGEMENT_SUPPORT if(current->dnssec_policy != zone_desc->dnssec_policy) { log_info("zone: %{dnsname}: %p: config: dnssec-policy modified", zone_desc->origin, zone_desc); if(zone_desc->dnssec_policy != NULL) { if(current->dnssec_policy != NULL) { log_warn("zone: %{dnsname}: %p: config: changing dnssec-policy at runtime (%s to %s)", zone_desc->origin, zone_desc, current->dnssec_policy->name, zone_desc->dnssec_policy->name); if(current->dnssec_policy->denial != zone_desc->dnssec_policy->denial) { log_warn("zone: %{dnsname}: %p: config: modifications of the dnssec-policy denial setting may be ignored", zone_desc->origin, zone_desc); } dnssec_policy_release(current->dnssec_policy); current->dnssec_policy = dnssec_policy_acquire_from_name(zone_desc->dnssec_policy->name); } else { log_info("zone: %{dnsname}: %p: config: dnssec-policy %s enabled", zone_desc->origin, zone_desc, zone_desc->dnssec_policy->name); current->dnssec_policy = dnssec_policy_acquire_from_name(zone_desc->dnssec_policy->name); } } else { log_warn("zone: %{dnsname}: %p: config: removing policy at runtime", zone_desc->origin, zone_desc); dnssec_policy_release(current->dnssec_policy); current->dnssec_policy = NULL; } } #endif if(current != zone_desc) { log_debug7("destroying temporary zone descriptor @%p", zone_desc); zone_release(zone_desc); } zone_clear_status(zone_desc, ZONE_STATUS_DROP_AFTER_RELOAD); zone_release(current); break; } // DUP default: { log_err("zone: %{dnsname}: %p: failed to register", zone_desc->origin, zone_desc); break; } } // switch } log_debug1("database_load_zone_desc(%p) done", zone_desc); }