[PATCH] SMPP interface version

"Oded Arbel" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi list.

Speaking of SMPP and patches, and new features submission discussion not
withstanding, here's a patch to get the SMPP interface version id
configurable (for use with SMSCs that only accept SMPP v3.3
connections).

Cheers

--
Oded Arbel
m-Wise Inc.
[email protected]
(972)-67-340014
(972)-9-9581711 (ext: 116)

::..
"The truth is more important than the facts."
	-- Frank Lloyd Wright
smsc_smpp.patch (application/octet-stream, 4.4 KB)
--- kannel-dev/gateway/gw/smsc_smpp.c	2002-05-05 10:57:31.000000000 +0300
+++ gateway/gw/smsc_smpp.c	2002-05-20 18:19:47.000000000 +0300
@@ -26,7 +26,7 @@
  * stable releases.
  */
 
-#if 1
+#ifndef DEBUG
 /* This version doesn't dump. */
 static void dump_pdu(const char *msg, SMPP_PDU *pdu)
 {
@@ -49,7 +49,7 @@
 #define SMPP_ENQUIRE_LINK_INTERVAL  30.0
 #define SMPP_MAX_PENDING_SUBMITS    10
 #define SMPP_RECONNECT_DELAY	    10.0
-
+#define SMPP_DEFAULT_VERSION        0x34
 
 
 /***********************************************************************
@@ -79,6 +79,7 @@
     int transmit_port;
     int receive_port;
     int quitting;
+    int version;
     SMSCConn *conn;
 } SMPP;
 
@@ -89,7 +90,7 @@
     	    	    	 Octstr *address_range, Octstr *our_host, 
                          int source_addr_ton, int source_addr_npi, 
                          int dest_addr_ton, int dest_addr_npi,
-			 Octstr *my_number)
+			 Octstr *my_number, int version)
 {
     SMPP *smpp;
     
@@ -112,6 +113,7 @@
     smpp->dest_addr_npi = dest_addr_npi;
     smpp->our_host = octstr_duplicate(our_host);
     smpp->my_number = octstr_duplicate(my_number);
+    smpp->version = version;
     smpp->transmit_port = transmit_port;
     smpp->receive_port = receive_port;
     smpp->quitting = 0;
@@ -384,7 +401,7 @@
     else
 	bind->u.bind_transmitter.system_type = 
 	    octstr_duplicate(smpp->system_type);
-    bind->u.bind_transmitter.interface_version = 0x34;
+    bind->u.bind_transmitter.interface_version = smpp->version;
     bind->u.bind_transmitter.address_range = 
     	octstr_duplicate(smpp->address_range);
     send_pdu(conn, bind);
@@ -418,7 +435,7 @@
         bind->u.bind_transmitter.system_type = octstr_create("VMA");
     else   
         bind->u.bind_transmitter.system_type = octstr_duplicate(smpp->system_type);
-    bind->u.bind_transmitter.interface_version = 0x34;
+    bind->u.bind_transmitter.interface_version = smpp->version;
     bind->u.bind_transmitter.address_range = octstr_duplicate(smpp->address_range);
     send_pdu(conn, bind);
     smpp_pdu_destroy(bind);
@@ -452,7 +469,7 @@
     else
 	bind->u.bind_receiver.system_type = 
 	    octstr_duplicate(smpp->system_type);
-    bind->u.bind_receiver.interface_version = 0x34;
+    bind->u.bind_receiver.interface_version = smpp->version;
     bind->u.bind_receiver.address_range = 
     	octstr_duplicate(smpp->address_range);
     send_pdu(conn, bind);
@@ -902,7 +919,7 @@
     SMPP *smpp;
     int ok;
     int transceiver_mode;
-
+    int version;
     
     my_number = NULL;
     transceiver_mode = 0;
@@ -958,10 +976,16 @@
     if (cfg_get_integer(&dest_addr_npi, grp, octstr_imm("dest-addr-npi")) == -1)
        dest_addr_npi = -1;
 
+    if (cfg_get_integer(&version, grp, octstr_imm("interface-version")) == -1)
+        version = SMPP_DEFAULT_VERSION;
+    else
+        /* convert decimal to BCD */
+        version = ((version / 10) << 4) + (version % 10);
+
     smpp = smpp_create(conn, host, port, receive_port, system_type, 
     	    	       username, password, address_range, our_host,
                        source_addr_ton, source_addr_npi, dest_addr_ton, 
-                       dest_addr_npi, my_number);
+                       dest_addr_npi, my_number, version);
 
     conn->data = smpp;
     conn->name = octstr_format("SMPP:%S:%d/%d:%S:%S", 
--- kannel-dev/gateway/gwlib/cfg.def	2002-04-28 12:28:31.000000000 +0300
+++ gateway/gwlib/cfg.def	2002-05-20 18:19:28.000000000 +0300
@@ -209,6 +210,7 @@
     OCTSTR(dest-addr-ton)
     OCTSTR(dest-addr-npi)
     OCTSTR(transceiver-mode)
+    OCTSTR(interface-version)
 )
 
 
--- kannel-dev/gateway/doc/userguide/userguide.xml	2002-05-19 14:56:38.000000000 +0300
+++ gateway/doc/userguide/userguide.xml	2002-05-21 10:13:30.000000000 +0300
@@ -2368,6 +2368,16 @@
        Voice Mail Activation.
      </entry></row>
 
+   <row><entry><literal>interface-version</literal></entry>
+     <entry><literal>number</literal></entry>
+     <entry valign=bottom>
+       Change the "interface version" parameter sent from Kannel to
+       a value other then 0x34 (for SMPP v3.4). the value entered here
+       should be the hexadecimal representation of the interface version
+       parameter. for example, the default (if not set) is "34" which stands
+       for 0x34. for SMPP v3.3 set to "33".
+     </entry></row>
+
    <row><entry><literal>address-range (m)</literal></entry>
      <entry><literal>string</literal></entry>
      <entry valign=bottom>
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.