Main Page | Modules | Data Structures | File List | Data Fields | Globals | Related Pages

# Packet Driver API developer's manual
[WinPcap internals]

## Modules
group | Packet.dll definitions and data structures
group | Packet.dll exported functions and variables
| Opens an adapter using the DAG capture API.

group | Packet.dll samples

## Detailed Description

`Packet.dll` is a dynamic link library that offers a set of low level functions to:

- install, start and stop the NPF device driver
- sniff the network traffic
- send packets to the network
- obtain the list of the available network adapters
- retrieve various information about an adapter, like the description and the list of addresses and netmasks
- query and set various low-level parameters of an adapter

There are two versions of packet.dll: the first one works in Windows 95/98/ME, the second in Windows NT/2000/XP.

Packet.dll was born to provide a layer granting access the low level functionalities of WinPcap in a system independent way. This library copes with the system dependent details (like managing the devices, interacting with the OS to handle the adapters, looking for the information in the registry and so on), and export an API that is the same on the different Win32 OSes. In this way, applications or libraries that use it can run without being recompiled under any Win32 operating system.

However, currently this portability does not apply to the whole packet.dll API: some of the most recent features, like for example kernel-mode dump, are present only in the WinNTx version of WinPcap, therefore packet.dll for Win9x does not export them. On the other side, the NTx version is a superset of the 9x one, in other words all the function present in the Win9x version are present also in WinNTx.

The other important role of this library is the handling of the NPF driver. Packet.dll transparently installs and starts the driver when an application attempts to access an adapter. This avoids the manual installation of the driver through the control panel.

## Important note, read carefully!

If you are writing a capture application and you do not have particular/low level requirements, you are recommended to use the functions of wpcap, that are compatible with the ones of the Unix packet capture library (libpcap), instead of the API described in this chapter. wpcap.dll relies on packet.dll, but provides a more powerful, immediate and easy to use programming environment. With wpcap.dll, operations like capturing a packet, creating a capture filter or saving a dump on a file are safely implemented and intuitive to use. Moreover, the programs written to use libpcap are easily compiled on Unix thanks to the compatibility between Win32 and Unix versions of this library.

As a consequence, since the normal and suggested way for an application to use WinPcap is through wpcap.dll, we cannot guarantee that the packet.dll API will not be changed in the future releases.

However, since libpcap was written to be portable and to offer a system-independent capture API, it cannot exploit all the features offered by the driver. Use packet.dll only if you need one of these features.

documentation. Copyright (c) 2002-2003 Politecnico di Torino. All rights reserved.