/src/opensips/parser/msg_parser.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright (C) 2001-2003 FhG Fokus |
3 | | * |
4 | | * This file is part of opensips, a free SIP server. |
5 | | * |
6 | | * opensips is free software; you can redistribute it and/or modify |
7 | | * it under the terms of the GNU General Public License as published by |
8 | | * the Free Software Foundation; either version 2 of the License, or |
9 | | * (at your option) any later version |
10 | | * |
11 | | * opensips is distributed in the hope that it will be useful, |
12 | | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
14 | | * GNU General Public License for more details. |
15 | | * |
16 | | * You should have received a copy of the GNU General Public License |
17 | | * along with this program; if not, write to the Free Software |
18 | | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
19 | | * |
20 | | * History |
21 | | * ------- |
22 | | * 2003-01-28 removed scratchpad (jiri) |
23 | | * 2003-02-28 scratchpad compatibility abandoned (jiri) |
24 | | * 2003-03-06 enum_request_method changed to begin with 1; |
25 | | * 0 reserved for invalid values; (jiri) |
26 | | * 2003-03-31 removed sip_msg->repl_add_rm (andrei) |
27 | | * 2003-04-01 2 macros added: GET_NEXT_HOP and GET_RURI (janakj) |
28 | | * 2003-04-04 structure for parsed inbound uri added (jiri) |
29 | | * 2003-04-11 updated the sip_uri structure (lots of fields added) (andrei) |
30 | | * 2003-04-12 added msg_flags to sip_msg (andrei) |
31 | | * 2003-11-02 added diversion header field to sip_msg (jh) |
32 | | * 2004-11-08 added force_send_socket (andrei) |
33 | | * 2005-02-25 uri types added (sip, sips & tel) (andrei) |
34 | | * 2006-02-17 Session-Expires, Min-SE (dhsueh@somanetworks.com) |
35 | | * 2007-09-09 added sdp structure (osas) |
36 | | * 2011-04-20 added support for URI unknown parameters (osas) |
37 | | */ |
38 | | |
39 | | |
40 | | #ifndef MSG_PARSER_H |
41 | | #define MSG_PARSER_H |
42 | | |
43 | | #include <strings.h> |
44 | | #include <sys/time.h> |
45 | | |
46 | | #include "../str.h" |
47 | | #include "../lump_struct.h" |
48 | | #include "../flags.h" |
49 | | #include "../ip_addr.h" |
50 | | #include "../md5utils.h" |
51 | | #include "../qvalue.h" |
52 | | #include "../config.h" |
53 | | #include "parse_def.h" |
54 | | #include "parse_cseq.h" |
55 | | #include "parse_content.h" |
56 | | #include "parse_via.h" |
57 | | #include "parse_fline.h" |
58 | | #include "parse_body.h" |
59 | | #include "hf.h" |
60 | | #include "../trim.h" |
61 | | |
62 | | |
63 | | /* convenience short-cut macros */ |
64 | 0 | #define REQ_LINE(_msg) ((_msg)->first_line.u.request) |
65 | 0 | #define REQ_METHOD first_line.u.request.method_value |
66 | | #define REQ_METHOD_S first_line.u.request.method |
67 | 0 | #define REPLY_STATUS first_line.u.reply.statuscode |
68 | | #define REPLY_CLASS(_reply) ((_reply)->REPLY_STATUS/100) |
69 | | |
70 | | /* number methods as power of two to allow bitmap matching */ |
71 | | enum request_method { |
72 | | METHOD_UNDEF=0, /* 0 - --- */ |
73 | | METHOD_INVITE=1, /* 1 - 2^0 */ |
74 | | METHOD_CANCEL=2, /* 2 - 2^1 */ |
75 | | METHOD_ACK=4, /* 3 - 2^2 */ |
76 | | METHOD_BYE=8, /* 4 - 2^3 */ |
77 | | METHOD_INFO=16, /* 5 - 2^4 */ |
78 | | METHOD_OPTIONS=32, /* 6 - 2^5 */ |
79 | | METHOD_UPDATE=64, /* 7 - 2^6 */ |
80 | | METHOD_REGISTER=128, /* 8 - 2^7 */ |
81 | | METHOD_MESSAGE=256, /* 9 - 2^8 */ |
82 | | METHOD_SUBSCRIBE=512, /* 10 - 2^9 */ |
83 | | METHOD_NOTIFY=1024, /* 11 - 2^10 */ |
84 | | METHOD_PRACK=2048, /* 12 - 2^11 */ |
85 | | METHOD_REFER=4096, /* 13 - 2^12 */ |
86 | | METHOD_PUBLISH=8192, /* 14 - 2^13 */ |
87 | | METHOD_OTHER=16384 /* 15 - 2^14 */ |
88 | | }; |
89 | | |
90 | 0 | #define FL_FORCE_RPORT (1<<0) /* force rport (top via) */ |
91 | 0 | #define FL_REPLY_TO_VIA (1<<1) /* force replying to VIA ip:port */ |
92 | 0 | #define FL_FORCE_LOCAL_RPORT (1<<2) /* force local rport (local via) */ |
93 | | #define FL_SDP_IP_AFS (1<<3) /* SDP IP rewritten */ |
94 | | #define FL_SDP_PORT_AFS (1<<4) /* SDP port rewritten */ |
95 | | #define FL_SHM_CLONE (1<<5) /* msg cloned in SHM as a single chunk */ |
96 | | #define FL_USE_UAC_FROM (1<<6) /* take FROM hdr from UAC insteas of UAS*/ |
97 | | #define FL_USE_UAC_TO (1<<7) /* take TO hdr from UAC insteas of UAS */ |
98 | | #define FL_USE_UAC_CSEQ (1<<8) /* take CSEQ hdr from UAC insteas of UAS*/ |
99 | | #define FL_REQ_UPSTREAM (1<<9) /* it's an upstream going request */ |
100 | | #define FL_DO_KEEPALIVE (1<<10) /* keepalive request's source after a |
101 | | * positive reply */ |
102 | | #define FL_USE_MEDIA_PROXY (1<<11) /* use mediaproxy on all messages during |
103 | | * a dialog */ |
104 | | #define FL_USE_RTPPROXY (1<<12) /* used by rtpproxy to remember if the msg |
105 | | * callback had already been registered */ |
106 | | #define FL_NAT_TRACK_DIALOG (1<<13) /* trigger dialog tracking from the |
107 | | * nat_traversal module */ |
108 | | #define FL_USE_SIPTRACE (1<<14) /* used by tracer to check if the tm |
109 | | * callbacks were registered */ |
110 | | #define FL_SHM_UPDATABLE (1<<15) /* a SHM cloned message can be updated |
111 | | * (TM used, requires FL_SHM_CLONE) */ |
112 | | #define FL_SHM_UPDATED (1<<16) /* an updatable SHM cloned message that |
113 | | * had at least one update; if the flag is |
114 | | * missing, it means the cloned msg was |
115 | | * never updated. |
116 | | * (TM used, requires FL_SHM_UPDATABLE) */ |
117 | | #define FL_TM_CB_REGISTERED (1<<17) /* tm callbacks for this message have been |
118 | | * registered (by setting this flag, you |
119 | | * will know if any tm callbacks for this |
120 | | * message have been registered) */ |
121 | | #define FL_TM_FAKE_REQ (1<<18) /* the SIP request is a fake one, |
122 | | * generated based on the transaction, |
123 | | * either in failure route or resume |
124 | | * route */ |
125 | | #define FL_TM_REPLICATED (1<<19) /* message received due to a tm replication */ |
126 | | #define FL_BODY_NO_SDP (1<<20) /* message does not have an SDP body */ |
127 | | #define FL_IS_LOCAL (1<<21) /* the message is a locally generated |
128 | | * one, not received */ |
129 | 0 | #define FL_HAS_ROUTE_LUMP (1<<22) /* the message had Route headers added |
130 | | * as lumps */ |
131 | | #define FL_USE_SIPTRACE_B2B (1<<23) /* used by tracer to check if the b2b |
132 | | * tracing was enabled */ |
133 | | #define FL_ACK_WITH_BODY (1<<24) /* ACK message has SDP body */ |
134 | | #define FL_TM_FAKE_REQ_REBUILT (1<<25) /* a TM faked request whose buffer and |
135 | | * parsed structures were re-flattened by |
136 | | * b2b into standalone pkg memory, no |
137 | | * longer sharing the transaction clone |
138 | | * (GH#3796) */ |
139 | | |
140 | | /* define the # of unknown URI parameters to parse */ |
141 | 0 | #define URI_MAX_U_PARAMS 10 |
142 | | |
143 | 71.4k | #define IFISMETHOD(methodname,firstchar) \ |
144 | 71.4k | if ( (*tmp==(firstchar) || *tmp==((firstchar) | 32)) && \ |
145 | 71.4k | strncasecmp( tmp+1, (char *)#methodname+1, methodname##_LEN-1)==0 && \ |
146 | 71.4k | *(tmp+methodname##_LEN)==' ') { \ |
147 | 8 | fl->type=SIP_REQUEST; \ |
148 | 8 | fl->u.request.method.len=methodname##_LEN; \ |
149 | 8 | fl->u.request.method_value=METHOD_##methodname; \ |
150 | 8 | tmp=buffer+methodname##_LEN; \ |
151 | 8 | } |
152 | | |
153 | | |
154 | | /* |
155 | | * Return a URI to which the message should be really sent (not what should |
156 | | * be in the Request URI. The following fields are tried in this order: |
157 | | * 1) dst_uri |
158 | | * 2) new_uri |
159 | | * 3) first_line.u.request.uri |
160 | | */ |
161 | | #define GET_NEXT_HOP(m) \ |
162 | | (((m)->dst_uri.s && (m)->dst_uri.len) ? (&(m)->dst_uri) : \ |
163 | | (((m)->new_uri.s && (m)->new_uri.len) ? (&(m)->new_uri) : (&(m)->first_line.u.request.uri))) |
164 | | |
165 | | |
166 | | /* |
167 | | * Return the Reqeust URI of a message. |
168 | | * The following fields are tried in this order: |
169 | | * 1) new_uri |
170 | | * 2) first_line.u.request.uri |
171 | | */ |
172 | 0 | #define GET_RURI(m) \ |
173 | 0 | (((m)->new_uri.s && (m)->new_uri.len) ? (&(m)->new_uri) : (&(m)->first_line.u.request.uri)) |
174 | | |
175 | | |
176 | | enum _uri_type{ERROR_URI_T=0, SIP_URI_T, SIPS_URI_T, TEL_URI_T, TELS_URI_T, URN_SERVICE_URI_T, URN_NENA_SERVICE_URI_T}; |
177 | | typedef enum _uri_type uri_type; |
178 | | |
179 | | struct sip_uri { |
180 | | str user; /* Username */ |
181 | | str passwd; /* Password */ |
182 | | str host; /* Host name */ |
183 | | str port; /* Port number */ |
184 | | str params; /* Parameters */ |
185 | | str headers; |
186 | | unsigned short port_no; |
187 | | unsigned short proto; /* from transport */ |
188 | | uri_type type; /* uri scheme */ |
189 | | |
190 | | /* parameters [+ "=value" parts, if any] */ |
191 | | str transport; |
192 | | str ttl; |
193 | | str user_param; |
194 | | str maddr; |
195 | | str method; |
196 | | str lr; |
197 | | str r2; /* ser specific rr parameter */ |
198 | | str gr; /* GRUU */ |
199 | | str pn_provider; /* RFC 8599 (SIP PN) */ |
200 | | str pn_prid; |
201 | | str pn_param; |
202 | | str pn_purr; |
203 | | |
204 | | /* just values */ |
205 | | str transport_val; |
206 | | str ttl_val; |
207 | | str user_param_val; |
208 | | str maddr_val; |
209 | | str method_val; |
210 | | str lr_val; /* lr value placeholder for lr=on a.s.o*/ |
211 | | str r2_val; |
212 | | str gr_val; |
213 | | str pn_provider_val; |
214 | | str pn_prid_val; |
215 | | str pn_param_val; |
216 | | str pn_purr_val; |
217 | | /* XXX - in the future when adding params as special links |
218 | | * in the list above, make sure to also update compare_uris() function |
219 | | * to explicitly compare these here */ |
220 | | |
221 | | /* unknown params */ |
222 | | str u_name[URI_MAX_U_PARAMS]; /* Unknown param names */ |
223 | | str u_val[URI_MAX_U_PARAMS]; /* Unknown param valss */ |
224 | | unsigned short u_params_no; /* No of unknown params */ |
225 | | }; |
226 | | |
227 | | |
228 | | #include "parse_to.h" |
229 | | |
230 | | /* Forward declaration */ |
231 | | struct msg_callback; |
232 | | |
233 | | struct sip_msg { |
234 | | unsigned int id; /* message id, unique/process*/ |
235 | | struct msg_start first_line; /* Message first line */ |
236 | | struct via_body* via1; /* The first via */ |
237 | | struct via_body* via2; /* The second via */ |
238 | | struct hdr_field* headers; /* All the parsed headers*/ |
239 | | struct hdr_field* last_header; /* Pointer to the last parsed header*/ |
240 | | hdr_flags_t parsed_flag; /* Already parsed header field types */ |
241 | | |
242 | | /* Via, To, CSeq, Call-Id, From, end of header*/ |
243 | | /* pointers to the first occurrences of these headers; |
244 | | * everything is also saved in 'headers' |
245 | | * (WARNING: do not deallocate them twice!)*/ |
246 | | |
247 | | struct hdr_field* h_via1; |
248 | | struct hdr_field* callid; |
249 | | struct hdr_field* to; |
250 | | struct hdr_field* cseq; |
251 | | struct hdr_field* from; |
252 | | struct hdr_field* contact; |
253 | | struct hdr_field* maxforwards; |
254 | | struct hdr_field* route; |
255 | | struct hdr_field* record_route; |
256 | | struct hdr_field* path; |
257 | | struct hdr_field* content_type; |
258 | | struct hdr_field* content_length; |
259 | | struct hdr_field* authorization; |
260 | | struct hdr_field* expires; |
261 | | struct hdr_field* proxy_auth; |
262 | | struct hdr_field* supported; |
263 | | struct hdr_field* proxy_require; |
264 | | struct hdr_field* unsupported; |
265 | | struct hdr_field* allow; |
266 | | struct hdr_field* event; |
267 | | struct hdr_field* accept; |
268 | | struct hdr_field* accept_language; |
269 | | struct hdr_field* organization; |
270 | | struct hdr_field* priority; |
271 | | struct hdr_field* subject; |
272 | | struct hdr_field* user_agent; |
273 | | struct hdr_field* content_disposition; |
274 | | struct hdr_field* accept_disposition; |
275 | | struct hdr_field* diversion; |
276 | | struct hdr_field* rpid; |
277 | | struct hdr_field* refer_to; |
278 | | struct hdr_field* session_expires; |
279 | | struct hdr_field* min_se; |
280 | | struct hdr_field* ppi; |
281 | | struct hdr_field* pai; |
282 | | struct hdr_field* privacy; |
283 | | struct hdr_field* call_info; |
284 | | struct hdr_field* www_authenticate; |
285 | | struct hdr_field* proxy_authenticate; |
286 | | struct hdr_field* min_expires; |
287 | | struct hdr_field* feature_caps; |
288 | | struct hdr_field* replaces; |
289 | | struct hdr_field* security_client; |
290 | | struct hdr_field* security_server; |
291 | | struct hdr_field* security_verify; |
292 | | |
293 | | struct sip_msg_body *body; |
294 | | /* optional, real-time changes performed on the first SDP body part */ |
295 | | struct sdp_body_part_ops *sdp_ops; |
296 | | |
297 | | char* eoh; /* pointer to the end of header (if found) or null */ |
298 | | char* unparsed; /* here we stopped parsing*/ |
299 | | |
300 | | struct receive_info rcv; /* source & dest ip, ports, proto a.s.o*/ |
301 | | |
302 | | char* buf; /* scratch pad, holds a unmodified message, |
303 | | * via, etc. point into it */ |
304 | | unsigned int len; /* message len (orig) */ |
305 | | |
306 | | /* attributes of the msg as first/default branch */ |
307 | | str new_uri; /* changed first line uri, when you change this |
308 | | * don't forget to set parsed_uri_ok to 0 */ |
309 | | str dst_uri; /* Destination URI, must be forwarded to this URI if len!=0 */ |
310 | | |
311 | | qvalue_t ruri_q; /* Q value of RURI */ |
312 | | |
313 | | unsigned int ruri_bflags; /* per-branch flags for RURI*/ |
314 | | |
315 | | /* force sending on this socket */ |
316 | | const struct socket_info* force_send_socket; |
317 | | |
318 | | /* path vector to generate Route hdrs */ |
319 | | str path_vec; |
320 | | /* end-of-attributes for RURI as first branch*/ |
321 | | |
322 | | /* current uri */ |
323 | | int parsed_uri_ok; /* 1 if parsed_uri is valid, 0 if not, set it to 0 |
324 | | if you modify the uri (e.g change new_uri)*/ |
325 | | struct sip_uri parsed_uri; /* speed-up > keep here the parsed uri*/ |
326 | | |
327 | | /* the same for original uri */ |
328 | | int parsed_orig_ruri_ok; |
329 | | struct sip_uri parsed_orig_ruri; |
330 | | |
331 | | /* modifications */ |
332 | | struct lump* add_rm; /* used for all the forwarded requests/replies */ |
333 | | struct lump* body_lumps; /* Lumps that update Content-Length */ |
334 | | struct lump_rpl *reply_lump; /* only for localy generated replies !!!*/ |
335 | | |
336 | | /* whatever whoever want to append to branch comes here */ |
337 | | char add_to_branch_s[MAX_BRANCH_PARAM_LEN]; |
338 | | int add_to_branch_len; |
339 | | |
340 | | /* index to TM hash table; stored in core to avoid |
341 | | * unnecessary calculations */ |
342 | | unsigned int hash_index; |
343 | | |
344 | | /* flags used from script */ |
345 | | flag_t flags; |
346 | | |
347 | | /* flags used by core - allows to set various flags on the message; may |
348 | | * be used for simple inter-module communication or remembering |
349 | | * processing state reached, e.g. FL_FORCE_RPORT */ |
350 | | unsigned int msg_flags; |
351 | | |
352 | | str set_global_address; |
353 | | str set_global_port; |
354 | | |
355 | | /* used to store a particular time of the message - note that the time is |
356 | | * not stored when the message was received, but only the first time |
357 | | * someone gets interested in it - this way we have a consistent timestamp |
358 | | * of the message, without being affected by lazy callbacks */ |
359 | | struct timeval time; |
360 | | |
361 | | struct msg_callback *msg_cb; |
362 | | }; |
363 | | |
364 | | |
365 | | /* pointer to a fakes message which was never received ; |
366 | | (when this message is "relayed", it is generated out |
367 | | of the original request) |
368 | | */ |
369 | 0 | #define FAKED_REPLY ((struct sip_msg *) -1) |
370 | | |
371 | | extern int via_cnt; |
372 | | extern int sdp_get_custom_body(struct sip_msg *msg, str *body); |
373 | | |
374 | | #define parse_msg( _buf, _len, _msg) \ |
375 | 14.3k | parse_msg_opt( _buf, _len, _msg, 1) |
376 | | |
377 | | int parse_msg_opt(char* buf, unsigned int len, struct sip_msg* msg, |
378 | | int free_on_err); |
379 | | |
380 | 13.3k | #define parse_headers(msg, flags,next) parse_headers_aux(msg,flags,next, 1) |
381 | | |
382 | | int parse_headers_aux(struct sip_msg* msg, hdr_flags_t flags, int next, int sip_well_known_parse); |
383 | | |
384 | 0 | #define get_hdr_field(buf,end,hdr) get_hdr_field_aux(buf,end,hdr,1) |
385 | | |
386 | | char* get_hdr_field_aux(char* buf, char* end, struct hdr_field* hdr, int sip_well_known_parse); |
387 | | |
388 | | /* add DEL lumps for all headers matching the given @hdr */ |
389 | | int delete_headers(struct sip_msg *msg, struct hdr_field *hdr); |
390 | | |
391 | | void free_sip_msg(struct sip_msg* msg); |
392 | | |
393 | | int clone_headers(struct sip_msg *from_msg, struct sip_msg *to_msg); |
394 | | |
395 | | /* make sure all HFs needed for transaction identification have been |
396 | | parsed; return 0 if those HFs can't be found |
397 | | */ |
398 | | |
399 | | int check_transaction_quadruple( struct sip_msg* msg ); |
400 | | |
401 | | /* calculate characteristic value of a message -- this value |
402 | | is used to identify a transaction during the process of |
403 | | reply matching |
404 | | */ |
405 | | inline static int char_msg_val( struct sip_msg *msg, char *cv ) |
406 | 0 | { |
407 | 0 | str src[8]; |
408 | 0 |
|
409 | 0 | if (!check_transaction_quadruple(msg)) { |
410 | 0 | LM_ERR("can't calculate char_value due to a parsing error\n"); |
411 | 0 | memset( cv, '0', MD5_LEN ); |
412 | 0 | return 0; |
413 | 0 | } |
414 | 0 |
|
415 | 0 | src[0]= msg->from->body; |
416 | 0 | src[1]= msg->to->body; |
417 | 0 | src[2]= msg->callid->body; |
418 | 0 | src[3]= msg->first_line.u.request.uri; |
419 | 0 | src[4]= get_cseq( msg )->number; |
420 | 0 |
|
421 | 0 | /* topmost Via is part of transaction key as well ! */ |
422 | 0 | src[5]= msg->via1->host; |
423 | 0 | src[6]= msg->via1->port_str; |
424 | 0 | if (msg->via1->branch) { |
425 | 0 | src[7]= msg->via1->branch->value; |
426 | 0 | MD5StringArray ( cv, src, 8 ); |
427 | 0 | } else { |
428 | 0 | MD5StringArray( cv, src, 7 ); |
429 | 0 | } |
430 | 0 | return 1; |
431 | 0 | } Unexecuted instantiation: fuzz_msg_parser.c:char_msg_val Unexecuted instantiation: msg_parser.c:char_msg_val Unexecuted instantiation: parse_uri.c:char_msg_val Unexecuted instantiation: parse_fline.c:char_msg_val Unexecuted instantiation: parse_methods.c:char_msg_val Unexecuted instantiation: parse_hname2.c:char_msg_val Unexecuted instantiation: parse_content.c:char_msg_val Unexecuted instantiation: hf.c:char_msg_val Unexecuted instantiation: parse_to.c:char_msg_val Unexecuted instantiation: parse_via.c:char_msg_val Unexecuted instantiation: error.c:char_msg_val Unexecuted instantiation: data_lump_rpl.c:char_msg_val Unexecuted instantiation: dprint.c:char_msg_val Unexecuted instantiation: pt.c:char_msg_val Unexecuted instantiation: strcommon.c:char_msg_val Unexecuted instantiation: ut.c:char_msg_val Unexecuted instantiation: msg_callbacks.c:char_msg_val Unexecuted instantiation: sdp_ops.c:char_msg_val Unexecuted instantiation: statistics.c:char_msg_val Unexecuted instantiation: pvar.c:char_msg_val Unexecuted instantiation: route.c:char_msg_val Unexecuted instantiation: socket_info.c:char_msg_val Unexecuted instantiation: data_lump.c:char_msg_val Unexecuted instantiation: ipc.c:char_msg_val Unexecuted instantiation: core_stats.c:char_msg_val Unexecuted instantiation: route_struct.c:char_msg_val Unexecuted instantiation: dset.c:char_msg_val Unexecuted instantiation: pt_scaling.c:char_msg_val Unexecuted instantiation: pt_load.c:char_msg_val Unexecuted instantiation: sr_module.c:char_msg_val Unexecuted instantiation: action.c:char_msg_val Unexecuted instantiation: flags.c:char_msg_val Unexecuted instantiation: db_insertq.c:char_msg_val Unexecuted instantiation: db.c:char_msg_val Unexecuted instantiation: pi_framework.c:char_msg_val Unexecuted instantiation: proto_tcp.c:char_msg_val Unexecuted instantiation: proto_udp.c:char_msg_val Unexecuted instantiation: trans.c:char_msg_val Unexecuted instantiation: net_tcp_proc.c:char_msg_val Unexecuted instantiation: proxy_protocol.c:char_msg_val Unexecuted instantiation: net_tcp.c:char_msg_val Unexecuted instantiation: tcp_common.c:char_msg_val Unexecuted instantiation: net_udp.c:char_msg_val Unexecuted instantiation: tcp_conn_profile.c:char_msg_val Unexecuted instantiation: trans_trace.c:char_msg_val Unexecuted instantiation: net_tcp_report.c:char_msg_val Unexecuted instantiation: shm_mem.c:char_msg_val Unexecuted instantiation: mi.c:char_msg_val Unexecuted instantiation: item.c:char_msg_val Unexecuted instantiation: sdp.c:char_msg_val Unexecuted instantiation: sdp_helpr_funcs.c:char_msg_val Unexecuted instantiation: digest_parser.c:char_msg_val Unexecuted instantiation: param_parser.c:char_msg_val Unexecuted instantiation: digest.c:char_msg_val Unexecuted instantiation: parse_contact.c:char_msg_val Unexecuted instantiation: parse_body.c:char_msg_val Unexecuted instantiation: parse_security.c:char_msg_val Unexecuted instantiation: parse_call_info.c:char_msg_val Unexecuted instantiation: parse_event.c:char_msg_val Unexecuted instantiation: parse_disposition.c:char_msg_val Unexecuted instantiation: parse_authenticate.c:char_msg_val Unexecuted instantiation: parser_f.c:char_msg_val Unexecuted instantiation: parse_rpid.c:char_msg_val Unexecuted instantiation: parse_ppi.c:char_msg_val Unexecuted instantiation: parse_fcaps.c:char_msg_val Unexecuted instantiation: parse_sst.c:char_msg_val Unexecuted instantiation: parse_rr.c:char_msg_val Unexecuted instantiation: parse_param.c:char_msg_val Unexecuted instantiation: parse_diversion.c:char_msg_val Unexecuted instantiation: parse_nameaddr.c:char_msg_val Unexecuted instantiation: parse_expires.c:char_msg_val Unexecuted instantiation: parse_refer_to.c:char_msg_val Unexecuted instantiation: parse_from.c:char_msg_val Unexecuted instantiation: parse_pai.c:char_msg_val Unexecuted instantiation: event_interface.c:char_msg_val Unexecuted instantiation: receive.c:char_msg_val Unexecuted instantiation: script_cb.c:char_msg_val Unexecuted instantiation: ip_addr.c:char_msg_val Unexecuted instantiation: async.c:char_msg_val Unexecuted instantiation: daemonize.c:char_msg_val Unexecuted instantiation: timer.c:char_msg_val Unexecuted instantiation: trace_api.c:char_msg_val Unexecuted instantiation: mod_fix.c:char_msg_val Unexecuted instantiation: reactor.c:char_msg_val Unexecuted instantiation: forward.c:char_msg_val Unexecuted instantiation: xlog.c:char_msg_val Unexecuted instantiation: blacklists.c:char_msg_val Unexecuted instantiation: usr_avp.c:char_msg_val Unexecuted instantiation: profiling.c:char_msg_val Unexecuted instantiation: sl_cb.c:char_msg_val Unexecuted instantiation: resolve.c:char_msg_val Unexecuted instantiation: io_wait.c:char_msg_val Unexecuted instantiation: transformations.c:char_msg_val Unexecuted instantiation: sr_module_deps.c:char_msg_val Unexecuted instantiation: cfg_reload.c:char_msg_val Unexecuted instantiation: time_rec.c:char_msg_val Unexecuted instantiation: status_report.c:char_msg_val Unexecuted instantiation: signals.c:char_msg_val Unexecuted instantiation: db_id.c:char_msg_val Unexecuted instantiation: pi_framework_db.c:char_msg_val Unexecuted instantiation: csv.c:char_msg_val Unexecuted instantiation: evi_transport.c:char_msg_val Unexecuted instantiation: msg_translator.c:char_msg_val Unexecuted instantiation: md5utils.c:char_msg_val Unexecuted instantiation: cfg.tab.c:char_msg_val Unexecuted instantiation: modparam.c:char_msg_val Unexecuted instantiation: crc.c:char_msg_val Unexecuted instantiation: re.c:char_msg_val Unexecuted instantiation: lex.yy.c:char_msg_val Unexecuted instantiation: cfg_pp.c:char_msg_val Unexecuted instantiation: shutdown.c:char_msg_val Unexecuted instantiation: cmds.c:char_msg_val Unexecuted instantiation: core_cmds.c:char_msg_val Unexecuted instantiation: serialize.c:char_msg_val Unexecuted instantiation: cachedb.c:char_msg_val Unexecuted instantiation: cachedb_id.c:char_msg_val |
432 | | |
433 | | |
434 | | /* returns the body of the SIP message (if none, an empty body will be returned) |
435 | | */ |
436 | | inline static int get_body(struct sip_msg *msg, str *body) |
437 | 0 | { |
438 | 0 | unsigned int hdrs_len; |
439 | 0 | int ct_len; |
440 | |
|
441 | 0 | if (sdp_get_custom_body(msg, body) == 0) { |
442 | 0 | LM_DBG("found custom 'SDP ops' body, len: %d\n", body->len); |
443 | 0 | return 0; |
444 | 0 | } |
445 | | |
446 | 0 | if ( parse_headers(msg,HDR_EOH_F, 0)==-1 ) |
447 | 0 | return -1; |
448 | | |
449 | 0 | if (msg->unparsed){ |
450 | 0 | hdrs_len=(unsigned int)(msg->unparsed-msg->buf); |
451 | 0 | } else { |
452 | 0 | return -1; |
453 | 0 | } |
454 | | |
455 | 0 | if ((hdrs_len+2<=msg->len) && (strncmp(CRLF,msg->unparsed,CRLF_LEN)==0) ) |
456 | 0 | body->s = msg->unparsed + CRLF_LEN; |
457 | 0 | else if ( (hdrs_len+1<=msg->len) && |
458 | 0 | (*(msg->unparsed)=='\n' || *(msg->unparsed)=='\r' ) ) |
459 | 0 | body->s = msg->unparsed + 1; |
460 | 0 | else { |
461 | | /* no body */ |
462 | 0 | body->s = NULL; |
463 | 0 | body->len = 0; |
464 | 0 | return 0; |
465 | 0 | } |
466 | | |
467 | | /* determin the length of the body */ |
468 | 0 | body->len = msg->buf + msg->len - body->s; |
469 | | |
470 | | /* double check the len against content-length hdr |
471 | | (if present, it must be already parsed); |
472 | | NOTE that the CT hdr may be missing if using UDP, so |
473 | | we do not consider its missing an err case */ |
474 | 0 | if (msg->content_length) { |
475 | 0 | ct_len = get_content_length( msg ); |
476 | 0 | if (ct_len<body->len) |
477 | 0 | body->len = ct_len; |
478 | 0 | } else if (msg->rcv.proto!=PROTO_UDP) { |
479 | | /* no ct -> no body */ |
480 | 0 | body->s = NULL; |
481 | 0 | body->len = 0; |
482 | 0 | } |
483 | |
|
484 | 0 | return 0; |
485 | 0 | } Unexecuted instantiation: fuzz_msg_parser.c:get_body Unexecuted instantiation: msg_parser.c:get_body Unexecuted instantiation: parse_uri.c:get_body Unexecuted instantiation: parse_fline.c:get_body Unexecuted instantiation: parse_methods.c:get_body Unexecuted instantiation: parse_hname2.c:get_body Unexecuted instantiation: parse_content.c:get_body Unexecuted instantiation: hf.c:get_body Unexecuted instantiation: parse_to.c:get_body Unexecuted instantiation: parse_via.c:get_body Unexecuted instantiation: error.c:get_body Unexecuted instantiation: data_lump_rpl.c:get_body Unexecuted instantiation: dprint.c:get_body Unexecuted instantiation: pt.c:get_body Unexecuted instantiation: strcommon.c:get_body Unexecuted instantiation: ut.c:get_body Unexecuted instantiation: msg_callbacks.c:get_body Unexecuted instantiation: sdp_ops.c:get_body Unexecuted instantiation: statistics.c:get_body Unexecuted instantiation: pvar.c:get_body Unexecuted instantiation: route.c:get_body Unexecuted instantiation: socket_info.c:get_body Unexecuted instantiation: data_lump.c:get_body Unexecuted instantiation: ipc.c:get_body Unexecuted instantiation: core_stats.c:get_body Unexecuted instantiation: route_struct.c:get_body Unexecuted instantiation: dset.c:get_body Unexecuted instantiation: pt_scaling.c:get_body Unexecuted instantiation: pt_load.c:get_body Unexecuted instantiation: sr_module.c:get_body Unexecuted instantiation: action.c:get_body Unexecuted instantiation: flags.c:get_body Unexecuted instantiation: db_insertq.c:get_body Unexecuted instantiation: db.c:get_body Unexecuted instantiation: pi_framework.c:get_body Unexecuted instantiation: proto_tcp.c:get_body Unexecuted instantiation: proto_udp.c:get_body Unexecuted instantiation: trans.c:get_body Unexecuted instantiation: net_tcp_proc.c:get_body Unexecuted instantiation: proxy_protocol.c:get_body Unexecuted instantiation: net_tcp.c:get_body Unexecuted instantiation: tcp_common.c:get_body Unexecuted instantiation: net_udp.c:get_body Unexecuted instantiation: tcp_conn_profile.c:get_body Unexecuted instantiation: trans_trace.c:get_body Unexecuted instantiation: net_tcp_report.c:get_body Unexecuted instantiation: shm_mem.c:get_body Unexecuted instantiation: mi.c:get_body Unexecuted instantiation: item.c:get_body Unexecuted instantiation: sdp.c:get_body Unexecuted instantiation: sdp_helpr_funcs.c:get_body Unexecuted instantiation: digest_parser.c:get_body Unexecuted instantiation: param_parser.c:get_body Unexecuted instantiation: digest.c:get_body Unexecuted instantiation: parse_contact.c:get_body Unexecuted instantiation: parse_body.c:get_body Unexecuted instantiation: parse_security.c:get_body Unexecuted instantiation: parse_call_info.c:get_body Unexecuted instantiation: parse_event.c:get_body Unexecuted instantiation: parse_disposition.c:get_body Unexecuted instantiation: parse_authenticate.c:get_body Unexecuted instantiation: parser_f.c:get_body Unexecuted instantiation: parse_rpid.c:get_body Unexecuted instantiation: parse_ppi.c:get_body Unexecuted instantiation: parse_fcaps.c:get_body Unexecuted instantiation: parse_sst.c:get_body Unexecuted instantiation: parse_rr.c:get_body Unexecuted instantiation: parse_param.c:get_body Unexecuted instantiation: parse_diversion.c:get_body Unexecuted instantiation: parse_nameaddr.c:get_body Unexecuted instantiation: parse_expires.c:get_body Unexecuted instantiation: parse_refer_to.c:get_body Unexecuted instantiation: parse_from.c:get_body Unexecuted instantiation: parse_pai.c:get_body Unexecuted instantiation: event_interface.c:get_body Unexecuted instantiation: receive.c:get_body Unexecuted instantiation: script_cb.c:get_body Unexecuted instantiation: ip_addr.c:get_body Unexecuted instantiation: async.c:get_body Unexecuted instantiation: daemonize.c:get_body Unexecuted instantiation: timer.c:get_body Unexecuted instantiation: trace_api.c:get_body Unexecuted instantiation: mod_fix.c:get_body Unexecuted instantiation: reactor.c:get_body Unexecuted instantiation: forward.c:get_body Unexecuted instantiation: xlog.c:get_body Unexecuted instantiation: blacklists.c:get_body Unexecuted instantiation: usr_avp.c:get_body Unexecuted instantiation: profiling.c:get_body Unexecuted instantiation: sl_cb.c:get_body Unexecuted instantiation: resolve.c:get_body Unexecuted instantiation: io_wait.c:get_body Unexecuted instantiation: transformations.c:get_body Unexecuted instantiation: sr_module_deps.c:get_body Unexecuted instantiation: cfg_reload.c:get_body Unexecuted instantiation: time_rec.c:get_body Unexecuted instantiation: status_report.c:get_body Unexecuted instantiation: signals.c:get_body Unexecuted instantiation: db_id.c:get_body Unexecuted instantiation: pi_framework_db.c:get_body Unexecuted instantiation: csv.c:get_body Unexecuted instantiation: evi_transport.c:get_body Unexecuted instantiation: msg_translator.c:get_body Unexecuted instantiation: md5utils.c:get_body Unexecuted instantiation: cfg.tab.c:get_body Unexecuted instantiation: modparam.c:get_body Unexecuted instantiation: crc.c:get_body Unexecuted instantiation: re.c:get_body Unexecuted instantiation: lex.yy.c:get_body Unexecuted instantiation: cfg_pp.c:get_body Unexecuted instantiation: shutdown.c:get_body Unexecuted instantiation: cmds.c:get_body Unexecuted instantiation: core_cmds.c:get_body Unexecuted instantiation: serialize.c:get_body Unexecuted instantiation: cachedb.c:get_body Unexecuted instantiation: cachedb_id.c:get_body |
486 | | |
487 | | /* |
488 | | * Get the callid of a message. If returned value is 0, the callid is stored |
489 | | * in the _cid field, otherwise -1 is returned on error |
490 | | */ |
491 | | inline static int get_callid(struct sip_msg* _m, str* _cid) |
492 | 0 | { |
493 | 0 | if ((parse_headers(_m, HDR_CALLID_F, 0) == -1)) { |
494 | 0 | LM_ERR("failed to parse call-id header\n"); |
495 | 0 | return -1; |
496 | 0 | } |
497 | 0 |
|
498 | 0 | if (_m->callid == NULL) { |
499 | 0 | LM_ERR("call-id not found\n"); |
500 | 0 | return -1; |
501 | 0 | } |
502 | 0 |
|
503 | 0 | _cid->s = _m->callid->body.s; |
504 | 0 | _cid->len = _m->callid->body.len; |
505 | 0 | trim(_cid); |
506 | 0 | return 0; |
507 | 0 | } Unexecuted instantiation: fuzz_msg_parser.c:get_callid Unexecuted instantiation: msg_parser.c:get_callid Unexecuted instantiation: parse_uri.c:get_callid Unexecuted instantiation: parse_fline.c:get_callid Unexecuted instantiation: parse_methods.c:get_callid Unexecuted instantiation: parse_hname2.c:get_callid Unexecuted instantiation: parse_content.c:get_callid Unexecuted instantiation: hf.c:get_callid Unexecuted instantiation: parse_to.c:get_callid Unexecuted instantiation: parse_via.c:get_callid Unexecuted instantiation: error.c:get_callid Unexecuted instantiation: data_lump_rpl.c:get_callid Unexecuted instantiation: dprint.c:get_callid Unexecuted instantiation: pt.c:get_callid Unexecuted instantiation: strcommon.c:get_callid Unexecuted instantiation: ut.c:get_callid Unexecuted instantiation: msg_callbacks.c:get_callid Unexecuted instantiation: sdp_ops.c:get_callid Unexecuted instantiation: statistics.c:get_callid Unexecuted instantiation: pvar.c:get_callid Unexecuted instantiation: route.c:get_callid Unexecuted instantiation: socket_info.c:get_callid Unexecuted instantiation: data_lump.c:get_callid Unexecuted instantiation: ipc.c:get_callid Unexecuted instantiation: core_stats.c:get_callid Unexecuted instantiation: route_struct.c:get_callid Unexecuted instantiation: dset.c:get_callid Unexecuted instantiation: pt_scaling.c:get_callid Unexecuted instantiation: pt_load.c:get_callid Unexecuted instantiation: sr_module.c:get_callid Unexecuted instantiation: action.c:get_callid Unexecuted instantiation: flags.c:get_callid Unexecuted instantiation: db_insertq.c:get_callid Unexecuted instantiation: db.c:get_callid Unexecuted instantiation: pi_framework.c:get_callid Unexecuted instantiation: proto_tcp.c:get_callid Unexecuted instantiation: proto_udp.c:get_callid Unexecuted instantiation: trans.c:get_callid Unexecuted instantiation: net_tcp_proc.c:get_callid Unexecuted instantiation: proxy_protocol.c:get_callid Unexecuted instantiation: net_tcp.c:get_callid Unexecuted instantiation: tcp_common.c:get_callid Unexecuted instantiation: net_udp.c:get_callid Unexecuted instantiation: tcp_conn_profile.c:get_callid Unexecuted instantiation: trans_trace.c:get_callid Unexecuted instantiation: net_tcp_report.c:get_callid Unexecuted instantiation: shm_mem.c:get_callid Unexecuted instantiation: mi.c:get_callid Unexecuted instantiation: item.c:get_callid Unexecuted instantiation: sdp.c:get_callid Unexecuted instantiation: sdp_helpr_funcs.c:get_callid Unexecuted instantiation: digest_parser.c:get_callid Unexecuted instantiation: param_parser.c:get_callid Unexecuted instantiation: digest.c:get_callid Unexecuted instantiation: parse_contact.c:get_callid Unexecuted instantiation: parse_body.c:get_callid Unexecuted instantiation: parse_security.c:get_callid Unexecuted instantiation: parse_call_info.c:get_callid Unexecuted instantiation: parse_event.c:get_callid Unexecuted instantiation: parse_disposition.c:get_callid Unexecuted instantiation: parse_authenticate.c:get_callid Unexecuted instantiation: parser_f.c:get_callid Unexecuted instantiation: parse_rpid.c:get_callid Unexecuted instantiation: parse_ppi.c:get_callid Unexecuted instantiation: parse_fcaps.c:get_callid Unexecuted instantiation: parse_sst.c:get_callid Unexecuted instantiation: parse_rr.c:get_callid Unexecuted instantiation: parse_param.c:get_callid Unexecuted instantiation: parse_diversion.c:get_callid Unexecuted instantiation: parse_nameaddr.c:get_callid Unexecuted instantiation: parse_expires.c:get_callid Unexecuted instantiation: parse_refer_to.c:get_callid Unexecuted instantiation: parse_from.c:get_callid Unexecuted instantiation: parse_pai.c:get_callid Unexecuted instantiation: event_interface.c:get_callid Unexecuted instantiation: receive.c:get_callid Unexecuted instantiation: script_cb.c:get_callid Unexecuted instantiation: ip_addr.c:get_callid Unexecuted instantiation: async.c:get_callid Unexecuted instantiation: daemonize.c:get_callid Unexecuted instantiation: timer.c:get_callid Unexecuted instantiation: trace_api.c:get_callid Unexecuted instantiation: mod_fix.c:get_callid Unexecuted instantiation: reactor.c:get_callid Unexecuted instantiation: forward.c:get_callid Unexecuted instantiation: xlog.c:get_callid Unexecuted instantiation: blacklists.c:get_callid Unexecuted instantiation: usr_avp.c:get_callid Unexecuted instantiation: profiling.c:get_callid Unexecuted instantiation: sl_cb.c:get_callid Unexecuted instantiation: resolve.c:get_callid Unexecuted instantiation: io_wait.c:get_callid Unexecuted instantiation: transformations.c:get_callid Unexecuted instantiation: sr_module_deps.c:get_callid Unexecuted instantiation: cfg_reload.c:get_callid Unexecuted instantiation: time_rec.c:get_callid Unexecuted instantiation: status_report.c:get_callid Unexecuted instantiation: signals.c:get_callid Unexecuted instantiation: db_id.c:get_callid Unexecuted instantiation: pi_framework_db.c:get_callid Unexecuted instantiation: csv.c:get_callid Unexecuted instantiation: evi_transport.c:get_callid Unexecuted instantiation: msg_translator.c:get_callid Unexecuted instantiation: md5utils.c:get_callid Unexecuted instantiation: cfg.tab.c:get_callid Unexecuted instantiation: modparam.c:get_callid Unexecuted instantiation: crc.c:get_callid Unexecuted instantiation: re.c:get_callid Unexecuted instantiation: lex.yy.c:get_callid Unexecuted instantiation: cfg_pp.c:get_callid Unexecuted instantiation: shutdown.c:get_callid Unexecuted instantiation: cmds.c:get_callid Unexecuted instantiation: core_cmds.c:get_callid Unexecuted instantiation: serialize.c:get_callid Unexecuted instantiation: cachedb.c:get_callid Unexecuted instantiation: cachedb_id.c:get_callid |
508 | | |
509 | | |
510 | | /* |
511 | | * Search through already parsed headers (no parsing done) a non-standard |
512 | | * header - all known headers are skipped! |
513 | | */ |
514 | | #define get_header_by_static_name(_msg, _name) \ |
515 | | get_header_by_name(_msg, _name, sizeof(_name)-1) |
516 | | inline static struct hdr_field *get_header_by_name( struct sip_msg *msg, |
517 | | char *s, unsigned int len) |
518 | 0 | { |
519 | 0 | struct hdr_field *hdr; |
520 | 0 |
|
521 | 0 | for( hdr=msg->headers ; hdr ; hdr=hdr->next ) { |
522 | 0 | if(len==hdr->name.len && strncasecmp(hdr->name.s,s,len)==0) |
523 | 0 | return hdr; |
524 | 0 | } |
525 | 0 | return NULL; |
526 | 0 | } Unexecuted instantiation: fuzz_msg_parser.c:get_header_by_name Unexecuted instantiation: msg_parser.c:get_header_by_name Unexecuted instantiation: parse_uri.c:get_header_by_name Unexecuted instantiation: parse_fline.c:get_header_by_name Unexecuted instantiation: parse_methods.c:get_header_by_name Unexecuted instantiation: parse_hname2.c:get_header_by_name Unexecuted instantiation: parse_content.c:get_header_by_name Unexecuted instantiation: hf.c:get_header_by_name Unexecuted instantiation: parse_to.c:get_header_by_name Unexecuted instantiation: parse_via.c:get_header_by_name Unexecuted instantiation: error.c:get_header_by_name Unexecuted instantiation: data_lump_rpl.c:get_header_by_name Unexecuted instantiation: dprint.c:get_header_by_name Unexecuted instantiation: pt.c:get_header_by_name Unexecuted instantiation: strcommon.c:get_header_by_name Unexecuted instantiation: ut.c:get_header_by_name Unexecuted instantiation: msg_callbacks.c:get_header_by_name Unexecuted instantiation: sdp_ops.c:get_header_by_name Unexecuted instantiation: statistics.c:get_header_by_name Unexecuted instantiation: pvar.c:get_header_by_name Unexecuted instantiation: route.c:get_header_by_name Unexecuted instantiation: socket_info.c:get_header_by_name Unexecuted instantiation: data_lump.c:get_header_by_name Unexecuted instantiation: ipc.c:get_header_by_name Unexecuted instantiation: core_stats.c:get_header_by_name Unexecuted instantiation: route_struct.c:get_header_by_name Unexecuted instantiation: dset.c:get_header_by_name Unexecuted instantiation: pt_scaling.c:get_header_by_name Unexecuted instantiation: pt_load.c:get_header_by_name Unexecuted instantiation: sr_module.c:get_header_by_name Unexecuted instantiation: action.c:get_header_by_name Unexecuted instantiation: flags.c:get_header_by_name Unexecuted instantiation: db_insertq.c:get_header_by_name Unexecuted instantiation: db.c:get_header_by_name Unexecuted instantiation: pi_framework.c:get_header_by_name Unexecuted instantiation: proto_tcp.c:get_header_by_name Unexecuted instantiation: proto_udp.c:get_header_by_name Unexecuted instantiation: trans.c:get_header_by_name Unexecuted instantiation: net_tcp_proc.c:get_header_by_name Unexecuted instantiation: proxy_protocol.c:get_header_by_name Unexecuted instantiation: net_tcp.c:get_header_by_name Unexecuted instantiation: tcp_common.c:get_header_by_name Unexecuted instantiation: net_udp.c:get_header_by_name Unexecuted instantiation: tcp_conn_profile.c:get_header_by_name Unexecuted instantiation: trans_trace.c:get_header_by_name Unexecuted instantiation: net_tcp_report.c:get_header_by_name Unexecuted instantiation: shm_mem.c:get_header_by_name Unexecuted instantiation: mi.c:get_header_by_name Unexecuted instantiation: item.c:get_header_by_name Unexecuted instantiation: sdp.c:get_header_by_name Unexecuted instantiation: sdp_helpr_funcs.c:get_header_by_name Unexecuted instantiation: digest_parser.c:get_header_by_name Unexecuted instantiation: param_parser.c:get_header_by_name Unexecuted instantiation: digest.c:get_header_by_name Unexecuted instantiation: parse_contact.c:get_header_by_name Unexecuted instantiation: parse_body.c:get_header_by_name Unexecuted instantiation: parse_security.c:get_header_by_name Unexecuted instantiation: parse_call_info.c:get_header_by_name Unexecuted instantiation: parse_event.c:get_header_by_name Unexecuted instantiation: parse_disposition.c:get_header_by_name Unexecuted instantiation: parse_authenticate.c:get_header_by_name Unexecuted instantiation: parser_f.c:get_header_by_name Unexecuted instantiation: parse_rpid.c:get_header_by_name Unexecuted instantiation: parse_ppi.c:get_header_by_name Unexecuted instantiation: parse_fcaps.c:get_header_by_name Unexecuted instantiation: parse_sst.c:get_header_by_name Unexecuted instantiation: parse_rr.c:get_header_by_name Unexecuted instantiation: parse_param.c:get_header_by_name Unexecuted instantiation: parse_diversion.c:get_header_by_name Unexecuted instantiation: parse_nameaddr.c:get_header_by_name Unexecuted instantiation: parse_expires.c:get_header_by_name Unexecuted instantiation: parse_refer_to.c:get_header_by_name Unexecuted instantiation: parse_from.c:get_header_by_name Unexecuted instantiation: parse_pai.c:get_header_by_name Unexecuted instantiation: event_interface.c:get_header_by_name Unexecuted instantiation: receive.c:get_header_by_name Unexecuted instantiation: script_cb.c:get_header_by_name Unexecuted instantiation: ip_addr.c:get_header_by_name Unexecuted instantiation: async.c:get_header_by_name Unexecuted instantiation: daemonize.c:get_header_by_name Unexecuted instantiation: timer.c:get_header_by_name Unexecuted instantiation: trace_api.c:get_header_by_name Unexecuted instantiation: mod_fix.c:get_header_by_name Unexecuted instantiation: reactor.c:get_header_by_name Unexecuted instantiation: forward.c:get_header_by_name Unexecuted instantiation: xlog.c:get_header_by_name Unexecuted instantiation: blacklists.c:get_header_by_name Unexecuted instantiation: usr_avp.c:get_header_by_name Unexecuted instantiation: profiling.c:get_header_by_name Unexecuted instantiation: sl_cb.c:get_header_by_name Unexecuted instantiation: resolve.c:get_header_by_name Unexecuted instantiation: io_wait.c:get_header_by_name Unexecuted instantiation: transformations.c:get_header_by_name Unexecuted instantiation: sr_module_deps.c:get_header_by_name Unexecuted instantiation: cfg_reload.c:get_header_by_name Unexecuted instantiation: time_rec.c:get_header_by_name Unexecuted instantiation: status_report.c:get_header_by_name Unexecuted instantiation: signals.c:get_header_by_name Unexecuted instantiation: db_id.c:get_header_by_name Unexecuted instantiation: pi_framework_db.c:get_header_by_name Unexecuted instantiation: csv.c:get_header_by_name Unexecuted instantiation: evi_transport.c:get_header_by_name Unexecuted instantiation: msg_translator.c:get_header_by_name Unexecuted instantiation: md5utils.c:get_header_by_name Unexecuted instantiation: cfg.tab.c:get_header_by_name Unexecuted instantiation: modparam.c:get_header_by_name Unexecuted instantiation: crc.c:get_header_by_name Unexecuted instantiation: re.c:get_header_by_name Unexecuted instantiation: lex.yy.c:get_header_by_name Unexecuted instantiation: cfg_pp.c:get_header_by_name Unexecuted instantiation: shutdown.c:get_header_by_name Unexecuted instantiation: cmds.c:get_header_by_name Unexecuted instantiation: core_cmds.c:get_header_by_name Unexecuted instantiation: serialize.c:get_header_by_name Unexecuted instantiation: cachedb.c:get_header_by_name Unexecuted instantiation: cachedb_id.c:get_header_by_name |
527 | | |
528 | | |
529 | | #define get_next_header_by_static_name(_hdr, _name) \ |
530 | | get_next_header_by_name(_hdr, _name, sizeof(_name)-1) |
531 | | inline static struct hdr_field *get_next_header_by_name( |
532 | | struct hdr_field *first, char *s, unsigned int len) |
533 | 0 | { |
534 | 0 | struct hdr_field *hdr; |
535 | 0 |
|
536 | 0 | for( hdr=first->next ; hdr ; hdr=hdr->next ) { |
537 | 0 | if(len==hdr->name.len && strncasecmp(hdr->name.s,s,len)==0) |
538 | 0 | return hdr; |
539 | 0 | } |
540 | 0 | return NULL; |
541 | 0 | } Unexecuted instantiation: fuzz_msg_parser.c:get_next_header_by_name Unexecuted instantiation: msg_parser.c:get_next_header_by_name Unexecuted instantiation: parse_uri.c:get_next_header_by_name Unexecuted instantiation: parse_fline.c:get_next_header_by_name Unexecuted instantiation: parse_methods.c:get_next_header_by_name Unexecuted instantiation: parse_hname2.c:get_next_header_by_name Unexecuted instantiation: parse_content.c:get_next_header_by_name Unexecuted instantiation: hf.c:get_next_header_by_name Unexecuted instantiation: parse_to.c:get_next_header_by_name Unexecuted instantiation: parse_via.c:get_next_header_by_name Unexecuted instantiation: error.c:get_next_header_by_name Unexecuted instantiation: data_lump_rpl.c:get_next_header_by_name Unexecuted instantiation: dprint.c:get_next_header_by_name Unexecuted instantiation: pt.c:get_next_header_by_name Unexecuted instantiation: strcommon.c:get_next_header_by_name Unexecuted instantiation: ut.c:get_next_header_by_name Unexecuted instantiation: msg_callbacks.c:get_next_header_by_name Unexecuted instantiation: sdp_ops.c:get_next_header_by_name Unexecuted instantiation: statistics.c:get_next_header_by_name Unexecuted instantiation: pvar.c:get_next_header_by_name Unexecuted instantiation: route.c:get_next_header_by_name Unexecuted instantiation: socket_info.c:get_next_header_by_name Unexecuted instantiation: data_lump.c:get_next_header_by_name Unexecuted instantiation: ipc.c:get_next_header_by_name Unexecuted instantiation: core_stats.c:get_next_header_by_name Unexecuted instantiation: route_struct.c:get_next_header_by_name Unexecuted instantiation: dset.c:get_next_header_by_name Unexecuted instantiation: pt_scaling.c:get_next_header_by_name Unexecuted instantiation: pt_load.c:get_next_header_by_name Unexecuted instantiation: sr_module.c:get_next_header_by_name Unexecuted instantiation: action.c:get_next_header_by_name Unexecuted instantiation: flags.c:get_next_header_by_name Unexecuted instantiation: db_insertq.c:get_next_header_by_name Unexecuted instantiation: db.c:get_next_header_by_name Unexecuted instantiation: pi_framework.c:get_next_header_by_name Unexecuted instantiation: proto_tcp.c:get_next_header_by_name Unexecuted instantiation: proto_udp.c:get_next_header_by_name Unexecuted instantiation: trans.c:get_next_header_by_name Unexecuted instantiation: net_tcp_proc.c:get_next_header_by_name Unexecuted instantiation: proxy_protocol.c:get_next_header_by_name Unexecuted instantiation: net_tcp.c:get_next_header_by_name Unexecuted instantiation: tcp_common.c:get_next_header_by_name Unexecuted instantiation: net_udp.c:get_next_header_by_name Unexecuted instantiation: tcp_conn_profile.c:get_next_header_by_name Unexecuted instantiation: trans_trace.c:get_next_header_by_name Unexecuted instantiation: net_tcp_report.c:get_next_header_by_name Unexecuted instantiation: shm_mem.c:get_next_header_by_name Unexecuted instantiation: mi.c:get_next_header_by_name Unexecuted instantiation: item.c:get_next_header_by_name Unexecuted instantiation: sdp.c:get_next_header_by_name Unexecuted instantiation: sdp_helpr_funcs.c:get_next_header_by_name Unexecuted instantiation: digest_parser.c:get_next_header_by_name Unexecuted instantiation: param_parser.c:get_next_header_by_name Unexecuted instantiation: digest.c:get_next_header_by_name Unexecuted instantiation: parse_contact.c:get_next_header_by_name Unexecuted instantiation: parse_body.c:get_next_header_by_name Unexecuted instantiation: parse_security.c:get_next_header_by_name Unexecuted instantiation: parse_call_info.c:get_next_header_by_name Unexecuted instantiation: parse_event.c:get_next_header_by_name Unexecuted instantiation: parse_disposition.c:get_next_header_by_name Unexecuted instantiation: parse_authenticate.c:get_next_header_by_name Unexecuted instantiation: parser_f.c:get_next_header_by_name Unexecuted instantiation: parse_rpid.c:get_next_header_by_name Unexecuted instantiation: parse_ppi.c:get_next_header_by_name Unexecuted instantiation: parse_fcaps.c:get_next_header_by_name Unexecuted instantiation: parse_sst.c:get_next_header_by_name Unexecuted instantiation: parse_rr.c:get_next_header_by_name Unexecuted instantiation: parse_param.c:get_next_header_by_name Unexecuted instantiation: parse_diversion.c:get_next_header_by_name Unexecuted instantiation: parse_nameaddr.c:get_next_header_by_name Unexecuted instantiation: parse_expires.c:get_next_header_by_name Unexecuted instantiation: parse_refer_to.c:get_next_header_by_name Unexecuted instantiation: parse_from.c:get_next_header_by_name Unexecuted instantiation: parse_pai.c:get_next_header_by_name Unexecuted instantiation: event_interface.c:get_next_header_by_name Unexecuted instantiation: receive.c:get_next_header_by_name Unexecuted instantiation: script_cb.c:get_next_header_by_name Unexecuted instantiation: ip_addr.c:get_next_header_by_name Unexecuted instantiation: async.c:get_next_header_by_name Unexecuted instantiation: daemonize.c:get_next_header_by_name Unexecuted instantiation: timer.c:get_next_header_by_name Unexecuted instantiation: trace_api.c:get_next_header_by_name Unexecuted instantiation: mod_fix.c:get_next_header_by_name Unexecuted instantiation: reactor.c:get_next_header_by_name Unexecuted instantiation: forward.c:get_next_header_by_name Unexecuted instantiation: xlog.c:get_next_header_by_name Unexecuted instantiation: blacklists.c:get_next_header_by_name Unexecuted instantiation: usr_avp.c:get_next_header_by_name Unexecuted instantiation: profiling.c:get_next_header_by_name Unexecuted instantiation: sl_cb.c:get_next_header_by_name Unexecuted instantiation: resolve.c:get_next_header_by_name Unexecuted instantiation: io_wait.c:get_next_header_by_name Unexecuted instantiation: transformations.c:get_next_header_by_name Unexecuted instantiation: sr_module_deps.c:get_next_header_by_name Unexecuted instantiation: cfg_reload.c:get_next_header_by_name Unexecuted instantiation: time_rec.c:get_next_header_by_name Unexecuted instantiation: status_report.c:get_next_header_by_name Unexecuted instantiation: signals.c:get_next_header_by_name Unexecuted instantiation: db_id.c:get_next_header_by_name Unexecuted instantiation: pi_framework_db.c:get_next_header_by_name Unexecuted instantiation: csv.c:get_next_header_by_name Unexecuted instantiation: evi_transport.c:get_next_header_by_name Unexecuted instantiation: msg_translator.c:get_next_header_by_name Unexecuted instantiation: md5utils.c:get_next_header_by_name Unexecuted instantiation: cfg.tab.c:get_next_header_by_name Unexecuted instantiation: modparam.c:get_next_header_by_name Unexecuted instantiation: crc.c:get_next_header_by_name Unexecuted instantiation: re.c:get_next_header_by_name Unexecuted instantiation: lex.yy.c:get_next_header_by_name Unexecuted instantiation: cfg_pp.c:get_next_header_by_name Unexecuted instantiation: shutdown.c:get_next_header_by_name Unexecuted instantiation: cmds.c:get_next_header_by_name Unexecuted instantiation: core_cmds.c:get_next_header_by_name Unexecuted instantiation: serialize.c:get_next_header_by_name Unexecuted instantiation: cachedb.c:get_next_header_by_name Unexecuted instantiation: cachedb_id.c:get_next_header_by_name |
542 | | |
543 | | |
544 | | |
545 | | |
546 | | /* |
547 | | * Make a private copy of the string and assign it to new_uri (new RURI) |
548 | | */ |
549 | | int set_ruri(struct sip_msg* msg, str* uri); |
550 | | |
551 | | |
552 | | /* |
553 | | * Make a private copy of the string and assign it to dst_uri |
554 | | */ |
555 | | int set_dst_uri(struct sip_msg* msg, str* uri); |
556 | | |
557 | | |
558 | | void reset_dst_uri(struct sip_msg *msg); |
559 | | |
560 | | |
561 | | int set_dst_host_port(struct sip_msg *msg, str *host, str *port); |
562 | | |
563 | | |
564 | | enum rw_ruri_part { |
565 | | RW_RURI_HOST = 1, |
566 | | RW_RURI_HOSTPORT, |
567 | | RW_RURI_USER, |
568 | | RW_RURI_USERPASS, |
569 | | RW_RURI_PORT, |
570 | | RW_RURI_PREFIX, |
571 | | RW_RURI_STRIP, |
572 | | RW_RURI_STRIP_TAIL |
573 | | }; |
574 | | |
575 | | int rewrite_ruri(struct sip_msg *msg, str *sval, int ival, |
576 | | enum rw_ruri_part part); |
577 | | |
578 | | |
579 | | /* |
580 | | * Set the q value of the Request-URI |
581 | | */ |
582 | | #define set_ruri_q(_msg,_q) \ |
583 | 0 | (_msg)->ruri_q = _q |
584 | | |
585 | | |
586 | | /* |
587 | | * Get the q value of the Request-URI |
588 | | */ |
589 | | #define get_ruri_q(_msg) \ |
590 | 0 | (_msg)->ruri_q |
591 | | |
592 | | |
593 | | /* |
594 | | * Get the per branch flags for RURI |
595 | | */ |
596 | | #define getb0flags(_msg) \ |
597 | 0 | (_msg)->ruri_bflags |
598 | | |
599 | | |
600 | | /* |
601 | | * Set the per branch flags for RURI |
602 | | */ |
603 | | #define setb0flags( _msg, _flags) \ |
604 | 0 | (_msg)->ruri_bflags = _flags |
605 | | |
606 | | |
607 | | /* |
608 | | * Make a private copy of the string and assign it to path_vec |
609 | | */ |
610 | | int set_path_vector(struct sip_msg* msg, str* path); |
611 | | void clear_path_vector(struct sip_msg* msg); |
612 | | |
613 | | |
614 | | /* |
615 | | * Parses a buffer containing a well formed SIP message and extracts the bodies |
616 | | * for FROM , TO , CSEQ and CALL-ID headers. |
617 | | */ |
618 | | int extract_ftc_hdrs( char *buf, int len, str *from, str *to, str *cseq,str *callid); |
619 | | |
620 | | inline static struct timeval *get_msg_time(struct sip_msg *msg) |
621 | 0 | { |
622 | 0 | static struct timeval static_time; |
623 | 0 | if (!msg || msg == (struct sip_msg *)-1) { |
624 | 0 | gettimeofday(&static_time, NULL); |
625 | 0 | return &static_time; |
626 | 0 | } |
627 | 0 | if (msg->time.tv_sec == 0 && msg->time.tv_usec == 0) |
628 | 0 | gettimeofday(&msg->time, NULL); |
629 | 0 | return &msg->time; |
630 | 0 | } Unexecuted instantiation: fuzz_msg_parser.c:get_msg_time Unexecuted instantiation: msg_parser.c:get_msg_time Unexecuted instantiation: parse_uri.c:get_msg_time Unexecuted instantiation: parse_fline.c:get_msg_time Unexecuted instantiation: parse_methods.c:get_msg_time Unexecuted instantiation: parse_hname2.c:get_msg_time Unexecuted instantiation: parse_content.c:get_msg_time Unexecuted instantiation: hf.c:get_msg_time Unexecuted instantiation: parse_to.c:get_msg_time Unexecuted instantiation: parse_via.c:get_msg_time Unexecuted instantiation: error.c:get_msg_time Unexecuted instantiation: data_lump_rpl.c:get_msg_time Unexecuted instantiation: dprint.c:get_msg_time Unexecuted instantiation: pt.c:get_msg_time Unexecuted instantiation: strcommon.c:get_msg_time Unexecuted instantiation: ut.c:get_msg_time Unexecuted instantiation: msg_callbacks.c:get_msg_time Unexecuted instantiation: sdp_ops.c:get_msg_time Unexecuted instantiation: statistics.c:get_msg_time Unexecuted instantiation: pvar.c:get_msg_time Unexecuted instantiation: route.c:get_msg_time Unexecuted instantiation: socket_info.c:get_msg_time Unexecuted instantiation: data_lump.c:get_msg_time Unexecuted instantiation: ipc.c:get_msg_time Unexecuted instantiation: core_stats.c:get_msg_time Unexecuted instantiation: route_struct.c:get_msg_time Unexecuted instantiation: dset.c:get_msg_time Unexecuted instantiation: pt_scaling.c:get_msg_time Unexecuted instantiation: pt_load.c:get_msg_time Unexecuted instantiation: sr_module.c:get_msg_time Unexecuted instantiation: action.c:get_msg_time Unexecuted instantiation: flags.c:get_msg_time Unexecuted instantiation: db_insertq.c:get_msg_time Unexecuted instantiation: db.c:get_msg_time Unexecuted instantiation: pi_framework.c:get_msg_time Unexecuted instantiation: proto_tcp.c:get_msg_time Unexecuted instantiation: proto_udp.c:get_msg_time Unexecuted instantiation: trans.c:get_msg_time Unexecuted instantiation: net_tcp_proc.c:get_msg_time Unexecuted instantiation: proxy_protocol.c:get_msg_time Unexecuted instantiation: net_tcp.c:get_msg_time Unexecuted instantiation: tcp_common.c:get_msg_time Unexecuted instantiation: net_udp.c:get_msg_time Unexecuted instantiation: tcp_conn_profile.c:get_msg_time Unexecuted instantiation: trans_trace.c:get_msg_time Unexecuted instantiation: net_tcp_report.c:get_msg_time Unexecuted instantiation: shm_mem.c:get_msg_time Unexecuted instantiation: mi.c:get_msg_time Unexecuted instantiation: item.c:get_msg_time Unexecuted instantiation: sdp.c:get_msg_time Unexecuted instantiation: sdp_helpr_funcs.c:get_msg_time Unexecuted instantiation: digest_parser.c:get_msg_time Unexecuted instantiation: param_parser.c:get_msg_time Unexecuted instantiation: digest.c:get_msg_time Unexecuted instantiation: parse_contact.c:get_msg_time Unexecuted instantiation: parse_body.c:get_msg_time Unexecuted instantiation: parse_security.c:get_msg_time Unexecuted instantiation: parse_call_info.c:get_msg_time Unexecuted instantiation: parse_event.c:get_msg_time Unexecuted instantiation: parse_disposition.c:get_msg_time Unexecuted instantiation: parse_authenticate.c:get_msg_time Unexecuted instantiation: parser_f.c:get_msg_time Unexecuted instantiation: parse_rpid.c:get_msg_time Unexecuted instantiation: parse_ppi.c:get_msg_time Unexecuted instantiation: parse_fcaps.c:get_msg_time Unexecuted instantiation: parse_sst.c:get_msg_time Unexecuted instantiation: parse_rr.c:get_msg_time Unexecuted instantiation: parse_param.c:get_msg_time Unexecuted instantiation: parse_diversion.c:get_msg_time Unexecuted instantiation: parse_nameaddr.c:get_msg_time Unexecuted instantiation: parse_expires.c:get_msg_time Unexecuted instantiation: parse_refer_to.c:get_msg_time Unexecuted instantiation: parse_from.c:get_msg_time Unexecuted instantiation: parse_pai.c:get_msg_time Unexecuted instantiation: event_interface.c:get_msg_time Unexecuted instantiation: receive.c:get_msg_time Unexecuted instantiation: script_cb.c:get_msg_time Unexecuted instantiation: ip_addr.c:get_msg_time Unexecuted instantiation: async.c:get_msg_time Unexecuted instantiation: daemonize.c:get_msg_time Unexecuted instantiation: timer.c:get_msg_time Unexecuted instantiation: trace_api.c:get_msg_time Unexecuted instantiation: mod_fix.c:get_msg_time Unexecuted instantiation: reactor.c:get_msg_time Unexecuted instantiation: forward.c:get_msg_time Unexecuted instantiation: xlog.c:get_msg_time Unexecuted instantiation: blacklists.c:get_msg_time Unexecuted instantiation: usr_avp.c:get_msg_time Unexecuted instantiation: profiling.c:get_msg_time Unexecuted instantiation: sl_cb.c:get_msg_time Unexecuted instantiation: resolve.c:get_msg_time Unexecuted instantiation: io_wait.c:get_msg_time Unexecuted instantiation: transformations.c:get_msg_time Unexecuted instantiation: sr_module_deps.c:get_msg_time Unexecuted instantiation: cfg_reload.c:get_msg_time Unexecuted instantiation: time_rec.c:get_msg_time Unexecuted instantiation: status_report.c:get_msg_time Unexecuted instantiation: signals.c:get_msg_time Unexecuted instantiation: db_id.c:get_msg_time Unexecuted instantiation: pi_framework_db.c:get_msg_time Unexecuted instantiation: csv.c:get_msg_time Unexecuted instantiation: evi_transport.c:get_msg_time Unexecuted instantiation: msg_translator.c:get_msg_time Unexecuted instantiation: md5utils.c:get_msg_time Unexecuted instantiation: cfg.tab.c:get_msg_time Unexecuted instantiation: modparam.c:get_msg_time Unexecuted instantiation: crc.c:get_msg_time Unexecuted instantiation: re.c:get_msg_time Unexecuted instantiation: lex.yy.c:get_msg_time Unexecuted instantiation: cfg_pp.c:get_msg_time Unexecuted instantiation: shutdown.c:get_msg_time Unexecuted instantiation: cmds.c:get_msg_time Unexecuted instantiation: core_cmds.c:get_msg_time Unexecuted instantiation: serialize.c:get_msg_time Unexecuted instantiation: cachedb.c:get_msg_time Unexecuted instantiation: cachedb_id.c:get_msg_time |
631 | | |
632 | | #endif |