Module: sip-router Branch: master Commit: 148b8faa4c38115bbe47809f0921fd20f86c6567 URL: http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=148b8faa...
Author: Daniel-Constantin Mierla miconda@gmail.com Committer: Jan Janak jan@iptel.org Date: Sat Mar 28 15:01:19 2009 +0100
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 jan@iptel.org
---
modules/tm/t_reply.c | 10 +++++++++- modules/tm/t_reply.h | 3 +++ modules/tm/tm_load.c | 1 + modules/tm/tm_load.h | 1 + 4 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/modules/tm/t_reply.c b/modules/tm/t_reply.c index a72f134..4e8a884 100644 --- a/modules/tm/t_reply.c +++ b/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; diff --git a/modules/tm/t_reply.h b/modules/tm/t_reply.h index fa9324d..65b4498 100644 --- a/modules/tm/t_reply.h +++ b/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 diff --git a/modules/tm/tm_load.c b/modules/tm/tm_load.c index c61d39d..ebdf0a8 100644 --- a/modules/tm/tm_load.c +++ b/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; } diff --git a/modules/tm/tm_load.h b/modules/tm/tm_load.h index 98b9ff2..bc99256 100644 --- a/modules/tm/tm_load.h +++ b/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;