msc/USSD: introduce common GSUP/DTAP matching functions

In order to avoid code duplication in the upcoming test cases,
let's introduce a few functions which basically do a GSUP/DTAP
message matching within the alternative statement.

Change-Id: I846c2d40a7c37afa8647e644673b4df905e3e116
diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index 4a6b822..640940d 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -2141,6 +2141,48 @@
  * USSD Testing
  ***********************************************************************/
 
+private altstep as_unexp_gsup_or_bssap_msg()
+runs on BSC_ConnHdlr {
+	[] GSUP.receive {
+		setverdict(fail, "Unknown/unexpected GSUP received");
+		self.stop;
+		}
+	[] BSSAP.receive {
+		setverdict(fail, "Unknown/unexpected BSSAP message received");
+		self.stop;
+		}
+}
+
+private function f_expect_gsup_msg(template GSUP_PDU msg)
+runs on BSC_ConnHdlr return GSUP_PDU {
+	var GSUP_PDU gsup_msg_complete;
+
+	alt {
+	[] GSUP.receive(msg) -> value gsup_msg_complete {
+		setverdict(pass);
+		}
+	/* We don't expect anything else */
+	[] as_unexp_gsup_or_bssap_msg();
+	}
+
+	return gsup_msg_complete;
+}
+
+private function f_expect_mt_dtap_msg(template PDU_ML3_NW_MS msg)
+runs on BSC_ConnHdlr return PDU_ML3_NW_MS {
+	var PDU_DTAP_MT bssap_msg_complete;
+
+	alt {
+	[] BSSAP.receive(tr_PDU_DTAP_MT(msg)) -> value bssap_msg_complete {
+		setverdict(pass);
+		}
+	/* We don't expect anything else */
+	[] as_unexp_gsup_or_bssap_msg();
+	}
+
+	return bssap_msg_complete.dtap;
+}
+
 /* LU followed by MO USSD request */
 private function f_tc_lu_and_mo_ussd_single_request(charstring id, BSC_ConnHdlrPars pars)
 runs on BSC_ConnHdlr {