Forráskód Böngészése

tm: new flags field in ua_client structure

- if enabled, it stores various states of the uac, for now: RR and
  double RR indicators
Daniel-Constantin Mierla 16 éve
szülő
commit
388683b5cc
2 módosított fájl, 19 hozzáadás és 0 törlés
  1. 12 0
      modules/tm/h_table.h
  2. 7 0
      modules/tm/t_fwd.c

+ 12 - 0
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.

+ 7 - 0
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. */