<p>Pau Espin Pedrol has uploaded this change for <strong>review</strong>.</p><p><a href="https://gerrit.osmocom.org/11302">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">gsm_08_58.h: Introduce struct abis_rsl_link_id<br><br>It will allow to make code handling link_id values more easier to read<br>and less prone to errors.<br>union is added inside the struct to be able to get the full octet in<br>case we need to pass it somewhere else or encode it.<br><br>A union is used in struct abis_rsl_common_hdr to allow using fields<br>directly while keeping API compatibility.<br><br>Change-Id: Ibd75a493bcfdf46c028ea466867d0c0d83d46343<br>---<br>M include/osmocom/gsm/protocol/gsm_08_58.h<br>1 file changed, 27 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/02/11302/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/include/osmocom/gsm/protocol/gsm_08_58.h b/include/osmocom/gsm/protocol/gsm_08_58.h</span><br><span>index e5ff464..06983f0 100644</span><br><span>--- a/include/osmocom/gsm/protocol/gsm_08_58.h</span><br><span>+++ b/include/osmocom/gsm/protocol/gsm_08_58.h</span><br><span>@@ -25,10 +25,32 @@</span><br><span> </span><br><span> #include <stdint.h></span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+#include <osmocom/core/endian.h></span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*! \addtogroup rsl</span><br><span>  *  @{</span><br><span>  * \file gsm_08_58.h */</span><br><span> </span><br><span style="color: hsl(120, 100%, 40%);">+/* Link Identifier 9.3.2 */</span><br><span style="color: hsl(120, 100%, 40%);">+struct abis_rsl_link_id {</span><br><span style="color: hsl(120, 100%, 40%);">+       union {</span><br><span style="color: hsl(120, 100%, 40%);">+#if OSMO_IS_BIG_ENDIAN</span><br><span style="color: hsl(120, 100%, 40%);">+               uint8_t cbits:2,</span><br><span style="color: hsl(120, 100%, 40%);">+                      na:1,</span><br><span style="color: hsl(120, 100%, 40%);">+                 reserved:2;</span><br><span style="color: hsl(120, 100%, 40%);">+                   sapi:3;</span><br><span style="color: hsl(120, 100%, 40%);">+#elif OSMO_IS_LITTLE_ENDIAN</span><br><span style="color: hsl(120, 100%, 40%);">+          uint8_t sapi:3,</span><br><span style="color: hsl(120, 100%, 40%);">+                       reserved:2,</span><br><span style="color: hsl(120, 100%, 40%);">+                   na:1,</span><br><span style="color: hsl(120, 100%, 40%);">+                 cbits:2;</span><br><span style="color: hsl(120, 100%, 40%);">+#endif</span><br><span style="color: hsl(120, 100%, 40%);">+              uint8_t link_id;</span><br><span style="color: hsl(120, 100%, 40%);">+      };</span><br><span style="color: hsl(120, 100%, 40%);">+} __attribute__ ((packed));</span><br><span style="color: hsl(120, 100%, 40%);">+#define ABIS_RSL_LINK_ID_CHAN_FACCH_SDCCH 0x00</span><br><span style="color: hsl(120, 100%, 40%);">+#define ABIS_RSL_LINK_ID_CHAN_SACCH 0x01</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> /*! RSL common header */</span><br><span> struct abis_rsl_common_hdr {</span><br><span>      uint8_t msg_discr;      /*!< message discriminator (ABIS_RSL_MDISC_*) */</span><br><span>@@ -42,7 +64,11 @@</span><br><span>     uint8_t ie_chan;        /*!< \ref RSL_IE_CHAN_NR (tag) */</span><br><span>         uint8_t chan_nr;        /*!< RSL channel number (value) */</span><br><span>        uint8_t ie_link_id;     /*!< \ref RSL_IE_LINK_IDENT (tag) */</span><br><span style="color: hsl(0, 100%, 40%);">- uint8_t link_id;        /*!< RSL link identifier (value) */</span><br><span style="color: hsl(120, 100%, 40%);">+        union</span><br><span style="color: hsl(120, 100%, 40%);">+ {</span><br><span style="color: hsl(120, 100%, 40%);">+             uint8_t link_id; /*!< RSL link identifier (value) */</span><br><span style="color: hsl(120, 100%, 40%);">+               struct abis_rsl_link_id link_id_fields;</span><br><span style="color: hsl(120, 100%, 40%);">+       };</span><br><span>   uint8_t data[0];        /*!< message payload data */</span><br><span> } __attribute__ ((packed));</span><br><span> </span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/11302">change 11302</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/11302"/><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: Ibd75a493bcfdf46c028ea466867d0c0d83d46343 </div>
<div style="display:none"> Gerrit-Change-Number: 11302 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Pau Espin Pedrol <pespin@sysmocom.de> </div>