aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2010-06-01 10:47:07 +0200
committerHarald Welte <laforge@gnumonks.org>2010-06-01 10:47:07 +0200
commitc226317c9c7297bebd030af3a7ffd13f2272bc59 (patch)
tree19a65c0576239bb3a87c7f4cd66405eb8e262219
parent4c053013c9ffe186996668a36ebe7c326083dc58 (diff)
add new new gprs_tmsi2tlli() function0.1.10
-rw-r--r--include/osmocore/gsm_utils.h4
-rw-r--r--src/gsm_utils.c17
2 files changed, 20 insertions, 1 deletions
diff --git a/include/osmocore/gsm_utils.h b/include/osmocore/gsm_utils.h
index 51e9f2e..685bc90 100644
--- a/include/osmocore/gsm_utils.h
+++ b/include/osmocore/gsm_utils.h
@@ -88,7 +88,7 @@ void gsm_fn2gsmtime(struct gsm_time *time, uint32_t fn);
uint32_t gsm_gsmtime2fn(struct gsm_time *time);
/* GSM TS 03.03 Chapter 2.6 */
-enum gprs_tlli_tyoe {
+enum gprs_tlli_type {
TLLI_LOCAL,
TLLI_FOREIGN,
TLLI_RANDOM,
@@ -99,5 +99,7 @@ enum gprs_tlli_tyoe {
/* TS 03.03 Chapter 2.6 */
int gprs_tlli_type(uint32_t tlli);
+uint32_t gprs_tmsi2tlli(uint32_t p_tmsi, enum gprs_tlli_type type);
+
void generate_backtrace();
#endif
diff --git a/src/gsm_utils.c b/src/gsm_utils.c
index b392fd3..913946e 100644
--- a/src/gsm_utils.c
+++ b/src/gsm_utils.c
@@ -374,3 +374,20 @@ int gprs_tlli_type(uint32_t tlli)
return TLLI_RESERVED;
}
+
+uint32_t gprs_tmsi2tlli(uint32_t p_tmsi, enum gprs_tlli_type type)
+{
+ uint32_t tlli;
+ switch (type) {
+ case TLLI_LOCAL:
+ tlli = p_tmsi | 0xc0000000;
+ break;
+ case TLLI_FOREIGN:
+ tlli = (p_tmsi & 0x3fffffff) | 0x80000000;
+ break;
+ default:
+ tlli = 0;
+ break;
+ }
+ return tlli;
+}