Change in osmo-ttcn3-hacks[master]: TTCN-3 definitions for BSSMAP-LE and BSSLAP protocols

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Fri Aug 21 13:45:51 UTC 2020


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/19764 )


Change subject: TTCN-3 definitions for BSSMAP-LE and BSSLAP protocols
......................................................................

TTCN-3 definitions for BSSMAP-LE and BSSLAP protocols

Both are part of GSM LCS and are spoken between BSC and SMLC

Change-Id: If31830be2c8e1b624579f6663e74955763db9d0e
---
A library/BSSAP_LE_Types.ttcn
A library/BSSLAP_Types.ttcn
A library/BSSMAP_LE_Templates.ttcn
3 files changed, 1,558 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/64/19764/1

diff --git a/library/BSSAP_LE_Types.ttcn b/library/BSSAP_LE_Types.ttcn
new file mode 100644
index 0000000..ae7385b
--- /dev/null
+++ b/library/BSSAP_LE_Types.ttcn
@@ -0,0 +1,594 @@
+module BSSAP_LE_Types {
+
+/* BSSAP_LE_Types, defining abstract TTCN-3 data types for the 3GPP BSSMAP-LE protocol.
+ *
+ * BSSMAP-LE is a 3GPP standard protocol used by SMLC and its peers in a GSM network.
+ * This file covers 3GPP TS 49.031 version 15.0.0 Release 15
+ *
+ * (C) 2020 by Harald Welte <laforge at gnumonks.org>
+ * All rights reserved.
+ *
+ * Released under the terms of GNU General Public License, Version 2 or
+ * (at your option) any later version.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+import from General_Types all;
+import from Osmocom_Types all;
+import from BSSAP_Types all;
+import from BSSLAP_Types all;
+import from MobileL3_CommonIE_Types all;
+
+/* TS 49.031 Section 10.1 */
+type enumerated BSSMAP_LE_MsgType {
+	BSSMAP_LE_PERFORM_LOC_REQ	('00101011'B),
+	BSSMAP_LE_PERFORM_LOC_RESP	('00101101'B),
+	BSSMAP_LE_PERFORM_LOC_ABORT	('00101110'B),
+	BSSMAP_LE_PERFORM_LOC_INFO	('00101111'B),
+	BSSMAP_LE_ASSIST_INFO_REQ	('00100000'B),
+	BSSMAP_LE_ASSIST_INFO_RESP	('00100001'B),
+
+	BSSMAP_LE_CONN_ORIENTED_INFO	('00101010'B),
+	BSSMAP_LE_CONN_LESS_INFO	('00111010'B),
+
+	BSSMAP_LE_RESET			('00110000'B),
+	BSSMAP_LE_RESET_ACK		('00110001'B)
+};
+
+/* TS 49.031 Section 10.2 */
+type enumerated BSSMAP_LE_IEI {
+	BSSMAP_LE_IEI_LCS_QoS		('00111110'B),
+	BSSMAP_LE_IEI_LCS_PRIORITY	('01000011'B),
+	BSSMAP_LE_IEI_LOCATION_TYPE	('01000100'B),
+	BSSMAP_LE_IEI_GANSS_LOCATION_TYPE ('10000010'B),
+	BSSMAP_LE_IEI_GEO_LOCATION	('01000101'B),
+	BSSMAP_LE_IEI_POSITIONING_DATA	('01000110'B),
+	BSSMAP_LE_IEI_GANSS_POS_DATA	('10000011'B),
+	BSSMAP_LE_IEI_VELOCITY_DATA	('01010101'B),
+	BSSMAP_LE_IEI_LCS_CAUSE		('01000111'B),
+	BSSMAP_LE_IEI_LCS_CLIENT_TYPE	('01001000'B),
+	BSSMAP_LE_IEI_APDU		('01001001'B),
+	BSSMAP_LE_IEI_NET_ELEM_ID	('01001010'B),
+	BSSMAP_LE_IEI_REQ_GPS_ASS_D	('01001011'B),
+	BSSMAP_LE_IEI_REQ_GANSS_ASS_D	('01000001'B),
+	BSSMAP_LE_IEI_DECIPH_KEYS	('01001100'B),
+	BSSMAP_LE_IEI_RET_ERR_REQ	('01001101'B),
+	BSSMAP_LE_IEI_RET_ERR_CAUSE	('01001110'B),
+	BSSMAP_LE_IEI_SEGMENTATION	('01001111'B),
+	BSSMAP_LE_IEI_CLASSMARK3_INFO	('00010011'B),
+	BSSMAP_LE_IEI_CAUSE		('00000100'B),
+	BSSMAP_LE_IEI_CELL_ID		('00000101'B),
+	BSSMAP_LE_IEI_CHOSEN_CHAN	('00100001'B),
+	BSSMAP_LE_IEI_IMSI		('00000000'B),
+	BSSMAP_LE_IEI_LCS_CAPABILITY	('01010000'B),
+	BSSMAP_LE_IEI_PKT_MEAS_REP	('01010001'B),
+	BSSMAP_LE_IEI_CELL_ID_LIST	('01010010'B),
+	BSSMAP_LE_IEI_IMEI		('10000000'B),
+	BSSMAP_LE_IEI_BSS_MLAT_CAP	('10000100'B),
+	BSSMAP_LE_IEI_CELL_INFO_LIST	('10000101'B),
+	BSSMAP_LE_IEI_BTS_RX_ACC_LVL	('10000110'B),
+	BSSMAP_LE_IEI_MLAT_METHOD	('10000111'B),
+	BSSMAP_LE_IEI_MLAT_TA		('10001000'B),
+	BSSMAP_LE_IEI_MS_SYNC_ACC	('10001001'B),
+	BSSMAP_LE_IEI_SHORT_ID_SET	('10001010'B),
+	BSSMAP_LE_IEI_RANDOM_ID_SET	('10001011'B),
+	BSSMAP_LE_IEI_SHORT_BSS_ID	('10001100'B),
+	BSSMAP_LE_IEI_RANDOM_ID		('10001101'B),
+	BSSMAP_LE_IEI_SHORT_ID		('10001110'B),
+	BSSMAP_LE_IEI_COVERAGE_CLASS	('10001111'B),
+	BSSMAP_LE_IEI_MTA_ACC_SEC_RQD	('10010000'B)
+};
+
+/* Section 9.1 */
+type record BSSMAP_LE_PerfLocReq {
+	BSSMAP_LE_MsgType 			msg_type,
+	BSSMAP_LE_IE_LocationType		location_type,
+	BSSMAP_IE_CellIdentifier		cell_id,
+	BSSMAP_IE_ClassmarkInformationType3	cm3 optional,
+	BSSMAP_LE_IE_LcsClientType		lcs_client_type optional,
+	BSSMAP_IE_ChosenChannel			chosen_channel optional,
+	BSSMAP_LE_IE_LcsPriority		lcs_priority optional,
+	BSSMAP_LE_IE_LcsQoS			lcs_qos optional,
+	BSSMAP_LE_IE_ReqGpsAssD			req_gps_ass_d optional,
+	BSSMAP_LE_IE_APDU			bsslap_apdu optional,
+	BSSMAP_LE_IE_LcsCapability		lcs_capability optional,
+	BSSMAP_LE_IE_PacketMeasRep		packet_meas_rep optional,
+	BSSMAP_LE_IE_CellIdList			meas_cell_id_list optional,
+	BSSMAP_LE_IE_IMSI			imsi optional,
+	BSSMAP_LE_IE_IMEI			imei optional
+	// TODO: more optional IEs
+};
+
+/* Section 9.2 */
+type record BSSMAP_LE_PerfLocResp {
+	BSSMAP_LE_MsgType			msg_type,
+	BSSMAP_LE_IE_GeographicLoc		geographic_loc optional,
+	BSSMAP_LE_IE_PositioningData		pos_data optional,
+	BSSMAP_LE_IE_DecipheringKeys		deciph_keys optional,
+	BSSMAP_LE_IE_LcsCause			lcs_cause optional,
+	BSSMAP_LE_IE_VelocityData		velocity_data optional,
+	BSSMAP_LE_IE_GanssPosData		ganss_pos_data optional
+};
+
+/* Section 9.4 */
+type record BSSMAP_LE_PerfLocAbort {
+	BSSMAP_LE_MsgType			msg_type,
+	BSSMAP_LE_IE_LcsCause			lcs_cause
+};
+
+/* Section 9.8 */
+type record BSSMAP_LE_ConnOrientedInfo {
+	BSSMAP_LE_MsgType			msg_type,
+	BSSMAP_LE_IE_APDU			bsslap_apdu,
+	BSSMAP_LE_IE_Segmentation		segmentation optional
+	// TODO: MLA related optional IEs
+};
+
+/* Section 9.9 */
+type record BSSMAP_LE_ConnLessInfo {
+	BSSMAP_LE_MsgType			msg_type,
+	BSSMAP_LE_IE_NetElementId		source_id,
+	BSSMAP_LE_IE_NetElementId		dest_id,
+	BSSMAP_LE_IE_APDU			bsslap_apdu optional,
+	BSSMAP_LE_IE_Segmentation		segmentation optional,
+	BSSMAP_LE_IE_RetErrReq			ret_err_req optional,
+	BSSMAP_LE_IE_RetErrCause		ret_err_cause optional
+};
+
+/* Section 9.10 */
+type record BSSMAP_LE_Reset {
+	BSSMAP_LE_MsgType 		msg_type,
+	BSSMAP_IE_Cause			cause
+};
+
+/* Section 9.11 */
+type record BSSMAP_LE_ResetAck {
+	BSSMAP_LE_MsgType 		msg_type
+};
+
+/* Section 9.12 */
+type record BSSMAP_LE_PerformLocInfo {
+	BSSMAP_LE_MsgType 		msg_type,
+	BSSMAP_IE_CellIdentifier	cell_id,
+	BSSMAP_LE_IE_APDU		bsslap_apdu optional
+};
+
+type union BSSMAP_LE_PDU {
+	BSSMAP_LE_PerfLocReq		perf_loc_req,
+	BSSMAP_LE_PerfLocResp		perf_loc_resp,
+	BSSMAP_LE_PerfLocAbort		perf_loc_abort,
+	BSSMAP_LE_ConnOrientedInfo	co_info,
+	BSSMAP_LE_ConnLessInfo		cl_info,
+	BSSMAP_LE_Reset			reset,
+	BSSMAP_LE_ResetAck		reset_ack,
+	BSSMAP_LE_PerformLocInfo	perf_loc_info,
+	/* The following BSSMAP messages defined in 3GPP TS 48.008 are applicable to the Lb interface to
+	 * support signaling to a Type A LMU using an SDCCH */
+	PDU_BSSMAP_CipherModeCommand	cipherModeCommand,
+	PDU_BSSMAP_CipherModeComplete	cipherModeComplete,
+	PDU_BSSMAP_CipherModeReject	cipherModeReject,
+	PDU_BSSMAP_ClassmarkUpdate	classmarkUpdate,
+	PDU_BSSMAP_ClearCommand		clearCommand,
+	PDU_BSSMAP_ClearComplete	clearComplete,
+	PDU_BSSMAP_ClearRequest		clearRequest,
+	PDU_BSSMAP_CompleteLayer3Information	completeLayer3Information,
+	PDU_BSSMAP_Confusion		confusion,
+	PDU_BSSMAP_HandoverRequired	handoverRequired,
+	PDU_BSSMAP_HandoverRequiredReject handoverRequiredReject,
+	PDU_BSSMAP_HandoverPerformed	handoverPerformed,
+	PDU_BSSMAP_Paging		paging
+} with {
+	variant "TAG(
+			perf_loc_req,	msg_type = BSSMAP_LE_PERFORM_LOC_REQ;
+			perf_loc_resp,	msg_type = BSSMAP_LE_PERFORM_LOC_RESP;
+			perf_loc_abort,	msg_type = BSSMAP_LE_PERFORM_LOC_ABORT;
+			co_info,	msg_type = BSSMAP_LE_CONN_ORIENTED_INFO;
+			cl_info,	msg_type = BSSMAP_LE_CONN_LESS_INFO;
+			reset,		msg_type = BSSMAP_LE_RESET;
+			reset_ack,	msg_type = BSSMAP_LE_RESET_ACK;
+			perf_loc_info,	msg_type = BSSMAP_LE_PERFORM_LOC_INFO;
+		)"
+};
+
+/* Section 10.3 */
+type record BSSMAP_LE_IE_APDU {
+	BSSMAP_LE_IEI		iei,
+	uint16_t		len,
+	BIT1			spare,
+	BSSMAP_LE_ProtocolId	protocol_id,
+	octetstring		data
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_APDU)"
+	variant (len) "LENGTHTO(spare,protocol_id,data)"
+};
+type enumerated BSSMAP_LE_ProtocolId {
+	BSSMAP_LE_PROT_RESERVED		('0000000'B),
+	BSSMAP_LE_PROT_BSSLAP		('0000001'B),
+	BSSMAP_LE_PROT_LLP		('0000010'B),
+	BSSMAP_LE_PROT_SMLCPP		('0000011'B)
+} with { variant "FIELDLENGTH(7)" };
+
+/* Section 10.8 */
+type record BSSMAP_LE_IE_DecipheringKeys {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+	BIT7			spare,
+	boolean			ciph_key_flag,
+	OCT7			cur_deciph_key,
+	OCT7			next_deciph_key
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_DECIPH_KEYS)"
+	variant (len) "LENGTHTO(spare,ciph_key_flag,cur_deciph_key,next_deciph_key)"
+}
+
+/* Section 10.9 */
+type record BSSMAP_LE_IE_GeographicLoc {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+	octetstring		location
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_GEO_LOCATION)"
+	variant (len) "LENGTHTO(location)"
+}
+
+/* Section 10.10 */
+type record BSSMAP_LE_IE_ReqGpsAssD {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+	BIT16			flags,
+	octetstring		sat_data
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_REQ_GPS_ASS_D)"
+	variant (len) "LENGTHTO(flags,sat_data)"
+}
+
+/* Section 10.11 */
+type record BSSMAP_LE_IE_IMSI {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+	MobileIdentityV		imsi
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_IMSI)"
+	variant (len) "LENGTHTO(imsi)"
+}
+
+/* Section 10.13 */
+type record BSSMAP_LE_IE_LcsCause {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+	BSSMAP_LE_LcsCause	cause,
+	OCT1			diag_val optional
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_IMSI)"
+	variant (len) "LENGTHTO(cause,diag_val)"
+}
+type enumerated BSSMAP_LE_LcsCause {
+	BSSMAP_LE_LCS_CAUSE_UNSPEIFIED		('00000000'B),
+	BSSMAP_LE_LCS_CAUSE_SYSTEM_FAILURE	('00000001'B),
+	BSSMAP_LE_LCS_CAUSE_PROTOCOL_ERROR	('00000010'B),
+	BSSMAP_LE_LCS_CAUSE_DATA_MISSING_IN_REQ	('00000011'B),
+	BSSMAP_LE_LCS_CAUSE_UNEXP_DATA_IN_REQ	('00000100'B),
+	BSSMAP_LE_LCS_CAUSE_POS_METH_FAILURE	('00000101'B),
+	BSSMAP_LE_LCS_CAUSE_TGT_MS_UNREACHABLE	('00000110'B),
+	BSSMAP_LE_LCS_CAUSE_REQUEST_ABORTED	('00000111'B),
+	BSSMAP_LE_LCS_CAUSE_FACILITY_NOTSUPP	('00001000'B),
+	BSSMAP_LE_LCS_CAUSE_INTER_BSC_HO	('00001001'B),
+	BSSMAP_LE_LCS_CAUSE_INTRA_BSC_HO	('00001010'B),
+	BSSMAP_LE_LCS_CAUSE_CONGESTION		('00001011'B),
+	BSSMAP_LE_LCS_CAUSE_INTER_NSE_CHG	('00001100'B),
+	BSSMAP_LE_LCS_CAUSE_RA_UPDAT		('00001101'B),
+	BSSMAP_LE_LCS_CAUSE_PTMSI_REALLOC	('00001110'B),
+	BSSMAP_LE_LCS_CAUSE_GPRS_SUSPENSION	('00001111'B)
+} with { variant "FIELDLENGTH(8)" };
+
+/* Section 10.14 */
+type record BSSMAP_LE_IE_LcsClientType {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+	BSSMAP_LE_ClientType	cltype
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_CAUSE)"
+	variant (len) "LENGTHTO(cltype)"
+}
+type enumerated BSSMAP_LE_ClientType {
+	BSSMAP_LE_LCS_CTYPE_VALUE_ADDED_UNSPECIFIED	('00000000'B),
+	BSSMAP_LE_LCS_CTYPE_PLMN_OPER_UNSPECIFIED	('00100000'B),
+	BSSMAP_LE_LCS_CTYPE_PLMN_OPER_BCAST_SERVICE	('00100001'B),
+	BSSMAP_LE_LCS_CTYPE_PLMN_OPER_OAM		('00100010'B),
+	BSSMAP_LE_LCS_CTYPE_PLMN_OPER_ANON_STATS	('00100011'B),
+	BSSMAP_LE_LCS_CTYPE_PLMN_OPER_TGT_MS_SVC	('00100100'B),
+	BSSMAP_LE_LCS_CTYPE_EMERG_SVC_UNSPECIFIED	('00110000'B),
+	BSSMAP_LE_LCS_CTYPE_LI_UNSPECIFIED		('01000000'B)
+} with { variant "FIELDLENGTH(8)" };
+
+/* Section 10.15 */
+type record BSSMAP_LE_IE_LcsPriority {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+	OCT1			priority
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_LCS_PRIORITY)"
+	variant (len) "LENGTHTO(priority)"
+}
+
+/* Section 10.16 */
+type record BSSMAP_LE_IE_LcsQoS {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+
+	BIT6			spare,
+	boolean			vel,
+	boolean			vert,
+
+	boolean			ha,
+	uint7_t			horiz_acc,
+
+	boolean			va,
+	uint7_t			vert_acc,
+
+	BIT2			rt,
+	BIT6			spare2
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_LCS_QoS)"
+	variant (len) "LENGTHTO(spare,vel,vert,ha,horiz_acc,va,vert_acc,rt,spare2)"
+}
+
+/* Section 10.18 */
+type record BSSMAP_LE_IE_LocationType {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+	BSSMAP_LE_LocInfo	loc_info,
+	BSSMAP_LE_PosMethod	pos_method optional
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_LOCATION_TYPE)"
+	variant (len) "LENGTHTO(loc_info,pos_method)"
+	variant (pos_method) "PRESENCE(loc_info = BSSMAP_LE_LOC_INFO_ASS_INFO_FOR_TGT_MS,
+				       loc_info = BSSMAP_LE_LOC_INFO_DECIPH_KEYS_FOR_BCAST)"
+}
+type enumerated BSSMAP_LE_LocInfo {
+	BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC	('00000000'B),
+	BSSMAP_LE_LOC_INFO_ASS_INFO_FOR_TGT_MS		('00000001'B),
+	BSSMAP_LE_LOC_INFO_DECIPH_KEYS_FOR_BCAST	('00000010'B)
+} with { variant "FIELDLENGTH(8)" };
+type enumerated BSSMAP_LE_PosMethod {
+	BSSMAP_LE_POS_METHOD_RESERVED		('00000000'B),
+	BSSMAP_LE_POS_MOBILE_ASSISTED_EOTD	('00000001'B),
+	BSSMAP_LE_POS_MOBILE_BASED_EOTD		('00000010'B),
+	BSSMAP_LE_POS_ASSISTED_GPS		('00000011'B),
+	BSSMAP_LE_POS_ASSISTED_GANSS		('00000100'B),
+	BSSMAP_LE_POS_ASSISTED_GPS_AND_GANSS	('00000101'B)
+} with { variant "FIELDLENGTH(8)" };
+
+/* Section 10.19 */
+type record BSSMAP_LE_IE_NetElementId {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+	BIT4			spare,
+	BSSMAP_LE_IdDiscr	id_discr,
+	BSSMAP_LE_IdU		u
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_NET_ELEM_ID)"
+	variant (len) "LENGTHTO(spare,id_discr,u)"
+	variant (u) "CROSSTAG(
+				cgi,		id_discr = BSSMAP_LE_ID_DISC_CGI;
+				lac_ci,		id_discr = BSSMAP_LE_ID_DISC_LAC_CI;
+				lai,		id_discr = BSSMAP_LE_ID_DISC_LAI;
+				lac,		id_discr = BSSMAP_LE_ID_DISC_LAC;
+				lmu,		id_discr = BSSMAP_LE_ID_LMU;
+			)"
+};
+type enumerated BSSMAP_LE_IdDiscr {
+	BSSMAP_LE_ID_DISC_CGI		('0000'B),
+	BSSMAP_LE_ID_DISC_LAC_CI	('0001'B),
+	BSSMAP_LE_ID_DISC_LAI		('0100'B),
+	BSSMAP_LE_ID_DISC_LAC		('0101'B),
+	BSSMAP_LE_ID_LMU		('0110'B)
+} with { variant "FIELDLENGTH(4)" };
+type union BSSMAP_LE_IdU {
+	BSSMAP_LE_Id_CGI	cgi,
+	BSSMAP_LE_Id_LAC_CI	lac_ci,
+	BSSMAP_LE_Id_LAI	lai,
+	uint16_t		lac,
+	octetstring		lmu
+};
+type record BSSMAP_LE_Id_CGI {
+	HEX6n		mcc_mnc,
+	uint16_t	lac,
+	uint16_t	ci
+};
+type record BSSMAP_LE_Id_LAC_CI {
+	uint16_t	lac,
+	uint16_t	ci
+};
+type record BSSMAP_LE_Id_LAI {
+	HEX6n		mcc_mnc,
+	uint16_t	lac
+};
+
+/* Section 10.20 */
+type record BSSMAP_LE_IE_PositioningData {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+	BIT4			spare,
+	uint4_t			discr,
+	BSSMAP_LE_PosMethList	pos_meth
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_POSITIONING_DATA)"
+	variant (len) "LENGTHTO(spare,discr,pos_meth)"
+};
+type record of BSSMAP_LE_PosMethodN BSSMAP_LE_PosMethList;
+type record BSSMAP_LE_PosMethodN {
+	BSSMAP_LE_Method	method,
+	BSSMAP_LE_Usage		usage
+};
+type enumerated BSSMAP_LE_Method {
+	BSSMAP_LE_METHOD_TA				('00000'B),
+	BSSMAP_LE_METHOD_RESERVED0			('00001'B),
+	BSSMAP_LE_METHOD_RESERVED1			('00010'B),
+	BSSMAP_LE_METHOD_MOBILE_ASS_EOTD		('00011'B),
+	BSSMAP_LE_METHOD_MOBILE_BASED_EOTD		('00100'B),
+	BSSMAP_LE_METHOD_MOBILE_ASS_GPS			('00101'B),
+	BSSMAP_LE_METHOD_MOBILE_BASED_GPS		('00110'B),
+	BSSMAP_LE_METHOD_CONVENTIONAL_GPS		('00111'B),
+	BSSMAP_LE_METHOD_UTDOA				('01000'B),
+	BSSMAP_LE_METHOD_CELL_ID			('01100'B)
+} with { variant "FIELDLENGTH(5)" };
+type enumerated BSSMAP_LE_Usage {
+	BSSMAP_LE_USAGE_ATTEMPTED_UNSUCC			('000'B),
+	BSSMAP_LE_USAGE_ATTEMPTED_SUCC_NOT_USED			('001'B),
+	BSSMAP_LE_USAGE_ATTEMPTED_SUCC_USED_VRFY_NOT_GEN	('010'B),
+	BSSMAP_LE_USAGE_ATTEMPTED_SUCC_USED_GEN			('011'B),
+	BSSMAP_LE_USAGE_ATTEMPTED_SUCC_USAGE_UNDETERMINED	('100'B)
+} with { variant "FIELDLENGTH(3)" };
+
+/* Section 10.21 */
+type record BSSMAP_LE_IE_RetErrReq {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+	OCT1			ret_err_type
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_RET_ERR_REQ)"
+	variant (len) "LENGTHTO(ret_err_type)"
+}
+
+/* Section 10.22 */
+type record BSSMAP_LE_IE_RetErrCause {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+	BSSMAP_LE_RetErrCause	cause
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_RET_ERR_REQ)"
+	variant (len) "LENGTHTO(cause)"
+}
+type enumerated BSSMAP_LE_RetErrCause {
+	BSSMAP_LE_RE_CAUSE_UNSPECIFIED		('00000000'B),
+	BSSMAP_LE_RE_CAUSE_SYSTEM_FAILURE	('00000001'B),
+	BSSMAP_LE_RE_CAUSE_PROTOCOL_ERROR	('00000010'B),
+	BSSMAP_LE_RE_CAUSE_DEST_UNKNOWN		('00000011'B),
+	BSSMAP_LE_RE_CAUSE_DEST_UNREACHABLE	('00000100'B),
+	BSSMAP_LE_RE_CAUSE_CONGESTION		('00000101'B)
+} with { variant "FIELDLENGTH(8)" };
+
+/* Section 10.24 */
+type record BSSMAP_LE_IE_Segmentation {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+	BIT3			spare,
+	boolean			s_non_final,
+	uint4_t			seg_nr,
+	OCT2			msg_id optional
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_SEGMENTATION)"
+	variant (len) "LENGTHTO(spare,s_non_final,seg_nr,msg_id)"
+}
+
+/* Section 10.26 */
+type record BSSMAP_LE_IE_LcsCapability {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+	octetstring		lcs_cap
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_LCS_CAPABILITY)"
+	variant (len) "LENGTHTO(lcs_cap)"
+}
+
+type record BSSMAP_LE_IE_PacketMeasRep {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+	octetstring		pkt_meas_rep
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_PKT_MEAS_REP)"
+	variant (len) "LENGTHTO(pkt_meas_rep)"
+}
+
+type record BSSMAP_LE_IE_CellIdList {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+	BSSLAP_CellIdList	cell_id_list
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_CELL_ID_LIST)"
+	variant (len) "LENGTHTO(cell_id_list)"
+}
+
+/* Section 10.29 */
+type record BSSMAP_LE_IE_IMEI {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+	MobileIdentityV		imei
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_IMEI)"
+	variant (len) "LENGTHTO(imei)"
+}
+
+/* Section 10.30 */
+type record BSSMAP_LE_IE_VelocityData {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+	octetstring		data
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_VELOCITY_DATA)"
+	variant (len) "LENGTHTO(data)"
+}
+
+/* Section 10.32 */
+type record BSSMAP_LE_IE_GanssPosData {
+	BSSMAP_LE_IEI		iei,
+	uint8_t			len,
+	BSSMAP_LE_GanssList	list
+} with {
+	variant "PRESENCE(iei = BSSMAP_LE_IEI_VELOCITY_DATA)"
+	variant (len) "LENGTHTO(list)"
+}
+type record of BSSMAP_LE_Ganss BSSMAP_LE_GanssList;
+type record BSSMAP_LE_Ganss {
+	BSSMAP_LE_GanssMethod	method,
+	BSSMAP_LE_GanssId	id,
+	BSSMAP_LE_Usage		usage
+};
+type enumerated BSSMAP_LE_GanssMethod {
+	BSSMAP_LE_GANSS_METH_MS_BASED		('00'B),
+	BSSMAP_LE_GANSS_METH_MS_ASSISTED	('01'B),
+	BSSMAP_LE_GANSS_METH_MS_CONVENTIONAL	('10'B),
+	BSSMAP_LE_GANSS_METH_MS_RESERVED	('11'B)
+} with { variant "FIELDLENGTH(2)" };
+type enumerated BSSMAP_LE_GanssId {
+	BSSMAP_LE_GANSS_ID_GALILEO		('000'B),
+	BSSMAP_LE_GANSS_ID_SBAS			('001'B),
+	BSSMAP_LE_GANSS_ID_MODERNIZED_GPS	('010'B),
+	BSSMAP_LE_GANSS_ID_QZSS			('011'B),
+	BSSMAP_LE_GANSS_ID_GLONASS		('100'B),
+	BSSMAP_LE_GANSS_ID_BDS			('101'B)
+} with { variant "FIELDLENGTH(3)" };
+
+/* FIXME: Further IEs */
+
+
+
+
+type union BSSMAPLEorDTAP {
+	BSSMAP_LE_PDU		bssmap,
+	octetstring  		dtap
+}
+
+type record PDU_BSSAP_LE {
+	BIT1		discriminator, 	// 0 = BSSMAP-LE; 1 = DTAP-LE
+	BIT7		spare,		// always '0000000'B
+	OCT1		dlci optional,
+	LIN1		lengthIndicator,
+	BSSMAPLEorDTAP	pdu
+} with {
+	variant (lengthIndicator) "LENGTHTO(pdu)"
+	variant (pdu) "CROSSTAG(bssmap, discriminator='0'B;
+				dtap, discriminator='1'B)"
+	variant (dlci) "PRESENCE(discriminator='1'B)"
+}
+
+
+external function enc_PDU_BSSAP_LE(in PDU_BSSAP_LE pdu) return octetstring
+with { extension "prototype(convert) encode(RAW)" }
+external function dec_PDU_BSSAP_LE(in octetstring stream) return PDU_BSSAP_LE
+with { extension "prototype(convert) decode(RAW)" }
+
+
+} with { encode "RAW" ; variant "FIELDORDER(msb)" }
diff --git a/library/BSSLAP_Types.ttcn b/library/BSSLAP_Types.ttcn
new file mode 100644
index 0000000..90c3953
--- /dev/null
+++ b/library/BSSLAP_Types.ttcn
@@ -0,0 +1,530 @@
+module BSSLAP_Types {
+
+/* BSSLAP_Types, defining abstract TTCN-3 data types for the 3GPP BSSLAP protocol.
+ *
+ * BSSLAP is a 3GPP standard protocol used between BSC and SMLC in a GSM network.
+ * This file covers 3GPP TS 48.071 version 15.0.0 Release 15
+ *
+ * (C) 2020 by Harald Welte <laforge at gnumonks.org>
+ * All rights reserved.
+ *
+ * Released under the terms of GNU General Public License, Version 2 or
+ * (at your option) any later version.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+import from General_Types all;
+import from Osmocom_Types all;
+
+
+/* 3GPP TS 48.071 Table 5.1 */
+type enumerated BSSLAP_IEI {
+	BSSLAP_IEI_TA			('00000001'B),
+	BSSLAP_IEI_CELL_ID		('00001001'B),
+	BSSLAP_IEI_CHAN_DESC		('00010000'B),
+	BSSLAP_IEI_MEAS_REP		('00010100'B),
+	BSSLAP_IEI_CAUSE		('00011000'B),
+	BSSLAP_IEI_RRLP_FLAG		('00011001'B),
+	BSSLAP_IEI_RRLP			('00011011'B),
+	BSSLAP_IEI_CELL_ID_LIST		('00011100'B),
+	BSSLAP_IEI_ENH_MEAS_REP		('00011101'B),
+	BSSLAP_IEI_LAC			('00011110'B),
+	BSSLAP_IEI_FREQ_LIST		('00100001'B),
+	BSSLAP_IEI_MS_POWER		('00100010'B),
+	BSSLAP_IEI_DELTA_TIMER		('00100011'B),
+	BSSLAP_IEI_SERVING_CELL_ID	('00100100'B),
+	BSSLAP_IEI_ENCR_KEY		('00100101'B),
+	BSSLAP_IEI_CIPH_MODE_SET	('00100110'B),
+	BSSLAP_IEI_CHAN_MODE		('00100111'B),
+	BSSLAP_IEI_MR_CONFIG		('00101000'B),
+	BSSLAP_IEI_POLLING_REPETITION	('00101001'B),
+	BSSLAP_IEI_PACKET_CHAN_DESC	('00101010'B),
+	BSSLAP_IEI_TLLI			('00101011'B),
+	BSSLAP_IEI_TFI			('00101100'B),
+	BSSLAP_IEI_TBF_START_TIME	('00101101'B),
+	BSSLAP_IEI_PWRUP_START_TIME	('00101110'B),
+	BSSLAP_IEI_LONG_ENCR_KEY	('00101111'B),
+	BSSLAP_IEI_CONCUR_POS_PROC_F	('00110000'B)
+} with { variant "FIELDLENGTH(8)" };
+
+/* 3GPP TS 48.071 Section 5.1 */
+type enumerated BSSLAP_MsgType {
+	BSSLAP_MSGT_TA_REQUEST		('00000001'B),
+	BSSLAP_MSGT_TA_RESPONSE		('00000010'B),
+	BSSLAP_MSGT_REJECT		('00001010'B),
+	BSSLAP_MSGT_RESET		('00001011'B),
+	BSSLAP_MSGT_ABORT		('00001100'B),
+	BSSLAP_MSGT_TA_LAYER3		('00001101'B),
+	BSSLAP_MSGT_MS_POS_CMD		('00001111'B),
+	BSSLAP_MSGT_MS_POS_RESP		('00010000'B),
+	BSSLAP_MSGT_UTDOA_REQ		('00010001'B),
+	BSSLAP_MSGT_UTDOA_RESP		('00010010'B)
+} with { variant "FIELDLENGTH(8)" };
+
+
+/* Section 4.2.1 */
+type record BSSLAP_TaRequest {
+	BSSLAP_MsgType			msg_type
+};
+
+/* Section 4.2.2 */
+type record BSSLAP_TaResponse {
+	BSSLAP_MsgType			msg_type,
+	BSSLAP_IE_CellId		serving_cell_id,
+	BSSLAP_IE_TimingAdvance		timing_advance,
+	BSSLAP_IE_MeasRep		meas_rep optional,
+	BSSLAP_IE_EnhMeasRep		enh_meas_rep optional,
+	BSSLAP_IE_CellIdList		meas_cell_id_list optional,
+	BSSLAP_IE_ConcurMethodF		concur_meth_flag optional
+};
+
+/* Section 4.2.5 */
+type record BSSLAP_Reject {
+	BSSLAP_MsgType			msg_type,
+	BSSLAP_IE_Cause			cause
+};
+
+/* Section 4.2.6 */
+type record BSSLAP_Reset {
+	BSSLAP_MsgType			msg_type,
+	BSSLAP_IE_CellId		cell_id,
+	BSSLAP_IE_TimingAdvance		timing_advance,
+	BSSLAP_IE_ChanDesc		chan_desc,
+	BSSLAP_IE_Cause			cause,
+	BSSLAP_IE_MeasRep		meas_rep optional,
+	BSSLAP_IE_EnhMeasRep		enh_meas_rep optional,
+	BSSLAP_IE_CellIdList		meas_cell_id_list optional,
+	BSSLAP_IE_LAC			lac optional,
+	BSSLAP_IE_FreqList		freq_list optional,
+	BSSLAP_IE_ChanMode		chan_mode optional,
+	BSSLAP_IE_MultiRateConfig	mr_config optional,
+	BSSLAP_IE_PacketChanDesc	pkt_chan_desc optional,
+	BSSLAP_IE_TLLI			tlli optional,
+	BSSLAP_IE_TFI			tfi optional,
+	BSSLAP_IE_StartingTime		tbf_start_time optional,
+	BSSLAP_IE_EncryptionKey		encr_key optional,
+	BSSLAP_IE_CiphModeSet		ciph_mode_set optional,
+	BSSLAP_IE_LongEncryptionKey	long_encr_key optional
+};
+
+/* Section 4.2.7 */
+type record BSSLAP_Abort {
+	BSSLAP_MsgType			msg_type,
+	BSSLAP_IE_Cause			cause
+};
+
+/* Section 4.2.8 */
+type record BSSLAP_TA_Layer3 {
+	BSSLAP_MsgType			msg_type,
+	BSSLAP_IE_TimingAdvance		timing_advance,
+	BSSLAP_IE_MeasRep		meas_rep optional,
+	BSSLAP_IE_EnhMeasRep		enh_meas_rep optional,
+	BSSLAP_IE_CellIdList		meas_cell_id_list optional
+};
+
+/* Section 4.2.9 */
+type record BSSLAP_MS_PosCmd {
+	BSSLAP_MsgType			msg_type,
+	BSSLAP_IE_RrlpFlag		flag,
+	BSSLAP_IE_Rrlp			rrlp_info
+};
+
+/* Section 4.2.10 */
+type record BSSLAP_MS_PosResp {
+	BSSLAP_MsgType			msg_type,
+	BSSLAP_IE_RrlpFlag		flag,
+	BSSLAP_IE_Rrlp			rrlp_info,
+	BSSLAP_IE_TimingAdvance		timing_advance optional,
+	BSSLAP_IE_MeasRep		meas_rep optional,
+	BSSLAP_IE_EnhMeasRep		enh_meas_rep optional,
+	BSSLAP_IE_CellIdList		meas_cell_id_list optional,
+	BSSLAP_IE_ConcurMethodF		concur_meth_flag optional
+};
+
+/* Section 4.2.11 */
+type record BSSLAP_UTDOA_Req {
+	BSSLAP_MsgType			msg_type,
+	BSSLAP_IE_DeltaTimer		delta_timer optional,
+	BSSLAP_IE_PollingRep		polling_repetition optional
+};
+
+type union BSSLAP_PDU {
+	BSSLAP_TaRequest	ta_req,
+	BSSLAP_TaResponse	ta_resp,
+	BSSLAP_Reject		reject,
+	BSSLAP_Reset		reset,
+	BSSLAP_Abort		abort,
+	BSSLAP_TA_Layer3	ta_layer3,
+	BSSLAP_MS_PosCmd	ms_pos_cmd,
+	BSSLAP_MS_PosResp	ms_pos_resp,
+	BSSLAP_UTDOA_Req	utdoa_req
+	// TODO: U-TDOA Resp
+} with { variant "TAG(
+		ta_req,		msg_type = BSSLAP_MSGT_TA_REQUEST;
+		ta_resp,	msg_type = BSSLAP_MSGT_TA_RESPONSE;
+		reject,		msg_type = BSSLAP_MSGT_REJECT;
+		reset,		msg_type = BSSLAP_MSGT_RESET;
+		abort,		msg_type = BSSLAP_MSGT_ABORT;
+		ta_layer3,	msg_type = BSSLAP_MSGT_TA_LAYER3;
+		ms_pos_cmd,	msg_type = BSSLAP_MSGT_MS_POS_CMD;
+		ms_pos_resp,	msg_type = BSSLAP_MSGT_MS_POS_RESP;
+		utdoa_req,	msg_type = BSSLAP_MSGT_UTDOA_REQ;
+		)"
+};
+
+
+/* Section 5.2 */
+type record BSSLAP_IE_TimingAdvance {
+	BSSLAP_IEI		iei,
+	uint8_t			ta
+} with { variant "PRESENCE(iei = BSSLAP_IEI_TA)" };
+
+
+/* Section 5.4 */
+type record BSSLAP_IE_CellId {
+	BSSLAP_IEI		iei,
+	uint16_t		cell_id
+} with { variant "PRESENCE(iei = BSSLAP_IEI_CELL_ID)" };
+
+/* Section 5.8 */
+type record BSSLAP_IE_ChanDesc {
+	BSSLAP_IEI		iei,
+	OCT3			chan_desc
+} with { variant "PRESENCE(iei = BSSLAP_IEI_CHAN_DESC)" };
+
+
+/* Section 5.12 */
+type record BSSLAP_IE_MeasRep {
+	BSSLAP_IEI		iei,
+	uint8_t			len,
+	octetstring		meas_rep
+} with {
+	variant "PRESENCE(iei = BSSLAP_IEI_MEAS_REP)"
+	variant (len) "LENGTHTO(meas_rep)"
+};
+
+/* Section 5.14 */
+type record BSSLAP_IE_Cause {
+	BSSLAP_IEI		iei,
+	BSSLAP_Cause		cause
+} with { variant "PRESENCE(iei = BSSLAP_IEI_CAUSE)" };
+type enumerated BSSLAP_Cause {
+	BSSLAP_CAUSE_CONGESTION			('00000000'B),
+	BSSLAP_CAUSE_CHAN_MODE_NOT_SUPP		('00000001'B),
+	BSSLAP_CAUSE_POS_PROC_NOT_SUPP		('00000010'B),
+	BSSLAP_CAUSE_OTHER_RADIO_EVT_FAIL	('00000011'B),
+	BSSLAP_CAUSE_INTRA_BSS_HO		('00000100'B),
+	BSSLAP_CAUSE_SUPERV_TIMER_EXPIRED	('00000101'B),
+	BSSLAP_CAUSE_INTER_BSS_HO		('00000110'B),
+	BSSLAP_CAUSE_LOSS_SIG_CONN_MS		('00000111'B),
+	BSSLAP_CAUSE_INCORR_SERV_CELL_ID	('00001000'B),
+	BSSLAP_CAUSE_BSSAP_LE_SEGMENT_ERR	('00001001'B),
+	BSSLAP_CAUSE_CONCUR_POS_PROC_NOT_EN	('00001010'B)
+};
+
+/* Section 5.15 */
+type record BSSLAP_IE_RrlpFlag {
+	BSSLAP_IEI		iei,
+	BIT7			spare,
+	boolean			not_a_pos_cmd
+} with { variant "PRESENCE(iei = BSSLAP_IEI_RRLP_FLAG)" };
+
+/* Section 5.16 */
+type record BSSLAP_IE_Rrlp {
+	BSSLAP_IEI		iei,
+	uint16_t		len,
+	octetstring		rrlp_apdu
+} with {
+	variant "PRESENCE(iei = BSSLAP_IEI_RRLP)"
+	variant (len) "LENGTHTO(rrlp_apdu)"
+};
+
+/* Section 5.17 */
+type record BSSLAP_IE_CellIdList {
+	BSSLAP_IEI		iei,
+	uint8_t			len,
+	BSSLAP_CellIdList	cell_id_list
+} with {
+	variant "PRESENCE(iei = BSSLAP_IEI_CELL_ID_LIST)"
+	variant (len) "LENGTHTO(cell_id_list)"
+};
+type record of BSSLAP_CellIdListEnt BSSLAP_CellIdList;
+type union BSSLAP_CellIdListEnt {
+	BIT4			spare,
+	BSSLAP_CellIdDiscr	discr,
+	BSSLAP_CellIdListEntU	u
+}// with {
+//};
+type enumerated BSSLAP_CellIdDiscr {
+	BSSLAP_CIDL_DISC_CGI	('0000'B),
+	BSSLAP_CIDL_DISC_LAC_CI	('0001'B),
+	BSSLAP_CIDL_DISC_3G_1	('0010'B),
+	BSSLAP_CIDL_DISC_3G_2	('0011'B)
+} with { variant "FIELDLENGTH(4)" };
+type union BSSLAP_CellIdListEntU {
+	BSSLAP_CellIdListEntCGI		cgi,
+	BSSLAP_CellIdListEntLACCI	lac_ci,
+	BSSLAP_CellIdListEnt3G1		umts_cont1,
+	BSSLAP_CellIdListEnt3G2		umts_cont2
+};
+type record BSSLAP_CellIdListEntCGI {
+	HEX6n		mcc_mnc,
+	uint16_t	lac,
+	uint16_t	ci
+};
+type record BSSLAP_CellIdListEntLACCI {
+	uint16_t	lac,
+	uint16_t	ci
+};
+type record BSSLAP_CellIdListEnt3G1 {
+	OCT9		cont
+};
+type record BSSLAP_CellIdListEnt3G2 {
+	OCT6		cont
+};
+
+/* Section 5.18 */
+type record BSSLAP_IE_EnhMeasRep {
+	BSSLAP_IEI		iei,
+	uint8_t			len,
+	octetstring		meas_rep
+} with {
+	variant "PRESENCE(iei = BSSLAP_IEI_ENH_MEAS_REP)"
+	variant (len) "LENGTHTO(meas_rep)"
+};
+
+/* Section 5.19 */
+type record BSSLAP_IE_LAC {
+	BSSLAP_IEI		iei,
+	uint16_t		lac
+} with { variant "PRESENCE(iei = BSSLAP_IEI_LAC)" };
+
+/* Section 5.20 */
+type record BSSLAP_IE_FreqList {
+	BSSLAP_IEI		iei,
+	uint8_t			len,
+	octetstring		freq_list
+} with {
+	variant "PRESENCE(iei = BSSLAP_IEI_FREQ_LIST)"
+	variant (len) "LENGTHTO(freq_list)"
+};
+
+/* Section 5.21 */
+type record BSSLAP_IE_MsPower {
+	BSSLAP_IEI		iei,
+	uint8_t			ms_pwr
+} with { variant "PRESENCE(iei = BSSLAP_IEI_MS_POWER)" };
+
+/* Section 5.22 */
+type record BSSLAP_IE_DeltaTimer {
+	BSSLAP_IEI		iei,
+	uint8_t			timer_val
+} with { variant "PRESENCE(iei = BSSLAP_IEI_MS_POWER)" };
+
+/* Section 5.23 */
+type record BSSLAP_IE_ServingCellId {
+	BSSLAP_IEI		iei,
+	uint8_t			len,
+	octetstring		val	// FIXME: like TS 08.08
+} with {
+	variant "PRESENCE(iei = BSSLAP_IEI_SERVING_CELL_ID)"
+	variant (len) "LENGTHTO(val)"
+};
+
+/* Section 5.24 */
+type record BSSLAP_IE_EncryptionKey {
+	BSSLAP_IEI		iei,
+	OCT8			kc
+} with { variant "PRESENCE(iei = BSSLAP_IEI_ENCR_KEY)" };
+
+/* Section 5.25 */
+type record BSSLAP_IE_CiphModeSet {
+	BSSLAP_IEI		iei,
+	BIT1			spare,
+	BIT3			iei2,
+	BIT3			algo_id,
+	boolean			sc
+} with { variant "PRESENCE(iei = BSSLAP_IEI_CIPH_MODE_SET)" };
+
+/* Section 5.26 */
+type record BSSLAP_IE_ChanMode {
+	BSSLAP_IEI		iei,
+	OCT1			mode
+} with { variant "PRESENCE(iei = BSSLAP_IEI_CHAN_MODE)" };
+
+/* Section 5.27 */
+type record BSSLAP_IE_MultiRateConfig {
+	BSSLAP_IEI		iei,
+	uint8_t			len,
+	/* TODO: Unify with TS 48.018 */
+	uint3_t			mr_speech_ver,
+	boolean			nscb,
+	boolean			icmi,
+	BIT1			spare,
+	uint2_t			start_mode,
+	octetstring		parameters
+} with {
+	variant "PRESENCE(iei = BSSLAP_IEI_MR_CONFIG)"
+	variant (len) "LENGTHTO(mr_speech_ver,nscb,icmi,spare,start_mode,parameters)"
+};
+
+/* Section 5.28 */
+type record BSSLAP_IE_PollingRep {
+	BSSLAP_IEI		iei,
+	BIT2			spare,
+	uint6_t			num_rep
+} with { variant "PRESENCE(iei = BSSLAP_IEI_MR_CONFIG)" };
+
+/* Section 5.29 */
+type record BSSLAP_IE_PacketChanDesc {
+	BSSLAP_IEI		iei,
+	OCT4			chan_desc
+} with { variant "PRESENCE(iei = BSSLAP_IEI_PACKET_CHAN_DESC)" };
+
+/* Section 5.30 */
+type record BSSLAP_IE_TLLI {
+	BSSLAP_IEI		iei,
+	OCT4			tlli
+} with { variant "PRESENCE(iei = BSSLAP_IEI_TLLI)" };
+
+/* Section 5.31 */
+type record BSSLAP_IE_TFI {
+	BSSLAP_IEI		iei,
+	BIT3			spare,
+	uint5_t			tfi
+} with { variant "PRESENCE(iei = BSSLAP_IEI_TFI)" };
+
+/* Section 5.32 */
+type record BSSLAP_IE_StartingTime {
+	BSSLAP_IEI		iei,
+	uint5_t			t1_p,
+	uint6_t			t3,
+	uint6_t			t2
+} with { variant "PRESENCE(iei = BSSLAP_IEI_TBF_START_TIME)" };
+
+/* Section 5.33 */
+type record BSSLAP_IE_LongEncryptionKey {
+	BSSLAP_IEI		iei,
+	OCT16			kc
+} with { variant "PRESENCE(iei = BSSLAP_IEI_LONG_ENCR_KEY)" };
+
+/* Section 5.34 */
+type record BSSLAP_IE_ConcurMethodF {
+	BSSLAP_IEI		iei,
+	BSSLAP_ConcurMethodF	flag
+} with { variant "PRESENCE(iei = BSSLAP_IEI_CONCUR_POS_PROC_F)" };
+type enumerated BSSLAP_ConcurMethodF {
+	BSSLAP_SECOND_CONCUR_ALLOWED	('00000000'B),
+	BSSLAP_SECOND_CONCUR_DISALLOWED	('11111111'B)
+} with { variant "FIELDLENGTH(8)" };
+
+
+
+external function enc_BSSLAP_PDU(in BSSLAP_PDU msg) return octetstring
+	with { extension "prototype(convert) encode(RAW)" };
+external function dec_BSSLAP_PDU(in octetstring stream) return BSSLAP_PDU
+	with { extension "prototype(convert) decode(RAW)" };
+
+template (value) BSSLAP_PDU ts_BSSLAP_TA_Req := {
+	ta_req := {
+		msg_type := BSSLAP_MSGT_TA_REQUEST
+	}
+}
+template (present) BSSLAP_PDU tr_BSSLAP_TA_Req := {
+	ta_req := {
+		msg_type := BSSLAP_MSGT_TA_REQUEST
+	}
+}
+
+template (value) BSSLAP_PDU
+ts_BSSLAP_TA_Resp(uint16_t cell_id, uint8_t ta)  := {
+	ta_resp := {
+		msg_type := BSSLAP_MSGT_TA_RESPONSE,
+		serving_cell_id := ts_BSSLAP_IE_CellId(cell_id),
+		timing_advance := ts_BSSLAP_IE_TA(ta),
+		meas_rep := omit,
+		enh_meas_rep := omit,
+		meas_cell_id_list := omit,
+		concur_meth_flag := omit
+ 	}
+}
+template (present) BSSLAP_PDU
+tr_BSSLAP_TA_Resp(template (present) uint16_t cell_id, template (present) uint8_t ta)  := {
+	ta_resp := {
+		msg_type := BSSLAP_MSGT_TA_RESPONSE,
+		serving_cell_id := tr_BSSLAP_IE_CellId(cell_id),
+		timing_advance := tr_BSSLAP_IE_TA(ta),
+		meas_rep := *,
+		enh_meas_rep := *,
+		meas_cell_id_list := *,
+		concur_meth_flag := *
+ 	}
+}
+
+template (value) BSSLAP_PDU
+ts_BSSLAP_Reject(BSSLAP_Cause cause) := {
+	reject := {
+		msg_type := BSSLAP_MSGT_REJECT,
+		cause := ts_BSSLAP_IE_Cause(cause)
+	}
+}
+template (present) BSSLAP_PDU
+tr_BSSLAP_Reject(template (present) BSSLAP_Cause cause) := {
+	reject := {
+		msg_type := BSSLAP_MSGT_REJECT,
+		cause := tr_BSSLAP_IE_Cause(cause)
+	}
+}
+
+
+template (value) BSSLAP_PDU
+ts_BSSLAP_Abort(BSSLAP_Cause cause) := {
+	abort := {
+		msg_type := BSSLAP_MSGT_ABORT,
+		cause := ts_BSSLAP_IE_Cause(cause)
+	}
+}
+template (present) BSSLAP_PDU
+tr_BSSLAP_Abort(template (present) BSSLAP_Cause cause) := {
+	abort := {
+		msg_type := BSSLAP_MSGT_ABORT,
+		cause := tr_BSSLAP_IE_Cause(cause)
+	}
+}
+
+
+
+template (value) BSSLAP_IE_TimingAdvance ts_BSSLAP_IE_TA(uint8_t ta) := {
+	iei := BSSLAP_IEI_TA,
+	ta := ta
+}
+template (present) BSSLAP_IE_TimingAdvance tr_BSSLAP_IE_TA(template (present) uint8_t ta) := {
+	iei := BSSLAP_IEI_TA,
+	ta := ta
+}
+
+template (value) BSSLAP_IE_CellId ts_BSSLAP_IE_CellId(uint16_t cell_id) := {
+	iei := BSSLAP_IEI_CELL_ID,
+	cell_id := cell_id
+}
+template (present) BSSLAP_IE_CellId tr_BSSLAP_IE_CellId(template (present) uint16_t cell_id) := {
+	iei := BSSLAP_IEI_CELL_ID,
+	cell_id := cell_id
+}
+
+template (value) BSSLAP_IE_Cause ts_BSSLAP_IE_Cause(BSSLAP_Cause cause) := {
+	iei := BSSLAP_IEI_CAUSE,
+	cause := cause
+}
+template (present) BSSLAP_IE_Cause tr_BSSLAP_IE_Cause(template (present) BSSLAP_Cause cause) := {
+	iei := BSSLAP_IEI_CAUSE,
+	cause := cause
+}
+
+
+
+
+
+
+} with { encode "RAW" };
diff --git a/library/BSSMAP_LE_Templates.ttcn b/library/BSSMAP_LE_Templates.ttcn
new file mode 100644
index 0000000..70805e7
--- /dev/null
+++ b/library/BSSMAP_LE_Templates.ttcn
@@ -0,0 +1,434 @@
+module BSSMAP_LE_Templates {
+
+/* BSSMAP-LE Templates, building on top of BSSAP_LE_Types.
+ *
+ * (C) 2017-2020 by Harald Welte <laforge at gnumonks.org>
+ * contributions by sysmocom - s.f.m.c. GmbH
+ * All rights reserved.
+ *
+ * Released under the terms of GNU General Public License, Version 2 or
+ * (at your option) any later version.
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ */
+
+import from General_Types all;
+import from Osmocom_Types all;
+import from GSM_Types all;
+import from BSSAP_Types all;
+import from BSSAP_LE_Types all;
+import from BSSMAP_Templates all;
+import from L3_Templates all;
+
+function ts_BSSMAP_LE_LcsCause(template (omit) BSSMAP_LE_LcsCause cause)
+return template (omit) BSSMAP_LE_IE_LcsCause {
+	if (istemplatekind(cause, "omit")) {
+		return omit;
+	}
+	var template (omit) BSSMAP_LE_IE_LcsCause ie := {
+		iei := BSSMAP_LE_IEI_IMSI,
+		len := 0,
+		cause := cause,
+		diag_val := omit
+	}
+	return ie;
+}
+function tr_BSSMAP_LE_LcsCause(template BSSMAP_LE_LcsCause cause)
+return template BSSMAP_LE_IE_LcsCause {
+	if (istemplatekind(cause, "omit")) {
+		return omit;
+	}
+	var template BSSMAP_LE_IE_LcsCause ie := {
+		iei := BSSMAP_LE_IEI_IMSI,
+		len := ?,
+		cause := cause,
+		diag_val := *
+	}
+	return ie;
+}
+
+
+function ts_BSSMAP_LE_GeographicLoc(template (omit) octetstring loc)
+return template (omit) BSSMAP_LE_IE_GeographicLoc {
+	if (istemplatekind(loc, "omit")) {
+		return omit;
+	}
+	var template (omit) BSSMAP_LE_IE_GeographicLoc ie := {
+		iei := BSSMAP_LE_IEI_GEO_LOCATION,
+		len := 0,
+		location := loc
+	}
+	return ie;
+}
+function tr_BSSMAP_LE_GeographicLoc(template octetstring loc)
+return template BSSMAP_LE_IE_GeographicLoc {
+	if (istemplatekind(loc, "omit")) {
+		return omit;
+	}
+	var template BSSMAP_LE_IE_GeographicLoc ie := {
+		iei := BSSMAP_LE_IEI_GEO_LOCATION,
+		len := ?,
+		location := loc
+	}
+	return ie;
+}
+
+
+
+
+template (value) PDU_BSSAP_LE ts_BSSAP_LE_BSSMAP := {
+	discriminator := '0'B,
+	spare := '0000000'B,
+	dlci := omit,
+	lengthIndicator := 0,	/* overwritten by codec */
+	pdu := {
+		bssmap := -
+	}
+}
+
+template (present) PDU_BSSAP_LE tr_BSSAP_LE_BSSMAP := {
+	discriminator := '0'B,
+	spare := '0000000'B,
+	dlci := *,
+	lengthIndicator := ?,
+	pdu := {
+		bssmap := ?
+	}
+}
+
+template (value) PDU_BSSAP_LE ts_BSSAP_LE_DTAP(octetstring dtap, template (value) OCT1 dlci) := {
+	discriminator := '1'B,
+	spare := '0000000'B,
+	dlci := dlci,
+	lengthIndicator := 0,	/* overwritten by codec */
+	pdu := {
+		dtap := dtap
+	}
+}
+
+template (present) PDU_BSSAP_LE tr_BSSAP_LE_DTAP := {
+	discriminator := '1'B,
+	spare := '0000000'B,
+	dlci := *,
+	lengthIndicator := ?,
+	pdu := {
+		dtap := ?
+	}
+}
+
+function ts_BSSMAP_LE_IMSI(template (omit) hexstring imsi) return template (omit) BSSMAP_LE_IE_IMSI {
+	if (istemplatekind(imsi, "omit")) {
+		return omit;
+	}
+	template (value) BSSMAP_LE_IE_IMSI res := {
+		iei := BSSMAP_LE_IEI_IMSI,
+		len := 0,
+		imsi := ts_MI_IMSI(valueof(imsi))
+	};
+	return res;
+}
+function tr_BSSMAP_LE_IMSI(template hexstring imsi) return template BSSMAP_LE_IE_IMSI {
+	if (istemplatekind(imsi, "omit")) {
+		return omit;
+	}
+	template BSSMAP_LE_IE_IMSI res := {
+		iei := BSSMAP_LE_IEI_IMSI,
+		len := ?,
+		imsi := tr_MI_IMSI(imsi)
+	};
+	return res;
+}
+
+template (value) BSSMAP_LE_IE_LocationType ts_BSSMAP_LE_LocType(template (value) BSSMAP_LE_LocInfo li,
+								template (omit) BSSMAP_LE_PosMethod pm := omit) := {
+	iei := BSSMAP_LE_IEI_LOCATION_TYPE,
+	len := 0,
+	loc_info := li,
+	pos_method := pm
+}
+template (present) BSSMAP_LE_IE_LocationType tr_BSSMAP_LE_LocType(template (present) BSSMAP_LE_LocInfo li,
+								  template BSSMAP_LE_PosMethod pm := omit) := {
+	iei := BSSMAP_LE_IEI_LOCATION_TYPE,
+	len := ?,
+	loc_info := li,
+	pos_method := pm
+}
+
+
+/* Section 9.1 */
+template (value) PDU_BSSAP_LE ts_BSMAP_LE_PerfLocReq(BSSMAP_LE_LocInfo loc_info := BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC,
+						     template (value) BSSMAP_IE_CellIdentifier cell_id,
+						     template (omit) hexstring imsi)
+
+modifies ts_BSSAP_LE_BSSMAP := {
+	pdu := {
+		bssmap := {
+			perf_loc_req := {
+				msg_type := BSSMAP_LE_PERFORM_LOC_REQ,
+				location_type := ts_BSSMAP_LE_LocType(loc_info),
+				cell_id := cell_id,
+				cm3 := omit,
+				lcs_client_type := omit,
+				chosen_channel := omit,
+				lcs_priority := omit,
+				lcs_qos := omit,
+				req_gps_ass_d := omit,
+				bsslap_apdu := omit,
+				lcs_capability := omit,
+				packet_meas_rep := omit,
+				meas_cell_id_list := omit,
+				imsi := ts_BSSMAP_LE_IMSI(imsi),
+				imei := omit
+			}
+		}
+	}
+}
+template (present) PDU_BSSAP_LE tr_BSMAP_LE_PerfLocReq(BSSMAP_LE_LocInfo loc_info := BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC,
+						       template (present) BSSMAP_IE_CellIdentifier cell_id,
+						       template hexstring imsi)
+modifies tr_BSSAP_LE_BSSMAP := {
+	pdu := {
+		bssmap := {
+			perf_loc_req := {
+				msg_type := BSSMAP_LE_PERFORM_LOC_REQ,
+				location_type := tr_BSSMAP_LE_LocType(loc_info),
+				cell_id := cell_id,
+				cm3 := *,
+				lcs_client_type := *,
+				chosen_channel := *,
+				lcs_priority := *,
+				lcs_qos := *,
+				req_gps_ass_d := *,
+				bsslap_apdu := *,
+				lcs_capability := *,
+				packet_meas_rep := *,
+				meas_cell_id_list := *,
+				imsi := tr_BSSMAP_LE_IMSI(imsi),
+				imei := *
+			}
+		}
+	}
+}
+
+
+/* Section 9.2 */
+template (value) PDU_BSSAP_LE ts_BSMAP_LE_PerfLocResp(BSSMAP_LE_LocInfo loc_info := BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC,
+						      template (omit) octetstring geo_loc,
+						      template (omit) BSSMAP_LE_LcsCause cause)
+
+modifies ts_BSSAP_LE_BSSMAP := {
+	pdu := {
+		bssmap := {
+			perf_loc_resp := {
+				msg_type := BSSMAP_LE_PERFORM_LOC_RESP,
+				geographic_loc := ts_BSSMAP_LE_GeographicLoc(geo_loc),
+				pos_data := omit,
+				deciph_keys := omit,
+				lcs_cause := ts_BSSMAP_LE_LcsCause(cause),
+				velocity_data := omit,
+				ganss_pos_data := omit
+			}
+		}
+	}
+}
+template (present) PDU_BSSAP_LE tr_BSMAP_LE_PerfLocResp(template BSSMAP_LE_LocInfo loc_info := BSSMAP_LE_LOC_INFO_CURRENT_GEOGRAPHIC_LOC,
+							template octetstring geo_loc,
+							template BSSMAP_LE_LcsCause cause)
+modifies tr_BSSAP_LE_BSSMAP := {
+	pdu := {
+		bssmap := {
+			perf_loc_resp := {
+				msg_type := BSSMAP_LE_PERFORM_LOC_RESP,
+				geographic_loc := tr_BSSMAP_LE_GeographicLoc(geo_loc),
+				pos_data := *,
+				deciph_keys := *,
+				lcs_cause := tr_BSSMAP_LE_LcsCause(cause),
+				velocity_data := *,
+				ganss_pos_data := *
+			}
+		}
+	}
+}
+
+
+/* Section 9.8 */
+template (value) PDU_BSSAP_LE ts_BSSMAP_LE_ConnInfo(BSSMAP_LE_ProtocolId prot_id, octetstring data,
+						    template (omit) BSSMAP_LE_IE_Segmentation segm := omit)
+modifies ts_BSSAP_LE_BSSMAP := {
+	pdu := {
+		bssmap := {
+			co_info := {
+				msg_type := BSSMAP_LE_CONN_ORIENTED_INFO,
+				bsslap_apdu := {
+					iei := BSSMAP_LE_IEI_APDU,
+					len := 0,
+					spare := '0'B,
+					protocol_id := prot_id,
+					data := data
+				},
+				segmentation := segm
+			}
+		}
+	}
+}
+template (present) PDU_BSSAP_LE tr_BSSMAP_LE_ConnInfo(template (present) BSSMAP_LE_ProtocolId prot_id,
+						      template (present) octetstring data,
+						      template BSSMAP_LE_IE_Segmentation segm := omit)
+modifies tr_BSSAP_LE_BSSMAP := {
+	pdu := {
+		bssmap := {
+			co_info := {
+				msg_type := BSSMAP_LE_CONN_ORIENTED_INFO,
+				bsslap_apdu := {
+					iei := BSSMAP_LE_IEI_APDU,
+					len := ?,
+					spare := '0'B,
+					protocol_id := prot_id,
+					data := data
+				},
+				segmentation := segm
+			}
+		}
+	}
+}
+
+
+
+/* Section 9.10 */
+template (value) PDU_BSSAP_LE ts_BSSMAP_LE_Reset(myBSSMAP_Cause cause) modifies ts_BSSAP_LE_BSSMAP := {
+	pdu := {
+		bssmap := {
+			reset := {
+				msg_type := BSSMAP_LE_RESET,
+				cause := ts_BSSMAP_IE_Cause(enum2int(cause))
+			}
+		}
+	}
+}
+template (present) PDU_BSSAP_LE tr_BSSMAP_LE_Reset modifies tr_BSSAP_LE_BSSMAP := {
+	pdu := {
+		bssmap := {
+			reset := {
+				msg_type := BSSMAP_LE_RESET,
+				cause := ?
+			}
+		}
+	}
+}
+
+/* Section 9.11 */
+template (value) PDU_BSSAP_LE ts_BSSMAP_LE_ResetAck modifies ts_BSSAP_LE_BSSMAP := {
+	pdu := {
+		bssmap := {
+			reset := {
+				msg_type := BSSMAP_LE_RESET_ACK
+			}
+		}
+	}
+}
+template (present) PDU_BSSAP_LE tr_BSSMAP_LE_ResetAck modifies tr_BSSAP_LE_BSSMAP := {
+	pdu := {
+		bssmap := {
+			reset_ack := {
+				msg_type := BSSMAP_LE_RESET_ACK
+			}
+		}
+	}
+}
+
+function ts_BSSMAP_LE_APDU(BSSMAP_LE_ProtocolId prot_id, template (omit) octetstring data)
+return template (omit) BSSMAP_LE_IE_APDU {
+	var BSSMAP_LE_IE_APDU ie := {
+		iei := BSSMAP_LE_IEI_APDU,
+		len := 0, // overwritten
+		spare := '0'B,
+		protocol_id := prot_id
+	}
+	if (istemplatekind(data, "omit")) {
+		return omit;
+	}
+	ie.data := valueof(data);
+	return ie;
+}
+
+function tr_BSSMAP_LE_APDU(template BSSMAP_LE_ProtocolId prot_id, template octetstring data)
+return template BSSMAP_LE_IE_APDU {
+	var template BSSMAP_LE_IE_APDU ie := {
+		iei := BSSMAP_LE_IEI_APDU,
+		len := ?,
+		spare := '0'B,
+		protocol_id := prot_id
+	}
+	if (istemplatekind(data, "omit")) {
+		return omit;
+	} else if (istemplatekind(data, "*")) {
+		return *;
+	}
+	ie.data := valueof(data);
+	return ie;
+}
+
+
+/* Section 9.12 */
+template (value) PDU_BSSAP_LE ts_BSSMAP_LE_PerformLocInfo(BSSMAP_IE_CellIdentifier cell_id,
+							  BSSMAP_LE_ProtocolId prot_id,
+							  template (omit) octetstring data)
+modifies ts_BSSAP_LE_BSSMAP := {
+	pdu := {
+		bssmap := {
+			perf_loc_info := {
+				msg_type := BSSMAP_LE_PERFORM_LOC_INFO,
+				cell_id := cell_id,
+				bsslap_apdu := ts_BSSMAP_LE_APDU(prot_id, data)
+			}
+		}
+	}
+}
+template (present) PDU_BSSAP_LE tr_BSSMAP_LE_PerformLocInfo(template (present) BSSMAP_IE_CellIdentifier cell_id,
+							    template BSSMAP_LE_ProtocolId prot_id,
+							    template octetstring data)
+modifies tr_BSSAP_LE_BSSMAP := {
+	pdu := {
+		bssmap := {
+			perf_loc_info := {
+				msg_type := BSSMAP_LE_PERFORM_LOC_INFO,
+				cell_id := cell_id,
+				bsslap_apdu := tr_BSSMAP_LE_APDU(prot_id, data)
+			}
+		}
+	}
+}
+
+/* return Layer3 octetstring inside BSSAP-LE PDU */
+function f_bssap_le_extract_l3(PDU_BSSAP_LE bssap) return template octetstring {
+	if (ischosen(bssap.pdu.bssmap)) {
+		return omit;
+	} else {
+		return bssap.pdu.dtap;
+	}
+}
+
+
+template PDU_BSSAP_LE tr_BSSMAP_LE_Paging(template hexstring imsi_digits := ?,
+					template OCT4 tmsi := *,
+					template BSSMAP_IE_ChannelNeeded chneed := *)
+modifies tr_BSSAP_LE_BSSMAP := {
+	pdu := {
+		bssmap := {
+			paging := {
+				messageType := '52'O,
+				iMSI := tr_BSSMAP_Imsi(imsi_digits),
+				tMSI := tr_BSSMAP_IE_TMSI(tmsi) ifpresent,
+				cellIdentifierList := ?,
+				channelNeeded := chneed,
+				eMLPP_Priority := omit,
+				pagingInformation := omit /* only VGCS/VBS flag */
+			}
+		}
+	}
+}
+
+
+
+
+} with { encode "RAW" };

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/19764
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: If31830be2c8e1b624579f6663e74955763db9d0e
Gerrit-Change-Number: 19764
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200821/b354c7a0/attachment.htm>


More information about the gerrit-log mailing list