From a7261d7312ba572a679f68c167242e572dd4ca22 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sat, 18 Nov 2017 13:28:07 +0100 Subject: mgw: Add RTP_CodecPort throguh which we can send/receive RTP+RTCP --- mgw/RTP_CodecPort.ttcn | 61 +++++++++++++++++++++++++++++++++++++++ mgw/RTP_CodecPort_CtrlFunct.ttcn | 44 ++++++++++++++++++++++++++++ mgw/RTP_CodecPort_CtrlFunctDef.cc | 56 +++++++++++++++++++++++++++++++++++ mgw/gen_links.sh | 8 +++++ mgw/regen_makefile.sh | 2 +- 5 files changed, 170 insertions(+), 1 deletion(-) create mode 100644 mgw/RTP_CodecPort.ttcn create mode 100644 mgw/RTP_CodecPort_CtrlFunct.ttcn create mode 100644 mgw/RTP_CodecPort_CtrlFunctDef.cc (limited to 'mgw') diff --git a/mgw/RTP_CodecPort.ttcn b/mgw/RTP_CodecPort.ttcn new file mode 100644 index 00000000..f9293f4d --- /dev/null +++ b/mgw/RTP_CodecPort.ttcn @@ -0,0 +1,61 @@ +module RTP_CodecPort { + + import from IPL4asp_PortType all; + import from IPL4asp_Types all; + import from RTP_Types all; + + type record RTP_RecvFrom { + ConnectionId connId, + HostName remName, + PortNumber remPort, + HostName locName, + PortNumber locPort, + RTP_messages_union msg + }; + + template RTP_RecvFrom t_RTP_RecvFrom(template RTP_messages_union msg) := { + connId := ?, + remName := ?, + remPort := ?, + locName := ?, + locPort := ?, + msg := msg + } + + type record RTP_Send { + ConnectionId connId, + RTP_messages_union msg + } + + template RTP_Send t_RTP_Send(template ConnectionId connId, template RTP_messages_union msg) := { + connId := connId, + msg := msg + } + + private function IPL4_to_RTP_RecvFrom(in ASP_RecvFrom pin, out RTP_RecvFrom pout) { + pout.connId := pin.connId; + pout.remName := pin.remName; + pout.remPort := pin.remPort; + pout.locName := pin.locName; + pout.locPort := pin.locPort; + pout.msg := f_RTP_dec(pin.msg) + } with { extension "prototype(fast)" }; + + private function RTP_to_IPL4_Send(in RTP_Send pin, out ASP_Send pout) { + pout.connId := pin.connId; + pout.proto := { udp := {} }; + pout.msg := f_RTP_enc(pin.msg); + } with { extension "prototype(fast)" }; + + type port RTP_CODEC_PT message { + out RTP_Send; + in RTP_RecvFrom, + ASP_ConnId_ReadyToRelease, + ASP_Event; + } with { extension "user IPL4asp_PT + out(RTP_Send -> ASP_Send:function(RTP_to_IPL4_Send)) + in(ASP_RecvFrom -> RTP_RecvFrom: function(IPL4_to_RTP_RecvFrom); + ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple; + ASP_Event -> ASP_Event: simple)" + } +} diff --git a/mgw/RTP_CodecPort_CtrlFunct.ttcn b/mgw/RTP_CodecPort_CtrlFunct.ttcn new file mode 100644 index 00000000..9f6cad2d --- /dev/null +++ b/mgw/RTP_CodecPort_CtrlFunct.ttcn @@ -0,0 +1,44 @@ +module RTP_CodecPort_CtrlFunct { + + import from RTP_CodecPort all; + import from IPL4asp_Types all; + + external function f_IPL4_listen( + inout RTP_CODEC_PT portRef, + in HostName locName, + in PortNumber locPort, + in ProtoTuple proto, + in OptionList options := {} + ) return Result; + + external function f_IPL4_connect( + inout RTP_CODEC_PT portRef, + in HostName remName, + in PortNumber remPort, + in HostName locName, + in PortNumber locPort, + in ConnectionId connId, + in ProtoTuple proto, + in OptionList options := {} + ) return Result; + + external function f_IPL4_close( + inout RTP_CODEC_PT portRef, + in ConnectionId id, + in ProtoTuple proto := { unspecified := {} } + ) return Result; + + external function f_IPL4_setUserData( + inout RTP_CODEC_PT portRef, + in ConnectionId id, + in UserData userData + ) return Result; + + external function f_IPL4_getUserData( + inout RTP_CODEC_PT portRef, + in ConnectionId id, + out UserData userData + ) return Result; + +} + diff --git a/mgw/RTP_CodecPort_CtrlFunctDef.cc b/mgw/RTP_CodecPort_CtrlFunctDef.cc new file mode 100644 index 00000000..ce8e176b --- /dev/null +++ b/mgw/RTP_CodecPort_CtrlFunctDef.cc @@ -0,0 +1,56 @@ +#include "IPL4asp_PortType.hh" +#include "RTP_CodecPort.hh" +#include "IPL4asp_PT.hh" + +namespace RTP__CodecPort__CtrlFunct { + + IPL4asp__Types::Result f__IPL4__listen( + RTP__CodecPort::RTP__CODEC__PT& portRef, + const IPL4asp__Types::HostName& locName, + const IPL4asp__Types::PortNumber& locPort, + const IPL4asp__Types::ProtoTuple& proto, + const IPL4asp__Types::OptionList& options) + { + return f__IPL4__PROVIDER__listen(portRef, locName, locPort, proto, options); + } + + IPL4asp__Types::Result f__IPL4__connect( + RTP__CodecPort::RTP__CODEC__PT& portRef, + const IPL4asp__Types::HostName& remName, + const IPL4asp__Types::PortNumber& remPort, + const IPL4asp__Types::HostName& locName, + const IPL4asp__Types::PortNumber& locPort, + const IPL4asp__Types::ConnectionId& connId, + const IPL4asp__Types::ProtoTuple& proto, + const IPL4asp__Types::OptionList& options) + { + return f__IPL4__PROVIDER__connect(portRef, remName, remPort, + locName, locPort, connId, proto, options); + } + + IPL4asp__Types::Result f__IPL4__close( + RTP__CodecPort::RTP__CODEC__PT& portRef, + const IPL4asp__Types::ConnectionId& connId, + const IPL4asp__Types::ProtoTuple& proto) + { + return f__IPL4__PROVIDER__close(portRef, connId, proto); + } + + IPL4asp__Types::Result f__IPL4__setUserData( + RTP__CodecPort::RTP__CODEC__PT& portRef, + const IPL4asp__Types::ConnectionId& connId, + const IPL4asp__Types::UserData& userData) + { + return f__IPL4__PROVIDER__setUserData(portRef, connId, userData); + } + + IPL4asp__Types::Result f__IPL4__getUserData( + RTP__CodecPort::RTP__CODEC__PT& portRef, + const IPL4asp__Types::ConnectionId& connId, + IPL4asp__Types::UserData& userData) + { + return f__IPL4__PROVIDER__getUserData(portRef, connId, userData); + } + +} + diff --git a/mgw/gen_links.sh b/mgw/gen_links.sh index 4b4e2b91..37c42a0f 100755 --- a/mgw/gen_links.sh +++ b/mgw/gen_links.sh @@ -31,3 +31,11 @@ DIR=$BASEDIR/titan.ProtocolModules.SDP/src FILES="SDP_EncDec.cc SDP_Types.ttcn SDP_parse_.tab.c SDP_parse_.tab.h SDP_parse_parser.h SDP_parser.l SDP_parser.y lex.SDP_parse_.c" gen_links $DIR $FILES + +DIR=$BASEDIR/titan.ProtocolModules.RTP/src +FILES="RTP_EncDec.cc RTP_Types.ttcn" +gen_links $DIR $FILES + +DIR=../library +FILES="General_Types.ttcn" +gen_links $DIR $FILES diff --git a/mgw/regen_makefile.sh b/mgw/regen_makefile.sh index ffdbd11e..752ff1b1 100755 --- a/mgw/regen_makefile.sh +++ b/mgw/regen_makefile.sh @@ -1,6 +1,6 @@ #!/bin/sh -FILES="*.ttcn SDP_EncDec.cc *.c MGCP_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc" +FILES="*.ttcn SDP_EncDec.cc *.c MGCP_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc RTP_EncDec.cc RTP_CodecPort_CtrlFunctDef.cc" ttcn3_makefilegen -f MGCP_Test.ttcn $FILES sed -i -e 's/# TTCN3_DIR = /TTCN3_DIR = \/usr/' Makefile -- cgit v1.2.3