65 lines
1.7 KiB
Plaintext
65 lines
1.7 KiB
Plaintext
module OPCAP_CodecPort {
|
|
|
|
/* Simple OPCAP Codec Port, translating between raw TCP octetstring payload
|
|
* towards the IPL4asp port provider, and OPCAP primitives
|
|
* which carry the decoded OPCAP data types as payload.
|
|
*
|
|
* (C) 2021 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 OPCAP_Types all;
|
|
|
|
type record OPCAP_RecvFrom {
|
|
ConnectionId connId,
|
|
OPCAP_PDU msg
|
|
}
|
|
|
|
type record OPCAP_Send {
|
|
ConnectionId connId,
|
|
OPCAP_PDU msg
|
|
}
|
|
|
|
template (value) OPCAP_Send ts_OPCAP_Send(ConnectionId conn_id, template (value) OPCAP_PDU msg) := {
|
|
connId := conn_id,
|
|
msg := msg
|
|
}
|
|
|
|
template OPCAP_RecvFrom tr_OPCAP_Recv(template ConnectionId conn_id, template OPCAP_PDU msg) := {
|
|
connId := conn_id,
|
|
msg := msg
|
|
}
|
|
|
|
private function IPL4_to_OPCAP_RecvFrom(in ASP_RecvFrom pin, out OPCAP_RecvFrom pout) {
|
|
pout.connId := pin.connId;
|
|
pout.msg := dec_OPCAP_PDU(pin.msg);
|
|
} with { extension "prototype(fast)" }
|
|
|
|
private function OPCAP_to_IPL4_Send(in OPCAP_Send pin, out ASP_Send pout) {
|
|
pout.connId := pin.connId;
|
|
pout.proto := { tcp := {} };
|
|
pout.msg := enc_OPCAP_PDU(pin.msg);
|
|
} with { extension "prototype(fast)" }
|
|
|
|
type port OPCAP_CODEC_PT message {
|
|
out OPCAP_Send;
|
|
in OPCAP_RecvFrom,
|
|
ASP_ConnId_ReadyToRelease,
|
|
ASP_Event;
|
|
} with { extension "user IPL4asp_PT
|
|
out(OPCAP_Send -> ASP_Send: function(OPCAP_to_IPL4_Send))
|
|
in(ASP_RecvFrom -> OPCAP_RecvFrom: function(IPL4_to_OPCAP_RecvFrom);
|
|
ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple;
|
|
ASP_Event -> ASP_Event: simple)"
|
|
}
|
|
|
|
|
|
|
|
}
|