add RSL_Types.ttcn - untested definitions defining GSM A-bis RSL
diff --git a/library/RSL_Types.ttcn b/library/RSL_Types.ttcn
new file mode 100644
index 0000000..129f441
--- /dev/null
+++ b/library/RSL_Types.ttcn
@@ -0,0 +1,669 @@
+module RSL_Types {
+
+	import from General_Types all;
+	import from Osmocom_Types all;
+	import from GSM_Types all;
+
+	/* Section 9.1 */
+	type enumerated RSL_MessageGroup {
+		RSL_MDISC_RESERVED	('0000000'B),
+		RSL_MDISC_RLL		('0000001'B),
+		RSL_MDISC_DCHAN		('0000100'B),
+		RSL_MDISC_CCHAN		('0000110'B),
+		RSL_MDISC_TRX_MGMT	('0001000'B),
+		RSL_MDISC_LCS		('0010000'B),
+		RSL_MDISC_IPACCESS	('0111111'B)
+	} with { variant "FIELDLENGTH(7)" };
+
+	/* Section 9.1 */
+	type record RSL_MessageDiscriminator {
+		RSL_MessageGroup	msg_group,
+		boolean			transparent
+	} with { variant "FIELDORDER(msb)" };
+
+	template RSL_MessageDiscriminator ts_RSL_MsgDisc(RSL_MessageGroup mg, boolean t := true) := {
+		msg_group := mg,
+		transparent := t
+	}
+
+	/* Section 9.2 */
+	type enumerated RSL_MessageType {
+		/* Radio Link Layer Management */
+		RSL_MT_DATA_REQ		('00000001'B),
+		RSL_MT_DATA_IND		('00000010'B),
+		RSL_MT_ERROR_IND	('00000011'B),
+		RSL_MT_EST_REQ		('00000100'B),
+		RSL_MT_EST_CONF		('00000101'B),
+		RSL_MT_EST_IND		('00000110'B),
+		RSL_MT_REL_REQ		('00000111'B),
+		RSL_MT_REL_CONF		('00001000'B),
+		RSL_MT_REL_IND		('00001001'B),
+		RSL_MT_UNIT_DATA_REQ	('00001010'B),
+		RSL_MT_UNIT_DATA_IND	('00001011'B),
+
+		/* non-standard below */
+		RSL_MT_SUSP_REQ		('00001100'B),
+		RSL_MT_SUSP_CONF	('00001101'B),
+		RSL_MT_RES_REQ		('00001110'B),
+		RSL_MT_RECON_REQ	('00001111'B),
+
+		/* Common Channel Management / TRX Management */
+		RSL_MT_BCCH_INFO	('00010001'B),
+		RSL_MT_CCCH_LOAD_IND,
+		RSL_MT_CHAN_RQD,
+		RSL_MT_DELETE_IND,
+		RSL_MT_PAGING_CMD,
+		RSL_MT_IMMEDIATE_ASSIGN_CMD,
+		RSL_MT_SMS_BC_REQ,
+		RSL_MT_CHAN_CONF,		/* non-standard element */
+		/* empty */
+		RSL_MT_RF_RES_IND	('00011001'B),
+		RSL_MT_SACCH_FILL,
+		RSL_MT_OVERLOAD,
+		RSL_MT_ERROR_REPORT,
+		RSL_MT_SMS_BC_CMD,
+		RSL_MT_CBCH_LOAD_IND,
+		RSL_MT_NOT_CMD,
+
+		/* Dedicate Channel Management */
+		RSL_MT_CHAN_ACTIV	('00100001'B),
+		RSL_MT_CHAN_ACTIV_ACK,
+		RSL_MT_CHAN_ACTIV_NACK,
+		RSL_MT_CONN_FAIL,
+		RSL_MT_DEACTIVATE_SACCH,
+		RSL_MT_ENCR_CMD,
+		RSL_MT_HANDO_DET,
+		RSL_MT_MEAS_RES,
+		RSL_MT_MODE_MODIFY_REQ,
+		RSL_MT_MODE_MODIFY_ACK,
+		RSL_MT_MODE_MODIFY_NACK,
+		RSL_MT_PHY_CONTEXT_REQ,
+		RSL_MT_PHY_CONTEXT_CONF,
+		RSL_MT_RF_CHAN_REL,
+		RSL_MT_MS_POWER_CONTROL,
+		RSL_MT_BS_POWER_CONTROL,		/* 0x30 */
+		RSL_MT_PREPROC_CONFIG,
+		RSL_MT_PREPROC_MEAS_RES,
+		RSL_MT_RF_CHAN_REL_ACK,
+		RSL_MT_SACCH_INFO_MODIFY,
+		RSL_MT_TALKER_DET,
+		RSL_MT_LISTENER_DET,
+		RSL_MT_REMOTE_CODEC_CONF_REP,
+		RSL_MT_RTD_REP,
+		RSL_MT_PRE_HANDO_NOTIF,
+		RSL_MT_MR_CODEC_MOD_REQ,
+		RSL_MT_MR_CODEC_MOD_ACK,
+		RSL_MT_MR_CODEC_MOD_NACK,
+		RSL_MT_MR_CODEC_MOD_PER,
+		RSL_MT_TFO_REP,
+		RSL_MT_TFO_MOD_REQ,		/* 0x3f */
+
+		RSL_MT_LOCATION_INFO		('01000001'B),
+
+		/* ip.access specific RSL message types */
+		RSL_MT_IPAC_DIR_RETR_ENQ	('01000000'B),
+
+		RSL_MT_IPAC_PDCH_ACT		('01001000'B),
+		RSL_MT_IPAC_PDCH_ACT_ACK,
+		RSL_MT_IPAC_PDCH_ACT_NACK,
+		RSL_MT_IPAC_PDCH_DEACT		('01001011'B),
+		RSL_MT_IPAC_PDCH_DEACT_ACK,
+		RSL_MT_IPAC_PDCH_DEACT_NACK,
+
+		RSL_MT_IPAC_CONNECT_MUX		('01010000'B),
+		RSL_MT_IPAC_CONNECT_MUX_ACK,
+		RSL_MT_IPAC_CONNECT_MUX_NACK,
+		RSL_MT_IPAC_BIND_MUX,
+		RSL_MT_IPAC_BIND_MUX_ACK,
+		RSL_MT_IPAC_BIND_MUX_NACK,
+		RSL_MT_IPAC_DISC_MUX,
+		RSL_MT_IPAC_DISC_MUX_ACK,
+		RSL_MT_IPAC_DISC_MUX_NACK,
+		RSL_MT_IPAC_MEAS_PREPROC_DFT 	('01100000'B),
+		RSL_MT_IPAC_HO_CAN_ENQ,
+		RSL_MT_IPAC_HO_CAN_RES,
+		RSL_MT_IPAC_CRCX,
+		RSL_MT_IPAC_CRCX_ACK,
+		RSL_MT_IPAC_CRCX_NACK,
+		RSL_MT_IPAC_MDCX,
+		RSL_MT_IPAC_MDCX_ACK,
+		RSL_MT_IPAC_MDCX_NACK,
+		RSL_MT_IPAC_DLCX_IND,
+		RSL_MT_IPAC_DLCX,
+		RSL_MT_IPAC_DLCX_ACK,
+		RSL_MT_IPAC_DLCX_NACK
+	} with { variant "FIELDLENGTH(8)" };
+
+	/*! RSL Information Element Identifiers (Chapter 9.3) */
+	type enumerated RSL_IE_Type {
+		RSL_IE_CHAN_NR			('00000001'B),
+		RSL_IE_LINK_IDENT,
+		RSL_IE_ACT_TYPE,
+		RSL_IE_BS_POWER,
+		RSL_IE_CHAN_IDENT,
+		RSL_IE_CHAN_MODE,
+		RSL_IE_ENCR_INFO,
+		RSL_IE_FRAME_NUMBER,
+		RSL_IE_HANDO_REF,
+		RSL_IE_L1_INFO,
+		RSL_IE_L3_INFO,
+		RSL_IE_MS_IDENTITY,
+		RSL_IE_MS_POWER,
+		RSL_IE_PAGING_GROUP,
+		RSL_IE_PAGING_LOAD,
+		RSL_IE_PYHS_CONTEXT,
+		RSL_IE_ACCESS_DELAY,
+		RSL_IE_RACH_LOAD,
+		RSL_IE_REQ_REFERENCE,
+		RSL_IE_RELEASE_MODE,
+		RSL_IE_RESOURCE_INFO,
+		RSL_IE_RLM_CAUSE,
+		RSL_IE_STARTNG_TIME,
+		RSL_IE_TIMING_ADVANCE,
+		RSL_IE_UPLINK_MEAS,
+		RSL_IE_CAUSE,
+		RSL_IE_MEAS_RES_NR,
+		RSL_IE_MSG_ID,
+		/* reserved */
+		RSL_IE_SYSINFO_TYPE		('00011110'B),
+		RSL_IE_MS_POWER_PARAM,
+		RSL_IE_BS_POWER_PARAM,
+		RSL_IE_PREPROC_PARAM,
+		RSL_IE_PREPROC_MEAS,
+		RSL_IE_IMM_ASS_INFO,		/* Phase 1 (3.6.0), later Full below */
+		RSL_IE_SMSCB_INFO,
+		RSL_IE_MS_TIMING_OFFSET,
+		RSL_IE_ERR_MSG,
+		RSL_IE_FULL_BCCH_INFO,
+		RSL_IE_CHAN_NEEDED,
+		RSL_IE_CB_CMD_TYPE,
+		RSL_IE_SMSCB_MSG,
+		RSL_IE_FULL_IMM_ASS_INFO,
+		RSL_IE_SACCH_INFO,
+		RSL_IE_CBCH_LOAD_INFO,
+		RSL_IE_SMSCB_CHAN_INDICATOR,
+		RSL_IE_GROUP_CALL_REF,
+		RSL_IE_CHAN_DESC,
+		RSL_IE_NCH_DRX_INFO,
+		RSL_IE_CMD_INDICATOR,
+		RSL_IE_EMLPP_PRIO,
+		RSL_IE_UIC,
+		RSL_IE_MAIN_CHAN_REF,
+		RSL_IE_MR_CONFIG,
+		RSL_IE_MR_CONTROL,
+		RSL_IE_SUP_CODEC_TYPES,
+		RSL_IE_CODEC_CONFIG,
+		RSL_IE_RTD,
+		RSL_IE_TFO_STATUS,
+		RSL_IE_LLP_APDU,
+
+		/* ip.access */
+		RSL_IE_IPAC_SRTP_CONFIG		('11100000'B),
+		RSL_IE_IPAC_PROXY_UDP,
+		RSL_IE_IPAC_BSCMPL_TOUT,
+
+		RSL_IE_IPAC_REMOTE_IP		('11110000'B),
+		RSL_IE_IPAC_REMOTE_PORT,
+		RSL_IE_IPAC_RTP_PAYLOAD,
+		RSL_IE_IPAC_LOCAL_PORT,
+		RSL_IE_IPAC_SPEECH_MODE,
+		RSL_IE_IPAC_LOCAL_IP,
+		RSL_IE_IPAC_CONN_STAT,
+		RSL_IE_IPAC_HO_C_PARMS,
+		RSL_IE_IPAC_CONN_ID,
+		RSL_IE_IPAC_RTP_CSD_FMT,
+		RSL_IE_IPAC_RTP_JIT_BUF,
+		RSL_IE_IPAC_RTP_COMPR,
+		RSL_IE_IPAC_RTP_PAYLOAD2,
+		RSL_IE_IPAC_RTP_MPLEX,
+		RSL_IE_IPAC_RTP_MPLEX_ID
+	} with { variant "FIELDLENGTH(8)" };
+
+	type record RSL_LV {
+		uint8_t		len,
+		octetstring	payload
+	} with { variant (len) "LENGTHTO(payload)" }
+
+	template RSL_LV ts_RSL_LV(template octetstring pl) := {
+		len := 0,
+		payload := pl
+	}
+
+	type record RSL_IE_V {
+		uint8_t		val
+	}
+
+	/* 9.3.3 */
+	type record RSL_IE_ActivationType {
+		boolean		reactivation,
+		uint4_t		reserved,
+		uint3_t		a_bits
+	}
+
+	template RSL_IE_ActivationType t_RSL_IE_ActType := {
+		reactivation := false,
+		reserved := 0,
+		a_bits := 0 /* related to immediate assignment */
+	}
+
+	/* 9.3.6 */
+	type enumerated RSL_SpeechDataInd {
+		RSL_SPDI_SPEECH		('00000001'B),
+		RSL_SPDI_DATA		('00000010'B),
+		RSL_SPDI_SIGN		('00000011'B)
+	} with { variant "FIELDLENGTH(8)" };
+	type enumerated RSL_ChanRateType {
+		RSL_CHRT_SDCCH		('00000001'B),
+		RSL_CHRT_TCH_F		('00001000'B),
+		RSL_CHRT_TCH_H		('00001001'B),
+		RSL_CHRT_TCH_F_BD_MSLOT	('00001010'B),
+		RSL_CHRT_TCH_F_DL_MSLOT	('00011010'B),
+		RSL_CHRT_TCH_F_GROUP	('00011000'B),
+		RSL_CHRT_TCH_H_GROUP	('00011001'B),
+		RSL_CHRT_TCH_F_BCAST	('00101000'B),
+		RSL_CHRT_TCH_H_BCAST	('00101001'B)
+	} with { variant "FIELDLENGTH(8)" };
+	type enumerated RSL_SpeechAlgo {
+		RSL_CMOD_NO_RESOURCE	('00000000'B),
+		RSL_CMOD_SP_GSM1	('00000001'B),
+		RSL_CMOD_SP_GSM2	('00010001'B),
+		RSL_CMOD_SP_GSM3	('00100001'B),
+		RSL_CMOD_SP_GSM4	('00110001'B),
+		RSL_CMOD_SP_GSM5	('00001001'B),
+		RSL_CMOD_SP_GSM6	('00001101'B)
+	} with { variant "FIELDLENGTH(8)" };
+	type record RSL_IE_ChannelMode {
+		BIT6		reserved,
+		boolean		dtx_d,
+		boolean		dtx_u,
+		RSL_SpeechDataInd spd_ind,
+		RSL_ChanRateType  ch_rate_type,
+		RSL_SpeechAlgo	coding_alg_rate
+	}
+
+	template RSL_IE_ChannelMode ts_RSL_ChanMode_SIGN := {
+		reserved := '000000'B,
+		dtx_d := false,
+		dtx_u := false,
+		spd_ind := RSL_SPDI_SIGN,
+		ch_rate_type := RSL_CHRT_SDCCH,
+		coding_alg_rate := RSL_CMOD_NO_RESOURCE
+	}
+
+	template RSL_IE_ChannelMode ts_RSL_ChanMode(RSL_ChanRateType t, RSL_SpeechAlgo alg) := {
+		reserved := '000000'B,
+		dtx_d := false,
+		dtx_u := false,
+		spd_ind := RSL_SPDI_SPEECH,
+		ch_rate_type := t,
+		coding_alg_rate := alg
+	}
+
+	/* 9.3.4 */
+	type record RSL_IE_BS_Power {
+		uint1_t 	reserved,
+		boolean		epc,
+		boolean		fpc,
+		uint5_t		power_level
+	}
+
+	/* 9.3.8 */
+	type record RSL_IE_FrameNumber {
+		uint5_t		t1_p,
+		uint6_t		t3,
+		uint5_t		t2
+	}
+	type RSL_IE_FrameNumber RSL_IE_StartingTime;
+
+	/* 9.3.10 */
+	type record RSL_IE_L1Info {
+		uint5_t		ms_power_lvl,
+		boolean		fpc,
+		uint2_t		reserved,
+		uint8_t		actual_ta
+	}
+
+	/* 9.3.13 */
+	type record RSL_IE_MS_Power {
+		uint2_t		reserved,
+		boolean		fpc_epc,
+		uint5_t		power_level
+	}
+
+	/* 9.3.19 */
+	type record RSL_IE_RequestRef {
+		OCT1		ra,
+		RSL_IE_FrameNumber frame_nr
+	}
+
+	/* 3GPP TS 44.018 / 10.5.2.38 Starting Time */
+	template RSL_IE_FrameNumber ts_RSL_IE_FrameNumber(GsmFrameNumber fn) := {
+		t1_p := (fn / 1326) mod 32,
+		t3 := fn mod 51,
+		t2 := fn mod 26
+	}
+
+	template RSL_IE_RequestRef ts_RSL_IE_ReqRef(OCT1 ra, GsmFrameNumber frame_nr) := {
+		ra := ra,
+		frame_nr := ts_RSL_IE_FrameNumber(frame_nr)
+	}
+
+	/* 9.3.26 */
+	type uint7_t RSL_Cause;
+	type record RSL_IE_Cause {
+		uint1_t		e,
+		RSL_Cause	cause,
+		octetstring	cause_ext optional
+	}
+
+	template RSL_IE_Cause ts_RSL_IE_Cause(RSL_Cause cause) := {
+		e := 0,
+		cause := cause,
+		cause_ext := omit
+	}
+
+	/* 9.3.40 */
+	type enumerated RSL_ChanNeeded {
+		RSL_CHANNEED_ANY	('00'B),
+		RSL_CHANNEED_SDCCH	('01'B),
+		RSL_CHANNEED_TCH_F	('10'B),
+		RSL_CHANNEED_TCH_ForH	('11'B)
+	}
+	type record RSL_IE_ChanNeeded {
+		uint6_t		reserved,
+		RSL_ChanNeeded	chan_needed
+	}
+
+	/* 9.3.53 */
+	type record RSL_IE_MultirateCtrl {
+		uint3_t		spare,
+		boolean		od,
+		boolean		pre,
+		uint2_t		rae,
+		boolean		tfo
+	}
+
+	type enumerated RSL_IE_SysinfoType {
+		RSL_SYSTEM_INFO_8	('00000000'B),
+		RSL_SYSTEM_INFO_1	('00000001'B),
+		RSL_SYSTEM_INFO_2	('00000010'B),
+		RSL_SYSTEM_INFO_3	('00000011'B),
+		RSL_SYSTEM_INFO_4	('00000100'B),
+		RSL_SYSTEM_INFO_5	('00000101'B),
+		RSL_SYSTEM_INFO_6	('00000110'B),
+		RSL_SYSTEM_INFO_7	('00000111'B),
+		RSL_SYSTEM_INFO_16	('00001000'B),
+		RSL_SYSTEM_INFO_17	('00001001'B),
+		RSL_SYSTEM_INFO_2bis	('00001010'B),
+		RSL_SYSTEM_INFO_2ter	('00001011'B),
+		RSL_SYSTEM_INFO_5bis	('00001101'B),
+		RSL_SYSTEM_INFO_5ter	('00001110'B),
+		RSL_SYSTEM_INFO_10	('00001111'B),
+		RSL_EXT_MEAS_ORDER	('01000111'B),
+		RSL_MEAS_INFO		('01001000'B),
+		RSL_SYSTEM_INFO_13	('00101000'B),
+		RSL_ERIC_SYSTEM_INFO_13 ('00001100'B),
+		RSL_SYSTEM_INFO_2quater ('00101001'B),
+		RSL_SYSTEM_INFO_9	('00101010'B),
+		RSL_SYSTEM_INFO_18	('00101011'B),
+		RSL_SYSTEM_INFO_19	('00101100'B),
+		RSL_SYSTEM_INFO_20	('00101101'B)
+	} with { variant "FIELDLENGTH(8)" }
+
+	/* union of all IE bodies */
+	type union RSL_IE_Body {
+		RslChannelNr		chan_nr,
+		RslLinkId		link_id,
+		RSL_LV			l3_info,
+		RSL_LV			rlm_cause,
+		uint8_t			release_mode,
+		RSL_IE_ActivationType	act_type,
+		RSL_IE_ChannelMode	chan_mode,
+		uint8_t			handover_ref,
+		RSL_IE_BS_Power		bs_power,
+		RSL_IE_MS_Power		ms_power,
+		uint8_t			timing_adv,
+		RSL_IE_MultirateCtrl	multirate_ctrl,
+		RSL_IE_FrameNumber	frame_nr,
+		RSL_IE_Cause		cause,
+		uint8_t			access_delay,
+		uint8_t			meas_res_nr,
+		RSL_IE_L1Info		l1_info,
+		RSL_IE_SysinfoType	sysinfo_type,
+		uint16_t		paging_load,
+		uint8_t			paging_group,
+		RSL_IE_ChanNeeded	chan_needed,
+		RSL_IE_StartingTime	starting_time,
+		RSL_IE_RequestRef	req_ref,
+		RSL_LV			full_imm_ass_info,
+
+		RSL_LV		other
+	}
+
+	type record RSL_IE {
+		RSL_IE_Type	iei,
+		RSL_IE_Body	body
+	} with { variant (body) "CROSSTAG(
+					chan_nr, iei = RSL_IE_CHAN_NR;
+					link_id, iei = RSL_IE_LINK_IDENT;
+					l3_info, iei = RSL_IE_L3_INFO;
+					rlm_cause, iei = RSL_IE_RLM_CAUSE;
+					release_mode, iei = RSL_IE_RELEASE_MODE;
+					act_type, iei = RSL_IE_ACT_TYPE;
+					chan_mode, iei = RSL_IE_CHAN_MODE;
+					handover_ref, iei = RSL_IE_HANDO_REF;
+					bs_power, iei = RSL_IE_BS_POWER;
+					ms_power, iei = RSL_IE_MS_POWER;
+					timing_adv, iei = RSL_IE_TIMING_ADVANCE;
+					multirate_ctrl, iei = RSL_IE_MR_CONTROL;
+
+					frame_nr, iei = RSL_IE_FRAME_NUMBER;
+					cause, iei = RSL_IE_CAUSE;
+					access_delay, iei = RSL_IE_ACCESS_DELAY;
+					meas_res_nr, iei = RSL_IE_MEAS_RES_NR;
+					l1_info, iei = RSL_IE_L1_INFO;
+					sysinfo_type, iei = RSL_IE_SYSINFO_TYPE;
+					paging_load, iei = RSL_IE_PAGING_LOAD;
+					paging_group, iei = RSL_IE_PAGING_GROUP;
+					chan_needed, iei = RSL_IE_CHAN_NEEDED;
+					starting_time, iei = RSL_IE_STARTNG_TIME;
+
+					req_ref, iei = RSL_IE_REQ_REFERENCE;
+
+					other, OTHERWISE;
+		)" };
+
+	template RSL_IE t_RSL_IE(template RSL_IE_Body body) := {
+		iei := RSL_IE_CHAN_NR, /* overwritten? */
+		body := body
+	}
+
+	type record of RSL_IE RSL_IE_List;
+
+	type record RSL_Message {
+		RSL_MessageDiscriminator	msg_disc,
+		RSL_MessageType			msg_type,
+		RSL_IE_List			ies optional
+	}
+
+	external function enc_RSL_Message(in RSL_Message msg) return octetstring
+		with { extension "prototype(convert) encode(RAW)" };
+	external function dec_RSL_Message(in octetstring stream) return RSL_Message
+		with { extension "prototype(convert) decode(RAW)" };
+
+	template RSL_Message tr_RSL_MsgType(RSL_MessageDiscriminator m_disc,
+				RSL_MessageType m_type) := {
+		msg_disc := m_disc,
+		msg_type := m_type,
+		ies := *
+	}
+
+	/* 8.3.1 BSC -> BTS */
+	template RSL_Message ts_RSL_DATA_REQ(RslChannelNr chan_nr, RslLinkId link_id, octetstring l3_info) := {
+		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_RLL, true),
+		msg_type := RSL_MT_DATA_REQ,
+		ies :={
+			t_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr}),
+			t_RSL_IE(RSL_IE_Body:{link_id := link_id}),
+			t_RSL_IE(RSL_IE_Body:{l3_info := ts_RSL_LV(l3_info)})
+		}
+	}
+
+	/* 8.3.2 BTS -> BSC */
+	template RSL_Message ts_RSL_DATA_IND(RslChannelNr chan_nr, RslLinkId link_id, octetstring l3_info) := {
+		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_RLL, true),
+		msg_type := RSL_MT_DATA_IND,
+		ies :={
+			t_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr}),
+			t_RSL_IE(RSL_IE_Body:{link_id := link_id}),
+			t_RSL_IE(RSL_IE_Body:{l3_info := ts_RSL_LV(l3_info)})
+		}
+	}
+
+	/* 8.3.3 BTS -> BSC */
+	template RSL_Message ts_RSL_ERROR_IND(RslChannelNr chan_nr, RslLinkId link_id, RSL_Cause cause) := {
+		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_RLL, false),
+		msg_type := RSL_MT_ERROR_IND,
+		ies :={
+			t_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr}),
+			t_RSL_IE(RSL_IE_Body:{link_id := link_id}),
+			t_RSL_IE(RSL_IE_Body:{cause := ts_RSL_IE_Cause(cause)})
+		}
+	}
+
+	/* 8.3.6 BTS -> BSC */
+	template RSL_Message ts_RSL_EST_IND(RslChannelNr chan_nr, RslLinkId link_id, octetstring l3_info) := {
+		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_RLL, false),
+		msg_type := RSL_MT_EST_IND,
+		ies := {
+			t_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr}),
+			t_RSL_IE(RSL_IE_Body:{link_id := link_id}),
+			t_RSL_IE(RSL_IE_Body:{l3_info := ts_RSL_LV(l3_info)})
+		}
+	}
+
+	/* 8.3.7 BSC -> BTS */
+	template RSL_Message ts_RSL_REL_REQ(RslChannelNr chan_nr, RslLinkId link_id) := {
+		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_RLL, false),
+		msg_type := RSL_MT_REL_REQ,
+		ies :={
+			t_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr}),
+			t_RSL_IE(RSL_IE_Body:{link_id := link_id})
+		}
+	}
+
+	/* 8.3.8 BTS -> BSC */
+	template RSL_Message ts_RSL_REL_CONF(RslChannelNr chan_nr, RslLinkId link_id) := {
+		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_RLL, false),
+		msg_type := RSL_MT_REL_CONF,
+		ies :={
+			t_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr}),
+			t_RSL_IE(RSL_IE_Body:{link_id := link_id})
+		}
+	}
+
+	/* 8.3.9 BTS -> BSC */
+	template RSL_Message ts_RSL_REL_IND(RslChannelNr chan_nr, RslLinkId link_id) := {
+		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_RLL, false),
+		msg_type := RSL_MT_REL_IND,
+		ies :={
+			t_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr}),
+			t_RSL_IE(RSL_IE_Body:{link_id := link_id})
+		}
+	}
+
+	/* 8.3.10 BSC -> BTS */
+	template RSL_Message ts_RSL_UNITDATA_REQ(RslChannelNr chan_nr, RslLinkId link_id, octetstring l3_info)
+	modifies ts_RSL_DATA_REQ := {
+		msg_type := RSL_MT_UNIT_DATA_REQ
+	}
+
+	/* 8.3.11 BTS -> BSC */
+	template RSL_Message ts_RSL_UNITDATA_IND(RslChannelNr chan_nr, RslLinkId link_id, octetstring l3_info)
+	modifies ts_RSL_DATA_IND := {
+		msg_type := RSL_MT_UNIT_DATA_IND
+	}
+
+
+	/* DEDICATED CANNEL MANAGEMENT MESSAGES */
+
+	/* 8.4.1 BSC -> BTS */
+	template RSL_Message ts_RSL_CHAN_ACT(RslChannelNr chan_nr, RSL_IE_ChannelMode mode) := {
+		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),
+		msg_type := RSL_MT_CHAN_ACTIV,
+		ies :={
+			t_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr}),
+			t_RSL_IE(RSL_IE_Body:{act_type := t_RSL_IE_ActType}),
+			t_RSL_IE(RSL_IE_Body:{chan_mode := mode})
+			/* lots of optional IEs */
+		}
+	}
+
+	/* 8.4.2 BTS -> BSC */
+	template RSL_Message ts_RSL_CHAN_ACT_ACK(RslChannelNr chan_nr, GsmFrameNumber fn) := {
+		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),
+		msg_type := RSL_MT_CHAN_ACTIV_ACK,
+		ies :={
+			t_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr}),
+			t_RSL_IE(RSL_IE_Body:{frame_nr := ts_RSL_IE_FrameNumber(fn)})
+		}
+	}
+
+	/* 8.4.3 BTS -> BSC */
+	template RSL_Message ts_RSL_CHAN_ACT_NACK(RslChannelNr chan_nr, RSL_Cause cause) := {
+		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),
+		msg_type := RSL_MT_CHAN_ACTIV_NACK,
+		ies :={
+			t_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr}),
+			t_RSL_IE(RSL_IE_Body:{cause := ts_RSL_IE_Cause(cause)})
+		}
+	}
+
+	/* 8.4.4 BTS -> BSC */
+	template RSL_Message ts_RSL_CONN_FAIL_IND(RslChannelNr chan_nr, RSL_Cause cause) := {
+		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),
+		msg_type := RSL_MT_CONN_FAIL,
+		ies :={
+			t_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr}),
+			t_RSL_IE(RSL_IE_Body:{cause := ts_RSL_IE_Cause(cause)})
+		}
+	}
+
+	/* 8.4.11 BTS -> BSC */
+	template RSL_Message ts_RSL_MODE_MODIFY_NACK(RslChannelNr chan_nr, RSL_Cause cause)
+	modifies ts_RSL_CHAN_ACT_NACK := {
+		msg_type := RSL_MT_MODE_MODIFY_NACK
+	}
+
+	/* COMMON CHANNEL MANAGEMENT MESSAGES */
+
+	/* 8.5.3 BTS -> BSC */
+	template RSL_Message ts_RSL_CHAN_RQD(OCT1 ra, GsmFrameNumber fn) := {
+		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_CCHAN, false),
+		msg_type := RSL_MT_CHAN_RQD,
+		ies := {
+			t_RSL_IE(RSL_IE_Body:{chan_nr := t_RslChanNr_RACH(0)}),
+			t_RSL_IE(RSL_IE_Body:{req_ref := ts_RSL_IE_ReqRef(ra, fn)})
+		}
+	}
+
+	/* 8.5.4 BTS -> BSC */
+	template RSL_Message ts_DELETE_IND(RslChannelNr chan_nr, octetstring imm_ass) := {
+		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_CCHAN, false),
+		msg_type := RSL_MT_DELETE_IND,
+		ies := {
+			t_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr}),
+			t_RSL_IE(RSL_IE_Body:{full_imm_ass_info := ts_RSL_LV(imm_ass)})
+		}
+	}
+
+	/* 8.6.4 BTS -> BSC */
+	template RSL_Message ts_RSL_ERROR_REPORT(RSL_Cause cause) := {
+		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_CCHAN, false),
+		msg_type := RSL_MT_ERROR_IND,
+		ies := {
+			t_RSL_IE(RSL_IE_Body:{cause := ts_RSL_IE_Cause(cause)})
+		}
+	}
+
+} with { encode "RAW" ; variant "FIELDORDER(msb)" }