Add hand-written encoder/decoder for RLC/MAC UL/DL data blocks

Their format is simply too complex to be used with the automatic RAW
encoder/decoder.  Let's implement it by hand, using the automatic
coder whenever possible.
diff --git a/library/RLCMAC_Types.ttcn b/library/RLCMAC_Types.ttcn
index f73721c..6cd6e49 100644
--- a/library/RLCMAC_Types.ttcn
+++ b/library/RLCMAC_Types.ttcn
@@ -104,66 +104,74 @@
 		with { extension "prototype(convert) decode(RAW)" };
 
 	/* a single RLC block / LLC-segment */
-
-	type record RlcBlockHdr {
+	type record LlcBlockHdr {
 		uint6_t		length_ind,
 		/* 1 = new LLC PDU starts */
 		BIT1		more,
 		/* 0 = another extension octet after LLC PDU, 1 = no more extension octets */
-		BIT1		e
-	} with { variant "" };
-
-	type record RlcBlock {
-		uint6_t		length_ind,
-		BIT1		more,
-		BIT1		e,
-		octetstring 	rlc optional
+		boolean		e
 	} with {
-		variant (rlc) "PRESENCE (more = '1'B)"
-		variant (length_ind) "LENGTHTO(length_ind, more, e, rlc)"
+		variant (e) "FIELDLENGTH(1)"
 	};
-
-	type record of RlcBlock RlcBlocks;
+	type record LlcBlock {
+		/* Header is only present if LI field was present */
+		LlcBlockHdr	hdr,
+		octetstring 	payload
+	} with { variant "" };
+	type record of LlcBlock LlcBlocks;
 
 	/* TS 44.060 10.2.1 Downlink RLC data block */
-	type record RlcmacDlDataBlock {
+	type record DlMacHdrDataExt {
 		/* Octet 1 */
-		DlMacHeader		mac_hdr,
-		/* Octet 2 */
 		PowerReduction		pr,
 		BIT1			spare,
 		uint4_t			tfi, /* 3 or 4? */
 		boolean			fbi,
-		/* Octet 3 */
+		/* Octet 2 */
 		uint7_t			bsn,
-		BIT1			e ('1'B),
-		RlcBlocks		rlc_blocks
+		boolean			e
+	} with {
+		variant (e) "FIELDLENGTH(1)"
+	};
+	type record DlMacDataHeader {
+		DlMacHeader		mac_hdr,
+		DlMacHdrDataExt		hdr_ext
 	} with { variant "" };
+	type record RlcmacDlDataBlock {
+		DlMacDataHeader		mac_hdr,
+		/* Octet 3..M / N: manual C++ Decoder */
+		LlcBlocks		blocks
+	} with {
+		variant ""
+	};
 
-	external function enc_RlcmacDlDataBlock(in RlcmacDlDataBlock si) return octetstring
-		with { extension "prototype(convert) encode(RAW)" };
-	external function dec_RlcmacDlDataBlock(in octetstring stream) return RlcmacDlDataBlock
-		with { extension "prototype(convert) decode(RAW)" };
+	external function enc_RlcmacDlDataBlock(in RlcmacDlDataBlock si) return octetstring;
+	external function dec_RlcmacDlDataBlock(in octetstring stream) return RlcmacDlDataBlock;
 
 
 	/* TS 44.060 10.2.2 */
 	type record UlMacDataHeader {
+		/* Octet 0 */
 		MacPayloadType		pt,
 		uint4_t			countdown,
 		boolean			stall_ind,
-		boolean			retry
+		boolean			retry,
+		/* Octet 1 */
+		BIT1			spare,
+		boolean			pfi_ind,
+		uint5_t			tfi,
+		boolean			tlli_ind,
+		/* Octet 2 */
+		uint7_t			bsn,
+		boolean			e
 	} with {
-		variant (stall_ind) "FIELDLENGTH(1)"
-		variant (retry) "FIELDLENGTH(1)"
+		variant (stall_ind)	"FIELDLENGTH(1)"
+		variant (retry)		"FIELDLENGTH(1)"
+		variant (pfi_ind)	"FIELDLENGTH(1)"
+		variant (tlli_ind)	"FIELDLENGTH(1)"
+		variant (e)		"FIELDLENGTH(1)"
 	};
 
-	type record RlcMacUlTlli {
-		RlcBlockHdr		hdr,
-		uint32_t		tlli
-	} with {
-		variant ""
-	}
-
 	type record RlcMacUlPfi {
 		uint7_t			pfi,
 		boolean			m
@@ -175,26 +183,16 @@
 	type record RlcmacUlDataBlock {
 		/* MAC header */
 		UlMacDataHeader		mac_hdr,
-		/* Octet 1 */
-		BIT1			spare,
-		boolean			pfi_ind,
-		uint5_t			tfi,
-		boolean			tlli_ind,
-		/* Octet 2 */
-		uint7_t			bsn,
-		BIT1			e ('1'B),
-		/* Octet 3 (optional) */
-		RlcMacUlTlli		tlli,
-		RlcMacUlPfi		pfi,
-		RlcBlocks		blocks
+		/* Octet 3 ... M (optional): manual C++ Decoder */
+		GprsTlli		tlli optional,
+		RlcMacUlPfi		pfi optional,
+		LlcBlocks		blocks
 	} with {
-		variant (tlli) "PRESENCE(tlli_ind = true)"
-		variant (pfi) "PRESENCE(pfi_ind = true)"
+		variant (tlli) "PRESENCE(mac_hdr.tlli_ind = true)"
+		variant (pfi) "PRESENCE(mac_hdr.pfi_ind = true)"
 	};
 
-	external function enc_RlcmacUlDataBlock(in RlcmacUlDataBlock si) return octetstring
-		with { extension "prototype(convert) encode(RAW)" };
-	external function dec_RlcmacUlDataBlock(in octetstring stream) return RlcmacUlDataBlock
-		with { extension "prototype(convert) decode(RAW)" };
+	external function enc_RlcmacUlDataBlock(in RlcmacUlDataBlock si) return octetstring;
+	external function dec_RlcmacUlDataBlock(in octetstring stream) return RlcmacUlDataBlock;
 
 } with { encode "RAW"; variant "FIELDORDER(msb)" }