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

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

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


Harald Welte has uploaded this change for review. ( 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(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-ttcn3-hacks refs/changes/51/13851/1

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: newchange
Gerrit-Change-Id: Ic23669671ce79151046f2330726bb68542faeb0e
Gerrit-Change-Number: 13851
Gerrit-PatchSet: 1
Gerrit-Owner: Harald Welte <laforge at gnumonks.org>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190502/38bcc6cd/attachment.htm>


More information about the gerrit-log mailing list