|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jnetpcap.nio.JMemory
org.jnetpcap.nio.JStruct
org.jnetpcap.PcapHeader
public class PcapHeader
struct pkt_header {
struct timeval ts; // ts.tv_sec, ts.tv_usec
uint32 caplen; // captured length
uint32 len; // original length
}
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class org.jnetpcap.nio.JMemory |
|---|
JMemory.Type |
| Field Summary | |
|---|---|
static int |
LENGTH
Length of the libpcap pcap header in bytes. |
static java.lang.String |
STRUCT_NAME
Name of the native structure. |
| Fields inherited from class org.jnetpcap.nio.JMemory |
|---|
JNETPCAP_LIBRARY_NAME, MAX_DIRECT_MEMORY_DEFAULT, POINTER |
| Constructor Summary | |
|---|---|
PcapHeader()
Creates a header structure with allocated memory. |
|
PcapHeader(int caplen,
int wirelen)
Creates a header structure with initial values. |
|
PcapHeader(JMemory.Type type)
Creates an empty pcap header suitable for peering. |
|
| Method Summary | |
|---|---|
int |
caplen()
Gets the caplen field from the structure. |
void |
caplen(int caplen)
Unsupported operation. |
int |
hdr_len()
Gets the hdr_len field from the structure. |
void |
hdr_len(int len)
Sets the hdr_len field. |
long |
hdr_sec()
Gets the hdr_sec field value. |
void |
hdr_sec(long ts)
Sets the hdr_sec field. |
int |
hdr_usec()
Gets the hdr_usec field. |
void |
hdr_usec(int ts)
Sets the hdr_usec field. |
int |
hdr_wirelen()
Gets the hdr_wirelen field. |
void |
hdr_wirelen(int len)
Sets the hdr_wirelen field. |
void |
initFrom(JCaptureHeader captureHeader)
Unsupported operation. |
long |
nanos()
Converts hdr_usec field into nano seconds. |
void |
nanos(long nanos)
Unsupported operation. |
int |
peer(JBuffer memory,
int offset)
Peers this header object with the supplied memory object. |
int |
peerTo(JBuffer buffer,
int offset)
Peers this header with the supplied buffer. |
int |
peerTo(PcapHeader header,
int offset)
Peers this header to the user supplied header. |
long |
seconds()
Gets the hdr_sec field. |
void |
seconds(long seconds)
Unsupported operation. |
static int |
sizeof()
Size of the pcap_pkthdr structure in bytes. |
long |
timestampInMicros()
Converts the hdr_sec and hdr_usec fields into a micro second absolute timestamp. |
long |
timestampInMillis()
Converts the hdr_sec and hdr_usec fields into a java style absolute timestamp suitable for usage with java's Date object. |
long |
timestampInNanos()
Converts the hdr_sec and hdr_usec fields into a nano second absolute timestamp. |
int |
transferTo(byte[] m,
int offset)
Copies contents of this buffer into supplied byte array buffer. |
int |
transferTo(JBuffer m,
int offset)
Copies contents of this header to supplied buffer. |
int |
wirelen()
Gets the value of hdr_wirelen field. |
void |
wirelen(int wirelen)
Unsupported operation. |
| Methods inherited from class org.jnetpcap.nio.JStruct |
|---|
getStructName, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final java.lang.String STRUCT_NAME
public static final int LENGTH
sizeof() method returns due to native compiler padding for
byte aligment.
| Constructor Detail |
|---|
public PcapHeader()
public PcapHeader(int caplen,
int wirelen)
caplen - buffer sizewirelen - original packet lengthpublic PcapHeader(JMemory.Type type)
type - memory allocation model type| Method Detail |
|---|
public static int sizeof()
public int caplen()
caplen in interface JCaptureHeaderpublic int hdr_len()
public void hdr_len(int len)
len - new value for hdr_len fieldpublic long hdr_sec()
public void hdr_sec(long ts)
ts - new value for hdr_sec fieldpublic int hdr_usec()
public void hdr_usec(int ts)
ts - new value for hdr_usec fieldpublic int hdr_wirelen()
public void hdr_wirelen(int len)
len - new value for hdr_wirelen fieldpublic long nanos()
nanos in interface JCaptureHeader
public int peer(JBuffer memory,
int offset)
memory - object to peer with this headeroffset - offset into memory object
public int peerTo(JBuffer buffer,
int offset)
buffer - buffer to peer withoffset - offset into the buffer
public int peerTo(PcapHeader header,
int offset)
header - header to peer withoffset - offset into the supplied header
public long seconds()
seconds in interface JCaptureHeaderpublic long timestampInMillis()
Date object.
timestampInMillis in interface JCaptureHeader
public int transferTo(JBuffer m,
int offset)
m - buffer to copy tooffset - offset into the buffer
public int transferTo(byte[] m,
int offset)
m - buffer to copy tooffset - offset into the buffer
public int wirelen()
wirelen in interface JCaptureHeaderpublic void caplen(int caplen)
caplen in interface JCaptureHeadercaplen - ignoredpublic void nanos(long nanos)
nanos in interface JCaptureHeadernanos - ignoredpublic void seconds(long seconds)
seconds in interface JCaptureHeaderseconds - ignoredpublic void wirelen(int wirelen)
wirelen in interface JCaptureHeaderwirelen - ignoredpublic void initFrom(JCaptureHeader captureHeader)
initFrom in interface JCaptureHeadercaptureHeader - ignoredpublic long timestampInNanos()
timestampInNanos in interface JCaptureHeaderpublic long timestampInMicros()
timestampInMicros in interface JCaptureHeader
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||