diff options
Diffstat (limited to 'src/gsm/gsm0808.c')
-rw-r--r-- | src/gsm/gsm0808.c | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index 6560d4b5..9fdf3794 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -730,10 +730,9 @@ struct msgb *gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi, const uint8_t *chan_needed) { struct msgb *msg; - struct osmo_mobile_identity mi; + uint8_t mid_buf[GSM48_MI_SIZE + 2]; + int mid_len; uint32_t tmsi_sw; - uint8_t *l; - int rc; /* Mandatory elements! */ OSMO_ASSERT(imsi); @@ -751,15 +750,8 @@ struct msgb *gsm0808_create_paging2(const char *imsi, const uint32_t *tmsi, msgb_v_put(msg, BSS_MAP_MSG_PAGING); /* mandatory IMSI 3.2.2.6 */ - mi = (struct osmo_mobile_identity){ .type = GSM_MI_TYPE_IMSI, }; - OSMO_STRLCPY_ARRAY(mi.imsi, imsi); - l = msgb_tl_put(msg, GSM0808_IE_IMSI); - rc = osmo_mobile_identity_encode_msgb(msg, &mi, false); - if (rc <= 0) { - msgb_free(msg); - return NULL; - } - *l = rc; + mid_len = gsm48_generate_mid_from_imsi(mid_buf, imsi); + msgb_tlv_put(msg, GSM0808_IE_IMSI, mid_len - 2, mid_buf + 2); /* TMSI 3.2.2.7 */ if (tmsi) { @@ -975,17 +967,9 @@ struct msgb *gsm0808_create_handover_request(const struct gsm0808_handover_reque /* IMSI 3.2.2.6 */ if (params->imsi) { - uint8_t *l; - int rc; - struct osmo_mobile_identity mi = { .type = GSM_MI_TYPE_IMSI, }; - OSMO_STRLCPY_ARRAY(mi.imsi, params->imsi); - l = msgb_tl_put(msg, GSM0808_IE_IMSI); - rc = osmo_mobile_identity_encode_msgb(msg, &mi, false); - if (rc <= 0) { - msgb_free(msg); - return NULL; - } - *l = rc; + uint8_t mid_buf[GSM48_MI_SIZE + 2]; + int mid_len = gsm48_generate_mid_from_imsi(mid_buf, params->imsi); + msgb_tlv_put(msg, GSM0808_IE_IMSI, mid_len - 2, mid_buf + 2); } if (params->aoip_transport_layer) |