当前位置: 首页>>代码示例>>C++>>正文


C++ pv_get_null函数代码示例

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


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

示例1: pv_get_ht_cell_expire

int pv_get_ht_cell_expire(struct sip_msg *msg,  pv_param_t *param,
		pv_value_t *res)
{
	str htname;
	ht_pv_t *hpv;
	unsigned int now;

	hpv = (ht_pv_t*)param->pvn.u.dname;

	if(hpv->ht==NULL)
	{
		hpv->ht = ht_get_table(&hpv->htname);
		if(hpv->ht==NULL)
			return pv_get_null(msg, param, res);
	}
	if(pv_printf_s(msg, hpv->pve, &htname)!=0)
	{
		LM_ERR("cannot get $ht name\n");
		return -1;
	}
	if(ht_get_cell_expire(hpv->ht, &htname, &now)!=0)
		return pv_get_null(msg, param, res);
	/* integer */
	return pv_get_uintval(msg, param, res, now);
}
开发者ID:AndreyRybkin,项目名称:kamailio,代码行数:25,代码来源:ht_var.c

示例2: pv_comp

static int pv_comp(sip_msg_t* msg, pv_param_t* param, pv_value_t* res)
{
    int ind_local, local = 0, issuer = 0, nid = NID_commonName;

    /* copy callback value as we modify it */
    ind_local = param->pvn.u.isname.name.n;
    DBG("ind_local = %x", ind_local);

    if (ind_local & PV_CERT_PEER) {
        local = 0;
        ind_local = ind_local ^ PV_CERT_PEER;
    } else if (ind_local & PV_CERT_LOCAL) {
        local = 1;
        ind_local = ind_local ^ PV_CERT_LOCAL;
    } else {
        BUG("could not determine certificate\n");
        return pv_get_null(msg, param, res);
    }

    if (ind_local & PV_CERT_SUBJECT) {
        issuer = 0;
        ind_local = ind_local ^ PV_CERT_SUBJECT;
    } else if (ind_local & PV_CERT_ISSUER) {
        issuer = 1;
        ind_local = ind_local ^ PV_CERT_ISSUER;
    } else {
        BUG("could not determine subject or issuer\n");
        return pv_get_null(msg, param, res);
    }

    switch(ind_local) {
    case PV_COMP_CN:
        nid = NID_commonName;
        break;
    case PV_COMP_O:
        nid = NID_organizationName;
        break;
    case PV_COMP_OU:
        nid = NID_organizationalUnitName;
        break;
    case PV_COMP_C:
        nid = NID_countryName;
        break;
    case PV_COMP_ST:
        nid = NID_stateOrProvinceName;
        break;
    case PV_COMP_L:
        nid = NID_localityName;
        break;
    default:
        nid = NID_undef;
    }

    if (get_comp(&res->rs, local, issuer, nid, msg) < 0) {
        return pv_get_null(msg, param, res);
    }

    res->flags = PV_VAL_STR;
    return 0;
}
开发者ID:kamailio,项目名称:kamailio,代码行数:60,代码来源:tls_select.c

示例3: tlsops_sn

int tlsops_sn(struct sip_msg *msg, pv_param_t *param,
		pv_value_t *res)
{
	static char buf[INT2STR_MAX_LEN];
	X509* cert;
	struct tcp_connection* c;
	int my, serial;
	char* sn;

	if (param->pvn.u.isname.name.n & CERT_PEER) {
		my = 0;
	} else if (param->pvn.u.isname.name.n & CERT_LOCAL) {
		my = 1;
	} else {
		LM_CRIT("could not determine certificate\n");
		return pv_get_null(msg, param, res);
	}
	
	if (get_cert(&cert, &c, msg, my) < 0)
		return pv_get_null(msg, param, res);
	
	serial = ASN1_INTEGER_get(X509_get_serialNumber(cert));
	sn = int2str( serial, &res->rs.len);
	memcpy(buf, sn, res->rs.len);
	res->rs.s = buf;
	res->ri = serial;
	res->flags = PV_VAL_STR | PV_VAL_INT;	
	
	if (!my) X509_free(cert);
	tcpconn_put(c);
	return 0;
}
开发者ID:Drooids,项目名称:openser-xmlrpc,代码行数:32,代码来源:tls_select.c

示例4: pv_get_sdp

static int pv_get_sdp(sip_msg_t *msg, pv_param_t *param,
		pv_value_t *res)
{
	sdp_info_t *sdp = NULL;

	if(msg==NULL || param==NULL)
		return -1;

	if(parse_sdp(msg) < 0) {
		LM_INFO("Unable to parse sdp\n");
		return pv_get_null(msg, param, res);
	}
	sdp = (sdp_info_t*)msg->body;

	if (sdp==NULL) {
		LM_DBG("No SDP\n");
		return pv_get_null(msg, param, res);
	}

	switch(param->pvn.u.isname.name.n)
	{
		case 0:
			return pv_get_strval(msg, param, res, &sdp->raw_sdp);
		default:
			return pv_get_null(msg, param, res);
	}
}
开发者ID:barchandune,项目名称:kamailio,代码行数:27,代码来源:sdpops_mod.c

示例5: pv_get_from_tag_initial

static int pv_get_from_tag_initial(sip_msg_t *msg, pv_param_t *param,
		pv_value_t *res)
{
	struct to_body *xto;
	if(msg==NULL)
		return -1;

	if(parse_from_header(msg)<0) {
		LM_ERR("cannot parse From header\n");
		return pv_get_null(msg, param, res);
	}
	if(msg->from==NULL || get_from(msg)==NULL) {
		LM_DBG("no From header\n");
		return pv_get_null(msg, param, res);
	}
	xto = get_from(msg);

	if(is_direction(msg, RR_FLOW_UPSTREAM)==0) {
		if(msg->to==NULL && parse_headers(msg, HDR_TO_F, 0)==-1) {
			LM_ERR("cannot parse To header\n");
			return pv_get_null(msg, param, res);
		}
		if(msg->to==NULL || get_to(msg)==NULL) {
			LM_DBG("no To header\n");
			return pv_get_null(msg, param, res);
		}
		xto = get_to(msg);
	}

	if (xto->tag_value.s==NULL || xto->tag_value.len<=0) {
		LM_DBG("no Tag parameter\n");
		return pv_get_null(msg, param, res);
	}
	return pv_get_strval(msg, param, res, &xto->tag_value);
}
开发者ID:apogrebennyk,项目名称:kamailio,代码行数:35,代码来源:rr_mod.c

示例6: pv_get_mongodb

static int pv_get_mongodb(struct sip_msg *msg,  pv_param_t *param,
		pv_value_t *res)
{
	mongodbc_pv_t *rpv;

	rpv = (mongodbc_pv_t*)param->pvn.u.dname;
	if(rpv->reply==NULL)
	{
		rpv->reply = mongodbc_get_reply(&rpv->rname);
		if(rpv->reply==NULL)
			return pv_get_null(msg, param, res);
	}


	switch(rpv->rkeyid) {
		case 1:
			/* value */
			if(rpv->reply->jsonrpl.s==NULL)
				return pv_get_null(msg, param, res);
			return pv_get_strval(msg, param, res, &rpv->reply->jsonrpl);
		case 2:
			/* info */
			return pv_get_null(msg, param, res);
		case 3:
			/* size */
			return pv_get_null(msg, param, res);
		case 0:
			/* type */
			return pv_get_sintval(msg, param, res, 0);
		default:
			/* We do nothing. */
			return pv_get_null(msg, param, res);
	}
}
开发者ID:4N7HR4X,项目名称:kamailio,代码行数:34,代码来源:ndb_mongodb_mod.c

示例7: pv_alt

static int pv_alt(sip_msg_t* msg, pv_param_t* param, pv_value_t* res)
{
	int ind_local, local = 0, type = GEN_URI;
	
	ind_local = param->pvn.u.isname.name.n;

	if (ind_local & PV_CERT_PEER) {
		local = 0;
		ind_local = ind_local ^ PV_CERT_PEER;
	} else if (ind_local & PV_CERT_LOCAL) {
		local = 1;
		ind_local = ind_local ^ PV_CERT_LOCAL;
	} else {
		BUG("could not determine certificate\n");
		return pv_get_null(msg, param, res);
	}

	switch(ind_local) {
		case PV_COMP_E:    type = GEN_EMAIL; break;
		case PV_COMP_HOST: type = GEN_DNS;   break;
		case PV_COMP_URI:  type = GEN_URI;   break;
		case PV_COMP_IP:   type = GEN_IPADD; break;
		default:
			BUG("ind_local=%d\n", ind_local);
			return pv_get_null(msg, param, res);
	}

	if (get_alt(&res->rs, local, type, msg) < 0) {
		return pv_get_null(msg, param, res);
	}
	
	res->flags = PV_VAL_STR;
	return 0;
}
开发者ID:alezzandro,项目名称:kamailio,代码行数:34,代码来源:tls_select.c

示例8: pv_check_cert

static int pv_check_cert(sip_msg_t* msg, pv_param_t* param, pv_value_t* res)
{
    int err;

    switch (param->pvn.u.isname.name.n) {
    case PV_CERT_VERIFIED:
        err = X509_V_OK;
        break;
    case PV_CERT_REVOKED:
        err = X509_V_ERR_CERT_REVOKED;
        break;
    case PV_CERT_EXPIRED:
        err = X509_V_ERR_CERT_HAS_EXPIRED;
        break;
    case PV_CERT_SELFSIGNED:
        err = X509_V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT;
        break;
    default:
        BUG("unexpected parameter value \"%d\"\n", param->pvn.u.isname.name.n);
        return pv_get_null(msg, param, res);
    }


    if (check_cert(&res->rs, &res->ri, 0, err, msg) < 0) {
        return pv_get_null(msg, param, res);
    }

    res->flags = PV_VAL_STR | PV_VAL_INT;
    return 0;
}
开发者ID:kamailio,项目名称:kamailio,代码行数:30,代码来源:tls_select.c

示例9: pv_get_json

int pv_get_json (struct sip_msg* msg,  pv_param_t* pvp, pv_value_t* val)
{

	pv_json_t * var ;
	json_t * obj;
	json_name * id = (json_name *) pvp->pvn.u.dname;
	UNUSED(id);


	if( expand_tag_list( msg, ((json_name *)pvp->pvn.u.dname)->tags ) < 0)
	{
		LM_ERR("Cannot expand variables in path\n");
		return pv_get_null( msg, pvp, val);
	}


	var = get_pv_json(pvp);

	if( var == NULL )
	{
		/* this is not an error - we simply came across a json spec
		 * pointing a json var which was never set/init */
		LM_DBG("Variable named:%.*s not found\n",id->name.len,id->name.s);
		return pv_get_null( msg, pvp, val);
	}

	obj = get_object(var, pvp, NULL, 0);
	memset(val, 0, sizeof(pv_value_t));

	if( obj == NULL )
		return pv_get_null( msg, pvp, val);

	if( json_object_is_type(obj, json_type_int) )
	{
		val->rs.s = sint2str(json_object_get_int(obj), &val->rs.len);
		val->ri = json_object_get_int(obj);;
		val->flags |= PV_VAL_INT|PV_TYPE_INT|PV_VAL_STR;

	}
	else if( json_object_is_type(obj, json_type_string))
	{
		val->flags = PV_VAL_STR;
		val->rs.s = (char*)json_object_get_string( obj );
#if JSON_LIB_VERSION >= 10
		val->rs.len = json_object_get_string_len( obj );
#else
		val->rs.len = strlen(val->rs.s);
#endif
	} else {
		val->flags = PV_VAL_STR;
		val->rs.s = (char*)json_object_to_json_string( obj );
		val->rs.len = strlen(val->rs.s);
	}

	return 0;
}
开发者ID:ZRouter,项目名称:ZRouter,代码行数:56,代码来源:json.c

示例10: pv_get_nh

int pv_get_nh(struct sip_msg *msg, pv_param_t *param,
		pv_value_t *res)
{
	struct sip_uri parsed_uri;
	str uri;

	if(msg==NULL || res==NULL)
		return -1;

	if(msg->first_line.type == SIP_REPLY)	/* REPLY doesnt have r/d-uri */
		return pv_get_null(msg, param, res);

    if (msg->dst_uri.s != NULL && msg->dst_uri.len>0)
	{
		uri = msg->dst_uri;
	} else {
		if (msg->new_uri.s!=NULL && msg->new_uri.len>0)
		{
			uri = msg->new_uri;
		} else {
			uri = msg->first_line.u.request.uri;
		}
	}
	if(param->pvn.u.isname.name.n==0) /* uri */
	{
		return pv_get_strval(msg, param, res, &uri);
	}
	if(parse_uri(uri.s, uri.len, &parsed_uri)!=0)
	{
		LM_ERR("failed to parse nh uri [%.*s]\n", uri.len, uri.s);
		return pv_get_null(msg, param, res);
	}
	if(param->pvn.u.isname.name.n==1) /* username */
	{
		if(parsed_uri.user.s==NULL || parsed_uri.user.len<=0)
			return pv_get_null(msg, param, res);
		return pv_get_strval(msg, param, res, &parsed_uri.user);
	} else if(param->pvn.u.isname.name.n==2) /* domain */ {
		if(parsed_uri.host.s==NULL || parsed_uri.host.len<=0)
			return pv_get_null(msg, param, res);
		return pv_get_strval(msg, param, res, &parsed_uri.host);
	} else if(param->pvn.u.isname.name.n==3) /* port */ {
		if(parsed_uri.port.s==NULL)
			return pv_get_5060(msg, param, res);
		return pv_get_strintval(msg, param, res, &parsed_uri.port,
				(int)parsed_uri.port_no);
	} else if(param->pvn.u.isname.name.n==4) /* protocol */ {
		if(parsed_uri.transport_val.s==NULL)
			return pv_get_udp(msg, param, res);
		return pv_get_strintval(msg, param, res, &parsed_uri.transport_val,
				(int)parsed_uri.proto);
	}
	LM_ERR("unknown specifier\n");
	return pv_get_null(msg, param, res);
}
开发者ID:GreenfieldTech,项目名称:kamailio,代码行数:55,代码来源:pv_branch.c

示例11: pv_get_t

int pv_get_t(struct sip_msg *msg,  pv_param_t *param,
		pv_value_t *res)
{
	tm_cell_t *t;

	if(msg==NULL || param==NULL)
		return -1;

	/* aliases to old TM pvs */
	switch(param->pvn.u.isname.name.n)
	{
		case 2:
			return pv_get_tm_reply_code(msg, param, res);
		case 4:
			return pv_get_tm_branch_idx(msg, param, res);
	}

	t = _tmx_tmb.t_gett();
	if(t==NULL || t==T_UNDEFINED) {
		/* no T */
		if(param->pvn.u.isname.name.n==8 || param->pvn.u.isname.name.n==9) {
			/* id_label_n or id_index_n - attempt to create transaction */
			if(_tmx_tmb.t_newtran(msg)<0) {
				LM_ERR("cannot create the transaction\n");
				return pv_get_null(msg, param, res);
			}
			t = _tmx_tmb.t_gett();
			if (t==NULL || t==T_UNDEFINED) {
				return pv_get_null(msg, param, res);
			}
		} else {
			return pv_get_null(msg, param, res);
		}
	}
	switch(param->pvn.u.isname.name.n)
	{
		case 1:
			return pv_get_uintval(msg, param, res, t->hash_index);
		case 3:
			if(get_route_type()==FAILURE_ROUTE) {
				if(_tmx_tmb.t_get_picked_branch()<0 )
					return pv_get_uintval(msg, param, res, 0);
				if(t->uac[_tmx_tmb.t_get_picked_branch()].reply==FAKED_REPLY)
					return pv_get_uintval(msg, param, res, 1);
			}
			return pv_get_uintval(msg, param, res, 0);
		case 8:
			return pv_get_uintval(msg, param, res, t->label);
		case 9:
			return pv_get_uintval(msg, param, res, t->hash_index);
		default:
			return pv_get_uintval(msg, param, res, t->label);
	}
}
开发者ID:adubovikov,项目名称:kamailio,代码行数:54,代码来源:t_var.c

示例12: pv_get_evr

static int pv_get_evr(sip_msg_t *msg, pv_param_t *param, pv_value_t *res)
{
	if(param==NULL || pv_evr_data==NULL) {
		return pv_get_null(msg, param, res);
	}

	switch(param->pvn.u.isname.name.n) {
		case 0: /* data */
			return pv_get_strval(msg, param, res, pv_evr_data);
		default:
			return pv_get_null(msg, param, res);
	}
}
开发者ID:adubovikov,项目名称:kamailio,代码行数:13,代码来源:evrexec_mod.c

示例13: pv_get_t_var_inv

int pv_get_t_var_inv(struct sip_msg *msg,  pv_param_t *param,
		pv_value_t *res)
{
	pv_spec_t *pv=NULL;

	if(pv_t_update_inv(msg))
		return pv_get_null(msg, param, res);

	pv = (pv_spec_t*)param->pvn.u.dname;
	if(pv==NULL || pv_alter_context(pv))
		return pv_get_null(msg, param, res);

	return pv_get_spec_value(&_pv_tinv.msg, pv, res);
}
开发者ID:adubovikov,项目名称:kamailio,代码行数:14,代码来源:t_var.c

示例14: pv_get_shvar

int pv_get_shvar(struct sip_msg *msg,  pv_param_t *param,
		pv_value_t *res)
{
	int len = 0;
	char *sval = NULL;
	sh_var_t *shv=NULL;

	if(msg==NULL || res==NULL)
		return -1;

	if(param==NULL || param->pvn.u.dname==0)
		return pv_get_null(msg, param, res);

	shv= (sh_var_t*)param->pvn.u.dname;

	lock_shvar(shv);
	if(shv->v.flags&VAR_VAL_STR)
	{
		if(param->pvv.s==NULL || param->pvv.len < shv->v.value.s.len)
		{
			if(param->pvv.s!=NULL)
				pkg_free(param->pvv.s);
			param->pvv.s = (char*)pkg_malloc(shv->v.value.s.len*sizeof(char));
			if(param->pvv.s==NULL)
			{
				unlock_shvar(shv);
				LM_ERR("no more pkg mem\n");
				return pv_get_null(msg, param, res);
			}
		}
		strncpy(param->pvv.s, shv->v.value.s.s, shv->v.value.s.len);
		param->pvv.len = shv->v.value.s.len;

		unlock_shvar(shv);

		res->rs = param->pvv;
		res->flags = PV_VAL_STR;
	} else {
		res->ri = shv->v.value.n;

		unlock_shvar(shv);

		sval = sint2str(res->ri, &len);
		res->rs.s = sval;
		res->rs.len = len;
		res->flags = PV_VAL_STR|PV_VAL_INT|PV_TYPE_INT;
	}
	return 0;
}
开发者ID:GeorgeShaw,项目名称:opensips,代码行数:49,代码来源:shvar.c

示例15: pv_tlsext_sn

static int pv_tlsext_sn(sip_msg_t* msg, pv_param_t* param, pv_value_t* res)
{
	if (param->pvn.u.isname.name.n != PV_TLSEXT_SNI) {
		BUG("unexpected parameter value \"%d\"\n",
			param->pvn.u.isname.name.n);
		return pv_get_null(msg, param, res);
	}
	
	if (get_tlsext_sn(&res->rs, msg) < 0) {
		return pv_get_null(msg, param, res);
	}
	
	res->flags = PV_VAL_STR;
	return 0;
}
开发者ID:alezzandro,项目名称:kamailio,代码行数:15,代码来源:tls_select.c


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