Change in osmo-ttcn3-hacks[master]: Add SGsAP_CodecPort module

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Oct 10 20:31:17 UTC 2018


Harald Welte has uploaded this change for review. ( https://gerrit.osmocom.org/11306


Change subject: Add SGsAP_CodecPort module
......................................................................

Add SGsAP_CodecPort module

Change-Id: I530f8f444d1c7ea0bf11d510da7b97f64a2039f5
---
A library/SGsAP_CodecPort.ttcn
A library/SGsAP_CodecPort_CtrlFunct.ttcn
A library/SGsAP_CodecPort_CtrlFunctDef.cc
3 files changed, 172 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/06/11306/1

diff --git a/library/SGsAP_CodecPort.ttcn b/library/SGsAP_CodecPort.ttcn
new file mode 100644
index 0000000..2981fa2
--- /dev/null
+++ b/library/SGsAP_CodecPort.ttcn
@@ -0,0 +1,72 @@
+module SGsAP_CodecPort {
+
+/* Simple SGsAP Codec Port, translating between raw SCTP primitives with
+ * octetstring payload towards the IPL4asp provider, and SGsAP primitives
+ * which carry the decoded SGsAP data types as payload.
+ *
+ * (C) 2018 by Harald Welte <laforge at gnumonks.org>
+ * All rights reserved.
+ *
+ * Released under the terms of GNU General Public License, Version 2 or
+ * (at your option) any later version.
+ */
+
+	import from IPL4asp_PortType all;
+	import from IPL4asp_Types all;
+	import from SGsAP_Types all;
+
+	type record SGsAP_RecvFrom {
+		ConnectionId	connId,
+		HostName	remName,
+		PortNumber	remPort,
+		HostName	locName,
+		PortNumber	locPort,
+		PDU_SGsAP	msg
+	};
+
+	template SGsAP_RecvFrom t_SGsAP_RecvFrom(template PDU_SGsAP msg) := {
+		connId := ?,
+		remName := ?,
+		remPort := ?,
+		locName := ?,
+		locPort := ?,
+		msg := msg
+	}
+
+	type record SGsAP_Send {
+		ConnectionId	connId,
+		PDU_SGsAP	msg
+	}
+
+	template SGsAP_Send t_SGsAP_Send(template ConnectionId connId, template PDU_SGsAP msg) := {
+		connId := connId,
+		msg := msg
+	}
+
+	private function IPL4_to_SGsAP_RecvFrom(in ASP_RecvFrom pin, out SGsAP_RecvFrom pout) {
+		pout.connId := pin.connId;
+		pout.remName := pin.remName;
+		pout.remPort := pin.remPort;
+		pout.locName := pin.locName;
+		pout.locPort := pin.locPort;
+		pout.msg := dec_PDU_SGsAP(pin.msg);
+	} with { extension "prototype(fast)" };
+
+	private function SGsAP_to_IPL4_Send(in SGsAP_Send pin, out ASP_Send pout) {
+		pout.connId := pin.connId;
+		pout.proto := { sctp := {} };
+		pout.msg := enc_PDU_SGsAP(pin.msg);
+	} with { extension "prototype(fast)" };
+
+	type port SGsAP_CODEC_PT message {
+		out	SGsAP_Send;
+		in	SGsAP_RecvFrom,
+			ASP_ConnId_ReadyToRelease,
+			ASP_Event;
+	} with { extension "user IPL4asp_PT
+		out(SGsAP_Send -> ASP_Send:function(SGsAP_to_IPL4_Send))
+		in(ASP_RecvFrom -> SGsAP_RecvFrom: function(IPL4_to_SGsAP_RecvFrom);
+		   ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
+		   ASP_Event -> ASP_Event: simple)"
+	}
+}
diff --git a/library/SGsAP_CodecPort_CtrlFunct.ttcn b/library/SGsAP_CodecPort_CtrlFunct.ttcn
new file mode 100644
index 0000000..b09fc94
--- /dev/null
+++ b/library/SGsAP_CodecPort_CtrlFunct.ttcn
@@ -0,0 +1,44 @@
+module SGsAP_CodecPort_CtrlFunct {
+
+  import from SGsAP_CodecPort all;
+  import from IPL4asp_Types all;
+
+  external function f_IPL4_listen(
+    inout SGsAP_CODEC_PT portRef,
+    in HostName locName,
+    in PortNumber locPort,
+    in ProtoTuple proto,
+    in OptionList options := {}
+  ) return Result;
+
+  external function f_IPL4_connect(
+    inout SGsAP_CODEC_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 SGsAP_CODEC_PT portRef,
+    in ConnectionId id,
+    in ProtoTuple proto := { unspecified := {} }
+  ) return Result;
+
+  external function f_IPL4_setUserData(
+    inout SGsAP_CODEC_PT portRef,
+    in ConnectionId id,
+    in UserData userData
+  ) return Result;
+
+  external function f_IPL4_getUserData(
+    inout SGsAP_CODEC_PT portRef,
+    in ConnectionId id,
+    out UserData userData
+  ) return Result;
+
+}
+
diff --git a/library/SGsAP_CodecPort_CtrlFunctDef.cc b/library/SGsAP_CodecPort_CtrlFunctDef.cc
new file mode 100644
index 0000000..aa38e51
--- /dev/null
+++ b/library/SGsAP_CodecPort_CtrlFunctDef.cc
@@ -0,0 +1,56 @@
+#include "IPL4asp_PortType.hh"
+#include "SGsAP_CodecPort.hh"
+#include "IPL4asp_PT.hh"
+
+namespace SGsAP__CodecPort__CtrlFunct {
+
+  IPL4asp__Types::Result f__IPL4__listen(
+    SGsAP__CodecPort::SGsAP__CODEC__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(
+    SGsAP__CodecPort::SGsAP__CODEC__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(
+    SGsAP__CodecPort::SGsAP__CODEC__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(
+    SGsAP__CodecPort::SGsAP__CODEC__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(
+    SGsAP__CodecPort::SGsAP__CODEC__PT& portRef,
+    const IPL4asp__Types::ConnectionId& connId,
+    IPL4asp__Types::UserData& userData)
+  {
+    return f__IPL4__PROVIDER__getUserData(portRef, connId, userData);
+  }
+  
+}
+

-- 
To view, visit https://gerrit.osmocom.org/11306
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I530f8f444d1c7ea0bf11d510da7b97f64a2039f5
Gerrit-Change-Number: 11306
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181010/b70600d3/attachment.htm>


More information about the gerrit-log mailing list