RTP_Emulation: Add convenience helper functions around procedure calls

Change-Id: I413aa2b86c2aebe8017112926fc88af0de4d43b7
This commit is contained in:
Harald Welte 2018-03-29 08:50:33 +02:00
parent 8d3ea0e3ec
commit 1af4033a7b
1 changed files with 30 additions and 0 deletions

View File

@ -160,6 +160,36 @@ type port RTPEM_CTRL_PT procedure {
inout RTPEM_bind, RTPEM_connect, RTPEM_mode, RTPEM_configure, RTPEM_stats_get;
} with { extension "internal" };
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.getreply(RTPEM_bind:{local_host, ?}) -> param (local_port) {};
}
}
function f_rtpem_connect(RTPEM_CTRL_PT pt, in HostName remote_host, in PortNumber remote_port) {
pt.call(RTPEM_connect:{remote_host, remote_port}) {
[] pt.getreply(RTPEM_connect:{remote_host, remote_port}) {};
}
}
function f_rtpem_mode(RTPEM_CTRL_PT pt, in RtpemMode mode) {
pt.call(RTPEM_mode:{mode}) {
[] pt.getreply(RTPEM_mode:{mode}) {};
}
}
function f_rtpem_configure(RTPEM_CTRL_PT pt, in RtpemConfig cfg) {
pt.call(RTPEM_configure:{cfg}) {
[] pt.getreply(RTPEM_configure:{cfg}) {};
}
}
function f_rtpem_stats_get(RTPEM_CTRL_PT pt, boolean rtcp := false) return RtpemStats {
var RtpemStats stats;
pt.call(RTPEM_stats_get:{-, rtcp}) {
[] pt.getreply(RTPEM_stats_get:{?, rtcp}) -> param(stats) {};
}
return stats;
}
template PDU_RTP ts_RTP(BIT32_BO_LAST ssrc, INT7b pt, LIN2_BO_LAST seq, uint32_t ts,
octetstring payload, BIT1 marker := '0'B) := {
version := 2,