msc: Add SMPP_CodecPort
Change-Id: I57640ccc5370d6820bc303003e162f27ddc9fcfd
diff --git a/library/SMPP_CodecPort.ttcn b/library/SMPP_CodecPort.ttcn
new file mode 100644
index 0000000..0ac81ae
--- /dev/null
+++ b/library/SMPP_CodecPort.ttcn
@@ -0,0 +1,65 @@
+module SMPP_CodecPort {
+
+/* Simple SMPP Codec Port, translating between raw TCP octetstring payload
+ * towards the IPL4asp port provider, and SMPP primitives
+ * which carry the decoded SMPP 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 SMPP_Types all;
+
+type record SMPP_RecvFrom {
+ ConnectionId connId,
+ SMPP_PDU msg
+}
+
+type record SMPP_Send {
+ ConnectionId connId,
+ SMPP_PDU msg
+}
+
+template (value) SMPP_Send ts_SMPP_Send(ConnectionId conn_id, template (value) SMPP_PDU msg) := {
+ connId := conn_id,
+ msg := msg
+}
+
+template SMPP_RecvFrom tr_SMPP_Recv(template ConnectionId conn_id, template SMPP_PDU msg) := {
+ connId := conn_id,
+ msg := msg
+}
+
+private function IPL4_to_SMPP_RecvFrom(in ASP_RecvFrom pin, out SMPP_RecvFrom pout) {
+ var integer rc;
+ pout.connId := pin.connId;
+ rc := f_decode_SMPP(pin.msg, pout.msg);
+} with { extension "prototype(fast)" }
+
+private function SMPP_to_IPL4_Send(in SMPP_Send pin, out ASP_Send pout) {
+ pout.connId := pin.connId;
+ pout.proto := { tcp := {} };
+ f_encode_SMPP(pin.msg, pout.msg);
+} with { extension "prototype(fast)" }
+
+type port SMPP_CODEC_PT message {
+ out SMPP_Send;
+ in SMPP_RecvFrom,
+ ASP_ConnId_ReadyToRelease,
+ ASP_Event;
+} with { extension "user IPL4asp_PT
+ out(SMPP_Send -> ASP_Send: function(SMPP_to_IPL4_Send))
+ in(ASP_RecvFrom -> SMPP_RecvFrom: function(IPL4_to_SMPP_RecvFrom);
+ ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
+ ASP_Event -> ASP_Event: simple)"
+}
+
+
+
+}
diff --git a/library/SMPP_CodecPort_CtrlFunct.ttcn b/library/SMPP_CodecPort_CtrlFunct.ttcn
new file mode 100644
index 0000000..2f6d616
--- /dev/null
+++ b/library/SMPP_CodecPort_CtrlFunct.ttcn
@@ -0,0 +1,52 @@
+module SMPP_CodecPort_CtrlFunct {
+
+ import from SMPP_CodecPort all;
+ import from IPL4asp_Types all;
+
+ external function f_IPL4_listen(
+ inout SMPP_CODEC_PT portRef,
+ in HostName locName,
+ in PortNumber locPort,
+ in ProtoTuple proto,
+ in OptionList options := {}
+ ) return Result;
+
+ external function f_IPL4_connect(
+ inout SMPP_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 SMPP_CODEC_PT portRef,
+ in ConnectionId id,
+ in ProtoTuple proto := { unspecified := {} }
+ ) return Result;
+
+ external function f_IPL4_setUserData(
+ inout SMPP_CODEC_PT portRef,
+ in ConnectionId id,
+ in UserData userData
+ ) return Result;
+
+ external function f_IPL4_getUserData(
+ inout SMPP_CODEC_PT portRef,
+ in ConnectionId id,
+ out UserData userData
+ ) return Result;
+
+ external function f_IPL4_setGetMsgLen(
+ inout SMPP_CODEC_PT portRef,
+ in ConnectionId id,
+ inout f_IPL4_getMsgLen f,
+ in ro_integer msgLenArgs
+ );
+
+
+}
+
diff --git a/library/SMPP_CodecPort_CtrlFunctDef.cc b/library/SMPP_CodecPort_CtrlFunctDef.cc
new file mode 100644
index 0000000..31603e4
--- /dev/null
+++ b/library/SMPP_CodecPort_CtrlFunctDef.cc
@@ -0,0 +1,66 @@
+#include "IPL4asp_PortType.hh"
+#include "SMPP_CodecPort.hh"
+#include "IPL4asp_PT.hh"
+
+namespace SMPP__CodecPort__CtrlFunct {
+
+ IPL4asp__Types::Result f__IPL4__listen(
+ SMPP__CodecPort::SMPP__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(
+ SMPP__CodecPort::SMPP__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(
+ SMPP__CodecPort::SMPP__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(
+ SMPP__CodecPort::SMPP__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(
+ SMPP__CodecPort::SMPP__CODEC__PT& portRef,
+ const IPL4asp__Types::ConnectionId& connId,
+ IPL4asp__Types::UserData& userData)
+ {
+ return f__IPL4__PROVIDER__getUserData(portRef, connId, userData);
+ }
+
+ void f__IPL4__setGetMsgLen(
+ SMPP__CodecPort::SMPP__CODEC__PT& portRef,
+ const IPL4asp__Types::ConnectionId& connId,
+ Socket__API__Definitions::f__getMsgLen& f,
+ const Socket__API__Definitions::ro__integer& msgLenArgs)
+ {
+ return f__IPL4__PROVIDER__setGetMsgLen(portRef, connId, f, msgLenArgs);
+ }
+
+
+}
+