BSSGP_Emulation: Abandon "BssgpDecoded" intermediate structure

It originally seemed like a great idea to define a custom record
which aggregates the decoded BSSGP, LLC, L3 and/or SNDCP and passes
it to the individual ConnHdlr.  However, particularly with testcase
interoperability for IuPS in mind, this seems bogus.  Also, we
never really took advantage of this.

Let's now decode as far as we can decode any PDU, and then send the
decoded version of that PDU via the ports between the BSSGP_Emulation
and the ConnHdlr component.

Change-Id: I8c1082880902dd9a04935945f0293895f4d0c53a
diff --git a/library/BSSGP_Emulation.ttcn b/library/BSSGP_Emulation.ttcn
index 5b5628e..f8b9f06 100644
--- a/library/BSSGP_Emulation.ttcn
+++ b/library/BSSGP_Emulation.ttcn
@@ -53,7 +53,9 @@
 		PDU_LLC,
 		PDU_L3_MS_SGSN,
 		PDU_L3_SGSN_MS;
-	out	BssgpDecoded,
+	out	PDU_BSSGP,
+		PDU_LLC,
+		PDU_SN,
 		NsStatusIndication,
 		BssgpStatusIndication,
 		ASP_Event,
@@ -66,7 +68,9 @@
 	in	ASP_Event,
 		NsStatusIndication,
 		BssgpStatusIndication,
-		BssgpDecoded,
+		PDU_BSSGP,
+		PDU_LLC,
+		PDU_SN,
 		PDU_L3_MS_SGSN,
 		PDU_L3_SGSN_MS;
 	out	PDU_BSSGP,
@@ -492,6 +496,21 @@
 	}
 }
 
+private function f_send_bssgp_dec(BssgpDecoded dec, BSSGP_Client_CT vc_conn, BSSGP_SP_PT pt := BSSGP_SP) runs on BSSGP_CT {
+	if (ispresent(dec.l3_mt)) {
+		pt.send(dec.l3_mt) to vc_conn;
+	} else if (ispresent(dec.l3_mo)) {
+		pt.send(dec.l3_mo) to vc_conn;
+	} else if (ispresent(dec.sndcp)) {
+		pt.send(dec.sndcp) to vc_conn;
+	} else if (ispresent(dec.llc)) {
+		pt.send(dec.llc) to vc_conn;
+	} else {
+		pt.send(dec.bssgp) to vc_conn;
+	}
+}
+
+
 altstep as_unblocked() runs on BSSGP_CT {
 	var BSSGP_Client_CT vc_conn;
 	var NsUnitdataIndication udi;
@@ -539,7 +558,7 @@
 	[] BSCP.receive(f_BnsUdInd(tr_BSSGP_PS_PAGING(g_cfg.bvci), g_cfg.bvci)) -> value udi {
 		var hexstring imsi := udi.bssgp.pDU_BSSGP_PAGING_PS.iMSI.digits
 		vc_conn := f_tbl_comp_by_imsi(imsi);
-		BSSGP_SP.send(f_dec_bssgp(udi.bssgp)) to vc_conn;
+		f_send_bssgp_dec(f_dec_bssgp(udi.bssgp), vc_conn);
 	}
 
 	/* Any other PTP BSSGP message: If it has TLLi, route to component; otherwise broadcast */
@@ -548,14 +567,14 @@
 		var template OCT4 tlli := f_bssgp_get_tlli(udi.bssgp);
 		if (isvalue(tlli)) {
 			vc_conn := f_tbl_comp_by_tlli(valueof(tlli));
-			BSSGP_SP.send(dec) to vc_conn;
+			f_send_bssgp_dec(dec, vc_conn);
 		} else {
 			log("No TLLI: Broadcasting ", dec);
 			/* broadcast this message to all components */
 			// TITAN DOESN'T DO THIS, *SIGH*: "BSSGP_SP.send(dec) to all component;"
 			for (var integer i := 0; i < sizeof(ClientTable); i := i+1) {
 				if (isbound(ClientTable[i].comp_ref)) {
-					BSSGP_SP.send(dec) to ClientTable[i].comp_ref;
+					f_send_bssgp_dec(dec, ClientTable[i].comp_ref);
 				}
 			}
 		}
@@ -567,14 +586,14 @@
 		var template OCT4 tlli := f_bssgp_get_tlli(udi.bssgp);
 		if (isvalue(tlli)) {
 			vc_conn := f_tbl_comp_by_tlli(valueof(tlli));
-			BSSGP_SP_SIG.send(dec) to vc_conn;
+			f_send_bssgp_dec(dec, vc_conn, BSSGP_SP_SIG);
 		} else {
 			log("No TLLI: Broadcasting ", dec);
 			/* broadcast this message to all components */
 			// TITAN DOESN'T DO THIS, *SIGH*: "BSSGP_SP.send(dec) to all component;"
 			for (var integer i := 0; i < sizeof(ClientTable); i := i+1) {
 				if (isbound(ClientTable[i].comp_ref)) {
-					BSSGP_SP_SIG.send(dec) to ClientTable[i].comp_ref;
+					f_send_bssgp_dec(dec, vc_conn, BSSGP_SP_SIG);
 				}
 			}
 		}
@@ -731,47 +750,5 @@
 	}
 }
 
-template BssgpDecoded tr_BD_BSSGP(template PDU_BSSGP bg) := {
-	bssgp := bg,
-	llc := *,
-	l3_mo := *,
-	l3_mt := *,
-	sndcp := *
-}
-
-template BssgpDecoded tr_BD_LLC(template PDU_LLC llc) := {
-	bssgp := ?,
-	llc := llc,
-	l3_mo := *,
-	l3_mt := *,
-	sndcp := *
-}
-
-template BssgpDecoded tr_BD_L3_MT(template PDU_L3_SGSN_MS mt) := {
-	bssgp := ?,
-	llc := ?,
-	l3_mo := omit,
-	l3_mt := mt,
-	sndcp := omit
-}
-
-template BssgpDecoded tr_BD_L3_MO(template PDU_L3_MS_SGSN mo) := {
-	bssgp := ?,
-	llc := ?,
-	l3_mo := mo,
-	l3_mt := omit,
-	sndcp := omit
-}
-
-template BssgpDecoded tr_BD_SNDCP(template BIT4 sapi, template PDU_SN sn) := {
-	bssgp := ?,
-	llc := tr_LLC_UI(?, sapi),
-	l3_mo := omit,
-	l3_mt := omit,
-	sndcp := sn
-}
-
-
-
 
 }