summaryrefslogtreecommitdiffstats
path: root/sysinfo
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2017-07-14 22:05:56 +0200
committerHarald Welte <laforge@gnumonks.org>2017-07-14 22:05:56 +0200
commit3d4df7f8f14981d4a131ada389740a3f3a14976c (patch)
tree9f4e42c089b59d8b505a7994934454cd537e9489 /sysinfo
parent164a28cbfbe0ec64e23a2a44eed2be122810f1d8 (diff)
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
Diffstat (limited to 'sysinfo')
-rw-r--r--sysinfo/GSMTAP_PortType.ttcn76
-rw-r--r--sysinfo/IPL4_GSMTAP_CtrlFunct.ttcn44
-rw-r--r--sysinfo/IPL4_GSMTAP_CtrlFunctDef.cc56
-rwxr-xr-xsysinfo/regen_makefile.sh2
4 files changed, 177 insertions, 1 deletions
diff --git a/sysinfo/GSMTAP_PortType.ttcn b/sysinfo/GSMTAP_PortType.ttcn
new file mode 100644
index 0000000..69074df
--- /dev/null
+++ b/sysinfo/GSMTAP_PortType.ttcn
@@ -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)" }
+
+}
diff --git a/sysinfo/IPL4_GSMTAP_CtrlFunct.ttcn b/sysinfo/IPL4_GSMTAP_CtrlFunct.ttcn
new file mode 100644
index 0000000..8bdb592
--- /dev/null
+++ b/sysinfo/IPL4_GSMTAP_CtrlFunct.ttcn
@@ -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;
+
+}
+
diff --git a/sysinfo/IPL4_GSMTAP_CtrlFunctDef.cc b/sysinfo/IPL4_GSMTAP_CtrlFunctDef.cc
new file mode 100644
index 0000000..4c05fe8
--- /dev/null
+++ b/sysinfo/IPL4_GSMTAP_CtrlFunctDef.cc
@@ -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);
+ }
+
+}
+
diff --git a/sysinfo/regen_makefile.sh b/sysinfo/regen_makefile.sh
index 93e5fc5..bcf8c20 100755
--- a/sysinfo/regen_makefile.sh
+++ b/sysinfo/regen_makefile.sh
@@ -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