Change in libosmo-netif[master]: add/clean big-endian packed structs (struct_endianess.py)

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

laforge gerrit-no-reply at lists.osmocom.org
Sun Jan 12 13:14:48 UTC 2020


laforge has submitted this change. ( https://gerrit.osmocom.org/c/libosmo-netif/+/16759 )

Change subject: add/clean big-endian packed structs (struct_endianess.py)
......................................................................

add/clean big-endian packed structs (struct_endianess.py)

Change-Id: If408153af472a41dcea8d6f6aedd22adb16963d5
---
M include/osmocom/netif/amr.h
M include/osmocom/netif/osmux.h
M include/osmocom/netif/rtp.h
3 files changed, 16 insertions(+), 27 deletions(-)

Approvals:
  laforge: Looks good to me, approved
  Jenkins Builder: Verified



diff --git a/include/osmocom/netif/amr.h b/include/osmocom/netif/amr.h
index 729d0ae..6e37c99 100644
--- a/include/osmocom/netif/amr.h
+++ b/include/osmocom/netif/amr.h
@@ -43,16 +43,7 @@
  */
 
 struct amr_hdr {
-#if OSMO_IS_BIG_ENDIAN
-	/* Payload Header */
-	uint8_t cmr:4,	/* Codec Mode Request */
-		pad1:4;
-	/* Table of Contents */
-	uint8_t f:1,	/* followed by another speech frame? */
-		ft:4,	/* coding mode */
-		q:1,	/* OK (not damaged) at origin? */
-		pad2:2;
-#elif OSMO_IS_LITTLE_ENDIAN
+#if OSMO_IS_LITTLE_ENDIAN
 	/* Payload Header */
 	uint8_t pad1:4,
 		cmr:4;	/* Codec Mode Request */
@@ -61,6 +52,10 @@
 		q:1,	/* OK (not damaged) at origin? */
 		ft:4,	/* coding mode */
 		f:1;	/* followed by another speech frame? */
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+	uint8_t cmr:4, pad1:4;
+	uint8_t f:1, ft:4, q:1, pad2:2;
 #endif
 } __attribute__((packed));
 
diff --git a/include/osmocom/netif/osmux.h b/include/osmocom/netif/osmux.h
index 7dee438..6305dc8 100644
--- a/include/osmocom/netif/osmux.h
+++ b/include/osmocom/netif/osmux.h
@@ -30,28 +30,25 @@
 #define OSMUX_FT_DUMMY		2
 
 struct osmux_hdr {
-#if OSMO_IS_BIG_ENDIAN
-	uint8_t rtp_m:1,
-		ft:2,
-		ctr:3,
-		amr_f:1,
-		amr_q:1;
-#elif OSMO_IS_LITTLE_ENDIAN
+#if OSMO_IS_LITTLE_ENDIAN
 	uint8_t amr_q:1,
 		amr_f:1,
 		ctr:3,
 		ft:2,
 		rtp_m:1;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+	uint8_t rtp_m:1, ft:2, ctr:3, amr_f:1, amr_q:1;
 #endif
 	uint8_t seq;
 #define OSMUX_CID_MAX		255	/* determined by circuit_id */
 	uint8_t circuit_id;
-#if OSMO_IS_BIG_ENDIAN
-	uint8_t amr_ft:4,
-		amr_cmr:4;
-#elif OSMO_IS_LITTLE_ENDIAN
+#if OSMO_IS_LITTLE_ENDIAN
 	uint8_t amr_cmr:4,
 		amr_ft:4;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+	uint8_t amr_ft:4, amr_cmr:4;
 #endif
 } __attribute__((packed));
 
diff --git a/include/osmocom/netif/rtp.h b/include/osmocom/netif/rtp.h
index c01df41..4e40745 100644
--- a/include/osmocom/netif/rtp.h
+++ b/include/osmocom/netif/rtp.h
@@ -13,12 +13,9 @@
 	uint8_t  payload_type:7,
 		 marker:1;
 #elif OSMO_IS_BIG_ENDIAN
-	uint8_t  version:2,
-		 padding:1,
-		 extension:1,
-		 csrc_count:4;
-	uint8_t  marker:1,
-		 payload_type:7;
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+	uint8_t  version:2, padding:1, extension:1, csrc_count:4;
+	uint8_t  marker:1, payload_type:7;
 #endif
 	uint16_t sequence;
 	uint32_t timestamp;

-- 
To view, visit https://gerrit.osmocom.org/c/libosmo-netif/+/16759
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: libosmo-netif
Gerrit-Branch: master
Gerrit-Change-Id: If408153af472a41dcea8d6f6aedd22adb16963d5
Gerrit-Change-Number: 16759
Gerrit-PatchSet: 2
Gerrit-Owner: neels <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge <laforge at osmocom.org>
Gerrit-Reviewer: neels <nhofmeyr at sysmocom.de>
Gerrit-CC: pespin <pespin at sysmocom.de>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20200112/adac328b/attachment.htm>


More information about the gerrit-log mailing list