1 /* $NetBSD: pcap-common.h,v 1.2 2014/11/19 19:33:30 christos Exp $ */
5 * We use the "receiver-makes-right" approach to byte order,
6 * because time is at a premium when we are writing the file.
7 * In other words, the pcap_file_header and pcap_pkthdr,
8 * records are written in host byte order.
9 * Note that the bytes of packet data are written out in the order in
10 * which they were received, so multi-byte fields in packets are not
11 * written in host byte order, they're written in whatever order the
12 * sending machine put them in.
14 * ntoh[ls] aren't sufficient because we might need to swap on a big-endian
15 * machine (if the file was written in little-end order).
18 ((((y)&0xff)<<24) | (((y)&0xff00)<<8) | (((y)&0xff0000)>>8) | (((y)>>24)&0xff))
19 #define SWAPSHORT(y) \
20 ( (((y)&0xff)<<8) | ((u_short)((y)&0xff00)>>8) )
22 extern int dlt_to_linktype(int dlt
);
24 extern int linktype_to_dlt(int linktype
);
26 extern void swap_pseudo_headers(int linktype
, struct pcap_pkthdr
*hdr
,