rlc.h: Fix struct bit fields on big endian systems

Related: OS#5003
Change-Id: I534539cdf197ce5c038752a177aff7efeefc9883
This commit is contained in:
Pau Espin 2021-02-04 12:59:27 +01:00
parent 44768f2127
commit 55aca83098
1 changed files with 24 additions and 4 deletions

View File

@ -377,8 +377,8 @@ struct gprs_rlc_ul_window: public gprs_rlc_window {
extern "C" { extern "C" {
/* TS 44.060 10.2.2 */ /* TS 44.060 10.2.2 */
#if OSMO_IS_LITTLE_ENDIAN
struct rlc_ul_header { struct rlc_ul_header {
#if OSMO_IS_LITTLE_ENDIAN
uint8_t r:1, uint8_t r:1,
si:1, si:1,
cv:4, cv:4,
@ -389,9 +389,16 @@ struct rlc_ul_header {
spare:1; spare:1;
uint8_t e:1, uint8_t e:1,
bsn:7; bsn:7;
#elif OSMO_IS_BIG_ENDIAN
/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
uint8_t pt:2, cv:4, si:1, r:1;
uint8_t spare:1, pi:1, tfi:5, ti:1;
uint8_t bsn:7, e:1;
#endif
} __attribute__ ((packed)); } __attribute__ ((packed));
struct rlc_dl_header { struct rlc_dl_header {
#if OSMO_IS_LITTLE_ENDIAN
uint8_t usf:3, uint8_t usf:3,
s_p:1, s_p:1,
rrbp:2, rrbp:2,
@ -401,21 +408,34 @@ struct rlc_dl_header {
pr:2; pr:2;
uint8_t e:1, uint8_t e:1,
bsn:7; bsn:7;
#elif OSMO_IS_BIG_ENDIAN
/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
uint8_t pt:2, rrbp:2, s_p:1, usf:3;
uint8_t pr:2, tfi:5, fbi:1;
uint8_t bsn:7, e:1;
#endif
} __attribute__ ((packed)); } __attribute__ ((packed));
struct rlc_li_field { struct rlc_li_field {
#if OSMO_IS_LITTLE_ENDIAN
uint8_t e:1, uint8_t e:1,
m:1, m:1,
li:6; li:6;
#elif OSMO_IS_BIG_ENDIAN
/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
uint8_t li:6, m:1, e:1;
#endif
} __attribute__ ((packed)); } __attribute__ ((packed));
struct rlc_li_field_egprs { struct rlc_li_field_egprs {
#if OSMO_IS_LITTLE_ENDIAN
uint8_t e:1, uint8_t e:1,
li:7; li:7;
} __attribute__ ((packed)); #elif OSMO_IS_BIG_ENDIAN
#else /* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
# error "Only little endian headers are supported yet. TODO: add missing structs" uint8_t li:7, e:1;
#endif #endif
} __attribute__ ((packed));
} }
inline bool gprs_rlc_v_b::is_state(int bsn, const gprs_rlc_dl_bsn_state type) const inline bool gprs_rlc_v_b::is_state(int bsn, const gprs_rlc_dl_bsn_state type) const