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

Function move_msg_branch

dset.c:789–817  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

787
788
789int move_msg_branch(struct sip_msg *msg, int src_idx, int dst_idx,
790 int keep_src)
791{
792 struct dset_ctx *dsct = get_dset_ctx();
793
794 if (src_idx==dst_idx)
795 /* this is a NOP */
796 return 0;
797
798 /* no branches have been added yet */
799 if (!dsct)
800 return -1;
801
802 if ( (src_idx>0 && src_idx>=dsct->nr_branches)
803 || (dst_idx>0 && dst_idx>=dsct->nr_branches) ) {
804 LM_ERR("overflow in src [%d] or dst [%d] indexes (having %d)\n",
805 src_idx, dst_idx, dsct->nr_branches);
806 return -1;
807 }
808
809 /* copy dst over src */
810 if (_copy_branch( msg, dsct, src_idx, dst_idx)<0)
811 return -1;
812
813 if (!keep_src && src_idx>0)
814 remove_msg_branch(src_idx);
815
816 return 0;
817}
818
819
820/**** Functions to work with the members ****/

Callers 1

w_move_msg_branchFunction · 0.85

Calls 2

_copy_branchFunction · 0.85
remove_msg_branchFunction · 0.85

Tested by

no test coverage detected