Harald Welte | 9adf57b | 2020-01-10 12:33:44 +0100 | [diff] [blame] | 1 | module SCCP_CodecPort { |
| 2 | |
| 3 | /* Simple SCCP Codec Port, translating between raw MTP3 primitives with |
| 4 | * octetstring payload towards the MTP3 provider, and MTP3-SCCP primitives |
| 5 | * which carry the decoded SCCP data types as payload. |
| 6 | * |
| 7 | * (C) 2019 by Harald Welte <laforge@gnumonks.org> |
| 8 | * All rights reserved. |
| 9 | * |
| 10 | * Released under the terms of GNU General Public License, Version 2 or |
| 11 | * (at your option) any later version. |
| 12 | */ |
| 13 | |
| 14 | import from General_Types all; |
| 15 | import from Osmocom_Types all; |
| 16 | |
| 17 | import from MTP3asp_Types all; |
| 18 | import from MTP3asp_PortType all; |
| 19 | import from SCCP_Types all; |
| 20 | |
| 21 | /* MTP3asp_Types.Types.MessageTypes.ASP_MTP3_TRANSFERind with PDU_SCCP instead of octetstring */ |
| 22 | type record SCCP_MTP3_TRANSFERind { |
| 23 | MTP3_Field_sio sio, |
| 24 | integer opc, |
| 25 | integer dpc, |
| 26 | integer sls, |
| 27 | PDU_SCCP data |
| 28 | }; |
| 29 | |
| 30 | /* MTP3asp_Types.Types.MessageTypes.ASP_MTP3_TRANSFERreq with PDU_SCCP instead of octetstring */ |
| 31 | type record SCCP_MTP3_TRANSFERreq { |
| 32 | MTP3_Field_sio sio, |
| 33 | integer opc, |
| 34 | integer dpc, |
| 35 | integer sls, |
| 36 | PDU_SCCP data |
| 37 | }; |
| 38 | |
| 39 | private function f_dec_TRANSFERind(in ASP_MTP3_TRANSFERind pin, out SCCP_MTP3_TRANSFERind pout) { |
| 40 | pout.sio := pin.sio; |
| 41 | pout.opc := pin.opc; |
| 42 | pout.dpc := pin.dpc; |
| 43 | pout.sls := pin.sls; |
| 44 | pout.data := dec_PDU_SCCP(pin.data); |
| 45 | //port.setstate(0); |
| 46 | } with {extension "prototype(fast)" } |
| 47 | |
| 48 | |
| 49 | private function f_enc_TRANSFERreq(in SCCP_MTP3_TRANSFERreq pin, out ASP_MTP3_TRANSFERreq pout) { |
| 50 | pout.sio := pin.sio; |
| 51 | pout.opc := pin.opc; |
| 52 | pout.dpc := pin.dpc; |
| 53 | pout.sls := pin.sls; |
| 54 | pout.data := enc_PDU_SCCP(pin.data); |
| 55 | //port.setstate(0); |
| 56 | } with {extension "prototype(fast)" } |
| 57 | |
| 58 | type port SCCP_CODEC_PT message { |
| 59 | out SCCP_MTP3_TRANSFERreq; |
| 60 | in SCCP_MTP3_TRANSFERind, |
| 61 | ASP_MTP3_PAUSE, |
| 62 | ASP_MTP3_RESUME, |
| 63 | ASP_MTP3_STATUS; |
| 64 | } with { extension "internal user MTP3asp_PT |
| 65 | out(SCCP_MTP3_TRANSFERreq -> ASP_MTP3_TRANSFERreq: function(f_enc_TRANSFERreq)) |
| 66 | in(ASP_MTP3_TRANSFERind -> SCCP_MTP3_TRANSFERind: function(f_dec_TRANSFERind); |
| 67 | ASP_MTP3_PAUSE -> ASP_MTP3_PAUSE: simple; |
| 68 | ASP_MTP3_RESUME -> ASP_MTP3_RESUME: simple; |
| 69 | ASP_MTP3_STATUS -> ASP_MTP3_STATUS: simple)" |
| 70 | } |
| 71 | |
| 72 | |
| 73 | } |