blob: 735a91f5281ba2426f069f2d0da38f0cf36e1470 [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
31 private function IPL4_to_NS_RecvFrom(in ASP_RecvFrom pin, out NS_RecvFrom pout) {
32 pout.connId := pin.connId;
33 pout.remName := pin.remName;
34 pout.remPort := pin.remPort;
35 pout.locName := pin.locName;
36 pout.locPort := pin.locPort;
37 pout.msg := dec_NsPdu(f_NS_expand_len(pin.msg));
38 } with { extension "prototype(fast)" };
39
40 private function NS_to_IPL4_Send(in NS_Send pin, out ASP_SendTo pout) {
41 pout.connId := pin.connId;
42 pout.proto := { udp := {} };
43 pout.msg := f_NS_compact_len(enc_NsPdu(pin.msg));
44 } with { extension "prototype(fast)" };
45
46 type port NS_CODEC_PT message {
47 out NS_Send;
48 in NS_RecvFrom,
49 ASP_Event;
50 } with { extension "user IPL4asp_PT
51 out(NS_Send -> ASP_SendTo: function(NS_to_IPL4_Send))
52 in(ASP_RecvFrom -> NS_RecvFrom: function(IPL4_to_NS_RecvFrom);
53 ASP_Event -> ASP_Event: simple)"
54 }
55}