Migrate Gb (NS/BSSGP) code over to Ericsson NS/BSSGP modules

When we started out, Ericsson hadn't released yet their NS and BSSGP
modules.  Let's port our logic over to their encoder/decoders, as they
are more complete (but less regular / more difficult to use).

Change-Id: Icbc4f5d24f3419f99c9a4805f836bddd2849f492
diff --git a/library/NS_Emulation.ttcn b/library/NS_Emulation.ttcn
index 253c91e..5924bbe 100644
--- a/library/NS_Emulation.ttcn
+++ b/library/NS_Emulation.ttcn
@@ -1,7 +1,7 @@
 module NS_Emulation {
 	import from NS_Types all;
 	import from BSSGP_Types all;
-	import from BSSGP_Helper_Functions all;
+	import from Osmocom_Gb_Types all;
 	import from NS_CodecPort all;
 	import from NS_CodecPort_CtrlFunct all;
 	import from IPL4asp_Types all;
@@ -10,11 +10,11 @@
 		BssgpBvci	bvci,
 		Nsei		nsei,
 		octetstring	sdu optional,
-		BssgpPdu	bssgp optional
+		PDU_BSSGP	bssgp optional
 	}
 
 	template NsUnitdataRequest t_NsUdReq(template Nsei nsei, template BssgpBvci bvci, template octetstring sdu,
-					     template BssgpPdu bssgp) := {
+					     template PDU_BSSGP bssgp) := {
 		bvci := bvci,
 		nsei := nsei,
 		sdu := sdu,
@@ -25,14 +25,14 @@
 		BssgpBvci	bvci,
 		Nsei		nsei,
 		octetstring	sdu optional,
-		BssgpPdu	bssgp optional
+		PDU_BSSGP	bssgp optional
 	}
 
 	template NsUnitdataIndication t_NsUdInd(Nsei nsei, BssgpBvci bvci, octetstring sdu) := {
 		bvci := bvci,
 		nsei := nsei,
 		sdu := sdu,
-		bssgp := dec_BssgpPdu(f_BSSGP_expand_len(sdu))
+		bssgp := dec_PDU_BSSGP(sdu)
 	}
 
 	type record NsStatusIndication {
@@ -186,7 +186,7 @@
 		/* default case of handling unknown PDUs */
 		[] NSCP.receive(t_NS_RecvFrom(?)) -> value rf {
 			log("Rx Unexpected NS PDU ", rf.msg," in state ", g_state);
-			NSCP.send(t_NS_Send(g_conn_id, t_NS_STATUS(NS_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE, rf.msg)));
+			NSCP.send(t_NS_Send(g_conn_id, ts_NS_STATUS(NS_CAUSE_PDU_NOT_COMPATIBLE_WITH_PROTOCOL_STATE, rf.msg)));
 		}
 		/* Forwarding of ASP_Evet to user */
 		[] NSCP.receive(ASP_Event:?) -> value evt { NS_SP.send(evt); }
@@ -250,7 +250,9 @@
 				}
 				/* NS-UNITDATA PDU from network to NS-UNITDATA.ind to user */
 				[] NSCP.receive(t_NS_RecvFrom(t_NS_UNITDATA(?, ?, ?))) -> value rf {
-					NS_SP.send(t_NsUdInd(mp_nsei, rf.msg.u.unitdata.bvci, rf.msg.u.unitdata.sdu));
+					NS_SP.send(t_NsUdInd(mp_nsei,
+							     oct2int(rf.msg.pDU_NS_Unitdata.bVCI),
+							     rf.msg.pDU_NS_Unitdata.nS_SDU));
 				}
 				/* NS-UNITDATA.req from user to NS-UNITDATA PDU on network */
 				[] NS_SP.receive(t_NsUdReq(mp_nsei, ?, ?, omit)) -> value ud_req {
@@ -259,7 +261,7 @@
 				}
 				[] NS_SP.receive(t_NsUdReq(mp_nsei, ?, omit, ?)) -> value ud_req {
 					/* using decoded BSSGP PDU that we need to encode first */
-					var octetstring enc := f_BSSGP_compact_len(enc_BssgpPdu(ud_req.bssgp));
+					var octetstring enc := enc_PDU_BSSGP(ud_req.bssgp);
 					NSCP.send(t_NS_Send(g_conn_id, t_NS_UNITDATA(t_SduCtrlB, ud_req.bvci, enc)));
 				}
 			}