00001 /* 00002 * $Id: sip_msg.h 4518 2008-07-28 15:39:28Z henningw $ 00003 * 00004 * Copyright (C) 2001-2003 FhG Fokus 00005 * 00006 * This file is part of Kamailio, a free SIP server. 00007 * 00008 * Kamailio is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version 00012 * 00013 * Kamailio is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with this program; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 */ 00022 00023 /*! \file 00024 * \brief TM :: SIP message handling 00025 * 00026 * \ingroup tm 00027 * - Module: \ref tm 00028 */ 00029 00030 #ifndef _SIP_MSG_H 00031 #define _SIP_MSG_H 00032 00033 #include "../../parser/msg_parser.h" 00034 #include "../../mem/shm_mem.h" 00035 00036 #define sip_msg_free(_p_msg) shm_free( (_p_msg )) 00037 #define sip_msg_free_unsafe(_p_msg) shm_free_unsafe( (_p_msg) ) 00038 00039 00040 struct sip_msg* sip_msg_cloner( struct sip_msg *org_msg, int *sip_msg_len ); 00041 00042 00043 static inline void clean_msg_clone(struct sip_msg *msg,void *min, void *max) 00044 { 00045 struct hdr_field *hdr; 00046 00047 /* free header's parsed structures that were added in pkg mem */ 00048 for( hdr=msg->headers ; hdr ; hdr=hdr->next ) { 00049 if ( hdr->parsed && hdr_allocs_parse(hdr) && 00050 (hdr->parsed<min || hdr->parsed>=max)) { 00051 /* header parsed filed doesn't point inside uas.request memory 00052 * chunck -> it was added by failure funcs.-> free it as pkg */ 00053 LM_DBG("removing hdr->parsed %d\n", hdr->type); 00054 clean_hdr_field(hdr); 00055 hdr->parsed = 0; 00056 } 00057 } 00058 } 00059 00060 00061 00062 #endif
1.5.6