1*a6085186SLina Ceballos /* 2*a6085186SLina Ceballos * SPDX-FileCopyrightText: 2019 Jiao Xianjun <[email protected]> 3*a6085186SLina Ceballos * SPDX-License-Identifier: AGPL-3.0-or-later 4*a6085186SLina Ceballos */ 5*a6085186SLina Ceballos 67273ec43Smmehari #include <stdlib.h> 77273ec43Smmehari #include <resolv.h> 87273ec43Smmehari #include <string.h> 97273ec43Smmehari #include <unistd.h> 107273ec43Smmehari #include <getopt.h> 117273ec43Smmehari #include <pcap.h> 127273ec43Smmehari #include <errno.h> 137273ec43Smmehari 147273ec43Smmehari typedef unsigned int u32; 157273ec43Smmehari typedef unsigned short u16; 167273ec43Smmehari typedef unsigned char u8; 177273ec43Smmehari typedef u32 __le32; 187273ec43Smmehari 197273ec43Smmehari #if __BYTE_ORDER == __LITTLE_ENDIAN 207273ec43Smmehari #define le16_to_cpu(x) (x) 217273ec43Smmehari #define le32_to_cpu(x) (x) 227273ec43Smmehari #else 237273ec43Smmehari #define le16_to_cpu(x) ((((x)&0xff)<<8)|(((x)&0xff00)>>8)) 247273ec43Smmehari #define le32_to_cpu(x) \ 257273ec43Smmehari ((((x)&0xff)<<24)|(((x)&0xff00)<<8)|(((x)&0xff0000)>>8)|(((x)&0xff000000)>>24)) 267273ec43Smmehari #endif 277273ec43Smmehari #define unlikely(x) (x) 287273ec43Smmehari 297273ec43Smmehari 307273ec43Smmehari 317273ec43Smmehari 32