GTP: convert from translation port to dual faced port
I spent numerous hours in trying to avoid the dual faced port from segfaulting, but in the end didn't succeed :( The easy way was then simply to fall back to the known-working pattern of the dual-faced port, which I already successfully used also on the NS module for the Gb Inteface
This commit is contained in:
parent
627c7c7dfa
commit
d418fc6bb5
|
@ -1,4 +1,4 @@
|
||||||
/* Translation Port sitting on top of IPL4_asp UDP to encode/decode GTP */
|
/* dual-faced port sitting on top of IPL4_asp UDP to encode/decode GTP */
|
||||||
/* (C) 2017 by Harald Welte <laforge@gnumonks.org */
|
/* (C) 2017 by Harald Welte <laforge@gnumonks.org */
|
||||||
module GTP_CodecPort {
|
module GTP_CodecPort {
|
||||||
import from IPL4asp_PortType all;
|
import from IPL4asp_PortType all;
|
||||||
|
@ -26,59 +26,54 @@ module GTP_CodecPort {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Translation port on top of IPL4asp; ASP_Event passed through transparently */
|
/* Translation port on top of IPL4asp; ASP_Event passed through transparently */
|
||||||
type port GTPC_PT message map to IPL4asp_PT {
|
type port GTPC_PT message {
|
||||||
out Gtp1cUnitdata to ASP_SendTo with f_enc_Gtp1cUD();
|
out Gtp1cUnitdata;
|
||||||
in Gtp1cUnitdata from ASP_RecvFrom with f_dec_Gtp1cUD(),
|
in Gtp1cUnitdata,
|
||||||
ASP_Event;
|
ASP_Event;
|
||||||
/* we can declare variables here and use them from all functions with "port" label */
|
} with { extension "user IPL4asp_PT
|
||||||
}
|
out(Gtp1cUnitdata -> ASP_SendTo: function(f_enc_Gtp1cUD))
|
||||||
|
in(ASP_RecvFrom -> Gtp1cUnitdata: function(f_dec_Gtp1cUD);
|
||||||
|
ASP_Event -> ASP_Event: simple)" }
|
||||||
|
|
||||||
function f_enc_Gtp1cUD(in Gtp1cUnitdata in_ud, out ASP_SendTo out_ud) port GTPC_PT {
|
private function f_enc_Gtp1cUD(in Gtp1cUnitdata in_ud, out ASP_SendTo out_ud) {
|
||||||
out_ud.connId := in_ud.peer.connId;
|
out_ud.connId := in_ud.peer.connId;
|
||||||
out_ud.remName := in_ud.peer.remName;
|
out_ud.remName := in_ud.peer.remName;
|
||||||
out_ud.remPort := in_ud.peer.remPort;
|
out_ud.remPort := in_ud.peer.remPort;
|
||||||
out_ud.proto := { udp := {} };
|
out_ud.proto := { udp := {} };
|
||||||
out_ud.msg := enc_PDU_GTPC(in_ud.gtpc);
|
out_ud.msg := enc_PDU_GTPC(in_ud.gtpc);
|
||||||
port.setstate(0);
|
|
||||||
} with { extension "prototype(fast)" };
|
} with { extension "prototype(fast)" };
|
||||||
|
|
||||||
function f_dec_Gtp1cUD(in ASP_RecvFrom in_ud, out Gtp1cUnitdata out_ud) port GTPC_PT {
|
private function f_dec_Gtp1cUD(in ASP_RecvFrom in_ud, out Gtp1cUnitdata out_ud) {
|
||||||
out_ud.peer.connId := in_ud.connId;
|
out_ud.peer.connId := in_ud.connId;
|
||||||
out_ud.peer.remName := in_ud.remName;
|
out_ud.peer.remName := in_ud.remName;
|
||||||
out_ud.peer.remPort := in_ud.remPort;
|
out_ud.peer.remPort := in_ud.remPort;
|
||||||
out_ud.gtpc := dec_PDU_GTPC(in_ud.msg);
|
out_ud.gtpc := dec_PDU_GTPC(in_ud.msg);
|
||||||
port.setstate(0);
|
|
||||||
} with { extension "prototype(fast)" };
|
} with { extension "prototype(fast)" };
|
||||||
|
|
||||||
|
|
||||||
/* Translation port on top of IPL4asp; ASP_Event passed through transparently */
|
/* dual-faced port on top of IPL4asp; ASP_Event passed through transparently */
|
||||||
type port GTPU_PT message map to IPL4asp_PT {
|
type port GTPU_PT message {
|
||||||
out Gtp1uUnitdata to ASP_SendTo with f_enc_Gtp1uUD();
|
out Gtp1uUnitdata;
|
||||||
in Gtp1uUnitdata from ASP_RecvFrom with f_dec_Gtp1uUD(),
|
in Gtp1uUnitdata,
|
||||||
ASP_Event;
|
ASP_Event;
|
||||||
/* we can declare variables here and use them from all functions with "port" label */
|
} with { extension "user IPL4asp_PT
|
||||||
}
|
out(Gtp1uUnitdata -> ASP_SendTo: function(f_enc_Gtp1uUD))
|
||||||
|
in(ASP_RecvFrom -> Gtp1uUnitdata: function(f_dec_Gtp1uUD);
|
||||||
|
ASP_Event -> ASP_Event: simple)" }
|
||||||
|
|
||||||
function f_enc_Gtp1uUD(in Gtp1uUnitdata in_ud, out ASP_SendTo out_ud) port GTPU_PT {
|
function f_enc_Gtp1uUD(in Gtp1uUnitdata in_ud, out ASP_SendTo out_ud) {
|
||||||
out_ud.connId := in_ud.peer.connId;
|
out_ud.connId := in_ud.peer.connId;
|
||||||
out_ud.remName := in_ud.peer.remName;
|
out_ud.remName := in_ud.peer.remName;
|
||||||
out_ud.remPort := in_ud.peer.remPort;
|
out_ud.remPort := in_ud.peer.remPort;
|
||||||
out_ud.proto := { udp := {} };
|
out_ud.proto := { udp := {} };
|
||||||
out_ud.msg := enc_PDU_GTPU(in_ud.gtpu);
|
out_ud.msg := enc_PDU_GTPU(in_ud.gtpu);
|
||||||
port.setstate(0);
|
|
||||||
} with { extension "prototype(fast)" };
|
} with { extension "prototype(fast)" };
|
||||||
|
|
||||||
function f_dec_Gtp1uUD(in ASP_RecvFrom in_ud, out Gtp1uUnitdata out_ud) port GTPU_PT {
|
function f_dec_Gtp1uUD(in ASP_RecvFrom in_ud, out Gtp1uUnitdata out_ud) {
|
||||||
out_ud.peer.connId := in_ud.connId;
|
out_ud.peer.connId := in_ud.connId;
|
||||||
out_ud.peer.remName := in_ud.remName;
|
out_ud.peer.remName := in_ud.remName;
|
||||||
out_ud.peer.remPort := in_ud.remPort;
|
out_ud.peer.remPort := in_ud.remPort;
|
||||||
out_ud.gtpu := dec_PDU_GTPU(in_ud.msg);
|
out_ud.gtpu := dec_PDU_GTPU(in_ud.msg);
|
||||||
port.setstate(0);
|
|
||||||
} with { extension "prototype(fast)" };
|
} with { extension "prototype(fast)" };
|
||||||
/*
|
|
||||||
function f_GTPC_listen(inout GTPC_PT portRef, in HostName locName,
|
|
||||||
in PortNumber locPort) return Result {
|
|
||||||
return f_IPL4_listen(portRef, locName, locPort, { udp := {} });
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,4 +40,11 @@ module GTP_CodecPort_CtrlFunct {
|
||||||
out UserData userData
|
out UserData userData
|
||||||
) return Result;
|
) return Result;
|
||||||
|
|
||||||
|
external function f_GTPU_listen(
|
||||||
|
inout GTPU_PT portRef,
|
||||||
|
in HostName locName,
|
||||||
|
in PortNumber locPort,
|
||||||
|
in ProtoTuple proto,
|
||||||
|
in OptionList options := {}
|
||||||
|
) return Result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
#include "IPL4asp_PT.hh"
|
#include "IPL4asp_PT.hh"
|
||||||
#include "GTP_CodecPort.hh"
|
#include "GTP_CodecPort.hh"
|
||||||
|
|
||||||
using namespace IPL4asp__PortType;
|
|
||||||
using namespace IPL4asp__Types;
|
|
||||||
|
|
||||||
namespace GTP__CodecPort__CtrlFunct {
|
namespace GTP__CodecPort__CtrlFunct {
|
||||||
|
|
||||||
IPL4asp__Types::Result f__IPL4__listen(
|
IPL4asp__Types::Result f__IPL4__listen(
|
||||||
|
@ -54,5 +51,16 @@ namespace GTP__CodecPort__CtrlFunct {
|
||||||
{
|
{
|
||||||
return f__IPL4__PROVIDER__getUserData(portRef, connId, userData);
|
return f__IPL4__PROVIDER__getUserData(portRef, connId, userData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
IPL4asp__Types::Result f__GTPU__listen(
|
||||||
|
GTP__CodecPort::GTPU__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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
FILES="*.ttcn IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc GTPC_EncDec.cc GTPU_EncDec.cc GTP_CodecPort_CtrlFunctDef.cc GTPC_PT.cc GTPU_PT.cc"
|
FILES="*.ttcn IPL4asp_PT.cc IPL4asp_discovery.cc TCCConversion.cc TCCInterface.cc GTPC_EncDec.cc GTPU_EncDec.cc GTP_CodecPort_CtrlFunctDef.cc"
|
||||||
|
|
||||||
ttcn3_makefilegen -f GGSN_Tests.ttcn $FILES
|
ttcn3_makefilegen -f GGSN_Tests.ttcn $FILES
|
||||||
sed -i -e 's/# TTCN3_DIR = /TTCN3_DIR = \/usr/' Makefile
|
sed -i -e 's/# TTCN3_DIR = /TTCN3_DIR = \/usr/' Makefile
|
||||||
|
|
Loading…
Reference in New Issue