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

Function pv_get_spec_index

pvar.c:5440–5475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5438
5439
5440int pv_get_spec_index(struct sip_msg* msg, pv_param_p ip, int *idx, int *flags)
5441{
5442 pv_value_t tv;
5443 if(ip==NULL || idx==NULL || flags==NULL)
5444 return -1;
5445
5446 *idx = 0;
5447 *flags = ip->pvi.type;
5448
5449 if(ip->pvi.type == 0)
5450 return 0;
5451
5452 if(ip->pvi.type == PV_IDX_ALL || ip->pvi.type == PV_IDX_APPEND) {
5453 return 0;
5454 }
5455
5456 if(ip->pvi.type == PV_IDX_INT)
5457 {
5458 *idx = ip->pvi.u.ival;
5459 return 0;
5460 }
5461
5462 /* pvar */
5463 if(pv_get_spec_value(msg, (const pv_spec_p)ip->pvi.u.dval, &tv)!=0)
5464 {
5465 LM_ERR("cannot get index value\n");
5466 return -1;
5467 }
5468 if(!(tv.flags & PV_VAL_INT))
5469 {
5470 LM_ERR("invalid index value\n");
5471 return -1;
5472 }
5473 *idx = tv.ri;
5474 return 0;
5475}
5476
5477/* function to set pv value */
5478int pv_set_value(struct sip_msg* msg, pv_spec_p sp,

Callers 15

pv_get_routeFunction · 0.85
pv_get_route_nameFunction · 0.85
pv_get_route_typeFunction · 0.85
pv_get_contact_bodyFunction · 0.85
pv_get_content_typeFunction · 0.85
pv_get_msg_bodyFunction · 0.85
pv_get_branch_fieldsFunction · 0.85
pv_get_msg_branch_fieldsFunction · 0.85
pv_get_msg_branch_attrFunction · 0.85
pv_get_avpFunction · 0.85
pv_get_hdrFunction · 0.85
pv_get_hdr_nameFunction · 0.85

Calls 1

pv_get_spec_valueFunction · 0.85

Tested by

no test coverage detected