9 #if !defined(AIRPCAP_H__EAE405F5_0171_9592_B3C2_C19EC426AD34__INCLUDED_)
10 #define AIRPCAP_H__EAE405F5_0171_9592_B3C2_C19EC426AD34__INCLUDED_
14 #pragma warning( disable : 4996)
55 #define AIRPCAP_DEVICE_NAME_PREFIX "\\\\.\\airpcap"
61 #define AIRPCAP_DEVICE_NUMBER_EXTRACT_STRING "\\\\.\\airpcap%u"
63 #define AIRPCAP_DEVICE_ANY_EXTRACT_STRING "\\\\.\\airpcap_any"
75 #define MAX_ENCRYPTION_KEYS 64
77 #define WEP_KEY_MAX_SIZE 32
87 #define AIRPCAP_KEYTYPE_WEP 0
88 #define AIRPCAP_KEYTYPE_TKIP 1
89 #define AIRPCAP_KEYTYPE_CCMP 2
101 __attribute__((__packed__))
113 AIRPCAP_CB_2_4_GHZ = 2,
114 AIRPCAP_CB_4_GHZ = 4,
124 AIRPCAP_VT_ACCEPT_EVERYTHING = 1,
125 AIRPCAP_VT_ACCEPT_CORRECT_FRAMES = 2,
126 AIRPCAP_VT_ACCEPT_CORRUPT_FRAMES = 3,
127 AIRPCAP_VT_UNKNOWN = 4
137 AIRPCAP_DECRYPTION_ON = 1,
138 AIRPCAP_DECRYPTION_OFF = 2
150 __attribute__((__packed__))
180 #define AirpcapKeysCollectionSize(nKeys) \
181 ((sizeof(AirpcapKeysCollection) - sizeof(AirpcapKey)) + ((nKeys) * sizeof(AirpcapKey)))
182 #define AirpcapKeysCollectionSizeToKeyCount(size) \
183 (unsigned)(((size) - AirpcapKeysCollectionSize(0))/sizeof(AirpcapKey))
195 unsigned Originallen;
199 __attribute__((__packed__))
204 #define AIRPCAP_ALIGNMENT sizeof(int)
205 #define AIRPCAP_WORDALIGN(x) (((x)+(AIRPCAP_ALIGNMENT-1))&~(AIRPCAP_ALIGNMENT-1))
213 #define AIRPCAP_ERRBUF_SIZE 512
215 #ifndef __AIRPCAP_DRIVER__
221 #undef _AirpcapLinkType
224 AIRPCAP_LT_802_11 = 1,
225 AIRPCAP_LT_802_11_PLUS_RADIO = 2,
226 AIRPCAP_LT_UNKNOWN = 3,
227 AIRPCAP_LT_802_11_PLUS_PPI = 4
230 #if !defined(AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_)
231 #define AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_
235 typedef struct _AirpcapHandle
AirpcapHandle, *PAirpcapHandle;
291 void AirpcapGetVersion(
unsigned * VersionMajor,
unsigned * VersionMinor,
unsigned * VersionRev,
unsigned * VersionBuild);
343 PAirpcapHandle
AirpcapOpen(
char * DeviceName,
char * Ebuf);
732 bool AirpcapSetFilter(PAirpcapHandle AdapterHandle,
void * Instructions,
unsigned Len);
787 bool AirpcapRead(PAirpcapHandle AdapterHandle, uint8_t *
Buffer,
unsigned BufSize,
unsigned * PReceievedBytes);
806 bool AirpcapWrite(PAirpcapHandle AdapterHandle,
char * TxPacket, uint32_t PacketLen);
struct _AirpcapChannelInfo AirpcapChannelInfo
Channel information. Used by AirpcapSetDeviceChannelEx(), AirpcapGetDeviceChannelEx(),...
_AirpcapValidationType
Type of frame validation the adapter performs. An adapter can be instructed to accept different kind ...
Definition: airpcap.h:122
struct _AirpcapKey AirpcapKey
WEP key container.
struct _AirpcapHandle AirpcapHandle
Adapter handle.
Definition: airpcap.h:234
enum _AirpcapLinkType AirpcapLinkType
Link type. AirPcap supports two kind of 802.11 linktypes: plain 802.11 and radiotap.
enum _AirpcapDecryptionState AirpcapDecryptionState
Type of decryption the adapter performs. An adapter can be instructed to turn decryption (based on th...
struct _AirpcapStats AirpcapStats
Capture statistics. Returned by AirpcapGetStats();.
struct _AirpcapDeviceDescription AirpcapDeviceDescription
Entry in the list returned by AirpcapGetDeviceList();.
_AirpcapLinkType
Link type. AirPcap supports two kind of 802.11 linktypes: plain 802.11 and radiotap.
Definition: airpcap.h:222
struct _AirpcapKeysCollection AirpcapKeysCollection
This structure is used to store a collection of WEP keys. Note that the definition of the structure h...
struct _AirpcapBpfHeader AirpcapBpfHeader
Packet header.
_AirpcapDecryptionState
Type of decryption the adapter performs. An adapter can be instructed to turn decryption (based on th...
Definition: airpcap.h:135
struct _AirpcapMacAddress AirpcapMacAddress
Storage for a MAC address.
enum _AirpcapValidationType AirpcapValidationType
Type of frame validation the adapter performs. An adapter can be instructed to accept different kind ...
_AirpcapChannelBand
frequency Band. 802.11 adapters can support different frequency bands, the most important of which ar...
Definition: airpcap.h:110
enum _AirpcapChannelBand AirpcapChannelBand
frequency Band. 802.11 adapters can support different frequency bands, the most important of which ar...
bool AirpcapSetDriverDecryptionState(PAirpcapHandle AdapterHandle, AirpcapDecryptionState Enable)
Turns on or off the decryption of the incoming frames with the global driver set of keys.
bool AirpcapGetLinkType(PAirpcapHandle AdapterHandle, PAirpcapLinkType PLinkType)
Get the link type of the specified adapter.
bool AirpcapSetMinToCopy(PAirpcapHandle AdapterHandle, unsigned MinToCopy)
Set the mintocopy parameter for an open adapter.
bool AirpcapRead(PAirpcapHandle AdapterHandle, uint8_t *Buffer, unsigned BufSize, unsigned *PReceievedBytes)
Fills a user-provided buffer with zero or more packets that have been captured on the referenced adap...
bool AirpcapSetLinkType(PAirpcapHandle AdapterHandle, AirpcapLinkType NewLinkType)
Set the link type of an adapter.
bool AirpcapConvertChannelToFrequency(unsigned Channel, unsigned *PFrequency)
Converts a given channel to the corresponding frequency.
int8_t ExtChannel
802.11n specific. Offset of the extension channel in case of 40MHz channels.
Definition: airpcap.h:271
bool AirpcapGetLedsNumber(PAirpcapHandle AdapterHandle, unsigned *NumberOfLeds)
Get the number of LEDs the referenced adapter has available.
bool AirpcapGetMacAddress(PAirpcapHandle AdapterHandle, PAirpcapMacAddress PMacAddress)
Return the MAC address of an adapter.
bool AirpcapGetDecryptionState(PAirpcapHandle AdapterHandle, PAirpcapDecryptionState PEnable)
Tells if this open instance is configured to perform the decryption of the incoming frames with the a...
void AirpcapGetVersion(unsigned *VersionMajor, unsigned *VersionMinor, unsigned *VersionRev, unsigned *VersionBuild)
Return a string with the API version.
void AirpcapFreeDeviceList(PAirpcapDeviceDescription PAllDevs)
Free a list of devices returned by AirpcapGetDeviceList()
bool AirpcapSetDeviceChannelEx(PAirpcapHandle AdapterHandle, AirpcapChannelInfo ChannelInfo)
Set the channel of a device through its radio frequency. In case of 802.11n enabled devices,...
bool AirpcapGetDeviceKeys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, unsigned *PKeysCollectionSize)
Returns the list of decryption keys in the driver that are currently associated with the specified de...
bool AirpcapSetDecryptionState(PAirpcapHandle AdapterHandle, AirpcapDecryptionState Enable)
Turns on or off the decryption of the incoming frames with the adapter-specific keys.
bool AirpcapSetMonitorMode(PAirpcapHandle AdapterHandle, bool MonitorModeEnabled)
Sets the monitor mode for the specified adapter.
bool AirpcapGetKernelBufferSize(PAirpcapHandle AdapterHandle, unsigned *PSizeBytes)
Get the size of the kernel packet buffer for this adapter.
bool AirpcapGetFcsPresence(PAirpcapHandle AdapterHandle, bool *PIsFcsPresent)
Returns true if the specified adapter includes the MAC Frame Check Sequence in the captured packets.
bool AirpcapSetFilter(PAirpcapHandle AdapterHandle, void *Instructions, unsigned Len)
Set the BPF kernel filter for an adapter.
bool AirpcapSetKernelBuffer(PAirpcapHandle AdapterHandle, unsigned BufferSize)
Set the size of the kernel packet buffer for this adapter.
bool AirpcapGetFcsValidation(PAirpcapHandle AdapterHandle, PAirpcapValidationType ValidationType)
Checks if the specified adapter is configured to capture frames with incorrect an incorrect Frame Che...
void AirpcapClose(PAirpcapHandle AdapterHandle)
Close an adapter.
bool AirpcapWrite(PAirpcapHandle AdapterHandle, char *TxPacket, uint32_t PacketLen)
Transmits a packet.
bool AirpcapGetDeviceSupportedChannels(PAirpcapHandle AdapterHandle, PAirpcapChannelInfo *ppChannelInfo, unsigned *pNumChannelInfo)
Get the list of supported channels for a given device. In case of a 802.11n capable device,...
bool AirpcapGetDeviceChannelEx(PAirpcapHandle AdapterHandle, PAirpcapChannelInfo PChannelInfo)
Get the channel of a device through its radiofrequency. In case of 802.11n enabled devices,...
bool AirpcapSetDeviceChannel(PAirpcapHandle AdapterHandle, unsigned Channel)
Set the radio channel of a device.
bool AirpcapSetFcsValidation(PAirpcapHandle AdapterHandle, AirpcapValidationType ValidationType)
Configures the adapter to accept or drop frames with an incorrect Frame Check sequence (FCS).
PAirpcapHandle AirpcapOpen(char *DeviceName, char *Ebuf)
Open an adapter.
bool AirpcapSetDeviceKeys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection)
Set the list of decryption keys that the driver is going to use with the specified device.
bool AirpcapGetDeviceChannel(PAirpcapHandle AdapterHandle, unsigned *PChannel)
Get the radio channel of a device.
bool AirpcapGetMonitorMode(PAirpcapHandle AdapterHandle, bool *PMonitorModeEnabled)
Returns true if the specified adapter is in monitor mode.
bool AirpcapConvertFrequencyToChannel(unsigned Frequency, unsigned *PChannel, PAirpcapChannelBand PBand)
Converts a given frequency to the corresponding channel.
bool AirpcapSetFcsPresence(PAirpcapHandle AdapterHandle, bool IsFcsPresent)
Configures the adapter on whether to include the MAC Frame Check Sequence in the captured packets.
bool AirpcapGetDriverKeys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, unsigned *PKeysCollectionSize)
Returns the global list of decryption keys in the driver that are associated with all the devices.
bool AirpcapTurnLedOff(PAirpcapHandle AdapterHandle, unsigned LedNumber)
Turn off one of the adapter's LEDs.
bool AirpcapStoreCurConfigAsAdapterDefault(PAirpcapHandle AdapterHandle)
Saves the configuration of the specified adapter in the registry, so that it becomes the default for ...
bool AirpcapTurnLedOn(PAirpcapHandle AdapterHandle, unsigned LedNumber)
Turn on one of the adapter's LEDs.
bool AirpcapGetDeviceList(PAirpcapDeviceDescription *PPAllDevs, char *Ebuf)
Return the list of available devices.
char * AirpcapGetLastError(PAirpcapHandle AdapterHandle)
Return the last error related to the specified handle.
bool AirpcapGetReadEvent(PAirpcapHandle AdapterHandle, void ***PReadEvent)
Gets an event that is signaled when that is signalled when packets are available in the kernel buffer...
bool AirpcapGetDriverDecryptionState(PAirpcapHandle AdapterHandle, PAirpcapDecryptionState PEnable)
Tells if this open instance is configured to perform the decryption of the incoming frames with the g...
bool AirpcapSetDriverKeys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection)
Set the global list of decryption keys that the driver is going to use with all the devices.
bool AirpcapGetStats(PAirpcapHandle AdapterHandle, PAirpcapStats PStats)
Get per-adapter WinPcap-compatible capture statistics.
Channel information. Used by AirpcapSetDeviceChannelEx(), AirpcapGetDeviceChannelEx(),...
Definition: airpcap.h:259
Entry in the list returned by AirpcapGetDeviceList();.
Definition: airpcap.h:69
WEP key container.
Definition: airpcap.h:94
This structure is used to store a collection of WEP keys. Note that the definition of the structure h...
Definition: airpcap.h:174
Storage for a MAC address.
Definition: airpcap.h:145
Capture statistics. Returned by AirpcapGetStats();.
Definition: airpcap.h:242
#define WEP_KEY_MAX_SIZE
Definition: wep-wpadefs.h:33