From b26003963e82805bfd73b13315ae85d478605383 Mon Sep 17 00:00:00 2001 From: Neels Hofmeyr Date: Fri, 16 Nov 2018 00:20:39 +0100 Subject: add/clean big-endian packed structs (struct_endianess.py) This is 1:1 the result of doing cd libosmocore ./contrib/struct_endianess.py git commit -a Running struct_endianess.py again should result in no changes. That means we could include such a check in the gerrit verification job now. Change-Id: Ia0b99d76932aeb03e93bd0c62d3bf025dec5f9d2 --- include/osmocom/gsm/protocol/gsm_44_318.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'include/osmocom/gsm/protocol/gsm_44_318.h') diff --git a/include/osmocom/gsm/protocol/gsm_44_318.h b/include/osmocom/gsm/protocol/gsm_44_318.h index 6ac02cfd..b3942be2 100644 --- a/include/osmocom/gsm/protocol/gsm_44_318.h +++ b/include/osmocom/gsm/protocol/gsm_44_318.h @@ -4,6 +4,7 @@ #pragma once #include +#include /* Table 11.1.1.2.1: Protocol Discriminator */ enum gan_pdisc { @@ -154,15 +155,24 @@ enum gan_iei { /* 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_endianess.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, @@ -179,4 +189,12 @@ struct gan_cch_desc_ie { tgecs:2, spare2:2; uint8_t access_class[2]; +#elif OSMO_IS_BIG_ENDIAN +/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */ + uint8_t mscr:1, att:1, dtm:1, gprs:1, nmo:2, ecmc:1, spare:1; + uint8_t t3212; + uint8_t rac; + uint8_t spare2:2, tgecs:2, pfcfm:1, re:1, ecmp:1, sgsnr:1; + uint8_t access_class[2]; +#endif } __attribute__((packed)); -- cgit v1.2.3