Winpcap Internals
|
Modules |
|
NPF driver internals Manual |
|
How to compile Winpcap |
|
Packet. dll -- Packet driver API |
Detailed description
This portion of the Manual describes the internal structure and interfaces of Winpcap, starting from the lowest-level module. It is targeted at people that must extend or modify this software,
Or to the ones interested in how it works. Therefore, developers who just want to use Winpcap in their software don't need to read it.
Winpcap Structure
Quoted from the home page of Winpcap:
Winpcap is an architecture for packet capture and Network Analysis for the Win32 platforms. it provides des a kernel-level packet filter, a low-level dynamic link library (packet. DLL), and a high-level
And system-independent Library (wpcap. dll ).
Why we use the term "architecture" rather than "library "? Because packet capture is a low level mechanic that requires a strict interaction with the network adapter and with the operating system,
In particle with its networking implementation, so a simple library is not sufficient.
The following figure shows the varous components of Winpcap:
Main Components of Winpcap.
First, a capture system needs to bypass the operating systems's protocol stack in order to access the raw data transiting on the network. This requires a portion running inside the kernel of OS,
Interacting directly with the network interface drivers. this portion is very system dependent, and in our solution it is realized as a device driver, called netgroup packet filter (NPF); we provide different versions of the driver for Windows 95, Windows
98, Windows ME, Windows NT 4, Windows 2000 and Windows XP. these drivers offer both basic features like packet capture and injection, as well as more advanced ones like a programmable filtering system and a monitoring engine. the first one can be used to restrict
A capture session to a subset of the network traffic (e.g. it is possible to capture only the FTP traffic generated by a participant host), the second one provides a powerful but simple to use mechanisms to obtain statistics on the traffic (e.g. it is possible
To obtain the network load or the amount of data exchanged between two hosts ).
Second, the capture system must export an interface that user-level applications will use to take advantage of the features provided by the kernel driver. Winpcap provides two different libraries:Packet. dllAndWpcap. dll.
The first one offers a low-level API that can be used to directly access the functions of the driver, with a programming interface independent from the Microsoft OS.
The second one exports a more powerful set of high level capture primitives that are compatible with Libpcap, the well known UNIX capture library. These functions enable packet capture in a manner
That is independent of the underlying network hardware and operating system.
Throughout this documentation we will refer toPacket driver APIOrPacket. dllAs the first set of functions, whereasWpcap,Wpcap. dllOrLibpcapWill
Refer to the second one.