Revert "GTP: Attempt to use UDP_Testport instead of IPL4asp"

This reverts commit a967f3f50edd02aa8aaae1044d162758715ff040.
diff --git a/ggsn_tests/GTP_CodecPort.ttcn b/ggsn_tests/GTP_CodecPort.ttcn
index e610a0f..44c71e2 100644
--- a/ggsn_tests/GTP_CodecPort.ttcn
+++ b/ggsn_tests/GTP_CodecPort.ttcn
@@ -1,16 +1,16 @@
-/* Translation Port sitting on top of UDP_asp UDP to encode/decode GTP */
+/* Translation Port sitting on top of IPL4_asp UDP to encode/decode GTP */
 /* (C) 2017 by Harald Welte <laforge@gnumonks.org */
 module GTP_CodecPort {
-	import from UDPasp_PortType all;
-	import from UDPasp_Types all;
+	import from IPL4asp_PortType all;
+	import from IPL4asp_Types all;
 	import from GTPC_Types all;
 	import from GTPU_Types all;
 
 	/* identifies a remote peer (sender or receiver) */
 	type record GtpPeer {
-		integer		connId,
-		AddressType	remName,
-		PortType	remPort
+		ConnectionId	connId,
+		HostName	remName,
+		PortNumber	remPort
 	}
 
 	/* Decoded GTP1C (Control Plane), used in send and receive direction */
@@ -25,58 +25,60 @@
 		PDU_GTPU	gtpu
 	}
 
- 	/* Translation port on top of UDPasp; ASP_Event passed through transparently */
-	type port GTPC_PT message map to UDPasp_PT {
-		out	Gtp1cUnitdata to ASP_UDP_message with f_enc_Gtp1cUD(),
-			ASP_UDP_open,
-			ASP_UDP_close;
-		in	Gtp1cUnitdata from ASP_UDP_message with f_dec_Gtp1cUD(),
-			ASP_UDP_open_result;
-		inout	ASP_UDP;
+ 	/* Translation port on top of IPL4asp; ASP_Event passed through transparently */
+	type port GTPC_PT message map to IPL4asp_PT {
+		out	Gtp1cUnitdata to ASP_SendTo with f_enc_Gtp1cUD();
+		in	Gtp1cUnitdata from ASP_RecvFrom with f_dec_Gtp1cUD(),
+			ASP_Event;
 		/* we can declare variables here and use them from all functions with "port" label */
 	}
 
-	function f_enc_Gtp1cUD(in Gtp1cUnitdata in_ud, out ASP_UDP_message out_ud) port GTPC_PT {
-		out_ud.id := in_ud.peer.connId;
-		out_ud.remote_addr := in_ud.peer.remName;
-		out_ud.remote_port := in_ud.peer.remPort;
-		out_ud.data := enc_PDU_GTPC(in_ud.gtpc);
+	function f_enc_Gtp1cUD(in Gtp1cUnitdata in_ud, out ASP_SendTo out_ud) port GTPC_PT {
+		out_ud.connId := in_ud.peer.connId;
+		out_ud.remName := in_ud.peer.remName;
+		out_ud.remPort := in_ud.peer.remPort;
+		out_ud.proto := { udp := {} };
+		out_ud.msg := enc_PDU_GTPC(in_ud.gtpc);
 		port.setstate(0);
 	} with { extension "prototype(fast)" };
 
-	function f_dec_Gtp1cUD(in ASP_UDP_message in_ud, out Gtp1cUnitdata out_ud) port GTPC_PT {
-		out_ud.peer.connId := in_ud.id;
-		out_ud.peer.remName := in_ud.remote_addr;
-		out_ud.peer.remPort := in_ud.remote_port;
-		out_ud.gtpc := dec_PDU_GTPC(in_ud.data);
+	function f_dec_Gtp1cUD(in ASP_RecvFrom in_ud, out Gtp1cUnitdata out_ud) port GTPC_PT {
+		out_ud.peer.connId := in_ud.connId;
+		out_ud.peer.remName := in_ud.remName;
+		out_ud.peer.remPort := in_ud.remPort;
+		out_ud.gtpc := dec_PDU_GTPC(in_ud.msg);
 		port.setstate(0);
 	} with { extension "prototype(fast)" };
 
 
-	/* Translation port on top of UDPasp; ASP_Event passed through transparently */
-	type port GTPU_PT message map to UDPasp_PT {
-		out	Gtp1uUnitdata to ASP_UDP_message with f_enc_Gtp1uUD(),
-			ASP_UDP_open,
-			ASP_UDP_close;
-		in	Gtp1uUnitdata from ASP_UDP_message with f_dec_Gtp1uUD(),
-			ASP_UDP_open_result;
-		inout	ASP_UDP;
+	/* Translation port on top of IPL4asp; ASP_Event passed through transparently */
+	type port GTPU_PT message map to IPL4asp_PT {
+		out	Gtp1uUnitdata to ASP_SendTo with f_enc_Gtp1uUD();
+		in	Gtp1uUnitdata from ASP_RecvFrom with f_dec_Gtp1uUD(),
+			ASP_Event;
 		/* we can declare variables here and use them from all functions with "port" label */
 	}
 
-	function f_enc_Gtp1uUD(in Gtp1uUnitdata in_ud, out ASP_UDP_message out_ud) port GTPU_PT {
-		out_ud.id := in_ud.peer.connId;
-		out_ud.remote_addr := in_ud.peer.remName;
-		out_ud.remote_port := in_ud.peer.remPort;
-		out_ud.data := enc_PDU_GTPU(in_ud.gtpu);
+	function f_enc_Gtp1uUD(in Gtp1uUnitdata in_ud, out ASP_SendTo out_ud) port GTPU_PT {
+		out_ud.connId := in_ud.peer.connId;
+		out_ud.remName := in_ud.peer.remName;
+		out_ud.remPort := in_ud.peer.remPort;
+		out_ud.proto := { udp := {} };
+		out_ud.msg := enc_PDU_GTPU(in_ud.gtpu);
 		port.setstate(0);
 	} with { extension "prototype(fast)" };
 
-	function f_dec_Gtp1uUD(in ASP_UDP_message in_ud, out Gtp1uUnitdata out_ud) port GTPU_PT {
-		out_ud.peer.connId := in_ud.id;
-		out_ud.peer.remName := in_ud.remote_addr;
-		out_ud.peer.remPort := in_ud.remote_port;
-		out_ud.gtpu := dec_PDU_GTPU(in_ud.data);
+	function f_dec_Gtp1uUD(in ASP_RecvFrom in_ud, out Gtp1uUnitdata out_ud) port GTPU_PT {
+		out_ud.peer.connId := in_ud.connId;
+		out_ud.peer.remName := in_ud.remName;
+		out_ud.peer.remPort := in_ud.remPort;
+		out_ud.gtpu := dec_PDU_GTPU(in_ud.msg);
 		port.setstate(0);
 	} 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 := {} });
+	}
+*/
 }
diff --git a/ggsn_tests/GTP_CodecPort_CtrlFunct.ttcn b/ggsn_tests/GTP_CodecPort_CtrlFunct.ttcn
new file mode 100644
index 0000000..33a2cab
--- /dev/null
+++ b/ggsn_tests/GTP_CodecPort_CtrlFunct.ttcn
@@ -0,0 +1,43 @@
+module GTP_CodecPort_CtrlFunct {
+
+  import from GTP_CodecPort all;
+  import from IPL4asp_Types all;
+
+  external function f_IPL4_listen(
+    inout GTPC_PT portRef,
+    in HostName locName,
+    in PortNumber locPort,
+    in ProtoTuple proto,
+    in OptionList options := {}
+  ) return Result;
+
+  external function f_IPL4_connect(
+    inout GTPC_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 GTPC_PT portRef,
+    in ConnectionId id,
+    in ProtoTuple proto := { unspecified := {} }
+  ) return Result;
+
+  external function f_IPL4_setUserData(
+    inout GTPC_PT portRef,
+    in ConnectionId id,
+    in UserData userData
+  ) return Result;
+
+  external function f_IPL4_getUserData(
+    inout GTPC_PT portRef,
+    in ConnectionId id,
+    out UserData userData
+  ) return Result;
+
+}
diff --git a/ggsn_tests/GTP_CodecPort_CtrlFunctDef.cc b/ggsn_tests/GTP_CodecPort_CtrlFunctDef.cc
new file mode 100644
index 0000000..a8a014b
--- /dev/null
+++ b/ggsn_tests/GTP_CodecPort_CtrlFunctDef.cc
@@ -0,0 +1,58 @@
+#include "IPL4asp_PortType.hh"
+#include "IPL4asp_PT.hh"
+#include "GTP_CodecPort.hh"
+
+using namespace IPL4asp__PortType;
+using namespace IPL4asp__Types;
+
+namespace GTP__CodecPort__CtrlFunct {
+
+  IPL4asp__Types::Result f__IPL4__listen(
+    GTP__CodecPort::GTPC__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(
+    GTP__CodecPort::GTPC__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(
+    GTP__CodecPort::GTPC__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(
+    GTP__CodecPort::GTPC__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(
+    GTP__CodecPort::GTPC__PT& portRef,
+    const IPL4asp__Types::ConnectionId& connId,
+    IPL4asp__Types::UserData& userData)
+  {
+    return f__IPL4__PROVIDER__getUserData(portRef, connId, userData);
+  }
+  
+}
diff --git a/ggsn_tests/gen_links.sh b/ggsn_tests/gen_links.sh
index abbe534..7d2b013 100755
--- a/ggsn_tests/gen_links.sh
+++ b/ggsn_tests/gen_links.sh
@@ -23,8 +23,8 @@
 FILES="Socket_API_Definitions.ttcn"
 gen_links $DIR $FILES
 
-DIR=$BASEDIR/titan.TestPorts.UDPasp/src
-FILES="UDPasp_PT.cc  UDPasp_PT.hh  UDPasp_PortType.ttcn  UDPasp_Types.ttcn"
+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=../GTP_v13.5.0_CNL113843_LATEST/src
diff --git a/ggsn_tests/regen_makefile.sh b/ggsn_tests/regen_makefile.sh
index 9939016..2668873 100755
--- a/ggsn_tests/regen_makefile.sh
+++ b/ggsn_tests/regen_makefile.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-FILES="*.ttcn  UDPasp_PT.cc  TCCConversion.cc  TCCInterface.cc GTPC_EncDec.cc GTPU_EncDec.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 GTPC_PT.cc GTPU_PT.cc"
 
 ttcn3_makefilegen -f GGSN_Tests.ttcn $FILES
 sed -i -e 's/# TTCN3_DIR = /TTCN3_DIR = \/usr/' Makefile