A Libpcap/WinPcap java wrapper
jNetPcap is a true java wrapper around the native libpcap and winpcap libraries, exposing all of their functions and structures. Through the use of java's JNI API, methods are proxied and structures are peered with their java cousins. I stress the "all" exported functions fact, to point out that no other java library does this today and that is how jNetPcap differentiates itself, among other things.
* No packet data copies - passed by reference into java as a direct nio byte buffer
* Provides "all" libpcap functions and structures - very few exceptions that just did not make sense in java
* Also comes with all WinPcap extensions
* Packets are now fully decoded and provide compile-time type safety for accessing header fields
* Produce human readable textual output from packets or XML using supplied formatters
* Tune kernel buffers and behavior from java
* Transmit at link layer with any size sendqueues
* Remote captures
* Allows the kernel to gather statistics much more efficiently
* LGPL licensed - source in SVN on sf.net
Some note worthy methods:
* openLive - opens a live capture from network interface
* openOffline - opens a capture file
* findAllDevsEx - extended version of Pcap.findAllDevs which allows you to not only find network interfaces, but also PCAP files. This can be done locally or remotely.
* liveDump - which can dump captured packets to a savefile automatically at the kernel level.
* sendQueueTransmit - and related method, which allow raw packets to be sent in bulk, efficiently.
* setMinToCopy, setMode and setBuf - allow tweaking of kernel buffers and enable/disable statistical captures
* offlineFilter - ability to apply the BPF filter on your own packets without a capture
* setSampling - changes the mode of the capture where only samples of a capture are retruend. packets
* statEx - extended statistics that include counters on RPCAP remote connection
Home page: jnetpcap.com