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

Function append_msg_branch

dset.c:266–307  ·  view source on GitHub ↗

! \brief * Add a new branch to current transaction */

Source from the content-addressed store, hash-verified

264 * Add a new branch to current transaction
265 */
266int append_msg_branch(struct msg_branch *branch)
267{
268 int idx;
269 struct msg_branch_wrap *new_br;
270 struct dset_ctx *dsct = get_dset_ctx();
271
272 if (dsct && !dsct->enabled)
273 return -1;
274
275 if (dsct==NULL && _dst_malloc(&dsct)<0 )
276 return -1;
277
278 idx = dsct->nr_branches;
279
280 /* if we have already set up the maximum number
281 * of branches, don't try new ones
282 */
283 if (idx == MAX_BRANCHES - 1) {
284 LM_ERR("max nr of branches exceeded\n");
285 ser_error = E_TOO_MANY_BRANCHES;
286 return -1;
287 }
288
289 if (idx % DSET_INCREMENT == 0) {
290 new_br = pkg_realloc(dsct->branches,
291 (idx + DSET_INCREMENT) * sizeof *dsct->branches);
292 if (!new_br) {
293 LM_ERR("oom 2\n");
294 return E_OUT_OF_MEM;
295 }
296 memset((char *)new_br + idx * sizeof *new_br, 0,
297 DSET_INCREMENT * sizeof *new_br);
298
299 dsct->branches = new_br;
300 }
301
302 if (_set_msg_branch( dsct->branches + idx, branch)<0)
303 return -1;
304
305 dsct->nr_branches++;
306 return 1;
307}
308
309
310/* ! \brief

Callers 11

next_branchesFunction · 0.85
w_append_branch_oldFunction · 0.85
w_append_msg_branchFunction · 0.85
pv_set_msg_branchFunction · 0.85
set_alias_to_ruriFunction · 0.85
ospPrepareDestinationFunction · 0.85
shmcontact2dsetFunction · 0.85
test_lookupFunction · 0.85
do_queryFunction · 0.85
cpl_proxy_to_loc_setFunction · 0.85
push_branchFunction · 0.85

Calls 2

_dst_mallocFunction · 0.85
_set_msg_branchFunction · 0.85

Tested by 1

test_lookupFunction · 0.68