| 68 | |
| 69 | |
| 70 | static inline struct hdr_field* extract_parsed_hdrs( char *buf, int len) |
| 71 | { |
| 72 | char *p; |
| 73 | static struct sip_msg msg; |
| 74 | struct hdr_field *hdr; |
| 75 | |
| 76 | /* skip the first line - not interesting */ |
| 77 | p = eat_line( buf, len); |
| 78 | if (p>=buf+len) |
| 79 | return 0; |
| 80 | |
| 81 | memset( &msg, 0, sizeof(struct sip_msg) ); |
| 82 | msg.buf = buf; |
| 83 | msg.len = len; |
| 84 | msg.unparsed = p; |
| 85 | |
| 86 | /* as we need all Route headers, we need to parse all headers */ |
| 87 | if (parse_headers( &msg, HDR_EOH_F, 0)==-1) |
| 88 | goto error; |
| 89 | |
| 90 | hdr = msg.headers; |
| 91 | msg.headers = 0; |
| 92 | |
| 93 | free_sip_msg( &msg ); |
| 94 | return hdr; |
| 95 | error: |
| 96 | free_sip_msg( &msg ); |
| 97 | return 0; |
| 98 | } |
| 99 | |
| 100 | |
| 101 | /* Build a local request based on a previous request; the only |
no test coverage detected