From 7460a728fca547d763674ca15a9464f8fedbd533 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Wed, 10 Oct 2018 12:28:27 +0200 Subject: [PATCH] IPA_Types/Emulation: Add RSPRO support RSPRO is the protocol used by osmo-remsim. It is embedded into an IPA multiplex, and hence the TTCN-3 IPA code needs some extension to cover support for it. Change-Id: I536d6843b3e65b3ee35fbbcd6353e0fb0ce21c8e --- library/IPA_Emulation.ttcnpp | 48 +++++++++++++++++++++++++++++++++++- library/IPA_Types.ttcn | 3 ++- 2 files changed, 49 insertions(+), 2 deletions(-) diff --git a/library/IPA_Emulation.ttcnpp b/library/IPA_Emulation.ttcnpp index 7a26a6be6..413d2909f 100644 --- a/library/IPA_Emulation.ttcnpp +++ b/library/IPA_Emulation.ttcnpp @@ -8,7 +8,7 @@ module IPA_Emulation { * GSUP. IT hence transcodes messages so the user can work with abstract data types rather * than binary messages. It handles multiple packets inside one TCP segment. * - * (C) 2017 by Harald Welte + * (C) 2017-2018 by Harald Welte * All rights reserved. * * Released under the terms of GNU General Public License, Version 2 or @@ -39,6 +39,12 @@ import from MGCP_Types all; import from GSUP_Types all; #endif +#ifdef IPA_EMULATION_RSPRO +import from RSPRO all; +import from RSPRO_Types all; +#endif + + import from Osmocom_CTRL_Types all; modulepar { @@ -137,6 +143,14 @@ type port IPA_GSUP_PT message { } with { extension "internal" } #endif +#ifdef IPA_EMULATION_RSPRO +type port IPA_RSPRO_PT message { + inout RsproPDU, ASP_IPA_Event; +} with { extension "internal" } +#endif + + + type component IPA_Emulation_CT { /* down-facing port to IPA codec port */ @@ -159,6 +173,10 @@ type component IPA_Emulation_CT { /* up-facing port for GSUP */ port IPA_GSUP_PT IPA_GSUP_PORT; #endif +#ifdef IPA_EMULATION_RSPRO + /* up-facing port for RSPRO */ + port IPA_RSPRO_PT IPA_RSPRO_PORT; +#endif /* up-facing port for other streams */ port IPA_SP_PT IPA_SP_PORT; @@ -265,6 +283,11 @@ private function f_send_IPA_EVT(template ASP_IPA_Event evt) runs on IPA_Emulatio if (IPA_GSUP_PORT.checkstate("Connected")) { IPA_GSUP_PORT.send(evt); } +#endif +#ifdef IPA_EMULATION_RSPRO + if (IPA_RSPRO_PORT.checkstate("Connected")) { + IPA_RSPRO_PORT.send(evt); + } #endif /* FIXME: to other ports */ } @@ -455,6 +478,13 @@ private function f_gsup_to_user(octetstring msg) runs on IPA_Emulation_CT { } #endif +#ifdef IPA_EMULATION_RSPRO +private function f_rspro_to_user(octetstring msg) runs on IPA_Emulation_CT { + var RsproPDU rspro := dec_RsproPDU(msg); + IPA_RSPRO_PORT.send(rspro); +} +#endif + #ifdef IPA_EMULATION_MGCP private function f_mgcp_to_user(octetstring msg) runs on IPA_Emulation_CT { var charstring msg_ch := oct2char(msg); @@ -497,6 +527,9 @@ private function ScanEvents() runs on IPA_Emulation_CT { #ifdef IPA_EMULATION_RSL var ASP_RSL_Unitdata rsl; #endif +#ifdef IPA_EMULATION_RSPRO + var RsproPDU rspro; +#endif /* Set function for dissecting the binary */ var f_IPL4_getMsgLen vl_f := refers(f_IPL4_fixedMsgLen); @@ -558,6 +591,11 @@ private function ScanEvents() runs on IPA_Emulation_CT { case (IPAC_PROTO_EXT_GSUP) { f_gsup_to_user(ipa_rx.msg); } +#endif +#ifdef IPA_EMULATION_RSPRO + case (IPAC_PROTO_EXT_RSPRO) { + f_rspro_to_user(ipa_rx.msg); + } #endif case else { IPA_SP_PORT.send(f_to_asp(ipa_rx)); @@ -639,6 +677,14 @@ private function ScanEvents() runs on IPA_Emulation_CT { } #endif +#ifdef IPA_EMULATION_RSPRO + [] IPA_RSPRO_PORT.receive(RsproPDU:?) -> value rspro { + payload := enc_RsproPDU(rspro); + ipa_ud := valueof(t_ASP_IPA_UD(IPAC_PROTO_OSMO, payload, IPAC_PROTO_EXT_RSPRO)); + IPA_PORT.send(f_from_asp(g_ipa_conn_id, ipa_ud)); + } +#endif + #ifdef IPA_EMULATION_RSL /* Received RSL -> down into IPA */ [] IPA_RSL_PORT.receive(ASP_RSL_Unitdata:?) -> value rsl { diff --git a/library/IPA_Types.ttcn b/library/IPA_Types.ttcn index 3230329ec..1325b1419 100644 --- a/library/IPA_Types.ttcn +++ b/library/IPA_Types.ttcn @@ -32,7 +32,8 @@ type enumerated IpaExtStreamId { IPAC_PROTO_EXT_SMSC ('03'H), IPAC_PROTO_EXT_ORC ('04'H), IPAC_PROTO_EXT_GSUP ('05'H), - IPAC_PROTO_EXT_OAP ('06'H) + IPAC_PROTO_EXT_OAP ('06'H), + IPAC_PROTO_EXT_RSPRO ('07'H) } with { variant "FIELDLENGTH(8)" } external function enc_PDU_IPA(in PDU_IPA pdu) return octetstring