Packet Sniffer SDK DLL Edition

WinPCap to PSSDK migration module

 Previous Next

WinPCap to PSSDK migration module is addressed to developers, who used WinPCap packet capture library in their projects, and wish to increase performance of their applications working on multi-CPU PC and in multi-Gigabit networks, and make them completely independent on external packet capture drivers and libraries.

WinPCap to PSSDK migration module also may be used for rapid migration of WinPCap-based projects to the Packet Sniffer SDK library, which provides richer possibilities for network traffic capturing and controlling.

Also this module may be useful for cross-platform applications developers, who use libpcap library and are going to port their applications to Microsoft Windows platform.

Since PSSDK version 4.0 WinPCap to PSSDK migration module allows to capture traffic on Loopback adapter - a virtual network adapter which provides local Windows TCP/UDP sockets traffic encapsulated in Ethernet packets.

Why migrate to PSSDK from WinPCap?

Windows applications created with WinPCap (Windows port of the libpcap library) require the following:

  1. wpcap.dll - libpcap library compiled for Windows,
  2. packet.dll - the library through which the application communicates with the packet capture driver,
  3. npf.sys - statically installed packet capture driver.

All these software must be installed beforehand by WinPCap installer. After migration of your application to PSSDK it becomes portable: you may run it from a removable storage device.

What is WinPCap to PSSDK migration module?

WinPCap to PSSDK migration module includes dynamic library packet.dll and a set of static libraries packet_vc*_xxx.lib, compiled for various compilers with different compilation options.

Both libraries provide implementations of functions of packet.dll library from WinPCap distribution, but use PSSDK instead.

packet.dll is a DLL, exporting the same functions set as packet.dll from WinPCap does, requires PSSDK.

packet_vc*_xxx.lib - static libraries with the same functions set as packet.dll from WinPCap has. If your application is compiled with any of these libraries, it will use PSSDK functions, so PSSDK static libraries are required too (pssdk_vc*_xxx.lib or pssdk.lib).

How to use WinPCap to PSSDK migration module in your application:

If your application uses WinPCap, then it refers to packet.dll, or to wpcap.dll, or to both of them, so its dependencies may look as follows:

Your application depends on wpcap.dll and packet.dll from WinPCap Your application depends only on wpcap.dll, which in turn depends on packet.dll from WinPCap Your application depends only on packet.dll from WinPCap

The first way to migrate your application to PSSDK:

Just replace packet.dll from WinPCap with packet.dll from WinPCap to PSSDK migration module, and put pssdk.dll near it.

In this case your application dependencies will look as follows:

Your application depends on wpcap.dll and packet.dll Your application depends only on wpcap.dll, which in turn depends on packet.dll Your application depends only on packet.dll from WinPCap

This is the simplest way: it even doesn't require your application to be recompiled, you only have to copy two files to the application directory.

This method is good if you want very easy and very quickly check if your application will work properly with PSSDK, or you just want to run from removable storage device one of numerous applications which use WinPCap (Wireshark/Ethereal, nmap, ngrep, etc.)

The second way to migrate your application to PSSDK:

In this case you should recompile your application using static libraries instead of linking of wpcap.lib and packet.lib import libraries.

Instead of wpcap.lib use:

Wpcap_vc*_XXX.lib from wpcap-4.1.beta2 directory (static version of the original wpcap.dll from WinPCap 4.1.beta2)

OR

Libpcap_vc*_XXX.lib from libpcap-0.9.8 (the original libpcap-0.9.8 from www.tcpdump.org)

We've compiled these libraries only for your convenience, so if you want you can compile them from sources by your own.

 

vc* - in the library file name means the following:

vc8 - static library for Microsoft Visual Studio 2005

vc9 - static library for Microsoft Visual Studio 2008

 

The ending XXX letters in the library file name mean the following:

mt - static library - release multi thread (/MT compiler option);

md - static library - release multi thread DLL (/MD compiler option);

mtd - static library - debug multi thread (/MTd compiler option);

mdd - static library - debug multi thread DLL (/MDd compiler option).

 

Instead of packet.dll use:

packet_vc*_XXX.lib from pssdk_wrapper directory (compiled static versions of the WinPCap to PSSDK migration module library)

And additionally from the pssdk-4.0 directory:

pssdk_vc*_XXX.lib, if you're going to use PSSDK static libraries

OR

pssdk.lib, if you're going to use pssdk.dll

 

Thus, you should compile your application this way:

 

Your application +
Wpcap_vc*_XXX.lib or Libpcap_vc*_XXX.lib +
pssdk.lib
application will need only pssdk.dll, which doesn't require installation.

OR

 

Your application +
Wpcap_vc*_XXX.lib or Libpcap_vc*_XXX.lib +
pssdk_vc*_XXX.lib
application will not require installation of WinPCap, nor pssdk.dll

In this case you'll get the following dependencies in your application:

Your application is compiled with pssdk.lib (uses PSSDK DLL Edition) Your application is compiled with pssdk_vc*_XXX.lib (uses PSSDK static libraries)

 

Currently the following WinPCap functions are supported:

 

PacketGetVersion
PacketGetDriverVersion
PacketSetMinToCopy
PacketSetNumWrites
PacketSetMode
PacketSetReadTimeout
PacketSetBpf
PacketSetSnapLen
PacketGetStats
PacketGetStatsEx
PacketSetBuff
PacketGetNetType
PacketOpenAdapter
PacketSendPacket
PacketSendPackets
PacketAllocatePacket
PacketInitPacket
PacketFreePacket
PacketReceivePacket
PacketSetHwFilter
PacketGetAdapterNames
PacketGetNetInfoEx
PacketGetNetInfo
PacketGetReadEvent
PacketStopDriver
PacketCloseAdapter

 

The following functions are not supported in the current version:

 

PacketSetDumpName
PacketSetDumpLimits
PacketIsDumpEnded

 

PacketRequest supports all OID requests supported by the vendor's NIC driver. For virtual Loopback adapter only the following requests are supported:

 

OID_802_3_CURRENT_ADDRESS
OID_GEN_LINK_SPEED
OID_GEN_MEDIA_CONNECT_STATUS
OID_GEN_HARDWARE_STATUS
OID_GEN_MAXIMUM_FRAME_SIZE
OID_GEN_MAXIMUM_TOTAL_SIZE
OID_GEN_XMIT_OK
OID_GEN_RCV_OK
OID_GEN_XMIT_ERROR
OID_GEN_RCV_ERROR
OID_GEN_RCV_NO_BUFFER

 

Unsupported functions are replaced with stub functions always returning false.

Full source texts of the WinPCap to PSSDK migration module can be downloaded from here.

Archive contents

_libpcap-0.9.8

Source texts of the original libpcap-0.9.8 from www.tcpdump.org.

_libpcap-0.9.8-libs

Compiled libpcap-0.9.8.

_pssdk-4.0-libs

Import library for pssdk.dll and PSSDK static libraries.

_pssdk_wrapper

WinPCap to PSSDK migration module 4.0 source texts.

_pssdk_wrapper-libs

Compiled static libraries and WinPCap to PSSDK migration module 4.0 DLL library.

_wpcap-4.1.beta2

Source texts of wpcap library from WinPCap 4.1.beta2. (libpcap + Win32 extensions of WinPCap).

_wpcap-4.1.beta2-libs

Compiled static libraries of wpcap-4.1.beta2.

WinPCap Examples

Source texts and compiled applications samples from WinPCap 4.1.beta2.