Module: sip-router
Branch: daniel/xavp
Commit: 074517dbf60512194517666bbbf39125369b4624
URL:
http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=074517d…
Author: Daniel-Constantin Mierla <miconda(a)gmail.com>
Committer: Daniel-Constantin Mierla <miconda(a)gmail.com>
Date: Tue Jun 30 12:16:35 2009 +0200
tm: set/reset head of xavps on TM events
---
modules/tm/h_table.c | 19 +++++++++++++++++++
modules/tm/h_table.h | 8 +++++++-
modules/tm/t_hooks.c | 10 ++++++++++
modules/tm/t_reply.c | 21 +++++++++++++++++++++
modules/tm/uac.c | 3 +++
5 files changed, 60 insertions(+), 1 deletions(-)
diff --git a/modules/tm/h_table.c b/modules/tm/h_table.c
index 11fb1a8..d536942 100644
--- a/modules/tm/h_table.c
+++ b/modules/tm/h_table.c
@@ -201,6 +201,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 );
@@ -266,6 +270,9 @@ struct cell* build_cell( struct sip_msg* p_msg )
struct cell* new_cell;
int sip_msg_len;
avp_list_t* old;
+#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)) */
@@ -305,6 +312,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
*/
@@ -347,9 +360,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 d6c36e4..1528039 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"
@@ -356,7 +359,10 @@ 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 3d46f6f..3bcf8c9 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 "../../usr_avp.h"
+#endif
#include "../../atomic_ops.h" /* membar_write() */
#include "../../compiler_opt.h"
#ifdef USE_DST_BLACKLIST
@@ -684,6 +687,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) {
@@ -714,6 +720,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;
@@ -729,6 +738,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;
}
}
@@ -1826,6 +1838,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;
@@ -1972,6 +1987,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 execueted by the core. (Miklos)
@@ -1989,6 +2007,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 6dfd0fc..1a3ac5f 100644
--- a/modules/tm/uac.c
+++ b/modules/tm/uac.c
@@ -284,6 +284,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
set_kr(REQ_FWDED);