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

Function msg_branch_flag_get

pvar.c:4434–4474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4432
4433
4434static int msg_branch_flag_get(struct sip_msg *msg, pv_param_t *param,
4435 pv_value_t *res)
4436{
4437 int size;
4438 int idx;
4439 int idxf;
4440
4441 if (param==NULL||res==NULL) {
4442 LM_CRIT("BUG - bad parameters\n");
4443 return -1;
4444 }
4445
4446 /* get the index */
4447 if (pv_get_spec_index(msg, param, &idx, &idxf)!=0) {
4448 LM_ERR("invalid index\n");
4449 return -1;
4450 }
4451
4452 if(idxf==PV_IDX_ALL) {
4453 LM_ERR("SCRIPT BUG - * not allowed in branch flag reading\n");
4454 return -1;
4455 }
4456
4457 size = get_dset_size();
4458
4459 if (idx<0) {
4460 idx = size + idx;
4461 }
4462
4463 if (idx<0 || idx>=size) {
4464 LM_DBG("inexisting branch flag reading [%d/%d]\n", size, idx);
4465 return -1;
4466 }
4467
4468 if ( isbflagset( msg, idx, param->pvn.u.isname.name.n)==1 ) {
4469 *res = pv_true;
4470 } else {
4471 *res = pv_false;
4472 }
4473 return 0;
4474}
4475
4476
4477/********** generic helper functions ***************/

Callers

nothing calls this directly

Calls 3

pv_get_spec_indexFunction · 0.85
get_dset_sizeFunction · 0.85
isbflagsetFunction · 0.85

Tested by

no test coverage detected