[PATCH] alt-dcs support for CIMD2

"Angel Fradejas" <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi all,

As promised, here's a patch to support alt-dcs config directive in cimd2
module. It also abstracts alt-dcs handling to upper layer, smscconn.c, for
the smscconn-based modules that already supported it (that is, at2, emi2,
smpp).

I tested it over 2 cimd2 providers with no problems at all.

Stipe, take a look at it, I think it can go into cvs for upcoming 1.3.2
release.

Illimar, please, test it, report, vote ;-)

Cheers!

Angel Fradejas
Mediafusión España, S.A.
[email protected]
www.mediafusion.es
Tel +34 91 252 32 00
Fax +34 91 572 27 08
cimd2_alt_dcs.diff (application/octet-stream, 6.3 KB)
? test/test_dbpool
? test/test_md5
? test/test_octstr_dump
? utils/mtbatch
Index: gw/smscconn.c
===================================================================
RCS file: /home/cvs/gateway/gw/smscconn.c,v
retrieving revision 1.36
diff -u -r1.36 smscconn.c
--- gw/smscconn.c	25 Mar 2003 10:16:10 -0000	1.36
+++ gw/smscconn.c	13 May 2003 08:35:20 -0000
@@ -64,6 +64,7 @@
     GET_OPTIONAL_VAL(conn->unified_prefix, "unified-prefix");
     GET_OPTIONAL_VAL(conn->our_host, "our-host");
     GET_OPTIONAL_VAL(conn->log_file, "log-file");
+    cfg_get_bool(&conn->alt_dcs, grp, octstr_imm("alt-dcs"));
     
     if (cfg_get_integer(&conn->log_level, grp, octstr_imm("log-level")) == -1)
         conn->log_level = 0;
Index: gw/smscconn_p.h
===================================================================
RCS file: /home/cvs/gateway/gw/smscconn_p.h,v
retrieving revision 1.36
diff -u -r1.36 smscconn_p.h
--- gw/smscconn_p.h	25 Mar 2003 10:16:10 -0000	1.36
+++ gw/smscconn_p.h	13 May 2003 08:35:20 -0000
@@ -128,6 +128,8 @@
     int log_idx;    /* index position within the global logfiles[] array in gwlib/log.c */
 
     long reconnect_delay; /* delay in seconds while re-connect attempts */
+    
+    int alt_dcs; /* use alternate DCS 0xFX */
 
 
     /* XXX: move rest global data from Smsc here
Index: gw/smsc/smsc_at2.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_at2.c,v
retrieving revision 1.16
diff -u -r1.16 smsc_at2.c
--- gw/smsc/smsc_at2.c	27 Mar 2003 08:56:42 -0000	1.16
+++ gw/smsc/smsc_at2.c	13 May 2003 08:35:21 -0000
@@ -1089,8 +1089,6 @@
     privdata->phase2plus = 0;
     privdata->validityperiod = cfg_get(cfg, octstr_imm("validityperiod"));
 
-    cfg_get_bool(&privdata->alt_dcs, cfg, octstr_imm("alt-dcs"));
-
     conn->data = privdata;
     conn->name = octstr_format("AT2[%s]", octstr_get_cstr(privdata->name));
 
@@ -1766,7 +1764,7 @@
 
     octstr_append_char(buffer, msg->sms.pid); /* protocol identifier */
     octstr_append_char(buffer, fields_to_dcs(msg, /* data coding scheme */
-	(msg->sms.alt_dcs ? 2 - msg->sms.alt_dcs : privdata->alt_dcs)));
+	(msg->sms.alt_dcs ? 2 - msg->sms.alt_dcs : privdata->conn->alt_dcs)));
 
     /* 
      * Validity-Period (TP-VP)
Index: gw/smsc/smsc_at2.h
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_at2.h,v
retrieving revision 1.3
diff -u -r1.3 smsc_at2.h
--- gw/smsc/smsc_at2.h	25 Nov 2002 16:29:27 -0000	1.3
+++ gw/smsc/smsc_at2.h	13 May 2003 08:35:21 -0000
@@ -73,7 +73,6 @@
     SMSCConn *conn;
     int phase2plus;
     Octstr *validityperiod;
-    int	alt_dcs;
     int retry;
     Octstr *my_number;
     Octstr *sms_center;
Index: gw/smsc/smsc_cimd2.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_cimd2.c,v
retrieving revision 1.10
diff -u -r1.10 smsc_cimd2.c
--- gw/smsc/smsc_cimd2.c	3 Apr 2003 12:18:18 -0000	1.10
+++ gw/smsc/smsc_cimd2.c	13 May 2003 08:35:21 -0000
@@ -1275,7 +1275,8 @@
     gw_assert(msg->type == sms);
     gw_assert(msg->sms.receiver != NULL);
 
-    dcs = fields_to_dcs(msg, 0);
+    dcs = fields_to_dcs(msg, (msg->sms.alt_dcs ? 
+        2 - msg->sms.alt_dcs : conn->alt_dcs));
     if (msg->sms.sender == NULL)
         msg->sms.sender = octstr_create("");
 
Index: gw/smsc/smsc_smpp.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_smpp.c,v
retrieving revision 1.36
diff -u -r1.36 smsc_smpp.c
--- gw/smsc/smsc_smpp.c	25 Apr 2003 11:58:57 -0000	1.36
+++ gw/smsc/smsc_smpp.c	13 May 2003 08:35:21 -0000
@@ -80,7 +80,6 @@
     int source_addr_npi; 
     int dest_addr_ton; 
     int dest_addr_npi;
-    int alt_dcs;
     int transmit_port; 
     int receive_port; 
     int quitting; 
@@ -102,7 +101,7 @@
     	    	    	 Octstr *address_range,
                          int source_addr_ton, int source_addr_npi,  
                          int dest_addr_ton, int dest_addr_npi, 
-                         int alt_dcs, int enquire_link_interval, 
+                         int enquire_link_interval, 
                          int max_pending_submits, int version, int priority,
                          Octstr *my_number, int smpp_msg_id_type, 
                          int autodetect_addr, Octstr *alt_charset, 
@@ -128,7 +127,6 @@
     smpp->source_addr_npi = source_addr_npi; 
     smpp->dest_addr_ton = dest_addr_ton; 
     smpp->dest_addr_npi = dest_addr_npi; 
-    smpp->alt_dcs = alt_dcs;
     smpp->my_number = octstr_duplicate(my_number); 
     smpp->service_type = octstr_duplicate(service_type);
     smpp->transmit_port = transmit_port; 
@@ -389,7 +387,7 @@
      * check if we have a forced value for this from the smsc-group.
      */
     pdu->u.submit_sm.data_coding = fields_to_dcs(msg, (msg->sms.alt_dcs ? 
-        2 - msg->sms.alt_dcs : smpp->alt_dcs));
+        2 - msg->sms.alt_dcs : smpp->conn->alt_dcs));
 
     /* set protocoll id */
     if(msg->sms.pid) 
@@ -1283,7 +1281,6 @@
     int ok; 
     int transceiver_mode; 
     Octstr *smsc_id; 
-    int alt_dcs;
     long enquire_link_interval;
     long max_pending_submits;
     long version;
@@ -1294,7 +1291,6 @@
  
     my_number = alt_charset = NULL; 
     transceiver_mode = 0;
-    alt_dcs = 0;
     autodetect_addr = 1;
  
     host = cfg_get(grp, octstr_imm("host")); 
@@ -1303,7 +1299,6 @@
     if (cfg_get_integer(&receive_port, grp, octstr_imm("receive-port")) == -1) 
         receive_port = 0; 
     cfg_get_bool(&transceiver_mode, grp, octstr_imm("transceiver-mode")); 
-    cfg_get_bool(&alt_dcs, grp, octstr_imm("alt-dcs")); 
     username = cfg_get(grp, octstr_imm("smsc-username")); 
     password = cfg_get(grp, octstr_imm("smsc-password")); 
     system_type = cfg_get(grp, octstr_imm("system-type")); 
@@ -1404,7 +1399,7 @@
     smpp = smpp_create(conn, host, port, receive_port, system_type,  
     	    	       username, password, address_range,
                        source_addr_ton, source_addr_npi, dest_addr_ton,  
-                       dest_addr_npi, alt_dcs, enquire_link_interval, 
+                       dest_addr_npi, enquire_link_interval, 
                        max_pending_submits, version, priority, my_number, 
                        smpp_msg_id_type, autodetect_addr, alt_charset, 
                        service_type);
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.