This Manual describes the programming interface and the source code of WinPcap. It provides detailed descriptions of the functions and structures exported to programmers, along with complete documentation of the WinPcap internals. Several tutorials and examples are provided as well.
You can follow the links at the top of this page or use the tree control at the left to reach sections of interest.
This documentation was created using the Doxygen documentation system, that can be found at http://www.doxygen.org.
WinPcap is an open source library for packet capture and network analysis for the Win32 platforms.
Most networking applications access the network through widely used operating system primitives such as sockets. It is easy to access data on the network with this approach since the operating system copes with the low level details (protocol handling, packet reassembly, etc.) and provides a familiar interface that is similar to the one used to read and write files.
Sometimes, however, the 'easy way' is not up to the task, since some applications require direct access to packets on the network. That is, they need access to the "raw" data on the network without the interposition of protocol processing by the operating system.
The purpose of WinPcap is to give this kind of access to Win32 applications; it provides facilities to:
This set of capabilities is obtained by means of a device driver, that is installed inside the networking portion of Win32 kernels, plus a couple of DLLs.
All these features are exported through a powerful programming interface, easily exploitable by the applications and available on different OSes. The main goal of this manual is to document this interface, with the help of several examples. If you are interested in starting your exploration right away you can go directly to the WinPcap user's manual.
The WinPcap programming interface can be used by many types of network tools for analysis, troubleshooting, security and monitoring. In particular, classical tools that rely on WinPcap are:
WinPcap receives and sends the packets independently from the host protocols, like TCP-IP. This means that it isn't able to block, filter or manipulate the traffic generated by other programs on the same machine: it simply "sniffs" the packets that transit on the wire. Therefore, it does not provide the appropriate support for applications like traffic shapers, QoS schedulers and personal firewalls.
The purpose of this manual is to provide a comprehensive and easy way to browse the documentation of the WinPcap architecture. You will find two main sections: WinPcap user's manual and WinPcap Internals.
The first one can be used by a programmer who needs to exploit WinPcap from an application: it contains all the information about functions and data structures exported by the WinPcap API, a manual that explains how to write packet filters and a page that explains how to include it in an application. A tutorial with several code samples is provided as well; it can be used to learn the basics of the WinPcap API using a step-by-step approach, but it also offers code snippets that demonstrate advanced features.
The second section is intended for WinPcap developers and maintainers, or for people who are curious about how this system works: it provides a general description of the WinPcap architecture and explains how it works. Additionally, it documents the complete device driver structure, the source code, the packet.dll interface and the low-level WinPcap API. If you want to understand what happens inside WinPcap or if you need to extend it, this is the section you will want to read.
For additional and up-to-date documentation, we suggest that you look at http://www.winpcap.org/docs/
In particular, if you are interested in the structure and the internals of WinPcap, we suggest reading the following documents:
Our development and documentation efforts focus primarily on the Windows NT/2000/XP/2003 version of WinPcap. This choice is based on the fact that the majority of the WinPcap users work on NTx systems, but also because the 9x technology has been abandoned by Microsoft. Moreover, we assume that a person who needs to use a PC for an advanced task like network analysis will install an advanced OS on the machine. For this reason, the documentation will refer to the WinNTx drivers and APIs. Win9x versions are very similar in the concept but sometimes differ in the implementation and, occasionally, the Win9x version of the API lacks some of the more advanced functionality. This manual describes the complete API and will indicate when a function is present only in Windows NTx.
documentation. Copyright (c) 2002-2005 Politecnico di Torino. Copyright (c) 2005-2008 CACE Technologies. All rights reserved.