blob: 82ba55bb872788621b00da80976978224529e068 [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;
Harald Welte6fff3642017-07-22 21:36:13 +02005 import from NS_Types all;
6
7 type record NS_RecvFrom {
8 ConnectionId connId,
9 HostName remName,
10 PortNumber remPort,
11 HostName locName,
12 PortNumber locPort,
Harald Weltee0abc472018-02-05 09:13:31 +010013 PDU_NS msg
Harald Welte6fff3642017-07-22 21:36:13 +020014 }
15
Harald Weltee0abc472018-02-05 09:13:31 +010016 template NS_RecvFrom t_NS_RecvFrom(template PDU_NS pdu) := {
Harald Welte6fff3642017-07-22 21:36:13 +020017 connId := ?,
18 remName := ?,
19 remPort := ?,
20 locName := ?,
21 locPort := ?,
22 msg := pdu
23 };
24
25 type record NS_Send {
26 ConnectionId connId,
Harald Weltee0abc472018-02-05 09:13:31 +010027 PDU_NS msg
Harald Welte6fff3642017-07-22 21:36:13 +020028 }
29
Harald Weltee0abc472018-02-05 09:13:31 +010030 template NS_Send t_NS_Send(template ConnectionId connId, template PDU_NS msg) := {
Harald Welte6e594f22017-07-23 16:19:35 +020031 connId := connId,
32 msg := msg
33 }
34
Harald Welte6fff3642017-07-22 21:36:13 +020035 private function IPL4_to_NS_RecvFrom(in ASP_RecvFrom pin, out NS_RecvFrom pout) {
36 pout.connId := pin.connId;
37 pout.remName := pin.remName;
38 pout.remPort := pin.remPort;
39 pout.locName := pin.locName;
40 pout.locPort := pin.locPort;
Harald Weltee0abc472018-02-05 09:13:31 +010041 pout.msg := dec_PDU_NS(pin.msg);
Harald Welte6fff3642017-07-22 21:36:13 +020042 } with { extension "prototype(fast)" };
43
Harald Welte6e594f22017-07-23 16:19:35 +020044 private function NS_to_IPL4_Send(in NS_Send pin, out ASP_Send pout) {
Harald Welte6fff3642017-07-22 21:36:13 +020045 pout.connId := pin.connId;
46 pout.proto := { udp := {} };
Harald Weltee0abc472018-02-05 09:13:31 +010047 pout.msg := enc_PDU_NS(pin.msg);
Harald Welte6fff3642017-07-22 21:36:13 +020048 } with { extension "prototype(fast)" };
49
50 type port NS_CODEC_PT message {
51 out NS_Send;
52 in NS_RecvFrom,
Harald Welte04d74cd2017-11-19 09:29:51 +010053 ASP_ConnId_ReadyToRelease,
Harald Welte6fff3642017-07-22 21:36:13 +020054 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);
Harald Welte04d74cd2017-11-19 09:29:51 +010058 ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
Harald Welte6fff3642017-07-22 21:36:13 +020059 ASP_Event -> ASP_Event: simple)"
60 }
61}