TM :: Message cloning functionality. More...
#include "defs.h"#include "../../parser/msg_parser.h"#include "../../mem/shm_mem.h"#include "../../atomic_ops.h"

Go to the source code of this file.
Cloning a message into shared memory (TM keeps a snapshot of messages in memory); note that many operations, which allocate pkg memory (such as parsing) cannot be used with a cloned message -- it would result in linking pkg structures to shmem msg and eventually in a memory error.
The cloned message is stored in a single memory fragment to save too many shm_mallocs -- these are expensive as they not only take lookup in fragment table but also a shmem lock operation (the same for shm_free)
Allow postponing the cloning of SIP msg: t_newtran() copies the requests to shm mem without the lumps, and t_forward_nonack() clones the lumps later when it is called the first time.
Definition in file tm/sip_msg.h.
| #define _sip_msg_free | ( | _free_func, | ||
| _p_msg | ||||
| ) |
do{ \ if (_p_msg->first_line.type==SIP_REPLY) { \ _free_func( (_p_msg) ); \ } else { \ membar_depends(); \ if ((_p_msg)->add_rm) \ _free_func((_p_msg)->add_rm); \ else if ((_p_msg)->body_lumps) \ _free_func((_p_msg)->body_lumps); \ else if ((_p_msg)->reply_lump) \ _free_func((_p_msg)->reply_lump); \ \ _free_func( (_p_msg) ); \ } \ }while(0)
msg is a reply: one memory block was allocated
msg is a request: two memory blocks were allocated:
Definition at line 70 of file tm/sip_msg.h.
| shm_msg | SIP message in shared memory | |
| pkg_msg | SIP message in private memory |
Definition at line 110 of file tm/sip_msg.c.
References sip_msg::add_rm, sip_msg::body_lumps, sip_msg::first_line, FL_SHM_CLONE, lumps_are_cloned, METHOD_ACK, sip_msg::msg_flags, msg_lump_cloner(), and sip_msg::reply_lump.

| org_msg | Original SIP message | |
| sip_msg_len | Length of the SIP message |
Definition at line 86 of file tm/sip_msg.c.
References sip_msg::first_line, and sip_msg_shm_clone().

1.7.1