summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2018-04-09 22:51:59 +0200
committerHarald Welte <laforge@gnumonks.org>2018-04-14 21:58:16 +0200
commit384f4fee234cd9d69178abda8af933e664af5d37 (patch)
treefc972a05c489aaeb9e8f7be41753b79656786315
parent72199a8be9ea73a417a3423cb1b4f6f0cbfef742 (diff)
msc: Add SMPP_CodecPort
-rw-r--r--library/SMPP_CodecPort.ttcn65
-rw-r--r--library/SMPP_CodecPort_CtrlFunct.ttcn52
-rw-r--r--library/SMPP_CodecPort_CtrlFunctDef.cc66
-rwxr-xr-xmsc/gen_links.sh1
-rwxr-xr-xmsc/regen_makefile.sh2
5 files changed, 185 insertions, 1 deletions
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);
+ }
+
+
+}
+
diff --git a/msc/gen_links.sh b/msc/gen_links.sh
index 6dea043..08d8de8 100755
--- a/msc/gen_links.sh
+++ b/msc/gen_links.sh
@@ -78,6 +78,7 @@ FILES+="Osmocom_CTRL_Types.ttcn Osmocom_CTRL_Functions.ttcn Osmocom_CTRL_Adapter
FILES+="BSSMAP_Emulation.ttcn BSSAP_CodecPort.ttcn BSSMAP_Templates.ttcn BSSAP_Adapter.ttcn MGCP_Types.ttcn MGCP_Templates.ttcn MGCP_CodecPort_CtrlFunct.ttcn MGCP_Emulation.ttcn "
FILES+="RTP_CodecPort.ttcn RTP_CodecPort_CtrlFunctDef.cc "
FILES+="MGCP_CodecPort.ttcn MGCP_CodecPort_CtrlFunctDef.cc "
+FILES+="SMPP_CodecPort.ttcn SMPP_CodecPort_CtrlFunct.ttcn SMPP_CodecPort_CtrlFunctDef.cc "
gen_links $DIR $FILES
ignore_pp_results
diff --git a/msc/regen_makefile.sh b/msc/regen_makefile.sh
index 29b3f05..de8f7ab 100755
--- a/msc/regen_makefile.sh
+++ b/msc/regen_makefile.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-FILES="*.ttcn *.ttcnpp SCCP_EncDec.cc SCTPasp_PT.cc TCCConversion.cc TCCInterface.cc UD_PT.cc MNCC_EncDec.cc IPL4asp_PT.cc IPL4asp_discovery.cc SDP_EncDec.cc RTP_EncDec.cc IPA_CodecPort_CtrlFunctDef.cc RTP_CodecPort_CtrlFunctDef.cc MGCP_CodecPort_CtrlFunctDef.cc TELNETasp_PT.cc Native_FunctionDefs.cc SMPP_EncDec.cc *.c"
+FILES="*.ttcn *.ttcnpp SCCP_EncDec.cc SCTPasp_PT.cc TCCConversion.cc TCCInterface.cc UD_PT.cc MNCC_EncDec.cc IPL4asp_PT.cc IPL4asp_discovery.cc SDP_EncDec.cc RTP_EncDec.cc IPA_CodecPort_CtrlFunctDef.cc RTP_CodecPort_CtrlFunctDef.cc MGCP_CodecPort_CtrlFunctDef.cc TELNETasp_PT.cc Native_FunctionDefs.cc SMPP_EncDec.cc SMPP_CodecPort_CtrlFunctDef.cc *.c"
export CPPFLAGS_TTCN3="-DIPA_EMULATION_MGCP -DIPA_EMULATION_GSUP -DUSE_MTP3_DISTRIBUTOR"