org.jnetpcap
Interface JCaptureHeader

All Known Implementing Classes:
JMemoryPacket.JMemoryHeader, PcapHeader

public interface JCaptureHeader

Interface to to capture header provided by the capturing library. For example PcapHeader, the capture header provided by libpcap, implements this interface which provides access to minimum set of information about the capture packet.

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Method Summary
 int caplen()
          Retrieves the length of the packet that was actually captured.
 void caplen(int caplen)
          Caplen.
 void initFrom(JCaptureHeader captureHeader)
          Inits the from.
 long nanos()
          Fractional part of the second when the packet was captured.
 void nanos(long nanos)
          Nanos.
 long seconds()
          Capture timestamp in UNIX seconds.
 void seconds(long seconds)
          Seconds.
 long timestampInMicros()
          Gets the absolute capture timestam pin micro seconds (10e-6).
 long timestampInMillis()
          Converts the timestamp into a java style timestamp suitable for usage with Date class.
 long timestampInNanos()
          Gets the absolute capture timestamp in nano seconds (10e-9).
 int wirelen()
          Retrieves the length of the packet before any of it was truncated by the capture mechanism.
 void wirelen(int wirelen)
          Wirelen.
 

Method Detail

caplen

int caplen()
Retrieves the length of the packet that was actually captured. This could be only a portion of the original packet if snaplen filter was set during Pcap.openXXX call. If the packet was not trucated, this length should equal the length returned by wirelen().

Returns:
length in bytes

wirelen

int wirelen()
Retrieves the length of the packet before any of it was truncated by the capture mechanism. This is the size of the orignal packet as it was send accross the network.

Returns:
length in bytes

seconds

long seconds()
Capture timestamp in UNIX seconds.

Returns:
timestamp in seconds since 1970

nanos

long nanos()
Fractional part of the second when the packet was captured. If the resolution of the original capture timestamp is lower than nano seconds, they are converted to nano seconds. For example of the capture timestamp is in micro seconds, then the micro seconds fraction is multiplied by a 1000 before being returned to conform to nano second return timestamp.

Returns:
Number of nano seconds at the time of the packet capture. The valid value returned by this method is from 0 to 999,999,999.

timestampInMillis

long timestampInMillis()
Converts the timestamp into a java style timestamp suitable for usage with Date class.

Returns:
capture timestamp in milli-seconds

timestampInNanos

long timestampInNanos()
Gets the absolute capture timestamp in nano seconds (10e-9).

Returns:
timestamp in nano seconds

timestampInMicros

long timestampInMicros()
Gets the absolute capture timestam pin micro seconds (10e-6).

Returns:
timestamp in micro seconds

seconds

void seconds(long seconds)
Seconds.

Parameters:
seconds - the seconds

nanos

void nanos(long nanos)
Nanos.

Parameters:
nanos - the nanos

caplen

void caplen(int caplen)
Caplen.

Parameters:
caplen - the caplen

wirelen

void wirelen(int wirelen)
Wirelen.

Parameters:
wirelen - the wirelen

initFrom

void initFrom(JCaptureHeader captureHeader)
Inits the from.

Parameters:
captureHeader - the capture header