#define ADAPTER_NAME_LENGTH 256 + 12 ///< Maximum length for the name of an adapter. The value is the same used by the IP Helper API.
#define ADAPTER_DESC_LENGTH 128 ///< Maximum length for the description of an adapter. The value is the same used by the IP Helper API.
#define MAX_MAC_ADDR_LENGTH 8 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API.
#define MAX_NETWORK_ADDRESSES 16 ///< Maximum length for the link layer address of an adapter. The value is the same used by the IP Helper API.
typedefstructWAN_ADAPTER_INTWAN_ADAPTER;///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API
typedefWAN_ADAPTER*PWAN_ADAPTER;///< Describes an opened wan (dialup, VPN...) network adapter using the NetMon API
#define INFO_FLAG_NDIS_ADAPTER 0 ///< Flag for ADAPTER_INFO: this is a traditional ndis adapter
#define INFO_FLAG_NDISWAN_ADAPTER 1 ///< Flag for ADAPTER_INFO: this is a NdisWan adapter, and it's managed by WANPACKET
#define INFO_FLAG_DAG_CARD 2 ///< Flag for ADAPTER_INFO: this is a DAG card
#define INFO_FLAG_DAG_FILE 6 ///< Flag for ADAPTER_INFO: this is a DAG file
#define INFO_FLAG_DONT_EXPORT 8 ///< Flag for ADAPTER_INFO: when this flag is set, the adapter will not be listed or openend by winpcap. This allows to prevent exporting broken network adapters, like for example FireWire ones.
#define INFO_FLAG_AIRPCAP_CARD 16 ///< Flag for ADAPTER_INFO: this is an airpcap card
#define INFO_FLAG_NPFIM_DEVICE 32
/*!
\brief Describes an opened network adapter.
This structure is the most important for the functioning of packet.dll, but the great part of its fields
should be ignored by the user, since the library offers functions that avoid to cope with low-level parameters
*/
typedefstruct_ADAPTER{
HANDLEhFile;///< \internal Handle to an open instance of the NPF driver.
CHARSymbolicLink[MAX_LINK_NAME_LENGTH];///< \internal A string containing the name of the network adapter currently opened.
intNumWrites;///< \internal Number of times a packets written on this adapter will be repeated
///< on the wire.
HANDLEReadEvent;///< A notification event associated with the read calls on the adapter.
///< It 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. In Windows NT/2000 the PacketSetMinToCopy()
///< function can be used to define the minimum amount of data in the kernel buffer
///< that will cause the event to be signalled.
UINTReadTimeOut;///< \internal The amount of time after which a read on the driver will be released and
///< ReadEvent will be signaled, also if no packets were captured
CHARName[ADAPTER_NAME_LENGTH];
PWAN_ADAPTERpWanAdapter;
UINTFlags;///< Adapter's flags. Tell if this adapter must be treated in a different way, using the Netmon API or the dagc API.
#ifdef HAVE_AIRPCAP_API
PAirpcapHandleAirpcapAd;
#endif // HAVE_AIRPCAP_API
#ifdef HAVE_NPFIM_API
void*NpfImHandle;
#endif // HAVE_NPFIM_API
#ifdef HAVE_DAG_API
dagc_t*pDagCard;///< Pointer to the dagc API adapter descriptor for this adapter
PCHARDagBuffer;///< Pointer to the buffer with the packets that is received from the DAG card
structtimevalDagReadTimeout;///< Read timeout. The dagc API requires a timeval structure
unsignedDagFcsLen;///< Length of the frame check sequence attached to any packet by the card. Obtained from the registry
DWORDDagFastProcess;///< True if the user requests fast capture processing on this card. Higher level applications can use this value to provide a faster but possibly unprecise capture (for example, libpcap doesn't convert the timestamps).
#endif // HAVE_DAG_API
}ADAPTER,*LPADAPTER;
/*!
\brief Structure that contains a group of packets coming from the driver.
This structure defines the header associated with every packet delivered to the application.
*/
typedefstruct_PACKET{
HANDLEhEvent;///< \deprecated Still present for compatibility with old applications.
OVERLAPPEDOverLapped;///< \deprecated Still present for compatibility with old applications.
PVOIDBuffer;///< Buffer with containing the packets. See the PacketReceivePacket() for
///< details about the organization of the data in this buffer
UINTLength;///< Length of the buffer
DWORDulBytesReceived;///< Number of valid bytes present in the buffer, i.e. amount of data
///< received by the last call to PacketReceivePacket()
BOOLEANbIoComplete;///< \deprecated Still present for compatibility with old applications.
}PACKET,*LPPACKET;
/*!
\brief Structure containing an OID request.
It is used by the PacketRequest() function to send an OID to the interface card driver.
It can be used, for example, to retrieve the status of the error counters on the adapter, its MAC address,
the list of the multicast groups defined on it, and so on.
*/
struct_PACKET_OID_DATA{
ULONGOid;///< OID code. See the Microsoft DDK documentation or the file ntddndis.h
///< for a complete list of valid codes.
ULONGLength;///< Length of the data field
UCHARData[1];///< variable-lenght field that contains the information passed to or received