Run struct_endianness.py

Use the OSMO_IS_LITTLE_ENDIAN / OSMO_IS_BIG_ENDIAN macros from
libosmocore and run struct_endianness.py to auto-generate the big endian
part.

Related: OS#5884
Change-Id: Ibeb96f61054b11ca9d82f8d9a00c3935ffb086a6
This commit is contained in:
Oliver Smith 2023-02-20 09:40:28 +01:00
parent e0202abcc1
commit 29baab4c58
1 changed files with 6 additions and 18 deletions

View File

@ -30,33 +30,21 @@
#include <osmocom/gapk/codecs.h>
#include <osmocom/gapk/formats.h>
#include <osmocom/gapk/procqueue.h>
#ifndef __BYTE_ORDER
# ifdef __APPLE__
# define __BYTE_ORDER __DARWIN_BYTE_ORDER
# define __LITTLE_ENDIAN __DARWIN_LITTLE_ENDIAN
# define __BIG_ENDIAN __DARWIN_BIG_ENDIAN
# else
# error "__BYTE_ORDER should be defined by someone"
# endif
#endif
#include <osmocom/core/endian.h>
/* according to 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
uint8_t version:2,
padding:1,
extension:1,
csrc_count:4;
uint8_t marker:1,
payload_type:7;
#elif OSMO_IS_BIG_ENDIAN
/* auto-generated from the little endian part above (libosmocore/contrib/struct_endianness.py) */
uint8_t version:2, padding:1, extension:1, csrc_count:4;
uint8_t marker:1, payload_type:7;
#endif
uint16_t sequence;
uint32_t timestamp;