org.jnetstream.capture
Interface Captures.LiveCaptureFactory

All Known Subinterfaces:
Captures.Factory, Captures.LocalFactory, Captures.RemoteFactory, RemoteSession
Enclosing class:
Captures

public static interface Captures.LiveCaptureFactory

Factory classes which create live capture sessions and transmit packets. Since live captures are inherantly platform specific, this part of the overall factory implementation is optional and may be ommitted. If implementation for LiveCaptureFactory is not included, all openLive and openTransmitter methods will trow UnsuportedOperationException. Other methods such as listCaptureDevices and newCaptureDevice will not, but will default to using java.net package to fulfill the request. The implementation can be specified using system variable

Author:
Mark Bednarczyk, Sly Technologies, Inc.

Field Summary
static java.lang.String LIVE_CAPTURE_FACTORY_CLASS_PROPERTY
          System property which can be used to override the default implementation class for LiveCaptureFactory.
 
Method Summary
 LiveCaptureDevice[] listCaptureDevices()
          Gets a list of all the devices capable of doing live capture on this or remote system.
 CaptureDevice newCaptureDevice()
          Creates a new empty, uninitialized CaptureDevice instance.
 LiveCapture openLive()
          Opens up all interfaces, except loopback and dialup interfaces, for live capture.
 LiveCapture openLive(CaptureDevice... nics)
           
 LiveCapture openLive(java.util.Collection<CaptureDevice> nics)
           
 LiveCapture openLive(Filter<ProtocolFilterTarget> fiter)
           Opens up all interfaces, except loopback and dialup interfaces, for live capture.
 LiveCapture openLive(Filter<ProtocolFilterTarget> filter, CaptureDevice... nics)
           
 LiveCapture openLive(Filter<ProtocolFilterTarget> filter, java.util.Collection<CaptureDevice> nics)
           
 LiveCapture openLive(long count)
          Opens up all interfaces, except loopback and dialup interfaces, for live capture.
 NetTransmitter openTransmitter()
          Opens a live session with the network interface for packet tranmition.
 NetTransmitter openTransmitter(java.net.NetworkInterface netInterface)
          Opens a live session with the network interface for packet tranmition.
 

Field Detail

LIVE_CAPTURE_FACTORY_CLASS_PROPERTY

static final java.lang.String LIVE_CAPTURE_FACTORY_CLASS_PROPERTY
System property which can be used to override the default implementation class for LiveCaptureFactory. By specifying this system property, before the jNetStream library is loaded, will cause it to look for the class named in this property and loading it to serve all LiveCaptureFactory requests.

See Also:
Constant Field Values
Method Detail

listCaptureDevices

LiveCaptureDevice[] listCaptureDevices()
                                       throws java.io.IOException
Gets a list of all the devices capable of doing live capture on this or remote system.

Returns:
list of capture capable devices
Throws:
java.io.IOException - any IO errors

newCaptureDevice

CaptureDevice newCaptureDevice()
Creates a new empty, uninitialized CaptureDevice instance. You must use its set methods to set all the properties yourself.

Returns:
empty instance of a capture device

openLive

LiveCapture openLive()
                     throws java.io.IOException
Opens up all interfaces, except loopback and dialup interfaces, for live capture. The captured packets can be iterated over using the inherited methods IOIterator.hasNext() and IOIterator.next(). There is no guarrantee as to the order in which captured packets are returned between multiple interfaces, with the exception that for each interface the packets will be returned in the order they were captured on that interface.

Returns:
a capture capturing packets on all interfaces, with the above specified exceptions
Throws:
java.io.IOException - any IO errors

openLive

LiveCapture openLive(CaptureDevice... nics)
                     throws java.io.IOException
Throws:
java.io.IOException

openLive

LiveCapture openLive(java.util.Collection<CaptureDevice> nics)
                     throws java.io.IOException
Throws:
java.io.IOException

openLive

LiveCapture openLive(Filter<ProtocolFilterTarget> fiter)
                     throws java.io.IOException

Opens up all interfaces, except loopback and dialup interfaces, for live capture. The captured packets can be iterated over using the inherited methods IOIterator.hasNext() and IOIterator.next(). There is no guarrantee as to the order in which captured packets are returned between multiple interfaces, with the exception that for each interface the packets will be returned in the order they were captured on that interface.

The filter is used to limit the number of packets captured to ones that match the filter criteria. Each packet after capture is matched by the filter. For efficiency this is done at the kernel level for operating systems that support this feature. On operating systems that do not, the filter match is performed in "userland" or user space which is less efficient

Parameters:
fiter -
Returns:
Throws:
java.io.IOException

openLive

LiveCapture openLive(Filter<ProtocolFilterTarget> filter,
                     CaptureDevice... nics)
                     throws java.io.IOException
Throws:
java.io.IOException

openLive

LiveCapture openLive(Filter<ProtocolFilterTarget> filter,
                     java.util.Collection<CaptureDevice> nics)
                     throws java.io.IOException
Throws:
java.io.IOException

openLive

LiveCapture openLive(long count)
                     throws java.io.IOException
Opens up all interfaces, except loopback and dialup interfaces, for live capture. The captured packets can be iterated over using the inherited methods IOIterator.hasNext() and IOIterator.next(). There is no guarrantee as to the order in which captured packets are returned between multiple interfaces, with the exception that for each interface the packets will be returned in the order they were captured on that interface.

Parameters:
count - number of packet to capture and then exit
Returns:
a capture capturing packets on all interfaces, with the above specified exceptions
Throws:
java.io.IOException - any IO errors

openTransmitter

NetTransmitter openTransmitter()
                               throws java.io.IOException
Opens a live session with the network interface for packet tranmition. The default interface is opened.

Returns:
open transmitter with the default network interface
Throws:
java.io.IOException - any IO errors while opening the connection to interface

openTransmitter

NetTransmitter openTransmitter(java.net.NetworkInterface netInterface)
                               throws java.io.IOException
Opens a live session with the network interface for packet tranmition. The user specified interface is opened.

Returns:
open transmitter with the user specified network interface
Throws:
java.io.IOException - any IO errors while opening the connection to interface