osmith has uploaded this change for review.
Run struct_endianness.py
Ensure there is no diff to prepare to run this in CI.
Related: OS#5884
Change-Id: I617c967c5f34c0be2cf6fd43ceb1af17897f2bf1
---
M src/host/gprsdecode/rlcmac.h
M src/host/layer23/include/osmocom/bb/common/sim.h
M src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_03_41.h
M src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h
M src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_12.h
M src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_08_58.h
M src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_44_318.h
7 files changed, 437 insertions(+), 0 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmocom-bb refs/changes/03/31403/1
diff --git a/src/host/gprsdecode/rlcmac.h b/src/host/gprsdecode/rlcmac.h
index 2381d77..41c0dec 100644
--- a/src/host/gprsdecode/rlcmac.h
+++ b/src/host/gprsdecode/rlcmac.h
@@ -2,6 +2,7 @@
#include <stdint.h>
#include <stdbool.h>
+#include <osmocom/core/endian.h>
#define OLD_TIME 2000
@@ -16,10 +17,16 @@
};
struct gprs_lime {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t li:6,
m:1,
e:1;
uint8_t used;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t e:1, m:1, li:6;
+ uint8_t used;
+#endif
} __attribute__ ((packed));
struct gprs_frag {
diff --git a/src/host/layer23/include/osmocom/bb/common/sim.h b/src/host/layer23/include/osmocom/bb/common/sim.h
index 321baf4..35b48f4 100644
--- a/src/host/layer23/include/osmocom/bb/common/sim.h
+++ b/src/host/layer23/include/osmocom/bb/common/sim.h
@@ -18,6 +18,7 @@
#pragma once
#include <osmocom/gsm/protocol/gsm_04_08.h>
+#include <osmocom/core/endian.h>
/* 9.2 commands */
#define GSM1111_CLASS_GSM 0xa0
@@ -211,6 +212,7 @@
} __attribute__ ((packed));
struct gsm1111_response_mfdf_gsm {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t file_char;
uint8_t num_df;
uint8_t num_ef;
@@ -229,10 +231,24 @@
rfu5:3,
unblk2_init:1;
uint8_t more_data[0];
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t file_char;
+ uint8_t num_df;
+ uint8_t num_ef;
+ uint8_t num_codes;
+ uint8_t rfu1;
+ uint8_t chv1_init:1, rfu2:3, chv1_remain:4;
+ uint8_t unblk1_init:1, rfu3:3, unblk1_remain:4;
+ uint8_t chv2_init:1, rfu4:3, chv2_remain:4;
+ uint8_t unblk2_init:1, rfu5:3, unblk2_remain:4;
+ uint8_t more_data[0];
+#endif
} __attribute__ ((packed));
/* Section 9.2.1 (response to selecting EF) */
struct gsm1111_response_ef {
+#if OSMO_IS_LITTLE_ENDIAN
uint16_t rfu1;
uint16_t file_size;
uint16_t file_id;
@@ -250,6 +266,20 @@
rfu4:5;
uint8_t length;
uint8_t structure;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint16_t rfu1;
+ uint16_t file_size;
+ uint16_t file_id;
+ uint8_t tof;
+ uint8_t inc_allowed;
+ uint8_t acc_read:4, acc_update:4;
+ uint8_t acc_inc:4, rfu2:4;
+ uint8_t acc_reha:4, acc_inval:4;
+ uint8_t rfu4:5, ru_inval:1, rfu3:1, not_inval:1;
+ uint8_t length;
+ uint8_t structure;
+#endif
} __attribute__ ((packed));
/* Section 10.3.17 */
diff --git a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_03_41.h b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_03_41.h
index 54365cb..14d8190 100644
--- a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_03_41.h
+++ b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_03_41.h
@@ -2,25 +2,42 @@
#define PROTO_GSM_03_41_H
#include <stdint.h>
+#include <osmocom/core/endian.h>
/* GSM TS 03.41 definitions also TS 23.041*/
/* Chapter 9.3.2 */
struct gsm341_ms_message {
struct {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t code_hi:6;
uint8_t gs:2;
uint8_t update:4;
uint8_t code_lo:4;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t gs:2, code_hi:6;
+ uint8_t code_lo:4, update:4;
+#endif
} serial;
uint16_t msg_id;
struct {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t language:4;
uint8_t group:4;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t group:4, language:4;
+#endif
} dcs;
struct {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t total:4;
uint8_t current:4;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t current:4, total:4;
+#endif
} page;
uint8_t data[0];
} __attribute__((packed));
@@ -28,12 +45,18 @@
/* Chapter 9.4.1.3 */
struct gsm341_etws_message {
struct {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t code_hi:4;
uint8_t popup:1;
uint8_t alert:1;
uint8_t gs:2;
uint8_t update:4;
uint8_t code_lo:4;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t gs:2, alert:1, popup:1, code_hi:4;
+ uint8_t code_lo:4, update:4;
+#endif
} serial;
uint16_t msg_id;
uint16_t warning_type;
diff --git a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h
index 172ef67..11b78b7 100644
--- a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h
+++ b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_08.h
@@ -2,21 +2,28 @@
#define PROTO_GSM_04_08_H
#include <stdint.h>
+#include <osmocom/core/endian.h>
/* GSM TS 04.08 definitions */
struct gsm_lchan;
/* Chapter 10.5.1.5 */
struct gsm48_classmark1 {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t pwr_lev:3,
a5_1:1,
es_ind:1,
rev_lev:2,
spare:1;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t spare:1, rev_lev:2, es_ind:1, a5_1:1, pwr_lev:3;
+#endif
} __attribute__ ((packed));
/* Chapter 10.5.1.6 */
struct gsm48_classmark2 {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t pwr_lev:3,
a5_1:1,
es_ind:1,
@@ -37,10 +44,17 @@
lcsva_cap:1,
spare4:1,
cm3:1;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t spare:1, rev_lev:2, es_ind:1, a5_1:1, pwr_lev:3;
+ uint8_t spare2:1, ps_cap:1, ss_scr:2, sm_cap:1, vbs:1, vgcs:1, fc:1;
+ uint8_t cm3:1, spare4:1, lcsva_cap:1, spare3:1, solsa:1, cmsp:1, a5_3:1, a5_2:1;
+#endif
} __attribute__ ((packed));
/* Chapter 10.5.2.1b.3 */
struct gsm48_range_1024 {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t w1_hi:2,
f0:1,
form_id:5;
@@ -72,10 +86,30 @@
w14_lo:3;
uint8_t w16:6,
w15_lo:2;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t form_id:5, f0:1, w1_hi:2;
+ uint8_t w1_lo;
+ uint8_t w2_hi;
+ uint8_t w2_lo:1, w3_hi:7;
+ uint8_t w3_lo:2, w4_hi:6;
+ uint8_t w4_lo:2, w5_hi:6;
+ uint8_t w5_lo:2, w6_hi:6;
+ uint8_t w6_lo:2, w7_hi:6;
+ uint8_t w7_lo:2, w8_hi:6;
+ uint8_t w8_lo:1, w9:7;
+ uint8_t w10:7, w11_hi:1;
+ uint8_t w11_lo:6, w12_hi:2;
+ uint8_t w12_lo:5, w13_hi:3;
+ uint8_t w13_lo:4, w14_hi:4;
+ uint8_t w14_lo:3, w15_hi:5;
+ uint8_t w15_lo:2, w16:6;
+#endif
} __attribute__ ((packed));
/* Chapter 10.5.2.1b.4 */
struct gsm48_range_512 {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t orig_arfcn_hi:1,
form_id:7;
uint8_t orig_arfcn_mid;
@@ -107,10 +141,30 @@
w15:6;
uint8_t w17:5,
w16_lo:3;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t form_id:7, orig_arfcn_hi:1;
+ uint8_t orig_arfcn_mid;
+ uint8_t orig_arfcn_lo:1, w1_hi:7;
+ uint8_t w1_lo:2, w2_hi:6;
+ uint8_t w2_lo:2, w3_hi:6;
+ uint8_t w3_lo:2, w4_hi:6;
+ uint8_t w4_lo:1, w5:7;
+ uint8_t w6:7, w7_hi:1;
+ uint8_t w7_lo:6, w8_hi:2;
+ uint8_t w8_lo:4, w9_hi:4;
+ uint8_t w9_lo:2, w10:6;
+ uint8_t w11:6, w12_hi:2;
+ uint8_t w12_lo:4, w13_hi:4;
+ uint8_t w13_lo:2, w14:6;
+ uint8_t w15:6, w16_hi:2;
+ uint8_t w16_lo:3, w17:5;
+#endif
} __attribute__ ((packed));
/* Chapter 10.5.2.1b.5 */
struct gsm48_range_256 {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t orig_arfcn_hi:1,
form_id:7;
uint8_t orig_arfcn_mid;
@@ -148,10 +202,30 @@
uint8_t spare:1,
w21:4,
w20_lo:3;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t form_id:7, orig_arfcn_hi:1;
+ uint8_t orig_arfcn_mid;
+ uint8_t orig_arfcn_lo:1, w1_hi:7;
+ uint8_t w1_lo:1, w2:7;
+ uint8_t w3:7, w4_hi:1;
+ uint8_t w4_lo:5, w5_hi:3;
+ uint8_t w5_lo:3, w6_hi:5;
+ uint8_t w6_lo:1, w7:6, w8_hi:1;
+ uint8_t w8_lo:4, w9_hi:4;
+ uint8_t w9_lo:1, w10:5, w11_hi:2;
+ uint8_t w11_lo:3, w12:5;
+ uint8_t w13:5, w14_hi:3;
+ uint8_t w14_lo:2, w15:5, w16_hi:1;
+ uint8_t w16_lo:3, w17:4, w18_hi:1;
+ uint8_t w18_lo:3, w19:4, w20_hi:1;
+ uint8_t w20_lo:3, w21:4, spare:1;
+#endif
} __attribute__ ((packed));
/* Chapter 10.5.2.1b.6 */
struct gsm48_range_128 {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t orig_arfcn_hi:1,
form_id:7;
uint8_t orig_arfcn_mid;
@@ -191,16 +265,43 @@
w28:3,
w27:3,
w26_lo:1;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t form_id:7, orig_arfcn_hi:1;
+ uint8_t orig_arfcn_mid;
+ uint8_t orig_arfcn_lo:1, w1:7;
+ uint8_t w2:6, w3_hi:2;
+ uint8_t w3_lo:4, w4_hi:4;
+ uint8_t w4_lo:1, w5:5, w6_hi:2;
+ uint8_t w6_lo:3, w7:5;
+ uint8_t w8:4, w9:4;
+ uint8_t w10:4, w11:4;
+ uint8_t w12:4, w13:4;
+ uint8_t w14:4, w15:4;
+ uint8_t w16:3, w17:3, w18_hi:2;
+ uint8_t w18_lo:1, w19:3, w20:3, w21_hi:1;
+ uint8_t w21_lo:2, w22:3, w23:3;
+ uint8_t w24:3, w25:3, w26_hi:2;
+ uint8_t w26_lo:1, w27:3, w28:3, spare:1;
+#endif
} __attribute__ ((packed));
/* Chapter 10.5.2.1b.7 */
struct gsm48_var_bit {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t orig_arfcn_hi:1,
form_id:7;
uint8_t orig_arfcn_mid;
uint8_t rrfcn1_7:7,
orig_arfcn_lo:1;
uint8_t rrfcn8_111[13];
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t form_id:7, orig_arfcn_hi:1;
+ uint8_t orig_arfcn_mid;
+ uint8_t orig_arfcn_lo:1, rrfcn1_7:7;
+ uint8_t rrfcn8_111[13];
+#endif
} __attribute__ ((packed));
/* Chapter 10.5.2.5 */
@@ -208,24 +309,37 @@
uint8_t chan_nr;
union {
struct {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t maio_high:4,
h:1,
tsc:3;
uint8_t hsn:6,
maio_low:2;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t tsc:3, h:1, maio_high:4;
+ uint8_t maio_low:2, hsn:6;
+#endif
} __attribute__ ((packed)) h1;
struct {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t arfcn_high:2,
spare:2,
h:1,
tsc:3;
uint8_t arfcn_low;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t tsc:3, h:1, spare:2, arfcn_high:2;
+ uint8_t arfcn_low;
+#endif
} __attribute__ ((packed)) h0;
} __attribute__ ((packed));
} __attribute__ ((packed));
/* Chapter 10.5.2.20 */
struct gsm48_meas_res {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t rxlev_full:6,
dtx_used:1,
ba_used:1;
@@ -265,10 +379,30 @@
rxlev_nc6_lo:5;
uint8_t bsic_nc6:6,
bcch_f_nc6_lo:2;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t ba_used:1, dtx_used:1, rxlev_full:6;
+ uint8_t spare:1, meas_valid:1, rxlev_sub:6;
+ uint8_t spare2:1, rxqual_full:3, rxqual_sub:3, no_nc_n_hi:1;
+ uint8_t no_nc_n_lo:2, rxlev_nc1:6;
+ uint8_t bcch_f_nc1:5, bsic_nc1_hi:3;
+ uint8_t bsic_nc1_lo:3, rxlev_nc2_hi:5;
+ uint8_t rxlev_nc2_lo:1, bcch_f_nc2:5, bsic_nc2_hi:2;
+ uint8_t bsic_nc2_lo:4, rxlev_nc3_hi:4;
+ uint8_t rxlev_nc3_lo:2, bcch_f_nc3:5, bsic_nc3_hi:1;
+ uint8_t bsic_nc3_lo:5, rxlev_nc4_hi:3;
+ uint8_t rxlev_nc4_lo:3, bcch_f_nc4:5;
+ uint8_t bsic_nc4:6, rxlev_nc5_hi:2;
+ uint8_t rxlev_nc5_lo:4, bcch_f_nc5_hi:4;
+ uint8_t bcch_f_nc5_lo:1, bsic_nc5:6, rxlev_nc6_hi:1;
+ uint8_t rxlev_nc6_lo:5, bcch_f_nc6_hi:3;
+ uint8_t bcch_f_nc6_lo:2, bsic_nc6:6;
+#endif
} __attribute__ ((packed));
/* Chapter 10.5.2.21aa */
struct gsm48_multi_rate_conf {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t smod : 2,
spare: 1,
icmi : 1,
@@ -282,49 +416,84 @@
m7_95 : 1,
m10_2 : 1,
m12_2 : 1;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t ver:3, nscb:1, icmi:1, spare:1, smod:2;
+ uint8_t m12_2:1, m10_2:1, m7_95:1, m7_40:1, m6_70:1, m5_90:1, m5_15:1, m4_75:1;
+#endif
} __attribute__((packed));
/* Chapter 10.5.2.28(a) */
struct gsm48_power_cmd {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t power_level:5,
spare:2,
atc:1;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t atc:1, spare:2, power_level:5;
+#endif
} __attribute__((packed));
/* Chapter 10.5.2.29 */
struct gsm48_rach_control {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t re :1,
cell_bar :1,
tx_integer :4,
max_trans :2;
uint8_t t2;
uint8_t t3;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t max_trans:2, tx_integer:4, cell_bar:1, re:1;
+ uint8_t t2;
+ uint8_t t3;
+#endif
} __attribute__ ((packed));
/* Chapter 10.5.2.30 */
struct gsm48_req_ref {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t ra;
uint8_t t3_high:3,
t1:5;
uint8_t t2:5,
t3_low:3;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t ra;
+ uint8_t t1:5, t3_high:3;
+ uint8_t t3_low:3, t2:5;
+#endif
} __attribute__ ((packed));
/* Chapter 10.5.2.38 */
struct gsm48_start_time {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t t3_high:3,
t1:5;
uint8_t t2:5,
t3_low:3;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t t1:5, t3_high:3;
+ uint8_t t3_low:3, t2:5;
+#endif
} __attribute__ ((packed));
/* Chapter 10.5.2.39 */
struct gsm48_sync_ind {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t si:2,
rot:1,
nci:1,
sync_ie:4;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t sync_ie:4, nci:1, rot:1, si:2;
+#endif
} __attribute__((packed));
/*
@@ -366,10 +535,16 @@
/* Chapter 10.5.2.2 */
struct gsm48_cell_desc {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t bcc:3,
ncc:3,
arfcn_hi:2;
uint8_t arfcn_lo;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t arfcn_hi:2, ncc:3, bcc:3;
+ uint8_t arfcn_lo;
+#endif
} __attribute__((packed));
/* Chapter 9.1.15 */
@@ -396,11 +571,19 @@
/* Chapter 9.1.25 */
struct gsm48_pag_resp {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t spare:4,
key_seq:4;
uint32_t classmark2;
uint8_t mi_len;
uint8_t mi[0];
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t key_seq:4, spare:4;
+ uint32_t classmark2;
+ uint8_t mi_len;
+ uint8_t mi[0];
+#endif
} __attribute__ ((packed));
/* Chapter 10.5.1.3 */
@@ -411,9 +594,15 @@
/* Section 9.2.2 */
struct gsm48_auth_req {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t key_seq:4,
spare:4;
uint8_t rand[16];
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t spare:4, key_seq:4;
+ uint8_t rand[16];
+#endif
} __attribute__ ((packed));
/* Section 9.2.3 */
@@ -423,12 +612,21 @@
/* Section 9.2.15 */
struct gsm48_loc_upd_req {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t type:4,
key_seq:4;
struct gsm48_loc_area_id lai;
struct gsm48_classmark1 classmark1;
uint8_t mi_len;
uint8_t mi[0];
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t key_seq:4, type:4;
+ struct gsm48_loc_area_id lai;
+ struct gsm48_classmark1 classmark1;
+ uint8_t mi_len;
+ uint8_t mi[0];
+#endif
} __attribute__ ((packed));
/* Section 10.1 */
@@ -440,23 +638,37 @@
/* Section 9.1.3x System information Type header */
struct gsm48_system_information_type_header {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t l2_plen;
uint8_t rr_protocol_discriminator :4,
skip_indicator:4;
uint8_t system_information;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t l2_plen;
+ uint8_t skip_indicator:4, rr_protocol_discriminator:4;
+ uint8_t system_information;
+#endif
} __attribute__ ((packed));
/* Section 10.5.2.4 Cell Selection Parameters */
struct gsm48_cell_sel_par {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t ms_txpwr_max_ccch:5, /* GSM 05.08 MS-TXPWR-MAX-CCCH */
cell_resel_hyst:3; /* GSM 05.08 CELL-RESELECT-HYSTERESIS */
uint8_t rxlev_acc_min:6, /* GSM 05.08 RXLEV-ACCESS-MIN */
neci:1,
acs:1;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t cell_resel_hyst:3, ms_txpwr_max_ccch:5;
+ uint8_t acs:1, neci:1, rxlev_acc_min:6;
+#endif
} __attribute__ ((packed));
/* Section 10.5.2.11 Control Channel Description , Figure 10.5.33 */
struct gsm48_control_channel_descr {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t ccch_conf :3,
bs_ag_blks_res :3,
att :1,
@@ -464,17 +676,29 @@
uint8_t bs_pa_mfrms : 3,
spare2 :5;
uint8_t t3212;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t spare1:1, att:1, bs_ag_blks_res:3, ccch_conf:3;
+ uint8_t spare2:5, bs_pa_mfrms:3;
+ uint8_t t3212;
+#endif
} __attribute__ ((packed));
struct gsm48_cell_options {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t radio_link_timeout:4,
dtx:2,
pwrc:1,
spare:1;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t spare:1, pwrc:1, dtx:2, radio_link_timeout:4;
+#endif
} __attribute__ ((packed));
/* Section 9.2.9 CM service request */
struct gsm48_service_request {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t cm_service_type : 4,
cipher_key_seq : 4;
/* length + 3 bytes */
@@ -482,6 +706,13 @@
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_endianness.py) */
+ uint8_t cipher_key_seq:4, cm_service_type:4;
+ uint32_t classmark;
+ uint8_t mi_len;
+ uint8_t mi[0];
+#endif
} __attribute__ ((packed));
/* Section 9.1.31 System information Type 1 */
@@ -541,30 +772,52 @@
/* Section 9.1.37 System information Type 5 */
struct gsm48_system_information_type_5 {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t rr_protocol_discriminator :4,
skip_indicator:4;
uint8_t system_information;
uint8_t bcch_frequency_list[16];
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t skip_indicator:4, rr_protocol_discriminator:4;
+ uint8_t system_information;
+ uint8_t bcch_frequency_list[16];
+#endif
} __attribute__ ((packed));
/* Section 9.1.38 System information Type 5bis */
struct gsm48_system_information_type_5bis {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t rr_protocol_discriminator :4,
skip_indicator:4;
uint8_t system_information;
uint8_t bcch_frequency_list[16];
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t skip_indicator:4, rr_protocol_discriminator:4;
+ uint8_t system_information;
+ uint8_t bcch_frequency_list[16];
+#endif
} __attribute__ ((packed));
/* Section 9.1.39 System information Type 5ter */
struct gsm48_system_information_type_5ter {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t rr_protocol_discriminator :4,
skip_indicator:4;
uint8_t system_information;
uint8_t bcch_frequency_list[16];
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t skip_indicator:4, rr_protocol_discriminator:4;
+ uint8_t system_information;
+ uint8_t bcch_frequency_list[16];
+#endif
} __attribute__ ((packed));
/* Section 9.1.40 System information Type 6 */
struct gsm48_system_information_type_6 {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t rr_protocol_discriminator :4,
skip_indicator:4;
uint8_t system_information;
@@ -573,6 +826,16 @@
struct gsm48_cell_options cell_options;
uint8_t ncc_permitted;
uint8_t rest_octets[0];
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t skip_indicator:4, rr_protocol_discriminator:4;
+ uint8_t system_information;
+ uint16_t cell_identity;
+ struct gsm48_loc_area_id lai;
+ struct gsm48_cell_options cell_options;
+ uint8_t ncc_permitted;
+ uint8_t rest_octets[0];
+#endif
} __attribute__ ((packed));
/* Section 9.1.43a System Information type 13 */
@@ -624,10 +887,15 @@
/* Section 9.1.9 */
struct gsm48_cip_mode_cmd {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t sc:1,
alg_id:3,
cr:1,
spare:3;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t spare:3, cr:1, alg_id:3, sc:1;
+#endif
} __attribute__((packed));
/* Section 9.1.11 */
@@ -672,6 +940,7 @@
/* Section 9.1.22 */
struct gsm48_paging1 {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t l2_plen;
uint8_t proto_discr;
uint8_t msg_type;
@@ -680,10 +949,19 @@
cneed1:2,
cneed2:2;
uint8_t data[0];
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t l2_plen;
+ uint8_t proto_discr;
+ uint8_t msg_type;
+ uint8_t cneed2:2, cneed1:2, spare:2, pag_mode:2;
+ uint8_t data[0];
+#endif
} __attribute__((packed));
/* Section 9.1.23 */
struct gsm48_paging2 {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t l2_plen;
uint8_t proto_discr;
uint8_t msg_type;
@@ -694,10 +972,21 @@
uint32_t tmsi1;
uint32_t tmsi2;
uint8_t data[0];
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t l2_plen;
+ uint8_t proto_discr;
+ uint8_t msg_type;
+ uint8_t cneed2:2, cneed1:2, spare:2, pag_mode:2;
+ uint32_t tmsi1;
+ uint32_t tmsi2;
+ uint8_t data[0];
+#endif
} __attribute__((packed));
/* Section 9.1.24 */
struct gsm48_paging3 {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t l2_plen;
uint8_t proto_discr;
uint8_t msg_type;
@@ -713,15 +1002,36 @@
cneed4:2,
spare2:4;
uint8_t rest[0];
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t l2_plen;
+ uint8_t proto_discr;
+ uint8_t msg_type;
+ uint8_t cneed2:2, cneed1:2, spare:2, pag_mode:2;
+ uint32_t tmsi1;
+ uint32_t tmsi2;
+ uint32_t tmsi3;
+ uint32_t tmsi4;
+ uint8_t spare2:4, cneed4:2, cneed3:2;
+ uint8_t rest[0];
+#endif
} __attribute__((packed));
/* Section 9.1.25 */
struct gsm48_pag_rsp {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t key_seq:3,
spare:5;
uint8_t cm2_len;
struct gsm48_classmark2 cm2;
uint8_t data[0];
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t spare:5, key_seq:3;
+ uint8_t cm2_len;
+ struct gsm48_classmark2 cm2;
+ uint8_t data[0];
+#endif
} __attribute__((packed));
/* Section 9.1.29 */
diff --git a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_12.h b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_12.h
index 9b1538a..4018f6c 100644
--- a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_12.h
+++ b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_04_12.h
@@ -2,6 +2,7 @@
#define PROTO_GSM_04_12_H
#include <stdint.h>
+#include <osmocom/core/endian.h>
/* GSM TS 04.12 definitions for Short Message Service Cell Broadcast */
@@ -13,19 +14,32 @@
#define GSM412_SEQ_NULL_MSG 0xf
struct gsm412_block_type {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t seq_nr : 4,
lb : 1,
lpd : 2,
spare : 1;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t spare:1, lpd:2, lb:1, seq_nr:4;
+#endif
} __attribute__((packed));
struct gsm412_sched_msg {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t beg_slot_nr : 6,
type : 2;
uint8_t end_slot_nr : 6,
spare1 : 1, spare2: 1;
uint8_t cbsms_msg_map[6];
uint8_t data[0];
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t type:2, beg_slot_nr:6;
+ uint8_t spare2:1, spare1:1, end_slot_nr:6;
+ uint8_t cbsms_msg_map[6];
+ uint8_t data[0];
+#endif
} __attribute__((packed));
#endif
diff --git a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_08_58.h b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_08_58.h
index 41d65af..6805d98 100644
--- a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_08_58.h
+++ b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_08_58.h
@@ -20,6 +20,7 @@
*/
#include <stdint.h>
+#include <osmocom/core/endian.h>
/*! \addtogroup rsl
* @{
@@ -469,10 +470,15 @@
/*! \brief RSL Cell Broadcast Command (Chapter 9.3.45) */
struct rsl_ie_cb_cmd_type {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t last_block:2;
uint8_t spare:1;
uint8_t def_bcast:1;
uint8_t command:4;
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t command:4, def_bcast:1, spare:1, last_block:2;
+#endif
} __attribute__ ((packed));
/* ->command */
#define RSL_CB_CMD_TYPE_NORMAL 0x00
diff --git a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_44_318.h b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_44_318.h
index cd5ec05..3c53a65 100644
--- a/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_44_318.h
+++ b/src/shared/libosmocore/include/osmocom/gsm/protocol/gsm_44_318.h
@@ -2,6 +2,7 @@
#define PROTO_GSM_44_318_H
#include <stdint.h>
+#include <osmocom/core/endian.h>
/* Definitions according to 3GPP TS 44.318 6.8.0 Release 6 */
@@ -154,15 +155,24 @@
/* 11.1.1 GA-RC and GA-CSR Message header IE */
struct gan_rc_csr_hdr {
+#if OSMO_IS_LITTLE_ENDIAN
uint16_t len;
uint8_t pdisc:4,
skip_ind:4;
uint8_t msg_type;
uint8_t data[0];
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint16_t len;
+ uint8_t skip_ind:4, pdisc:4;
+ uint8_t msg_type;
+ uint8_t data[0];
+#endif
} __attribute__((packed));
/* 11.2.14.1: GAN Control Channel Description IE */
struct gan_cch_desc_ie {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t spare:1,
ecmc:1,
nmo:2,
@@ -196,5 +206,30 @@
sgsnr:1;
#endif
uint8_t access_class[2];
+#elif OSMO_IS_BIG_ENDIAN
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
+ uint8_t mscr:1, att:1, dtm:1, gprs:1, nmo:2, ecmc:1, spare:1;
+#if 0
+ uint8_t mscr:1,
+ att:1,
+ dtm:1,
+ gprs:1,
+ nmo:2,
+ ecmc:1,
+ spare:1;
+#endif
+ uint8_t t3212;
+ uint8_t rac;
+ uint8_t spare2:2, tgecs:2, pfcfm:1, re:1, ecmp:1, sgsnr:1;
+#if 0
+ uint8_t spare2:2,
+ tgecs:2,
+ pfcfm:1,
+ re:1,
+ ecmp:1,
+ sgsnr:1;
+#endif
+ uint8_t access_class[2];
+#endif
} __attribute__((packed));
#endif /* PROTO_GSM_44_318_H */
To view, visit change 31403. To unsubscribe, or for help writing mail filters, visit settings.