lapdm: Updated to recent changes in library code (make it compile again)
diff --git a/lapdm/L1CTL_Test.ttcn b/lapdm/L1CTL_Test.ttcn
index e780de8..98dc43b 100644
--- a/lapdm/L1CTL_Test.ttcn
+++ b/lapdm/L1CTL_Test.ttcn
@@ -91,6 +91,30 @@
 		}
 	}
 
+	template LapdmFrame t_nopayload(template GsmSapi sapi) := {
+		b := {
+			addr := tr_LapdmAddr(sapi, true),
+			ctrl := ?,
+			len := 0,
+			m := false,
+			el := 1,
+			payload := ''O
+		}
+	}
+
+	template LapdmFrame LAPDm_B_DISC(template GsmSapi sapi) modifies t_nopayload := {
+		b := {
+			ctrl := t_LapdmCtrlDISC(true)
+		}
+	}
+
+	template LapdmFrame LAPDm_B_RR(template GsmSapi sapi, template uint3_t nr) modifies t_nopayload := {
+		b := {
+			ctrl := t_LapdmCtrlRR(nr, false)
+		}
+	}
+
+
 	function f_test_sabm_results_in_ua(uint8_t sapi, boolean use_sacch, octetstring payload) runs on dummy_CT return boolean {
 		var LAPDm_ph_data phd;
 		var boolean result := false;
@@ -106,6 +130,7 @@
 			[] LAPDM.receive(t_PH_DATA(?, ?, ?)) -> value phd { log("Other PH-DATA: ", phd); repeat; }
 			[] T.timeout { }
 		}
+		LAPDM.send(t_PH_DATA(sapi, use_sacch, LAPDm_B_RR(sapi, 0)));
 		f_release_dcch();
 		return result;
 	}
@@ -169,8 +194,22 @@
 		f_release_dcch();
 	}
 
+	/* we test that a re-transmitted SABM with identical payload will result in the retransmission of a
+	  * SABM. This is required during the contention resolution procedure as specified in 8.4.1.4 */
+	testcase TC_sabm_retransmit() runs on dummy_CT {
+		const octetstring payload := '00FEFEDEADBEEF'O;
+		f_init();
+		if (not f_test_sabm_results_in_ua(0, false, payload)) {
+			setverdict(fail, "UA not received for first SABM");
+		}
+		if (not f_test_sabm_results_in_ua(0, false, payload)) {
+			setverdict(fail, "UA not received for second SABM");
+		}
+		setverdict(pass);
+	}
 
 	testcase TC_foo() runs on dummy_CT {
+		var LapdmFrame lf;
 /*
 		var LapdmFrame lf := valueof(LAPDm_B_UA(0, ''O));
 		log("ENC UA: ", enc_LapdmFrame(lf));
@@ -180,6 +219,16 @@
 
 		log("DEC UI AF: ", dec_LapdmAddressField('03'O));
 */
+
+		lf := valueof(LAPDm_B_RR(0, 0));
+		log("ENC RR: ", enc_LapdmFrame(lf));
+
+		lf := valueof(LAPDm_B_UA(0, ''O));
+		log("ENC UA: ", enc_LapdmFrame(lf));
+
+		lf := valueof(LAPDm_B_UI(0, ''O));
+		log("ENC UI: ", enc_LapdmFrame(lf));
+
 		log("DEC UI CU: ", dec_LapdmCtrlU('03'O));
 		log("DEC UI CT: ", dec_LapdmCtrl('03'O));
 
@@ -194,9 +243,12 @@
 	control {
 		execute(TC_foo());
 		execute(TC_sabm_ua_dcch_sapi0());
+/*
 		execute(TC_sabm_ua_dcch_sapi0_nopayload());
 		execute(TC_sabm_ua_dcch_sapi3());
 		execute(TC_sabm_ua_dcch_sapi4());
 		execute(TC_sabm_contention());
+		execute(TC_sabm_retransmit());
+*/
 	}
 }
diff --git a/lapdm/LAPDm_RAW_PT.ttcn b/lapdm/LAPDm_RAW_PT.ttcn
index 02b0b13..06225bb 100644
--- a/lapdm/LAPDm_RAW_PT.ttcn
+++ b/lapdm/LAPDm_RAW_PT.ttcn
@@ -3,6 +3,7 @@
  * all kinds of hand-crafted LAPDm frames for testing of the remote LAPDm layer */
 module LAPDm_RAW_PT {
 	import from GSM_Types all;
+	import from GSM_RR_Types all;
 	import from Osmocom_Types all;
 	import from L1CTL_Types all;
 	import from L1CTL_PortType all;
diff --git a/lapdm/LAPDm_Types.ttcn b/lapdm/LAPDm_Types.ttcn
index 988e015..98f6956 100644
--- a/lapdm/LAPDm_Types.ttcn
+++ b/lapdm/LAPDm_Types.ttcn
@@ -40,21 +40,21 @@
 	};
 
 	type record LapdmCtrlI {
-		BIT1	spare,
+		BIT1	spare ('0'B),
 		uint3_t	n_s,
 		boolean	p,
 		uint3_t n_r
 	} with { variant "FIELDORDER(lsb)" };
 
 	type record LapdmCtrlS {
-		BIT2		spare,
+		BIT2		spare ('01'B),
 		LapdmSBits	s,
 		boolean		p_f,
 		uint3_t		n_r
 	} with { variant "FIELDORDER(lsb)" };
 
 	type record LapdmCtrlU {
-		BIT2		spare,
+		BIT2		spare ('11'B),
 		LapdmU2Bits	u2,
 		boolean		p_f,
 		LapdmUBits	u
diff --git a/lapdm/gen_links.sh b/lapdm/gen_links.sh
index d849751..a00b5dd 100755
--- a/lapdm/gen_links.sh
+++ b/lapdm/gen_links.sh
@@ -18,5 +18,5 @@
 
 
 DIR=../library
-FILES="General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn L1CTL_PortType.ttcn L1CTL_Types.ttcn"
+FILES="General_Types.ttcn GSM_Types.ttcn GSM_RR_Types.ttcn RLCMAC_CSN1_Types.ttcn Osmocom_Types.ttcn L1CTL_PortType.ttcn L1CTL_Types.ttcn"
 gen_links $DIR $FILES
diff --git a/lapdm/regen_makefile.sh b/lapdm/regen_makefile.sh
index 8d321ac..f4cf882 100755
--- a/lapdm/regen_makefile.sh
+++ b/lapdm/regen_makefile.sh
@@ -5,5 +5,5 @@
 ttcn3_makefilegen -f L1CTL_Test.ttcn $FILES
 sed -i -e 's/# TTCN3_DIR = /TTCN3_DIR = \/usr/' Makefile
 sed -i -e 's/LDFLAGS = /LDFLAGS = -L \/usr\/lib\/titan `pkg-config --libs libnetfilter_conntrack`/' Makefile
-sed -i -e 's/TTCN3_LIB = ttcn3-parallel/TTCN3_LIB = ttcn3/' Makefile
+#sed -i -e 's/TTCN3_LIB = ttcn3-parallel/TTCN3_LIB = ttcn3/' Makefile
 sed -i -e 's/CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)\/include/CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)\/include -I\/usr\/include\/titan/' Makefile