• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ MI_SSTR函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: init_mi_tree

struct mi_root *mi_set_shtag_active(struct mi_root *cmd_tree, void *param)
{
	struct mi_node* node;
	struct dlg_sharing_tag *tag;

	if (!dialog_repl_cluster)
		return init_mi_tree(400, MI_SSTR("Dialog replication disabled"));

	node = cmd_tree->node.kids;
	if (node == NULL || !node->value.s || !node->value.len)
		return init_mi_tree(400, MI_SSTR(MI_MISSING_PARM));

	lock_start_write(shtags_lock);

	if ((tag = get_shtag_unsafe(&node->value)) == NULL)
		return init_mi_tree(500, MI_SSTR("Unable to set sharing tag"));

	tag->state = SHTAG_STATE_ACTIVE;

	lock_stop_write(shtags_lock);

	if (send_shtag_active_info(&node->value, 0) < 0)
		LM_WARN("Failed to broadcast message about tag [%.*s] going active\n",
			node->value.len, node->value.s);

	return init_mi_tree( 200, MI_SSTR(MI_OK));
}
开发者ID:NormB,项目名称:opensips,代码行数:27,代码来源:dlg_replication.c


示例2: init_mi_tree

static struct mi_root *mi_debug(struct mi_root *cmd, void *param)
{
	struct mi_root *rpl_tree;
	struct mi_node *node;
	char *p;
	int len;
	int new_debug;

	node = cmd->node.kids;
	if (node!=NULL) {
		if (str2sint( &node->value, &new_debug) < 0)
			return init_mi_tree( 400, MI_SSTR(MI_BAD_PARM));
	} else
		new_debug = debug;

	rpl_tree = init_mi_tree( 200, MI_SSTR(MI_OK));
	if (rpl_tree==0)
		return 0;

	p = sint2str((long)new_debug, &len);
	node = add_mi_node_child( &rpl_tree->node, MI_DUP_VALUE,
		MI_SSTR("DEBUG"),p, len);
	if (node==0) {
		free_mi_tree(rpl_tree);
		return 0;
	}

	debug = new_debug;

	return rpl_tree;
}
开发者ID:AbedKarmi,项目名称:opensips-ng,代码行数:31,代码来源:mi_core.c


示例3: clusterer_set_status

static struct mi_root* clusterer_set_status(struct mi_root *cmd, void *param)
{
	unsigned int cluster_id;
	unsigned int state;
	int rc;
	struct mi_node *node;

	node = cmd->node.kids;

	if (node == NULL || node->next == NULL || node->next->next != NULL)
		return init_mi_tree(400, MI_MISSING_PARM_S, MI_MISSING_PARM_LEN);

	rc = str2int(&node->value, &cluster_id);
	if (rc < 0 || cluster_id < 1)
		return init_mi_tree(400, MI_SSTR(MI_BAD_PARM));

	rc = str2int(&node->next->value, &state);
	if (rc < 0 || (state != STATE_DISABLED && state != STATE_ENABLED))
		return init_mi_tree(400, MI_SSTR(MI_BAD_PARM));

	rc = cl_set_state(cluster_id, state);
	if (rc == -1)
		return init_mi_tree(404, "Cluster id not found", 20);
	if (rc == 1)
		return init_mi_tree(404, "Node id not found", 17);

	return init_mi_tree(200, MI_SSTR(MI_OK));
}
开发者ID:victor-ciurel,项目名称:opensips,代码行数:28,代码来源:clusterer_mod.c


示例4: init_mi_param_error

static mi_response_t *clusterer_set_status(const mi_params_t *params,
								struct mi_handler *async_hdl)
{
	int cluster_id;
	int state;
	int rc;

	if (get_mi_int_param(params, "cluster_id", &cluster_id) < 0)
		return init_mi_param_error();
	if (cluster_id < 1)
		return init_mi_error(400, MI_SSTR("Bad value for 'cluster_id'"));

	if (get_mi_int_param(params, "status", &state) < 0)
		return init_mi_param_error();
	if (state != STATE_DISABLED && state != STATE_ENABLED)
		return init_mi_error(400, MI_SSTR("Bad value for 'status'"));

	rc = cl_set_state(cluster_id, state);
	if (rc == -1)
		return init_mi_error(404, MI_SSTR("Cluster id not found"));
	if (rc == 1)
		return init_mi_error(404, MI_SSTR("Node id not found"));

	return init_mi_result_ok();
}
开发者ID:OpenSIPS,项目名称:opensips,代码行数:25,代码来源:clusterer_mod.c


示例5: mi_sync_db_dlg

struct mi_root* mi_sync_db_dlg(struct mi_root *cmd, void *param)
{
	if (sync_dlg_db_mem() < 0)
		return init_mi_tree( 400, MI_SSTR("Sync mem with DB failed"));
	else
		return init_mi_tree( 200, MI_SSTR(MI_OK));
}
开发者ID:bluemutedwisdom,项目名称:OpenSIPS,代码行数:7,代码来源:dlg_db_handler.c


示例6: init_mi_result_array

static mi_response_t *mi_list_root_path(const mi_params_t *params,
						struct mi_handler *async_hdl)
{
	mi_response_t *resp;
	mi_item_t *resp_arr;
	mi_item_t *root_item;
	struct httpd_cb *cb = httpd_cb_list;

	resp = init_mi_result_array(&resp_arr);
	if (!resp)
		return 0;

	while(cb) {
		root_item = add_mi_object(resp_arr, 0, 0);
		if (!root_item)
			goto error;

		if (add_mi_string(root_item, MI_SSTR("http_root"),
				cb->http_root->s, cb->http_root->len) < 0)
			goto error;

		if (add_mi_string(root_item, MI_SSTR("module"),
				(char*)cb->module, strlen(cb->module)) < 0)
			goto error;

		cb = cb->next;
	}

	return resp;

error:
	free_mi_response(resp);
	return 0;
}
开发者ID:rrb3942,项目名称:opensips,代码行数:34,代码来源:httpd.c


示例7: mi_address_reload

/*! \brief
 * MI function to reload address table
 */
struct mi_root* mi_address_reload(struct mi_root *cmd_tree, void *param)
{
    if (reload_address_table_cmd () == 1) {
	return init_mi_tree( 200, MI_SSTR(MI_OK));
    } else {
	return init_mi_tree( 400, MI_SSTR("Address table reload failed"));
    }
}
开发者ID:gbour,项目名称:kamailio,代码行数:11,代码来源:mi.c


示例8: mi_lb_resize

static struct mi_root* mi_lb_resize(struct mi_root *cmd, void *param)
{
	struct mi_root *rpl_tree;
	struct lb_dst *dst;
	struct mi_node *node;
	unsigned int  id, size;
	str *name;
	int n;

	for( n=0,node = cmd->node.kids; n<3 && node ; n++,node=node->next );
	if (n!=3 || node!=0)
		return init_mi_tree( 400, MI_MISSING_PARM_S, MI_MISSING_PARM_LEN);

	node = cmd->node.kids;

	/* id (param 1) */
	if (str2int( &node->value, &id) < 0)
		goto bad_syntax;

	/* resource (param 2) */
	node = node->next;
	name = &node->value;

	/* id (param 3) */
	node = node->next;
	if (str2int( &node->value, &size) < 0)
		goto bad_syntax;

	lock_start_read( ref_lock );

	/* get destination */
	for( dst=(*curr_data)->dsts ; dst && dst->id!=id ; dst=dst->next);
	if (dst==NULL) {
		rpl_tree = init_mi_tree( 404, MI_SSTR("Destination ID not found"));
	} else {
		/* get resource */
		for( n=0 ; n<dst->rmap_no ; n++)
			if (dst->rmap[n].resource->name.len == name->len &&
			memcmp( dst->rmap[n].resource->name.s, name->s, name->len)==0)
				break;
		if (n==dst->rmap_no) {
			rpl_tree = init_mi_tree( 404,
				MI_SSTR("Destination has no such resource"));
		} else {
			dst->rmap[n].max_load = size;
			rpl_tree = init_mi_tree( 200, MI_SSTR(MI_OK_S));
		}
	}

	lock_stop_read( ref_lock );

	return rpl_tree;
bad_syntax:
	return init_mi_tree( 400, MI_SSTR(MI_BAD_PARM_S));

}
开发者ID:NormB,项目名称:opensips,代码行数:56,代码来源:load_balancer.c


示例9: mi_sync_cl_dlg

struct mi_root* mi_sync_cl_dlg(struct mi_root *cmd, void *param)
{
	if (!dialog_repl_cluster)
		return init_mi_tree(400, MI_SSTR("Dialog replication disabled"));

	if (clusterer_api.request_sync(&dlg_repl_cap, dialog_repl_cluster, 1) < 0)
		return init_mi_tree(400, MI_SSTR("Failed to send sync request"));
	else
		return init_mi_tree(200, MI_SSTR(MI_OK));
}
开发者ID:NormB,项目名称:opensips,代码行数:10,代码来源:dlg_replication.c


示例10: LM_ERR

struct mi_root *mi_help(struct mi_root *root, void *param)
{
	struct mi_root *rpl_tree = 0;
	struct mi_node *node;
	struct mi_node *rpl;
	struct mi_cmd *cmd;

	if (!root) {
		LM_ERR("invalid MI command\n");
		return 0;
	}
	node = root->node.kids;
	if (!node || !node->value.len || !node->value.s) {
		rpl_tree = init_mi_tree(200, MI_SSTR(MI_OK));
		if (!rpl_tree) {
			LM_ERR("cannot init mi tree\n");
			return 0;
		}
		rpl = &rpl_tree->node;
		if (!add_mi_node_child(rpl, 0, "Usage", 5, MI_SSTR(MI_HELP_STR))) {
			LM_ERR("cannot add new child\n");
			goto error;
		}
	} else {
		/* search the command */
		cmd = lookup_mi_cmd(node->value.s, node->value.len);
		if (!cmd)
			return init_mi_tree(404, MI_SSTR(MI_UNKNOWN_CMD));
		rpl_tree = init_mi_tree(200, MI_SSTR(MI_OK));
		if (!rpl_tree) {
			LM_ERR("cannot init mi tree\n");
			return 0;
		}
		rpl = &rpl_tree->node;
		if (!addf_mi_node_child(rpl, 0, "Help", 4, "%s", cmd->help.s ?
					cmd->help.s : MI_NO_HELP)) {
			LM_ERR("cannot add new child\n");
			goto error;
		}
		if (cmd->module.len && cmd->module.s &&
				!add_mi_node_child(rpl, 0, "Exported by", 11,
					cmd->module.s, cmd->module.len)) {
			LM_ERR("cannot add new child\n");
			goto error;
		}
	}

	return rpl_tree;

error:
	if (rpl_tree)
		free_mi_tree(rpl_tree);
	return 0;
}
开发者ID:Distrotech,项目名称:opensips,代码行数:54,代码来源:mi.c


示例11: process_mi_params

static inline struct mi_root* process_mi_params(struct mi_root *cmd_tree,
													struct dlg_cell **dlg_p)
{
	struct mi_node* node;
	struct dlg_entry *d_entry;
	struct dlg_cell *dlg;
	str *callid;
	str *from_tag;
	unsigned int h_entry;

	node = cmd_tree->node.kids;
	if (node == NULL) {
		/* no parameters at all */
		*dlg_p = NULL;
		return NULL;
	}

	/* we have params -> get callid and fromtag */
	callid = &node->value;
	if(callid->s==NULL || callid->len<=0)
		return init_mi_tree(400, MI_SSTR(MI_MISSING_PARM));
	LM_DBG("callid='%.*s'\n", callid->len, callid->s);

	node = node->next;
	if ( !node || !node->value.s || !node->value.len) {
		from_tag = NULL;
	} else {
		from_tag = &node->value;
		LM_DBG("from_tag='%.*s'\n", from_tag->len, from_tag->s);
		if ( node->next!=NULL )
			return init_mi_tree( 400, MI_SSTR(MI_MISSING_PARM));
	}

	h_entry = core_hash( callid, 0, d_table->size);

	d_entry = &(d_table->entries[h_entry]);
	dlg_lock( d_table, d_entry);

	for( dlg = d_entry->first ; dlg ; dlg = dlg->next ) {
		if (match_downstream_dialog( dlg, callid, from_tag)==1) {
			if (dlg->state==DLG_STATE_DELETED) {
				*dlg_p = NULL;
				break;
			} else {
				*dlg_p = dlg;
				dlg_unlock( d_table, d_entry);
				return 0;
			}
		}
	}
	dlg_unlock( d_table, d_entry);

	return init_mi_tree( 404, MI_SSTR("Nu such dialog"));
}
开发者ID:AlessioCasco,项目名称:kamailio,代码行数:54,代码来源:dlg_hash.c


示例12: mi_agent_login

/* FORMAT :  agent_id  log_state */
static struct mi_root* mi_agent_login(struct mi_root *cmd_tree, void *param)
{
	struct mi_node *node;
	struct cc_agent *agent;
	unsigned int loged_in;
	struct cc_agent* prev_agent= 0;

	node = cmd_tree->node.kids;

	if (node==NULL || node->next==NULL || node->next->next!=NULL)
		return init_mi_tree( 400, MI_MISSING_PARM_S, MI_MISSING_PARM_LEN);

	/* block access to data */
	lock_get( data->lock );

	/* name of the agent */
	agent = get_agent_by_name( data, &node->value, &prev_agent);
	if (agent==NULL) {
		lock_release( data->lock );
		return init_mi_tree( 404, MI_SSTR("Agent not found") );
	}

	/* login state */
	node = node->next;
	if (str2int( &node->value , &loged_in)!=0 ) {
		lock_release( data->lock );
		return init_mi_tree( 400, MI_SSTR("Bad loged_in state") );
	}

	if (agent->loged_in != loged_in) {

		if(loged_in && (agent->state==CC_AGENT_WRAPUP) &&
			(get_ticks() - agent->last_call_end > wrapup_time))
			agent->state = CC_AGENT_FREE;

		if(loged_in && data->agents[CC_AG_ONLINE] == NULL)
			data->last_online_agent = agent;

		agent_switch_login(data, agent, prev_agent);
		
		if(loged_in) {
			data->logedin_agents++;
			log_agent_to_flows( data, agent, 1);
		} else {
			data->logedin_agents--;
			log_agent_to_flows(data, agent, 0);
		}
	}

	/* release the readers */
	lock_release( data->lock );

	return init_mi_tree( 200, MI_OK_S, MI_OK_LEN);
}
开发者ID:abh-gitcs1989,项目名称:opensips,代码行数:55,代码来源:call_center.c


示例13: internal_mi_print_b2bl_entity_id

static inline int internal_mi_print_b2bl_entity_id(mi_item_t *item, b2bl_entity_id_t *c)
{
	if (c->scenario_id.s && c->scenario_id.len != 0)
		if (add_mi_string(item, MI_SSTR("scenario_id"),
			c->scenario_id.s, c->scenario_id.len) < 0)
			goto error;

	if (c->key.s && c->key.len != 0)
		if (add_mi_string(item, MI_SSTR("key"),
			c->key.s, c->key.len) < 0)
			goto error;

	if (add_mi_number(item, MI_SSTR("disconnected"),
		c->disconnected) < 0)
		goto error;
	if (add_mi_number(item, MI_SSTR("state"),
		c->state) < 0)
		goto error;
	if (add_mi_number(item, MI_SSTR("no"),
		c->no) < 0)
		goto error;
	if (add_mi_number(item, MI_SSTR("type"),
		c->type) < 0)
		goto error;

	if (c->peer)
	{
		if (c->peer->key.s && c->peer->key.len != 0)
			if (add_mi_string(item, MI_SSTR("peer"),
				c->peer->key.s, c->peer->key.len) < 0)
				goto error;
	}

	if (c->to_uri.s && c->to_uri.len != 0)
		if (add_mi_string(item, MI_SSTR("to_uri"),
			c->to_uri.s, c->to_uri.len) < 0)
			goto error;

	if (c->from_uri.s && c->from_uri.len != 0)
		if (add_mi_string(item, MI_SSTR("from_uri"),
			c->from_uri.s, c->from_uri.len) < 0)
			goto error;

	if (c->from_dname.s && c->from_dname.len != 0)
		if (add_mi_string(item, MI_SSTR("from_dname"),
			c->from_dname.s, c->from_dname.len) < 0)
			goto error;

	return 0;

error:
	LM_ERR("failed to add mi item\n");
	return -1;
}
开发者ID:OpenSIPS,项目名称:opensips,代码行数:54,代码来源:b2b_logic.c


示例14: mi_trusted_reload

/*
 * MI function to reload trusted table
 */
struct mi_root* mi_trusted_reload(struct mi_root *cmd_tree, void *param)
{
	if (hash_table==NULL) {
		return init_mi_tree( 200, MI_SSTR(MI_OK));
	}

	if (reload_trusted_table () == 1) {
		return init_mi_tree( 200, MI_SSTR(MI_OK));
	} else {
		return init_mi_tree( 400, MI_SSTR("Trusted table reload failed"));
	}
}
开发者ID:gbour,项目名称:kamailio,代码行数:15,代码来源:mi.c


示例15: cluster_send_mi

static struct mi_root* cluster_send_mi(struct mi_root *cmd, void *param)
{
	struct mi_node *node, *cmd_params_n;
	unsigned int cluster_id, node_id;
	int rc;
	str cl_cmd_name;
	str cl_cmd_params[MI_CMD_MAX_NR_PARAMS];
	int no_params = 0;

	node = cmd->node.kids;

	if (node == NULL || node->next == NULL || node->next->next == NULL)
		return init_mi_tree(400, MI_SSTR(MI_MISSING_PARM));

	rc = str2int(&node->value, &cluster_id);
	if (rc < 0 || cluster_id < 1)
		return init_mi_tree(400, MI_SSTR(MI_BAD_PARM));

	rc = str2int(&node->next->value, &node_id);
	if (rc < 0 || node_id < 1)
		return init_mi_tree(400, MI_SSTR(MI_BAD_PARM));
	if (node_id == current_id)
		return init_mi_tree(400, MI_SSTR("Local node specified as destination"));

	cl_cmd_name = node->next->next->value;

	cmd_params_n = node->next->next->next;
	for (; cmd_params_n; cmd_params_n = cmd_params_n->next, no_params++)
		cl_cmd_params[no_params] = cmd_params_n->value;

	/* send MI cmd in cluster */
	rc = send_mi_cmd(cluster_id, node_id, cl_cmd_name, cl_cmd_params, no_params);
	switch (rc) {
		case CLUSTERER_SEND_SUCCES:
			LM_DBG("MI command <%.*s> sent\n", cl_cmd_name.len, cl_cmd_name.s);
			break;
		case CLUSTERER_CURR_DISABLED:
			LM_INFO("Local node disabled, MI command <%.*s> not sent\n",
				cl_cmd_name.len, cl_cmd_name.s);
			break;
		case CLUSTERER_DEST_DOWN:
			LM_ERR("Destination down, MI command <%.*s> not sent\n",
				cl_cmd_name.len, cl_cmd_name.s);
			break;
		case CLUSTERER_SEND_ERR:
			LM_ERR("Error sending MI command <%.*s>+\n",
				cl_cmd_name.len, cl_cmd_name.s);
			break;
	}

	return init_mi_tree(200, MI_SSTR(MI_OK));
}
开发者ID:victor-ciurel,项目名称:opensips,代码行数:52,代码来源:clusterer_mod.c


示例16: cluster_bcast_mi

static struct mi_root* cluster_bcast_mi(struct mi_root *cmd, void *param)
{
	struct mi_node *node, *cmd_params_n;
	struct mi_cmd *f;
	unsigned int cluster_id;
	int rc;
	str cl_cmd_name;
	str cl_cmd_params[MI_CMD_MAX_NR_PARAMS];
	int no_params = 0;

	node = cmd->node.kids;

	if (node == NULL || node->next == NULL || node->next->next == NULL)
		return init_mi_tree(400, MI_SSTR(MI_MISSING_PARM));

	rc = str2int(&node->value, &cluster_id);
	if (rc < 0 || cluster_id < 1)
		return init_mi_tree(400, MI_SSTR(MI_BAD_PARM));

	cl_cmd_name = node->next->value;

	f = lookup_mi_cmd(cl_cmd_name.s, cl_cmd_name.len);
	if (!f)
		return init_mi_tree(400, MI_SSTR("MI command to be run not found"));

	cmd_params_n = node->next->next;
	for (; cmd_params_n; cmd_params_n = cmd_params_n->next, no_params++)
		cl_cmd_params[no_params] = cmd_params_n->value;

	/* send MI cmd in cluster */
	rc = send_mi_cmd(cluster_id, 0, cl_cmd_name, cl_cmd_params, no_params);
	switch (rc) {
		case CLUSTERER_SEND_SUCCES:
			LM_DBG("MI command <%.*s> sent\n", cl_cmd_name.len, cl_cmd_name.s);
			break;
		case CLUSTERER_CURR_DISABLED:
			LM_INFO("Local node disabled, MI command <%.*s> not sent\n",
				cl_cmd_name.len, cl_cmd_name.s);
			break;
		case CLUSTERER_DEST_DOWN:
			LM_ERR("All nodes down, MI command <%.*s> not sent\n",
				cl_cmd_name.len, cl_cmd_name.s);
			break;
		case CLUSTERER_SEND_ERR:
			LM_ERR("Error sending MI command <%.*s>+\n",
				cl_cmd_name.len, cl_cmd_name.s);
			break;
	}

	/* run MI cmd locally */
	return run_mi_cmd_local(f, cl_cmd_params, no_params, cmd->async_hdl);
}
开发者ID:victor-ciurel,项目名称:opensips,代码行数:52,代码来源:clusterer_mod.c


示例17: clusterer_list_cap

static struct mi_root * clusterer_list_cap(struct mi_root *cmd_tree, void *param)
{
	cluster_info_t *cl;
	struct local_cap *cap;
	struct mi_root *rpl_tree = NULL;
	struct mi_node *node = NULL;
	struct mi_node *node_s = NULL;
	struct mi_attr* attr;
	str val;
	static str str_ok = str_init("Ok");
	static str str_not_synced = str_init("not synced");

	rpl_tree = init_mi_tree(200, MI_OK_S, MI_OK_LEN);
	if (!rpl_tree)
		return NULL;
	rpl_tree->node.flags |= MI_IS_ARRAY;

	lock_start_read(cl_list_lock);

	for (cl = *cluster_list; cl; cl = cl->next) {
		val.s = int2str(cl->cluster_id, &val.len);
		node = add_mi_node_child(&rpl_tree->node, MI_DUP_VALUE|MI_IS_ARRAY,
			MI_SSTR("Cluster"), val.s, val.len);
		if (!node) goto error;

		for (cap = cl->capabilities; cap; cap = cap->next) {
			val.s = cap->reg.name.s;
			val.len = cap->reg.name.len;
			node_s = add_mi_node_child(node, MI_DUP_VALUE|MI_IS_ARRAY,
			   MI_SSTR("Capability"), val.s, val.len);
			if (!node_s) goto error;

			lock_get(cl->lock);
			val.s = int2str((cap->flags & CAP_STATE_OK) ? 1 : 0, &val.len);
			lock_release(cl->lock);
			attr = add_mi_attr(node_s, MI_DUP_VALUE, MI_SSTR("State"),
				(cap->flags & CAP_STATE_OK) ? str_ok.s : str_not_synced.s,
				(cap->flags & CAP_STATE_OK) ? str_ok.len : str_not_synced.len);
			if (!attr) goto error;
	   }
	}

	lock_stop_read(cl_list_lock);
	return rpl_tree;

error:
	lock_stop_read(cl_list_lock);
	if (rpl_tree) free_mi_tree(rpl_tree);
	return NULL;
}
开发者ID:victor-ciurel,项目名称:opensips,代码行数:50,代码来源:clusterer_mod.c


示例18: mi_print_dlgs_ctx

/*!
 * \brief Print a dialog context via the MI interface
 * \param cmd_tree MI command tree
 * \param param unused
 * \return mi node with the dialog information, or NULL on failure
 */
struct mi_root * mi_print_dlgs_ctx(struct mi_root *cmd_tree, void *param )
{
	struct mi_root* rpl_tree= NULL;
	struct mi_node* rpl = NULL;
	struct dlg_cell* dlg = NULL;

	rpl_tree = process_mi_params( cmd_tree, &dlg);
	if (rpl_tree)
		/* param error */
		return rpl_tree;

	rpl_tree = init_mi_tree( 200, MI_SSTR(MI_OK));
	if (rpl_tree==0)
		return 0;
	rpl = &rpl_tree->node;

	if (dlg==NULL) {
		if ( internal_mi_print_dlgs(rpl,1)!=0 )
			goto error;
	} else {
		if ( internal_mi_print_dlg(rpl,dlg,1)!=0 )
			goto error;
	}

	return rpl_tree;
error:
	free_mi_tree(rpl_tree);
	return NULL;
}
开发者ID:AlessioCasco,项目名称:kamailio,代码行数:35,代码来源:dlg_hash.c


示例19: mi_print_dlgs_ctx

struct mi_root * mi_print_dlgs_ctx(struct mi_root *cmd_tree, void *param )
{
	struct mi_root* rpl_tree= NULL;
	struct mi_node* rpl = NULL;
	struct dlg_cell* dlg = NULL;
	unsigned int idx,cnt;

	rpl_tree = process_mi_params( cmd_tree, &dlg, &idx, &cnt);
	if (rpl_tree)
		/* param error */
		return rpl_tree;

	rpl_tree = init_mi_tree( 200, MI_SSTR(MI_OK));
	if (rpl_tree==0)
		goto error;
	rpl = &rpl_tree->node;

	if (dlg==NULL) {
		if ( internal_mi_print_dlgs(rpl_tree, rpl, 1, idx, cnt)!=0 )
			goto error;
	} else {
		if ( internal_mi_print_dlg(rpl,dlg,1)!=0 )
			goto error;
		/* done with the dialog -> unlock it */
		dlg_unlock_dlg(dlg);
	}

	return rpl_tree;
error:
	/* if a dialog ref was returned, unlock it now */
	if (dlg) dlg_unlock_dlg(dlg);
	/* trash everything that was built so far */
	if (rpl_tree) free_mi_tree(rpl_tree);
	return NULL;
}
开发者ID:dsandras,项目名称:opensips,代码行数:35,代码来源:dlg_hash.c


示例20: ds_mi_list

static struct mi_root* ds_mi_list(struct mi_root* cmd_tree, void* param)
{
	struct mi_root* rpl_tree;
	struct mi_node* part_node;
	int flags = 0;

	if (cmd_tree->node.kids){
		if(cmd_tree->node.kids->value.len == 4 && memcmp(cmd_tree->node.kids->value.s,"full",4)==0)
			flags  |= MI_FULL_LISTING;
		else
			return init_mi_tree(400, MI_SSTR(MI_BAD_PARM_S));

	}

	rpl_tree = init_mi_tree(200, MI_OK_S, MI_OK_LEN);
	if (rpl_tree==NULL)
		return 0;
	rpl_tree->node.flags |= MI_IS_ARRAY;

	ds_partition_t *part_it;
	for (part_it = partitions; part_it; part_it = part_it->next) {
		part_node = add_mi_node_child(&rpl_tree->node, MI_IS_ARRAY,"PARTITION",
				9, part_it->name.s, part_it->name.len);

		if (part_node == NULL
			|| ds_print_mi_list(part_node, part_it, flags) < 0) {
		LM_ERR("failed to add node\n");
		free_mi_tree(rpl_tree);
		return 0;
		}
	}

	return rpl_tree;
}
开发者ID:Danfx,项目名称:opensips,代码行数:34,代码来源:dispatcher.c



注:本文中的MI_SSTR函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ MI_UNREFERENCED_PARAMETER函数代码示例发布时间:2022-05-30
下一篇:
C++ MI_NPIXELS函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap