blob: 8f85fd9a5cf3d677c76a42e8e9e10ecc6393703f [file] [log] [blame]
Harald Weltea7261d72017-11-18 13:28:07 +01001module RTP_CodecPort {
2
Harald Welte35bb7162018-01-03 21:07:52 +01003/* 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.
12 */
13
Harald Weltea7261d72017-11-18 13:28:07 +010014 import from IPL4asp_PortType all;
15 import from IPL4asp_Types all;
16 import from RTP_Types all;
17
18 type record RTP_RecvFrom {
19 ConnectionId connId,
20 HostName remName,
21 PortNumber remPort,
22 HostName locName,
23 PortNumber locPort,
24 RTP_messages_union msg
25 };
26
27 template RTP_RecvFrom t_RTP_RecvFrom(template RTP_messages_union msg) := {
28 connId := ?,
29 remName := ?,
30 remPort := ?,
31 locName := ?,
32 locPort := ?,
33 msg := msg
34 }
35
36 type record RTP_Send {
37 ConnectionId connId,
38 RTP_messages_union msg
39 }
40
41 template RTP_Send t_RTP_Send(template ConnectionId connId, template RTP_messages_union msg) := {
42 connId := connId,
43 msg := msg
44 }
45
46 private function IPL4_to_RTP_RecvFrom(in ASP_RecvFrom pin, out RTP_RecvFrom pout) {
47 pout.connId := pin.connId;
48 pout.remName := pin.remName;
49 pout.remPort := pin.remPort;
50 pout.locName := pin.locName;
51 pout.locPort := pin.locPort;
52 pout.msg := f_RTP_dec(pin.msg)
53 } with { extension "prototype(fast)" };
54
55 private function RTP_to_IPL4_Send(in RTP_Send pin, out ASP_Send pout) {
56 pout.connId := pin.connId;
57 pout.proto := { udp := {} };
58 pout.msg := f_RTP_enc(pin.msg);
59 } with { extension "prototype(fast)" };
60
61 type port RTP_CODEC_PT message {
62 out RTP_Send;
63 in RTP_RecvFrom,
64 ASP_ConnId_ReadyToRelease,
65 ASP_Event;
66 } with { extension "user IPL4asp_PT
67 out(RTP_Send -> ASP_Send:function(RTP_to_IPL4_Send))
68 in(ASP_RecvFrom -> RTP_RecvFrom: function(IPL4_to_RTP_RecvFrom);
69 ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
70 ASP_Event -> ASP_Event: simple)"
71 }
72}