tm/sip_msg.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2001-2003 FhG Fokus
00003  *
00004  * This file is part of ser, a free SIP server.
00005  *
00006  * ser is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation; either version 2 of the License, or
00009  * (at your option) any later version
00010  *
00011  * For a license to use the ser software under conditions
00012  * other than those described here, or to purchase support for this
00013  * software, please contact iptel.org by e-mail at the following addresses:
00014  *    info@iptel.org
00015  *
00016  * ser is distributed in the hope that it will be useful,
00017  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  * GNU General Public License for more details.
00020  *
00021  * You should have received a copy of the GNU General Public License 
00022  * along with this program; if not, write to the Free Software 
00023  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00024  */
00025 
00048 #ifndef _SIP_MSG_H
00049 #define _SIP_MSG_H
00050 
00051 #include "defs.h"
00052 
00053 
00054 #include "../../parser/msg_parser.h"
00055 #include "../../mem/shm_mem.h"
00056 
00057 
00058 #include "../../atomic_ops.h" /* membar_depends() */
00059 
00070 #define  _sip_msg_free(_free_func, _p_msg) \
00071                 do{ \
00072                         if (_p_msg->first_line.type==SIP_REPLY) { \
00073                                 _free_func( (_p_msg) ); \
00074                         } else { \
00075                                 membar_depends(); \
00076                                 if ((_p_msg)->add_rm) \
00077                                         _free_func((_p_msg)->add_rm); \
00078                                 else if ((_p_msg)->body_lumps) \
00079                                         _free_func((_p_msg)->body_lumps); \
00080                                 else if ((_p_msg)->reply_lump) \
00081                                         _free_func((_p_msg)->reply_lump); \
00082                                                                           \
00083                                 _free_func( (_p_msg) ); \
00084                         } \
00085                 }while(0)
00086 
00087 
00091 #define  sip_msg_free(_p_msg) _sip_msg_free(shm_free, _p_msg)
00092 
00095 #define  sip_msg_free_unsafe(_p_msg) _sip_msg_free(shm_free_unsafe, _p_msg)
00096 
00104 struct sip_msg*  sip_msg_cloner( struct sip_msg *org_msg, int *sip_msg_len );
00105 
00109 extern unsigned char lumps_are_cloned;
00110 
00117 int save_msg_lumps( struct sip_msg *shm_msg, struct sip_msg *pkg_msg);
00118 
00119 
00120 #endif