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

Function ds_hash_pvar

modules/dispatcher/dispatch.c:1582–1608  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1580
1581
1582int ds_hash_pvar(struct sip_msg *msg, unsigned int *hash)
1583{
1584 /* The String to create the hash */
1585 str hash_str = {0, 0};
1586
1587 if(msg==NULL || hash == NULL || hash_param_model == NULL)
1588 {
1589 LM_ERR("bad parameters\n");
1590 return -1;
1591 }
1592 if (pv_printf_s(msg, hash_param_model, &hash_str)<0) {
1593 LM_ERR("error - cannot print the format\n");
1594 return -1;
1595 }
1596
1597 /* Remove empty spaces */
1598 trim(&hash_str);
1599 if (hash_str.len <= 0) {
1600 LM_ERR("String is empty!\n");
1601 return -1;
1602 }
1603 LM_DBG("Hashing %.*s!\n", hash_str.len, hash_str.s);
1604
1605 *hash = ds_get_hash(&hash_str, NULL);
1606
1607 return 0;
1608}
1609
1610
1611static inline int ds_get_index(int group, ds_set_p *index,

Callers 1

ds_select_dstFunction · 0.85

Calls 3

pv_printf_sFunction · 0.85
trimFunction · 0.85
ds_get_hashFunction · 0.85

Tested by

no test coverage detected