1 /* 2 * SPDX-FileCopyrightText: 2019 Jiao Xianjun <[email protected]> 3 * SPDX-License-Identifier: AGPL-3.0-or-later 4 */ 5 6 #include <stdlib.h> 7 #include <resolv.h> 8 #include <string.h> 9 #include <unistd.h> 10 #include <getopt.h> 11 #include <pcap.h> 12 #include <errno.h> 13 14 typedef unsigned int u32; 15 typedef unsigned short u16; 16 typedef unsigned char u8; 17 typedef u32 __le32; 18 19 #if __BYTE_ORDER == __LITTLE_ENDIAN 20 #define le16_to_cpu(x) (x) 21 #define le32_to_cpu(x) (x) 22 #else 23 #define le16_to_cpu(x) ((((x)&0xff)<<8)|(((x)&0xff00)>>8)) 24 #define le32_to_cpu(x) \ 25 ((((x)&0xff)<<24)|(((x)&0xff00)<<8)|(((x)&0xff0000)>>8)|(((x)&0xff000000)>>24)) 26 #endif 27 #define unlikely(x) (x) 28 29 30 31 32