Makefile.am Try to get the latest state of asn1 files into the dist.
[obnox/wireshark/wip.git] / airpcap.h
index f7e6cff331d1c12aff32e2d7f387421b9f48ebc9..639a930a70ef25c8aac1e98b0630c969ed73e3b0 100644 (file)
--- a/airpcap.h
+++ b/airpcap.h
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2006 CACE Technologies, Davis (California)
+ * Copyright (c) 2006-2007 CACE Technologies, Davis (California)
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
 #if !defined(AIRPCAP_H__EAE405F5_0171_9592_B3C2_C19EC426AD34__INCLUDED_)
 #define AIRPCAP_H__EAE405F5_0171_9592_B3C2_C19EC426AD34__INCLUDED_
 
-/* This disables a VS warning for zero-sized arrays. All the compilers we support have that feature */
+#ifdef _MSC_VER
+// This disables a VS warning for zero-sized arrays.
 #pragma warning( disable : 4200)
+// This stops VS2005 ranting against stdio.
+#pragma warning( disable : 4996)
+#endif
 
 #ifdef __cplusplus
 extern "C" {
@@ -39,7 +43,7 @@ extern "C" {
        link type control and WEP configuration.<br>
        This manual includes the following sections:
 
-       \note throughout this documentation, \i device refers to a physical USB AirPcap device, wile \i adapter is an open API
+       \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().
@@ -59,18 +63,14 @@ 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"
 
-/*!
-  \brief This string is the scanf modifier to extract the adapter "Any" string 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"
 
 /*!
@@ -78,48 +78,63 @@ extern "C" {
 */
 typedef struct _AirpcapDeviceDescription
 {
-       struct  _AirpcapDeviceDescription *next;                        /* Next element in the list */
-       PCHAR   Name;                                                                           /* Device name */
-       PCHAR   Description;                                                            /* Device description */
+       struct  _AirpcapDeviceDescription *next;                        ///< Next element in the list
+       PCHAR   Name;                                                                           ///< Device name
+       PCHAR   Description;                                                            ///< Device description
 } AirpcapDeviceDescription, *PAirpcapDeviceDescription;
 
-#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 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
 
 #ifndef __MINGW32__
 #pragma pack(push)
 #pragma pack(1)
-#endif /* __MINGW32__ */
+#endif // __MINGW32__
 
 
-#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
 {
-       UINT 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. */
-       UINT KeyLen;                                            /* Length of the key, in bytes */
-       BYTE KeyData[WEP_KEY_MAX_SIZE];         /* Key Data */
+       UINT 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.
+       UINT KeyLen;                                            ///< Length of the key, in bytes
+       BYTE KeyData[WEP_KEY_MAX_SIZE];         ///< Key Data
 }
 #ifdef __MINGW32__
 __attribute__((__packed__))
-#endif /* __MINGW32__ */
+#endif // __MINGW32__
 AirpcapKey, *PAirpcapKey;
 
+/*!
+  \brief 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 _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
+}AirpcapChannelBand, *PAirpcapChannelBand;
+
 /*!
   \brief 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 _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 worng 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 worng Frame Check Sequence (FCS).
+       AIRPCAP_VT_UNKNOWN = 4                                  ///< Unknown validation type. You should see it only in case of error.
 }AirpcapValidationType, *PAirpcapValidationType;
 
 /*!
@@ -129,8 +144,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;
 
 
@@ -139,11 +154,11 @@ typedef enum _AirpcapDecryptionState
 */
 typedef struct _AirpcapMacAddress
 {
-       BYTE Address[6];                /* MAC address bytes */
+       BYTE Address[6];                ///< MAC address bytes
 }
 #ifdef __MINGW32__
 __attribute__((__packed__))
-#endif /* __MINGW32__ */
+#endif // __MINGW32__
 AirpcapMacAddress, *PAirpcapMacAddress;
 
 /*!
@@ -166,8 +181,8 @@ AirpcapMacAddress, *PAirpcapMacAddress;
 */
 typedef struct _AirpcapKeysCollection
 {
-       UINT nKeys;                                                                                             /* Number of keys in the collection */
-       AirpcapKey Keys[0];                                                                             /* Array of nKeys keys.  */
+       UINT nKeys;                                                                                             ///< Number of keys in the collection
+       AirpcapKey Keys[0];                                                                             ///< Array of nKeys keys.
 } AirpcapKeysCollection, *PAirpcapKeysCollection;
 
 /*!
@@ -177,26 +192,26 @@ typedef struct _AirpcapKeysCollection
 */
 typedef struct _AirpcapBpfHeader
 {
-       UINT TsSec;                     /* Timestamp associated with the captured packet. SECONDS. */
-       UINT TsUsec;            /* Timestamp associated with the captured packet. MICROSECONDS. */
-       UINT 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. */
-       UINT Originallen;       /* Original length of packet */
-       USHORT  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. */
+       UINT TsSec;                     ///< Timestamp associated with the captured packet. SECONDS.
+       UINT TsUsec;            ///< Timestamp associated with the captured packet. MICROSECONDS.
+       UINT 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.
+       UINT Originallen;       ///< Original length of packet
+       USHORT  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__))
-#endif /* __MINGW32__ */
+#endif // __MINGW32__
 AirpcapBpfHeader, *PAirpcapBpfHeader;
 
-/* Helper macros to extract packets coming from the driver. Rounds up to the next even multiple of AIRPCAP_ALIGNMENT.  */
+/// Helper macros to extract packets coming from the driver. Rounds up to the next even multiple of AIRPCAP_ALIGNMENT.
 #define AIRPCAP_ALIGNMENT sizeof(int)
 #define AIRPCAP_WORDALIGN(x) (((x)+(AIRPCAP_ALIGNMENT-1))&~(AIRPCAP_ALIGNMENT-1))
 
 #ifndef __MINGW32__
 #pragma pack(pop)
-#endif /* __MINGW32__ */
+#endif // __MINGW32__
 
-#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__
 
@@ -204,11 +219,13 @@ AirpcapBpfHeader, *PAirpcapBpfHeader;
   \brief Link type.
    AirPcap supports two kind of 802.11 linktypes: plain 802.11 and radiotap.
 */
+#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 = 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_)
@@ -225,17 +242,40 @@ typedef struct _AirpcapHandle AirpcapHandle, *PAirpcapHandle;
 */
 typedef struct _AirpcapStats
 {
-       UINT 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. */
-       UINT 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.  */
-       UINT IfDrops;           /* Packets dropped by the card before going to the USB bus.  */
-                                               /* Not supported at the moment. */
-       UINT Capt;                      /* number of packets that pass the BPF filter, find place in the kernel buffer and */
-                                               /* therefore reach the application. */
+       UINT 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.
+       UINT 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.
+       UINT IfDrops;           ///< Packets dropped by the card before going to the USB bus.
+                                               ///< Not supported at the moment.
+       UINT Capt;                      ///< number of packets that pass the BPF filter, find place in the kernel buffer and
+                                               ///< therefore reach the application.
 }AirpcapStats, *PAirpcapStats;
 
+/*!
+  \brief Channel information.
+  Used by \ref AirpcapSetDeviceChannelEx(), \ref AirpcapGetDeviceChannelEx(), \ref AirpcapGetDeviceSupportedChannels()
+*/
+typedef struct _AirpcapChannelInfo
+{
+       UINT 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.
+       */
+       CHAR ExtChannel;
+       UCHAR Reserved[3];      ///< Reserved. It should be set to {0,0,0}.
+}
+       AirpcapChannelInfo, *PAirpcapChannelInfo;
+
+
 /*@}*/
 
 /** @defgroup airpcapfuncs AirPcap functions
@@ -264,7 +304,7 @@ PCHAR 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 snppet of code that shows how to use AirpcapGetDeviceList():
+       Here's a snippet of code that shows how to use AirpcapGetDeviceList():
 
        \code
        CHAR Ebuf[AIRPCAP_ERRBUF_SIZE];
@@ -283,6 +323,8 @@ PCHAR AirpcapGetLastError(PAirpcapHandle AdapterHandle);
                tDesc->Name,
                tDesc->Description);
        }
+
+       AirpcapFreeDeviceList(Desc);
        \endcode
 */
 BOOL AirpcapGetDeviceList(PAirpcapDeviceDescription *PPAllDevs, PCHAR Ebuf);
@@ -307,6 +349,50 @@ PAirpcapHandle AirpcapOpen(PCHAR DeviceName, PCHAR Ebuf);
 */
 VOID AirpcapClose(PAirpcapHandle AdapterHandle);
 
+/*!
+  \brief Sets the monitor mode for the specified adapter
+  \param AdapterHandle Handle to the adapter.
+  \param MonitorModeEnabled If TRUE, the adapter will be put in monitor mode. If FALSE, the adapter will be configured
+         for normal operation.
+  \return TRUE on success.
+
+  When monitor mode is on, the adapter captures all the packets transmitted on the channel. This includes:
+
+   - unicast packets
+   - multicast packets
+   - broadcast packets
+   - control and management packets
+
+  When monitor mode is off, the adapter has a filter on unicast packets to capture only the packets whose MAC
+  destination address equals to the adapter's address. This means the following frames will be received:
+
+   - unicast packets with the address of the adapter
+   - multicast packets
+   - broadcast packets
+   - beacons and probe requests
+
+  The main reason to turn monitor mode off is that, when not in monitor mode, the adapter will acknowledge the
+  data frames sent to its address. This is useful when the adapter needs to interact with other devices on the
+  802.11 network, bacause handling the ACKs in software is too slow.
+
+  \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.
+*/
+BOOL AirpcapSetMonitorMode(PAirpcapHandle AdapterHandle, BOOL MonitorModeEnabled);
+
+/*!
+  \brief Returns TRUE if the specified adapter is in monitor mode.
+  \param AdapterHandle Handle to the adapter.
+  \param PMonitorModeEnabled User-provided variable that will be set to true if the adapter is in monitor mode.
+  \return TRUE if the operation is successful. FALSE otherwise.
+
+  \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.
+*/
+BOOL AirpcapGetMonitorMode(PAirpcapHandle AdapterHandle, PBOOL PMonitorModeEnabled);
+
 /*!
   \brief Set the link type of an adapter
   \param AdapterHandle Handle to the adapter.
@@ -315,13 +401,16 @@ VOID AirpcapClose(PAirpcapHandle AdapterHandle);
 
   the "link type" determines how the driver will encode the packets captured from the network.
   Aircap supports two link types:
-  - AIRPCAP_LT_802_11, to capture 802.11 frames (including control frames) without any
+  - \ref AIRPCAP_LT_802_11, to capture 802.11 frames (including control frames) without any
    power information. Look at the Capture_no_radio example application in the developer's pack
    for a reference on how to decode 802.11 frames with this link type.
-  - AIRPCAP_LT_802_11_PLUS_RADIO, to capture 802.11 frames (including control frames) with a radiotap header
-  that contains power and channel information. More information about the radiotap header can be found int the
+  - \ref AIRPCAP_LT_802_11_PLUS_RADIO, to capture 802.11 frames (including control frames) with a radiotap header
+  that contains power and channel information. More information about the radiotap header can be found in the
   \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 founf in the PPI online documentation (TODO).
 */
 BOOL AirpcapSetLinkType(PAirpcapHandle AdapterHandle, AirpcapLinkType NewLinkType);
 
@@ -402,16 +491,16 @@ BOOL AirpcapGetFcsValidation(PAirpcapHandle AdapterHandle, PAirpcapValidationTyp
   The AirPcap driver is able to use a set of decryption keys to decrypt the traffic transmitted on a specific SSID. If one of the
   keys corresponds to the one the frame has been encrypted with, the driver will perform decryption and return the cleartext frames
   to the application.
-  The driver supports, for every device, multiple keys at the same time.
 
-  At this time, the only supported decryption method is WEP.
+  This function allows to set the <b>adapter-specific</b> set of keys. These keys will be used by the specified adapter only,
+  and will not be used by other airpcap devices besides the specified one.
 
-  The configured decryption keys are device-specific: they will not be used by other airpcap devices besides the specified one.
+  At this time, the only supported decryption method is WEP.
 
   The keys are applied to the packets in the same order they appear in the KeysCollection structure until the packet is
   correctly decrypted, therefore putting frequently used keys at the beginning of the structure improves performance.
 
-  \note: this is a Device-related function: when you change the channel from an open capture instance, the change will be
+  \note: when you change the set of keys from an open capture instance, the change will be
          immediately reflected on all the other capture instances.
 */
 BOOL AirpcapSetDeviceKeys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection);
@@ -427,7 +516,9 @@ BOOL AirpcapSetDeviceKeys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection K
   needed KeysCollection length, in bytes. If the device doesn't have any decryption key configured, the return value is TRUE, and
   KeysCollectionSize will be zero.
 
-  This function returns the list of decryption keys in the driver that are associated with the specified device.
+  This function returns the <b>adapter-specific</b> set of keys. These keys are used by the specified adapter only,
+  and not by other airpcap devices besides the specified one.
+
   The AirPcap driver is able to use a set of decryption keys to decrypt the traffic transmitted on a specific SSID. If one of the
   keys corresponds to the one the frame has been encrypted with, the driver will perform decryption and return the cleartext frames
   to the application.
@@ -437,43 +528,107 @@ BOOL AirpcapSetDeviceKeys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection K
   when called on different devices.
 
   At this time, the only supported decryption method is WEP.
+*/
+BOOL AirpcapGetDeviceKeys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, PUINT PKeysCollectionSize);
+
+/*!
+  \brief Set the global list of decryption keys that the driver is going to use with all the devices.
+  \param AdapterHandle Handle an open adapter instance.
+  \param KeysCollection Pointer to a \ref PAirpcapKeysCollection structure that contains the keys to be set in the driver.
+  \return TRUE if the operation is successful. FALSE otherwise.
+
+  The AirPcap driver is able to use a set of decryption keys to decrypt the traffic transmitted on a specific SSID. If one of the
+  keys corresponds to the one the frame has been encrypted with, the driver will perform decryption and return the cleartext frames
+  to the application.
+
+  This function allows to set the <b>global driver</b> set of keys. These keys will be used by all the adapters plugged in
+  the machine.
+
+  At this time, the only supported decryption method is WEP.
+
+  The keys are applied to the packets in the same order they appear in the KeysCollection structure until the packet is
+  correctly decrypted, therefore putting frequently used keys at the beginning of the structure improves performance.
 
-  \note: this is a Device-related function: when you change the channel from an open capture instance, the change will be
+  \note: when you change the set of keys from an open capture instance, the change will be
          immediately reflected on all the other capture instances.
 */
-BOOL AirpcapGetDeviceKeys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, PUINT PKeysCollectionSize);
+BOOL AirpcapSetDriverKeys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection);
+
+/*!
+  \brief Returns the global list of decryption keys in the driver that are associated with all the devices.
+  \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.
+  \return TRUE if the operation is succesful. 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
+  KeysCollectionSize will be zero.
+
+  This function returns the <b>global driver</b> set of keys. These keys will be used by all the adapters plugged in
+  the machine.
+
+  The AirPcap driver is able to use a set of decryption keys to decrypt the traffic transmitted on a specific SSID. If one of the
+  keys corresponds to the one the frame has been encrypted with, the driver will perform decryption and return the cleartext frames
+  to the application.
+
+  At this time, the only supported decryption method is WEP.
+*/
+BOOL AirpcapGetDriverKeys(PAirpcapHandle AdapterHandle, PAirpcapKeysCollection KeysCollection, PUINT PKeysCollectionSize);
 
 /*!
-  \brief Turns on or off the decryption of the incoming frames
+  \brief Turns on or off the decryption of the incoming frames with the <b>adapter-specific</b> keys.
   \param AdapterHandle Handle to the adapter.
-  \param ValidationType Either \ref AIRPCAP_DECRYPTION_ON or \ref AIRPCAP_DECRYPTION_OFF
+  \param Enable Either \ref AIRPCAP_DECRYPTION_ON or \ref AIRPCAP_DECRYPTION_OFF
   \return TRUE on success.
 
-  The decryption keys can be configured with the \ref AirpcapSetDeviceKeys() function.
+  The adapter-specific decryption keys can be configured with the \ref AirpcapSetDeviceKeys() function.
   \note By default, the driver is configured with \ref AIRPCAP_DECRYPTION_ON.
 */
 BOOL AirpcapSetDecryptionState(PAirpcapHandle AdapterHandle, AirpcapDecryptionState Enable);
 
 /*!
-  \brief Tells if this open instance is configured to perform the decryption of the incoming frames
+  \brief Tells if this open instance is configured to perform the decryption of the incoming frames with the <b>adapter-specific</b> keys.
   \param AdapterHandle Handle to the adapter.
-  \param ValidationType Pointer to a user supplied variable that will contain the decryption configuration. See \ref PAirpcapDecryptionState for details.
+  \param PEnable Pointer to a user supplied variable that will contain the decryption configuration. See \ref PAirpcapDecryptionState for details.
   \return TRUE if the operation is succesful. FALSE otherwise.
 
-  The decryption keys can be configured with the \ref AirpcapSetDeviceKeys() function.
+  The adapter-specific decryption keys can be configured with the \ref AirpcapSetDeviceKeys() function.
   \note By default, the driver is configured with \ref AIRPCAP_DECRYPTION_ON.
 */
 BOOL AirpcapGetDecryptionState(PAirpcapHandle AdapterHandle, PAirpcapDecryptionState PEnable);
 
+/*!
+  \brief Turns on or off the decryption of the incoming frames with the <b>global driver</b> set of keys.
+  \param AdapterHandle Handle to the adapter.
+  \param Enable Either \ref AIRPCAP_DECRYPTION_ON or \ref AIRPCAP_DECRYPTION_OFF
+  \return TRUE on success.
+
+  The global decryption keys can be configured with the \ref AirpcapSetDriverKeys() function.
+  \note By default, the driver is configured with \ref AIRPCAP_DECRYPTION_ON.
+*/
+BOOL AirpcapSetDriverDecryptionState(PAirpcapHandle AdapterHandle, AirpcapDecryptionState Enable);
+
+/*!
+  \brief Tells if this open instance is configured to perform the decryption of the incoming frames with the <b>global driver</b> set of keys.
+  \param AdapterHandle Handle to the adapter.
+  \param PEnable Pointer to a user supplied variable that will contain the decryption configuration. See \ref PAirpcapDecryptionState for details.
+  \return TRUE if the operation is succesful. FALSE otherwise.
+
+  The global decryption keys can be configured with the \ref AirpcapSetDriverKeys() function.
+  \note By default, the driver is configured with \ref AIRPCAP_DECRYPTION_ON.
+*/
+BOOL AirpcapGetDriverDecryptionState(PAirpcapHandle AdapterHandle, PAirpcapDecryptionState PEnable);
+
 /*!
   \brief Set the radio channel of a device
   \param AdapterHandle Handle to the adapter.
   \param Channel the new channel to set.
   \return TRUE on success.
 
-  Valid channels are in the range 1-14. The default channel setting is 6.
+  The list of available channels can be retrieved with \ref AirpcapGetDeviceSupportedChannels(). The default channel setting is 6.
 
-  \note: this is a Device-related function: when you change the channel from an open capture instance, the change will be
+  \note this is a device-related function: when you change the channel from an open capture instance, the change will be
          immediately reflected on all the other capture instances.
 */
 BOOL AirpcapSetDeviceChannel(PAirpcapHandle AdapterHandle, UINT Channel);
@@ -484,9 +639,9 @@ BOOL AirpcapSetDeviceChannel(PAirpcapHandle AdapterHandle, UINT Channel);
   \param PChannel Pointer to a user-supplied variable into which the function will copy the currently configured radio channel.
   \return TRUE on success.
 
-  Valid channels are in the range 1-14. The default channel setting is 6.
+  The list of available channels can be retrieved with \ref AirpcapGetDeviceSupportedChannels(). The default channel setting is 6.
 
-  \note: this is a Device-related function: when you change the channel from an open capture instance, the change will be
+  \note this is a device-related function: when you change the channel from an open capture instance, the change will be
          immediately reflected on all the other capture instances.
 */
 BOOL AirpcapGetDeviceChannel(PAirpcapHandle AdapterHandle, PUINT PChannel);
@@ -502,8 +657,8 @@ BOOL AirpcapGetDeviceChannel(PAirpcapHandle AdapterHandle, PUINT PChannel);
   A bigger kernel buffer size decreases the risk of dropping packets during network bursts or when the
   application is busy, at the cost of higher kernel memory usage.
 
-  \note: don't use this function unless you know what you are doing. Due to chaching issues and bigger non-paged
-  memory consumption, Bigger buffer sizes can decrease the capture performace instead of improving it.
+  \note don't use this function unless you know what you are doing. Due to caching issues and bigger non-paged
+  memory consumption, bigger buffer sizes can decrease the capture performace instead of improving it.
 */
 BOOL AirpcapSetKernelBuffer(PAirpcapHandle AdapterHandle, UINT BufferSize);
 
@@ -632,6 +787,25 @@ BOOL AirpcapGetReadEvent(PAirpcapHandle AdapterHandle, HANDLE* PReadEvent);
 */
 BOOL AirpcapRead(PAirpcapHandle AdapterHandle, PBYTE Buffer, UINT BufSize, PUINT PReceievedBytes);
 
+/*!
+  \brief Transmits a packet.
+  \param AdapterHandle Handle to the adapter.
+  \param TxPacket Pointer to a buffer that contains the packet to be transmitted.
+  \param PacketLen Length of the buffer pointed by the TxPacket argument, in bytes.
+  \return TRUE on success.
+
+  The packet will be transmitted on the channel the device is currently set. To change the device adapter, use the
+  \ref AirpcapSetDeviceChannel() function.
+
+  If the linktype of the adapter is AIRPCAP_LT_802_11, the buffer pointed by TxPacket should contain just the 802.11
+  packet, without additional information. The packet will be transmitted at 1Mbps.
+
+  If the linktype of the adapter is AIRPCAP_LT_802_11_PLUS_RADIO, the buffer pointed by TxPacket should contain a radiotap
+  header followed by the 802.11 packet. AirpcapWrite will use the rate information in the radiotap header when
+  transmitting the packet.
+*/
+BOOL AirpcapWrite(PAirpcapHandle AdapterHandle, PCHAR TxPacket, ULONG PacketLen);
+
 /*!
   \brief Get per-adapter WinPcap-compatible capture statistics.
   \param AdapterHandle Handle to the adapter.
@@ -664,12 +838,70 @@ BOOL AirpcapTurnLedOn(PAirpcapHandle AdapterHandle, UINT LedNumber);
 */
 BOOL AirpcapTurnLedOff(PAirpcapHandle AdapterHandle, UINT LedNumber);
 
+/*!
+  \brief Set the channel of a device through its radio frequency. In case of 802.11n enabled devices, it sets the extension channel, if used.
+  \param AdapterHandle Handle to the adapter.
+  \param ChannelInfo The new channel information to set.
+  \return TRUE on success.
+
+  \note this is a device-related function: when you change the channel from an open capture instance, the change will be
+         immediately reflected on all the other capture instances.
+*/
+BOOL AirpcapSetDeviceChannelEx(PAirpcapHandle AdapterHandle, AirpcapChannelInfo ChannelInfo);
+
+/*!
+  \brief Get the channel of a device through its radiofrequency. In case of 802.11n enabled devices, it gets the extension channel, if in use.
+  \param AdapterHandle Handle to the adapter.
+  \param PChannelInfo Pointer to a user-supplied variable into which the function will copy the currently configured channel information.
+  \return TRUE on success.
+
+  \note this is a device-related function: when you change the channel from an open capture instance, the change will be
+         immediately reflected on all the other capture instances.
+*/
+BOOL AirpcapGetDeviceChannelEx(PAirpcapHandle AdapterHandle, PAirpcapChannelInfo PChannelInfo);
+
+/*!
+  \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.
+  \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.
+  \return TRUE on success.
+
+  \note The supported channels are not listed in any specific order.
+*/
+BOOL AirpcapGetDeviceSupportedChannels(PAirpcapHandle AdapterHandle, PAirpcapChannelInfo *ppChannelInfo, PUINT pNumChannelInfo);
+
+/*!
+  \brief Converts a given frequency to the corresponding channel.
+
+  \param Frequency Frequency of the channel, in MHz.
+  \param PChannel Pointer to a user-supplied variable that will contain the channel number on success.
+  \param PBand Pointer to a user-supplied variable that will contain the band (a or b/g) of the given channel.
+  \return TRUE on success, i.e. the frequency corresponds to a valid a or b/g channel.
+*/
+BOOL AirpcapConvertFrequencyToChannel(UINT Frequency, PUINT PChannel, PAirpcapChannelBand PBand);
+
+/*!
+  \brief Converts a given channel to the corresponding frequency.
+
+  \param Channel Channel number to be converted.
+  \param PFrequency Pointer to a user-supplied variable that will contain the channel frequency in MHz on success.
+  \return TRUE on success, i.e. the given channel number exists.
+*/
+BOOL AirpcapConvertChannelToFrequency(UINT Channel, PUINT PFrequency);
+
+
 /*@}*/
 
-#endif /* __AIRPCAP_DRIVER__ */
+#endif // __AIRPCAP_DRIVER__
 
 #ifdef __cplusplus
 }
 #endif
 
-#endif /* !defined(AIRPCAP_H__EAE405F5_0171_9592_B3C2_C19EC426AD34__INCLUDED_) */
+#endif // !defined(AIRPCAP_H__EAE405F5_0171_9592_B3C2_C19EC426AD34__INCLUDED_)