sms: Introduce a SMS queue that will be responsible for delivery

The SMSqueue will be responsible of sending to the user. It will
do so in a loop and will also try not to overload the BTS. This
means the throughput of SMS will be limited.
diff --git a/openbsc/include/openbsc/Makefile.am b/openbsc/include/openbsc/Makefile.am
index 3dffe4b..6cf8c3b 100644
--- a/openbsc/include/openbsc/Makefile.am
+++ b/openbsc/include/openbsc/Makefile.am
@@ -11,7 +11,7 @@
 		gb_proxy.h gprs_sgsn.h gsm_04_08_gprs.h sgsn.h \
 		gprs_ns_frgre.h auth.h osmo_msc.h bsc_msc.h bsc_nat.h \
 		osmo_bsc_rf.h osmo_bsc.h network_listen.h bsc_nat_sccp.h \
-		osmo_msc_data.h osmo_bsc_grace.h
+		osmo_msc_data.h osmo_bsc_grace.h sms_queue.h
 
 openbsc_HEADERS = gsm_04_08.h meas_rep.h bsc_api.h
 openbscdir = $(includedir)/openbsc
diff --git a/openbsc/include/openbsc/gsm_04_11.h b/openbsc/include/openbsc/gsm_04_11.h
index d62a392..2078778 100644
--- a/openbsc/include/openbsc/gsm_04_11.h
+++ b/openbsc/include/openbsc/gsm_04_11.h
@@ -33,5 +33,7 @@
 void _gsm411_sms_trans_free(struct gsm_trans *trans);
 int gsm411_send_sms_subscr(struct gsm_subscriber *subscr,
 			   struct gsm_sms *sms);
+int gsm411_send_sms(struct gsm_subscriber_connection *conn,
+		    struct gsm_sms *sms);
 void gsm411_sapi_n_reject(struct gsm_subscriber_connection *conn);
 #endif
diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index 5badde2..4c87f83 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -5,6 +5,7 @@
 
 struct osmo_msc_data;
 struct osmo_bsc_sccp_con;
+struct gsm_sms_queue;
 
 enum gsm_phys_chan_config {
 	GSM_PCHAN_NONE,
@@ -734,6 +735,7 @@
 
 	/* subscriber related features */
 	int keep_subscr;
+	struct gsm_sms_queue *sms_queue;
 };
 
 #define SMS_HDR_SIZE	128
diff --git a/openbsc/include/openbsc/sms_queue.h b/openbsc/include/openbsc/sms_queue.h
new file mode 100644
index 0000000..d377aca
--- /dev/null
+++ b/openbsc/include/openbsc/sms_queue.h
@@ -0,0 +1,8 @@
+#ifndef SMS_QUEUE_H
+#define SMS_QUEUE_H
+
+struct gsm_network;
+
+int sms_queue_start(struct gsm_network *, int in_flight);
+
+#endif