SourceForge Jpcap

net.sourceforge.jpcap.capture
Enum PacketCapture.LoopMode

java.lang.Object
  extended by java.lang.Enum<PacketCapture.LoopMode>
      extended by net.sourceforge.jpcap.capture.PacketCapture.LoopMode
All Implemented Interfaces:
Serializable, Comparable<PacketCapture.LoopMode>
Enclosing class:
PacketCapture

public static enum PacketCapture.LoopMode
extends Enum<PacketCapture.LoopMode>

LoopModes determine how the PacketCapture.capture(int) and PacketCapture.captureTo(int, net.sourceforge.jpcap.capture.PacketOutputStream) methods behave in the presence of timeouts. For libpcap programmers, this enumeration specifies whether to call pcap_loop() or pcap_dispatch().

If capturing from a file, LoopMode.Dispatch is identical to LoopMode.Loop.

If not set, the default LoopMode is LoopMode.Loop.

Since:
2.0.0
See Also:
PacketCapture.capture(int), PacketCapture.getLoopMode(), PacketCapture.setLoopMode(net.sourceforge.jpcap.capture.PacketCapture.LoopMode), PacketCapture.configureBlocking(boolean)

Enum Constant Summary
Dispatch
          The Dispatch mode causes packet captures to run until either: no packets have arrived within the timeout period specified when the capture device was opened, the count is exhausted (if positive), the input file is exhausted (if capturing from a savefile), or PacketCapture.endCapture() is called.
Loop
          The Loop mode causes packet captures to run until either: the count is exhausted (if positive), the input file is exhausted (if capturing from a savefile), or PacketCapture.endCapture() is called.
 
Method Summary
static PacketCapture.LoopMode valueOf(String name)
          Returns the enum constant of this type with the specified name.
static PacketCapture.LoopMode[] values()
          Returns an array containing the constants of this enum type, in the order they're declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

Loop

public static final PacketCapture.LoopMode Loop
The Loop mode causes packet captures to run until either: The timeout parameter specified when opening the capture device is used only to determine how long the capture loop waits for another packet to arrive before starting to call callbacks for those that have already arrived: this is a measure to reduce context switches.

For libpcap programmers, this value causes the capture methods to call pcap_loop().


Dispatch

public static final PacketCapture.LoopMode Dispatch
The Dispatch mode causes packet captures to run until either:

In addition, if the capture device is in non-blocking mode, the capture methods return immediately if there are no packets ready to be captured at the moment it is called.

The timeout parameter specified when opening the capture device is used both for this purpose and to determine how long the capture loop waits for another packet to arrive before starting to call callbacks for those that have already arrived: this is a measure to reduce context switches.

For libpcap programmers, this value causes the capture methods to call pcap_dispatch().

See Also:
PacketCapture.configureBlocking(boolean)
Method Detail

values

public static final PacketCapture.LoopMode[] values()
Returns an array containing the constants of this enum type, in the order they're declared. This method may be used to iterate over the constants as follows:
for(PacketCapture.LoopMode c : PacketCapture.LoopMode.values())
        System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they're declared

valueOf

public static PacketCapture.LoopMode valueOf(String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
IllegalArgumentException - if this enum type has no constant with the specified name

Copyright © Patrick Charles & Jonas Lehmann, 2001; Esmond Pitt, 2008.