org.jnetpcap
Class PcapPktHdr

java.lang.Object
  extended by org.jnetpcap.PcapPktHdr

public class PcapPktHdr
extends java.lang.Object

Class peered with native pcap_pkthdr structure. This classes fields are initialized with values from the C structure. There are no setter methods, since the pcap_pkthdr C structure is used in read-only fassion.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Constructor Summary
PcapPktHdr()
          Initializes the timestamp fields to current time and length fields to 0.
PcapPktHdr(int caplen, int len)
          Allocates a new packet header and initializes the caplen and len fields.
PcapPktHdr(long seconds, int useconds, int caplen, int len)
           
 
Method Summary
 int getCaplen()
          Number of bytes actually captured.
 int getLen()
          Number of original bytes in the packet.
 long getSeconds()
          Capture timestamp in seconds.
 int getUseconds()
          Capture timestamp in microseconds fraction.
 void setCaplen(int caplen)
           
 void setLen(int len)
           
 void setSeconds(long seconds)
           
 void setUseconds(int useconds)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PcapPktHdr

public PcapPktHdr()
Initializes the timestamp fields to current time and length fields to 0.


PcapPktHdr

public PcapPktHdr(int caplen,
                  int len)
Allocates a new packet header and initializes the caplen and len fields. The timestamp fields are initialized to current timestamp.

Parameters:
caplen - amount of data captured
len - original packet length

PcapPktHdr

public PcapPktHdr(long seconds,
                  int useconds,
                  int caplen,
                  int len)
Parameters:
seconds - time stamp in seconds
useconds - a fraction of a second. Valid value is from 0 to 999,999.
caplen - amount of data captured
len - original packet length
Method Detail

getSeconds

public final long getSeconds()
Capture timestamp in seconds.

Returns:
the seconds

getUseconds

public final int getUseconds()
Capture timestamp in microseconds fraction.

Returns:
the useconds

getCaplen

public final int getCaplen()
Number of bytes actually captured.

Returns:
the caplen

getLen

public final int getLen()
Number of original bytes in the packet.

Returns:
the len

setSeconds

public final void setSeconds(long seconds)
Parameters:
seconds - the seconds to set

setUseconds

public final void setUseconds(int useconds)
Parameters:
useconds - the useconds to set

setCaplen

public final void setCaplen(int caplen)
Parameters:
caplen - the caplen to set

setLen

public final void setLen(int len)
Parameters:
len - the len to set