Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 1 | module NS_CodecPort { |
| 2 | |
| 3 | import from IPL4asp_PortType all; |
| 4 | import from IPL4asp_Types all; |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 5 | 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 Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 13 | PDU_NS msg |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 14 | } |
| 15 | |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 16 | template NS_RecvFrom t_NS_RecvFrom(template PDU_NS pdu) := { |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 17 | connId := ?, |
| 18 | remName := ?, |
| 19 | remPort := ?, |
| 20 | locName := ?, |
| 21 | locPort := ?, |
| 22 | msg := pdu |
| 23 | }; |
| 24 | |
| 25 | type record NS_Send { |
| 26 | ConnectionId connId, |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 27 | PDU_NS msg |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 28 | } |
| 29 | |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 30 | template NS_Send t_NS_Send(template ConnectionId connId, template PDU_NS msg) := { |
Harald Welte | 6e594f2 | 2017-07-23 16:19:35 +0200 | [diff] [blame] | 31 | connId := connId, |
| 32 | msg := msg |
| 33 | } |
| 34 | |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 35 | 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 Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 41 | pout.msg := dec_PDU_NS(pin.msg); |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 42 | } with { extension "prototype(fast)" }; |
| 43 | |
Harald Welte | 6e594f2 | 2017-07-23 16:19:35 +0200 | [diff] [blame] | 44 | private function NS_to_IPL4_Send(in NS_Send pin, out ASP_Send pout) { |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 45 | pout.connId := pin.connId; |
| 46 | pout.proto := { udp := {} }; |
Harald Welte | e0abc47 | 2018-02-05 09:13:31 +0100 | [diff] [blame] | 47 | pout.msg := enc_PDU_NS(pin.msg); |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 48 | } with { extension "prototype(fast)" }; |
| 49 | |
| 50 | type port NS_CODEC_PT message { |
| 51 | out NS_Send; |
| 52 | in NS_RecvFrom, |
Harald Welte | 04d74cd | 2017-11-19 09:29:51 +0100 | [diff] [blame] | 53 | ASP_ConnId_ReadyToRelease, |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 54 | ASP_Event; |
| 55 | } with { extension "user IPL4asp_PT |
Harald Welte | 6e594f2 | 2017-07-23 16:19:35 +0200 | [diff] [blame] | 56 | out(NS_Send -> ASP_Send: function(NS_to_IPL4_Send)) |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 57 | in(ASP_RecvFrom -> NS_RecvFrom: function(IPL4_to_NS_RecvFrom); |
Harald Welte | 04d74cd | 2017-11-19 09:29:51 +0100 | [diff] [blame] | 58 | ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple; |
Harald Welte | 6fff364 | 2017-07-22 21:36:13 +0200 | [diff] [blame] | 59 | ASP_Event -> ASP_Event: simple)" |
| 60 | } |
| 61 | } |