summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeels Hofmeyr <neels@hofmeyr.de>2018-11-16 00:19:26 +0100
committerNeels Hofmeyr <neels@hofmeyr.de>2018-11-23 04:11:55 +0100
commit58bcdd130161e9255631d25e00f2612a17f56e1b (patch)
tree8f9be50c533e376af2c8cc914a6f4a38ec82c2b0
parent5371a212937ad5eca33699bad3be8c101ab10cee (diff)
add/clean big-endian packed structs (struct_endianess.py)neels/big_endian
-rw-r--r--include/osmocom/mtp/mtp_level3.h17
-rw-r--r--include/osmocom/sccp/sccp_types.h15
-rw-r--r--src/sccp.c1
3 files changed, 15 insertions, 18 deletions
diff --git a/include/osmocom/mtp/mtp_level3.h b/include/osmocom/mtp/mtp_level3.h
index d0d24a1..414b144 100644
--- a/include/osmocom/mtp/mtp_level3.h
+++ b/include/osmocom/mtp/mtp_level3.h
@@ -131,9 +131,8 @@ struct mtp_level_3_hdr {
spare : 2,
ni : 2;
#elif OSMO_IS_BIG_ENDIAN
- uint8_t ni : 2,
- spare : 2,
- ser_ind : 4;
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+ uint8_t ni:2, spare:2, ser_ind:4;
#endif
uint32_t addr;
uint8_t data[0];
@@ -144,8 +143,8 @@ struct mtp_level_3_cmn {
uint8_t h0 : 4,
h1 : 4;
#elif OSMO_IS_BIG_ENDIAN
- uint8_t h1 : 4,
- h0 : 4;
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+ uint8_t h1:4, h0:4;
#endif
} __attribute__((packed));
@@ -155,8 +154,8 @@ struct mtp_level_3_mng {
uint8_t spare : 4,
length : 4;
#elif OSMO_IS_BIG_ENDIAN
- uint8_t length : 4,
- spare : 4;
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+ uint8_t length:4, spare:4;
#endif
uint8_t data[0];
} __attribute__((packed));
@@ -175,8 +174,8 @@ struct sccp_con_ctrl_prt_mgt {
uint8_t mul_ind : 2,
spare : 6;
#elif OSMO_IS_BIG_ENDIAN
- uint8_t spare : 6,
- mul_ind : 2;
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+ uint8_t spare:6, mul_ind:2;
#endif
} __attribute__((packed));
diff --git a/include/osmocom/sccp/sccp_types.h b/include/osmocom/sccp/sccp_types.h
index ab7f74f..3e67fc8 100644
--- a/include/osmocom/sccp/sccp_types.h
+++ b/include/osmocom/sccp/sccp_types.h
@@ -97,11 +97,8 @@ struct sccp_called_party_address {
routing_indicator : 1,
reserved : 1;
#elif OSMO_IS_BIG_ENDIAN
- uint8_t reserved : 1,
- routing_indicator : 1,
- global_title_indicator : 4,
- ssn_indicator : 1,
- point_code_indicator : 1;
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+ uint8_t reserved:1, routing_indicator:1, global_title_indicator:4, ssn_indicator:1, point_code_indicator:1;
#endif
uint8_t data[0];
} __attribute__((packed));
@@ -115,8 +112,8 @@ struct sccp_signalling_point_code {
uint8_t msb : 6,
reserved : 2;
#elif OSMO_IS_BIG_ENDIAN
- uint8_t reserved : 2,
- msb : 6;
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+ uint8_t reserved:2, msb:6;
#endif
} __attribute__((packed));
@@ -157,8 +154,8 @@ struct sccp_global_title {
uint8_t nature_of_addr_ind : 7,
odd_even : 1;
#elif OSMO_IS_BIG_ENDIAN
- uint8_t odd_even : 1,
- nature_of_addr_ind : 7;
+/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianess.py) */
+ uint8_t odd_even:1, nature_of_addr_ind:7;
#endif
uint8_t data[0];
} __attribute__((packed));
diff --git a/src/sccp.c b/src/sccp.c
index 8c3641c..dcb1b75 100644
--- a/src/sccp.c
+++ b/src/sccp.c
@@ -29,6 +29,7 @@
#include <osmocom/core/msgb.h>
#include <osmocom/core/talloc.h>
#include <osmocom/core/logging.h>
+#include <osmocom/core/endian.h>
#include <osmocom/gsm/tlv.h>
#include <osmocom/sccp/sccp.h>