move imsi_hex2oct to Osmocom_Types.ttcn
This function is required not only for the MSC_Tests, but also for
the upcoming Iu related SGSN tests
Change-Id: Ic23669671ce79151046f2330726bb68542faeb0e
diff --git a/library/Osmocom_Types.ttcn b/library/Osmocom_Types.ttcn
index 90b2758..2a4f68c 100644
--- a/library/Osmocom_Types.ttcn
+++ b/library/Osmocom_Types.ttcn
@@ -133,5 +133,24 @@
return x;
}
+function imsi_hex2oct(hexstring imsi) return octetstring {
+ var hexstring tmp := ''H;
+ var octetstring ret;
+ var integer i;
+
+ /* swap nibbles and pad with F if insufficient input nibbles */
+ for (i := 0; i < lengthof(imsi); i := i+1) {
+ if (i+1 < lengthof(imsi)) {
+ tmp := tmp & imsi[i+1];
+ } else {
+ tmp := tmp & 'F'H;
+ }
+ tmp := tmp & imsi[i];
+ i := i+1;
+ }
+ ret := hex2oct(tmp);
+ return ret;
+}
+
} with { encode "RAW"; variant "FIELDORDER(msb)" }
diff --git a/msc/BSC_ConnectionHandler.ttcn b/msc/BSC_ConnectionHandler.ttcn
index b1a0491..595f402 100644
--- a/msc/BSC_ConnectionHandler.ttcn
+++ b/msc/BSC_ConnectionHandler.ttcn
@@ -86,25 +86,6 @@
boolean ran_is_geran
};
-function imsi_hex2oct(hexstring imsi) return octetstring {
- var hexstring tmp := ''H;
- var octetstring ret;
- var integer i;
-
- /* swap nibbles and pad with F if insufficient input nibbles */
- for (i := 0; i < lengthof(imsi); i := i+1) {
- if (i+1 < lengthof(imsi)) {
- tmp := tmp & imsi[i+1];
- } else {
- tmp := tmp & 'F'H;
- }
- tmp := tmp & imsi[i];
- i := i+1;
- }
- ret := hex2oct(tmp);
- return ret;
-}
-
/* get a one-octet bitmaks of supported algorithms based on Classmark information */
function f_alg_mask_from_cm(BSSMAP_IE_ClassmarkInformationType2 cm2) return OCT1 {
var BIT8 res := '00000001'B; /* A5/0 always supported */