library/RTP_Emulation: add optional port for RTP sniffing

Change-Id: I224d25aa298b5b512ab9e2a36c144e19c23d8462
This commit is contained in:
Vadim Yanitskiy 2021-07-04 03:42:31 +02:00 committed by laforge
parent 8c978ec94f
commit ed5129f313
1 changed files with 12 additions and 0 deletions

View File

@ -81,6 +81,8 @@ type component RTP_Emulation_CT {
/* user-facing port for controlling the binding */ /* user-facing port for controlling the binding */
port RTPEM_CTRL_PT CTRL; port RTPEM_CTRL_PT CTRL;
/* user-facing port for sniffing RTP frames */
port RTPEM_DATA_PT DATA;
/* configurable by user, should be fixed */ /* configurable by user, should be fixed */
var RtpemConfig g_cfg := c_RtpemDefaultCfg; var RtpemConfig g_cfg := c_RtpemDefaultCfg;
@ -186,6 +188,10 @@ type port RTPEM_CTRL_PT procedure {
RTPEM_conn_refuse_received; RTPEM_conn_refuse_received;
} with { extension "internal" }; } with { extension "internal" };
type port RTPEM_DATA_PT message {
inout PDU_RTP, PDU_RTCP;
} with { extension "internal" };
function f_rtpem_bind(RTPEM_CTRL_PT pt, in HostName local_host, inout PortNumber local_port) { function f_rtpem_bind(RTPEM_CTRL_PT pt, in HostName local_host, inout PortNumber local_port) {
pt.call(RTPEM_bind:{local_host, local_port}) { pt.call(RTPEM_bind:{local_host, local_port}) {
[] pt.getreply(RTPEM_bind:{local_host, ?}) -> param (local_port) {}; [] pt.getreply(RTPEM_bind:{local_host, ?}) -> param (local_port) {};
@ -515,10 +521,16 @@ function f_main() runs on RTP_Emulation_CT
if (g_cfg.iuup_mode) { if (g_cfg.iuup_mode) {
rx_rtp.msg.rtp.data := f_IuUP_Em_rx_decaps(g_iuup_ent, rx_rtp.msg.rtp.data); rx_rtp.msg.rtp.data := f_IuUP_Em_rx_decaps(g_iuup_ent, rx_rtp.msg.rtp.data);
} }
if (DATA.checkstate("Connected")) {
DATA.send(rx_rtp.msg.rtp);
}
} }
[g_rx_enabled] RTCP.receive(tr_rtcp) -> value rx_rtp { [g_rx_enabled] RTCP.receive(tr_rtcp) -> value rx_rtp {
//log("RX RTCP: ", rx_rtp); //log("RX RTCP: ", rx_rtp);
g_stats_rtcp.num_pkts_rx := g_stats_rtcp.num_pkts_rx+1; g_stats_rtcp.num_pkts_rx := g_stats_rtcp.num_pkts_rx+1;
if (DATA.checkstate("Connected")) {
DATA.send(rx_rtp.msg.rtcp);
}
} }
/* transmit if timer has expired */ /* transmit if timer has expired */