2019-07-16 10:43:32 +00:00
|
|
|
/* dual-faced port sitting on top of IPL4_asp UDP to encode/decode GTPv2C
|
|
|
|
* (C) 2019 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
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
module GTPv2_CodecPort {
|
|
|
|
import from IPL4asp_PortType all;
|
|
|
|
import from IPL4asp_Types all;
|
2020-03-12 19:00:48 +00:00
|
|
|
import from GTPv2_Types all;
|
2019-07-16 10:43:32 +00:00
|
|
|
|
|
|
|
/* identifies a remote peer (sender or receiver) */
|
2024-02-29 18:47:07 +00:00
|
|
|
type record Gtp2cPeer {
|
2019-07-16 10:43:32 +00:00
|
|
|
ConnectionId connId,
|
|
|
|
HostName remName,
|
2020-03-12 19:00:48 +00:00
|
|
|
IPL4asp_Types.PortNumber remPort
|
2019-07-16 10:43:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Decoded GTP2C (Control Plane), used in send and receive direction */
|
|
|
|
type record Gtp2cUnitdata {
|
2024-02-29 18:47:07 +00:00
|
|
|
Gtp2cPeer peer,
|
2019-07-16 10:43:32 +00:00
|
|
|
PDU_GTPCv2 gtpc
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Translation port on top of IPL4asp; ASP_Event passed through transparently */
|
|
|
|
type port GTPv2C_PT message {
|
|
|
|
out Gtp2cUnitdata;
|
|
|
|
in Gtp2cUnitdata,
|
|
|
|
ASP_ConnId_ReadyToRelease,
|
|
|
|
ASP_Event;
|
|
|
|
} with { extension "user IPL4asp_PT
|
|
|
|
out(Gtp2cUnitdata -> ASP_SendTo: function(f_enc_Gtp2cUD))
|
|
|
|
in(ASP_RecvFrom -> Gtp2cUnitdata: function(f_dec_Gtp2cUD);
|
|
|
|
ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
|
|
|
|
ASP_Event -> ASP_Event: simple)" }
|
|
|
|
|
|
|
|
private function f_enc_Gtp2cUD(in Gtp2cUnitdata in_ud, out ASP_SendTo out_ud) {
|
|
|
|
out_ud.connId := in_ud.peer.connId;
|
|
|
|
out_ud.remName := in_ud.peer.remName;
|
|
|
|
out_ud.remPort := in_ud.peer.remPort;
|
|
|
|
out_ud.proto := { udp := {} };
|
|
|
|
out_ud.msg := enc_PDU_GTPCv2(in_ud.gtpc);
|
|
|
|
} with { extension "prototype(fast)" };
|
|
|
|
|
|
|
|
private function f_dec_Gtp2cUD(in ASP_RecvFrom in_ud, out Gtp2cUnitdata out_ud) {
|
|
|
|
out_ud.peer.connId := in_ud.connId;
|
|
|
|
out_ud.peer.remName := in_ud.remName;
|
|
|
|
out_ud.peer.remPort := in_ud.remPort;
|
|
|
|
out_ud.gtpc := dec_PDU_GTPCv2(in_ud.msg);
|
|
|
|
} with { extension "prototype(fast)" };
|
|
|
|
|
|
|
|
}
|