Add SGsAP_CodecPort + SGsAP_Emulation module
Change-Id: I530f8f444d1c7ea0bf11d510da7b97f64a2039f5
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@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)"
+ }
+}