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

Function append2buf

modules/tm/t_fifo.c:441–472  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

439
440
441static inline char* append2buf( char *buf, int len, struct sip_msg *req,
442 struct append_elem *elem)
443{
444 pv_value_t value;
445 char *end;
446
447 end = buf+len;
448
449 while (elem)
450 {
451 /* get the value */
452 if (pv_get_spec_value(req, &elem->spec, &value)!=0)
453 {
454 LM_ERR("failed to get '%.*s'\n", elem->name.len,elem->name.s);
455 }
456
457 /* empty element? */
458 if ( !(value.flags&PV_VAL_NULL) ) {
459 /* write the value into the buffer */
460 buf = add2buf( buf, end, &elem->name, &value.rs);
461 if (!buf)
462 {
463 LM_ERR("overflow -> append exceeded %d len\n",len);
464 return 0;
465 }
466 }
467
468 elem = elem->next;
469 }
470
471 return buf;
472}
473
474
475static int assemble_msg(struct sip_msg* msg, struct tw_info *twi)

Callers 1

assemble_msgFunction · 0.85

Calls 2

pv_get_spec_valueFunction · 0.85
add2bufFunction · 0.85

Tested by

no test coverage detected