move f_gprs_tlli_{type,random} to Osmocom_Gb_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: I6fc41ed94e97e0ec44dc4ea56d110bdd9ac77a72
diff --git a/library/L3_Common.ttcn b/library/L3_Common.ttcn
index 981c6ba..a2c27bf 100644
--- a/library/L3_Common.ttcn
+++ b/library/L3_Common.ttcn
@@ -47,45 +47,6 @@
return vec;
}
-/* 3GPP TS 23.003 2.6 */
-type enumerated TlliType {
- TLLI_LOCAL,
- TLLI_FOREIGN,
- TLLI_RANDOM,
- TLLI_AUXILIARY,
- TLLI_RESERVED,
- TLLI_G_RNTI,
- TLLI_RAND_G_RNTI
-}
-
-/* 3GPP TS 23.003 2.6 */
-function f_gprs_tlli_type(OCT4 tlli) return TlliType {
- var bitstring tllib := oct2bit(tlli);
- if (substr(tllib, 0, 2) == '11'B) {
- return TLLI_LOCAL;
- } else if (substr(tllib, 0, 2) == '10'B) {
- return TLLI_FOREIGN;
- } else if (substr(tllib, 0, 5) == '01111'B) {
- return TLLI_RANDOM;
- } else if (substr(tllib, 0, 4) == '0110'B) {
- return TLLI_RESERVED;
- } else if (substr(tllib, 0, 3) == '010'B) {
- return TLLI_RESERVED;
- } else if (substr(tllib, 0, 4) == '0000'B) {
- return TLLI_G_RNTI;
- } else if (substr(tllib, 0, 4) == '0001'B) {
- return TLLI_RAND_G_RNTI;
- } else {
- setverdict(fail, "Unknonw TLLI Type ", tllib);
- mtc.stop;
- }
-}
-
-function f_gprs_tlli_random() return OCT4 {
- var OCT4 tlli := f_rnd_octstring(4);
- return tlli or4b 'c0000000'O;
-}
-
function f_RAI(HEX0_3n mcc, HEX0_3n mnc, OCT2 lac, OCT1 rac) return RoutingAreaIdentificationV {
if (lengthof(mnc) == 2) {
mnc := mnc & 'F'H;
diff --git a/library/Osmocom_Gb_Types.ttcn b/library/Osmocom_Gb_Types.ttcn
index 5ffca7a..ee1437c 100644
--- a/library/Osmocom_Gb_Types.ttcn
+++ b/library/Osmocom_Gb_Types.ttcn
@@ -1785,5 +1785,45 @@
return oct2int(valueof(bvci_raw.unstructured_value));
}
+/* 3GPP TS 23.003 2.6 */
+type enumerated TlliType {
+ TLLI_LOCAL,
+ TLLI_FOREIGN,
+ TLLI_RANDOM,
+ TLLI_AUXILIARY,
+ TLLI_RESERVED,
+ TLLI_G_RNTI,
+ TLLI_RAND_G_RNTI
+}
+
+/* 3GPP TS 23.003 2.6 */
+function f_gprs_tlli_type(OCT4 tlli) return TlliType {
+ var bitstring tllib := oct2bit(tlli);
+ if (substr(tllib, 0, 2) == '11'B) {
+ return TLLI_LOCAL;
+ } else if (substr(tllib, 0, 2) == '10'B) {
+ return TLLI_FOREIGN;
+ } else if (substr(tllib, 0, 5) == '01111'B) {
+ return TLLI_RANDOM;
+ } else if (substr(tllib, 0, 4) == '0110'B) {
+ return TLLI_RESERVED;
+ } else if (substr(tllib, 0, 3) == '010'B) {
+ return TLLI_RESERVED;
+ } else if (substr(tllib, 0, 4) == '0000'B) {
+ return TLLI_G_RNTI;
+ } else if (substr(tllib, 0, 4) == '0001'B) {
+ return TLLI_RAND_G_RNTI;
+ } else {
+ setverdict(fail, "Unknonw TLLI Type ", tllib);
+ mtc.stop;
+ }
+}
+
+function f_gprs_tlli_random() return OCT4 {
+ var OCT4 tlli := f_rnd_octstring(4);
+ return tlli or4b 'c0000000'O;
+}
+
+
} with { encode "RAW" };