Functions | |
PCHAR | PacketGetVersion () |
Return a string with the dll version. | |
PCHAR | PacketGetDriverVersion () |
Return a string with the version of the NPF.sys device driver. | |
BOOL | PacketStopDriver () |
Stops and unloads the WinPcap device driver. | |
LPADAPTER | PacketOpenAdapter (PCHAR AdapterName) |
Opens an adapter. | |
VOID | PacketCloseAdapter (LPADAPTER lpAdapter) |
Closes an adapter. | |
LPPACKET | PacketAllocatePacket (void) |
Allocates a _PACKET structure. | |
VOID | PacketFreePacket (LPPACKET lpPacket) |
Frees a _PACKET structure. | |
VOID | PacketInitPacket (LPPACKET lpPacket, PVOID Buffer, UINT Length) |
Initializes a _PACKET structure. | |
BOOLEAN | PacketReceivePacket (LPADAPTER AdapterObject, LPPACKET lpPacket, BOOLEAN Sync) |
Read data (packets or statistics) from the NPF driver. | |
BOOLEAN | PacketSendPacket (LPADAPTER AdapterObject, LPPACKET lpPacket, BOOLEAN Sync) |
Sends one (or more) copies of a packet to the network. | |
INT | PacketSendPackets (LPADAPTER AdapterObject, PVOID PacketBuff, ULONG Size, BOOLEAN Sync) |
Sends a buffer of packets to the network. | |
BOOLEAN | PacketSetMinToCopy (LPADAPTER AdapterObject, int nbytes) |
Defines the minimum amount of data that will be received in a read. | |
BOOLEAN | PacketSetMode (LPADAPTER AdapterObject, int mode) |
Sets the working mode of an adapter. | |
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. | |
BOOLEAN | PacketSetDumpLimits (LPADAPTER AdapterObject, UINT maxfilesize, UINT maxnpacks) |
Set the dump mode limits. | |
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. | |
HANDLE | PacketGetReadEvent (LPADAPTER AdapterObject) |
Returns the notification event associated with the read calls on an adapter. | |
BOOLEAN | PacketSetNumWrites (LPADAPTER AdapterObject, int nwrites) |
Sets the number of times a single packet written with PacketSendPacket() will be repeated on the network. | |
BOOLEAN | PacketSetReadTimeout (LPADAPTER AdapterObject, int timeout) |
Sets the timeout after which a read on an adapter returns. | |
BOOLEAN | PacketSetBuff (LPADAPTER AdapterObject, int dim) |
Sets the size of the kernel-level buffer associated with a capture. | |
BOOLEAN | PacketSetBpf (LPADAPTER AdapterObject, struct bpf_program *fp) |
Sets a kernel-level packet filter. | |
INT | PacketSetSnapLen (LPADAPTER AdapterObject, int snaplen) |
Sets the snap len on the adapters that allow it. | |
BOOLEAN | PacketGetStats (LPADAPTER AdapterObject, struct bpf_stat *s) |
Returns a couple of statistic values about the current capture session. | |
BOOLEAN | PacketGetStatsEx (LPADAPTER AdapterObject, struct bpf_stat *s) |
Returns statistic values about the current capture session. Enhanced version of PacketGetStats(). | |
BOOLEAN | PacketRequest (LPADAPTER AdapterObject, BOOLEAN Set, PPACKET_OID_DATA OidData) |
Performs a query/set operation on an internal variable of the network card driver. | |
BOOLEAN | PacketSetHwFilter (LPADAPTER AdapterObject, ULONG Filter) |
Sets a hardware filter on the incoming packets. | |
BOOLEAN | PacketGetAdapterNames (PTSTR pStr, PULONG BufferSize) |
Retrieve the list of available network adapters and their description. | |
BOOLEAN | PacketGetNetInfoEx (PCHAR AdapterName, npf_if_addr *buffer, PLONG NEntries) |
Returns comprehensive information the addresses of an adapter. | |
BOOLEAN | PacketGetNetType (LPADAPTER AdapterObject, NetType *type) |
Returns information about the MAC type of an adapter. |
|
Allocates a _PACKET structure.
Definition at line 1141 of file Packet32.c. Referenced by main(), pcap_open_live(), and pcap_sendpacket(). |
|
Closes an adapter.
Definition at line 1099 of file Packet32.c. References _ADAPTER::Flags, _ADAPTER::hFile, INFO_FLAG_DAG_CARD, INFO_FLAG_DAG_FILE, _ADAPTER::Name, PacketUpdateAdInfo(), _ADAPTER::pWanAdapter, and _ADAPTER::ReadEvent. Referenced by main(), pcap_close_win32(), and pcap_open_live(). |
|
Frees a _PACKET structure.
Definition at line 1162 of file Packet32.c. Referenced by main(), pcap_close_win32(), and pcap_sendpacket(). |
|
Retrieve the list of available network adapters and their description.
After a call to PacketGetAdapterNames pStr contains, in succession:
Definition at line 2028 of file Packet32.c. References AdaptersInfoList, AdaptersInfoMutex, _ADAPTER_INFO::Description, _ADAPTER_INFO::Name, _ADAPTER_INFO::Next, ODS, ODSEx, and PacketPopulateAdaptersInfoList(). Referenced by main(), and pcap_lookupdev(). |
|
Return a string with the version of the NPF.sys device driver.
Definition at line 897 of file Packet32.c. References PacketDriverVersion. |
|
Returns comprehensive information the addresses of an adapter.
Definition at line 2113 of file Packet32.c. References AdaptersInfoMutex, _ADAPTER_INFO::NetworkAddresses, _ADAPTER_INFO::NNetworkAddresses, ODS, PacketFindAdInfo(), PacketUpdateAdInfo(), and WChar2SChar(). Referenced by pcap_lookupnet(). |
|
Returns information about the MAC type of an adapter.
Definition at line 2184 of file Packet32.c. References AdaptersInfoMutex, _ADAPTER_INFO::LinkLayer, _ADAPTER::Name, ODS, and PacketFindAdInfo(). Referenced by pcap_open_live(). |
|
Returns the notification event associated with the read calls on an adapter.
In every case, a call to PacketReceivePacket() will return immediately. The event can be passed to standard Win32 functions (like WaitForSingleObject or WaitForMultipleObjects) to wait until the driver's buffer contains some data. It is particularly useful in GUI applications that need to wait concurrently on several events. Definition at line 1634 of file Packet32.c. References _ADAPTER::ReadEvent. Referenced by pcap_getevent(). |
|
Returns a couple of statistic values about the current capture session.
Definition at line 1827 of file Packet32.c. References bpf_stat::bs_drop, bpf_stat::bs_recv, _ADAPTER::Flags, _ADAPTER::hFile, INFO_FLAG_DAG_CARD, pBIOCGSTATS, and _ADAPTER::pWanAdapter. Referenced by main(), and pcap_stats_win32(). |
|
Returns statistic values about the current capture session. Enhanced version of PacketGetStats().
Definition at line 1889 of file Packet32.c. References bpf_stat::bs_capt, bpf_stat::bs_drop, bpf_stat::bs_recv, _ADAPTER::Flags, _ADAPTER::hFile, INFO_FLAG_DAG_CARD, pBIOCGSTATS, bpf_stat::ps_ifdrop, and _ADAPTER::pWanAdapter. Referenced by pcap_stats_ex(). |
|
Return a string with the dll version.
Definition at line 888 of file Packet32.c. References PacketLibraryVersion. Referenced by main(), and pcap_lib_version(). |
|
Initializes a _PACKET structure.
Definition at line 1184 of file Packet32.c. References _PACKET::bIoComplete, _PACKET::Buffer, _PACKET::Length, and _PACKET::ulBytesReceived. Referenced by main(), pcap_open_live(), pcap_sendpacket(), and pcap_setuserbuffer(). |
|
Returns the status of the kernel dump process, i.e. tells if one of the limits defined with PacketSetDumpLimits() was reached.
Definition at line 1584 of file Packet32.c. References _ADAPTER::Flags, _ADAPTER::hFile, INFO_FLAG_NDIS_ADAPTER, ODS, pBIOCISDUMPENDED, and _ADAPTER::ReadEvent. Referenced by pcap_live_dump_ended(). |
|
Opens an adapter.
Definition at line 956 of file Packet32.c. References ADAPTER_NAME_LENGTH, AdaptersInfoMutex, _ADAPTER::Flags, _ADAPTER_INFO::Flags, INFO_FLAG_DAG_CARD, INFO_FLAG_NDIS_ADAPTER, INFO_FLAG_NDISWAN_ADAPTER, _ADAPTER::Name, ODSEx, PacketFindAdInfo(), PacketOpenAdapterNPF(), PacketUpdateAdInfo(), _ADAPTER::pWanAdapter, _ADAPTER::ReadEvent, SChar2WChar(), and WChar2SChar(). Referenced by main(), and pcap_open_live(). |
|
Read data (packets or statistics) from the NPF driver.
The number of packets received with this function is variable. It depends on the number of packets currently stored in the driver’s buffer, on the size of these packets and on the size of the buffer associated to the lpPacket parameter. The following figure shows the format used by the driver to pass packets to the application.
![]() method used to encode the packets Examples can be seen either in the TestApp sample application (see the Packet.dll samples page) provided in the developer's pack, or in the pcap_read() function of wpcap. Definition at line 1223 of file Packet32.c. References _PACKET::Buffer, _ADAPTER::hFile, _PACKET::Length, _ADAPTER::pWanAdapter, _ADAPTER::ReadEvent, _ADAPTER::ReadTimeOut, and _PACKET::ulBytesReceived. Referenced by main(), and pcap_read_win32(). |
|
Performs a query/set operation on an internal variable of the network card driver.
Definition at line 1944 of file Packet32.c. References _ADAPTER::Flags, _ADAPTER::hFile, INFO_FLAG_NDIS_ADAPTER, ODSEx, pBIOCQUERYOID, and pBIOCSETOID. Referenced by PacketSetHwFilter(), and PacketSetMaxLookaheadsize(). |
|
Sends one (or more) copies of a packet to the network.
The behavior of this function is influenced by the PacketSetNumWrites() function. With PacketSetNumWrites(), it is possible to change the number of times a single write must be repeated. The default is 1, i.e. every call to PacketSendPacket() will correspond to one packet sent to the network. If this number is greater than 1, for example 1000, every raw packet written by the application will be sent 1000 times on the network. This feature mitigates the overhead of the context switches and therefore can be used to generate high speed traffic. It is particularly useful for tools that test networks, routers, and servers and need to obtain high network loads. The optimized sending process is still limited to one packet at a time: for the moment it cannot be used to send a buffer with multiple packets.
Definition at line 1286 of file Packet32.c. References _PACKET::Buffer, _ADAPTER::Flags, _ADAPTER::hFile, INFO_FLAG_NDIS_ADAPTER, _PACKET::Length, and ODS. Referenced by main(), and pcap_sendpacket(). |
|
Sends a buffer of packets to the network.
Definition at line 1330 of file Packet32.c. References _ADAPTER::Flags, _ADAPTER::hFile, INFO_FLAG_NDIS_ADAPTER, and ODS. Referenced by pcap_sendqueue_transmit(). |
|
Sets a kernel-level packet filter.
A filter can be automatically created by using the pcap_compile() function of wpcap. This function converts a human readable text expression with the syntax of WinDump (see the manual of WinDump at http://netgroup.polito.it/windump for details) into a BPF program. If your program doesn't link wpcap, but you need to know the code of a particular filter, you can launch WinDump with the -d or -dd or -ddd flags to obtain the pseudocode. Definition at line 1771 of file Packet32.c. References bpf_program::bf_insns, bpf_program::bf_len, _ADAPTER::Flags, _ADAPTER::hFile, INFO_FLAG_DAG_CARD, pBIOCSETF, and _ADAPTER::pWanAdapter. Referenced by pcap_setfilter_win32(). |
|
Sets the size of the kernel-level buffer associated with a capture.
Note: the dimension of the kernel buffer affects heavily the performances of the capture process. An adequate buffer in the driver is able to keep the packets while the application is busy, compensating the delays of the application and avoiding the loss of packets during bursts or high network activity. The buffer size is set to 0 when an instance of the driver is opened: the programmer should remember to set it to a proper value. As an example, wpcap sets the buffer size to 1MB at the beginning of a capture. Definition at line 1733 of file Packet32.c. References _ADAPTER::Flags, _ADAPTER::hFile, INFO_FLAG_DAG_CARD, pBIOCSETBUFFERSIZE, and _ADAPTER::pWanAdapter. Referenced by main(), pcap_open_live(), and pcap_setbuff(). |
|
Set the dump mode limits.
Definition at line 1545 of file Packet32.c. References _ADAPTER::Flags, _ADAPTER::hFile, INFO_FLAG_NDIS_ADAPTER, ODS, and pBIOCSETDUMPLIMITS. Referenced by pcap_live_dump(). |
|
Sets the name of the file that will receive the packet when the adapter is in dump mode.
Definition at line 1490 of file Packet32.c. References _ADAPTER::Flags, _ADAPTER::hFile, INFO_FLAG_NDIS_ADAPTER, ODS, pBIOCSETDUMPFILENAME, and SChar2WChar(). Referenced by pcap_live_dump(). |
|
Sets a hardware filter on the incoming packets.
Definition at line 1983 of file Packet32.c. References _ADAPTER::Flags, INFO_FLAG_NDIS_ADAPTER, ODS, PacketRequest(), and PPACKET_OID_DATA. Referenced by main(), and pcap_open_live(). |
|
Defines the minimum amount of data that will be received in a read.
note: this function has effect only in Windows NTx. The driver for Windows 9x doesn't offer this possibility, therefore PacketSetMinToCopy is implemented under these systems only for compatibility. Definition at line 1410 of file Packet32.c. References _ADAPTER::Flags, _ADAPTER::hFile, INFO_FLAG_DAG_CARD, INFO_FLAG_NDISWAN_ADAPTER, pBIOCSMINTOCOPY, and _ADAPTER::pWanAdapter. Referenced by pcap_open_live(), and pcap_setmintocopy(). |
|
Sets the working mode of an adapter.
Definition at line 1464 of file Packet32.c. References _ADAPTER::hFile, pBIOCSMODE, and _ADAPTER::pWanAdapter. Referenced by pcap_live_dump(), and pcap_setmode(). |
|
Sets the number of times a single packet written with PacketSendPacket() will be repeated on the network.
Definition at line 1647 of file Packet32.c. References _ADAPTER::Flags, _ADAPTER::hFile, INFO_FLAG_NDIS_ADAPTER, ODS, and pBIOCSWRITEREP. Referenced by main(). |
|
Sets the timeout after which a read on an adapter returns.
Definition at line 1674 of file Packet32.c. References _ADAPTER::Flags, _ADAPTER::hFile, INFO_FLAG_DAG_CARD, pBIOCSRTIMEOUT, _ADAPTER::pWanAdapter, and _ADAPTER::ReadTimeOut. Referenced by main(), pcap_open_live(), and pcap_setnonblock_win32(). |
|
Sets the snap len on the adapters that allow it.
Definition at line 1803 of file Packet32.c. References _ADAPTER::Flags, and INFO_FLAG_DAG_CARD. |
|
Stops and unloads the WinPcap device driver.
Definition at line 910 of file Packet32.c. References NPFServiceName, and scmHandle. |
documentation. Copyright (c) 2002-2003 Politecnico di Torino. All rights reserved.