sms: Provide some simple vty command for the state of the SMS queue
diff --git a/openbsc/include/openbsc/sms_queue.h b/openbsc/include/openbsc/sms_queue.h
index d048566..5bfa4b4 100644
--- a/openbsc/include/openbsc/sms_queue.h
+++ b/openbsc/include/openbsc/sms_queue.h
@@ -3,8 +3,12 @@
 
 struct gsm_network;
 struct gsm_sms_queue;
+struct vty;
 
 int sms_queue_start(struct gsm_network *, int in_flight);
 int sms_queue_trigger(struct gsm_sms_queue *);
 
+/* vty helper functions */
+int sms_queue_stats(struct gsm_sms_queue *, struct vty* vty);
+
 #endif
diff --git a/openbsc/src/sms_queue.c b/openbsc/src/sms_queue.c
index f6d09cf..ee43987 100644
--- a/openbsc/src/sms_queue.c
+++ b/openbsc/src/sms_queue.c
@@ -40,6 +40,8 @@
 
 #include <osmocore/talloc.h>
 
+#include <osmocom/vty/vty.h>
+
 /*
  * One pending SMS that we wait for.
  */
@@ -391,3 +393,17 @@
 
 	return 0;
 }
+
+/* VTY helper functions */
+int sms_queue_stats(struct gsm_sms_queue *smsq, struct vty *vty)
+{
+	struct gsm_sms_pending *pending;
+
+	vty_out(vty, "SMSqueue with max_pending: %d pending: %d%s",
+		smsq->max_pending, smsq->pending, VTY_NEWLINE);
+
+	llist_for_each_entry(pending, &smsq->pending_sms, entry)
+		vty_out(vty, " SMS Pending for Subscriber: %llu%s\n",
+			pending->subscr->id, VTY_NEWLINE);
+	return 0;
+}
diff --git a/openbsc/src/vty_interface_layer3.c b/openbsc/src/vty_interface_layer3.c
index f1e5371..f9dd586 100644
--- a/openbsc/src/vty_interface_layer3.c
+++ b/openbsc/src/vty_interface_layer3.c
@@ -46,6 +46,7 @@
 #include <openbsc/vty.h>
 #include <openbsc/gsm_04_80.h>
 #include <openbsc/chan_alloc.h>
+#include <openbsc/sms_queue.h>
 
 extern struct gsm_network *gsmnet_from_vty(struct vty *v);
 
@@ -633,6 +634,17 @@
 	return CMD_SUCCESS;
 }
 
+DEFUN(show_smsqueue,
+      show_smsqueue_cmd,
+      "show sms-queue",
+      SHOW_STR "Display SMSqueue statistics\n")
+{
+	struct gsm_network *net = gsmnet_from_vty(vty);
+
+	sms_queue_stats(net->sms_queue, vty);
+	return CMD_SUCCESS;
+}
+
 
 int bsc_vty_init_extra(void)
 {
@@ -650,6 +662,7 @@
 	install_element_ve(&subscriber_ussd_notify_cmd);
 	install_element_ve(&subscriber_update_cmd);
 	install_element_ve(&show_stats_cmd);
+	install_element_ve(&show_smsqueue_cmd);
 
 	install_element(ENABLE_NODE, &ena_subscr_name_cmd);
 	install_element(ENABLE_NODE, &ena_subscr_extension_cmd);