blob: 47fe2cde384d45c241e1ff665e36a3ef983bb047 [file] [log] [blame]
Harald Welteaf5bce42018-10-09 09:20:45 +02001module SGsAP_CodecPort {
2
3/* Simple SGsAP Codec Port, translating between raw SCTP primitives with
4 * octetstring payload towards the IPL4asp provider, and SGsAP primitives
5 * which carry the decoded SGsAP 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.
Harald Welte34b5a952019-05-27 11:54:11 +020012 *
13 * SPDX-License-Identifier: GPL-2.0-or-later
Harald Welteaf5bce42018-10-09 09:20:45 +020014 */
15
16 import from IPL4asp_PortType all;
17 import from IPL4asp_Types all;
18 import from SGsAP_Types all;
19
20 type record SGsAP_RecvFrom {
21 ConnectionId connId,
22 HostName remName,
23 PortNumber remPort,
24 HostName locName,
25 PortNumber locPort,
26 PDU_SGsAP msg
27 };
28
29 template SGsAP_RecvFrom t_SGsAP_RecvFrom(template PDU_SGsAP msg) := {
30 connId := ?,
31 remName := ?,
32 remPort := ?,
33 locName := ?,
34 locPort := ?,
35 msg := msg
36 }
37
38 type record SGsAP_Send {
39 ConnectionId connId,
40 PDU_SGsAP msg
41 }
42
43 template SGsAP_Send t_SGsAP_Send(template ConnectionId connId, template PDU_SGsAP msg) := {
44 connId := connId,
45 msg := msg
46 }
47
48 private function IPL4_to_SGsAP_RecvFrom(in ASP_RecvFrom pin, out SGsAP_RecvFrom pout) {
49 pout.connId := pin.connId;
50 pout.remName := pin.remName;
51 pout.remPort := pin.remPort;
52 pout.locName := pin.locName;
53 pout.locPort := pin.locPort;
54 pout.msg := dec_PDU_SGsAP(pin.msg);
55 } with { extension "prototype(fast)" };
56
57 private function SGsAP_to_IPL4_Send(in SGsAP_Send pin, out ASP_Send pout) {
58 pout.connId := pin.connId;
59 pout.proto := { sctp := {} };
60 pout.msg := enc_PDU_SGsAP(pin.msg);
61 } with { extension "prototype(fast)" };
62
63 type port SGsAP_CODEC_PT message {
64 out SGsAP_Send;
65 in SGsAP_RecvFrom,
66 ASP_ConnId_ReadyToRelease,
67 ASP_Event;
68 } with { extension "user IPL4asp_PT
69 out(SGsAP_Send -> ASP_Send:function(SGsAP_to_IPL4_Send))
70 in(ASP_RecvFrom -> SGsAP_RecvFrom: function(IPL4_to_SGsAP_RecvFrom);
71 ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
72 ASP_Event -> ASP_Event: simple)"
73 }
74}