This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
neels gerrit-no-reply at lists.osmocom.orgneels has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/18966 ) Change subject: fixup for gsm0808_create_common_id(): add API doc, use new MI API ...................................................................... fixup for gsm0808_create_common_id(): add API doc, use new MI API Follows patch I353adc1aa72377f7d4b3336d2ff47791fb73d62c that was merged too soon. Applying my code review in form of this fixup patch. Change-Id: I979bca0c6aaa8fe4feddda922bd2e6c1cb49585b --- M src/gsm/gsm0808.c 1 file changed, 17 insertions(+), 4 deletions(-) git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/66/18966/1 diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c index e1db175..a1d567d 100644 --- a/src/gsm/gsm0808.c +++ b/src/gsm/gsm0808.c @@ -1235,14 +1235,19 @@ return msg; } +/*! Create BSSMAP COMMON ID message, 3GPP TS 48.008 3.2.1.68. + * \param[in] imsi IMSI digits (decimal string). + * \param[in] selected_plmn_id Selected PLMN ID to encode, or NULL to not encode this IE. + * \param[in] last_used_eutran_plnm_id Last used E-UTRAN PLMN ID to encode, or NULL to not encode this IE. + * \returns callee-allocated msgb with BSSMAP COMMON ID message, or NULL if encoding failed. */ struct msgb *gsm0808_create_common_id(const char *imsi, const struct osmo_plmn_id *selected_plmn_id, const struct osmo_plmn_id *last_used_eutran_plnm_id) { struct msgb *msg; - uint8_t mid_buf[GSM48_MI_SIZE + 2]; uint8_t *out; - int mid_len; + struct osmo_mobile_identity mi; + int rc; msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "COMMON-ID"); if (!msg) @@ -1252,8 +1257,16 @@ msgb_v_put(msg, BSS_MAP_MSG_COMMON_ID); /* mandatory IMSI 3.2.2.6 */ - mid_len = gsm48_generate_mid_from_imsi(mid_buf, imsi); - msgb_tlv_put(msg, GSM0808_IE_IMSI, mid_len - 2, mid_buf + 2); + mi = (struct osmo_mobile_identity){ .type = GSM_MI_TYPE_IMSI }; + OSMO_STRLCPY_ARRAY(mi.imsi, imsi); + out = msgb_tl_put(msg, GSM0808_IE_IMSI); + rc = osmo_mobile_identity_encode_msgb(msg, &mi, false); + if (rc < 0) { + msgb_free(msg); + return NULL; + } + /* write the MI value length */ + *out = rc; /* not implemented: SNA Access Information */ -- To view, visit https://gerrit.osmocom.org/c/libosmocore/+/18966 To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings Gerrit-Project: libosmocore Gerrit-Branch: master Gerrit-Change-Id: I979bca0c6aaa8fe4feddda922bd2e6c1cb49585b Gerrit-Change-Number: 18966 Gerrit-PatchSet: 1 Gerrit-Owner: neels <nhofmeyr at sysmocom.de> Gerrit-MessageType: newchange -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200622/5f91efb6/attachment.htm>