summaryrefslogtreecommitdiffstats
path: root/library
diff options
context:
space:
mode:
authorHarald Welte <laforge@osmocom.org>2020-11-12 17:27:58 +0100
committerHarald Welte <laforge@osmocom.org>2020-11-12 21:51:40 +0100
commit8f66af1665b37ad0cbd605cbc858ce2d1e96bcd5 (patch)
tree3fcee9fe6ebcabe93be703f8e4bbb33ea92312d8 /library
parent69b3a4839f1de12dceb4101d87ea59331e823e24 (diff)
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
Diffstat (limited to 'library')
-rw-r--r--library/L3_Common.ttcn39
-rw-r--r--library/Osmocom_Gb_Types.ttcn40
2 files changed, 40 insertions, 39 deletions
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 @@ function f_gen_auth_vec_3g() return AuthVector {
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 @@ function f_BSSGP_BVCI_get(PDU_BSSGP pdu) return template (omit) BssgpBvci {
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" };