Преглед на файлове

Export picked branch index via the tm module API.

This patch turns a function-local variable into a global variable in the
module and adds a new function to read the value of the variable. The
function is then exported via the tm module API.

Signed-off-by: Jan Janak <[email protected]>
Daniel-Constantin Mierla преди 16 години
родител
ревизия
148b8faa4c
променени са 4 файла, в които са добавени 14 реда и са изтрити 1 реда
  1. 9 1
      modules/tm/t_reply.c
  2. 3 0
      modules/tm/t_reply.h
  3. 1 0
      modules/tm/tm_load.c
  4. 1 0
      modules/tm/tm_load.h

+ 9 - 1
modules/tm/t_reply.c

@@ -182,6 +182,15 @@ int t_get_reply_totag(struct sip_msg *msg, str *totag)
 	return 1;
 }
 
+static int picked_branch = -1;
+
+/*! \brief returns the picked branch */
+int t_get_picked_branch(void)
+{
+	return picked_branch;
+}
+
+
 
 
 /* we store the reply_route # in private memory which is
@@ -1000,7 +1009,6 @@ static enum rps t_should_relay_response( struct cell *Trans , int new_code,
 	branch_bm_t *cancel_bitmap, struct sip_msg *reply )
 {
 	int branch_cnt;
-	int picked_branch;
 	int picked_code;
 	int new_branch;
 	int inv_through;

+ 3 - 0
modules/tm/t_reply.h

@@ -164,4 +164,7 @@ int fake_req(struct sip_msg *faked_req,
 
 void free_faked_req(struct sip_msg *faked_req, struct cell *t);
 
+typedef int (*tget_picked_f)(void);
+int t_get_picked_branch(void);
+
 #endif

+ 1 - 0
modules/tm/tm_load.c

@@ -227,5 +227,6 @@ int load_tm( struct tm_binds *tmb)
 	}
 
 	tmb->t_get_reply_totag = t_get_reply_totag;
+	tmb->t_get_picked_branch = t_get_picked_branch;
 	return 1;
 }

+ 1 - 0
modules/tm/tm_load.h

@@ -133,6 +133,7 @@ struct tm_binds {
 	t_suspend_f	t_suspend;
 	t_continue_f	t_continue;
 	tget_reply_totag_f t_get_reply_totag;
+	tget_picked_f t_get_picked_branch;
 };
 
 extern int tm_init;