|
SourceForge Jpcap | |||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |
See:
Description
Interface Summary | |
---|---|
PacketCaptureCapable | This is the packet capture interface. |
PacketDispatchCapable | An interface for classes capable of dispatching captured network packets. |
PacketListener | Packet data listener. |
RawPacketListener | Raw packet data listener. |
StatisticsListener | StatisticsListener is the callback that is used when a capture device is in
JWinPcap.CaptureMode.Statistical mode. |
Class Summary | |
---|---|
CaptureDevice | Encapsulates a capture-capable device. |
CaptureDevice.Address | The Address class encapsulates addressing information for a CaptureDevice. |
CaptureStatistics | Packet capture statistics. |
CaptureTest | Class to exercise PacketCapture. |
CompiledFilter | The CompiledFilter class encapsulates a compiled packet filter expression. |
JWinPcap | The JWinPcap class encapsulates the extended functions supported by the WinPcap native library. |
JWinPcapTest | Class to exercise JWinPcap. |
PacketCapture | This class is the core of packet capture in jpcap. |
PacketCaptureBase | This class contains base functionality shared by both the simulator and the actual packet capture system. |
PacketDispatcher | This class encapsulates a mechanism for dispatching network data and packets to a listener who has subscribed to such events. |
PacketInputStream | PacketInputStream provides an easy way of reading packets from the network or a savefile
without having to define and register PacketListeners . |
PacketOutputStream | PacketOutputStream is an I/O stream used for sending Packets to the network, or dumping them to a tcpdump-formatted file, depending on how the stream was created. |
StatisticsEvent | StatisticsEvent encapsulates the statistics generated by JWinPcap.CaptureMode.Statistical . |
Enum Summary | |
---|---|
JWinPcap.CaptureMode | Capture mode, for use with setCaptureMode() . |
JWinPcap.OpenFlags | Open flags, for use with open() . |
JWinPcap.SamplingMethod | Sampling method for use with setSamplingMethod() . |
PacketCapture.Direction | Capture Direction enumeration. |
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. |
Exception Summary | |
---|---|
CaptureConfigurationException | This exception occurs when the capture client tries to specify a capture device that does not exist or if the capture device specified is illegal. |
CaptureDeviceInvalidException | This exception occurs when the capture client tries to specify a capture device that does not exist or if the capture device specified is illegal. |
CaptureDeviceLookupException | This exception occurs when no capture devices are detected. |
CaptureDeviceNotFoundException | This exception occurs when no capture devices are detected. |
CaptureDeviceOpenException | This exception occurs when the capture device cannot be opened. |
CaptureFileOpenException | This exception occurs when a tcpdump-formatted savefile cannot be opened. |
CapturePacketException | This exception occurs when an error occurs while capturing data. |
InvalidFilterException | This exception occurs when an error occurs while capturing data. |
JpcapException | JpcapException is the base class for all Jpcap exceptions. |
Provides an interface for capturing packets and a layer of abstraction around libpcap, a portable native system library for capturing network packets.
The PacketCapture
class is the core of the packet capture system provided by jpcap.
Applications wishing to capture network packets create an instance of
PacketCapture
and call its methods in order to open a network device,
set packet filters and ultimately receive packet data from the network.
PacketCapture
utilizes an event-listener pattern to broadcast packets
to all objects which have registered as listeners for events of interest.
Applications capturing network data must implement
PacketListener
or RawPacketListener
and register with an instance of the capture system in order to receive
packets.
The JWinPcap
class encapsulates the WinPcap extension API.
PacketCapture
and JWinPcap
classes provide an almost complete coverage
of the libpcap/Winpcap APIs, as described in the following subsections.
The mapping is as Java-like as possible, e.g. using InputStream
and OutputStream
where appropriate,
rather than just mapping every 'C' method into a Java method.
This approach also has the advantage of making the Java interface much smaller, as we don't have to add
lots of interface data structures, or re-document well-known methods like constructors,
finalize()
,
close()
,
flush()
, etc.
However, no efficiency is sacrificed by this approach: indeed, some operations,
like the captureTo()
methods,
are more efficient than they would be if the underyling 'C' methods were mapped directly.
PacketDispatcher.addPacketListener(net.sourceforge.jpcap.capture.PacketListener)
,
PacketDispatcher.addRawPacketListener(net.sourceforge.jpcap.capture.RawPacketListener)
.
PacketCapture.open()
.
PacketCapture.openOffline()
.
PacketCapture.getOutputStream(File)
.
PacketCapture.configureBlocking(boolean)
,
PacketCapture.isBlocking()
.
PacketCapture.lookupDevices()
,
PacketCapture.lookupCaptureDevices()
.
PacketCapture.findDevice()
, PacketCapture.findCaptureDevice()
, JWinPcap.findCaptureDevice()
.
PacketCapture.getNetmask()
and
PacketCapture.getNetwork()
.
CaptureDevice
.
PacketCapture.capture()
,
PacketCapture.captureTo()
,
PacketCapture.LoopMode
,
PacketCapture.getLoopMode()
,
PacketCapture.setLoopMode()
.
PacketCapture.captureNext()
,
PacketInputStream.readPacket()
.
PacketCapture.endCapture()
.
PacketOutputStream.writePacket(net.sourceforge.jpcap.net.Packet)
PacketCapture.getOutputStream(File)
,
PacketCapture.captureTo()
.
PacketOutputStream.getFilePointer()
.
PacketCapture.compileFilter(java.lang.String, boolean)
,
CompiledFilter.finalize()
.
PacketCapture.setFilter()
.
PacketCapture.getLinkLayerType()
.
PacketCapture.getLinkLayerTypes()
.
PacketCapture.setLinkLayerType(int)
.
PacketCapture.getLinkLayerName()
.
PacketCapture.getLinkLayerDescription()
.
PacketCapture.getSnapshotLength()
:
the data is saved and returned at the Java level.
PacketCapture.getStatistics()
.
PacketCapture.getLibVersion()
.
PacketCapture.close()
.
PacketOutputStream.flush()
.
PacketOutputStream.close()
.
JWinPcap.isFilteredOffline()
.
PacketCapture.captureTo()
,
and not just on Windows platforms.
PacketCapture.getStatistics()
.
JWinPcap.setBufferSize(int)
.
JWinPcap.getBufferSize()
,
which is missing from the WinPcap API, but by knowing it is initially 1 megabyte and tracking
changes we can implement it at the Java level.
JWinPcap.CaptureMode
,
JWinPcap.setCaptureMode()
,
StatisticsListener
,
StatisticsEvent
,
JWinPcap.addStatisticsListener()
,
JWinPcap.removeStatisticsListener()
.
JWinPcap.setMinimumKernelCopy(int)
JWinPcap.getMinimumKernelCopy()
method,
as per JWinPcap.getBufferSize()
above.
Selector
).
PacketOutputStreams
,
without having to define any new API methods.
Specifically, these pcap_sendqueue_*() methods are mapped to
the PacketOutputStream
constructor,
PacketOutputStream.close()
,
PacketOutputStream.writePacket(net.sourceforge.jpcap.net.Packet)
,
PacketOutputStream.flush()
,
respectively, when called on a PacketOutputStream obtained from
JWinPcap.getOutputStream()
.
Note: when a Winpcap send-queue has been transmitted it cannot be reused for further queueing;
when this happens in JWinPcap, a new send-queue is constructed automatically if necessary.
Send queues are automatically destroyed on closure of the stream, or via garbage collection.
JWinPcap.lookupCaptureDevices()
.
URI
JWinPcap
constructors,
JWinPcap.open()
,
JWinPcap.openOffline()
.
JWinPcap.SamplingMethod
,
JWinPcap.setSamplingMethod()
.
|
Copyright © Patrick Charles & Jonas Lehmann, 2001; Esmond Pitt, 2008. | |||||||||
PREV PACKAGE NEXT PACKAGE | FRAMES NO FRAMES |