* Retrieves the cluster_id of a message, if present in via * Returns: * -2: if param was found, but there was a parsing error * -1: if param was not found * cid: the cluster id, if found and valid */
| 464 | * cid: the cluster id, if found and valid |
| 465 | */ |
| 466 | static int tm_get_cid(struct sip_msg *msg) |
| 467 | { |
| 468 | int cid; |
| 469 | struct via_param *p; |
| 470 | |
| 471 | if (!msg->via1 || !msg->via1->param_lst) |
| 472 | goto not_found; |
| 473 | /* search for the cid parameter */ |
| 474 | for (p = msg->via1->param_lst; p; p = p->next) |
| 475 | if (p->type == GEN_PARAM && p->name.len == tm_cluster_param.len && |
| 476 | memcmp(p->name.s, tm_cluster_param.s, p->name.len) == 0) |
| 477 | /* found the parameter - get its value */ |
| 478 | return (str2sint(&p->value, &cid) == 0 ? cid : -2); |
| 479 | |
| 480 | not_found: |
| 481 | return -1; |
| 482 | } |
| 483 | |
| 484 | /** |
| 485 | * Checks if a message should be replicated, and if it is, replicates it |
no test coverage detected