[SR-Dev] git:master: tm: new flags field in ua_client structure

Daniel-Constantin Mierla miconda at gmail.com
Mon Apr 27 17:34:13 CEST 2009


Module: sip-router
Branch: master
Commit: 388683b5ccc232066e13bb7a2504f1fb3c86a126
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=388683b5ccc232066e13bb7a2504f1fb3c86a126

Author: Daniel-Constantin Mierla <miconda at gmail.com>
Committer: Daniel-Constantin Mierla <miconda at gmail.com>
Date:   Mon Apr 27 16:50:54 2009 +0200

tm: new flags field in ua_client structure

- if enabled, it stores various states of the uac, for now: RR and
  double RR indicators

---

 modules/tm/h_table.h |   12 ++++++++++++
 modules/tm/t_fwd.c   |    7 +++++++
 2 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/modules/tm/h_table.h b/modules/tm/h_table.h
index 1710584..37aecc9 100644
--- a/modules/tm/h_table.h
+++ b/modules/tm/h_table.h
@@ -192,6 +192,13 @@ typedef struct ua_server
 
 /* User Agent Client content */
 
+#define TM_UAC_FLAGS
+#ifdef TM_UAC_FLAGS
+/* UAC internal flags */
+#define TM_UAC_FLAG_RR	1	/* Record-Route applied */
+#define TM_UAC_FLAG_R2	2	/* 2nd Record-Route applied */
+#endif
+
 typedef struct ua_client
 {
 	/* if we store a reply (branch picking), this is where it is */
@@ -212,6 +219,11 @@ typedef struct ua_client
 	str              uri;
 	/* if we don't store, we at least want to know the status */
 	int             last_received;
+
+#ifdef TM_UAC_FLAGS
+	/* internal flags per tm uac */
+	unsigned int flags;
+#endif
 #ifdef WITH_AS_SUPPORT
 	/**
 	 * Resent for every rcvd 2xx reply.
diff --git a/modules/tm/t_fwd.c b/modules/tm/t_fwd.c
index 23ebd2e..9344e6f 100644
--- a/modules/tm/t_fwd.c
+++ b/modules/tm/t_fwd.c
@@ -443,6 +443,13 @@ int add_uac( struct cell *t, struct sip_msg *request, str *uri, str* next_hop,
 	t->uac[branch].uri.s=t->uac[branch].request.buffer+
 		request->first_line.u.request.method.len+1;
 	t->uac[branch].uri.len=uri->len;
+#ifdef TM_UAC_FLAGS
+	len = count_applied_lumps(request->add_rm, HDR_RECORDROUTE_T);
+	if(len==1)
+		t->uac[branch].flags = TM_UAC_FLAG_RR;
+	else if(len==2)
+		t->uac[branch].flags = TM_UAC_FLAG_RR|TM_UAC_FLAG_R2;
+#endif
 	membar_write(); /* to allow lockless ops (e.g. which_cancel()) we want
 					   to be sure everything above is fully written before
 					   updating branches no. */




More information about the sr-dev mailing list