Harald Welte | 384f4fe | 2018-04-09 22:51:59 +0200 | [diff] [blame] | 1 | module SMPP_CodecPort { |
| 2 | |
| 3 | /* Simple SMPP Codec Port, translating between raw TCP octetstring payload |
| 4 | * towards the IPL4asp port provider, and SMPP primitives |
| 5 | * which carry the decoded SMPP data types as payload. |
| 6 | * |
| 7 | * (C) 2018 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 | |
| 15 | import from IPL4asp_PortType all; |
| 16 | import from IPL4asp_Types all; |
| 17 | import from SMPP_Types all; |
| 18 | |
| 19 | type record SMPP_RecvFrom { |
| 20 | ConnectionId connId, |
| 21 | SMPP_PDU msg |
| 22 | } |
| 23 | |
| 24 | type record SMPP_Send { |
| 25 | ConnectionId connId, |
| 26 | SMPP_PDU msg |
| 27 | } |
| 28 | |
| 29 | template (value) SMPP_Send ts_SMPP_Send(ConnectionId conn_id, template (value) SMPP_PDU msg) := { |
| 30 | connId := conn_id, |
| 31 | msg := msg |
| 32 | } |
| 33 | |
| 34 | template SMPP_RecvFrom tr_SMPP_Recv(template ConnectionId conn_id, template SMPP_PDU msg) := { |
| 35 | connId := conn_id, |
| 36 | msg := msg |
| 37 | } |
| 38 | |
| 39 | private function IPL4_to_SMPP_RecvFrom(in ASP_RecvFrom pin, out SMPP_RecvFrom pout) { |
| 40 | var integer rc; |
| 41 | pout.connId := pin.connId; |
| 42 | rc := f_decode_SMPP(pin.msg, pout.msg); |
| 43 | } with { extension "prototype(fast)" } |
| 44 | |
| 45 | private function SMPP_to_IPL4_Send(in SMPP_Send pin, out ASP_Send pout) { |
| 46 | pout.connId := pin.connId; |
| 47 | pout.proto := { tcp := {} }; |
| 48 | f_encode_SMPP(pin.msg, pout.msg); |
| 49 | } with { extension "prototype(fast)" } |
| 50 | |
| 51 | type port SMPP_CODEC_PT message { |
| 52 | out SMPP_Send; |
| 53 | in SMPP_RecvFrom, |
| 54 | ASP_ConnId_ReadyToRelease, |
| 55 | ASP_Event; |
| 56 | } with { extension "user IPL4asp_PT |
| 57 | out(SMPP_Send -> ASP_Send: function(SMPP_to_IPL4_Send)) |
| 58 | in(ASP_RecvFrom -> SMPP_RecvFrom: function(IPL4_to_SMPP_RecvFrom); |
| 59 | ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple; |
| 60 | ASP_Event -> ASP_Event: simple)" |
| 61 | } |
| 62 | |
| 63 | |
| 64 | |
| 65 | } |