diff options
author | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-11-04 15:41:32 +0100 |
---|---|---|
committer | Pau Espin Pedrol <pespin@sysmocom.de> | 2019-11-04 15:41:41 +0100 |
commit | ba5a9b922477ff939cdffc4dbb785a8c8e1e5657 (patch) | |
tree | 18f97ae12d1417ef8b053c725a998aea1b9665f3 | |
parent | e40b9637ea9f166ed4e574550c05b429b1099e39 (diff) |
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
-rw-r--r-- | include/osmocom/gsm/protocol/gsm_04_08.h | 33 |
1 files changed, 28 insertions, 5 deletions
diff --git a/include/osmocom/gsm/protocol/gsm_04_08.h b/include/osmocom/gsm/protocol/gsm_04_08.h index 68ec4e3e..8370eca1 100644 --- a/include/osmocom/gsm/protocol/gsm_04_08.h +++ b/include/osmocom/gsm/protocol/gsm_04_08.h @@ -889,13 +889,25 @@ struct gsm48_pag_resp { #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 @@ struct gsm48_service_request { #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 |