aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-03-22 09:37:17 +0100
committerHolger Hans Peter Freyther <holger@moiji-mobile.com>2015-03-22 09:38:36 +0100
commit86115434f1f60afe51a87d4c1674a3e2c0d18700 (patch)
tree42c3f4953443225a51421876077b84720825d42a /include/osmocom
parentd69c1ca8fab461ca5cdf65215261df0b2582f7ad (diff)
endian: Use the new endian macros for portability
Use the new macros to deal with little/big endian. Im a bit worried to make this change due the little test coverage in this module but in case of a typo the elements would not be defined.
Diffstat (limited to 'include/osmocom')
-rw-r--r--include/osmocom/netif/amr.h6
-rw-r--r--include/osmocom/netif/osmux.h10
-rw-r--r--include/osmocom/netif/rtp.h6
3 files changed, 14 insertions, 8 deletions
diff --git a/include/osmocom/netif/amr.h b/include/osmocom/netif/amr.h
index 60dacf6..b0ab8a3 100644
--- a/include/osmocom/netif/amr.h
+++ b/include/osmocom/netif/amr.h
@@ -1,6 +1,8 @@
#ifndef _OSMO_AMR_H_
#define _OSMO_AMR_H_
+#include <osmocom/core/endian.h>
+
/* As defined by RFC3267: Adaptive Multi-Rate (AMR) */
/*
@@ -41,7 +43,7 @@
*/
struct amr_hdr {
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if OSMO_IS_BIG_ENDIAN
/* Payload Header */
uint8_t cmr:4, /* Codec Mode Request */
pad1:4;
@@ -50,7 +52,7 @@ struct amr_hdr {
ft:4, /* coding mode */
q:1, /* OK (not damaged) at origin? */
pad2:2;
-#elif __BYTE_ORDER == __LITTLE_ENDIAN
+#elif OSMO_IS_LITTLE_ENDIAN
/* Payload Header */
uint8_t pad1:4,
cmr:4;
diff --git a/include/osmocom/netif/osmux.h b/include/osmocom/netif/osmux.h
index 493f64f..0f6f5c9 100644
--- a/include/osmocom/netif/osmux.h
+++ b/include/osmocom/netif/osmux.h
@@ -1,6 +1,8 @@
#ifndef _OSMUX_H_
#define _OSMUX_H_
+#include <osmocom/core/endian.h>
+
/* OSmux header:
*
* ft (3 bits): 0=signalling, 1=voice
@@ -17,12 +19,12 @@
#define OSMUX_FT_VOICE_AMR 1
struct osmux_hdr {
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if OSMO_IS_BIG_ENDIAN
uint8_t ft:3,
ctr:3,
amr_f:1,
amr_q:1;
-#elif __BYTE_ORDER == __LITTLE_ENDIAN
+#elif OSMO_IS_LITTLE_ENDIAN
uint8_t amr_q:1,
amr_f:1,
ctr:3,
@@ -31,10 +33,10 @@ struct osmux_hdr {
uint8_t seq;
#define OSMUX_CID_MAX 255 /* determined by circuit_id */
uint8_t circuit_id;
-#if __BYTE_ORDER == __BIG_ENDIAN
+#if OSMO_IS_BIG_ENDIAN
uint8_t amr_ft:4,
amr_cmr:4;
-#elif __BYTE_ORDER == __LITTLE_ENDIAN
+#elif OSMO_IS_LITTLE_ENDIAN
uint8_t amr_cmr:4,
amr_ft:4;
#endif
diff --git a/include/osmocom/netif/rtp.h b/include/osmocom/netif/rtp.h
index 1854d6c..729e5c9 100644
--- a/include/osmocom/netif/rtp.h
+++ b/include/osmocom/netif/rtp.h
@@ -1,16 +1,18 @@
#ifndef _OSMO_RTP_H_
#define _OSMO_RTP_H_
+#include <osmocom/core/endian.h>
+
/* RTP header as defined by RFC 3550 */
struct rtp_hdr {
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t csrc_count:4,
extension:1,
padding:1,
version:2;
uint8_t payload_type:7,
marker:1;
-#elif __BYTE_ORDER == __BIG_ENDIAN
+#elif OSMO_IS_BIG_ENDIAN
uint8_t version:2,
padding:1,
extension:1,