Change in osmo-ttcn3-hacks[master]: move imsi_hex2oct to Osmocom_Types.ttcn

Harald Welte gerrit-no-reply at lists.osmocom.org
Thu May 2 17:17:01 UTC 2019


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/13851 )

Change subject: move imsi_hex2oct to Osmocom_Types.ttcn
......................................................................

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
---
M library/Osmocom_Types.ttcn
M msc/BSC_ConnectionHandler.ttcn
2 files changed, 19 insertions(+), 19 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



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 */

-- 
To view, visit https://gerrit.osmocom.org/13851
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic23669671ce79151046f2330726bb68542faeb0e
Gerrit-Change-Number: 13851
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190502/bfdac171/attachment.html>


More information about the gerrit-log mailing list