BSC_ConnectionHandler.ttcn: split up f_mo_sms() into two functions

This would allow to submit an SMS message using f_mo_sms_submit()
and wait for RP-ACK using f_mo_sms_wait_rp_ack() separately in the
follow-up changes for SMS over GSUP.

Change-Id: I5b35206286ae8add8b5bd34b0ab41ba7862c28e4
diff --git a/msc/BSC_ConnectionHandler.ttcn b/msc/BSC_ConnectionHandler.ttcn
index bf7a6d2..17d9591 100644
--- a/msc/BSC_ConnectionHandler.ttcn
+++ b/msc/BSC_ConnectionHandler.ttcn
@@ -806,17 +806,13 @@
 	}
 }
 
-/* Submit a MO-SMS over an already existing (and authenticated, ...) DTAP connection */
-function f_mo_sms(inout SmsParameters spars)
+/* Submit a MO-SMS over an already existing DTAP connection */
+function f_mo_sms_submit(inout SmsParameters spars)
 runs on BSC_ConnHdlr {
 	var template (value) TPDU_RP_DATA_MS_SGSN tp_mo;
 	var template (value) RPDU_MS_SGSN rp_mo;
 	var template (value) PDU_ML3_MS_NW l3_mo;
 
-	var template TPDU_RP_DATA_SGSN_MS tp_mt;
-	var template RPDU_SGSN_MS rp_mt;
-	var template PDU_ML3_NW_MS l3_mt;
-
 	var default d := activate(as_other_sms());
 
 	/* just in case this is routed to SMPP.. */
@@ -830,6 +826,24 @@
 	/* receive CP-ACK for CP-DATA above */
 	BSSAP.receive(tr_PDU_DTAP_MT(tr_ML3_MT_SMS(spars.tid, c_TIF_REPL, tr_CP_ACK_MT), spars.dlci));
 
+	deactivate(d);
+	setverdict(pass);
+}
+
+/* Wait RP-ACK for MO-SMS on an already existing DTAP connection */
+function f_mo_sms_wait_rp_ack(inout SmsParameters spars)
+runs on BSC_ConnHdlr {
+	var template (value) PDU_ML3_MS_NW l3_mo;
+
+	var template TPDU_RP_DATA_SGSN_MS tp_mt;
+	var template RPDU_SGSN_MS rp_mt;
+	var template PDU_ML3_NW_MS l3_mt;
+
+	var default d := activate(as_other_sms());
+
+	/* just in case this is routed to SMPP.. */
+	f_create_smpp_expect(hex2str(spars.tp.da.tP_DA_NoPad.tP_DAValue));
+
 	if (ispresent(spars.exp_rp_err)) {
 		/* expect an RP-ERROR message from MSC with given cause */
 		rp_mt := tr_RP_ERROR_MT(spars.rp.msg_ref, spars.exp_rp_err);
@@ -847,10 +861,19 @@
 		l3_mo := ts_ML3_MO_SMS(spars.tid, c_TIF_ORIG, ts_CP_ACK_MO);
 		BSSAP.send(ts_PDU_DTAP_MO(l3_mo, spars.dlci, true));
 	}
+
 	deactivate(d);
 	setverdict(pass);
 }
 
+/* Submit a MO-SMS, and wait for RP-ACK on an existing
+ * (and authenticated, ...) DTAP connection */
+function f_mo_sms(inout SmsParameters spars)
+runs on BSC_ConnHdlr {
+	f_mo_sms_submit(spars);
+	f_mo_sms_wait_rp_ack(spars);
+}
+
 /* receive MT-SMS delivered from the MSC/SMSC over an already existing DTAP connection */
 function f_mt_sms(inout SmsParameters spars)
 runs on BSC_ConnHdlr {