SharpPcap Changelog

What's new in SharpPcap 4.0.0

Sep 14, 2011
  • Update PacketDotNet from 0.10.0 to 0.11.0 commit
  • we track changes in git right now commit
  • Bump assembly version up to 4.0.0 commit
  • Improve the WinformsExample example by adding a textbox below the captured packets list that shows the text output of the selected packet after parsing commit
  • Add unit tests for ICaptureDevice vs. a specfic device type and for unsafe code commit
  • Fix indentation commit
  • Fix a compile error in PcapDevice.MarshalRawPacket commit
  • Resize and align PcapHeader to improve conversion performance.
  • Switch PcapHeader properties to fields, profiling shows a ~2.5% performance improvement
  • Enable pdb output and debug symbols for release builds of SharpPcap.
  • Remove unused NotSupportedOnOfflineDeviceException. Replaced with NotSupportedOnCaptureFileException during the capture file reader/writer cleanup.
  • Convert PcapHeader to a struct and convert its creation from an IntPtr to unsafe for significant performance improvement. Add the unsafe flag to the SharpPcap library so we can use unsafe code. Switch from casting and copying the data instead of allocating an instance and marshalling data into it. Performance test results from Test/Performance in the source tree: Baseline: 346,681 packets parsed / sec 1,032,907 packets captured / sec After changes: 407,989 packets parsed / sec 1,545,507 packets captured / sec ~18% increase in packet parsing rate ~50% increase in packet capture rate Note that those are synthetic tests that are reading packets from a capture file. Real world results are likely to be significant improvements in line capture rates and a reduction in dropped packets.
  • Fix TestStatisticsException, a NotSupportedOnCaptureFileException is thrown now instead of a NotSupportedOnOfflineDeviceException
  • Remove OfflinePcapDevice.cs and OfflineCaptureDevice.cs. OfflinePcapDevice has been replaced by CaptureFileReaderDevice Remove the dump methods from PcapDevice. Writing to capture files has been replaced with the CaptureFileWriterDevice. Remove Example 7 and example 8, these have been replaced with the CreatingCaptureFile and ReadingCaptureFile examples Remove the dump methods from ICaptureDevice
  • Switch RawCapture.Data from a virtual property to a class field. ~2.5% performance improvement when parsing packets with Packet.Net and ~20% when reading all of the packet data bytes.
  • Add a new PacketParsing performance benchmark
  • Rename Performance/PacketParsing.cs to PacketReading.cs to reflect that the test isn't actually parsing packets, just reading packets
  • Switch from using OfflineCaptureDevice to using the newer LibPcap.CaptureFileReaderDevice, OfflinePcapDevice is being deprecated
  • Add ICaptureDevice.GetNextPacketPointers and PcapDevice.GetNextPacketPointers that return the pointers from the calls to pcap_next_ex(). This enables unmanaged code to avoid the overhead of marshalling PcapHeader and packet contents to allocated memory.
  • Update the tutorial to reflect the new CaptureFileWriterDevice and CaptureFileReaderDevice classes. Remove the older style examples as they were more complicated
  • Add FileSize and FileName properties to CaptureFileReaderDevice, copied from the now deprecated OfflinePcapDevice
  • Project file updates for packet.net dll reference
  • Create new classes for reading and writing capture files, CaptureFileReaderDevice and CaptureFileWriterDevice. Add new examples that use these classes, Examples/ReadingCaptureFile and Examples/CreatingCaptureFile
  • Clarify PcapDevice.DumpOpen() and where the link-layer type and snapshot length
  • Modify ARP class to take a device instead of a device name. Fixes an issue where device names can be specific to their lists, eg. the WinPcap device list has names that start with rpcap but LibPcapLiveDeviceList does not. Using a WinPcap device name to look up a LibPcapLiveDevice like the ARP class used to do won't work. Switch instead to passing a device in instead. Also modify the class to only look up IPv4 addresses as ARP is IPv4 only, and remove public properties for the DeviceName, MacAddress and LocalIP, these can now be passed into ARP.Resolve() if desired. Modify Example2 to reflect the changes to the ARP class

New in SharpPcap 3.3.0 (Oct 27, 2010)

  • Update PacketDotNet to 0.6.0
  • Integrate patch to add winpcap specific pcap_setmintocopy()
  • Change deprecated PcapDevice.SetFilter() from public to protected. Users should use the PcapDevice.Filter property instead.
  • Add a unit test that verifies that a DeviceNotReadyException is thrown from
  • PcapDevice.StartCapture() if no delegates have been assigned to
  • PcapDevice.OnPacketArrival.
  • PcapDevice.StartCapture() should throw a DeviceNotReadyException() if no delegates have been assigned to the OnPacketArrival event. Might help some new users of the library avoid wondering where the captured packets were going.
  • Solution and .csproj file updates made by Monodevelop 2.4. Can't help but think that these bring the files closer to what Visual Studio is looking for since Monodevelop is looking for full compatibility with Visual Studio.
  • Fix setter of PcapDevice.Filter by using the new filter value. Fixes the
  • OfflinePcapDeviceTest.SetFilter() test.
  • Add a check in PcapDevice.GetNextPacket() to throw an exception if the device is already performing a background capture.
  • Performing a call to GetNextPacket() while a background capture is running can result in multiple calls into libpcap that appear to corrupt an internal pcap device structure. Protect the user from this condition.
  • Add a unit test to verify that the proper exception is thrown.
  • Improve documentation of PcapDevice.StartCapture()