osmo-ttcn3-hacks/library/S1AP_CodecPort.ttcn

83 lines
2.1 KiB
Plaintext

module S1AP_CodecPort {
/* Simple S1AP Codec Port, translating between raw SCTP primitives with
* octetstring payload towards the IPL4asp provider, and S1AP primitives
* which carry the decoded S1AP data types as payload.
*
* (C) 2019 by Harald Welte <laforge@gnumonks.org>
* All rights reserved.
*
* Released under the terms of GNU General Public License, Version 2 or
* (at your option) any later version.
*
* SPDX-License-Identifier: GPL-2.0-or-later
*/
import from IPL4asp_PortType all;
import from IPL4asp_Types all;
import from S1AP_PDU_Descriptions all;
import from S1AP_Types all;
type record S1AP_RecvFrom {
ConnectionId connId,
HostName remName,
PortNumber remPort,
HostName locName,
PortNumber locPort,
S1AP_PDU msg
};
template S1AP_RecvFrom t_S1AP_RecvFrom(template S1AP_PDU msg) := {
connId := ?,
remName := ?,
remPort := ?,
locName := ?,
locPort := ?,
msg := msg
}
type record S1AP_Send {
ConnectionId connId,
S1AP_PDU msg
}
template S1AP_Send t_S1AP_Send(template ConnectionId connId, template S1AP_PDU msg) := {
connId := connId,
msg := msg
}
private function IPL4_to_S1AP_RecvFrom(in ASP_RecvFrom pin, out S1AP_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_S1AP_PDU(pin.msg);
} with { extension "prototype(fast)" };
private function S1AP_to_IPL4_Send(in S1AP_Send pin, out ASP_Send pout) {
pout.connId := pin.connId;
pout.proto := {
sctp := {
sinfo_stream := omit,
sinfo_ppid := 18,
remSocks := omit,
assocId := omit
}
};
pout.msg := enc_S1AP_PDU(pin.msg);
} with { extension "prototype(fast)" };
type port S1AP_CODEC_PT message {
out S1AP_Send;
in S1AP_RecvFrom,
ASP_ConnId_ReadyToRelease,
ASP_Event;
} with { extension "user IPL4asp_PT
out(S1AP_Send -> ASP_Send:function(S1AP_to_IPL4_Send))
in(ASP_RecvFrom -> S1AP_RecvFrom: function(IPL4_to_S1AP_RecvFrom);
ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
ASP_Event -> ASP_Event: simple)"
}
}