Module: sip-router
Branch: kamailio_3.0
Commit: a6ab14576e4ca562ea6a8f3b7c5a57a182eb3a64
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=a6ab145…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Fri Oct 30 12:55:21 2009 +0100
tm: set/reset head of xavps on TM events
- import from branch daniel/xavp
---
modules/tm/h_table.c | 19 +++++++++++++++++++
modules/tm/h_table.h | 6 ++++++
modules/tm/t_hooks.c | 10 ++++++++++
modules/tm/t_reply.c | 21 +++++++++++++++++++++
modules/tm/uac.c | 3 +++
5 files changed, 59 insertions(+), 0 deletions(-)
diff --git a/modules/tm/h_table.c b/modules/tm/h_table.c
index f35d7d5..f856ef6 100644
--- a/modules/tm/h_table.c
+++ b/modules/tm/h_table.c
@@ -210,6 +210,10 @@ void free_cell( struct cell* dead_cell )
destroy_avp_list_unsafe( &dead_cell->uri_avps_from );
if (dead_cell->uri_avps_to)
destroy_avp_list_unsafe( &dead_cell->uri_avps_to );
+#ifdef WITH_XAVP
+ if (dead_cell->xavps_list)
+ xavp_destroy_list_unsafe( &dead_cell->xavps_list );
+#endif
/* the cell's body */
shm_free_unsafe( dead_cell );
@@ -276,6 +280,9 @@ struct cell* build_cell( struct sip_msg* p_msg )
int sip_msg_len;
avp_list_t* old;
struct tm_callback *cbs, *cbs_tmp;
+#ifdef WITH_XAVP
+ sr_xavp_t** xold;
+#endif
/* allocs a new cell */
/* if syn_branch==0 add space for md5 (MD5_LEN -sizeof(struct cell.md5)) */
@@ -315,6 +322,12 @@ struct cell* build_cell( struct sip_msg* p_msg )
new_cell->user_avps_to = *old;
*old = 0;
+#ifdef WITH_XAVP
+ xold = xavp_set_list(&new_cell->xavps_list );
+ new_cell->xavps_list = *xold;
+ *xold = 0;
+#endif
+
/* We can just store pointer to domain avps in the transaction context,
* because they are read-only
*/
@@ -375,9 +388,15 @@ error:
destroy_avp_list(&new_cell->user_avps_to);
destroy_avp_list(&new_cell->uri_avps_from);
destroy_avp_list(&new_cell->uri_avps_to);
+#ifdef WITH_XAVP
+ xavp_destroy_list(&new_cell->xavps_list);
+#endif
shm_free(new_cell);
/* unlink transaction AVP list and link back the global AVP list (bogdan)*/
reset_avps();
+#ifdef WITH_XAVP
+ xavp_reset_list();
+#endif
return NULL;
}
diff --git a/modules/tm/h_table.h b/modules/tm/h_table.h
index 90abd64..739c30c 100644
--- a/modules/tm/h_table.h
+++ b/modules/tm/h_table.h
@@ -69,6 +69,9 @@
#include "../../types.h"
#include "../../md5utils.h"
#include "../../usr_avp.h"
+#ifdef WITH_XAVP
+#include "../../xavp.h"
+#endif
#include "../../timer.h"
#include "../../flags.h"
#include "../../atomic_ops.h"
@@ -360,6 +363,9 @@ typedef struct cell
struct usr_avp *user_avps_to;
struct usr_avp *domain_avps_from;
struct usr_avp *domain_avps_to;
+#ifdef WITH_XAVP
+ sr_xavp_t *xavps_list;
+#endif
/* protection against concurrent reply processing */
ser_lock_t reply_mutex;
diff --git a/modules/tm/t_hooks.c b/modules/tm/t_hooks.c
index 6e149ea..ceb3c24 100644
--- a/modules/tm/t_hooks.c
+++ b/modules/tm/t_hooks.c
@@ -230,6 +230,9 @@ void run_trans_callbacks_internal(struct tmcb_head_list* cb_lst, int
type,
{
struct tm_callback *cbp;
avp_list_t* backup_from, *backup_to, *backup_dom_from, *backup_dom_to, *backup_uri_from,
*backup_uri_to;
+#ifdef WITH_XAVP
+ sr_xavp_t **backup_xavps;
+#endif
backup_uri_from = set_avp_list(AVP_CLASS_URI | AVP_TRACK_FROM,
&trans->uri_avps_from );
@@ -243,6 +246,10 @@ void run_trans_callbacks_internal(struct tmcb_head_list* cb_lst, int
type,
&trans->domain_avps_from);
backup_dom_to = set_avp_list(AVP_CLASS_DOMAIN | AVP_TRACK_TO,
&trans->domain_avps_to);
+#ifdef WITH_XAVP
+ backup_xavps = xavp_set_list(&trans->xavps_list);
+#endif
+
cbp=(struct tm_callback*)cb_lst->first;
while(cbp){
membar_depends(); /* make sure the cache has the correct cbp
@@ -261,6 +268,9 @@ void run_trans_callbacks_internal(struct tmcb_head_list* cb_lst, int
type,
set_avp_list(AVP_CLASS_USER | AVP_TRACK_FROM, backup_from );
set_avp_list(AVP_CLASS_URI | AVP_TRACK_TO, backup_uri_to );
set_avp_list(AVP_CLASS_URI | AVP_TRACK_FROM, backup_uri_from );
+#ifdef WITH_XAVP
+ xavp_set_list(backup_xavps);
+#endif
}
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c
index d643245..a250f63 100644
--- a/modules/tm/t_reply.c
+++ b/modules/tm/t_reply.c
@@ -114,6 +114,9 @@
#include "../../data_lump.h"
#include "../../data_lump_rpl.h"
#include "../../usr_avp.h"
+#ifdef WITH_XAVP
+#include "../../xavp.h"
+#endif
#include "../../atomic_ops.h" /* membar_write() */
#include "../../compiler_opt.h"
#ifdef USE_DST_BLACKLIST
@@ -688,6 +691,9 @@ void faked_env( struct cell *t, struct sip_msg *msg)
static avp_list_t* backup_user_from, *backup_user_to;
static avp_list_t* backup_domain_from, *backup_domain_to;
static avp_list_t* backup_uri_from, *backup_uri_to;
+#ifdef WITH_XAVP
+ static sr_xavp_t **backup_xavps;
+#endif
static struct socket_info* backup_si;
if (msg) {
@@ -718,6 +724,9 @@ void faked_env( struct cell *t, struct sip_msg *msg)
backup_user_to = set_avp_list(AVP_TRACK_TO | AVP_CLASS_USER, &t->user_avps_to
);
backup_domain_from = set_avp_list(AVP_TRACK_FROM | AVP_CLASS_DOMAIN,
&t->domain_avps_from );
backup_domain_to = set_avp_list(AVP_TRACK_TO | AVP_CLASS_DOMAIN,
&t->domain_avps_to );
+#ifdef WITH_XAVP
+ backup_xavps = xavp_set_list(&t->xavps_list);
+#endif
/* set default send address to the saved value */
backup_si=bind_address;
bind_address=t->uac[0].request.dst.send_sock;
@@ -733,6 +742,9 @@ void faked_env( struct cell *t, struct sip_msg *msg)
set_avp_list(AVP_TRACK_TO | AVP_CLASS_DOMAIN, backup_domain_to );
set_avp_list(AVP_TRACK_FROM | AVP_CLASS_URI, backup_uri_from );
set_avp_list(AVP_TRACK_TO | AVP_CLASS_URI, backup_uri_to );
+#ifdef WITH_XAVP
+ xavp_set_list(backup_xavps);
+#endif
bind_address=backup_si;
}
}
@@ -1834,6 +1846,9 @@ int reply_received( struct sip_msg *p_msg )
avp_list_t* backup_user_from, *backup_user_to;
avp_list_t* backup_domain_from, *backup_domain_to;
avp_list_t* backup_uri_from, *backup_uri_to;
+#ifdef WITH_XAVP
+ sr_xavp_t **backup_xavps;
+#endif
#ifdef USE_DNS_FAILOVER
int branch_ret;
int prev_branch;
@@ -1981,6 +1996,9 @@ int reply_received( struct sip_msg *p_msg )
backup_user_to = set_avp_list(AVP_TRACK_TO | AVP_CLASS_USER, &t->user_avps_to
);
backup_domain_from = set_avp_list(AVP_TRACK_FROM | AVP_CLASS_DOMAIN,
&t->domain_avps_from );
backup_domain_to = set_avp_list(AVP_TRACK_TO | AVP_CLASS_DOMAIN,
&t->domain_avps_to );
+#ifdef WITH_XAVP
+ backup_xavps = xavp_set_list(&t->xavps_list);
+#endif
setbflagsval(0, uac->branch_flags);
/* Pre- and post-script callbacks have already
* been executed by the core. (Miklos)
@@ -2000,6 +2018,9 @@ int reply_received( struct sip_msg *p_msg )
set_avp_list( AVP_TRACK_TO | AVP_CLASS_USER, backup_user_to );
set_avp_list( AVP_TRACK_FROM | AVP_CLASS_DOMAIN, backup_domain_from );
set_avp_list( AVP_TRACK_TO | AVP_CLASS_DOMAIN, backup_domain_to );
+#ifdef WITH_XAVP
+ xavp_set_list(backup_xavps);
+#endif
}
#ifdef USE_DST_BLACKLIST
/* add temporary to the blacklist the source of a 503 reply */
diff --git a/modules/tm/uac.c b/modules/tm/uac.c
index 7565763..d311cc9 100644
--- a/modules/tm/uac.c
+++ b/modules/tm/uac.c
@@ -409,6 +409,9 @@ static inline int t_uac_prepare(uac_req_t *uac_r,
/* better reset avp list now - anyhow, it's useless from
* this point (bogdan) */
reset_avps();
+#ifdef WITH_XAVP
+ xavp_reset_list();
+#endif
new_cell->method.s = buf;
new_cell->method.len = uac_r->method->len;