diff options
author | Neels Hofmeyr <neels@hofmeyr.de> | 2018-11-16 00:20:39 +0100 |
---|---|---|
committer | Neels Hofmeyr <nhofmeyr@sysmocom.de> | 2018-12-19 18:40:03 +0000 |
commit | b26003963e82805bfd73b13315ae85d478605383 (patch) | |
tree | a54c4b111f2fee0c146ba9c4eb204dabf599bc0b /include/osmocom/gsm/protocol/gsm_44_318.h | |
parent | 036012b5080e15b1e6579e5422c9d1bc8c63e2fb (diff) |
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
Diffstat (limited to 'include/osmocom/gsm/protocol/gsm_44_318.h')
-rw-r--r-- | include/osmocom/gsm/protocol/gsm_44_318.h | 18 |
1 files changed, 18 insertions, 0 deletions
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 <stdint.h> +#include <osmocom/core/endian.h> /* 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)); |