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
This commit is contained in:
parent
de6f3ee592
commit
69b3a4839f
|
@ -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
|
external function enc_MobileIdentityLV(in MobileIdentityLV si) return octetstring
|
||||||
with { extension "prototype(convert) encode(RAW)" };
|
with { extension "prototype(convert) encode(RAW)" };
|
||||||
|
|
||||||
|
|
|
@ -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)" }
|
} with { encode "RAW"; variant "FIELDORDER(msb)" }
|
||||||
|
|
Loading…
Reference in New Issue