[SR-Dev] git:ser_modules: modules: tm register_tcmb api update

Andrei Pelinescu-Onciul andrei at iptel.org
Wed Apr 15 20:57:27 CEST 2009


Module: sip-router
Branch: ser_modules
Commit: 84f05eea920186865233d218ac58a754975ec69a
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=84f05eea920186865233d218ac58a754975ec69a

Author: Andrei Pelinescu-Onciul <andrei at iptel.org>
Committer: Andrei Pelinescu-Onciul <andrei at iptel.org>
Date:   Wed Apr 15 19:30:36 2009 +0200

modules: tm register_tcmb api update

- register_tmcb has now an additional parameter

---

 modules_s/acc_db/acc_db.c         |   14 +++++++++-----
 modules_s/acc_radius/acc_radius.c |   14 +++++++++-----
 modules_s/acc_syslog/acc_syslog.c |   14 +++++++++-----
 modules_s/cpl-c/cpl_proxy.h       |    2 +-
 modules_s/mangler/mangler.c       |    2 +-
 modules_s/osp/tm.c                |    4 ++--
 modules_s/uac/from.c              |    4 ++--
 modules_s/uac/uac.c               |    2 +-
 8 files changed, 34 insertions(+), 22 deletions(-)

diff --git a/modules_s/acc_db/acc_db.c b/modules_s/acc_db/acc_db.c
index 5f94187..755b110 100644
--- a/modules_s/acc_db/acc_db.c
+++ b/modules_s/acc_db/acc_db.c
@@ -917,24 +917,28 @@ static void on_req(struct cell* t, int type, struct tmcb_params *ps)
 	req_time = time(0);
 
 	if (is_acc_on(ps->req) || is_mc_on(ps->req)) {
-		if (tmb.register_tmcb(0, t, TMCB_RESPONSE_OUT, replyout_handler, (void*)req_time) <= 0) {
+		if (tmb.register_tmcb(0, t, TMCB_RESPONSE_OUT, replyout_handler,
+								(void*)req_time, 0) <= 0) {
 			LOG(L_ERR, "ERROR:acc:on_req: Error while registering TMCB_RESPONSE_OUT callback\n");
 			return;
 		}
 
 		if (report_ack) {
-			if (tmb.register_tmcb(0, t, TMCB_E2EACK_IN, ack_handler, (void*)req_time) <= 0) {
+			if (tmb.register_tmcb(0, t, TMCB_E2EACK_IN, ack_handler,
+									(void*)req_time, 0) <= 0) {
 				LOG(L_ERR, "ERROR:acc:on_req: Error while registering TMCB_E2EACK_IN callback\n");
 				return;
 			}
 		}
 
-		if (tmb.register_tmcb(0, t, TMCB_ON_FAILURE_RO, failure_handler, (void*)req_time) <= 0) {
+		if (tmb.register_tmcb(0, t, TMCB_ON_FAILURE_RO, failure_handler,
+								(void*)req_time, 0) <= 0) {
 			LOG(L_ERR, "ERROR:acc:on_req: Error while registering TMCB_ON_FAILURE_RO callback\n");
 			return;
 		}
 
-		if (tmb.register_tmcb(0, t, TMCB_RESPONSE_IN, replyin_handler, (void*)req_time) <= 0) {
+		if (tmb.register_tmcb(0, t, TMCB_RESPONSE_IN, replyin_handler,
+								(void*)req_time, 0) <= 0) {
 			LOG(L_ERR, "ERROR:acc:on_req: Error while registering TMCB_RESPONSE_IN callback\n");
 			return;
 		}
@@ -1019,7 +1023,7 @@ static int mod_init(void)
 
 	     /* register callbacks*/
 	     /* listen for all incoming requests  */
-	if (tmb.register_tmcb( 0, 0, TMCB_REQUEST_IN, on_req, 0 ) <= 0) {
+	if (tmb.register_tmcb( 0, 0, TMCB_REQUEST_IN, on_req, 0, 0) <= 0) {
 		LOG(L_ERR,"ERROR:acc:mod_init: cannot register TMCB_REQUEST_IN "
 		    "callback\n");
 		return -1;
diff --git a/modules_s/acc_radius/acc_radius.c b/modules_s/acc_radius/acc_radius.c
index 6931863..4275268 100644
--- a/modules_s/acc_radius/acc_radius.c
+++ b/modules_s/acc_radius/acc_radius.c
@@ -959,24 +959,28 @@ void on_req(struct cell* t, int type, struct tmcb_params *ps)
 	req_time = time(0);
 
 	if (is_acc_on(ps->req) || is_mc_on(ps->req)) {
-		if (tmb.register_tmcb(0, t, TMCB_RESPONSE_OUT, replyout_handler, (void*)req_time) <= 0) {
+		if (tmb.register_tmcb(0, t, TMCB_RESPONSE_OUT, replyout_handler,
+								(void*)req_time, 0) <= 0) {
 			LOG(L_ERR, "ERROR:acc:on_req: Error while registering TMCB_RESPONSE_OUT callback\n");
 			return;
 		}
 
 		if (report_ack) {
-			if (tmb.register_tmcb(0, t, TMCB_E2EACK_IN, ack_handler, (void*)req_time) <= 0) {
+			if (tmb.register_tmcb(0, t, TMCB_E2EACK_IN, ack_handler,
+									(void*)req_time, 0) <= 0) {
 				LOG(L_ERR, "ERROR:acc:on_req: Error while registering TMCB_E2EACK_IN callback\n");
 				return;
 			}
 		}
 
-		if (tmb.register_tmcb(0, t, TMCB_ON_FAILURE_RO, failure_handler, (void*)req_time) <= 0) {
+		if (tmb.register_tmcb(0, t, TMCB_ON_FAILURE_RO, failure_handler,
+								(void*)req_time, 0) <= 0) {
 			LOG(L_ERR, "ERROR:acc:on_req: Error while registering TMCB_ON_FAILURE_RO callback\n");
 			return;
 		}
 
-		if (tmb.register_tmcb(0, t, TMCB_RESPONSE_IN, replyin_handler, (void*)req_time) <= 0) {
+		if (tmb.register_tmcb(0, t, TMCB_RESPONSE_IN, replyin_handler,
+								(void*)req_time, 0) <= 0) {
 			LOG(L_ERR, "ERROR:acc:on_req: Error while registering TMCB_RESPONSE_IN callback\n");
 			return;
 		}
@@ -1008,7 +1012,7 @@ static int mod_init(void)
 
 	     /* register callbacks*/
 	     /* listen for all incoming requests  */
-	if (tmb.register_tmcb( 0, 0, TMCB_REQUEST_IN, on_req, 0 ) <= 0) {
+	if (tmb.register_tmcb( 0, 0, TMCB_REQUEST_IN, on_req, 0, 0) <= 0) {
 		LOG(L_ERR,"ERROR:acc:mod_init: cannot register TMCB_REQUEST_IN "
 		    "callback\n");
 		return -1;
diff --git a/modules_s/acc_syslog/acc_syslog.c b/modules_s/acc_syslog/acc_syslog.c
index f0ec8f3..269bd46 100644
--- a/modules_s/acc_syslog/acc_syslog.c
+++ b/modules_s/acc_syslog/acc_syslog.c
@@ -876,24 +876,28 @@ void on_req(struct cell* t, int type, struct tmcb_params *ps)
 	req_time = time(0);
 
 	if (is_acc_on(ps->req) || is_mc_on(ps->req)) {
-		if (tmb.register_tmcb(0, t, TMCB_RESPONSE_OUT, replyout_handler, (void*)req_time) <= 0) {
+		if (tmb.register_tmcb(0, t, TMCB_RESPONSE_OUT, replyout_handler,
+								(void*)req_time, 0) <= 0) {
 			LOG(L_ERR, "ERROR:acc:on_req: Error while registering TMCB_RESPONSE_OUT callback\n");
 			return;
 		}
 
 		if (report_ack) {
-			if (tmb.register_tmcb(0, t, TMCB_E2EACK_IN, ack_handler, (void*)req_time) <= 0) {
+			if (tmb.register_tmcb(0, t, TMCB_E2EACK_IN, ack_handler,
+									(void*)req_time, 0) <= 0) {
 				LOG(L_ERR, "ERROR:acc:on_req: Error while registering TMCB_E2EACK_IN callback\n");
 				return;
 			}
 		}
 
-		if (tmb.register_tmcb(0, t, TMCB_ON_FAILURE_RO, failure_handler, (void*)req_time) <= 0) {
+		if (tmb.register_tmcb(0, t, TMCB_ON_FAILURE_RO, failure_handler,
+								(void*)req_time, 0) <= 0) {
 			LOG(L_ERR, "ERROR:acc:on_req: Error while registering TMCB_ON_FAILURE_RO callback\n");
 			return;
 		}
 
-		if (tmb.register_tmcb(0, t, TMCB_RESPONSE_IN, replyin_handler, (void*)req_time) <= 0) {
+		if (tmb.register_tmcb(0, t, TMCB_RESPONSE_IN, replyin_handler,
+								(void*)req_time, 0) <= 0) {
 			LOG(L_ERR, "ERROR:acc:on_req: Error while registering TMCB_RESPONSE_IN callback\n");
 			return;
 		}
@@ -924,7 +928,7 @@ static int mod_init(void)
 
 	     /* register callbacks*/
 	     /* listen for all incoming requests  */
-	if (tmb.register_tmcb( 0, 0, TMCB_REQUEST_IN, on_req, 0 ) <= 0) {
+	if (tmb.register_tmcb( 0, 0, TMCB_REQUEST_IN, on_req, 0, 0) <= 0) {
 		LOG(L_ERR,"ERROR:acc:mod_init: cannot register TMCB_REQUEST_IN "
 		    "callback\n");
 		return -1;
diff --git a/modules_s/cpl-c/cpl_proxy.h b/modules_s/cpl-c/cpl_proxy.h
index 538a015..f6daf20 100644
--- a/modules_s/cpl-c/cpl_proxy.h
+++ b/modules_s/cpl-c/cpl_proxy.h
@@ -487,7 +487,7 @@ static inline char *run_proxy( struct cpl_interpreter *intr )
 		/* as I am interested in getting the responses back - I need to install
 		 * some callback functions for replies  */
 		if (cpl_fct.tmb.register_tmcb(intr->msg,0,
-		TMCB_ON_FAILURE|TMCB_RESPONSE_OUT,reply_callback,(void*)intr) <= 0 ) {
+		TMCB_ON_FAILURE|TMCB_RESPONSE_OUT,reply_callback,(void*)intr, 0) <= 0){
 			LOG(L_ERR, "ERROR:cpl_c:run_proxy: failed to register "
 				"TMCB_RESPONSE_OUT callback\n");
 			goto runtime_error;
diff --git a/modules_s/mangler/mangler.c b/modules_s/mangler/mangler.c
index c97e72b..98fb26d 100644
--- a/modules_s/mangler/mangler.c
+++ b/modules_s/mangler/mangler.c
@@ -185,7 +185,7 @@ prepare ()
 	}
 	if (load_tm(&tmb)==-1) return -1;
 
-	if (tmb.register_tmcb(TMCB_REQUEST_OUT,func_invite,0) <= 0) return -1;
+	if (tmb.register_tmcb(TMCB_REQUEST_OUT, func_invite, 0, 0) <= 0) return -1;
 #endif
 	return 0;
 }
diff --git a/modules_s/osp/tm.c b/modules_s/osp/tm.c
index 7fa96ef..e976498 100644
--- a/modules_s/osp/tm.c
+++ b/modules_s/osp/tm.c
@@ -64,7 +64,7 @@ int ospInitTm(void)
     }
 
     /* Register callbacks, listen for all incoming requests  */
-    if (osp_tmb.register_tmcb(0, 0, TMCB_REQUEST_IN, ospOnReq, 0) <= 0) {
+    if (osp_tmb.register_tmcb(0, 0, TMCB_REQUEST_IN, ospOnReq, 0, 0) <= 0) {
         LOG(L_ERR, "osp: ERROR: failed to register TMCB_REQUEST_IN callback\n");
         LOG(L_ERR, "osp: ERROR: TM callbacks are required for reporting call set up usage\n");
         return -1;
@@ -104,7 +104,7 @@ static void ospOnReq(
 //        TMCB_RESPONSE_IN |
         0;
 
-    if (osp_tmb.register_tmcb(0, t, tmcb_types, ospTmcbFunc, 0) <= 0) {
+    if (osp_tmb.register_tmcb(0, t, tmcb_types, ospTmcbFunc, 0, 0) <= 0) {
         LOG(L_ERR, "osp: ERROR: failed to register TM callbacks\n");
         LOG(L_ERR, "osp: ERROR: TM callbacks are required for reporting call setup usage\n");
         return;
diff --git a/modules_s/uac/from.c b/modules_s/uac/from.c
index 8b68a51..e9e3243 100644
--- a/modules_s/uac/from.c
+++ b/modules_s/uac/from.c
@@ -420,7 +420,7 @@ void tr_checker(struct cell* t, int type, struct tmcb_params *param)
 			 * by replace_from() function */
 			DBG("*************** marker **************\n");
 			if ( uac_tmb.register_tmcb( 0, t, TMCB_RESPONSE_IN,
-				correct_reply, (void*)&rst_from )!=1 )
+						correct_reply, (void*)&rst_from, 0)!=1 )
 			{
 				LOG(L_ERR,"ERROR:uac:tr_checker: failed to install "
 					"TM callback\n");
@@ -434,7 +434,7 @@ void tr_checker(struct cell* t, int type, struct tmcb_params *param)
 				 * by restore_from() function */
 				/* restore in req performed -> replace in reply */
 				if ( uac_tmb.register_tmcb( 0, t, TMCB_RESPONSE_IN,
-					correct_reply, (void*)&rst_to)!=1 )
+							correct_reply, (void*)&rst_to, 0)!=1 )
 				{
 					LOG(L_ERR,"ERROR:uac:tr_checker: failed to install "
 						"TM callback\n");
diff --git a/modules_s/uac/uac.c b/modules_s/uac/uac.c
index 503f9e6..edcf73c 100644
--- a/modules_s/uac/uac.c
+++ b/modules_s/uac/uac.c
@@ -138,7 +138,7 @@ static int mod_init(void)
 	if (from_restore_mode==FROM_AUTO_RESTORE)
 	{
 		/* get all transactions */
-		if (uac_tmb.register_tmcb( 0, 0, TMCB_REQUEST_IN, tr_checker, 0)!=1)
+		if (uac_tmb.register_tmcb( 0, 0, TMCB_REQUEST_IN, tr_checker, 0, 0)!=1)
 		{
 			LOG(L_ERR,"ERROR:uac:mod_init: failed to install TM callback\n");
 			goto error;




More information about the sr-dev mailing list