1214455Srpaulo
2214455Srpaulo/*
3214455Srpaulo * We use the "receiver-makes-right" approach to byte order,
4214455Srpaulo * because time is at a premium when we are writing the file.
5214455Srpaulo * In other words, the pcap_file_header and pcap_pkthdr,
6214455Srpaulo * records are written in host byte order.
7214455Srpaulo * Note that the bytes of packet data are written out in the order in
8214455Srpaulo * which they were received, so multi-byte fields in packets are not
9214455Srpaulo * written in host byte order, they're written in whatever order the
10214455Srpaulo * sending machine put them in.
11214455Srpaulo *
12214455Srpaulo * ntoh[ls] aren't sufficient because we might need to swap on a big-endian
13214455Srpaulo * machine (if the file was written in little-end order).
14214455Srpaulo */
15214455Srpaulo#define	SWAPLONG(y) \
16214455Srpaulo((((y)&0xff)<<24) | (((y)&0xff00)<<8) | (((y)&0xff0000)>>8) | (((y)>>24)&0xff))
17214455Srpaulo#define	SWAPSHORT(y) \
18214455Srpaulo	( (((y)&0xff)<<8) | ((u_short)((y)&0xff00)>>8) )
19214455Srpaulo
20214455Srpauloextern int dlt_to_linktype(int dlt);
21214455Srpaulo
22214455Srpauloextern int linktype_to_dlt(int linktype);
23214455Srpaulo
24214455Srpauloextern void swap_linux_usb_header(const struct pcap_pkthdr *hdr, u_char *buf,
25214455Srpaulo    int header_len_64_bytes);
26