patch smsc_smpp.c unbind notification

Ignat Vassilev <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi all
here is a patch for  UNBIND operation


Regards
Ignat
unbind.diff (text/plain, 2.3 KB)
Index: gw/smpp_pdu.def
===================================================================
RCS file: /home/cvs/gateway/gw/smpp_pdu.def,v
retrieving revision 1.4
diff -b -u -r1.4 smpp_pdu.def
--- gw/smpp_pdu.def	Wed Apr 24 08:09:34 2002 -0000      1.4
+++ gw/smpp_pdu.def	Tue Jun 25 11:40:29 2002 -0000
@@ -179,6 +179,10 @@
     HEADER
 )

+PDU(generic_nack_resp,
+    0x80000000,
+    HEADER
+)

 #undef PDU
 #undef INTEGER
Index: gw/smsc_smpp.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc_smpp.c,v
retrieving revision 1.71
diff -b -u -r1.71 smsc_smpp.c
--- gw/smsc_smpp.c	Fri Jun 21 22:17:13 2002 -0000      1.71
+++ gw/smsc_smpp.c	Tue Jun 25 11:25:35 2002 -0000
@@ -384,6 +384,20 @@
 } 
  
  
+static void send_unbind(SMPP *smpp, Connection *conn)
+{
+    SMPP_PDU *pdu;
+    Octstr *os;
+    pdu = smpp_pdu_create(unbind,
+		    counter_increase(smpp->message_id_counter));
+    dump_pdu("Sending unbind:", smpp->conn->id, pdu);
+    os = smpp_pdu_pack(pdu);
+    conn_write(conn, os);
+    octstr_destroy(os);
+    smpp_pdu_destroy(pdu);
+}
+
+
 static int send_pdu(Connection *conn, Octstr *id, SMPP_PDU *pdu) 
 { 
     Octstr *os; 
@@ -787,6 +801,20 @@
             } 
             break; 
  
+	case generic_nack_resp:
+	    {
+		    error(0, "SMPP: NACK PDU type 0x%08lx, "
+				    "code 0x%08lx.",
+				    pdu->type, pdu->u.generic_nack_resp.command_status);
+	    }
+	    break;
+
+	case unbind:
+	    break;	    
+ 
+	case unbind_resp:	
+	    break;
+
         default: 
             error(0, "SMPP[%s]: Unknown PDU type 0x%08lx, ignored.",
                   octstr_get_cstr(smpp->conn->id), pdu->type); 
@@ -864,6 +892,21 @@
         for (;;) { 
             timeout = last_enquire_sent + smpp->enquire_link_interval
                         - date_universal_now(); 
+   
+       /*UNBIND*/
+	    if (smpp->quitting) {
+		    send_unbind(smpp, conn);
+		    while ((ret = read_pdu(smpp, conn, &len, &pdu)) == 1) {
+			    dump_pdu("Got PDU:", smpp->conn->id, pdu);
+			    handle_pdu(smpp, conn, pdu, &pending_submits);
+			    smpp_pdu_destroy(pdu);
+		    }
+
+		    debug("bb.sms.smpp", 0, "SMPP: %s: break and shutting down",
+__PRETTY_FUNCTION__);
+	    }
+       /*END UNBIND*/
+	    
             if (smpp->quitting || conn_wait(conn, timeout) == -1) 
                 break;
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.