[PATCH] smppbox :: TLV support

Victor Luchitz <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hello.

I'm attaching a patch against r17 that adds custom TLV support to
DELIVER_SM, DATA_SM and SUBMIT_SM PDU's processed by smppbox.

-- 
Best regards,
 Victor Luchitz
tlv.diff (application/octet-stream, 1.3 KB)
Index: smppbox.c
===================================================================
--- smppbox.c	(revision 17)
+++ smppbox.c	(working copy)
@@ -77,6 +77,7 @@
 #include "gw/sms.h"
 #include "gw/dlr.h"
 #include "gw/heartbeat.h"
+#include "gw/meta_data.h"
 
 /* our config */
 static Cfg *cfg;
@@ -782,6 +783,7 @@
 	else {
 		pdu2->u.deliver_sm.short_message = octstr_duplicate(msg2->sms.msgdata);
 	}
+	pdu2->u.deliver_sm.tlv = meta_data_get_values(msg->sms.meta_data, "smpp");
 	gwlist_append(pdulist, pdu2);
 	msg_destroy(msg2);
     }
@@ -957,6 +959,10 @@
 	msg->sms.sms_type = report_mo;
     }
 
+    if (msg->sms.meta_data == NULL)
+        msg->sms.meta_data = octstr_create("");
+    meta_data_set_values(msg->sms.meta_data, pdu->u.submit_sm.tlv, "smpp", 1);
+
     return msg;
 
 error:
@@ -1103,6 +1109,10 @@
             }
     }
 
+    if (msg->sms.meta_data == NULL)
+        msg->sms.meta_data = octstr_create("");
+    meta_data_set_values(msg->sms.meta_data, pdu->u.data_sm.tlv, "smpp", 1);
+
     return msg;
 
 error:
@@ -1811,6 +1821,10 @@
 	/* init dlr storage */
 	dlr_init(cfg);
 
+	/* initialize low level PDUs */
+	if (smpp_pdu_init(cfg) == -1)
+    	    panic(0, "Connot start with PDU init failed.");
+
 	/*
 	 * first we take the port number in bearerbox and other values from the
 	 * smppbox group in configuration file
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.