65 lines
1.6 KiB
Plaintext
65 lines
1.6 KiB
Plaintext
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)"
|
|
}
|
|
|
|
|
|
|
|
}
|