msc: Introduce BSC_ConnHdlrNetworkPars

This record collects information about the network configuration,
such as whether or not authentication, tmsi allocation and/or
encryption are enabled.  The individual helper functions can then
react according to this information, without having to pass long
argument lists along the call chain.

Change-Id: I01a931f1cbbca4593fff2fd12689f040ceaa79b6
diff --git a/msc/MSC_Tests.ttcn b/msc/MSC_Tests.ttcn
index b6b38dd..90f308f 100644
--- a/msc/MSC_Tests.ttcn
+++ b/msc/MSC_Tests.ttcn
@@ -354,6 +354,12 @@
 /* FIXME: move into BSC_ConnectionHandler? */
 function f_start_handler(void_fn fn, charstring id, integer imsi_suffix) runs on MTC_CT return BSC_ConnHdlr {
 	var BSC_ConnHdlr vc_conn;
+	var BSC_ConnHdlrNetworkPars net_pars := {
+		kc_support := '0A'O,	/* A5/1 and A5/3 enabled */
+		expect_tmsi := true,
+		expect_auth := false,
+		expect_ciph := false
+	};
 	var BSC_ConnHdlrPars pars := {
 		sccp_addr_own := g_sccp_addr_own,
 		sccp_addr_peer := g_sccp_addr_peer,
@@ -364,7 +370,8 @@
 		tmsi := omit,
 		cm2 := valueof(ts_CM2_default),
 		cm3 := omit,
-		vec := omit
+		vec := omit,
+		net := net_pars
 	};
 
 	vc_conn := BSC_ConnHdlr.create(id);
@@ -400,7 +407,7 @@
 
 private function f_tc_lu_imsi_noauth_tmsi(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr {
 	f_init_handler(pars);
-	f_perform_lu(false, true, true);
+	f_perform_lu(true);
 }
 testcase TC_lu_imsi_noauth_tmsi() runs on MTC_CT {
 	var BSC_ConnHdlr vc_conn;
@@ -411,8 +418,9 @@
 }
 
 private function f_tc_lu_imsi_noauth_notmsi(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr {
+	pars.net.expect_tmsi := false;
 	f_init_handler(pars);
-	f_perform_lu(false, false, true);
+	f_perform_lu(true);
 }
 testcase TC_lu_imsi_noauth_notmsi() runs on MTC_CT {
 	var BSC_ConnHdlr vc_conn;
@@ -477,8 +485,9 @@
 }
 
 private function f_tc_lu_imsi_auth_tmsi(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr {
+	pars.net.expect_auth := true;
 	f_init_handler(pars);
-	f_perform_lu(true, true, true);
+	f_perform_lu(true);
 }
 testcase TC_lu_imsi_auth_tmsi() runs on MTC_CT {
 	var BSC_ConnHdlr vc_conn;
@@ -532,7 +541,7 @@
 	cpars.mgcp_connection_id_bss := '22222'H;
 	cpars.mgcp_connection_id_mss := '33333'H;
 
-	f_perform_lu(cpars.expect_auth, true, true);
+	f_perform_lu(true);
 	f_mo_call(cpars);
 }
 testcase TC_lu_and_mo_call() runs on MTC_CT {
@@ -883,7 +892,7 @@
 private function f_tc_emerg_call_imsi(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr {
 	f_init_handler(pars);
 	/* First perform location update to ensure subscriber is known */
-	f_perform_lu(false, true, true);
+	f_perform_lu(true);
 	/* Then issue emergency call identified by IMSI */
 	f_emerg_call(valueof(ts_MI_IMSI_LV(g_pars.imsi)));
 }
@@ -900,7 +909,7 @@
 	f_init_handler(pars);
 
 	/* First perform location update to ensure subscriber is known */
-	f_perform_lu(false, true, true);
+	f_perform_lu(true);
 
 	var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
 	var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_VGCS, mi));
@@ -921,7 +930,7 @@
 	f_init_handler(pars);
 
 	/* First perform location update to ensure subscriber is known */
-	f_perform_lu(false, true, true);
+	f_perform_lu(true);
 
 	var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
 	var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_VBS, mi));
@@ -942,7 +951,7 @@
 	f_init_handler(pars);
 
 	/* First perform location update to ensure subscriber is known */
-	f_perform_lu(false, true, true);
+	f_perform_lu(true);
 
 	var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
 	var PDU_ML3_MS_NW l3_info := valueof(ts_CM_SERV_REQ(CM_TYPE_LCS, mi));
@@ -963,7 +972,7 @@
 	f_init_handler(pars);
 
 	/* First perform location update to ensure subscriber is known */
-	f_perform_lu(false, true, true);
+	f_perform_lu(true);
 
 	var MobileIdentityLV mi := valueof(ts_MI_IMSI_LV(g_pars.imsi));
 	var PDU_ML3_MS_NW l3_info := valueof(ts_CM_REEST_REQ(0, mi));
@@ -1019,9 +1028,12 @@
 	vc_conn.done;
 }
 
+/* A5/1 + A5/3 permitted on network side, and MS capable to do it */
 private function f_tc_lu_imsi_auth_tmsi_encr_13_13(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr {
+	pars.net.expect_auth := true;
+	pars.net.expect_ciph := true;
 	f_init_handler(pars);
-	f_perform_lu(true, true, true, true);
+	f_perform_lu(true);
 }
 testcase TC_lu_imsi_auth_tmsi_encr_13_13() runs on MTC_CT {
 	var BSC_ConnHdlr vc_conn;
@@ -1106,9 +1118,9 @@
 private function f_tc_establish_and_nothing(charstring id, BSC_ConnHdlrPars pars) runs on BSC_ConnHdlr {
 	f_init_handler(pars);
 
-	f_perform_lu(false, true, true, false);
+	f_perform_lu(true);
 
-	f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)), false, false);
+	f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)));
 	f_expect_clear();
 }
 testcase TC_establish_and_nothing() runs on MTC_CT {
@@ -1125,9 +1137,9 @@
 
 	var CallParameters cpars := valueof(t_CallParams('12345'H, 0));
 
-	f_perform_lu(false, true, true, false);
+	f_perform_lu(true);
 
-	f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)), false, false);
+	f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)));
 	f_create_mncc_expect(hex2str(cpars.called_party));
 	f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
 
@@ -1150,9 +1162,9 @@
 	var MNCC_PDU mncc;
 	var MgcpCommand mgcp_cmd;
 
-	f_perform_lu(false, true, true, false);
+	f_perform_lu(true);
 
-	f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)), false, false);
+	f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)));
 	f_create_mncc_expect(hex2str(cpars.called_party));
 	f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
 
@@ -1184,9 +1196,9 @@
 	var MNCC_PDU mncc;
 	var MgcpCommand mgcp_cmd;
 
-	f_perform_lu(false, true, true, false);
+	f_perform_lu(true);
 
-	f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)), false, false);
+	f_establish_fully(valueof(ts_MI_IMSI_LV(g_pars.imsi)));
 	f_create_mncc_expect(hex2str(cpars.called_party));
 	f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
 
@@ -1246,7 +1258,7 @@
 	var MgcpCommand mgcp_cmd;
 	var OCT4 tmsi;
 
-	f_perform_lu(false, true, true, false);
+	f_perform_lu(true);
 	if (isvalue(g_pars.tmsi)) {
 		tmsi := g_pars.tmsi;
 	} else {
@@ -1262,7 +1274,7 @@
 	/* MSC->BSC: expect PAGING from MSC */
 	BSSAP.receive(tr_BSSMAP_Paging(g_pars.imsi));
 	/* MS -> MSC: PAGING RESPONSE */
-	f_establish_fully_pag(valueof(ts_MI_IMSI_LV(g_pars.imsi)), false, false);
+	f_establish_fully_pag(valueof(ts_MI_IMSI_LV(g_pars.imsi)));
 
 	f_create_mgcp_expect(ExpectCriteria:{omit,omit,omit});
 
@@ -1390,7 +1402,7 @@
 	cpars.mgcp_connection_id_mss := '33333'H;
 
 	/* Location Update to make subscriber known */
-	f_perform_lu(cpars.expect_auth, true, true);
+	f_perform_lu(true);
 
 	/* First MO call should succeed */
 	f_mo_call(cpars);