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

Function get_route_set

modules/tm/dlg.c:293–336  ·  view source on GitHub ↗

* Create a copy of route set either in normal or reverse order */

Source from the content-addressed store, hash-verified

291 * Create a copy of route set either in normal or reverse order
292 */
293static inline int get_route_set(struct sip_msg* _m, rr_t** _rs, unsigned char _order)
294{
295 struct hdr_field* ptr;
296 rr_t* last, *p, *t;
297
298 last = 0;
299 *_rs = 0;
300
301 ptr = _m->record_route;
302 while(ptr) {
303 if (ptr->type == HDR_RECORDROUTE_T) {
304 if (parse_rr(ptr) < 0) {
305 LM_ERR("failed to parse Record-Route body\n");
306 goto error;
307 }
308
309 p = (rr_t*)ptr->parsed;
310 while(p) {
311 if (shm_duplicate_rr(&t, p, 1/*only first*/) < 0) {
312 LM_ERR("duplicating rr_t\n");
313 goto error;
314 }
315 if (_order == NORMAL_ORDER) {
316 if (!*_rs) *_rs = t;
317 if (last) last->next = t;
318 last = t;
319 } else {
320 t->next = *_rs;
321 *_rs = t;
322 }
323
324 p = p->next;
325 }
326
327 }
328 ptr = ptr->next;
329 }
330
331 return 0;
332
333 error:
334 shm_free_rr(_rs);
335 return -1;
336}
337
338
339/*

Callers 1

response2dlgFunction · 0.70

Calls 3

parse_rrFunction · 0.85
shm_duplicate_rrFunction · 0.85
shm_free_rrFunction · 0.85

Tested by

no test coverage detected