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

Function get_source_group

modules/permissions/address.c:489–516  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

487
488
489int get_source_group(struct sip_msg* msg, pv_spec_t *out_var,
490 struct pm_part_struct *part)
491{
492 int group;
493 struct ip_addr *ip;
494 pv_value_t pvt;
495
496 ip = &msg->rcv.src_ip;
497 LM_DBG("Looking for <%s, %u> in address table\n",
498 ip_addr2a(ip), msg->rcv.src_port);
499
500 group = pm_hash_find_group(*part->hash_table,
501 ip, msg->rcv.src_port);
502 if (group == -1) return -1;
503 LM_DBG("Found <%d>\n", group);
504
505 pvt.flags = PV_VAL_INT|PV_TYPE_INT;
506 pvt.rs.s = NULL;
507 pvt.rs.len = 0;
508 pvt.ri = group;
509
510 if (pv_set_value(msg, out_var, (int)EQ_T, &pvt) < 0) {
511 LM_ERR("setting of pvar failed\n");
512 return -1;
513 }
514
515 return 1;
516}

Callers

nothing calls this directly

Calls 3

ip_addr2aFunction · 0.85
pm_hash_find_groupFunction · 0.85
pv_set_valueFunction · 0.85

Tested by

no test coverage detected