Harald Welte | a7261d7 | 2017-11-18 13:28:07 +0100 | [diff] [blame] | 1 | module RTP_CodecPort { |
| 2 | |
Harald Welte | 35bb716 | 2018-01-03 21:07:52 +0100 | [diff] [blame] | 3 | /* Simple RTP Codec Port, translating between raw UDP primitives with |
| 4 | * octetstring payload towards the IPL4asp provider, and RTP primitives |
| 5 | * which carry the decoded abstract RTP data types as payload. |
| 6 | * |
| 7 | * (C) 2017 by Harald Welte <laforge@gnumonks.org> |
| 8 | * All rights reserved. |
| 9 | * |
| 10 | * Released under the terms of GNU General Public License, Version 2 or |
| 11 | * (at your option) any later version. |
Harald Welte | 34b5a95 | 2019-05-27 11:54:11 +0200 | [diff] [blame] | 12 | * |
| 13 | * SPDX-License-Identifier: GPL-2.0-or-later |
Harald Welte | 35bb716 | 2018-01-03 21:07:52 +0100 | [diff] [blame] | 14 | */ |
| 15 | |
Harald Welte | a7261d7 | 2017-11-18 13:28:07 +0100 | [diff] [blame] | 16 | import from IPL4asp_PortType all; |
| 17 | import from IPL4asp_Types all; |
| 18 | import from RTP_Types all; |
| 19 | |
| 20 | type record RTP_RecvFrom { |
| 21 | ConnectionId connId, |
| 22 | HostName remName, |
| 23 | PortNumber remPort, |
| 24 | HostName locName, |
| 25 | PortNumber locPort, |
| 26 | RTP_messages_union msg |
| 27 | }; |
| 28 | |
| 29 | template RTP_RecvFrom t_RTP_RecvFrom(template RTP_messages_union msg) := { |
| 30 | connId := ?, |
| 31 | remName := ?, |
| 32 | remPort := ?, |
| 33 | locName := ?, |
| 34 | locPort := ?, |
| 35 | msg := msg |
| 36 | } |
| 37 | |
| 38 | type record RTP_Send { |
| 39 | ConnectionId connId, |
| 40 | RTP_messages_union msg |
| 41 | } |
| 42 | |
| 43 | template RTP_Send t_RTP_Send(template ConnectionId connId, template RTP_messages_union msg) := { |
| 44 | connId := connId, |
| 45 | msg := msg |
| 46 | } |
| 47 | |
| 48 | private function IPL4_to_RTP_RecvFrom(in ASP_RecvFrom pin, out RTP_RecvFrom pout) { |
| 49 | pout.connId := pin.connId; |
| 50 | pout.remName := pin.remName; |
| 51 | pout.remPort := pin.remPort; |
| 52 | pout.locName := pin.locName; |
| 53 | pout.locPort := pin.locPort; |
| 54 | pout.msg := f_RTP_dec(pin.msg) |
| 55 | } with { extension "prototype(fast)" }; |
| 56 | |
| 57 | private function RTP_to_IPL4_Send(in RTP_Send pin, out ASP_Send pout) { |
| 58 | pout.connId := pin.connId; |
| 59 | pout.proto := { udp := {} }; |
| 60 | pout.msg := f_RTP_enc(pin.msg); |
| 61 | } with { extension "prototype(fast)" }; |
| 62 | |
| 63 | type port RTP_CODEC_PT message { |
| 64 | out RTP_Send; |
| 65 | in RTP_RecvFrom, |
| 66 | ASP_ConnId_ReadyToRelease, |
| 67 | ASP_Event; |
| 68 | } with { extension "user IPL4asp_PT |
| 69 | out(RTP_Send -> ASP_Send:function(RTP_to_IPL4_Send)) |
| 70 | in(ASP_RecvFrom -> RTP_RecvFrom: function(IPL4_to_RTP_RecvFrom); |
| 71 | ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple; |
| 72 | ASP_Event -> ASP_Event: simple)" |
| 73 | } |
| 74 | } |