library/IPA_Emulation: handle optional conn_id in ASP_RSL_Unitdata

This would allow the RSL Emulation component to maintain several
transceiver connections in server mode. In order to send an RSL
message to a specific transceiver, its TCP/IP connection ID needs
to be included in the ASP_RSL_Unitdata message.

Change-Id: I5c48d043cd746aad03e4329d9ffd2a627b640f64
Related: OS#4546
diff --git a/library/IPA_Emulation.ttcnpp b/library/IPA_Emulation.ttcnpp
index 1833a89..2148392 100644
--- a/library/IPA_Emulation.ttcnpp
+++ b/library/IPA_Emulation.ttcnpp
@@ -110,18 +110,23 @@
 #ifdef IPA_EMULATION_RSL
 /* like ASP_IPA_Unitdata, but with RSL_Message abstract type instead of octetstring */
 type record ASP_RSL_Unitdata {
+	integer		conn_id optional,
 	IpaStreamId	streamId,
 	RSL_Message	rsl
 };
 
 template (value) ASP_RSL_Unitdata ts_ASP_RSL_UD(template (value) RSL_Message rsl,
-						IpaStreamId sid := IPAC_PROTO_RSL_TRX0) := {
+						IpaStreamId sid := IPAC_PROTO_RSL_TRX0,
+						template (omit) integer conn_id := omit) := {
+	conn_id := conn_id,
 	streamId := sid,
 	rsl := rsl
 }
 
 template ASP_RSL_Unitdata tr_ASP_RSL_UD(template (present) RSL_Message rsl,
-					template IpaStreamId sid := IPAC_PROTO_RSL_TRX0) := {
+					template IpaStreamId sid := IPAC_PROTO_RSL_TRX0,
+					template integer conn_id := *) := {
+	conn_id := conn_id,
 	streamId := sid,
 	rsl := rsl
 }
@@ -479,8 +484,13 @@
 #ifdef IPA_EMULATION_RSL
 private function f_from_rsl(IPL4asp_Types.ConnectionId connId, ASP_RSL_Unitdata rsl_tx) return IPA_Send {
 	var octetstring payload := enc_RSL_Message(rsl_tx.rsl);
-	var IPA_Send ret := valueof(t_IPA_Send(connId, rsl_tx.streamId, payload));
-	return ret;
+
+	/* ASP_RSL_Unitdata may (optionally) contain TCP/IP connection ID */
+	if (rsl_tx.conn_id != omit) {
+		connId := rsl_tx.conn_id;
+	}
+
+	return valueof(t_IPA_Send(connId, rsl_tx.streamId, payload));
 }
 #endif
 
@@ -654,10 +664,11 @@
 #endif
 #ifdef IPA_EMULATION_RSL
 			case (t_IpaSidRSL) {
-				rsl := {
-					streamId := ipa_rx.streamId,
-					rsl := dec_RSL_Message(ipa_rx.msg)
-				};
+				rsl := valueof(ts_ASP_RSL_UD(
+					rsl := dec_RSL_Message(ipa_rx.msg),
+					sid := ipa_rx.streamId,
+					conn_id := ipa_rx.connId
+				));
 				IPA_RSL_PORT.send(rsl);
 			}
 #endif