blob: 47796c8d73fe24ca6fb06933d01c2af53bf12bf3 [file] [log] [blame]
Harald Welte34b5a952019-05-27 11:54:11 +02001/* dual-faced port that wraps an IPL4asp port and encodes/decodes GSMTAP
2 * (C) 2017 Harald Welte <laforge@gnumonks.org>
3 * All rights reserved.
4 *
5 * Released under the terms of GNU General Public License, Version 2 or
6 * (at your option) any later version.
7 *
8 * SPDX-License-Identifier: GPL-2.0+
9 */
10
Harald Welte3d4df7f2017-07-14 22:05:56 +020011module GSMTAP_PortType {
12 import from GSMTAP_Types all;
13 import from IPL4asp_PortType all;
14 import from IPL4asp_Types all;
15
16 /* just like ASP_ReacFrom but with decoded GsmtapMessage */
17 type record GSMTAP_RecvFrom {
18 ConnectionId connId,
19 HostName remName,
20 PortNumber remPort,
21 HostName locName,
22 PortNumber locPort,
23 ProtoTuple proto,
24 UserData userData,
25 GsmtapMessage msg
26 }
27
28 /* just like ASP_Send but with decoded GsmtapMessage */
29 type record GSMTAP_Send {
30 ConnectionId connId,
31 ProtoTuple proto,
32 GsmtapMessage msg
33 }
34
35 /* just like ASP_SendTo but with decoded GsmtapMessage */
36 type record GSMTAP_SendTo {
37 ConnectionId connId,
38 HostName remName,
39 PortNumber remPort,
40 ProtoTuple proto,
41 GsmtapMessage msg
42 }
43
44 /* Convert RecvFrom from ASP to GSMTAP decoded */
45 private function IPL4_to_GSMTAP(in ASP_RecvFrom pin, out GSMTAP_RecvFrom pout) {
46 pout.connId := pin.connId;
47 pout.remName := pin.remName;
48 pout.remPort := pin.remPort;
49 pout.locName := pin.locName;
50 pout.locPort := pin.locPort;
51 pout.proto := pin.proto;
52 pout.userData := pin.userData;
53 pout.msg := dec_GsmtapMessage(pin.msg);
54 } with { extension "prototype(fast)" }
55
56 /* Convert SendTo from GSMTAP to ASP */
57 private function GSMTAP_to_IPL4_SendTo(in GSMTAP_SendTo pin, out ASP_SendTo pout) {
58 pout.connId := pin.connId;
59 pout.remName := pin.remName;
60 pout.remPort := pin.remPort;
61 pout.proto := pin.proto;
62 pout.msg := enc_GsmtapMessage(pin.msg);
63 } with { extension "prototype(fast)" }
64
65 /* Convert SendTo from GSMTAP to ASP */
66 private function GSMTAP_to_IPL4_Send(in GSMTAP_Send pin, out ASP_Send pout) {
67 pout.connId := pin.connId;
68 pout.proto := pin.proto;
69 pout.msg := enc_GsmtapMessage(pin.msg);
70 } with { extension "prototype(fast)" }
71
72 /* dual-faced port that converts from octetstring to decoded
73 * GSMTAP and vice-versa */
74 type port GSMTAP_PT message {
75 out GSMTAP_Send
76 out GSMTAP_SendTo
77 in GSMTAP_RecvFrom
78 in ASP_Event
Harald Welte04d74cd2017-11-19 09:29:51 +010079 in ASP_ConnId_ReadyToRelease
Harald Welte3d4df7f2017-07-14 22:05:56 +020080 } with { extension "user IPL4asp_PT
81 out(GSMTAP_Send -> ASP_Send: function(GSMTAP_to_IPL4_Send);
82 GSMTAP_SendTo -> ASP_SendTo: function(GSMTAP_to_IPL4_SendTo))
83 in(ASP_RecvFrom -> GSMTAP_RecvFrom: function(IPL4_to_GSMTAP);
Harald Welte04d74cd2017-11-19 09:29:51 +010084 ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
Harald Welte3d4df7f2017-07-14 22:05:56 +020085 ASP_Event -> ASP_Event: simple)" }
86
87}