bsc: Add Lb interface support

This introduces the Lb interface stack, which allows BSC_Tests.ttcn
to emulate a SMLC towards the BSC.

In accordance with https://osmocom.org/projects/cellular-infrastructure/wiki/Point_Codes
we use 0.23.6 as point code for emulating the SMLC.

Change-Id: Id41246f0dd812f7ddee9d920bfd07a4e3aac3504
diff --git a/bsc/MSC_ConnectionHandler.ttcn b/bsc/MSC_ConnectionHandler.ttcn
index 3d6538a..3e58f5a 100644
--- a/bsc/MSC_ConnectionHandler.ttcn
+++ b/bsc/MSC_ConnectionHandler.ttcn
@@ -19,6 +19,9 @@
 import from SCCPasp_Types all;
 import from BSSAP_Types all;
 import from RAN_Emulation all;
+import from BSSAP_LE_Emulation all;
+import from BSSAP_LE_Types all;
+import from BSSMAP_LE_Templates all;
 import from BSSMAP_Templates all;
 
 import from IPL4asp_Types all;
@@ -430,7 +433,7 @@
 /* this component represents a single subscriber connection at the MSC.
  * There is a 1:1 mapping between SCCP connections and RAN_ConnHdlr components.
  * We inherit all component variables, ports, functions, ... from RAN_ConnHdlr */
-type component MSC_ConnHdlr extends RAN_ConnHdlr, RSL_DchanHdlr, MGCP_ConnHdlr, StatsD_ConnHdlr {
+type component MSC_ConnHdlr extends RAN_ConnHdlr, RSL_DchanHdlr, MGCP_ConnHdlr, BSSAP_LE_ConnHdlr, StatsD_ConnHdlr {
 	/* SCCP Connecction Identifier for the underlying SCCP connection */
 	var integer g_sccp_conn_id;
 
@@ -491,6 +494,20 @@
 	return resp;
 }
 
+/* Callback function from general BSSAP_LE_Emulation whenever a connectionless
+ * BSSAP_LE message arrives.  Can return a PDU_BSSAP_LE that should be sent in return */
+private function BSSAP_LE_UnitdataCallback(PDU_BSSAP_LE bssap)
+runs on BSSAP_LE_Emulation_CT return template PDU_BSSAP_LE {
+	var template PDU_BSSAP_LE resp := omit;
+
+	/* answer all RESET with a RESET ACK */
+	if (match(bssap, tr_BSSMAP_LE_Reset)) {
+		resp := ts_BSSMAP_LE_ResetAck;
+	}
+
+	return resp;
+}
+
 const RanOps MSC_RanOps := {
 	create_cb := refers(RAN_Emulation.ExpectedCreateCallback),
 	unitdata_cb := refers(UnitdataCallback),
@@ -503,6 +520,15 @@
 	sccp_addr_peer := omit
 }
 
+const BssapLeOps SMLC_BssapLeOps := {
+	create_cb := refers(BSSAP_LE_Emulation.ExpectedCreateCallback),
+	unitdata_cb := refers(BSSAP_LE_UnitdataCallback),
+	decode_dtap := false,
+	role_ms := false,
+	sccp_addr_local := omit,
+	sccp_addr_peer := omit
+}
+
 const MGCPOps MSC_MGCPOps := {
 	create_cb := refers(MGCP_Emulation.ExpectedCreateCallback),
 	unitdata_cb := refers(MGCP_Emulation.DummyUnitdataCallback)