Change in libosmocore[master]: gsm_08_58.h: Introduce struct abis_rsl_link_id

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/.

Pau Espin Pedrol gerrit-no-reply at lists.osmocom.org
Wed Oct 10 15:07:05 UTC 2018


Pau Espin Pedrol has uploaded this change for review. ( https://gerrit.osmocom.org/11302


Change subject: gsm_08_58.h: Introduce struct abis_rsl_link_id
......................................................................

gsm_08_58.h: Introduce struct abis_rsl_link_id

It will allow to make code handling link_id values more easier to read
and less prone to errors.
union is added inside the struct to be able to get the full octet in
case we need to pass it somewhere else or encode it.

A union is used in struct abis_rsl_common_hdr to allow using fields
directly while keeping API compatibility.

Change-Id: Ibd75a493bcfdf46c028ea466867d0c0d83d46343
---
M include/osmocom/gsm/protocol/gsm_08_58.h
1 file changed, 27 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/02/11302/1

diff --git a/include/osmocom/gsm/protocol/gsm_08_58.h b/include/osmocom/gsm/protocol/gsm_08_58.h
index e5ff464..06983f0 100644
--- a/include/osmocom/gsm/protocol/gsm_08_58.h
+++ b/include/osmocom/gsm/protocol/gsm_08_58.h
@@ -25,10 +25,32 @@
 
 #include <stdint.h>
 
+#include <osmocom/core/endian.h>
+
 /*! \addtogroup rsl
  *  @{
  * \file gsm_08_58.h */
 
+/* Link Identifier 9.3.2 */
+struct abis_rsl_link_id {
+	union {
+#if OSMO_IS_BIG_ENDIAN
+		uint8_t cbits:2,
+			na:1,
+			reserved:2;
+			sapi:3;
+#elif OSMO_IS_LITTLE_ENDIAN
+		uint8_t sapi:3,
+			reserved:2,
+			na:1,
+			cbits:2;
+#endif
+		uint8_t link_id;
+	};
+} __attribute__ ((packed));
+#define ABIS_RSL_LINK_ID_CHAN_FACCH_SDCCH 0x00
+#define ABIS_RSL_LINK_ID_CHAN_SACCH 0x01
+
 /*! RSL common header */
 struct abis_rsl_common_hdr {
 	uint8_t	msg_discr;	/*!< message discriminator (ABIS_RSL_MDISC_*) */
@@ -42,7 +64,11 @@
 	uint8_t	ie_chan;	/*!< \ref RSL_IE_CHAN_NR (tag) */
 	uint8_t	chan_nr;	/*!< RSL channel number (value) */
 	uint8_t	ie_link_id;	/*!< \ref RSL_IE_LINK_IDENT (tag) */
-	uint8_t	link_id;	/*!< RSL link identifier (value) */
+	union
+	{
+		uint8_t	link_id; /*!< RSL link identifier (value) */
+		struct abis_rsl_link_id link_id_fields;
+	};
 	uint8_t	data[0];	/*!< message payload data */
 } __attribute__ ((packed));
 

-- 
To view, visit https://gerrit.osmocom.org/11302
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: Ibd75a493bcfdf46c028ea466867d0c0d83d46343
Gerrit-Change-Number: 11302
Gerrit-PatchSet: 1
Gerrit-Owner: Pau Espin Pedrol <pespin at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20181010/65764841/attachment.htm>


More information about the gerrit-log mailing list