blob: 2981fa2b50bc12e7cceae6dcf998c7b0b577bdbb [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.
12 */
13
14 import from IPL4asp_PortType all;
15 import from IPL4asp_Types all;
16 import from SGsAP_Types all;
17
18 type record SGsAP_RecvFrom {
19 ConnectionId connId,
20 HostName remName,
21 PortNumber remPort,
22 HostName locName,
23 PortNumber locPort,
24 PDU_SGsAP msg
25 };
26
27 template SGsAP_RecvFrom t_SGsAP_RecvFrom(template PDU_SGsAP msg) := {
28 connId := ?,
29 remName := ?,
30 remPort := ?,
31 locName := ?,
32 locPort := ?,
33 msg := msg
34 }
35
36 type record SGsAP_Send {
37 ConnectionId connId,
38 PDU_SGsAP msg
39 }
40
41 template SGsAP_Send t_SGsAP_Send(template ConnectionId connId, template PDU_SGsAP msg) := {
42 connId := connId,
43 msg := msg
44 }
45
46 private function IPL4_to_SGsAP_RecvFrom(in ASP_RecvFrom pin, out SGsAP_RecvFrom pout) {
47 pout.connId := pin.connId;
48 pout.remName := pin.remName;
49 pout.remPort := pin.remPort;
50 pout.locName := pin.locName;
51 pout.locPort := pin.locPort;
52 pout.msg := dec_PDU_SGsAP(pin.msg);
53 } with { extension "prototype(fast)" };
54
55 private function SGsAP_to_IPL4_Send(in SGsAP_Send pin, out ASP_Send pout) {
56 pout.connId := pin.connId;
57 pout.proto := { sctp := {} };
58 pout.msg := enc_PDU_SGsAP(pin.msg);
59 } with { extension "prototype(fast)" };
60
61 type port SGsAP_CODEC_PT message {
62 out SGsAP_Send;
63 in SGsAP_RecvFrom,
64 ASP_ConnId_ReadyToRelease,
65 ASP_Event;
66 } with { extension "user IPL4asp_PT
67 out(SGsAP_Send -> ASP_Send:function(SGsAP_to_IPL4_Send))
68 in(ASP_RecvFrom -> SGsAP_RecvFrom: function(IPL4_to_SGsAP_RecvFrom);
69 ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
70 ASP_Event -> ASP_Event: simple)"
71 }
72}