| 1371 | } |
| 1372 | |
| 1373 | struct sip_msg* get_dummy_sip_msg(void) |
| 1374 | { |
| 1375 | struct sip_msg* req; |
| 1376 | |
| 1377 | if (dummy_static_req == NULL || dummy_static_in_used) { |
| 1378 | /* if the static request is not yet allocated, or the static |
| 1379 | * request is already in used (nested calls?), we better allocate |
| 1380 | * a new structure */ |
| 1381 | LM_DBG("allocating new sip msg\n"); |
| 1382 | req = (struct sip_msg*)pkg_malloc(sizeof(struct sip_msg)); |
| 1383 | if(req == NULL) |
| 1384 | { |
| 1385 | LM_ERR("No more memory\n"); |
| 1386 | return NULL; |
| 1387 | } |
| 1388 | memset( req, 0, sizeof(struct sip_msg)); |
| 1389 | |
| 1390 | req->buf = (char*)_sip_msg_buf; |
| 1391 | req->len = strlen(_sip_msg_buf); |
| 1392 | req->rcv.src_ip.af = AF_INET; |
| 1393 | req->rcv.dst_ip.af = AF_INET; |
| 1394 | |
| 1395 | parse_msg((char*)_sip_msg_buf, strlen(_sip_msg_buf), req); |
| 1396 | parse_headers( req, HDR_EOH_F, 0); |
| 1397 | if (dummy_static_req==NULL) { |
| 1398 | dummy_static_req = req; |
| 1399 | dummy_static_in_used = 1; |
| 1400 | LM_DBG("setting as static to %p\n",req); |
| 1401 | } |
| 1402 | } else { |
| 1403 | /* reuse the static request */ |
| 1404 | req = dummy_static_req; |
| 1405 | LM_DBG("reusing the static sip msg %p\n",req); |
| 1406 | } |
| 1407 | |
| 1408 | return req; |
| 1409 | } |
| 1410 | |
| 1411 | void release_dummy_sip_msg( struct sip_msg* req) |
| 1412 | { |
no outgoing calls
no test coverage detected