Wireshark  4.3.0
The Wireshark network protocol analyzer
Classes | Macros | Typedefs | Enumerations | Functions
airpcap.h File Reference

Go to the source code of this file.

Classes

struct  _AirpcapDeviceDescription
 Entry in the list returned by AirpcapGetDeviceList();. More...
 
struct  _AirpcapKey
 WEP key container. More...
 
struct  _AirpcapMacAddress
 Storage for a MAC address. More...
 
struct  _AirpcapKeysCollection
 This structure is used to store a collection of WEP keys. Note that the definition of the structure has one key in it (so that this code can be compiled by compilers that don't support zero-length arrays), so be careful to allocate a buffer with the size of the set of keys, as per the following example: More...
 
struct  _AirpcapBpfHeader
 Packet header. More...
 
struct  _AirpcapStats
 Capture statistics. Returned by AirpcapGetStats();. More...
 
struct  _AirpcapChannelInfo
 Channel information. Used by AirpcapSetDeviceChannelEx(), AirpcapGetDeviceChannelEx(), AirpcapGetDeviceSupportedChannels() More...
 

Macros

#define AIRPCAP_DEVICE_NAME_PREFIX   "\\\\.\\airpcap"
 This string is the fixed prefix in the airpcap adapter name. It can be used to parse the name field in an AirpcapDeviceDescription structure.
 
#define AIRPCAP_DEVICE_NUMBER_EXTRACT_STRING   "\\\\.\\airpcap%u"
 This string is the scanf modifier to extract the adapter number from an adapter name. It can be used to parse the name field in an AirpcapDeviceDescription structure with scanf.
 
#define AIRPCAP_DEVICE_ANY_EXTRACT_STRING   "\\\\.\\airpcap_any"
 
#define MAX_ENCRYPTION_KEYS   64
 
#define WEP_KEY_MAX_SIZE
 
#define AIRPCAP_KEYTYPE_WEP   0 /* < Key type: WEP. The key can have an arbitrary length smaller than 32 bytes. */
 
#define AIRPCAP_KEYTYPE_TKIP   1 /* < Key type: TKIP (WPA). NOT SUPPORTED YET. */
 
#define AIRPCAP_KEYTYPE_CCMP   2 /* < Key type: CCMP (WPA2). NOT SUPPORTED YET. */
 
#define AirpcapKeysCollectionSize(nKeys)    ((sizeof(AirpcapKeysCollection) - sizeof(AirpcapKey)) + ((nKeys) * sizeof(AirpcapKey)))
 
#define AirpcapKeysCollectionSizeToKeyCount(size)    (unsigned)(((size) - AirpcapKeysCollectionSize(0))/sizeof(AirpcapKey))
 
#define AIRPCAP_ALIGNMENT   sizeof(int)
 
#define AIRPCAP_WORDALIGN(x)   (((x)+(AIRPCAP_ALIGNMENT-1))&~(AIRPCAP_ALIGNMENT-1))
 
#define AIRPCAP_ERRBUF_SIZE   512 /* < Size of the error buffer, in bytes */
 
#define AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_
 

Typedefs

typedef struct _AirpcapDeviceDescription AirpcapDeviceDescription
 Entry in the list returned by AirpcapGetDeviceList();.
 
typedef struct _AirpcapDeviceDescriptionPAirpcapDeviceDescription
 
typedef struct _AirpcapKey AirpcapKey
 WEP key container.
 
typedef struct _AirpcapKeyPAirpcapKey
 
typedef enum _AirpcapChannelBand AirpcapChannelBand
 frequency Band. 802.11 adapters can support different frequency bands, the most important of which are: 2.4GHz (802.11b/g/n) and 5GHz (802.11a/n).
 
typedef enum _AirpcapChannelBandPAirpcapChannelBand
 
typedef enum _AirpcapValidationType AirpcapValidationType
 Type of frame validation the adapter performs. An adapter can be instructed to accept different kind of frames: correct frames only, frames with wrong Frame Check Sequence (FCS) only, all frames.
 
typedef enum _AirpcapValidationTypePAirpcapValidationType
 
typedef enum _AirpcapDecryptionState AirpcapDecryptionState
 Type of decryption the adapter performs. An adapter can be instructed to turn decryption (based on the device-configured keys configured with AirpcapSetDeviceKeys()) on or off.
 
typedef enum _AirpcapDecryptionStatePAirpcapDecryptionState
 
typedef struct _AirpcapMacAddress AirpcapMacAddress
 Storage for a MAC address.
 
typedef struct _AirpcapMacAddressPAirpcapMacAddress
 
typedef struct _AirpcapKeysCollection AirpcapKeysCollection
 This structure is used to store a collection of WEP keys. Note that the definition of the structure has one key in it (so that this code can be compiled by compilers that don't support zero-length arrays), so be careful to allocate a buffer with the size of the set of keys, as per the following example: More...
 
typedef struct _AirpcapKeysCollectionPAirpcapKeysCollection
 
typedef struct _AirpcapBpfHeader AirpcapBpfHeader
 Packet header. More...
 
typedef struct _AirpcapBpfHeaderPAirpcapBpfHeader
 
typedef enum _AirpcapLinkType AirpcapLinkType
 Link type. AirPcap supports two kind of 802.11 linktypes: plain 802.11 and radiotap.
 
typedef enum _AirpcapLinkTypePAirpcapLinkType
 
typedef struct _AirpcapHandle AirpcapHandle
 Adapter handle.
 
typedef struct _AirpcapHandle * PAirpcapHandle
 
typedef struct _AirpcapStats AirpcapStats
 Capture statistics. Returned by AirpcapGetStats();.
 
typedef struct _AirpcapStatsPAirpcapStats
 
typedef struct _AirpcapChannelInfo AirpcapChannelInfo
 Channel information. Used by AirpcapSetDeviceChannelEx(), AirpcapGetDeviceChannelEx(), AirpcapGetDeviceSupportedChannels()
 
typedef struct _AirpcapChannelInfoPAirpcapChannelInfo
 

Enumerations

enum  _AirpcapChannelBand { AIRPCAP_CB_AUTO = 1 , AIRPCAP_CB_2_4_GHZ = 2 , AIRPCAP_CB_4_GHZ = 4 , AIRPCAP_CB_5_GHZ = 5 }
 frequency Band. 802.11 adapters can support different frequency bands, the most important of which are: 2.4GHz (802.11b/g/n) and 5GHz (802.11a/n).
 
enum  _AirpcapValidationType { AIRPCAP_VT_ACCEPT_EVERYTHING = 1 , AIRPCAP_VT_ACCEPT_CORRECT_FRAMES = 2 , AIRPCAP_VT_ACCEPT_CORRUPT_FRAMES = 3 , AIRPCAP_VT_UNKNOWN = 4 }
 Type of frame validation the adapter performs. An adapter can be instructed to accept different kind of frames: correct frames only, frames with wrong Frame Check Sequence (FCS) only, all frames.
 
enum  _AirpcapDecryptionState { AIRPCAP_DECRYPTION_ON = 1 , AIRPCAP_DECRYPTION_OFF = 2 }
 Type of decryption the adapter performs. An adapter can be instructed to turn decryption (based on the device-configured keys configured with AirpcapSetDeviceKeys()) on or off.
 
enum  _AirpcapLinkType { AIRPCAP_LT_802_11 = 1 , AIRPCAP_LT_802_11_PLUS_RADIO = 2 , AIRPCAP_LT_UNKNOWN = 3 , AIRPCAP_LT_802_11_PLUS_PPI = 4 }
 Link type. AirPcap supports two kind of 802.11 linktypes: plain 802.11 and radiotap.
 

Functions

void AirpcapGetVersion (unsigned *VersionMajor, unsigned *VersionMinor, unsigned *VersionRev, unsigned *VersionBuild)
 Return a string with the API version. More...
 
char * AirpcapGetLastError (PAirpcapHandle AdapterHandle)
 Return the last error related to the specified handle. More...
 
bool AirpcapGetDeviceList (PAirpcapDeviceDescription *PPAllDevs, char *Ebuf)
 Return the list of available devices. More...
 
void AirpcapFreeDeviceList (PAirpcapDeviceDescription PAllDevs)
 Free a list of devices returned by AirpcapGetDeviceList() More...
 
PAirpcapHandle AirpcapOpen (char *DeviceName, char *Ebuf)
 Open an adapter. More...
 
void AirpcapClose (PAirpcapHandle AdapterHandle)
 Close an adapter. More...
 
bool AirpcapSetMonitorMode (PAirpcapHandle AdapterHandle, bool MonitorModeEnabled)
 Sets the monitor mode for the specified adapter. More...
 
bool AirpcapGetMonitorMode (PAirpcapHandle AdapterHandle, bool *PMonitorModeEnabled)
 Returns true if the specified adapter is in monitor mode. More...
 
bool AirpcapSetLinkType (PAirpcapHandle AdapterHandle, AirpcapLinkType NewLinkType)
 Set the link type of an adapter. More...
 
bool AirpcapGetLinkType (PAirpcapHandle AdapterHandle, PAirpcapLinkType PLinkType)
 Get the link type of the specified adapter. More...
 
bool AirpcapSetFcsPresence (PAirpcapHandle AdapterHandle, bool IsFcsPresent)
 Configures the adapter on whether to include the MAC Frame Check Sequence in the captured packets. More...
 
bool AirpcapGetFcsPresence (PAirpcapHandle AdapterHandle, bool *PIsFcsPresent)
 Returns true if the specified adapter includes the MAC Frame Check Sequence in the captured packets. More...
 
bool AirpcapSetFcsValidation (PAirpcapHandle AdapterHandle, AirpcapValidationType ValidationType)
 Configures the adapter to accept or drop frames with an incorrect Frame Check sequence (FCS). More...
 
bool AirpcapGetFcsValidation (PAirpcapHandle AdapterHandle, PAirpcapValidationType ValidationType)
 Checks if the specified adapter is configured to capture frames with incorrect an incorrect Frame Check Sequence (FCS). More...
 
bool AirpcapSetDeviceKeys (PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection)
 Set the list of decryption keys that the driver is going to use with the specified device. More...
 
bool AirpcapGetDeviceKeys (PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, unsigned *PKeysCollectionSize)
 Returns the list of decryption keys in the driver that are currently associated with the specified device. More...
 
bool AirpcapSetDriverKeys (PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection)
 Set the global list of decryption keys that the driver is going to use with all the devices. More...
 
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. More...
 
bool AirpcapSetDecryptionState (PAirpcapHandle AdapterHandle, AirpcapDecryptionState Enable)
 Turns on or off the decryption of the incoming frames with the adapter-specific keys. More...
 
bool AirpcapGetDecryptionState (PAirpcapHandle AdapterHandle, PAirpcapDecryptionState PEnable)
 Tells if this open instance is configured to perform the decryption of the incoming frames with the adapter-specific keys. More...
 
bool AirpcapSetDriverDecryptionState (PAirpcapHandle AdapterHandle, AirpcapDecryptionState Enable)
 Turns on or off the decryption of the incoming frames with the global driver set of keys. More...
 
bool AirpcapGetDriverDecryptionState (PAirpcapHandle AdapterHandle, PAirpcapDecryptionState PEnable)
 Tells if this open instance is configured to perform the decryption of the incoming frames with the global driver set of keys. More...
 
bool AirpcapSetDeviceChannel (PAirpcapHandle AdapterHandle, unsigned Channel)
 Set the radio channel of a device. More...
 
bool AirpcapGetDeviceChannel (PAirpcapHandle AdapterHandle, unsigned *PChannel)
 Get the radio channel of a device. More...
 
bool AirpcapSetKernelBuffer (PAirpcapHandle AdapterHandle, unsigned BufferSize)
 Set the size of the kernel packet buffer for this adapter. More...
 
bool AirpcapGetKernelBufferSize (PAirpcapHandle AdapterHandle, unsigned *PSizeBytes)
 Get the size of the kernel packet buffer for this adapter. More...
 
bool AirpcapStoreCurConfigAsAdapterDefault (PAirpcapHandle AdapterHandle)
 Saves the configuration of the specified adapter in the registry, so that it becomes the default for this adapter. More...
 
bool AirpcapSetFilter (PAirpcapHandle AdapterHandle, void *Instructions, unsigned Len)
 Set the BPF kernel filter for an adapter. More...
 
bool AirpcapGetMacAddress (PAirpcapHandle AdapterHandle, PAirpcapMacAddress PMacAddress)
 Return the MAC address of an adapter. More...
 
bool AirpcapSetMinToCopy (PAirpcapHandle AdapterHandle, unsigned MinToCopy)
 Set the mintocopy parameter for an open adapter. More...
 
bool AirpcapGetReadEvent (PAirpcapHandle AdapterHandle, void ***PReadEvent)
 Gets an event that is signaled when that is signalled when packets are available in the kernel buffer (see AirpcapSetMinToCopy()). More...
 
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 adapter. More...
 
bool AirpcapWrite (PAirpcapHandle AdapterHandle, char *TxPacket, uint32_t PacketLen)
 Transmits a packet. More...
 
bool AirpcapGetStats (PAirpcapHandle AdapterHandle, PAirpcapStats PStats)
 Get per-adapter WinPcap-compatible capture statistics. More...
 
bool AirpcapGetLedsNumber (PAirpcapHandle AdapterHandle, unsigned *NumberOfLeds)
 Get the number of LEDs the referenced adapter has available. More...
 
bool AirpcapTurnLedOn (PAirpcapHandle AdapterHandle, unsigned LedNumber)
 Turn on one of the adapter's LEDs. More...
 
bool AirpcapTurnLedOff (PAirpcapHandle AdapterHandle, unsigned LedNumber)
 Turn off one of the adapter's LEDs. More...
 
bool AirpcapSetDeviceChannelEx (PAirpcapHandle AdapterHandle, AirpcapChannelInfo ChannelInfo)
 Set the channel of a device through its radio frequency. In case of 802.11n enabled devices, it sets the extension channel, if used. More...
 
bool AirpcapGetDeviceChannelEx (PAirpcapHandle AdapterHandle, PAirpcapChannelInfo PChannelInfo)
 Get the channel of a device through its radiofrequency. In case of 802.11n enabled devices, it gets the extension channel, if in use. More...
 
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, information related to supported extension channels is also reported. More...
 
bool AirpcapConvertFrequencyToChannel (unsigned Frequency, unsigned *PChannel, PAirpcapChannelBand PBand)
 Converts a given frequency to the corresponding channel. More...
 
bool AirpcapConvertChannelToFrequency (unsigned Channel, unsigned *PFrequency)
 Converts a given channel to the corresponding frequency. More...
 

Detailed Description

Copyright (c) 2006-2007 CACE Technologies, Davis (California) All rights reserved.

SPDX-License-Identifier: BSD-3-Clause