| 1580 | |
| 1581 | |
| 1582 | int 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 | |
| 1611 | static inline int ds_get_index(int group, ds_set_p *index, |
no test coverage detected