MCPcopy Create free account
hub / github.com/OpenSIPS/opensips / pv_get_avp_name

Function pv_get_avp_name

pvar.c:5399–5437  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5397}
5398
5399int pv_get_avp_name(struct sip_msg* msg, pv_param_p ip, int *avp_name,
5400 unsigned short *name_type)
5401{
5402 pv_value_t tv;
5403 if(ip==NULL || avp_name==NULL || name_type==NULL)
5404 return -1;
5405 *avp_name = 0;
5406 *name_type = 0;
5407
5408 if(ip->pvn.type==PV_NAME_INTSTR)
5409 {
5410 *name_type = ip->pvn.u.isname.type;
5411 *avp_name = ip->pvn.u.isname.name.n;
5412 *name_type &= AVP_SCRIPT_MASK;
5413 return 0;
5414 }
5415 /* pvar */
5416 if(pv_get_spec_value(msg, (const pv_spec_p)(ip->pvn.u.dname), &tv)!=0)
5417 {
5418 LM_ERR("cannot get avp value\n");
5419 return -1;
5420 }
5421 if(tv.flags&PV_VAL_NULL || tv.flags&PV_VAL_EMPTY)
5422 {
5423 LM_ERR("null or empty name\n");
5424 return -1;
5425 }
5426
5427 if(!(tv.flags&PV_VAL_STR))
5428 tv.rs.s = int2str(tv.ri, &tv.rs.len);
5429
5430 /* search the name here */
5431 *avp_name = get_avp_id(&tv.rs);
5432 if (*avp_name == 0) {
5433 LM_ERR("cannot find avp %.*s\n", tv.rs.len, tv.rs.s);
5434 return -1;
5435 }
5436 return 0;
5437}
5438
5439
5440int pv_get_spec_index(struct sip_msg* msg, pv_param_p ip, int *idx, int *flags)

Callers 15

w_cache_raw_queryFunction · 0.85
w_construct_uriFunction · 0.85
w_get_timestampFunction · 0.85
pv_get_msg_branch_attrFunction · 0.85
pv_get_avpFunction · 0.85
pv_set_avpFunction · 0.85
pv_set_msg_branch_attrFunction · 0.85
h350_auth_lookupFunction · 0.85
w_shuffle_avpsFunction · 0.85
init_rpid_avpFunction · 0.85
partition_initFunction · 0.85
mod_initFunction · 0.85

Calls 3

pv_get_spec_valueFunction · 0.85
int2strFunction · 0.85
get_avp_idFunction · 0.85

Tested by

no test coverage detected