blob: a9ae97fd02871a3e7fe75eb07d79bffa1fbc6e25 [file] [log] [blame]
Harald Welte619b2a62019-11-22 00:35:52 +01001module VPCD_CodecPort {
2
3/* Simple VPCD Codec Port, translating between raw TCP octetstring payload
4 * towards the IPL4asp port provider, and VPCD primitives
5 * which carry the decoded VPCD data types as payload.
6 *
7 * (C) 2018 by Harald Welte <laforge@gnumonks.org>
8 * All rights reserved.
9 *
10 * Released under the terms of GNU General Public License, Version 2 or
11 * (at your option) any later version.
12 */
13
14
15import from IPL4asp_PortType all;
16import from IPL4asp_Types all;
17import from VPCD_Types all;
18
19type record VPCD_RecvFrom {
20 ConnectionId connId,
21 VPCD_PDU msg
22}
23
24type record VPCD_Send {
25 ConnectionId connId,
26 VPCD_PDU msg
27}
28
29template (value) VPCD_Send ts_VPCD_Send(ConnectionId conn_id, template (value) VPCD_PDU msg) := {
30 connId := conn_id,
31 msg := msg
32}
33
34template VPCD_RecvFrom tr_VPCD_Recv(template ConnectionId conn_id, template VPCD_PDU msg) := {
35 connId := conn_id,
36 msg := msg
37}
38
39private function IPL4_to_VPCD_RecvFrom(in ASP_RecvFrom pin, out VPCD_RecvFrom pout) {
40 pout.connId := pin.connId;
41 pout.msg := dec_VPCD_PDU(pin.msg);
42} with { extension "prototype(fast)" }
43
44private function VPCD_to_IPL4_Send(in VPCD_Send pin, out ASP_Send pout) {
45 pout.connId := pin.connId;
46 pout.proto := { tcp := {} };
47 pout.msg := enc_VPCD_PDU(pin.msg);
48} with { extension "prototype(fast)" }
49
50type port VPCD_CODEC_PT message {
51 out VPCD_Send;
52 in VPCD_RecvFrom,
53 ASP_ConnId_ReadyToRelease,
54 ASP_Event;
55} with { extension "user IPL4asp_PT
56 out(VPCD_Send -> ASP_Send: function(VPCD_to_IPL4_Send))
57 in(ASP_RecvFrom -> VPCD_RecvFrom: function(IPL4_to_VPCD_RecvFrom);
58 ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
59 ASP_Event -> ASP_Event: simple)"
60}
61
62
63
64}