public final class PcapGlobalHeader extends Object
| Modifier and Type | Field and Description |
|---|---|
static byte[] |
MAGIC_BIG_ENDIAN
See http://wiki.wireshark.org/Development/LibpcapFileFormat
|
static byte[] |
MAGIC_LITTLE_ENDIAN
See http://wiki.wireshark.org/Development/LibpcapFileFormat
|
static byte[] |
MAGIC_MODIFIED
Found the following at:
http://anonsvn.wireshark.org/wireshark/trunk/wiretap/libpcap.h
PCAP_MODIFIED_MAGIC is for Alexey Kuznetsov's modified "libpcap" format,
as generated on Linux systems that have a "libpcap" with his patches, at
http://ftp.sunet.se/pub/os/Linux/ip-routing/lbl-tools/
applied; PCAP_SWAPPED_MODIFIED_MAGIC is the byte-swapped version.
|
static byte[] |
MAGIC_MODIFIED_SWAPPED |
static byte[] |
MAGIC_NGPCAP
New pcap format
|
static byte[] |
MAGIC_NSEC
Found the following at:
http://anonsvn.wireshark.org/wireshark/trunk/wiretap/libpcap.h
PCAP_NSEC_MAGIC is for Ulf Lamping's modified "libpcap" format, which
uses the same common file format as PCAP_MAGIC, but the timestamps are
saved in nanosecond resolution instead of microseconds.
|
static byte[] |
MAGIC_NSEC_SWAPPED |
static int |
SIZE
pcap_hdr_s struct is SIZE bytes long.
|
| Constructor and Description |
|---|
PcapGlobalHeader(ByteOrder byteOrder,
byte[] body) |
PcapGlobalHeader(ByteOrder byteOrder,
byte[] body,
boolean nsTimestamps) |
| Modifier and Type | Method and Description |
|---|---|
static PcapGlobalHeader |
createDefaultHeader()
Factory method for creating a default
PcapGlobalHeader. |
static PcapGlobalHeader |
createDefaultHeader(Protocol protocol) |
ByteOrder |
getByteOrder() |
int |
getDataLinkType() |
static int |
getInt(int offset,
byte[] buffer,
ByteOrder byteOrder) |
int |
getMajorVersion()
Major version is currently 2
|
int |
getMinorVersion()
Minor version is currently 4
|
long |
getSnapLength()
the "snapshot length" for the capture (typically 65535 or even more, but
might be limited by the user)
|
int |
getTimeAccuracy()
in theory, the accuracy of time stamps in the capture; in practice, all
tools set it to 0
|
long |
getTimeZoneCorrection()
The correction time in seconds between GMT (UTC) and the local timezone
of the following packet header timestamps.
|
static long |
getUnsignedInt(int offset,
byte[] buffer,
ByteOrder byteOrder) |
static int |
getUnsignedShort(int offset,
byte[] buffer,
ByteOrder byteOrder) |
static PcapGlobalHeader |
parse(Buffer in) |
boolean |
timestampsInNs() |
String |
toString() |
static long |
unsignedInt(byte a,
byte b,
byte c,
byte d) |
void |
write(OutputStream out)
Will write this header to the output stream.
|
public static final int SIZE
public static final byte[] MAGIC_BIG_ENDIAN
public static final byte[] MAGIC_LITTLE_ENDIAN
public static final byte[] MAGIC_NGPCAP
public static final byte[] MAGIC_NSEC
public static final byte[] MAGIC_NSEC_SWAPPED
public static final byte[] MAGIC_MODIFIED
public static final byte[] MAGIC_MODIFIED_SWAPPED
public PcapGlobalHeader(ByteOrder byteOrder, byte[] body)
public PcapGlobalHeader(ByteOrder byteOrder, byte[] body, boolean nsTimestamps)
public static PcapGlobalHeader createDefaultHeader()
PcapGlobalHeader. Mainly
used for when writing out new pcaps to a stream.public static PcapGlobalHeader createDefaultHeader(Protocol protocol)
public ByteOrder getByteOrder()
public boolean timestampsInNs()
public int getMajorVersion()
public int getMinorVersion()
public int getTimeAccuracy()
public long getTimeZoneCorrection()
public long getSnapLength()
public int getDataLinkType()
public static final int getUnsignedShort(int offset,
byte[] buffer,
ByteOrder byteOrder)
public static final long getUnsignedInt(int offset,
byte[] buffer,
ByteOrder byteOrder)
public static final int getInt(int offset,
byte[] buffer,
ByteOrder byteOrder)
public static final PcapGlobalHeader parse(Buffer in) throws IOException
IOExceptionpublic void write(OutputStream out) throws IOException
out - IOExceptionpublic static long unsignedInt(byte a,
byte b,
byte c,
byte d)
Copyright © 2021. All Rights Reserved.