aboutsummaryrefslogtreecommitdiffstats
path: root/airpcap.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2013-02-17 03:28:23 +0000
committerGuy Harris <guy@alum.mit.edu>2013-02-17 03:28:23 +0000
commit806cb7224df91bbaac0744a881c185fdf25fe9ea (patch)
treeb287b001ef378c38870c1c46a4883ff292d78236 /airpcap.h
parent5be3e9cb7af8fed8a62c92eb1e48a2da153a7330 (diff)
Clean up white space (use spaces instead of tabs).
svn path=/trunk/; revision=47698
Diffstat (limited to 'airpcap.h')
-rw-r--r--airpcap.h216
1 files changed, 108 insertions, 108 deletions
diff --git a/airpcap.h b/airpcap.h
index 5f1af5c721..8813ed0e13 100644
--- a/airpcap.h
+++ b/airpcap.h
@@ -38,25 +38,25 @@ extern "C" {
#endif
/*
- \mainpage AirPcap interface documentation
+ \mainpage AirPcap interface documentation
- \section Introduction
+ \section Introduction
- This document describes the data structures and the functions exported by the CACE Technologies AirPcap library.
- The AirPcap library provides low-level access to the AirPcap driver including advanced capabilities such as channel setting,
- link type control and WEP configuration.<br>
- This manual includes the following sections:
+ This document describes the data structures and the functions exported by the CACE Technologies AirPcap library.
+ The AirPcap library provides low-level access to the AirPcap driver including advanced capabilities such as channel setting,
+ link type control and WEP configuration.<br>
+ This manual includes the following sections:
- \note throughout this documentation, \e device refers to a physical USB AirPcap device, while \e adapter is an open API
- instance. Most of the AirPcap API operations are adapter-specific but some of them, like setting the channel, are
- per-device and will be reflected on all the open adapters. These functions will have "Device" in their name, e.g.
- AirpcapSetDeviceChannel().
+ \note throughout this documentation, \e device refers to a physical USB AirPcap device, while \e adapter is an open API
+ instance. Most of the AirPcap API operations are adapter-specific but some of them, like setting the channel, are
+ per-device and will be reflected on all the open adapters. These functions will have "Device" in their name, e.g.
+ AirpcapSetDeviceChannel().
- \b Sections:
+ \b Sections:
- - \ref airpcapfuncs
- - \ref airpcapdefs
- - \ref radiotap
+ - \ref airpcapfuncs
+ - \ref airpcapdefs
+ - \ref radiotap
*/
/** @defgroup airpcapdefs AirPcap definitions and data structures
@@ -67,13 +67,13 @@ extern "C" {
\brief 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_NAME_PREFIX "\\\\.\\airpcap"
+#define AIRPCAP_DEVICE_NAME_PREFIX "\\\\.\\airpcap"
/*!
\brief 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_NUMBER_EXTRACT_STRING "\\\\.\\airpcap%u"
+#define AIRPCAP_DEVICE_NUMBER_EXTRACT_STRING "\\\\.\\airpcap%u"
#define AIRPCAP_DEVICE_ANY_EXTRACT_STRING "\\\\.\\airpcap_any"
@@ -82,15 +82,15 @@ extern "C" {
*/
typedef struct _AirpcapDeviceDescription
{
- struct _AirpcapDeviceDescription *next; /* < Next element in the list */
- gchar * Name; /* < Device name */
- gchar * Description; /* < Device description */
+ struct _AirpcapDeviceDescription *next; /* < Next element in the list */
+ gchar * Name; /* < Device name */
+ gchar * Description; /* < Device description */
} AirpcapDeviceDescription, *PAirpcapDeviceDescription;
#define MAX_ENCRYPTION_KEYS 64
-#define WEP_KEY_MAX_SIZE 32 /* < Maximum size of a WEP key, in bytes. This is the size of an entry in the
- < AirpcapWepKeysCollection structure. */
+#define WEP_KEY_MAX_SIZE 32 /* < Maximum size of a WEP key, in bytes. This is the size of an entry in the
+ < AirpcapWepKeysCollection structure. */
#ifdef _WIN32
#ifndef __MINGW32__
@@ -99,18 +99,18 @@ typedef struct _AirpcapDeviceDescription
#endif
#endif
-#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 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. */
/*!
\brief WEP key container
*/
typedef struct _AirpcapKey
{
- guint KeyType; /* < Type of key, can be on of: \ref AIRPCAP_KEYTYPE_WEP, \ref AIRPCAP_KEYTYPE_TKIP, \ref AIRPCAP_KEYTYPE_CCMP. Only AIRPCAP_KEYTYPE_WEP is supported by the driver at the moment. */
- guint KeyLen; /* < Length of the key, in bytes */
- guint8 KeyData[WEP_KEY_MAX_SIZE]; /* < Key Data */
+ guint KeyType; /* < Type of key, can be on of: \ref AIRPCAP_KEYTYPE_WEP, \ref AIRPCAP_KEYTYPE_TKIP, \ref AIRPCAP_KEYTYPE_CCMP. Only AIRPCAP_KEYTYPE_WEP is supported by the driver at the moment. */
+ guint KeyLen; /* < Length of the key, in bytes */
+ guint8 KeyData[WEP_KEY_MAX_SIZE]; /* < Key Data */
}
#ifdef __MINGW32__
__attribute__((__packed__))
@@ -124,10 +124,10 @@ AirpcapKey, *PAirpcapKey;
*/
typedef enum _AirpcapChannelBand
{
- AIRPCAP_CB_AUTO = 1, /* < Automatically pick the best frequency band */
- AIRPCAP_CB_2_4_GHZ = 2, /* < 2.4 GHz frequency band */
- AIRPCAP_CB_4_GHZ = 4, /* < 4 GHz frequency band */
- AIRPCAP_CB_5_GHZ = 5 /* < 5 GHz frequency band */
+ AIRPCAP_CB_AUTO = 1, /* < Automatically pick the best frequency band */
+ AIRPCAP_CB_2_4_GHZ = 2, /* < 2.4 GHz frequency band */
+ AIRPCAP_CB_4_GHZ = 4, /* < 4 GHz frequency band */
+ AIRPCAP_CB_5_GHZ = 5 /* < 5 GHz frequency band */
}AirpcapChannelBand, *PAirpcapChannelBand;
/*!
@@ -136,10 +136,10 @@ typedef enum _AirpcapChannelBand
*/
typedef enum _AirpcapValidationType
{
- AIRPCAP_VT_ACCEPT_EVERYTHING = 1, /* < Accept all the frames the device captures */
- AIRPCAP_VT_ACCEPT_CORRECT_FRAMES = 2, /* < Accept correct frames only, i.e. frames with correct Frame Check Sequence (FCS). */
- AIRPCAP_VT_ACCEPT_CORRUPT_FRAMES = 3, /* < Accept corrupt frames only, i.e. frames with wrong Frame Check Sequence (FCS). */
- AIRPCAP_VT_UNKNOWN = 4 /* < Unknown validation type. You should see it only in case of error. */
+ AIRPCAP_VT_ACCEPT_EVERYTHING = 1, /* < Accept all the frames the device captures */
+ AIRPCAP_VT_ACCEPT_CORRECT_FRAMES = 2, /* < Accept correct frames only, i.e. frames with correct Frame Check Sequence (FCS). */
+ AIRPCAP_VT_ACCEPT_CORRUPT_FRAMES = 3, /* < Accept corrupt frames only, i.e. frames with wrong Frame Check Sequence (FCS). */
+ AIRPCAP_VT_UNKNOWN = 4 /* < Unknown validation type. You should see it only in case of error. */
}AirpcapValidationType, *PAirpcapValidationType;
/*!
@@ -149,8 +149,8 @@ typedef enum _AirpcapValidationType
*/
typedef enum _AirpcapDecryptionState
{
- AIRPCAP_DECRYPTION_ON = 1, /* < This adapter performs decryption */
- AIRPCAP_DECRYPTION_OFF = 2 /* < This adapter does not perform decryption */
+ AIRPCAP_DECRYPTION_ON = 1, /* < This adapter performs decryption */
+ AIRPCAP_DECRYPTION_OFF = 2 /* < This adapter does not perform decryption */
}AirpcapDecryptionState, *PAirpcapDecryptionState;
@@ -159,7 +159,7 @@ typedef enum _AirpcapDecryptionState
*/
typedef struct _AirpcapMacAddress
{
- guint8 Address[6]; /* < MAC address bytes */
+ guint8 Address[6]; /* < MAC address bytes */
}
#ifdef __MINGW32__
__attribute__((__packed__))
@@ -172,22 +172,22 @@ AirpcapMacAddress, *PAirpcapMacAddress;
with the size of the key, like in the following example:
\code
- PAirpcapKeysCollection KeysCollection;
- guint KeysCollectionSize;
+ PAirpcapKeysCollection KeysCollection;
+ guint KeysCollectionSize;
- KeysCollectionSize = sizeof(AirpcapKeysCollection) + NumKeys * sizeof(AirpcapKey);
+ KeysCollectionSize = sizeof(AirpcapKeysCollection) + NumKeys * sizeof(AirpcapKey);
- KeysCollection = (PAirpcapKeysCollection)malloc(KeysCollectionSize);
- if(!KeysCollection)
- {
- Error
- }
+ KeysCollection = (PAirpcapKeysCollection)malloc(KeysCollectionSize);
+ if(!KeysCollection)
+ {
+ Error
+ }
\endcode
*/
typedef struct _AirpcapKeysCollection
{
- guint nKeys; /* < Number of keys in the collection */
- AirpcapKey Keys[0]; /* < Array of nKeys keys. */
+ guint nKeys; /* < Number of keys in the collection */
+ AirpcapKey Keys[0]; /* < Array of nKeys keys. */
} AirpcapKeysCollection, *PAirpcapKeysCollection;
/*!
@@ -197,11 +197,11 @@ typedef struct _AirpcapKeysCollection
*/
typedef struct _AirpcapBpfHeader
{
- guint TsSec; /* < Timestamp associated with the captured packet. SECONDS. */
- guint TsUsec; /* < Timestamp associated with the captured packet. MICROSECONDS. */
- guint Caplen; /* < Length of captured portion. The captured portion <b>can be different</b> from the original packet, because it is possible (with a proper filter) to instruct the driver to capture only a portion of the packets. */
- guint Originallen; /* < Original length of packet */
- guint16 Hdrlen; /* < Length of bpf header (this struct plus alignment padding). In some cases, a padding could be added between the end of this structure and the packet data for performance reasons. This field can be used to retrieve the actual data of the packet. */
+ guint TsSec; /* < Timestamp associated with the captured packet. SECONDS. */
+ guint TsUsec; /* < Timestamp associated with the captured packet. MICROSECONDS. */
+ guint Caplen; /* < Length of captured portion. The captured portion <b>can be different</b> from the original packet, because it is possible (with a proper filter) to instruct the driver to capture only a portion of the packets. */
+ guint Originallen; /* < Original length of packet */
+ guint16 Hdrlen; /* < Length of bpf header (this struct plus alignment padding). In some cases, a padding could be added between the end of this structure and the packet data for performance reasons. This field can be used to retrieve the actual data of the packet. */
}
#ifdef __MINGW32__
__attribute__((__packed__))
@@ -218,7 +218,7 @@ AirpcapBpfHeader, *PAirpcapBpfHeader;
#endif
#endif
-#define AIRPCAP_ERRBUF_SIZE 512 /* < Size of the error buffer, in bytes */
+#define AIRPCAP_ERRBUF_SIZE 512 /* < Size of the error buffer, in bytes */
#ifndef __AIRPCAP_DRIVER__
@@ -229,10 +229,10 @@ AirpcapBpfHeader, *PAirpcapBpfHeader;
#undef _AirpcapLinkType
typedef enum _AirpcapLinkType
{
- AIRPCAP_LT_802_11 = 1, /* < plain 802.11 linktype. Every packet in the buffer contains the raw 802.11 frame, including MAC FCS. */
- AIRPCAP_LT_802_11_PLUS_RADIO = 2, /* < 802.11 plus radiotap linktype. Every packet in the buffer contains a radiotap header followed by the 802.11 frame. MAC FCS is included. */
- AIRPCAP_LT_UNKNOWN = 3, /* < Unknown linktype. You should see it only in case of error. */
- AIRPCAP_LT_802_11_PLUS_PPI = 4 /* < 802.11 plus PPI header linktype. Every packet in the buffer contains a PPI header followed by the 802.11 frame. MAC FCS is included. */
+ AIRPCAP_LT_802_11 = 1, /* < plain 802.11 linktype. Every packet in the buffer contains the raw 802.11 frame, including MAC FCS. */
+ AIRPCAP_LT_802_11_PLUS_RADIO = 2, /* < 802.11 plus radiotap linktype. Every packet in the buffer contains a radiotap header followed by the 802.11 frame. MAC FCS is included. */
+ AIRPCAP_LT_UNKNOWN = 3, /* < Unknown linktype. You should see it only in case of error. */
+ AIRPCAP_LT_802_11_PLUS_PPI = 4 /* < 802.11 plus PPI header linktype. Every packet in the buffer contains a PPI header followed by the 802.11 frame. MAC FCS is included. */
}AirpcapLinkType, *PAirpcapLinkType;
#if !defined(AIRPCAP_HANDLE__EAE405F5_0171_9592_B3C2_C19EC426AD34__DEFINED_)
@@ -249,15 +249,15 @@ typedef struct _AirpcapHandle AirpcapHandle, *PAirpcapHandle;
*/
typedef struct _AirpcapStats
{
- guint Recvs; /* < Number of packets that the driver received by the adapter */
- /* < from the beginning of the current capture. This value includes the packets */
- /* < dropped because of buffer full. */
- guint Drops; /* < number of packets that the driver dropped from the beginning of a capture. */
- /* < A packet is lost when the the buffer of the driver is full. */
- guint IfDrops; /* < Packets dropped by the card before going to the USB bus. */
- /* < Not supported at the moment. */
- guint Capt; /* < number of packets that pass the BPF filter, find place in the kernel buffer and */
- /* < therefore reach the application. */
+ guint Recvs; /* < Number of packets that the driver received by the adapter */
+ /* < from the beginning of the current capture. This value includes the packets */
+ /* < dropped because of buffer full. */
+ guint Drops; /* < number of packets that the driver dropped from the beginning of a capture. */
+ /* < A packet is lost when the the buffer of the driver is full. */
+ guint IfDrops; /* < Packets dropped by the card before going to the USB bus. */
+ /* < Not supported at the moment. */
+ guint Capt; /* < number of packets that pass the BPF filter, find place in the kernel buffer and */
+ /* < therefore reach the application. */
}AirpcapStats, *PAirpcapStats;
/*!
@@ -266,21 +266,21 @@ typedef struct _AirpcapStats
*/
typedef struct _AirpcapChannelInfo
{
- guint Frequency; /* < Channel frequency, in MHz. */
- /*!
- \brief 802.11n specific. Offset of the extension channel in case of 40MHz channels.
-
- Possible values are -1, 0 +1:
- - -1 means that the extension channel should be below the control channel (e.g. Control = 5 and Extension = 1)
- - 0 means that no extension channel should be used (20MHz channels or legacy mode)
- - +1 means that the extension channel should be above the control channel (e.g. Control = 1 and Extension = 5)
-
- In case of 802.11a/b/g channels (802.11n legacy mode), this field should be set to 0.
- */
- gchar ExtChannel;
- guint8 Reserved[3]; /* < Reserved. It should be set to {0,0,0}. */
+ guint Frequency; /* < Channel frequency, in MHz. */
+ /*!
+ \brief 802.11n specific. Offset of the extension channel in case of 40MHz channels.
+
+ Possible values are -1, 0 +1:
+ - -1 means that the extension channel should be below the control channel (e.g. Control = 5 and Extension = 1)
+ - 0 means that no extension channel should be used (20MHz channels or legacy mode)
+ - +1 means that the extension channel should be above the control channel (e.g. Control = 1 and Extension = 5)
+
+ In case of 802.11a/b/g channels (802.11n legacy mode), this field should be set to 0.
+ */
+ gchar ExtChannel;
+ guint8 Reserved[3]; /* < Reserved. It should be set to {0,0,0}. */
}
- AirpcapChannelInfo, *PAirpcapChannelInfo;
+ AirpcapChannelInfo, *PAirpcapChannelInfo;
/*@}*/
@@ -311,28 +311,28 @@ gchar * AirpcapGetLastError(PAirpcapHandle AdapterHandle);
\param Ebuf String that will contain error information if FALSE is returned. The size of the string must be AIRPCAP_ERRBUF_SIZE bytes.
\return TRUE on success. FALSE is returned on failure, in which case Ebuf is filled in with an appropriate error message.
- Here's a snippet of code that shows how to use AirpcapGetDeviceList():
+ Here's a snippet of code that shows how to use AirpcapGetDeviceList():
- \code
- gchar Ebuf[AIRPCAP_ERRBUF_SIZE];
- AirpcapDeviceDescription *Desc, *tDesc;
+ \code
+ gchar Ebuf[AIRPCAP_ERRBUF_SIZE];
+ AirpcapDeviceDescription *Desc, *tDesc;
- if(AirpcapGetDeviceList(&Desc, Ebuf) == -1)
- {
- printf("Unable to get the list of devices: %s\n", Ebuf);
- return -1;
- }
+ if(AirpcapGetDeviceList(&Desc, Ebuf) == -1)
+ {
+ printf("Unable to get the list of devices: %s\n", Ebuf);
+ return -1;
+ }
- for(tDesc = Desc; tDesc; tDesc = tDesc->next)
- {
- printf("%u) %s (%s)\n",
- ++i,
- tDesc->Name,
- tDesc->Description);
- }
+ for(tDesc = Desc; tDesc; tDesc = tDesc->next)
+ {
+ printf("%u) %s (%s)\n",
+ ++i,
+ tDesc->Name,
+ tDesc->Description);
+ }
- AirpcapFreeDeviceList(Desc);
- \endcode
+ AirpcapFreeDeviceList(Desc);
+ \endcode
*/
gboolean AirpcapGetDeviceList(PAirpcapDeviceDescription *PPAllDevs, gchar * Ebuf);
@@ -384,7 +384,7 @@ void AirpcapClose(PAirpcapHandle AdapterHandle);
\note When an adapter is plugged into the system, it's always configured with monitor mode ON. The monitor mode
configuration is not stored persistently, so if you want to turn monitor mode off, you will need to do it
- every time you open the adapter.
+ every time you open the adapter.
*/
gboolean AirpcapSetMonitorMode(PAirpcapHandle AdapterHandle, gboolean MonitorModeEnabled);
@@ -396,7 +396,7 @@ gboolean AirpcapSetMonitorMode(PAirpcapHandle AdapterHandle, gboolean MonitorMod
\note When an adapter is plugged into the system, it's always configured with monitor mode ON. The monitor mode
configuration is not stored persistently, so if you want to turn monitor mode off, you will need to do it
- every time you open the adapter.
+ every time you open the adapter.
*/
gboolean AirpcapGetMonitorMode(PAirpcapHandle AdapterHandle, gboolean * PMonitorModeEnabled);
@@ -416,8 +416,8 @@ gboolean AirpcapGetMonitorMode(PAirpcapHandle AdapterHandle, gboolean * PMonitor
\ref radiotap section. Moreover, the "Capture_radio" example application in
the developer's pack can be used as a reference on how to decode 802.11 frames with radiotap headers.
- \ref AIRPCAP_LT_802_11_PLUS_PPI, to capture 802.11 frames (including control frames) with a Per Packet Information (PPI)
- header that contains per-packet meta information like channel and power information. More details on the PPI header can
- be found in the PPI online documentation (TODO).
+ header that contains per-packet meta information like channel and power information. More details on the PPI header can
+ be found in the PPI online documentation (TODO).
*/
gboolean AirpcapSetLinkType(PAirpcapHandle AdapterHandle, AirpcapLinkType NewLinkType);
@@ -517,7 +517,7 @@ gboolean AirpcapSetDeviceKeys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollecti
\param AdapterHandle Handle to an open adapter instance.
\param KeysCollection User-allocated PAirpcapKeysCollection structure that will be filled with the keys.
\param PKeysCollectionSize \b IN: pointer to a user-allocated variable that contains the length of the KeysCollection structure, in bytes.
- \b OUT: amount of data moved by the driver in the buffer pointed by KeysBuffer, in bytes.
+ \b OUT: amount of data moved by the driver in the buffer pointed by KeysBuffer, in bytes.
\return TRUE if the operation is successful. If an error occurs, the return value is FALSE and KeysCollectionSize is zero.
If the provided buffer is too small to contain the keys, the return value is FALSE and KeysCollectionSize contains the
needed KeysCollection length, in bytes. If the device doesn't have any decryption key configured, the return value is TRUE, and
@@ -566,7 +566,7 @@ gboolean AirpcapSetDriverKeys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollecti
\param AdapterHandle Handle to an open adapter instance.
\param KeysCollection User-allocated PAirpcapKeysCollection structure that will be filled with the keys.
\param PKeysCollectionSize \b IN: pointer to a user-allocated variable that contains the length of the KeysCollection structure, in bytes.
- \b OUT: amount of data moved by the driver in the buffer pointed by KeysBuffer, in bytes.
+ \b OUT: amount of data moved by the driver in the buffer pointed by KeysBuffer, in bytes.
\return TRUE if the operation is successful. If an error occurs, the return value is FALSE and KeysCollectionSize is zero.
If the provided buffer is too small to contain the keys, the return value is FALSE and KeysCollectionSize contains the
needed KeysCollection length, in bytes. If the device doesn't have any decryption key configured, the return value is TRUE, and
@@ -871,9 +871,9 @@ gboolean AirpcapGetDeviceChannelEx(PAirpcapHandle AdapterHandle, PAirpcapChannel
\brief 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.
Every control channel is listed multiple times, one for each different supported extension channel. For example channel 6 (2437MHz) is usually listed three times:
- - <b>Frequency 2437 Extension +1</b>. Control channel is 6, extension channel is 10.
- - <b>Frequency 2437 Extension 0</b>. Control channel is 6, no extension channel is used (20MHz channel and legacy mode).
- - <b>Frequency 2437 Extension -1</b>. Control channel is 6, extension channel is 2.
+ - <b>Frequency 2437 Extension +1</b>. Control channel is 6, extension channel is 10.
+ - <b>Frequency 2437 Extension 0</b>. Control channel is 6, no extension channel is used (20MHz channel and legacy mode).
+ - <b>Frequency 2437 Extension -1</b>. Control channel is 6, extension channel is 2.
\param AdapterHandle Handle to the adapter.
\param ppChannelInfo Pointer to a user-supplied variable that will point to an array of supported channel. Such list must not be freed by the caller
\param pNumChannelInfo Number of channels returned in the array.