2017-09-15 16:50:08 +00:00
|
|
|
module MGCP_CodecPort {
|
|
|
|
|
2018-01-03 20:07:52 +00:00
|
|
|
/* Simple MGCP Codec Port, translating between raw UDP primitives with
|
|
|
|
* octetstring payload towards the IPL4asp provider, and MGCP primitives
|
|
|
|
* which carry the decoded MGCP data types as payload.
|
|
|
|
*
|
|
|
|
* (C) 2017 by Harald Welte <laforge@gnumonks.org>
|
2019-05-27 09:54:11 +00:00
|
|
|
* contributions by sysmocom - s.f.m.c. GmbH
|
2018-01-03 20:07:52 +00:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* Released under the terms of GNU General Public License, Version 2 or
|
|
|
|
* (at your option) any later version.
|
2019-05-27 09:54:11 +00:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
2018-01-03 20:07:52 +00:00
|
|
|
*/
|
|
|
|
|
2017-09-15 16:50:08 +00:00
|
|
|
import from IPL4asp_PortType all;
|
|
|
|
import from IPL4asp_Types all;
|
|
|
|
import from MGCP_Types all;
|
|
|
|
|
|
|
|
type record MGCP_RecvFrom {
|
|
|
|
ConnectionId connId,
|
|
|
|
HostName remName,
|
|
|
|
PortNumber remPort,
|
|
|
|
HostName locName,
|
|
|
|
PortNumber locPort,
|
|
|
|
MgcpMessage msg
|
2017-09-15 16:56:57 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
template MGCP_RecvFrom t_MGCP_RecvFrom(template MgcpMessage msg) := {
|
|
|
|
connId := ?,
|
|
|
|
remName := ?,
|
|
|
|
remPort := ?,
|
|
|
|
locName := ?,
|
|
|
|
locPort := ?,
|
|
|
|
msg := msg
|
2017-09-15 16:50:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type record MGCP_Send {
|
|
|
|
ConnectionId connId,
|
|
|
|
MgcpMessage msg
|
|
|
|
}
|
|
|
|
|
2019-06-18 15:21:52 +00:00
|
|
|
type record MGCP_SendTo {
|
|
|
|
ConnectionId connId,
|
|
|
|
HostName remName,
|
|
|
|
PortNumber remPort,
|
|
|
|
MgcpMessage msg
|
|
|
|
};
|
|
|
|
|
2017-09-15 16:56:57 +00:00
|
|
|
template MGCP_Send t_MGCP_Send(template ConnectionId connId, template MgcpMessage msg) := {
|
|
|
|
connId := connId,
|
|
|
|
msg := msg
|
|
|
|
}
|
|
|
|
|
2019-06-18 15:21:52 +00:00
|
|
|
template MGCP_SendTo t_MGCP_SendTo(template ConnectionId connId, HostName remName,
|
|
|
|
PortNumber remPort,template MgcpMessage msg) := {
|
|
|
|
connId := connId,
|
|
|
|
remName := remName,
|
|
|
|
remPort := remPort,
|
|
|
|
msg := msg
|
|
|
|
}
|
|
|
|
|
|
|
|
template MGCP_SendTo t_MGCP_SendToMrf(MGCP_RecvFrom mrf,template MgcpMessage msg) := {
|
|
|
|
connId := mrf.connId,
|
|
|
|
remName := mrf.remName,
|
|
|
|
remPort := mrf.remPort,
|
|
|
|
msg := msg
|
|
|
|
}
|
|
|
|
|
2017-09-15 16:50:08 +00:00
|
|
|
private function IPL4_to_MGCP_RecvFrom(in ASP_RecvFrom pin, out MGCP_RecvFrom pout) {
|
|
|
|
pout.connId := pin.connId;
|
|
|
|
pout.remName := pin.remName;
|
|
|
|
pout.remPort := pin.remPort;
|
|
|
|
pout.locName := pin.locName;
|
|
|
|
pout.locPort := pin.locPort;
|
2017-09-17 08:22:34 +00:00
|
|
|
/* FIXME: This should actually be the below:
|
|
|
|
pout.msg := dec_MgcpMessage(oct2char(pin.msg)); - see
|
|
|
|
https://www.eclipse.org/forums/index.php/t/1088893/
|
|
|
|
*/
|
2018-01-17 12:25:58 +00:00
|
|
|
pout.msg := dec_MgcpMessage(oct2char(pin.msg));
|
2017-09-15 16:50:08 +00:00
|
|
|
} with { extension "prototype(fast)" };
|
|
|
|
|
|
|
|
private function MGCP_to_IPL4_Send(in MGCP_Send pin, out ASP_Send pout) {
|
|
|
|
pout.connId := pin.connId;
|
|
|
|
pout.proto := { udp := {} };
|
|
|
|
pout.msg := char2oct(enc_MgcpMessage(pin.msg));
|
|
|
|
} with { extension "prototype(fast)" };
|
|
|
|
|
2019-06-18 15:21:52 +00:00
|
|
|
private function MGCP_to_IPL4_SendTo(in MGCP_SendTo pin, out ASP_SendTo out_ud) {
|
|
|
|
out_ud.connId := pin.connId;
|
|
|
|
out_ud.remName := pin.remName;
|
|
|
|
out_ud.remPort := pin.remPort;
|
|
|
|
out_ud.proto := { udp := {} };
|
|
|
|
out_ud.msg := char2oct(enc_MgcpMessage(pin.msg));
|
|
|
|
} with { extension "prototype(fast)" };
|
|
|
|
|
2017-09-15 16:50:08 +00:00
|
|
|
type port MGCP_CODEC_PT message {
|
2019-06-18 15:21:52 +00:00
|
|
|
out MGCP_Send,
|
|
|
|
MGCP_SendTo;
|
2017-09-15 16:50:08 +00:00
|
|
|
in MGCP_RecvFrom,
|
2017-11-18 12:00:57 +00:00
|
|
|
ASP_ConnId_ReadyToRelease,
|
2017-09-15 16:50:08 +00:00
|
|
|
ASP_Event;
|
|
|
|
} with { extension "user IPL4asp_PT
|
2019-06-18 15:21:52 +00:00
|
|
|
out(MGCP_Send -> ASP_Send:function(MGCP_to_IPL4_Send);
|
|
|
|
MGCP_SendTo -> ASP_SendTo: function(MGCP_to_IPL4_SendTo))
|
2017-09-15 16:50:08 +00:00
|
|
|
in(ASP_RecvFrom -> MGCP_RecvFrom: function(IPL4_to_MGCP_RecvFrom);
|
2017-11-18 12:00:57 +00:00
|
|
|
ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
|
2017-09-15 16:50:08 +00:00
|
|
|
ASP_Event -> ASP_Event: simple)"
|
|
|
|
}
|
|
|
|
}
|