[sr-dev] git:pd/msrp: modules/msrp: Added place holders for MSRP transaction storage functions

Peter Dunkley peter.dunkley at crocodile-rcs.com
Sun Feb 10 23:43:26 CET 2013


Module: sip-router
Branch: pd/msrp
Commit: 294d1b6a98762598cae925d6792ba8ed9930519c
URL:    http://git.sip-router.org/cgi-bin/gitweb.cgi/sip-router/?a=commit;h=294d1b6a98762598cae925d6792ba8ed9930519c

Author: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Committer: Peter Dunkley <peter.dunkley at crocodile-rcs.com>
Date:   Fri Feb  8 16:30:56 2013 +0000

modules/msrp: Added place holders for MSRP transaction storage functions

- Needed for generating REPORTs from error responses and timed-out SENDs

---

 modules/msrp/msrp_mod.c |   50 ++++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 49 insertions(+), 1 deletions(-)

diff --git a/modules/msrp/msrp_mod.c b/modules/msrp/msrp_mod.c
index 2dca9ae..b815358 100644
--- a/modules/msrp/msrp_mod.c
+++ b/modules/msrp/msrp_mod.c
@@ -61,6 +61,9 @@ static int w_msrp_reply_flags(sip_msg_t* msg, char *tflags, char* str2);
 static int w_msrp_cmap_save(sip_msg_t* msg, char* str1, char* str2);
 static int w_msrp_cmap_lookup(sip_msg_t* msg, char* str1, char* str2);
 static int w_msrp_report(sip_msg_t* msg, char* code, char* text);
+static int w_msrp_tmap_save(sip_msg_t* msg, char* str1, char* str2);
+static int w_msrp_tmap_lookup(sip_msg_t* msg, char* str1, char* str2);
+static int w_msrp_tmap_del(sip_msg_t* msg, char* str1, char* str2);
 
 static void msrp_local_timer(unsigned int ticks, void* param); /*!< Local timer handler */
 
@@ -70,6 +73,7 @@ int msrp_auth_min_expires = 60;
 int msrp_auth_max_expires = 3600;
 int msrp_timer_interval = 60;
 str msrp_use_path_addr = { 0 };
+int msrp_tmap_size = 10;
 
 static int msrp_frame_received(void *data);
 sip_msg_t *msrp_fake_sipmsg(msrp_frame_t *mf);
@@ -111,6 +115,12 @@ static cmd_export_t cmds[]={
 		0, ANY_ROUTE},
 	{"msrp_report", (cmd_function)w_msrp_report, 2, fixup_spve_spve,
 		0, ANY_ROUTE},
+	{"msrp_tmap_save", (cmd_function)w_msrp_tmap_save, 0, 0,
+		0, ANY_ROUTE},
+	{"msrp_tmap_lookup", (cmd_function)w_msrp_tmap_lookup, 0, 0,
+		0, ANY_ROUTE},
+	{"msrp_tmap_del", (cmd_function)w_msrp_tmap_del, 0, 0,
+		0, ANY_ROUTE},
 	{0, 0, 0, 0, 0, 0}
 };
 
@@ -121,6 +131,7 @@ static param_export_t params[]={
 	{"auth_max_expires",  PARAM_INT,   &msrp_auth_max_expires},
 	{"timer_interval",    PARAM_INT,   &msrp_timer_interval},
 	{"use_path_addr",     PARAM_STR,   &msrp_use_path_addr},
+	{"tmap_size",         PARAM_INT,   &msrp_tmap_size},
 	{0, 0, 0}
 };
 
@@ -164,10 +175,23 @@ static int mod_init(void)
 			LM_ERR("Cannot init internal cmap\n");
 			return -1;
 		}
+	}
+
+	if(msrp_tmap_size>0) {
+		if(msrp_tmap_size>16)
+			msrp_tmap_size = 16;
+//		if(msrp_tmap_init(1<<msrp_tmap_size)<0) {
+//			LM_ERR("Cannot init tmap\n");
+//			return -1;
+//		}
+	}
+
+	if (msrp_cmap_size> 0 || msrp_tmap_size> 0) {
 		if(msrp_timer_interval<=0)
 			msrp_timer_interval = 60;
 		register_sync_timers(1);
 	}
+
 	sr_event_register_cb(SREV_TCP_MSRP_FRAME, msrp_frame_received);
 	return 0;
 }
@@ -184,7 +208,7 @@ static int child_init(int rank)
 
 	if (rank!=PROC_MAIN)
 		return 0;
-	if(msrp_cmap_size>0) {
+	if(msrp_cmap_size>0 || msrp_tmap_size>0) {
 		if(fork_sync_timer(PROC_TIMER, "MSRP Timer", 1 /*socks flag*/,
 				msrp_local_timer, NULL, msrp_timer_interval /*sec*/)<0) {
 			LM_ERR("failed to start timer routine as process\n");
@@ -460,6 +484,30 @@ static int w_msrp_cmap_lookup(sip_msg_t* msg, char* str1, char* str2)
 /**
  *
  */
+static int w_msrp_tmap_save(sip_msg_t* msg, char* str1, char* str2)
+{
+	return 1;
+}
+
+/**
+ *
+ */
+static int w_msrp_tmap_lookup(sip_msg_t* msg, char* str1, char* str2)
+{
+	return 1;
+}
+
+/**
+ *
+ */
+static int w_msrp_tmap_del(sip_msg_t* msg, char* str1, char* str2)
+{
+	return 1;
+}
+
+/**
+ *
+ */
 static int msrp_frame_received(void *data)
 {
 	tcp_event_info_t *tev;




More information about the sr-dev mailing list