aboutsummaryrefslogtreecommitdiffstats
path: root/library/PFCP_CodecPort.ttcn
blob: 8d4078dd0deaf15c10c1cc09746d04b9a1ddeec4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
/* dual-faced port sitting on top of IPL4_asp UDP to encode/decode PFCP
 *
 * (C) 2022 sysmocom - s.f.m.c. GmbH <info@sysmocom.de>
 * 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 PFCP_CodecPort {

import from IPL4asp_PortType all;
import from IPL4asp_Types all;
import from PFCP_Types all;

/* identifies a remote peer (sender or receiver) */
type record PFCP_Peer {
	ConnectionId conn_id,
	HostName remote_name,
	PortNumber remote_port
}

type record PFCP_Unitdata {
	PFCP_Peer peer,
	PDU_PFCP pdu
}

/* Translation port on top of IPL4asp; ASP_Event passed through transparently */
type port PFCP_PT message {
	out PFCP_Unitdata;
	in PFCP_Unitdata,
	   ASP_ConnId_ReadyToRelease,
	   ASP_Event;
} with { extension "user IPL4asp_PT
	out(PFCP_Unitdata -> ASP_SendTo: function(f_enc_pfcp_unitdata))
	in(ASP_RecvFrom -> PFCP_Unitdata: function(f_dec_pfcp_unitdata);
	   ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
	   ASP_Event -> ASP_Event: simple)" }

private function f_enc_pfcp_unitdata(in PFCP_Unitdata in_ud, out ASP_SendTo out_ud) {
	out_ud.connId := in_ud.peer.conn_id;
	out_ud.remName := in_ud.peer.remote_name;
	out_ud.remPort := in_ud.peer.remote_port;
	out_ud.proto := { udp := {} };
	out_ud.msg := enc_PDU_PFCP(in_ud.pdu);
} with { extension "prototype(fast)" };

private function f_dec_pfcp_unitdata(in ASP_RecvFrom in_ud, out PFCP_Unitdata out_ud) {
	out_ud.peer.conn_id := in_ud.connId;
	out_ud.peer.remote_name := in_ud.remName;
	out_ud.peer.remote_port := in_ud.remPort;
	out_ud.pdu := dec_PDU_PFCP(in_ud.msg);
} with { extension "prototype(fast)" };

}