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

Function _copy_branch

dset.c:661–694  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

659
660
661static inline int _copy_branch(struct sip_msg *msg, struct dset_ctx *dsct,
662 int src_idx, int dst_idx)
663{
664 struct msg_branch_wrap *brs = dsct->branches;
665 int ret = 0;
666
667 if (dst_idx>=0) {
668 /* we copy into a branch */
669 if (src_idx>=0) {
670 /* we copy from a branch */
671 /* destroy the avps of the dst branch before the bulk copy */
672 destroy_avp_list( &brs[dst_idx].branch.attrs );
673 /* do the copy */
674 brs[dst_idx] = brs[src_idx];
675 _post_copy_branch_update( brs+dst_idx );
676 /* clone the list of attrs from src to dst now */
677 brs[dst_idx].branch.attrs =
678 clone_avp_list( brs[src_idx].branch.attrs );
679 } else {
680 /* we copy from msg */
681 ret = _msg_2_branch( dsct, msg, &brs[dst_idx]);
682 }
683 } else {
684 /* we copy into msg */
685 if (src_idx>=0) {
686 /* we copy from a branch */
687 ret = _branch_2_msg( dsct, &brs[src_idx], msg);
688 } else {
689 /* this should not happen, it is a NOP */
690 }
691 }
692
693 return ret;
694}
695
696
697int move_msg_branch_to_ruri(int idx, struct sip_msg *msg)

Callers 2

swap_msg_branchesFunction · 0.85
move_msg_branchFunction · 0.85

Calls 4

destroy_avp_listFunction · 0.85
clone_avp_listFunction · 0.85
_msg_2_branchFunction · 0.85
_branch_2_msgFunction · 0.85

Tested by

no test coverage detected