Reader wraps an underlying io.Reader to read packet data in PCAP format. See http://wiki.wireshark.org/Development/LibpcapFileFormat for information on the file format. We currenty read v2.4 file format with nanosecond and microsecdond timestamp resolution in little-endian and big-endian encoding.
| 30 | // If the PCAP data is gzip compressed it is transparently uncompressed |
| 31 | // by wrapping the given io.Reader with a gzip.Reader. |
| 32 | type Reader struct { |
| 33 | r io.Reader |
| 34 | byteOrder binary.ByteOrder |
| 35 | nanoSecsFactor uint32 |
| 36 | versionMajor uint16 |
| 37 | versionMinor uint16 |
| 38 | // timezone |
| 39 | // sigfigs |
| 40 | snaplen uint32 |
| 41 | linkType layers.LinkType |
| 42 | // reusable buffer |
| 43 | buf [16]byte |
| 44 | // buffer for ZeroCopyReadPacketData |
| 45 | packetBuf []byte |
| 46 | } |
| 47 | |
| 48 | const magicNanoseconds = 0xA1B23C4D |
| 49 | const magicMicrosecondsBigendian = 0xD4C3B2A1 |
nothing calls this directly
no outgoing calls
no test coverage detected