| 439 | |
| 440 | |
| 441 | static 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 | |
| 475 | static int assemble_msg(struct sip_msg* msg, struct tw_info *twi) |
no test coverage detected