Harald Welte | 3549811 | 2019-07-02 14:26:39 +0800 | [diff] [blame] | 1 | module S1AP_CodecPort { |
| 2 | |
| 3 | /* Simple S1AP Codec Port, translating between raw SCTP primitives with |
| 4 | * octetstring payload towards the IPL4asp provider, and S1AP primitives |
| 5 | * which carry the decoded S1AP 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 | * SPDX-License-Identifier: GPL-2.0-or-later |
| 14 | */ |
| 15 | |
| 16 | import from IPL4asp_PortType all; |
| 17 | import from IPL4asp_Types all; |
| 18 | import from S1AP_PDU_Descriptions all; |
| 19 | import from S1AP_Types all; |
| 20 | |
| 21 | type record S1AP_RecvFrom { |
| 22 | ConnectionId connId, |
| 23 | HostName remName, |
| 24 | PortNumber remPort, |
| 25 | HostName locName, |
| 26 | PortNumber locPort, |
| 27 | S1AP_PDU msg |
| 28 | }; |
| 29 | |
| 30 | template S1AP_RecvFrom t_S1AP_RecvFrom(template S1AP_PDU msg) := { |
| 31 | connId := ?, |
| 32 | remName := ?, |
| 33 | remPort := ?, |
| 34 | locName := ?, |
| 35 | locPort := ?, |
| 36 | msg := msg |
| 37 | } |
| 38 | |
| 39 | type record S1AP_Send { |
| 40 | ConnectionId connId, |
| 41 | S1AP_PDU msg |
| 42 | } |
| 43 | |
| 44 | template S1AP_Send t_S1AP_Send(template ConnectionId connId, template S1AP_PDU msg) := { |
| 45 | connId := connId, |
| 46 | msg := msg |
| 47 | } |
| 48 | |
| 49 | private function IPL4_to_S1AP_RecvFrom(in ASP_RecvFrom pin, out S1AP_RecvFrom pout) { |
| 50 | pout.connId := pin.connId; |
| 51 | pout.remName := pin.remName; |
| 52 | pout.remPort := pin.remPort; |
| 53 | pout.locName := pin.locName; |
| 54 | pout.locPort := pin.locPort; |
| 55 | pout.msg := dec_S1AP_PDU(pin.msg); |
| 56 | } with { extension "prototype(fast)" }; |
| 57 | |
| 58 | private function S1AP_to_IPL4_Send(in S1AP_Send pin, out ASP_Send pout) { |
| 59 | pout.connId := pin.connId; |
| 60 | pout.proto := { |
| 61 | sctp := { |
| 62 | sinfo_stream := omit, |
| 63 | sinfo_ppid := 18, |
| 64 | remSocks := omit, |
| 65 | assocId := omit |
| 66 | } |
| 67 | }; |
| 68 | pout.msg := enc_S1AP_PDU(pin.msg); |
| 69 | } with { extension "prototype(fast)" }; |
| 70 | |
| 71 | type port S1AP_CODEC_PT message { |
| 72 | out S1AP_Send; |
| 73 | in S1AP_RecvFrom, |
| 74 | ASP_ConnId_ReadyToRelease, |
| 75 | ASP_Event; |
| 76 | } with { extension "user IPL4asp_PT |
| 77 | out(S1AP_Send -> ASP_Send:function(S1AP_to_IPL4_Send)) |
| 78 | in(ASP_RecvFrom -> S1AP_RecvFrom: function(IPL4_to_S1AP_RecvFrom); |
| 79 | ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple; |
| 80 | ASP_Event -> ASP_Event: simple)" |
| 81 | } |
| 82 | } |