osmo-ttcn3-hacks/library/OSMUX_CodecPort.ttcn

75 lines
2.0 KiB
Plaintext

module OSMUX_CodecPort {
/* Simple Osmux Codec Port, translating between raw UDP primitives with
* octetstring payload towards the IPL4asp provider, and Osmux primitives
* which carry the decoded abstract Osmux data types as payload.
*
* (C) 2019 by sysmocom s.f.m.c. GmbH <info@sysmocom.de>
* All rights reserved.
*
* Author: Pau Espin Pedrol <pespin@sysmocom.de>
*
* Released under the terms of GNU General Public License, Version 2 or
* (at your option) any later version.
*/
import from IPL4asp_PortType all;
import from IPL4asp_Types all;
import from OSMUX_Types all;
type record Osmux_RecvFrom {
ConnectionId connId,
HostName remName,
PortNumber remPort,
HostName locName,
PortNumber locPort,
OSMUX_PDU msg
};
template Osmux_RecvFrom t_Osmux_RecvFrom(template OSMUX_PDU msg) := {
connId := ?,
remName := ?,
remPort := ?,
locName := ?,
locPort := ?,
msg := msg
}
type record Osmux_Send {
ConnectionId connId,
OSMUX_PDU msg
}
template Osmux_Send t_Osmux_Send(template ConnectionId connId, template OSMUX_PDU msg) := {
connId := connId,
msg := msg
}
private function IPL4_to_Osmux_RecvFrom(in ASP_RecvFrom pin, out Osmux_RecvFrom pout) {
pout.connId := pin.connId;
pout.remName := pin.remName;
pout.remPort := pin.remPort;
pout.locName := pin.locName;
pout.locPort := pin.locPort;
pout.msg := dec_OSMUX_PDU(pin.msg)
} with { extension "prototype(fast)" };
private function Osmux_to_IPL4_Send(in Osmux_Send pin, out ASP_Send pout) {
pout.connId := pin.connId;
pout.proto := { udp := {} };
pout.msg := enc_OSMUX_PDU(pin.msg);
} with { extension "prototype(fast)" };
type port OSMUX_CODEC_PT message {
out Osmux_Send;
in Osmux_RecvFrom,
ASP_ConnId_ReadyToRelease,
ASP_Event;
} with { extension "user IPL4asp_PT
out(Osmux_Send -> ASP_Send:function(Osmux_to_IPL4_Send))
in(ASP_RecvFrom -> Osmux_RecvFrom: function(IPL4_to_Osmux_RecvFrom);
ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
ASP_Event -> ASP_Event: simple)"
}
}