clones the headers list from the `from` sip_msg * into the `to` sip_msg structure */
| 660 | /* clones the headers list from the `from` sip_msg |
| 661 | * into the `to` sip_msg structure */ |
| 662 | int clone_headers(struct sip_msg *from_msg, struct sip_msg *to_msg) |
| 663 | { |
| 664 | int hdrs_no, i; |
| 665 | struct hdr_field *hdrs; |
| 666 | struct hdr_field *hdr; |
| 667 | |
| 668 | #define link_sibling_hdr_case(_hook, _hdr_type) \ |
| 669 | case _hdr_type: \ |
| 670 | _add_last(&hdrs[i], to_msg->_hook, sibling);\ |
| 671 | break |
| 672 | #define link_hdr_case(_hook, _hdr_type) \ |
| 673 | case _hdr_type: \ |
| 674 | to_msg->_hook=&hdrs[i];\ |
| 675 | break |
| 676 | |
| 677 | /* |
| 678 | * we need to duplicate the headers because the hdr->parsed field resides |
| 679 | * in shm memory, so there might be a different process that access the |
| 680 | * parsed field and find the structure parsed by the current process in |
| 681 | * pkg |
| 682 | */ |
| 683 | for (hdrs_no = 0, hdr = from_msg->headers; hdr; hdr = hdr->next) |
| 684 | hdrs_no++; |
| 685 | |
| 686 | hdrs = pkg_malloc(hdrs_no * sizeof(struct hdr_field)); |
| 687 | if (!hdrs) { |
| 688 | LM_ERR("could not allocate %d contact headers!\n", hdrs_no); |
| 689 | return -1; |
| 690 | } |
| 691 | |
| 692 | /* reset all header fields before populating new ones */ |
| 693 | to_msg->h_via1 = NULL; |
| 694 | to_msg->callid = NULL; |
| 695 | to_msg->to = NULL; |
| 696 | to_msg->cseq = NULL; |
| 697 | to_msg->from = NULL; |
| 698 | to_msg->contact = NULL; |
| 699 | to_msg->maxforwards = NULL; |
| 700 | to_msg->route = NULL; |
| 701 | to_msg->record_route = NULL; |
| 702 | to_msg->path = NULL; |
| 703 | to_msg->content_type = NULL; |
| 704 | to_msg->content_length = NULL; |
| 705 | to_msg->authorization = NULL; |
| 706 | to_msg->expires = NULL; |
| 707 | to_msg->proxy_auth = NULL; |
| 708 | to_msg->supported = NULL; |
| 709 | to_msg->proxy_require = NULL; |
| 710 | to_msg->unsupported = NULL; |
| 711 | to_msg->allow = NULL; |
| 712 | to_msg->event = NULL; |
| 713 | to_msg->accept = NULL; |
| 714 | to_msg->accept_language = NULL; |
| 715 | to_msg->organization = NULL; |
| 716 | to_msg->priority = NULL; |
| 717 | to_msg->subject = NULL; |
| 718 | to_msg->user_agent = NULL; |
| 719 | to_msg->content_disposition = NULL; |
no outgoing calls
no test coverage detected