<p>neels has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/c/libosmocore/+/18966">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">fixup for gsm0808_create_common_id(): add API doc, use new MI API<br><br>Follows patch I353adc1aa72377f7d4b3336d2ff47791fb73d62c that was merged too<br>soon. Applying my code review in form of this fixup patch.<br><br>Change-Id: I979bca0c6aaa8fe4feddda922bd2e6c1cb49585b<br>---<br>M src/gsm/gsm0808.c<br>1 file changed, 17 insertions(+), 4 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/66/18966/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c</span><br><span>index e1db175..a1d567d 100644</span><br><span>--- a/src/gsm/gsm0808.c</span><br><span>+++ b/src/gsm/gsm0808.c</span><br><span>@@ -1235,14 +1235,19 @@</span><br><span>   return msg;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/*! Create BSSMAP COMMON ID message, 3GPP TS 48.008 3.2.1.68.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] imsi  IMSI digits (decimal string).</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] selected_plmn_id  Selected PLMN ID to encode, or NULL to not encode this IE.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param[in] last_used_eutran_plnm_id  Last used E-UTRAN PLMN ID to encode, or NULL to not encode this IE.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \returns callee-allocated msgb with BSSMAP COMMON ID message, or NULL if encoding failed. */</span><br><span> struct msgb *gsm0808_create_common_id(const char *imsi,</span><br><span>                                const struct osmo_plmn_id *selected_plmn_id,</span><br><span>                                 const struct osmo_plmn_id *last_used_eutran_plnm_id)</span><br><span> {</span><br><span>      struct msgb *msg;</span><br><span style="color: hsl(0, 100%, 40%);">-       uint8_t mid_buf[GSM48_MI_SIZE + 2];</span><br><span>  uint8_t *out;</span><br><span style="color: hsl(0, 100%, 40%);">-   int mid_len;</span><br><span style="color: hsl(120, 100%, 40%);">+  struct osmo_mobile_identity mi;</span><br><span style="color: hsl(120, 100%, 40%);">+       int rc;</span><br><span> </span><br><span>  msg = msgb_alloc_headroom(BSSMAP_MSG_SIZE, BSSMAP_MSG_HEADROOM, "COMMON-ID");</span><br><span>      if (!msg)</span><br><span>@@ -1252,8 +1257,16 @@</span><br><span>   msgb_v_put(msg, BSS_MAP_MSG_COMMON_ID);</span><br><span> </span><br><span>  /* mandatory IMSI 3.2.2.6 */</span><br><span style="color: hsl(0, 100%, 40%);">-    mid_len = gsm48_generate_mid_from_imsi(mid_buf, imsi);</span><br><span style="color: hsl(0, 100%, 40%);">-  msgb_tlv_put(msg, GSM0808_IE_IMSI, mid_len - 2, mid_buf + 2);</span><br><span style="color: hsl(120, 100%, 40%);">+ mi = (struct osmo_mobile_identity){ .type = GSM_MI_TYPE_IMSI };</span><br><span style="color: hsl(120, 100%, 40%);">+       OSMO_STRLCPY_ARRAY(mi.imsi, imsi);</span><br><span style="color: hsl(120, 100%, 40%);">+    out = msgb_tl_put(msg, GSM0808_IE_IMSI);</span><br><span style="color: hsl(120, 100%, 40%);">+      rc = osmo_mobile_identity_encode_msgb(msg, &mi, false);</span><br><span style="color: hsl(120, 100%, 40%);">+   if (rc < 0) {</span><br><span style="color: hsl(120, 100%, 40%);">+              msgb_free(msg);</span><br><span style="color: hsl(120, 100%, 40%);">+               return NULL;</span><br><span style="color: hsl(120, 100%, 40%);">+  }</span><br><span style="color: hsl(120, 100%, 40%);">+     /* write the MI value length */</span><br><span style="color: hsl(120, 100%, 40%);">+       *out = rc;</span><br><span> </span><br><span>       /* not implemented: SNA Access Information */</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/libosmocore/+/18966">change 18966</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/libosmocore/+/18966"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: libosmocore </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I979bca0c6aaa8fe4feddda922bd2e6c1cb49585b </div>
<div style="display:none"> Gerrit-Change-Number: 18966 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: neels <nhofmeyr@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>