Index: gw/bb_smscconn.c
===================================================================
RCS file: /home/cvs/gateway/gw/bb_smscconn.c,v
retrieving revision 1.106
diff -u -b -w -r1.106 bb_smscconn.c
--- gw/bb_smscconn.c	1 Nov 2009 15:14:36 -0000	1.106
+++ gw/bb_smscconn.c	6 Nov 2009 14:06:13 -0000
@@ -102,9 +102,11 @@
 
 extern Counter *incoming_sms_counter;
 extern Counter *outgoing_sms_counter;
+extern Counter *incoming_dlr_counter;
 
 extern Load *outgoing_sms_load;
 extern Load *incoming_sms_load;
+extern Load *incoming_dlr_load;
 
 extern List *flow_threads;
 extern List *suspended;
@@ -495,14 +497,17 @@
         return (rc == -1 ? SMSCCONN_FAILED_QFULL : rc);
     }
 
-    if (sms->sms.sms_type != report_mo)
+    if (sms->sms.sms_type != report_mo) {
 	bb_alog_sms(conn, sms, "Receive SMS");
-    else
-	bb_alog_sms(conn, sms, "Receive DLR");
-
     counter_increase(incoming_sms_counter);
     load_increase(incoming_sms_load);
     if (conn != NULL) counter_increase(conn->received);
+    } else {
+	bb_alog_sms(conn, sms, "Receive DLR");
+        counter_increase(incoming_dlr_counter);
+        load_increase(incoming_dlr_load);
+        if (conn != NULL) counter_increase(conn->dlr);
+    }
 
     msg_destroy(sms);
 
@@ -1133,14 +1138,14 @@
 	
         if (status_type == BBSTATUS_XML)
             octstr_format_append(tmp, "<status>%s</status>\n\t\t<received>%ld</received>"
-                "\n\t\t<sent>%ld</sent>\n\t\t<failed>%ld</failed>\n\t\t"
+                "\n\t\t<dlr>%ld</dlr>\n\t\t<sent>%ld</sent>\n\t\t<failed>%ld</failed>\n\t\t"
                 "<queued>%ld</queued>\n\t</smsc>\n", tmp3,
-                info.received, info.sent, info.failed,
+                info.received, info.dlr, info.sent, info.failed,
                 info.queued);
         else
-            octstr_format_append(tmp, " (%s, rcvd %ld, sent %ld, failed %ld, "
+            octstr_format_append(tmp, " (%s, rcvd %ld, dlr %ld, sent %ld, failed %ld, "
                 "queued %ld msgs)%s", tmp3,
-            info.received, info.sent, info.failed,
+            info.received, info.dlr, info.sent, info.failed,
             info.queued, lb);
     }
     gw_rwlock_unlock(&smsc_list_lock);
Index: gw/bearerbox.c
===================================================================
RCS file: /home/cvs/gateway/gw/bearerbox.c,v
retrieving revision 1.172
diff -u -b -w -r1.172 bearerbox.c
--- gw/bearerbox.c	1 Sep 2009 21:45:44 -0000	1.172
+++ gw/bearerbox.c	6 Nov 2009 14:06:14 -0000
@@ -89,6 +89,7 @@
 
 Counter *incoming_sms_counter;
 Counter *outgoing_sms_counter;
+Counter *incoming_dlr_counter;
 Counter *incoming_wdp_counter;
 Counter *outgoing_wdp_counter;
 
@@ -99,6 +100,7 @@
 
 Load *outgoing_sms_load;
 Load *incoming_sms_load;
+Load *incoming_dlr_load;
 
 
 /* this is not a list of items; instead it is used as
@@ -457,6 +459,7 @@
 
     outgoing_sms_counter = counter_create();
     incoming_sms_counter = counter_create();
+    incoming_dlr_counter = counter_create();
     outgoing_wdp_counter = counter_create();
     incoming_wdp_counter = counter_create();
 
@@ -472,6 +475,11 @@
     load_add_interval(incoming_sms_load, 60);
     load_add_interval(incoming_sms_load, 300);
     load_add_interval(incoming_sms_load, -1);
+    incoming_dlr_load = load_create();
+    /* add 60,300,-1 entries to dlr */
+    load_add_interval(incoming_dlr_load, 60);
+    load_add_interval(incoming_dlr_load, 300);
+    load_add_interval(incoming_dlr_load, -1);
 
     setup_signal_handlers();
     
@@ -556,8 +564,9 @@
         debug("bb", 0, "Remaining SMS: %ld incoming, %ld outgoing",
               gwlist_len(incoming_sms), gwlist_len(outgoing_sms));
 
-    info(0, "Total SMS messages: received %ld, sent %ld",
+    info(0, "Total SMS messages: received %ld, dlr %ld, sent %ld",
          counter_value(incoming_sms_counter),
+         counter_value(incoming_dlr_counter),
          counter_value(outgoing_sms_counter));
 #endif
 
@@ -565,9 +574,11 @@
     gwlist_destroy(outgoing_sms, msg_destroy_item);
     
     counter_destroy(incoming_sms_counter);
+    counter_destroy(incoming_dlr_counter);
     counter_destroy(outgoing_sms_counter);
 
     load_destroy(incoming_sms_load);
+    load_destroy(incoming_dlr_load);
     load_destroy(outgoing_sms_load);
 }
 
@@ -875,9 +886,11 @@
                " <p>Status: %s, uptime %ldd %ldh %ldm %lds</p>\n\n"
                " <p>WDP: received %ld (%ld queued), sent %ld "
                "(%ld queued)</p>\n\n"
-               " <p>SMS: received %ld (%ld queued), sent %ld "
+               " <p>SMS: received %ld (%ld queued), dlr %ld, sent %ld "
                "(%ld queued), store size %ld</p>\n"
-               " <p>SMS: inbound (%.2f,%.2f,%.2f) msg/sec, outbound (%.2f,%.2f,%.2f) msg/sec</p>\n\n"
+               " <p>SMS: inbound (%.2f,%.2f,%.2f) msg/sec, "
+               "dlr (%.2f,%.2f,%.2f) msg/sec, "
+               "outbound (%.2f,%.2f,%.2f) msg/sec</p>\n\n"
                " <p>DLR: %ld queued, using %s storage</p>\n\n";
         footer = "<p>";
     } else if (status_type == BBSTATUS_WML) {
@@ -885,10 +898,11 @@
                "   <p>Status: %s, uptime %ldd %ldh %ldm %lds</p>\n\n"
                "   <p>WDP: received %ld (%ld queued)<br/>\n"
                "      WDP: sent %ld (%ld queued)</p>\n\n"
-               "   <p>SMS: received %ld (%ld queued)<br/>\n"
+               "   <p>SMS: received %ld (%ld queued), dlr %ld<br/>\n"
                "      SMS: sent %ld (%ld queued)<br/>\n"
                "      SMS: store size %ld<br/>\n"
                "      SMS: inbound (%.2f,%.2f,%.2f) msg/sec<br/>\n"
+               "      SMS: dlr (%.2f,%.2f,%.2f) msg/sec<br/>\n"
                "      SMS: outbound (%.2f,%.2f,%.2f) msg/sec</p>\n\n"
                "   <p>DLR: %ld queued<br/>\n"
                "      DLR: using %s storage</p>\n\n";
@@ -899,17 +913,19 @@
                "\t<wdp>\n\t\t<received><total>%ld</total><queued>%ld</queued>"
                "</received>\n\t\t<sent><total>%ld</total><queued>%ld</queued>"
                "</sent>\n\t</wdp>\n"
-               "\t<sms>\n\t\t<received><total>%ld</total><queued>%ld</queued>"
+               "\t<sms>\n\t\t<received><total>%ld</total><queued>%ld</queued><dlr>%ld</dlr>"
                "</received>\n\t\t<sent><total>%ld</total><queued>%ld</queued>"
                "</sent>\n\t\t<storesize>%ld</storesize>\n\t\t"
-               "<inbound>%.2f,%.2f,%.2f</inbound>\n\t\t<outbound>%.2f,%.2f,%.2f</outbound>\n\t</sms>\n"
+               "<inbound>%.2f,%.2f,%.2f</inbound>\n\t\t"
+               "<dlr>%.2f,%.2f,%.2f</dlr>\n\t\t"
+               "<outbound>%.2f,%.2f,%.2f</outbound>\n\t</sms>\n"
                "\t<dlr>\n\t\t<queued>%ld</queued>\n\t\t<storage>%s</storage>\n\t</dlr>\n";
         footer = "";
     } else {
         frmt = "%s\n\nStatus: %s, uptime %ldd %ldh %ldm %lds\n\n"
                "WDP: received %ld (%ld queued), sent %ld (%ld queued)\n\n"
-               "SMS: received %ld (%ld queued), sent %ld (%ld queued), store size %ld\n"
-               "SMS: inbound (%.2f,%.2f,%.2f) msg/sec, outbound (%.2f,%.2f,%.2f) msg/sec\n\n"
+               "SMS: received %ld (%ld queued), dlr %ld, sent %ld (%ld queued), store size %ld\n"
+               "SMS: inbound (%.2f,%.2f,%.2f) msg/sec, dlr (%.2f,%.2f,%.2f) msg/sec, outbound (%.2f,%.2f,%.2f) msg/sec\n\n"
                "DLR: %ld queued, using %s storage\n\n";
         footer = "";
     }
@@ -920,10 +936,11 @@
         counter_value(incoming_wdp_counter),
         gwlist_len(incoming_wdp) + boxc_incoming_wdp_queue(),
         counter_value(outgoing_wdp_counter), gwlist_len(outgoing_wdp) + udp_outgoing_queue(),
-        counter_value(incoming_sms_counter), gwlist_len(incoming_sms),
+        counter_value(incoming_sms_counter), gwlist_len(incoming_sms), counter_value(incoming_dlr_counter),
         counter_value(outgoing_sms_counter), gwlist_len(outgoing_sms),
         store_messages(),
         load_get(incoming_sms_load,0), load_get(incoming_sms_load,1), load_get(incoming_sms_load,2),
+        load_get(incoming_dlr_load,0), load_get(incoming_dlr_load,1), load_get(incoming_dlr_load,2),
         load_get(outgoing_sms_load,0), load_get(outgoing_sms_load,1), load_get(outgoing_sms_load,2),
         dlr_messages(), dlr_type());
 
Index: gw/smscconn.c
===================================================================
RCS file: /home/cvs/gateway/gw/smscconn.c,v
retrieving revision 1.61
diff -u -b -w -r1.61 smscconn.c
--- gw/smscconn.c	17 Sep 2009 21:53:55 -0000	1.61
+++ gw/smscconn.c	6 Nov 2009 14:06:16 -0000
@@ -170,6 +170,7 @@
     conn->is_stopped = start_as_stopped;
 
     conn->received = counter_create();
+    conn->dlr = counter_create();
     conn->sent = counter_create();
     conn->failed = counter_create();
     conn->flow_mutex = mutex_create();
@@ -334,6 +335,7 @@
     mutex_lock(conn->flow_mutex);
 
     counter_destroy(conn->received);
+    counter_destroy(conn->dlr);
     counter_destroy(conn->sent);
     counter_destroy(conn->failed);
 
@@ -599,6 +601,7 @@
     
     infotable->sent = counter_value(conn->sent);
     infotable->received = counter_value(conn->received);
+    infotable->dlr = counter_value(conn->dlr);
     infotable->failed = counter_value(conn->failed);
 
     if (conn->queued)
Index: gw/smscconn.h
===================================================================
RCS file: /home/cvs/gateway/gw/smscconn.h,v
retrieving revision 1.21
diff -u -b -w -r1.21 smscconn.h
--- gw/smscconn.h	6 May 2009 18:47:34 -0000	1.21
+++ gw/smscconn.h	6 Nov 2009 14:06:16 -0000
@@ -114,6 +114,7 @@
     smscconn_killed_t killed;	/* if we are killed, why */
     int is_stopped;	/* is connection currently in stopped state? */
     unsigned long received;	/* total number */
+    unsigned long dlr;          /* total number */
     unsigned long sent;		/* total number */
     unsigned long failed;	/* total number */
     long queued;	/* set our internal outgoing queue length */
Index: gw/smscconn_p.h
===================================================================
RCS file: /home/cvs/gateway/gw/smscconn_p.h,v
retrieving revision 1.55
diff -u -b -w -r1.55 smscconn_p.h
--- gw/smscconn_p.h	17 Sep 2009 21:53:55 -0000	1.55
+++ gw/smscconn_p.h	6 Nov 2009 14:06:17 -0000
@@ -159,6 +159,7 @@
     /* connection specific counters (created in smscconn.c, updated
      *  by callback functions in bb_smscconn.c, NOT used by specific driver) */
     Counter *received;
+    Counter *dlr;
     Counter *sent;
     Counter *failed;
 
