From 86115434f1f60afe51a87d4c1674a3e2c0d18700 Mon Sep 17 00:00:00 2001 From: Holger Hans Peter Freyther Date: Sun, 22 Mar 2015 09:37:17 +0100 Subject: 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. --- include/osmocom/netif/amr.h | 6 ++++-- include/osmocom/netif/osmux.h | 10 ++++++---- include/osmocom/netif/rtp.h | 6 ++++-- 3 files changed, 14 insertions(+), 8 deletions(-) (limited to 'include') 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 + /* 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 + /* 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 + /* 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, -- cgit v1.2.3