Allow Setting IuUP_Cfg from test using RTP_Emulation

Change-Id: I4e8296dae40277be51974338bc0d21c939eec149
diff --git a/hnodeb/HNBGW_ConnectionHandler.ttcn b/hnodeb/HNBGW_ConnectionHandler.ttcn
index 076cb82..6b06437 100644
--- a/hnodeb/HNBGW_ConnectionHandler.ttcn
+++ b/hnodeb/HNBGW_ConnectionHandler.ttcn
@@ -251,7 +251,7 @@
 	/* Initialize, connect and start the emulation component */
 	var RtpemConfig cfg := c_RtpemDefaultCfg;
 	cfg.iuup_mode := true;
-	cfg.iuup_tx_init := false;
+	cfg.iuup_cfg.active_init := false;
 	cfg.tx_payload_type := 96;
 
 	vc_RTPEM := RTP_Emulation_CT.create(testcasename() & "-RTPEM") alive;
diff --git a/library/IuUP_Emulation.ttcn b/library/IuUP_Emulation.ttcn
index 1bb2bb2..b649e44 100644
--- a/library/IuUP_Emulation.ttcn
+++ b/library/IuUP_Emulation.ttcn
@@ -26,6 +26,7 @@
 	/* IPTI value in number of ITIs for the corresponding RFCI */
 	uint8_t ipti
 };
+type record of IuUP_RabFlowCombination IuUP_RabFlowCombinationList;
 
 template (value) IuUP_RabFlowCombination t_IuUP_RFC(IuUP_RFCI rfci, RecOfU8 subflow_bits, uint8_t ipti) := {
 	rfci := rfci,
@@ -37,21 +38,50 @@
 template (value) IuUP_RabFlowCombination t_IuUP_RFC_AMR_SID(IuUP_RFCI rfci) := t_IuUP_RFC(rfci, {34, 0, 0}, 7);
 template (value) IuUP_RabFlowCombination t_IuUP_RFC_AMR_NO_DATA(IuUP_RFCI rfci) := t_IuUP_RFC(rfci, {0, 0, 0}, 1);
 
+
+const IuUP_RabFlowCombinationList c_IuUP_Config_RabFlowCombination_def := {
+	{
+		rfci := 0,
+		sub_flow_bits := {81, 103, 60},
+		ipti := 1
+	}, {
+		rfci := 1,
+		sub_flow_bits := {34, 0, 0},
+		ipti := 7
+	}, {
+		rfci := 2,
+		sub_flow_bits := {0, 0, 0},
+		ipti := 1
+	}
+};
 type record IuUP_Config {
 	/* actively send INIT (true) or only passively respond (false) */
 	boolean active_init,
 	boolean data_pdu_type_0,
 	/* RAB Flow Combinations */
-	record of IuUP_RabFlowCombination rab_flow_combs
+	IuUP_RabFlowCombinationList rab_flow_combs
 };
 
+template (value) IuUP_Config t_IuUP_Config(boolean active_init := true,
+					 boolean data_pdu_type_0 := true,
+					 template (value) IuUP_RabFlowCombinationList rab_flow_combs :=
+						c_IuUP_Config_RabFlowCombination_def) := {
+	active_init := active_init,
+	data_pdu_type_0 := true,
+	rab_flow_combs := rab_flow_combs
+}
+
+const IuUP_Config c_IuUP_Config_def := {
+	active_init := true,
+	data_pdu_type_0 := true,
+	rab_flow_combs := c_IuUP_Config_RabFlowCombination_def
+}
+
 type enumerated IuUP_Em_State {
 	ST_INIT,
 	ST_DATA_TRANSFER_READY
 };
 
-
-
 type record IuUP_Entity {
 	IuUP_Config cfg,
 	IuUP_Em_State state,
@@ -60,12 +90,8 @@
 	IuUP_PDU pending_tx_pdu optional
 };
 
-template (value) IuUP_Entity t_IuUP_Entity(boolean act_init) := {
-	cfg := {
-		active_init := act_init,
-		data_pdu_type_0 := true,
-		rab_flow_combs := { t_IuUP_RFC_AMR_12_2(0), t_IuUP_RFC_AMR_SID(1), t_IuUP_RFC_AMR_NO_DATA(2) }
-	},
+template (value) IuUP_Entity t_IuUP_Entity(template (value) IuUP_Config cfg) := {
+	cfg := cfg,
 	state := ST_INIT,
 	tx_next_frame_nr := 0,
 	rx_last_frame_nr := omit,
diff --git a/library/RTP_Emulation.ttcn b/library/RTP_Emulation.ttcn
index f4d926e..eaff017 100644
--- a/library/RTP_Emulation.ttcn
+++ b/library/RTP_Emulation.ttcn
@@ -161,7 +161,7 @@
 	octetstring tx_fixed_payload optional,
 	octetstring rx_fixed_payload optional,
 	boolean iuup_mode,
-	boolean iuup_tx_init
+	IuUP_Config iuup_cfg
 };
 
 const RtpemConfig c_RtpemDefaultCfg := {
@@ -172,7 +172,7 @@
 	tx_fixed_payload := '01020304'O,
 	rx_fixed_payload := '01020304'O,
 	iuup_mode := false,
-	iuup_tx_init := true
+	iuup_cfg := c_IuUP_Config_def
 }
 
 signature RTPEM_bind(in HostName local_host, inout PortNumber local_port);
@@ -384,7 +384,7 @@
 							      os_error_code := 111,
 							      os_error_text := ? /* "Connection refused" */}};
 
-	g_iuup_ent := valueof(t_IuUP_Entity(g_cfg.iuup_tx_init));
+	g_iuup_ent := valueof(t_IuUP_Entity(g_cfg.iuup_cfg));
 
 	while (true) {
 	alt {
@@ -488,7 +488,7 @@
 		}
 		[] CTRL.getcall(RTPEM_configure:{?}) -> param (cfg) {
 			g_cfg := cfg;
-			g_iuup_ent.cfg.active_init := g_cfg.iuup_tx_init;
+			g_iuup_ent.cfg := g_cfg.iuup_cfg;
 			CTRL.reply(RTPEM_configure:{cfg});
 		}
 		[] CTRL.getcall(RTPEM_stats_get:{?, ?}) -> param (is_rtcp) {
diff --git a/mgw/MGCP_Test.ttcn b/mgw/MGCP_Test.ttcn
index 9defea7..de00e9d 100644
--- a/mgw/MGCP_Test.ttcn
+++ b/mgw/MGCP_Test.ttcn
@@ -2482,7 +2482,7 @@
 		flow[0].rtp_cfg := c_RtpemDefaultCfg;
 		flow[0].rtp_cfg.tx_payload_type := flow[0].pt;
 		flow[0].rtp_cfg.iuup_mode := true;
-		flow[0].rtp_cfg.iuup_tx_init := true;
+		flow[0].rtp_cfg.iuup_cfg.active_init := true;
 		f_flow_create(RTPEM[0], ep, call_id, "recvonly", flow[0], true);
 		f_rtpem_mode(RTPEM[0], RTPEM_MODE_RXONLY);
 
@@ -2493,7 +2493,7 @@
 		flow[1].rtp_cfg := c_RtpemDefaultCfg;
 		flow[1].rtp_cfg.tx_payload_type := flow[1].pt;
 		flow[1].rtp_cfg.iuup_mode := true;
-		flow[1].rtp_cfg.iuup_tx_init := false;
+		flow[1].rtp_cfg.iuup_cfg.active_init := false;
 		f_flow_create(RTPEM[1], ep, call_id, "recvonly", flow[1], true);
 		f_rtpem_mode(RTPEM[1], RTPEM_MODE_RXONLY);
 
@@ -2601,7 +2601,7 @@
 		flow[0].rtp_cfg.tx_fixed_payload := '4f28959ffeb80181f5c4e83d176c897b4a4e333298333419a493ca63ded6e0'O;
 		flow[0].rtp_cfg.rx_fixed_payload := '08556d944c71a1a081e7ead204244480000ecd82b81118000097c4794e7740'O; /* flow[1].rtp_cfg.tx_fixed_payload converted AMR-BE-RTP->AMR-IUUP*/
 		flow[0].rtp_cfg.iuup_mode := true;
-		flow[0].rtp_cfg.iuup_tx_init := true;
+		flow[0].rtp_cfg.iuup_cfg.active_init := true;
 		f_flow_create(RTPEM[0], ep, call_id, "recvonly", flow[0], true);
 		f_rtpem_mode(RTPEM[0], RTPEM_MODE_RXONLY);