#include <packet32.h>
#include <windows.h>
#include <windowsx.h>
#include <ntddndis.h>
#include <stdio.h>
Go to the source code of this file.
Defines | |
#define | UNICODE 1 |
#define | ODS(_x) |
Macro to print a debug string. The behavior differs depending on the debug level. More... | |
#define | ODSEx(_x, _y) |
Macro to print debug data with the printf convention. The behavior differs depending on the debug level. More... | |
Functions | |
LONG | PacketDumpRegistryKey (PCHAR KeyName, PCHAR FileName) |
Dumps a registry key to disk in text format. Uses regedit. More... | |
BOOL APIENTRY | DllMain (HANDLE DllHandle, DWORD Reason, LPVOID lpReserved) |
The main dll function. More... | |
WCHAR * | SChar2WChar (char *string) |
Converts an ASCII string to UNICODE. Uses the MultiByteToWideChar() system function. More... | |
BOOLEAN | PacketSetMaxLookaheadsize (LPADAPTER AdapterObject) |
Sets the maximum possible lookahead buffer for the driver's Packet_tap() function. More... | |
BOOLEAN | PacketSetReadEvt (LPADAPTER AdapterObject) |
Retrieves the event associated in the driver with a capture instance and stores it in an _ADAPTER structure. More... | |
BOOL | PacketInstallDriver (SC_HANDLE ascmHandle, SC_HANDLE *srvHandle, TCHAR *driverPath) |
Installs the NPF device driver. More... | |
ULONG | inet_addrU (const WCHAR *cp) |
Convert a Unicode dotted-quad to a 32-bit IP address. More... | |
PCHAR | PacketGetVersion () |
Returns a string with the dll version. More... | |
BOOLEAN | PacketGetNetType (LPADAPTER AdapterObject, NetType *type) |
Returns information about the MAC type of an adapter. More... | |
BOOL | PacketStopDriver () |
Stops and unloads the WinPcap device driver. More... | |
LPADAPTER | PacketOpenAdapter (LPTSTR AdapterName) |
Opens an adapter. More... | |
VOID | PacketCloseAdapter (LPADAPTER lpAdapter) |
Closes an adapter. More... | |
LPPACKET | PacketAllocatePacket (void) |
Allocates a _PACKET structure. More... | |
VOID | PacketFreePacket (LPPACKET lpPacket) |
Frees a _PACKET structure. More... | |
VOID | PacketInitPacket (LPPACKET lpPacket, PVOID Buffer, UINT Length) |
Initializes a _PACKET structure. More... | |
BOOLEAN | PacketReceivePacket (LPADAPTER AdapterObject, LPPACKET lpPacket, BOOLEAN Sync) |
Read data (packets or statistics) from the NPF driver. More... | |
BOOLEAN | PacketSendPacket (LPADAPTER AdapterObject, LPPACKET lpPacket, BOOLEAN Sync) |
Sends one (or more) copies of a packet to the network. More... | |
INT | PacketSendPackets (LPADAPTER AdapterObject, PVOID PacketBuff, ULONG Size, BOOLEAN Sync) |
Sends a buffer of packets to the network. More... | |
BOOLEAN | PacketSetMinToCopy (LPADAPTER AdapterObject, int nbytes) |
Defines the minimum amount of data that will be received in a read. More... | |
BOOLEAN | PacketSetMode (LPADAPTER AdapterObject, int mode) |
Sets the working mode of an adapter. More... | |
BOOLEAN | PacketSetDumpName (LPADAPTER AdapterObject, void *name, int len) |
Sets the name of the file that will receive the packet when the adapter is in dump mode. More... | |
BOOLEAN | PacketSetDumpLimits (LPADAPTER AdapterObject, UINT maxfilesize, UINT maxnpacks) |
Set the dump mode limits. More... | |
BOOLEAN | PacketIsDumpEnded (LPADAPTER AdapterObject, BOOLEAN sync) |
Returns the status of the kernel dump process, i.e. tells if one of the limits defined with PacketSetDumpLimits() was reached. More... | |
HANDLE | PacketGetReadEvent (LPADAPTER AdapterObject) |
Returns the notification event associated with the read calls on an adapter. More... | |
BOOLEAN | PacketSetNumWrites (LPADAPTER AdapterObject, int nwrites) |
Sets the number of times a single packet written with PacketSendPacket() will be repeated on the network. More... | |
BOOLEAN | PacketSetReadTimeout (LPADAPTER AdapterObject, int timeout) |
Sets the timeout after which a read on an adapter returns. More... | |
BOOLEAN | PacketSetBuff (LPADAPTER AdapterObject, int dim) |
Sets the size of the kernel-level buffer associated with a capture. More... | |
BOOLEAN | PacketSetBpf (LPADAPTER AdapterObject, struct bpf_program *fp) |
Sets a kernel-level packet filter. More... | |
BOOLEAN | PacketGetStats (LPADAPTER AdapterObject, struct bpf_stat *s) |
Returns a couple of statistic values about the current capture session. More... | |
BOOLEAN | PacketGetStatsEx (LPADAPTER AdapterObject, struct bpf_stat *s) |
Returns statistic values about the current capture session. Enhanced version of PacketGetStats(). More... | |
BOOLEAN | PacketRequest (LPADAPTER AdapterObject, BOOLEAN Set, PPACKET_OID_DATA OidData) |
Performs a query/set operation on an internal variable of the network card driver. More... | |
BOOLEAN | PacketSetHwFilter (LPADAPTER AdapterObject, ULONG Filter) |
Sets a hardware filter on the incoming packets. More... | |
BOOLEAN | PacketGetAdapterNames (PTSTR pStr, PULONG BufferSize) |
Retrieve the list of available network adapters and their description. More... | |
BOOLEAN | PacketGetNetInfoEx (LPTSTR AdapterName, npf_if_addr *buffer, PLONG NEntries) |
Returns comprehensive information the addresses of an adapter. More... | |
BOOLEAN | PacketGetNetInfo (LPTSTR AdapterName, PULONG netp, PULONG maskp) |
Returns the IP address and the netmask of an adapter. More... | |
Variables | |
TCHAR | szWindowTitle [] = TEXT("PACKET.DLL") |
Title of error windows. More... | |
SC_HANDLE | scmHandle = NULL |
SC_HANDLE | srvHandle = NULL |
LPCTSTR | NPFServiceName = TEXT("NPF") |
LPCTSTR | NPFServiceDesc = TEXT("Netgroup Packet Filter") |
LPCTSTR | NPFDriverName = TEXT("\\npf.sys") |
LPCTSTR | NPFRegistryLocation = TEXT("SYSTEM\\CurrentControlSet\\Services\\NPF") |
char | PacketLibraryVersion [] = "2.3" |
Current packet.dll Version. It can be retrieved directly or through the PacketGetVersion() function. More... |
|
Value: { \ FILE *f; \ f = fopen("winpcap_debug.txt", "a"); \ fprintf(f, "%s", _x); \ fclose(f); \ }
Definition at line 44 of file Packet32.c. Referenced by DllMain, PacketAllocatePacket, PacketGetAdapterNames, PacketGetNetType, PacketInstallDriver, PacketOpenAdapter, PacketSendPackets, PacketSetHwFilter, PacketSetMaxLookaheadsize, and PacketSetReadEvt. |
|
Value: { \ FILE *f; \ f = fopen("winpcap_debug.txt", "a"); \ fprintf(f, _x, _y); \ fclose(f); \ }
Definition at line 54 of file Packet32.c. Referenced by PacketGetAdapterNames, PacketGetNetType, PacketInstallDriver, PacketOpenAdapter, and PacketRequest. |
|
Definition at line 22 of file Packet32.c. |
|
The main dll function.
Definition at line 83 of file Packet32.c. References ODS, and PacketDumpRegistryKey. |
|
Convert a Unicode dotted-quad to a 32-bit IP address.
Definition at line 274 of file Packet32.c. References val. Referenced by PacketGetNetInfo, and PacketGetNetInfoEx. |
|
Dumps a registry key to disk in text format. Uses regedit.
Definition at line 313 of file Packet32.c. Referenced by DllMain. |
|
Installs the NPF device driver.
Definition at line 224 of file Packet32.c. References NPFServiceDesc, NPFServiceName, ODS, ODSEx, and srvHandle. Referenced by PacketOpenAdapter. |
|
Sets the maximum possible lookahead buffer for the driver's Packet_tap() function.
Definition at line 141 of file Packet32.c. References ODS, PacketRequest, and PPACKET_OID_DATA. Referenced by PacketOpenAdapter. |
|
Retrieves the event associated in the driver with a capture instance and stores it in an _ADAPTER structure.
Definition at line 173 of file Packet32.c. References _ADAPTER::hFile, ODS, pBIOCEVNAME, _ADAPTER::ReadEvent, and _ADAPTER::ReadTimeOut. Referenced by PacketOpenAdapter. |
|
Converts an ASCII string to UNICODE. Uses the MultiByteToWideChar() system function.
Definition at line 122 of file Packet32.c. Referenced by PacketGetNetInfo, PacketGetNetInfoEx, PacketOpenAdapter, and PacketSetDumpName. |
|
Definition at line 73 of file Packet32.c. Referenced by PacketOpenAdapter. |
|
Definition at line 74 of file Packet32.c. Referenced by PacketOpenAdapter. |
|
Definition at line 72 of file Packet32.c. Referenced by PacketInstallDriver. |
|
Definition at line 71 of file Packet32.c. Referenced by PacketInstallDriver, PacketOpenAdapter, and PacketStopDriver. |
|
Definition at line 69 of file Packet32.c. Referenced by PacketOpenAdapter, and PacketStopDriver. |
|
Definition at line 70 of file Packet32.c. Referenced by PacketInstallDriver, and PacketOpenAdapter. |
|
Title of error windows.
Definition at line 33 of file Packet32.c. Referenced by PacketGetAdapterNames. |
documentation. Copyright (c) 2002 Politecnico di Torino. All rights reserved.