Add SCCP_Tests_RAW for testing the actual SCCP implementation
Using SCCP_Tests_RAW.ttcn we can trasnceive decoded MTP3 primitives
containing decoded SCCP messages against a remote SCCP implementation.
Related: OS#4343
Change-Id: I07c43cfac9cdbdeccf102cd08309ca9ec64968cc
diff --git a/sccp/SCCP_CodecPort.ttcn b/sccp/SCCP_CodecPort.ttcn
new file mode 100644
index 0000000..838517a
--- /dev/null
+++ b/sccp/SCCP_CodecPort.ttcn
@@ -0,0 +1,73 @@
+module SCCP_CodecPort {
+
+/* Simple SCCP Codec Port, translating between raw MTP3 primitives with
+ * octetstring payload towards the MTP3 provider, and MTP3-SCCP primitives
+ * which carry the decoded SCCP data types as payload.
+ *
+ * (C) 2019 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 General_Types all;
+import from Osmocom_Types all;
+
+import from MTP3asp_Types all;
+import from MTP3asp_PortType all;
+import from SCCP_Types all;
+
+/* MTP3asp_Types.Types.MessageTypes.ASP_MTP3_TRANSFERind with PDU_SCCP instead of octetstring */
+type record SCCP_MTP3_TRANSFERind {
+ MTP3_Field_sio sio,
+ integer opc,
+ integer dpc,
+ integer sls,
+ PDU_SCCP data
+};
+
+/* MTP3asp_Types.Types.MessageTypes.ASP_MTP3_TRANSFERreq with PDU_SCCP instead of octetstring */
+type record SCCP_MTP3_TRANSFERreq {
+ MTP3_Field_sio sio,
+ integer opc,
+ integer dpc,
+ integer sls,
+ PDU_SCCP data
+};
+
+private function f_dec_TRANSFERind(in ASP_MTP3_TRANSFERind pin, out SCCP_MTP3_TRANSFERind pout) {
+ pout.sio := pin.sio;
+ pout.opc := pin.opc;
+ pout.dpc := pin.dpc;
+ pout.sls := pin.sls;
+ pout.data := dec_PDU_SCCP(pin.data);
+ //port.setstate(0);
+} with {extension "prototype(fast)" }
+
+
+private function f_enc_TRANSFERreq(in SCCP_MTP3_TRANSFERreq pin, out ASP_MTP3_TRANSFERreq pout) {
+ pout.sio := pin.sio;
+ pout.opc := pin.opc;
+ pout.dpc := pin.dpc;
+ pout.sls := pin.sls;
+ pout.data := enc_PDU_SCCP(pin.data);
+ //port.setstate(0);
+} with {extension "prototype(fast)" }
+
+type port SCCP_CODEC_PT message {
+ out SCCP_MTP3_TRANSFERreq;
+ in SCCP_MTP3_TRANSFERind,
+ ASP_MTP3_PAUSE,
+ ASP_MTP3_RESUME,
+ ASP_MTP3_STATUS;
+} with { extension "internal user MTP3asp_PT
+ out(SCCP_MTP3_TRANSFERreq -> ASP_MTP3_TRANSFERreq: function(f_enc_TRANSFERreq))
+ in(ASP_MTP3_TRANSFERind -> SCCP_MTP3_TRANSFERind: function(f_dec_TRANSFERind);
+ ASP_MTP3_PAUSE -> ASP_MTP3_PAUSE: simple;
+ ASP_MTP3_RESUME -> ASP_MTP3_RESUME: simple;
+ ASP_MTP3_STATUS -> ASP_MTP3_STATUS: simple)"
+}
+
+
+}