From aaa0dfdd3f60458eee6cbd26317c7df8ad2ca6ce Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Thu, 4 Feb 2021 16:58:53 +0100 Subject: [PATCH] Move "ro_integer" to Osmocom_Types We don't need several re-definitions of a "record of integer" type, plus associated helper functions. Let's move that to the shared Osmocom_Types.ttcn Change-Id: I6a68ab8180a40b93c540db9cb80941c39c2fb549 --- gbproxy/GBProxy_Tests.ttcn | 13 ------------- library/L1CTL_PortType.ttcn | 4 ++-- library/NS_Emulation.ttcnpp | 9 ++++----- library/Osmocom_Types.ttcn | 14 ++++++++++++++ 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/gbproxy/GBProxy_Tests.ttcn b/gbproxy/GBProxy_Tests.ttcn index 506ed389d..ad8874c78 100644 --- a/gbproxy/GBProxy_Tests.ttcn +++ b/gbproxy/GBProxy_Tests.ttcn @@ -498,19 +498,6 @@ private function f_init_vty() runs on test_CT { f_vty_transceive(GBPVTY, "enable"); } -type record of integer ro_integer; - -private function ro_integer_contains(ro_integer r, integer x) return boolean { - for (var integer j := 0; j < lengthof(r); j := j+1) { - if (r[j] == x) { - return true; - } - } - return false; -} - -private type record of ro_integer roro_integer; - /* count the number of unblocked BVCI for each SGSN NSE */ private altstep as_count_unblocked4nse(integer sgsn_idx, inout roro_integer bvci_unblocked) runs on test_CT { diff --git a/library/L1CTL_PortType.ttcn b/library/L1CTL_PortType.ttcn index 5c554c2b6..80e33a81f 100644 --- a/library/L1CTL_PortType.ttcn +++ b/library/L1CTL_PortType.ttcn @@ -12,9 +12,9 @@ module L1CTL_PortType { import from L1CTL_Types all; import from UD_PortType all; + import from Socket_API_Definitions all; import from UD_Types all; import from Osmocom_Types all; - import from Osmocom_Types all; import from GSM_Types all; import from GSM_RR_Types all; import from L1CTL_PortType_CtrlFunct all; @@ -32,7 +32,7 @@ module L1CTL_PortType { charstring m_l1ctl_sock_path := "/tmp/osmocom_l2"; } - function f_L1CTL_getMsgLen(in octetstring stream, inout ro_integer args) return integer { + function f_L1CTL_getMsgLen(in octetstring stream, inout Socket_API_Definitions.ro_integer args) return integer { var integer stream_len := lengthof(stream); var integer len; if (stream_len < 2) { diff --git a/library/NS_Emulation.ttcnpp b/library/NS_Emulation.ttcnpp index 34bbcd946..ca44a0258 100644 --- a/library/NS_Emulation.ttcnpp +++ b/library/NS_Emulation.ttcnpp @@ -217,8 +217,8 @@ module NS_Emulation { /* references to the per-NSVC components */ var NsvcTable g_nsvcs := {}; /* list of indexes to g_nsvcs[] of currently unblocked NSVCs */ - var ro_integer g_unblocked_nsvcs_sig := {}; - var ro_integer g_unblocked_nsvcs_data := {}; + var Osmocom_Types.ro_integer g_unblocked_nsvcs_sig := {}; + var Osmocom_Types.ro_integer g_unblocked_nsvcs_data := {}; }; type record NsvcTableEntry { NSVCConfiguration cfg, @@ -226,7 +226,6 @@ module NS_Emulation { NsvcState state }; type record of NsvcTableEntry NsvcTable; - type record of integer ro_integer; /* internal port from the NS-VC point of view */ type port NSint_SP_PT message { @@ -319,7 +318,7 @@ module NS_Emulation { } } else if (g_nsvcs[i].state == NSVC_S_ALIVE_UNBLOCKED and state != NSVC_S_ALIVE_UNBLOCKED) { /* remove index to list of unblocked NSVCs */ - var ro_integer new_unblocked_nsvcs_sig := {}; + var Osmocom_Types.ro_integer new_unblocked_nsvcs_sig := {}; for (var integer j := 0; j < lengthof(g_unblocked_nsvcs_sig); j := j+1) { if (g_unblocked_nsvcs_sig[j] != i) { new_unblocked_nsvcs_sig := new_unblocked_nsvcs_sig & {j}; @@ -327,7 +326,7 @@ module NS_Emulation { } g_unblocked_nsvcs_sig := new_unblocked_nsvcs_sig; - var ro_integer new_unblocked_nsvcs_data := {}; + var Osmocom_Types.ro_integer new_unblocked_nsvcs_data := {}; for (var integer j := 0; j < lengthof(g_unblocked_nsvcs_data); j := j+1) { if (g_unblocked_nsvcs_data[j] != i) { new_unblocked_nsvcs_data := new_unblocked_nsvcs_data & {j}; diff --git a/library/Osmocom_Types.ttcn b/library/Osmocom_Types.ttcn index e813a11ce..06920bf0a 100644 --- a/library/Osmocom_Types.ttcn +++ b/library/Osmocom_Types.ttcn @@ -283,5 +283,19 @@ function f_gen_tmsi(integer suffix, integer nri_v := 0, integer nri_bitlen := 10 return tmsi; } +type record of integer ro_integer; + +function ro_integer_contains(ro_integer r, integer x) return boolean { + for (var integer j := 0; j < lengthof(r); j := j+1) { + if (r[j] == x) { + return true; + } + } + return false; +} + +type record of ro_integer roro_integer; + + } with { encode "RAW"; variant "FIELDORDER(msb)" }