diff --git a/include/osmocom/gsm/gsm48.h b/include/osmocom/gsm/gsm48.h index a4522d749..74ac52c77 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 80f75024e..48b22c759 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 c29142844..0c0d9f778 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;