blob: f2d215dbc0d6962d7e0970f5ec4f564118067f2f [file] [log] [blame]
Harald Weltec4ac9e02021-04-22 23:07:44 +02001module OPCAP_CodecPort {
2
3/* Simple OPCAP Codec Port, translating between raw TCP octetstring payload
4 * towards the IPL4asp port provider, and OPCAP primitives
5 * which carry the decoded OPCAP data types as payload.
6 *
7 * (C) 2021 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 OPCAP_Types all;
18
19type record OPCAP_RecvFrom {
20 ConnectionId connId,
21 OPCAP_PDU msg
22}
23
24type record OPCAP_Send {
25 ConnectionId connId,
26 OPCAP_PDU msg
27}
28
29template (value) OPCAP_Send ts_OPCAP_Send(ConnectionId conn_id, template (value) OPCAP_PDU msg) := {
30 connId := conn_id,
31 msg := msg
32}
33
34template OPCAP_RecvFrom tr_OPCAP_Recv(template ConnectionId conn_id, template OPCAP_PDU msg) := {
35 connId := conn_id,
36 msg := msg
37}
38
39private function IPL4_to_OPCAP_RecvFrom(in ASP_RecvFrom pin, out OPCAP_RecvFrom pout) {
40 pout.connId := pin.connId;
41 pout.msg := dec_OPCAP_PDU(pin.msg);
42} with { extension "prototype(fast)" }
43
44private function OPCAP_to_IPL4_Send(in OPCAP_Send pin, out ASP_Send pout) {
45 pout.connId := pin.connId;
46 pout.proto := { tcp := {} };
47 pout.msg := enc_OPCAP_PDU(pin.msg);
48} with { extension "prototype(fast)" }
49
50type port OPCAP_CODEC_PT message {
51 out OPCAP_Send;
52 in OPCAP_RecvFrom,
53 ASP_ConnId_ReadyToRelease,
54 ASP_Event;
55} with { extension "user IPL4asp_PT
56 out(OPCAP_Send -> ASP_Send: function(OPCAP_to_IPL4_Send))
57 in(ASP_RecvFrom -> OPCAP_RecvFrom: function(IPL4_to_OPCAP_RecvFrom);
58 ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
59 ASP_Event -> ASP_Event: simple)"
60}
61
62
63
64}