Functions | Variables

tm/sip_msg.c File Reference

TM :: Message cloning functionality. More...

#include "defs.h"
#include "sip_msg.h"
#include "../../dprint.h"
#include "../../mem/mem.h"
#include "../../data_lump.h"
#include "../../data_lump_rpl.h"
#include "../../ut.h"
#include "../../sip_msg_clone.h"
#include "../../fix_lumps.h"
Include dependency graph for tm/sip_msg.c:

Go to the source code of this file.

Functions

Variables


Detailed Description

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.c.


Function Documentation

int save_msg_lumps ( struct sip_msg shm_msg,
struct sip_msg pkg_msg 
)
Parameters:
shm_msg SIP message in shared memory
pkg_msg SIP message in private memory
Returns:
0 on success, -1 on error

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.

Here is the call graph for this function:

struct sip_msg* sip_msg_cloner ( struct sip_msg org_msg,
int *  sip_msg_len 
) [read]
Warning:
Cloner does not clone all hdr_field headers (From, To, etc.). Pointers will reference pkg memory. Dereferencing will crash ser!
Parameters:
org_msg Original SIP message
sip_msg_len Length of the SIP message
Returns:
Cloned SIP message, or NULL on error

Definition at line 86 of file tm/sip_msg.c.

References sip_msg::first_line, and sip_msg_shm_clone().

Here is the call graph for this function: