Introduce MGCP_CodecPort on top of UDP port

This commit is contained in:
Harald Welte 2017-09-16 00:50:08 +08:00
parent 12000e2a7a
commit 2c6dba145a
6 changed files with 171 additions and 17 deletions

45
mgw/MGCP_CodecPort.ttcn Normal file
View File

@ -0,0 +1,45 @@
module MGCP_CodecPort {
import from IPL4asp_PortType all;
import from IPL4asp_Types all;
import from MGCP_Types all;
type record MGCP_RecvFrom {
ConnectionId connId,
HostName remName,
PortNumber remPort,
HostName locName,
PortNumber locPort,
MgcpMessage msg
}
type record MGCP_Send {
ConnectionId connId,
MgcpMessage msg
}
private function IPL4_to_MGCP_RecvFrom(in ASP_RecvFrom pin, out MGCP_RecvFrom pout) {
pout.connId := pin.connId;
pout.remName := pin.remName;
pout.remPort := pin.remPort;
pout.locName := pin.locName;
pout.locPort := pin.locPort;
pout.msg := dec_MgcpMessage(oct2char(pin.msg));
} with { extension "prototype(fast)" };
private function MGCP_to_IPL4_Send(in MGCP_Send pin, out ASP_Send pout) {
pout.connId := pin.connId;
pout.proto := { udp := {} };
pout.msg := char2oct(enc_MgcpMessage(pin.msg));
} with { extension "prototype(fast)" };
type port MGCP_CODEC_PT message {
out MGCP_Send;
in MGCP_RecvFrom,
ASP_Event;
} with { extension "user IPL4asp_PT
out(MGCP_Send -> ASP_Send:function(MGCP_to_IPL4_Send))
in(ASP_RecvFrom -> MGCP_RecvFrom: function(IPL4_to_MGCP_RecvFrom);
ASP_Event -> ASP_Event: simple)"
}
}

View File

@ -0,0 +1,44 @@
module MGCP_CodecPort_CtrlFunct {
import from MGCP_CodecPort all;
import from IPL4asp_Types all;
external function f_IPL4_listen(
inout MGCP_CODEC_PT portRef,
in HostName locName,
in PortNumber locPort,
in ProtoTuple proto,
in OptionList options := {}
) return Result;
external function f_IPL4_connect(
inout MGCP_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 MGCP_CODEC_PT portRef,
in ConnectionId id,
in ProtoTuple proto := { unspecified := {} }
) return Result;
external function f_IPL4_setUserData(
inout MGCP_CODEC_PT portRef,
in ConnectionId id,
in UserData userData
) return Result;
external function f_IPL4_getUserData(
inout MGCP_CODEC_PT portRef,
in ConnectionId id,
out UserData userData
) return Result;
}

View File

@ -0,0 +1,56 @@
#include "IPL4asp_PortType.hh"
#include "MGCP_CodecPort.hh"
#include "IPL4asp_PT.hh"
namespace MGCP__CodecPort__CtrlFunct {
IPL4asp__Types::Result f__IPL4__listen(
MGCP__CodecPort::MGCP__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(
MGCP__CodecPort::MGCP__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(
MGCP__CodecPort::MGCP__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(
MGCP__CodecPort::MGCP__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(
MGCP__CodecPort::MGCP__CODEC__PT& portRef,
const IPL4asp__Types::ConnectionId& connId,
IPL4asp__Types::UserData& userData)
{
return f__IPL4__PROVIDER__getUserData(portRef, connId, userData);
}
}

View File

@ -33,11 +33,6 @@ module MGCP_Types {
variant "END('\r\n', '([\r\n])|(\r\n)')"
}
external function enc_MgcpCommandLine(in MgcpCommandLine id) return charstring
with { extension "prototype(convert) encode(TEXT)" };
external function dec_MgcpCommandLine(in charstring id) return MgcpCommandLine
with { extension "prototype(convert) decode(TEXT)" };
type record MgcpParameter {
MgcpInfoCode code,
charstring val optional
@ -48,20 +43,10 @@ module MGCP_Types {
variant "END('\r\n', '([\r\n])|(\r\n)')"
}
external function enc_MgcpParameter(in MgcpParameter id) return charstring
with { extension "prototype(convert) encode(TEXT)" };
external function dec_MgcpParameter(in charstring id) return MgcpParameter
with { extension "prototype(convert) decode(TEXT)" };
type record of MgcpParameter MgcpParameterList with {
variant "BEGIN('')"
};
external function enc_MgcpParameterList(in MgcpParameterList id) return charstring
with { extension "prototype(convert) encode(TEXT)" };
external function dec_MgcpParameterList(in charstring id) return MgcpParameterList
with { extension "prototype(convert) decode(TEXT)" };
type record MgcpCommand {
MgcpCommandLine line,
MgcpParameterList params optional,
@ -100,5 +85,17 @@ module MGCP_Types {
external function dec_MgcpResponse(in charstring id) return MgcpResponse
with { extension "prototype(convert) decode(TEXT)" };
type union MgcpMessage {
MgcpCommand command,
MgcpResponse response
} with {
variant "BEGIN('')"
}
external function enc_MgcpMessage(in MgcpMessage id) return charstring
with { extension "prototype(convert) encode(TEXT)" };
external function dec_MgcpMessage(in charstring id) return MgcpMessage
with { extension "prototype(convert) decode(TEXT)" };
} with { encode "TEXT" }

View File

@ -15,6 +15,18 @@ gen_links() {
#FILES="UD_PT.cc UD_PT.hh UD_PortType.ttcn UD_Types.ttcn"
#gen_links $DIR $FILES
DIR=$BASEDIR/titan.Libraries.TCCUsefulFunctions/src
FILES="TCCInterface_Functions.ttcn TCCConversion_Functions.ttcn TCCConversion.cc TCCConversion.hh TCCInterface.cc TCCInterface_ip.h"
gen_links $DIR $FILES
DIR=$BASEDIR/titan.TestPorts.Common_Components.Socket-API/src
FILES="Socket_API_Definitions.ttcn"
gen_links $DIR $FILES
DIR=$BASEDIR/titan.TestPorts.IPL4asp/src
FILES="IPL4asp_Functions.ttcn IPL4asp_PT.cc IPL4asp_PT.hh IPL4asp_PortType.ttcn IPL4asp_Types.ttcn IPL4asp_discovery.cc IPL4asp_protocol_L234.hh"
gen_links $DIR $FILES
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"

View File

@ -1,9 +1,9 @@
#!/bin/sh
FILES="*.ttcn SDP_EncDec.cc *.c"
FILES="*.ttcn SDP_EncDec.cc *.c MGCP_CodecPort_CtrlFunctDef.cc IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc"
ttcn3_makefilegen -f MGCP_Test.ttcn $FILES
sed -i -e 's/# TTCN3_DIR = /TTCN3_DIR = \/usr/' Makefile
sed -i -e 's/LDFLAGS = /LDFLAGS = -L \/usr\/lib\/titan/' Makefile
sed -i -e 's/TTCN3_LIB = ttcn3-parallel/TTCN3_LIB = ttcn3/' Makefile
#sed -i -e 's/TTCN3_LIB = ttcn3-parallel/TTCN3_LIB = ttcn3/' Makefile
sed -i -e 's/CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)\/include/CPPFLAGS = -D$(PLATFORM) -I$(TTCN3_DIR)\/include -I\/usr\/include\/titan/' Makefile