aboutsummaryrefslogtreecommitdiffstats
path: root/library/VPCD_CodecPort.ttcn
blob: a9ae97fd02871a3e7fe75eb07d79bffa1fbc6e25 (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
57
58
59
60
61
62
63
64
module VPCD_CodecPort {

/* Simple VPCD Codec Port, translating between raw TCP octetstring payload
 * towards the IPL4asp port provider, and VPCD primitives
 * which carry the decoded VPCD data types as payload.
 *
 * (C) 2018 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.
 */


import from IPL4asp_PortType all;
import from IPL4asp_Types all;
import from VPCD_Types all;

type record VPCD_RecvFrom {
	ConnectionId	connId,
	VPCD_PDU	msg
}

type record VPCD_Send {
	ConnectionId	connId,
	VPCD_PDU	msg
}

template (value) VPCD_Send ts_VPCD_Send(ConnectionId conn_id, template (value) VPCD_PDU msg) := {
	connId := conn_id,
	msg := msg
}

template VPCD_RecvFrom tr_VPCD_Recv(template ConnectionId conn_id, template VPCD_PDU msg) := {
	connId := conn_id,
	msg := msg
}

private function IPL4_to_VPCD_RecvFrom(in ASP_RecvFrom pin, out VPCD_RecvFrom pout) {
	pout.connId := pin.connId;
	pout.msg := dec_VPCD_PDU(pin.msg);
} with { extension "prototype(fast)" }

private function VPCD_to_IPL4_Send(in VPCD_Send pin, out ASP_Send pout) {
	pout.connId := pin.connId;
	pout.proto := { tcp := {} };
	pout.msg := enc_VPCD_PDU(pin.msg);
} with { extension "prototype(fast)" }

type port VPCD_CODEC_PT message {
	out	VPCD_Send;
	in	VPCD_RecvFrom,
		ASP_ConnId_ReadyToRelease,
		ASP_Event;
} with { extension "user IPL4asp_PT
	out(VPCD_Send -> ASP_Send: function(VPCD_to_IPL4_Send))
	in(ASP_RecvFrom -> VPCD_RecvFrom: function(IPL4_to_VPCD_RecvFrom);
	   ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
	   ASP_Event -> ASP_Event: simple)"
}



}