diff options
author | David Härdeman <david@hardeman.nu> | 2020-06-16 00:00:01 +0200 |
---|---|---|
committer | David Härdeman <david@hardeman.nu> | 2020-06-16 00:00:01 +0200 |
commit | ac2754e0eb9862081e00e5ae886783db08541944 (patch) | |
tree | c193a9cb77751d63af3db214d4ffb740daa317ef /utils.h | |
parent | 4492ad9328e59edc4c8d3db8cd881941b7903741 (diff) |
Add working igmp implementation
Diffstat (limited to 'utils.h')
-rw-r--r-- | utils.h | 12 |
1 files changed, 12 insertions, 0 deletions
@@ -77,6 +77,18 @@ static inline bool empty_str(const char *str) return false; } +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define chtobe32(x) __bswap_constant_32(x) +#else +#define chtobe32(x) (x) +#endif + +#if __BYTE_ORDER == __LITTLE_ENDIAN +#define cinet_addr(a,b,c,d) ((uint32_t)((a)<<0|(b)<<8|(c)<<16|(d)<<24)) +#else +#define cinet_addr(a,b,c,d) ((uint32_t)((a)<<24|(b)<<16|(c)<<8|(d)<<0)) +#endif + #define LIST_HEAD_INIT(name) { &(name), &(name) } #define LIST_HEAD(name) struct list_head name = LIST_HEAD_INIT(name) |