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

Function get_msg_branch_attr

dset.c:894–930  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

892
893
894int get_msg_branch_attr(unsigned int b_idx, int name_id,
895 unsigned short *flags, int_str *val)
896{
897 struct dset_ctx *dsct = get_dset_ctx();
898 struct usr_avp **attrs;
899 struct usr_avp *avp;
900 struct usr_avp** old_list;
901
902 if (!dsct)
903 return -1;
904
905 if (b_idx==0)
906 attrs = &(dsct->ruri_attrs);
907 else if (b_idx-1 < get_dset_size())
908 attrs = &dsct->branches[b_idx - 1].branch.attrs;
909 else {
910 LM_DBG("index %d out of rante (available branches %d)\n",
911 b_idx, get_dset_size() );
912 return -1;
913 }
914
915 LM_DBG("getting attr [%d] on branch %d/ptr=%p\n",name_id, b_idx, attrs);
916
917 /* operate on the list of ATTRS/AVPS of the branch */
918 old_list = set_avp_list( attrs );
919
920 avp = search_first_avp(0, name_id, val, 0);
921
922 set_avp_list( old_list );
923
924 if (avp)
925 *flags = avp->flags;
926 else
927 *flags = AVP_VAL_NULL;
928
929 return avp ? 1 : -1 ;
930}
931
932
933int set_msg_branch_attr(unsigned int b_idx, int name_id,

Callers 1

pv_get_msg_branch_attrFunction · 0.85

Calls 3

get_dset_sizeFunction · 0.85
set_avp_listFunction · 0.85
search_first_avpFunction · 0.85

Tested by

no test coverage detected