L1CTL: Add message segmentation helper via getMsgLen()

As L1CTL is using a stream socket, we need to give the UNIX_DOMAIN
port some clue as to where our L1CTL message boundaries are in the
stream.

This requires a patched UNIX_DOMAIN_SOCKETasp test port with the
following commit applied:

commit 655cb4ab2ac006b3a73d1b679c83081d9743410a
Author: Harald Welte <laforge@gnumonks.org>
Date:   Sun Feb 25 23:25:46 2018 +0100

    Add "getMsgLen" function similar to IPL4asp_PT

Change-Id: Iab33f57cb4311180e521a76307a552d16287b062
diff --git a/library/L1CTL_PortType.ttcn b/library/L1CTL_PortType.ttcn
index b82419e..4dcacb8 100644
--- a/library/L1CTL_PortType.ttcn
+++ b/library/L1CTL_PortType.ttcn
@@ -6,6 +6,7 @@
 	import from Osmocom_Types all;
 	import from GSM_Types all;
 	import from GSM_RR_Types all;
+	import from L1CTL_PortType_CtrlFunct all;
 
 	type record L1CTL_connect {
 		charstring	path
@@ -20,6 +21,18 @@
 		charstring	m_l1ctl_sock_path := "/tmp/osmocom_l2";
 	}
 
+	function f_L1CTL_getMsgLen(in octetstring stream, inout ro_integer args) return integer {
+		var integer stream_len := lengthof(stream);
+		var integer len;
+		if (stream_len < 2) {
+			log("getMsgLen(", stream, ",", args, ")=-1");
+			return -1;
+		}
+		len := 2 + oct2int(substr(stream, 0, 2));
+		log("getMsgLen(", stream, ",", args, ")=", len);
+		return len;
+	}
+
 	function f_L1CTL_FBSB(L1CTL_PT pt, Arfcn arfcn, L1ctlCcchMode ccch_mode := CCCH_MODE_COMBINED) {
 		timer T := 5.0;
 		pt.send(t_L1CTL_FBSB_REQ(arfcn, t_L1CTL_FBSB_F_ALL, 0, ccch_mode, 0));
@@ -88,8 +101,11 @@
 	}
 
 	function f_connect_reset(L1CTL_PT pt, charstring l1ctl_sock_path := m_l1ctl_sock_path) {
+		var f_UD_getMsgLen vl_f := refers(f_L1CTL_getMsgLen);
+		f_L1CTL_setGetMsgLen(pt, -1, vl_f, {});
 		pt.send(L1CTL_connect:{path:=l1ctl_sock_path});
 		pt.receive(L1CTL_connect_result:{result_code := SUCCESS, err:=omit});
+		f_L1CTL_setGetMsgLen(pt, 0, vl_f, {});
 
 		pt.send(t_L1ctlResetReq(L1CTL_RES_T_SCHED));
 		pt.receive;