Harald Welte | 2c6dba1 | 2017-09-16 00:50:08 +0800 | [diff] [blame] | 1 | module MGCP_CodecPort { |
| 2 | |
| 3 | import from IPL4asp_PortType all; |
| 4 | import from IPL4asp_Types all; |
| 5 | import from MGCP_Types all; |
| 6 | |
| 7 | type record MGCP_RecvFrom { |
| 8 | ConnectionId connId, |
| 9 | HostName remName, |
| 10 | PortNumber remPort, |
| 11 | HostName locName, |
| 12 | PortNumber locPort, |
| 13 | MgcpMessage msg |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 14 | }; |
| 15 | |
| 16 | template MGCP_RecvFrom t_MGCP_RecvFrom(template MgcpMessage msg) := { |
| 17 | connId := ?, |
| 18 | remName := ?, |
| 19 | remPort := ?, |
| 20 | locName := ?, |
| 21 | locPort := ?, |
| 22 | msg := msg |
Harald Welte | 2c6dba1 | 2017-09-16 00:50:08 +0800 | [diff] [blame] | 23 | } |
| 24 | |
| 25 | type record MGCP_Send { |
| 26 | ConnectionId connId, |
| 27 | MgcpMessage msg |
| 28 | } |
| 29 | |
Harald Welte | 3c6ebb9 | 2017-09-16 00:56:57 +0800 | [diff] [blame] | 30 | template MGCP_Send t_MGCP_Send(template ConnectionId connId, template MgcpMessage msg) := { |
| 31 | connId := connId, |
| 32 | msg := msg |
| 33 | } |
| 34 | |
Harald Welte | 2c6dba1 | 2017-09-16 00:50:08 +0800 | [diff] [blame] | 35 | private function IPL4_to_MGCP_RecvFrom(in ASP_RecvFrom pin, out MGCP_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 | 9ccb480 | 2017-09-17 16:22:34 +0800 | [diff] [blame] | 41 | /* FIXME: This should actually be the below: |
| 42 | pout.msg := dec_MgcpMessage(oct2char(pin.msg)); - see |
| 43 | https://www.eclipse.org/forums/index.php/t/1088893/ |
| 44 | */ |
| 45 | pout.msg := { response := dec_MgcpResponse(oct2char(pin.msg)) }; |
Harald Welte | 2c6dba1 | 2017-09-16 00:50:08 +0800 | [diff] [blame] | 46 | } with { extension "prototype(fast)" }; |
| 47 | |
| 48 | private function MGCP_to_IPL4_Send(in MGCP_Send pin, out ASP_Send pout) { |
| 49 | pout.connId := pin.connId; |
| 50 | pout.proto := { udp := {} }; |
| 51 | pout.msg := char2oct(enc_MgcpMessage(pin.msg)); |
| 52 | } with { extension "prototype(fast)" }; |
| 53 | |
| 54 | type port MGCP_CODEC_PT message { |
| 55 | out MGCP_Send; |
| 56 | in MGCP_RecvFrom, |
| 57 | ASP_Event; |
| 58 | } with { extension "user IPL4asp_PT |
| 59 | out(MGCP_Send -> ASP_Send:function(MGCP_to_IPL4_Send)) |
| 60 | in(ASP_RecvFrom -> MGCP_RecvFrom: function(IPL4_to_MGCP_RecvFrom); |
| 61 | ASP_Event -> ASP_Event: simple)" |
| 62 | } |
| 63 | } |