blob: e333546865d5ef2061527fa2f6ba95b2b06c7130 [file] [log] [blame]
Harald Welte6fff3642017-07-22 21:36:13 +02001module NS_CodecPort {
2
3 import from IPL4asp_PortType all;
4 import from IPL4asp_Types all;
5 import from BSSGP_Helper_Functions all;
6 import from NS_Types all;
7
8 type record NS_RecvFrom {
9 ConnectionId connId,
10 HostName remName,
11 PortNumber remPort,
12 HostName locName,
13 PortNumber locPort,
14 NsPdu msg
15 }
16
17 template NS_RecvFrom t_NS_RecvFrom(template NsPdu pdu) := {
18 connId := ?,
19 remName := ?,
20 remPort := ?,
21 locName := ?,
22 locPort := ?,
23 msg := pdu
24 };
25
26 type record NS_Send {
27 ConnectionId connId,
28 NsPdu msg
29 }
30
Harald Welte6e594f22017-07-23 16:19:35 +020031 template NS_Send t_NS_Send(template ConnectionId connId, template NsPdu msg) := {
32 connId := connId,
33 msg := msg
34 }
35
Harald Welte6fff3642017-07-22 21:36:13 +020036 private function IPL4_to_NS_RecvFrom(in ASP_RecvFrom pin, out NS_RecvFrom pout) {
37 pout.connId := pin.connId;
38 pout.remName := pin.remName;
39 pout.remPort := pin.remPort;
40 pout.locName := pin.locName;
41 pout.locPort := pin.locPort;
42 pout.msg := dec_NsPdu(f_NS_expand_len(pin.msg));
43 } with { extension "prototype(fast)" };
44
Harald Welte6e594f22017-07-23 16:19:35 +020045 private function NS_to_IPL4_Send(in NS_Send pin, out ASP_Send pout) {
Harald Welte6fff3642017-07-22 21:36:13 +020046 pout.connId := pin.connId;
47 pout.proto := { udp := {} };
48 pout.msg := f_NS_compact_len(enc_NsPdu(pin.msg));
49 } with { extension "prototype(fast)" };
50
51 type port NS_CODEC_PT message {
52 out NS_Send;
53 in NS_RecvFrom,
54 ASP_Event;
55 } with { extension "user IPL4asp_PT
Harald Welte6e594f22017-07-23 16:19:35 +020056 out(NS_Send -> ASP_Send: function(NS_to_IPL4_Send))
Harald Welte6fff3642017-07-22 21:36:13 +020057 in(ASP_RecvFrom -> NS_RecvFrom: function(IPL4_to_NS_RecvFrom);
58 ASP_Event -> ASP_Event: simple)"
59 }
60}