move GTP_CodecPort from ggsn to library (for sgsn reuse)

Change-Id: If1b25f3c4705fcf4763886b54c5ef1f7ae08628f
diff --git a/ggsn_tests/GTP_CodecPort.ttcn b/ggsn_tests/GTP_CodecPort.ttcn
deleted file mode 100644
index 7a3e755..0000000
--- a/ggsn_tests/GTP_CodecPort.ttcn
+++ /dev/null
@@ -1,83 +0,0 @@
-/* dual-faced 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 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 {
-		ConnectionId	connId,
-		HostName	remName,
-		PortNumber	remPort
-	}
-
-	/* Decoded GTP1C (Control Plane), used in send and receive direction */
-	type record Gtp1cUnitdata {
-		GtpPeer		peer,
-		PDU_GTPC	gtpc
-	}
-
-	/* Decoded GTP1U (User Plane), used in send and receive direction */
-	type record Gtp1uUnitdata {
-		GtpPeer		peer,
-		PDU_GTPU	gtpu
-	}
-
- 	/* Translation port on top of IPL4asp; ASP_Event passed through transparently */
-	type port GTPC_PT message {
-		out	Gtp1cUnitdata;
-		in	Gtp1cUnitdata,
-			ASP_ConnId_ReadyToRelease,
-			ASP_Event;
-	} with { extension "user IPL4asp_PT
-		out(Gtp1cUnitdata -> ASP_SendTo: function(f_enc_Gtp1cUD))
-		in(ASP_RecvFrom -> Gtp1cUnitdata: function(f_dec_Gtp1cUD);
-		   ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
-		   ASP_Event -> ASP_Event: simple)" }
-
-	private function f_enc_Gtp1cUD(in Gtp1cUnitdata in_ud, out ASP_SendTo out_ud) {
-		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);
-	} with { extension "prototype(fast)" };
-
-	private function f_dec_Gtp1cUD(in ASP_RecvFrom in_ud, out Gtp1cUnitdata out_ud) {
-		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);
-	} with { extension "prototype(fast)" };
-
-
-	/* dual-faced port on top of IPL4asp; ASP_Event passed through transparently */
-	type port GTPU_PT message {
-		out	Gtp1uUnitdata;
-		in	Gtp1uUnitdata,
-			ASP_ConnId_ReadyToRelease,
-			ASP_Event;
-	} with { extension "user IPL4asp_PT
-		out(Gtp1uUnitdata -> ASP_SendTo: function(f_enc_Gtp1uUD))
-		in(ASP_RecvFrom -> Gtp1uUnitdata: function(f_dec_Gtp1uUD);
-		   ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
-		   ASP_Event -> ASP_Event: simple)" }
-
-	function f_enc_Gtp1uUD(in Gtp1uUnitdata in_ud, out ASP_SendTo out_ud) {
-		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);
-	} with { extension "prototype(fast)" };
-
-	function f_dec_Gtp1uUD(in ASP_RecvFrom in_ud, out Gtp1uUnitdata out_ud) {
-		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);
-	} with { extension "prototype(fast)" };
-
-}
diff --git a/ggsn_tests/GTP_CodecPort_CtrlFunct.ttcn b/ggsn_tests/GTP_CodecPort_CtrlFunct.ttcn
deleted file mode 100644
index 4f61af7..0000000
--- a/ggsn_tests/GTP_CodecPort_CtrlFunct.ttcn
+++ /dev/null
@@ -1,50 +0,0 @@
-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;
-
-  external function f_GTPU_listen(
-    inout GTPU_PT portRef,
-    in HostName locName,
-    in PortNumber locPort,
-    in ProtoTuple proto,
-    in OptionList options := {}
-  ) return Result;
-}
diff --git a/ggsn_tests/GTP_CodecPort_CtrlFunctDef.cc b/ggsn_tests/GTP_CodecPort_CtrlFunctDef.cc
deleted file mode 100644
index c0b9391..0000000
--- a/ggsn_tests/GTP_CodecPort_CtrlFunctDef.cc
+++ /dev/null
@@ -1,66 +0,0 @@
-#include "IPL4asp_PortType.hh"
-#include "IPL4asp_PT.hh"
-#include "GTP_CodecPort.hh"
-
-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);
-  }
-
-
-  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);
-  }
-
-}
diff --git a/ggsn_tests/gen_links.sh b/ggsn_tests/gen_links.sh
index 1ab8009..c04d19e 100755
--- a/ggsn_tests/gen_links.sh
+++ b/ggsn_tests/gen_links.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 BASEDIR=../deps
 
@@ -48,5 +48,6 @@
 gen_links $DIR $FILES
 
 DIR=../library
-FILES="General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn"
+FILES="General_Types.ttcn GSM_Types.ttcn Osmocom_Types.ttcn Native_Functions.ttcn Native_FunctionDefs.cc IPCP_Types.ttcn "
+FILES+="GTP_CodecPort.ttcn GTP_CodecPort_CtrlFunct.ttcn GTP_CodecPort_CtrlFunctDef.cc "
 gen_links $DIR $FILES