summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-11-12 17:25:49 +0100
committerHarald Welte <laforge@osmocom.org>2020-11-12 21:51:40 +0100
commit69b3a4839f1de12dceb4101d87ea59331e823e24 (patch)
tree0ca1488ab62a7871fb7c1407f086e59d1fe2252d /library
parentde6f3ee592637fd8a5822b460c2378a735d1f359 (diff)
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
Diffstat (limited to 'library')
-rw-r--r--library/L3_Templates.ttcn20
-rw-r--r--library/Osmocom_Types.ttcn22
2 files changed, 22 insertions, 20 deletions
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 @@ template (value) PDU_L3_MS_SGSN ts_SM_DEACT_PDP_ACCEPT_MO(BIT3 tid)
-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 @@ function f_rnd_ra11_ps() return BIT11 {
}
+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)" }