Change in osmo-ttcn3-hacks[master]: move f_gen_{imsi, imei, msisdn} from L3_Templates to Osmocom_Types

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

laforge gerrit-no-reply at lists.osmocom.org
Thu Nov 12 20:56:45 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21129 )

Change subject: move f_gen_{imsi,imei,msisdn} from L3_Templates to Osmocom_Types
......................................................................

move f_gen_{imsi,imei,msisdn} from L3_Templates to Osmocom_Types

Those functions don't depend on any L3 specific data structurs, and
it is not a good idea to burden every user with having to impot all
of a 2G/3G Layer3 just to generate some hexstring identifiers.

Change-Id: I7880633a46afc607f16f8aa6ea1a277f7958c95b
---
M library/L3_Templates.ttcn
M library/Osmocom_Types.ttcn
2 files changed, 22 insertions(+), 20 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/library/L3_Templates.ttcn b/library/L3_Templates.ttcn
index 2ef8773..2eb0bb2 100644
--- a/library/L3_Templates.ttcn
+++ b/library/L3_Templates.ttcn
@@ -2968,26 +2968,6 @@
 
 
 
-private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring {
-	var integer suffix_len := tot_len - lengthof(prefix);
-	var charstring suffix_ch := int2str(suffix);
-	var integer pad_len := suffix_len - lengthof(suffix_ch);
-
-	return prefix & int2hex(0, pad_len) & str2hex(suffix_ch);
-}
-
-function f_gen_imei(integer suffix) return hexstring {
-	return f_concat_pad(14, '49999'H, suffix);
-}
-
-function f_gen_imsi(integer suffix) return hexstring {
-	return f_concat_pad(15, '26242'H, suffix);
-}
-
-function f_gen_msisdn(integer suffix) return hexstring {
-	return f_concat_pad(12, '49123'H, suffix);
-}
-
 external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring
 	with { extension "prototype(convert) encode(RAW)" };
 
diff --git a/library/Osmocom_Types.ttcn b/library/Osmocom_Types.ttcn
index ee3b04a..4012f6d 100644
--- a/library/Osmocom_Types.ttcn
+++ b/library/Osmocom_Types.ttcn
@@ -252,4 +252,26 @@
 }
 
 
+private function f_concat_pad(integer tot_len, hexstring prefix, integer suffix) return hexstring {
+	var integer suffix_len := tot_len - lengthof(prefix);
+	var charstring suffix_ch := int2str(suffix);
+	var integer pad_len := suffix_len - lengthof(suffix_ch);
+
+	return prefix & int2hex(0, pad_len) & str2hex(suffix_ch);
+}
+
+function f_gen_imei(integer suffix) return hexstring {
+	return f_concat_pad(14, '49999'H, suffix);
+}
+
+function f_gen_imsi(integer suffix) return hexstring {
+	return f_concat_pad(15, '26242'H, suffix);
+}
+
+function f_gen_msisdn(integer suffix) return hexstring {
+	return f_concat_pad(12, '49123'H, suffix);
+}
+
+
+
 } with { encode "RAW"; variant "FIELDORDER(msb)" }

-- 
To view, visit https://gerrit.osmocom.org/c/osmo-ttcn3-hacks/+/21129
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ttcn3-hacks
Gerrit-Branch: master
Gerrit-Change-Id: I7880633a46afc607f16f8aa6ea1a277f7958c95b
Gerrit-Change-Number: 21129
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20201112/6e04ed9d/attachment.htm>


More information about the gerrit-log mailing list