RTP_Emulation: Integrate IuUP support
Change-Id: I46de7fb9c324654275a27aa5f8c1be70340e3229
diff --git a/bsc/gen_links.sh b/bsc/gen_links.sh
index 5d8555a..4316966 100755
--- a/bsc/gen_links.sh
+++ b/bsc/gen_links.sh
@@ -76,5 +76,5 @@
gen_links $DIR $FILES
DIR=../library
-FILES="General_Types.ttcn Osmocom_Types.ttcn GSM_Types.ttcn IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcn L3_Templates.ttcn BSSMAP_Templates.ttcn BSSMAP_Emulation.ttcn RLCMAC_CSN1_Types.ttcn GSM_RR_Types.ttcn RSL_Types.ttcn RSL_Emulation.ttcn MGCP_Types.ttcn MGCP_Templates.ttcn MGCP_CodecPort.ttcn MGCP_CodecPort_CtrlFunct.ttcn MGCP_CodecPort_CtrlFunctDef.cc BSSAP_CodecPort.ttcn Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn RTP_CodecPort.ttcn RTP_CodecPort_CtrlFunct.ttcn RTP_CodecPort_CtrlFunctDef.cc RTP_Emulation.ttcn"
+FILES="General_Types.ttcn Osmocom_Types.ttcn GSM_Types.ttcn IPA_Types.ttcn IPA_CodecPort.ttcn IPA_CodecPort_CtrlFunct.ttcn IPA_CodecPort_CtrlFunctDef.cc IPA_Emulation.ttcn L3_Templates.ttcn BSSMAP_Templates.ttcn BSSMAP_Emulation.ttcn RLCMAC_CSN1_Types.ttcn GSM_RR_Types.ttcn RSL_Types.ttcn RSL_Emulation.ttcn MGCP_Types.ttcn MGCP_Templates.ttcn MGCP_CodecPort.ttcn MGCP_CodecPort_CtrlFunct.ttcn MGCP_CodecPort_CtrlFunctDef.cc BSSAP_CodecPort.ttcn Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn RTP_CodecPort.ttcn RTP_CodecPort_CtrlFunct.ttcn RTP_CodecPort_CtrlFunctDef.cc RTP_Emulation.ttcn IuUP_Types.ttcn IuUP_EncDec.cc IuUP_Emulation.ttcn"
gen_links $DIR $FILES
diff --git a/library/RTP_Emulation.ttcn b/library/RTP_Emulation.ttcn
index e55890e..f952510 100644
--- a/library/RTP_Emulation.ttcn
+++ b/library/RTP_Emulation.ttcn
@@ -21,6 +21,9 @@
import from RTP_CodecPort all;
import from RTP_CodecPort_CtrlFunct all;
+import from IuUP_Types all;
+import from IuUP_Emulation all;
+
type component RTP_Emulation_CT {
/* down-facing ports for RTP and RTCP codec ports on top of IPL4asp */
port RTP_CODEC_PT RTP;
@@ -32,7 +35,7 @@
port RTPEM_CTRL_PT CTRL;
/* configurable by user, should be fixed */
- var RtpemConfig g_cfg := c_default_cfg;
+ var RtpemConfig g_cfg := c_RtpemDefaultCfg;
var HostName g_remote_host;
var PortNumber g_remote_port;
@@ -47,6 +50,8 @@
var INT7b g_rx_payload_type := 0;
var LIN2_BO_LAST g_rx_last_seq;
var uint32_t g_rx_last_ts;
+
+ var IuUP_Entity g_iuup_ent; // := valueof(t_IuUP_Entity(1));
}
type enumerated RtpemMode {
@@ -61,15 +66,19 @@
integer tx_samplerate_hz,
integer tx_duration_ms,
BIT32_BO_LAST tx_ssrc,
- octetstring tx_fixed_payload optional
+ octetstring tx_fixed_payload optional,
+ boolean iuup_mode,
+ boolean iuup_tx_init
};
-const RtpemConfig c_default_cfg := {
+const RtpemConfig c_RtpemDefaultCfg := {
tx_payload_type := 0,
tx_samplerate_hz := 8000,
tx_duration_ms := 20,
tx_ssrc := '11011110101011011011111011101111'B,
- tx_fixed_payload := '01020304'O
+ tx_fixed_payload := '01020304'O,
+ iuup_mode := false,
+ iuup_tx_init := true
}
signature RTPEM_bind(in HostName local_host, inout PortNumber local_port);
@@ -98,6 +107,9 @@
}
private function f_tx_rtp(octetstring payload, BIT1 marker := '0'B) runs on RTP_Emulation_CT {
+ if (g_cfg.iuup_mode) {
+ payload := f_IuUP_Em_tx_encap(g_iuup_ent, payload);
+ }
var PDU_RTP rtp := valueof(ts_RTP(g_cfg.tx_ssrc, g_cfg.tx_payload_type, g_tx_next_seq,
g_tx_next_ts, payload, marker));
RTP.send(t_RTP_Send(g_rtp_conn_id, RTP_messages_union:{rtp:=rtp}));
@@ -128,6 +140,8 @@
tr_rtp.connId := g_rtcp_conn_id;
tr_rtcp.msg := { rtcp := ? };
+ g_iuup_ent := valueof(t_IuUP_Entity(g_cfg.iuup_tx_init));
+
while (true) {
alt {
/* control procedures (calls) from the user */
@@ -164,11 +178,13 @@
[] CTRL.getcall(RTPEM_mode:{RTPEM_MODE_NONE}) {
T_transmit.stop;
g_rx_enabled := false;
+ CTRL.reply(RTPEM_mode:{RTPEM_MODE_NONE});
}
[] CTRL.getcall(RTPEM_mode:{RTPEM_MODE_TXONLY}) {
/* start transmit timer */
T_transmit.start;
g_rx_enabled := false;
+ CTRL.reply(RTPEM_mode:{RTPEM_MODE_TXONLY});
}
[] CTRL.getcall(RTPEM_mode:{RTPEM_MODE_RXONLY}) {
@@ -179,6 +195,7 @@
RTCP.clear;
g_rx_enabled := true;
}
+ CTRL.reply(RTPEM_mode:{RTPEM_MODE_RXONLY});
}
[] CTRL.getcall(RTPEM_mode:{RTPEM_MODE_BIDIR}) {
T_transmit.start;
@@ -188,9 +205,12 @@
RTCP.clear;
g_rx_enabled := true;
}
+ CTRL.reply(RTPEM_mode:{RTPEM_MODE_BIDIR});
}
[] CTRL.getcall(RTPEM_configure:{?}) -> param (cfg) {
g_cfg := cfg;
+ g_iuup_ent.cfg.active_init := g_cfg.iuup_tx_init;
+ CTRL.reply(RTPEM_configure:{cfg});
}
/* simply ignore any RTTP/RTCP if receiver not enabled */
@@ -200,6 +220,9 @@
/* process received RTCP/RTP if receiver enabled */
[g_rx_enabled] RTP.receive(tr_rtp) -> value rx_rtp {
log("RX RTP: ", rx_rtp);
+ if (g_cfg.iuup_mode) {
+ rx_rtp.msg.rtp.data := f_IuUP_Em_rx_decaps(g_iuup_ent, rx_rtp.msg.rtp.data);
+ }
}
[g_rx_enabled] RTCP.receive(tr_rtcp) -> value rx_rtp {
log("RX RTCP: ", rx_rtp);