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
diff --git a/library/L1CTL_PortType.ttcn b/library/L1CTL_PortType.ttcn
index 5c554c2..80e33a8 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 @@
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 34bbcd9..ca44a02 100644
--- a/library/NS_Emulation.ttcnpp
+++ b/library/NS_Emulation.ttcnpp
@@ -217,8 +217,8 @@
/* 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 @@
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 @@
}
} 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 @@
}
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 e813a11..06920bf 100644
--- a/library/Osmocom_Types.ttcn
+++ b/library/Osmocom_Types.ttcn
@@ -283,5 +283,19 @@
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)" }