aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom
diff options
context:
space:
mode:
authorRuben Undheim <ruben.undheim@gmail.com>2015-12-09 20:22:42 +0100
committerHarald Welte <laforge@gnumonks.org>2015-12-09 20:22:42 +0100
commit771a58feeec15c1e36373f0fe165ddf3ba83cbf6 (patch)
treeb19e57b6f5f108c6b21e560af5989a1c695ab369 /include/osmocom
parent84c19a9b36c5e416e3df6b42afb5b0e8aa8095cc (diff)
gsm_03_41: Fix structure definitions for big-endian machines
this was detected by debian packaging, as the associated gsm_03_41 test case fails on big endian machines like ppc.
Diffstat (limited to 'include/osmocom')
-rw-r--r--include/osmocom/gsm/protocol/gsm_03_41.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/include/osmocom/gsm/protocol/gsm_03_41.h b/include/osmocom/gsm/protocol/gsm_03_41.h
index 0ece6ccf..40051cd4 100644
--- a/include/osmocom/gsm/protocol/gsm_03_41.h
+++ b/include/osmocom/gsm/protocol/gsm_03_41.h
@@ -2,8 +2,13 @@
#include <stdint.h>
+#include <osmocom/core/endian.h>
#include <osmocom/gsm/protocol/gsm_04_12.h>
+#ifndef OSMO_IS_LITTLE_ENDIAN
+ #define OSMO_IS_LITTLE_ENDIAN 0
+#endif
+
/* GSM TS 03.41 definitions also TS 23.041*/
#define GSM341_MAX_PAYLOAD (GSM412_MSG_LEN-sizeof(struct gsm341_ms_message))
@@ -13,19 +18,36 @@
/* Chapter 9.3.2 */
struct gsm341_ms_message {
struct {
+#if OSMO_IS_LITTLE_ENDIAN == 1
uint8_t code_hi:6;
uint8_t gs:2;
uint8_t update:4;
uint8_t code_lo:4;
+#else
+ uint8_t gs:2;
+ uint8_t code_hi:6;
+ uint8_t code_lo:4;
+ uint8_t update:4;
+#endif
} serial;
uint16_t msg_id;
struct {
+#if OSMO_IS_LITTLE_ENDIAN == 1
uint8_t language:4;
uint8_t group:4;
+#else
+ uint8_t group:4;
+ uint8_t language:4;
+#endif
} dcs;
struct {
+#if OSMO_IS_LITTLE_ENDIAN == 1
uint8_t total:4;
uint8_t current:4;
+#else
+ uint8_t current:4;
+ uint8_t total:4;
+#endif
} page;
uint8_t data[0];
} __attribute__((packed));
@@ -33,12 +55,21 @@ struct gsm341_ms_message {
/* Chapter 9.4.1.3 */
struct gsm341_etws_message {
struct {
+#if OSMO_IS_LITTLE_ENDIAN == 1
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;
+#else
+ uint8_t gs:2;
+ uint8_t alert:1;
+ uint8_t popup:1;
+ uint8_t code_hi:4;
+ uint8_t code_lo:4;
+ uint8_t update:4;
+#endif
} serial;
uint16_t msg_id;
uint16_t warning_type;