Packets/80211Bundle: Read-only radiotap reimplementation
[senf.git] / senf / Packets / 80211Bundle / radiotap / platform.h
1 #include <stddef.h>
2 #include <errno.h>
3 #ifndef _BSD_SOURCE
4 #define _BSD_SOURCE
5 #endif
6 #include <endian.h>
7
8 #define le16_to_cpu             le16toh
9 #define le32_to_cpu             le32toh
10 #define get_unaligned(p)                                        \
11 ({                                                              \
12         struct packed_dummy_struct {                            \
13                 typeof(*(p)) __val;                             \
14         } __attribute__((packed)) *__ptr = (void *) (p);        \
15                                                                 \
16         __ptr->__val;                                           \
17 })
18 #define get_unaligned_le16(p)   le16_to_cpu(get_unaligned((uint16_t *)(p)))
19 #define get_unaligned_le32(p)   le32_to_cpu(get_unaligned((uint32_t *)(p)))