<p>Neels Hofmeyr has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/9333">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">add gsm0808_cell_id_to_list()<br><br>The idea is to be able to add a gsm0808_cell_id to a gsm0808_cell_id_list2:<br>first convert it to a list, then re-use gsm0808_cell_id_list_add(). It will be<br>used by osmo-bsc to manage neighbor-BSS cell identifiers from VTY.<br><br>Change-Id: Ibf746ac60b1b1e920baf494b396658a5ceabd788<br>---<br>M include/osmocom/gsm/gsm0808_utils.h<br>M src/gsm/gsm0808_utils.c<br>M src/gsm/libosmogsm.map<br>3 files changed, 33 insertions(+), 0 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/33/9333/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/gsm/gsm0808_utils.h b/include/osmocom/gsm/gsm0808_utils.h</span><br><span>index 24c139a..6555734 100644</span><br><span>--- a/include/osmocom/gsm/gsm0808_utils.h</span><br><span>+++ b/include/osmocom/gsm/gsm0808_utils.h</span><br><span>@@ -98,6 +98,7 @@</span><br><span>                            const uint8_t *elem, uint8_t len)</span><br><span>                            OSMO_DEPRECATED("use gsm0808_dec_cell_id_list2 instead");</span><br><span> int gsm0808_cell_id_list_add(struct gsm0808_cell_id_list2 *dst, const struct gsm0808_cell_id_list2 *src);</span><br><span style="color: hsl(120, 100%, 40%);">+void gsm0808_cell_id_to_list(struct gsm0808_cell_id_list2 *dst, const struct gsm0808_cell_id *src);</span><br><span> uint8_t gsm0808_enc_cell_id(struct msgb *msg, const struct gsm0808_cell_id *ci);</span><br><span> int gsm0808_dec_cell_id(struct gsm0808_cell_id *ci, const uint8_t *elem, uint8_t len);</span><br><span> int gsm0808_chan_type_to_speech_codec(uint8_t perm_spch);</span><br><span>diff --git a/src/gsm/gsm0808_utils.c b/src/gsm/gsm0808_utils.c</span><br><span>index 2c659bb..080fc95 100644</span><br><span>--- a/src/gsm/gsm0808_utils.c</span><br><span>+++ b/src/gsm/gsm0808_utils.c</span><br><span>@@ -988,6 +988,37 @@</span><br><span>        return added;</span><br><span> }</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/*! Convert a single Cell Identifier to a Cell Identifier List with one entry.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param dst[out]  Overwrite this list.</span><br><span style="color: hsl(120, 100%, 40%);">+ * \param src[in]   Set \a dst to contain exactly this item.</span><br><span style="color: hsl(120, 100%, 40%);">+ */</span><br><span style="color: hsl(120, 100%, 40%);">+void gsm0808_cell_id_to_list(struct gsm0808_cell_id_list2 *dst, const struct gsm0808_cell_id *src)</span><br><span style="color: hsl(120, 100%, 40%);">+{</span><br><span style="color: hsl(120, 100%, 40%);">+    if (!dst)</span><br><span style="color: hsl(120, 100%, 40%);">+             return;</span><br><span style="color: hsl(120, 100%, 40%);">+       if (!src) {</span><br><span style="color: hsl(120, 100%, 40%);">+           *dst = (struct gsm0808_cell_id_list2){</span><br><span style="color: hsl(120, 100%, 40%);">+                        .id_discr = CELL_IDENT_NO_CELL,</span><br><span style="color: hsl(120, 100%, 40%);">+               };</span><br><span style="color: hsl(120, 100%, 40%);">+            return;</span><br><span style="color: hsl(120, 100%, 40%);">+       }</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+   *dst = (struct gsm0808_cell_id_list2){</span><br><span style="color: hsl(120, 100%, 40%);">+                .id_discr = src->id_discr,</span><br><span style="color: hsl(120, 100%, 40%);">+         .id_list = { src->id },</span><br><span style="color: hsl(120, 100%, 40%);">+            .id_list_len = 1,</span><br><span style="color: hsl(120, 100%, 40%);">+     };</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+  switch (src->id_discr) {</span><br><span style="color: hsl(120, 100%, 40%);">+   case CELL_IDENT_NO_CELL:</span><br><span style="color: hsl(120, 100%, 40%);">+      case CELL_IDENT_BSS:</span><br><span style="color: hsl(120, 100%, 40%);">+          dst->id_list_len = 0;</span><br><span style="color: hsl(120, 100%, 40%);">+              break;</span><br><span style="color: hsl(120, 100%, 40%);">+        default:</span><br><span style="color: hsl(120, 100%, 40%);">+              break;</span><br><span style="color: hsl(120, 100%, 40%);">+        }</span><br><span style="color: hsl(120, 100%, 40%);">+}</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*! Encode Cell Identifier IE (3GPP TS 48.008 3.2.2.17).</span><br><span>  *  \param[out] msg Message Buffer to which IE is to be appended</span><br><span>  *  \param[in] ci Cell ID to be encoded</span><br><span>diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map</span><br><span>index c4b1b75..5a57429 100644</span><br><span>--- a/src/gsm/libosmogsm.map</span><br><span>+++ b/src/gsm/libosmogsm.map</span><br><span>@@ -177,6 +177,7 @@</span><br><span> gsm0808_dec_cell_id_list;</span><br><span> gsm0808_dec_cell_id_list2;</span><br><span> gsm0808_cell_id_list_add;</span><br><span style="color: hsl(120, 100%, 40%);">+gsm0808_cell_id_to_list;</span><br><span> gsm0808_enc_cell_id;</span><br><span> gsm0808_dec_cell_id;</span><br><span> gsm0808_cell_id_name;</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/9333">change 9333</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/9333"/><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-MessageType: newchange </div>
<div style="display:none"> Gerrit-Change-Id: Ibf746ac60b1b1e920baf494b396658a5ceabd788 </div>
<div style="display:none"> Gerrit-Change-Number: 9333 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Neels Hofmeyr <nhofmeyr@sysmocom.de> </div>