aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2015-08-16 17:56:25 +0200
committerHarald Welte <laforge@gnumonks.org>2015-08-18 19:32:33 +0200
commit1a8c4e05fbf51662e3ffe47ed64c20f4752e2563 (patch)
treef41fdfd37d6a8adf20b48dfcaa90c5dc8f675a71
parent1f6aad1c042f3040ac62696fc38c65a875862b6a (diff)
Introduce gsm48_mi_type_name() function
-rw-r--r--include/osmocom/gsm/gsm48.h1
-rw-r--r--src/gsm/gsm48.c14
-rw-r--r--src/gsm/libosmogsm.map1
3 files changed, 16 insertions, 0 deletions
diff --git a/include/osmocom/gsm/gsm48.h b/include/osmocom/gsm/gsm48.h
index a4522d7..74ac52c 100644
--- a/include/osmocom/gsm/gsm48.h
+++ b/include/osmocom/gsm/gsm48.h
@@ -32,6 +32,7 @@ int gsm48_generate_mid_from_imsi(uint8_t *buf, const char *imsi);
/* Convert Mobile Identity (10.5.1.4) to string */
int gsm48_mi_to_string(char *string, const int str_len,
const uint8_t *mi, const int mi_len);
+const char *gsm48_mi_type_name(uint8_t mi);
/* Parse Routeing Area Identifier */
void gsm48_parse_ra(struct gprs_ra_id *raid, const uint8_t *buf);
diff --git a/src/gsm/gsm48.c b/src/gsm/gsm48.c
index 80f7502..48b22c7 100644
--- a/src/gsm/gsm48.c
+++ b/src/gsm/gsm48.c
@@ -254,6 +254,20 @@ const char *rr_cause_name(uint8_t cause)
return get_value_string(rr_cause_names, cause);
}
+static const struct value_string mi_type_names[] = {
+ { GSM_MI_TYPE_NONE, "NONE" },
+ { GSM_MI_TYPE_IMSI, "IMSI" },
+ { GSM_MI_TYPE_IMEI, "IMEI" },
+ { GSM_MI_TYPE_IMEISV, "IMEI-SV" },
+ { GSM_MI_TYPE_TMSI, "TMSI" },
+ { 0, NULL }
+};
+
+const char *gsm48_mi_type_name(uint8_t mi)
+{
+ return get_value_string(mi_type_names, mi);
+}
+
static void to_bcd(uint8_t *bcd, uint16_t val)
{
bcd[2] = val % 10;
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index c291428..0c0d9f7 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -137,6 +137,7 @@ gsm48_mm_att_tlvdef;
gsm48_number_of_paging_subchannels;
gsm48_parse_ra;
gsm48_rr_att_tlvdef;
+gsm48_mi_type_name;
gsm_7bit_decode;
gsm_7bit_decode_ussd;