BSC_Tests: Implement ecnryption related procedures

Let's verify the operation of the CIPHERING MODE COMMAND as issued
by MSC, performed by BSC and implemented by simulated BTS/MS.

Change-Id: Ibc06bd2177c63837a794a0ca1f54ebef17499e78
diff --git a/library/RSL_Types.ttcn b/library/RSL_Types.ttcn
index 67e4dc9..0604440 100644
--- a/library/RSL_Types.ttcn
+++ b/library/RSL_Types.ttcn
@@ -330,6 +330,19 @@
 		uint5_t		power_level
 	}
 
+	/* 9.3.7 */
+	type record RSL_IE_EncryptionInfo {
+		uint8_t		len,
+		OCT1		alg_id,
+		octetstring	key
+	} with { variant (len) "LENGTHTO(alg_id,key)" };
+
+	template RSL_IE_EncryptionInfo tr_RSL_IE_EncrInfo(template OCT1 alg, template octetstring key) := {
+		len := ?,
+		alg_id := alg,
+		key := key
+	}
+
 	/* 9.3.8 */
 	type record RSL_IE_FrameNumber {
 		uint5_t		t1_p,
@@ -550,6 +563,7 @@
 		uint8_t			paging_group,
 		RSL_IE_ChanNeeded	chan_needed,
 		RSL_IE_StartingTime	starting_time,
+		RSL_IE_EncryptionInfo	encr_info,
 		RSL_IE_RequestRef	req_ref,
 		RSL_LV			full_imm_ass_info,
 		RSL_LV			ms_identity,
@@ -595,6 +609,7 @@
 					paging_group, iei = RSL_IE_PAGING_GROUP;
 					chan_needed, iei = RSL_IE_CHAN_NEEDED;
 					starting_time, iei = RSL_IE_STARTNG_TIME;
+					encr_info, iei = RSL_IE_ENCR_INFO;
 
 					req_ref, iei = RSL_IE_REQ_REFERENCE;
 					full_imm_ass_info, iei = RSL_IE_FULL_IMM_ASS_INFO;
@@ -852,6 +867,22 @@
 		}
 	}
 
+	/* 8.4.6 BSC ->BTS */
+	template RSL_Message tr_RSL_ENCR_CMD(template RslChannelNr chan_nr,
+					     template RslLinkId link_id := ?,
+					     template OCT1 alg := ?,
+					     template octetstring key := ?,
+					     template octetstring l3_info := ?) := {
+		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),
+		msg_type := RSL_MT_ENCR_CMD,
+		ies := {
+			tr_RSL_IE(RSL_IE_Body:{chan_nr := chan_nr}),
+			tr_RSL_IE(RSL_IE_Body:{encr_info := tr_RSL_IE_EncrInfo(alg, key)}),
+			tr_RSL_IE(RSL_IE_Body:{link_id := link_id}),
+			tr_RSL_IE(RSL_IE_Body:{l3_info := tr_RSL_L16V(l3_info)})
+		}
+	}
+
 	/* 8.4.10 BTS -> BSC */
 	template RSL_Message ts_RSL_MODE_MODIFY_ACK(RslChannelNr chan_nr) := {
 		msg_disc := ts_RSL_MsgDisc(RSL_MDISC_DCHAN, false),