Introduce gsm48_mi_type_name() function

This commit is contained in:
Harald Welte 2015-08-16 17:56:25 +02:00
parent 1f6aad1c04
commit 1a8c4e05fb
3 changed files with 16 additions and 0 deletions

View File

@ -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);

View File

@ -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;

View File

@ -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;