Change in libosmocore[master]: gsm: gsm_04_08.h: Allow accessing classmark2 as struct instead of uin...

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

pespin gerrit-no-reply at lists.osmocom.org
Mon Nov 4 14:42:51 UTC 2019


pespin has uploaded this change for review. ( https://gerrit.osmocom.org/c/libosmocore/+/15955 )


Change subject: gsm: gsm_04_08.h: Allow accessing classmark2 as struct instead of uint32_t
......................................................................

gsm: gsm_04_08.h: Allow accessing classmark2 as struct instead of uint32_t

New fields are put inside a union to keep backward compatibility with
potential older users of the struct.

Change-Id: I235635800c0de47b1e2b9ec9c7191418f6003554
---
M include/osmocom/gsm/protocol/gsm_04_08.h
1 file changed, 28 insertions(+), 5 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/libosmocore refs/changes/55/15955/1

diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h
index 68ec4e3..8370eca 100644
--- a/include/osmocom/gsm/protocol/gsm_04_08.h
+++ b/include/osmocom/gsm/protocol/gsm_04_08.h
@@ -889,13 +889,25 @@
 #if OSMO_IS_LITTLE_ENDIAN
 	uint8_t spare:4,
 		 key_seq:4;
-	uint32_t classmark2;
+	union {
+		uint32_t classmark2;  /* Backward compatibility */
+		struct {
+			uint8_t cm2_len;
+			struct gsm48_classmark2 cm2;
+		};
+	};
 	uint8_t mi_len;
 	uint8_t mi[0];
 #elif OSMO_IS_BIG_ENDIAN
 /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
 	uint8_t key_seq:4, spare:4;
-	uint32_t classmark2;
+	union {
+		uint32_t classmark2;  /* Backward compatibility */
+		struct {
+			uint8_t cm2_len;
+			struct gsm48_classmark2 cm2;
+		};
+	};
 	uint8_t mi_len;
 	uint8_t mi[0];
 #endif
@@ -1027,15 +1039,26 @@
 #if OSMO_IS_LITTLE_ENDIAN
 	uint8_t cm_service_type : 4,
 		 cipher_key_seq  : 4;
-	/* length + 3 bytes */
-	uint32_t classmark;
+	union {
+		uint32_t classmark;  /* Backward compatibility */
+		struct {
+			uint8_t cm2_len;
+			struct gsm48_classmark2 classmark2;
+		};
+	};
 	uint8_t mi_len;
 	uint8_t mi[0];
 	/* optional priority level */
 #elif OSMO_IS_BIG_ENDIAN
 /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
 	uint8_t cipher_key_seq:4, cm_service_type:4;
-	uint32_t classmark;
+	union {
+		uint32_t classmark;  /* Backward compatibility */
+		struct {
+			uint8_t cm2_len;
+			struct gsm48_classmark2 classmark2;
+		};
+	};
 	uint8_t mi_len;
 	uint8_t mi[0];
 #endif

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

Gerrit-Project: libosmocore
Gerrit-Branch: master
Gerrit-Change-Id: I235635800c0de47b1e2b9ec9c7191418f6003554
Gerrit-Change-Number: 15955
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <pespin at sysmocom.de>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20191104/8cecba83/attachment.htm>


More information about the gerrit-log mailing list