bsc: Start MGCP_Emulation and extend MSC_ConnectionHandler for MGCP

forward-ported by Harald Welte

Change-Id: I1f316a9ed5859670348ea7aa352604020d6b09f5
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index d1be0ef..3dbb782 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -10,6 +10,7 @@
 
 import from MGCP_Types all;
 import from MGCP_Templates all;
+import from MGCP_Emulation all;
 import from SDP_Types all;
 
 import from RSL_Emulation all;
@@ -24,7 +25,7 @@
 /* this component represents a single subscriber connection at the MSC.
  * There is a 1:1 mapping between SCCP connections and BSSAP_ConnHdlr components.
  * We inherit all component variables, ports, functions, ... from BSSAP_ConnHdlr */
-type component MSC_ConnHdlr extends BSSAP_ConnHdlr, RSL_DchanHdlr {
+type component MSC_ConnHdlr extends BSSAP_ConnHdlr, RSL_DchanHdlr, MGCP_ConnHdlr {
 	/* SCCP Connecction Identifier for the underlying SCCP connection */
 	var integer g_sccp_conn_id;
 
@@ -55,6 +56,10 @@
 	role_ms := false
 }
 
+const MGCPOps MSC_MGCPOps := {
+	create_cb := refers(MGCP_Emulation.ExpectedCreateCallback)
+}
+
 type enumerated MSC_State {
 	MSC_STATE_NONE,
 	MSC_STATE_WAIT_ASS_COMPL,
@@ -65,7 +70,7 @@
 }
 
 /* register an expect with the BSSMAP core */
-private function f_create_exp(octetstring l3_enc) runs on MSC_ConnHdlr {
+private function f_create_bssmap_exp(octetstring l3_enc) runs on MSC_ConnHdlr {
 	BSSMAPEM.call(BSSMAPEM_register:{l3_enc, self}) {
 		[] BSSMAPEM.getreply(BSSMAPEM_register:{?, ?}) {};
 	}
@@ -92,7 +97,7 @@
 
 	/* call helper function for CHAN_RQD -> IMM ASS ->EST_IND */
 	RSL_Emulation.f_chan_est(pars.ra, l3_enc, pars.link_id, pars.fn);
-	f_create_exp(l3_enc);
+	f_create_bssmap_exp(l3_enc);
 }
 
 function f_rsl_reply(template PDU_ML3_MS_NW l3, RSL_Message orig) runs on MSC_ConnHdlr {
@@ -184,10 +189,14 @@
 		crcx_seen := true;
 		repeat;
 		}
+	/* mgw CRCX goes here */
+
 	[crcx_seen] RSL.receive(tr_RSL_IPA_MDCX(g_chan_nr, ?)) -> value rsl{
 		RSL.send(ts_RSL_IPA_MDCX_ACK(g_chan_nr, 1, 1, 1, 1));
 		repeat;
 		}
+	/* mgw MGCX goes here */
+
 	[exp_compl] BSSAP.receive(tr_BSSMAP_AssignmentComplete) {
 		setverdict(fail, "Received non-matching ASSIGNMENT COMPLETE");
 		}