pcap-common.h revision 214455
1257752Semaste 2257752Semaste/* 3257752Semaste * We use the "receiver-makes-right" approach to byte order, 4257752Semaste * because time is at a premium when we are writing the file. 5257752Semaste * In other words, the pcap_file_header and pcap_pkthdr, 6257752Semaste * records are written in host byte order. 7257752Semaste * Note that the bytes of packet data are written out in the order in 8257752Semaste * which they were received, so multi-byte fields in packets are not 9257752Semaste * written in host byte order, they're written in whatever order the 10257752Semaste * sending machine put them in. 11257752Semaste * 12257752Semaste * ntoh[ls] aren't sufficient because we might need to swap on a big-endian 13257752Semaste * machine (if the file was written in little-end order). 14257752Semaste */ 15257752Semaste#define SWAPLONG(y) \ 16257752Semaste((((y)&0xff)<<24) | (((y)&0xff00)<<8) | (((y)&0xff0000)>>8) | (((y)>>24)&0xff)) 17257752Semaste#define SWAPSHORT(y) \ 18257752Semaste ( (((y)&0xff)<<8) | ((u_short)((y)&0xff00)>>8) ) 19257752Semaste 20257752Semasteextern int dlt_to_linktype(int dlt); 21257752Semaste 22257752Semasteextern int linktype_to_dlt(int linktype); 23257752Semaste 24257752Semasteextern void swap_linux_usb_header(const struct pcap_pkthdr *hdr, u_char *buf, 25257752Semaste int header_len_64_bytes); 26257752Semaste