diff options
Diffstat (limited to 'library/sabp/SABP_CodecPort.ttcn')
-rw-r--r-- | library/sabp/SABP_CodecPort.ttcn | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/library/sabp/SABP_CodecPort.ttcn b/library/sabp/SABP_CodecPort.ttcn new file mode 100644 index 00000000..65fb5420 --- /dev/null +++ b/library/sabp/SABP_CodecPort.ttcn @@ -0,0 +1,65 @@ +module SABP_CodecPort { + +/* Simple SABP Codec Port, translating between raw TCP octetstring payload + * towards the IPL4asp port provider, and SABP primitives + * which carry the decoded SABP data types as payload. + * + * (C) 2019 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 SABP_PDU_Descriptions all; +import from SABP_Types all; + +type record SABP_RecvFrom { + ConnectionId connId, + SABP_PDU msg +} + +type record SABP_Send { + ConnectionId connId, + SABP_PDU msg +} + +template (value) SABP_Send ts_SABP_Send(ConnectionId conn_id, template (value) SABP_PDU msg) := { + connId := conn_id, + msg := msg +} + +template SABP_RecvFrom tr_SABP_Recv(template ConnectionId conn_id, template SABP_PDU msg) := { + connId := conn_id, + msg := msg +} + +private function IPL4_to_SABP_RecvFrom(in ASP_RecvFrom pin, out SABP_RecvFrom pout) { + pout.connId := pin.connId; + pout.msg := dec_SABP_PDU(pin.msg); +} with { extension "prototype(fast)" } + +private function SABP_to_IPL4_Send(in SABP_Send pin, out ASP_Send pout) { + pout.connId := pin.connId; + pout.proto := { tcp := {} }; + pout.msg := enc_SABP_PDU(pin.msg); +} with { extension "prototype(fast)" } + +type port SABP_CODEC_PT message { + out SABP_Send; + in SABP_RecvFrom, + ASP_ConnId_ReadyToRelease, + ASP_Event; +} with { extension "user IPL4asp_PT + out(SABP_Send -> ASP_Send: function(SABP_to_IPL4_Send)) + in(ASP_RecvFrom -> SABP_RecvFrom: function(IPL4_to_SABP_RecvFrom); + ASP_ConnId_ReadyToRelease -> ASP_ConnId_ReadyToRelease: simple; + ASP_Event -> ASP_Event: simple)" +} + + + +} |