X-Git-Url: https://handorf.org/code/?p=soho-sigint.git;a=blobdiff_plain;f=client-wifi%2Fclient-c%2Fplatform.h;fp=client-wifi%2Fclient-c%2Fplatform.h;h=980fe6fdc99303d125e27749119b781819f54330;hp=0000000000000000000000000000000000000000;hb=33d0324ec01087bf1d8a919dc2a3000e89534426;hpb=d9eef3618e5d1213bd3eead787dbc48ec2fa16b1 diff --git a/client-wifi/client-c/platform.h b/client-wifi/client-c/platform.h new file mode 100644 index 0000000..980fe6f --- /dev/null +++ b/client-wifi/client-c/platform.h @@ -0,0 +1,23 @@ +#include +#include +#ifndef _BSD_SOURCE +#define _BSD_SOURCE +#endif +#ifdef __FreeBSD__ + #include +#else + #include +#endif + +#define le16_to_cpu le16toh +#define le32_to_cpu le32toh +#define get_unaligned(p) \ +({ \ + struct packed_dummy_struct { \ + typeof(*(p)) __val; \ + } __attribute__((packed)) *__ptr = (void *) (p); \ + \ + __ptr->__val; \ +}) +#define get_unaligned_le16(p) le16_to_cpu(get_unaligned((uint16_t *)(p))) +#define get_unaligned_le32(p) le32_to_cpu(get_unaligned((uint32_t *)(p)))