您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ switch_core_hash_find函数代码示例

51自学网 2021-06-03 08:35:11
  C++
这篇教程C++ switch_core_hash_find函数代码示例写得很实用,希望能帮到您。

本文整理汇总了C++中switch_core_hash_find函数的典型用法代码示例。如果您正苦于以下问题:C++ switch_core_hash_find函数的具体用法?C++ switch_core_hash_find怎么用?C++ switch_core_hash_find使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。

在下文中一共展示了switch_core_hash_find函数的24个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: tag_hook

/** * Process a tag */static int tag_hook(void *user_data, char *name, char **atts, int type){	int result = IKS_OK;	struct nlsml_parser *parser = (struct nlsml_parser *)user_data;	if (type == IKS_OPEN || type == IKS_SINGLE) {		struct nlsml_node *child_node = malloc(sizeof(*child_node));		child_node->name = name;		child_node->tag_def = switch_core_hash_find(globals.tag_defs, name);		if (!child_node->tag_def) {			child_node->tag_def = switch_core_hash_find(globals.tag_defs, "ANY");		}		child_node->parent = parser->cur;		parser->cur = child_node;		switch_log_printf(SWITCH_CHANNEL_UUID_LOG(parser->uuid), SWITCH_LOG_DEBUG1, "<%s>/n", name);		result = process_tag(parser, name, atts);	}	if (type == IKS_CLOSE || type == IKS_SINGLE) {		struct nlsml_node *node = parser->cur;		parser->cur = node->parent;		free(node);		switch_log_printf(SWITCH_CHANNEL_UUID_LOG(parser->uuid), SWITCH_LOG_DEBUG1, "</%s>/n", name);	}	return result;}
开发者ID:benlangfeld,项目名称:FreeSWITCH,代码行数:30,


示例2: process_node

static switch_status_t process_node(const switch_log_node_t *node, switch_log_level_t level){	switch_hash_index_t *hi;	void *val;	const void *var;	logfile_profile_t *profile;	for (hi = switch_core_hash_first(profile_hash); hi; hi = switch_core_hash_next(&hi)) {		size_t mask = 0;		size_t ok = 0;		switch_core_hash_this(hi, &var, NULL, &val);		profile = val;		ok = switch_log_check_mask(profile->all_level, level);		if (!ok) {			mask = (size_t) switch_core_hash_find(profile->log_hash, node->file);			ok = switch_log_check_mask(mask, level);		}		if (!ok) {			mask = (size_t) switch_core_hash_find(profile->log_hash, node->func);			ok = switch_log_check_mask(mask, level);		}		if (!ok) {			char tmp[256] = "";			switch_snprintf(tmp, sizeof(tmp), "%s:%s", node->file, node->func);			mask = (size_t) switch_core_hash_find(profile->log_hash, tmp);			ok = switch_log_check_mask(mask, level);		}		if (ok) {			if (profile->log_uuid && !zstr(node->userdata)) {				char buf[2048];				char *dup = strdup(node->data);				char *lines[100];				int argc, i;								argc = switch_split(dup, '/n', lines);				for (i = 0; i < argc; i++) {					switch_snprintf(buf, sizeof(buf), "%s %s/n", node->userdata, lines[i]);					mod_logfile_raw_write(profile, buf);					}								free(dup);							} else {				mod_logfile_raw_write(profile, node->data);			}		}	}	return SWITCH_STATUS_SUCCESS;}
开发者ID:odmanV2,项目名称:freecenter,代码行数:57,


示例3: subscriber_execute

/** * Execute function for each subscriber */static void subscriber_execute(const char *uuid, const char *signal_type, subscriber_execute_fn callback, void *user_data){    switch_event_t *subscriber_list = NULL;    switch_event_header_t *subscriber = NULL;    /* fetch list of subscribers */    char *key = switch_mprintf("%s:%s", uuid, signal_type);    switch_event_create_subclass(&subscriber_list, SWITCH_EVENT_CLONE, NULL);    switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_DEBUG, "Subscriber execute %s/n", signal_type);    switch_mutex_lock(globals.subscribers_mutex);    {        switch_hash_index_t *hi = NULL;        switch_hash_t *signal_subscribers = switch_core_hash_find(globals.subscribers, key);        if (signal_subscribers) {            for (hi = switch_core_hash_first(signal_subscribers); hi; hi = switch_core_hash_next(hi)) {                const void *jid;                void *dont_care;                switch_core_hash_this(hi, &jid, NULL, &dont_care);                switch_event_add_header_string(subscriber_list, SWITCH_STACK_BOTTOM, "execute", (const char *)jid);            }        } else {            switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_DEBUG, "No subscribers for %s/n", signal_type);        }    }    switch_mutex_unlock(globals.subscribers_mutex);    switch_safe_free(key);    /* execute function for each subscriber */    for (subscriber = subscriber_list->headers; subscriber; subscriber = subscriber->next) {        callback(subscriber->value, user_data);    }    switch_event_destroy(&subscriber_list);}
开发者ID:bodji,项目名称:freeswitch,代码行数:37,


示例4: spy_on_hangup

static switch_status_t spy_on_hangup(switch_core_session_t *session){	switch_channel_t *channel = switch_core_session_get_channel(session);	const char *data = switch_channel_get_private(channel, "_userspy_");	const char *uuid = switch_core_session_get_uuid(session);	spy_t *spy = NULL, *p = NULL, *prev = NULL;	switch_thread_rwlock_wrlock(globals.spy_hash_lock);	spy = switch_core_hash_find(globals.spy_hash, data);	for (p = spy; p; p = p->next) {		if (p->uuid == uuid) {			if (prev) {				prev->next = p->next;			} else {				spy = p->next;			}			globals.spy_count--;			break;		}		prev = p;	}	switch_core_hash_insert(globals.spy_hash, data, spy);	switch_thread_rwlock_unlock(globals.spy_hash_lock);		return SWITCH_STATUS_SUCCESS;}
开发者ID:DastanIqbal,项目名称:FreeSWITCH,代码行数:29,


示例5: get_remote_usage

/* Compute the usage sum of a resource on remote boxes */static limit_hash_item_t get_remote_usage(const char *key) {	limit_hash_item_t usage = { 0 };	switch_hash_index_t *hi;		switch_thread_rwlock_rdlock(globals.remote_hash_rwlock);	for (hi = switch_hash_first(NULL, globals.remote_hash); hi; hi = switch_hash_next(hi)) {		void *val;			const void *hashkey;		switch_ssize_t keylen;		limit_remote_t *remote;		limit_hash_item_t *item;		switch_hash_this(hi, &hashkey, &keylen, &val);									remote = (limit_remote_t *)val;		if (remote->state != REMOTE_UP) {			continue;		}				switch_thread_rwlock_rdlock(remote->rwlock);		if ((item = switch_core_hash_find(remote->index, key))) {			usage.total_usage += item->total_usage;			usage.rate_usage += item->rate_usage;			if (!usage.last_check) {				usage.last_check = item->last_check;			}		}		switch_thread_rwlock_unlock(remote->rwlock);	}		switch_thread_rwlock_unlock(globals.remote_hash_rwlock);		return usage;}
开发者ID:moises-silva,项目名称:mod_conference-admin,代码行数:34,


示例6: switch_thread_rwlock_rdlock

limit_remote_t *limit_remote_create(const char *name, const char *host, uint16_t port, const char *username, const char *password, int interval) {	limit_remote_t *r;	switch_memory_pool_t *pool;		switch_thread_rwlock_rdlock(globals.remote_hash_rwlock);	if (switch_core_hash_find(globals.remote_hash, name)) {			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Already have a remote instance named %s/n", name);			switch_thread_rwlock_unlock(globals.remote_hash_rwlock);			return NULL;	}	switch_thread_rwlock_unlock(globals.remote_hash_rwlock);		if (switch_core_new_memory_pool(&pool) != SWITCH_STATUS_SUCCESS) {		return NULL;	}		r = switch_core_alloc(pool, sizeof(limit_remote_t));	r->pool = pool;	r->name = switch_core_strdup(r->pool, name);	r->host = switch_core_strdup(r->pool, host);	r->port = port;	r->username = switch_core_strdup(r->pool, username);	r->password = switch_core_strdup(r->pool, password);	r->interval = interval;		switch_thread_rwlock_create(&r->rwlock, pool);	switch_core_hash_init(&r->index, pool);		switch_thread_rwlock_rdlock(globals.remote_hash_rwlock);	switch_core_hash_insert(globals.remote_hash, name, r);	switch_thread_rwlock_unlock(globals.remote_hash_rwlock);	return r;}
开发者ID:moises-silva,项目名称:mod_conference-admin,代码行数:35,


示例7: callprogress_detector_start

/** * Start call progress detection * * @param session the session to detect * @param name of the descriptor to use  * @return SWITCH_STATUS_SUCCESS if successful */switch_status_t callprogress_detector_start(switch_core_session_t *session, const char *name){	switch_channel_t *channel = switch_core_session_get_channel(session);	tone_detector_t *detector = NULL;	tone_descriptor_t *descriptor = NULL;	switch_media_bug_t *bug = NULL;	/* are we already running? */	bug = switch_channel_get_private(channel, TONE_PRIVATE);	if (bug) {		return SWITCH_STATUS_FALSE;	}	/* find the tone descriptor with the matching name and create the detector */	descriptor = switch_core_hash_find(spandsp_globals.tones, name);	if (!descriptor) {		switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_WARNING, "no tone descriptor defined with name '%s'.  Update configuration. /n", name);		return SWITCH_STATUS_FALSE;	}	tone_detector_create(session, &detector, descriptor);	/* start listening for tones */	switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Starting tone detection for '%s'/n", name);	switch_core_media_bug_add(session, "spandsp_tone_detect", NULL,				callprogress_detector_process_buffer, detector, 0 /* stop time */, SMBF_READ_REPLACE, &bug);	if (!bug) {		return SWITCH_STATUS_FALSE;	}	switch_channel_set_private(channel, TONE_PRIVATE, bug);	return SWITCH_STATUS_SUCCESS;}
开发者ID:RodrigoNieves,项目名称:FreeSWITCH,代码行数:39,


示例8: my_on_reporting

static switch_status_t my_on_reporting(switch_core_session_t *session){	switch_channel_t *channel = switch_core_session_get_channel(session);	switch_status_t status = SWITCH_STATUS_SUCCESS;	const char *template_str = NULL;	char *expanded_vars = NULL, *sql = NULL;	if (globals.shutdown) {		return SWITCH_STATUS_SUCCESS;	}	if (!((globals.legs & CDR_LEG_A) && (globals.legs & CDR_LEG_B))) {		if ((globals.legs & CDR_LEG_A)) {			if (switch_channel_get_originator_caller_profile(channel)) {				return SWITCH_STATUS_SUCCESS;			}		} else {			if (switch_channel_get_originatee_caller_profile(channel)) {				return SWITCH_STATUS_SUCCESS;			}		}	}	if (globals.debug) {		switch_event_t *event;		if (switch_event_create_plain(&event, SWITCH_EVENT_CHANNEL_DATA) == SWITCH_STATUS_SUCCESS) {			char *buf;			switch_channel_event_set_data(channel, event);			switch_event_serialize(event, &buf, SWITCH_FALSE);			switch_assert(buf);			switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "CHANNEL_DATA:/n%s/n", buf);			switch_event_destroy(&event);			switch_safe_free(buf);		}	}	template_str = (const char *) switch_core_hash_find(globals.template_hash, globals.default_template);	if (!template_str) {		template_str = default_template;	}	expanded_vars = switch_channel_expand_variables(channel, template_str);	if (!expanded_vars) {		switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error expanding CDR variables./n");		return SWITCH_STATUS_FALSE;	}	sql = switch_mprintf("INSERT INTO %s VALUES (%s)", globals.db_table, expanded_vars);	assert(sql);	write_cdr(sql);	switch_safe_free(sql);	if (expanded_vars != template_str) {		switch_safe_free(expanded_vars);	}	return status;}
开发者ID:DrumTechnologiesLtd,项目名称:FreeSWITCH,代码行数:60,


示例9: process_event

static switch_status_t process_event(switch_event_t *event){	switch_core_session_t *session = NULL;	switch_channel_t *channel;	char *username[3] = { 0 };	char *domain[3] = { 0 };	char key[512];	char *uuid = NULL, *my_uuid = NULL;	int i;	switch_thread_rwlock_rdlock(globals.spy_hash_lock);	if (!globals.spy_count) {		goto done;	}	username[0] = switch_event_get_header(event, "Caller-Username");	domain[0] = switch_event_get_header(event, "variable_domain_name");	domain[1] = switch_event_get_header(event, "variable_dialed_domain");	username[1] = switch_event_get_header(event, "variable_dialed_user");	username[2] = switch_event_get_header(event, "variable_user_name");	domain[2] = switch_event_get_header(event, "variable_domain_name");	for (i = 0; i < 3; i++) {		if (username[i] && domain[i]) {			switch_snprintf(key, sizeof(key), "%[email
C++ switch_core_new_memory_pool函数代码示例
C++ switch_core_destroy_memory_pool函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。