Add GSMTAP_PortType dual-faced port
this can be stacked between the UDP socket (IPL4asp Port) and the actual test component(s) to provide transparante encode/decode of GSMTAP messages
This commit is contained in:
parent
164a28cbfb
commit
3d4df7f8f1
|
@ -0,0 +1,76 @@
|
|||
/* dual-faced port that wraps an IPL4asp port and encodes/decodes GSMTAP */
|
||||
module GSMTAP_PortType {
|
||||
import from GSMTAP_Types all;
|
||||
import from IPL4asp_PortType all;
|
||||
import from IPL4asp_Types all;
|
||||
|
||||
/* just like ASP_ReacFrom but with decoded GsmtapMessage */
|
||||
type record GSMTAP_RecvFrom {
|
||||
ConnectionId connId,
|
||||
HostName remName,
|
||||
PortNumber remPort,
|
||||
HostName locName,
|
||||
PortNumber locPort,
|
||||
ProtoTuple proto,
|
||||
UserData userData,
|
||||
GsmtapMessage msg
|
||||
}
|
||||
|
||||
/* just like ASP_Send but with decoded GsmtapMessage */
|
||||
type record GSMTAP_Send {
|
||||
ConnectionId connId,
|
||||
ProtoTuple proto,
|
||||
GsmtapMessage msg
|
||||
}
|
||||
|
||||
/* just like ASP_SendTo but with decoded GsmtapMessage */
|
||||
type record GSMTAP_SendTo {
|
||||
ConnectionId connId,
|
||||
HostName remName,
|
||||
PortNumber remPort,
|
||||
ProtoTuple proto,
|
||||
GsmtapMessage msg
|
||||
}
|
||||
|
||||
/* Convert RecvFrom from ASP to GSMTAP decoded */
|
||||
private function IPL4_to_GSMTAP(in ASP_RecvFrom pin, out GSMTAP_RecvFrom pout) {
|
||||
pout.connId := pin.connId;
|
||||
pout.remName := pin.remName;
|
||||
pout.remPort := pin.remPort;
|
||||
pout.locName := pin.locName;
|
||||
pout.locPort := pin.locPort;
|
||||
pout.proto := pin.proto;
|
||||
pout.userData := pin.userData;
|
||||
pout.msg := dec_GsmtapMessage(pin.msg);
|
||||
} with { extension "prototype(fast)" }
|
||||
|
||||
/* Convert SendTo from GSMTAP to ASP */
|
||||
private function GSMTAP_to_IPL4_SendTo(in GSMTAP_SendTo pin, out ASP_SendTo pout) {
|
||||
pout.connId := pin.connId;
|
||||
pout.remName := pin.remName;
|
||||
pout.remPort := pin.remPort;
|
||||
pout.proto := pin.proto;
|
||||
pout.msg := enc_GsmtapMessage(pin.msg);
|
||||
} with { extension "prototype(fast)" }
|
||||
|
||||
/* Convert SendTo from GSMTAP to ASP */
|
||||
private function GSMTAP_to_IPL4_Send(in GSMTAP_Send pin, out ASP_Send pout) {
|
||||
pout.connId := pin.connId;
|
||||
pout.proto := pin.proto;
|
||||
pout.msg := enc_GsmtapMessage(pin.msg);
|
||||
} with { extension "prototype(fast)" }
|
||||
|
||||
/* dual-faced port that converts from octetstring to decoded
|
||||
* GSMTAP and vice-versa */
|
||||
type port GSMTAP_PT message {
|
||||
out GSMTAP_Send
|
||||
out GSMTAP_SendTo
|
||||
in GSMTAP_RecvFrom
|
||||
in ASP_Event
|
||||
} with { extension "user IPL4asp_PT
|
||||
out(GSMTAP_Send -> ASP_Send: function(GSMTAP_to_IPL4_Send);
|
||||
GSMTAP_SendTo -> ASP_SendTo: function(GSMTAP_to_IPL4_SendTo))
|
||||
in(ASP_RecvFrom -> GSMTAP_RecvFrom: function(IPL4_to_GSMTAP);
|
||||
ASP_Event -> ASP_Event: simple)" }
|
||||
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
module IPL4_GSMTAP_CtrlFunct {
|
||||
|
||||
import from GSMTAP_PortType all;
|
||||
import from IPL4asp_Types all;
|
||||
|
||||
external function f_IPL4_listen(
|
||||
inout GSMTAP_PT portRef,
|
||||
in HostName locName,
|
||||
in PortNumber locPort,
|
||||
in ProtoTuple proto,
|
||||
in OptionList options := {}
|
||||
) return Result;
|
||||
|
||||
external function f_IPL4_connect(
|
||||
inout GSMTAP_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 GSMTAP_PT portRef,
|
||||
in ConnectionId id,
|
||||
in ProtoTuple proto := { unspecified := {} }
|
||||
) return Result;
|
||||
|
||||
external function f_IPL4_setUserData(
|
||||
inout GSMTAP_PT portRef,
|
||||
in ConnectionId id,
|
||||
in UserData userData
|
||||
) return Result;
|
||||
|
||||
external function f_IPL4_getUserData(
|
||||
inout GSMTAP_PT portRef,
|
||||
in ConnectionId id,
|
||||
out UserData userData
|
||||
) return Result;
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,56 @@
|
|||
#include "IPL4asp_PortType.hh"
|
||||
#include "GSMTAP_PortType.hh"
|
||||
#include "IPL4asp_PT.hh"
|
||||
|
||||
namespace IPL4__GSMTAP__CtrlFunct {
|
||||
|
||||
IPL4asp__Types::Result f__IPL4__listen(
|
||||
GSMTAP__PortType::GSMTAP__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(
|
||||
GSMTAP__PortType::GSMTAP__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(
|
||||
GSMTAP__PortType::GSMTAP__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(
|
||||
GSMTAP__PortType::GSMTAP__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(
|
||||
GSMTAP__PortType::GSMTAP__PT& portRef,
|
||||
const IPL4asp__Types::ConnectionId& connId,
|
||||
IPL4asp__Types::UserData& userData)
|
||||
{
|
||||
return f__IPL4__PROVIDER__getUserData(portRef, connId, userData);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
|
||||
FILES="*.ttcn IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc"
|
||||
FILES="*.ttcn IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc IPL4_GSMTAP_CtrlFunctDef.cc"
|
||||
|
||||
ttcn3_makefilegen -f Test.ttcn $FILES
|
||||
sed -i -e 's/# TTCN3_DIR = /TTCN3_DIR = \/usr/' Makefile
|
||||
|
|
Loading…
Reference in New Issue