* Create Via header */
| 610 | * Create Via header |
| 611 | */ |
| 612 | static inline int assemble_via(str* dest, struct cell* t, const struct socket_info* sock, int branch, str *extra) |
| 613 | { |
| 614 | static char branch_buf[MAX_BRANCH_PARAM_LEN]; |
| 615 | char* via; |
| 616 | int len; |
| 617 | unsigned int via_len; |
| 618 | str branch_str; |
| 619 | struct hostport hp; |
| 620 | |
| 621 | if (!t_calc_branch(t, branch, branch_buf, &len)) { |
| 622 | LM_ERR("branch calculation failed\n"); |
| 623 | return -1; |
| 624 | } |
| 625 | |
| 626 | branch_str.s = branch_buf; |
| 627 | branch_str.len = len; |
| 628 | |
| 629 | #ifdef XL_DEBUG |
| 630 | printf("!!!proto: %d\n", sock->proto); |
| 631 | #endif |
| 632 | |
| 633 | set_hostport(&hp, 0); |
| 634 | via = via_builder(&via_len, sock, &branch_str, extra, sock->proto, &hp); |
| 635 | if (!via) { |
| 636 | LM_ERR("via building failed\n"); |
| 637 | return -2; |
| 638 | } |
| 639 | |
| 640 | dest->s = via; |
| 641 | dest->len = via_len; |
| 642 | return 0; |
| 643 | } |
| 644 | |
| 645 | |
| 646 | /* |
no test coverage detected