tolerate additional IPv4 address now available for gnunet.org
[oweals/gnunet.git] / src / transport / ieee80211_radiotap.h
index bfcc2180c6f1383d82340a9442d30b4c6a1ac996..ed1cd69dde81331db09075cae7bbfaf2d3c70918 100644 (file)
@@ -37,7 +37,7 @@
 
 #include <linux/if_ether.h>
 #include <linux/kernel.h>
-//#include <asm/unaligned.h>
+// #include <asm/unaligned.h>
 
 /* Base version of the radiotap packet header data */
 #define PKTHDR_RADIOTAP_VERSION                0
  * The radio capture header precedes the 802.11 header.
  * All data in the header is little endian on all platforms.
  */
-struct ieee80211_radiotap_header {
-       u8 it_version;          /* Version 0. Only increases
-                                * for drastic changes,
-                                * introduction of compatible
-                                * new fields does not count.
-                                */
-       u8 it_pad;
-       __le16 it_len;          /* length of the whole
-                                * header in bytes, including
-                                * it_version, it_pad,
-                                * it_len, and data fields.
-                                */
-       __le32 it_present;      /* A bitmap telling which
-                                * fields are present. Set bit 31
-                                * (0x80000000) to extend the
-                                * bitmap by another 32 bits.
-                                * Additional extensions are made
-                                * by setting bit 31.
-                                */
+struct ieee80211_radiotap_header
+{
+  u8 it_version;                /* Version 0. Only increases
+                                 * for drastic changes,
+                                 * introduction of compatible
+                                 * new fields does not count.
+                                 */
+  u8 it_pad;
+  __le16 it_len;                /* length of the whole
+                                 * header in bytes, including
+                                 * it_version, it_pad,
+                                 * it_len, and data fields.
+                                 */
+  __le32 it_present;            /* A bitmap telling which
+                                 * fields are present. Set bit 31
+                                 * (0x80000000) to extend the
+                                 * bitmap by another 32 bits.
+                                 * Additional extensions are made
+                                 * by setting bit 31.
+                                 */
 } __packed;
 
 /* Name                                 Data type    Units
@@ -179,71 +180,72 @@ struct ieee80211_radiotap_header {
  *     Number of unicast retries a transmitted frame used.
  *
  */
-enum ieee80211_radiotap_type {
-       IEEE80211_RADIOTAP_TSFT = 0,
-       IEEE80211_RADIOTAP_FLAGS = 1,
-       IEEE80211_RADIOTAP_RATE = 2,
-       IEEE80211_RADIOTAP_CHANNEL = 3,
-       IEEE80211_RADIOTAP_FHSS = 4,
-       IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5,
-       IEEE80211_RADIOTAP_DBM_ANTNOISE = 6,
-       IEEE80211_RADIOTAP_LOCK_QUALITY = 7,
-       IEEE80211_RADIOTAP_TX_ATTENUATION = 8,
-       IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9,
-       IEEE80211_RADIOTAP_DBM_TX_POWER = 10,
-       IEEE80211_RADIOTAP_ANTENNA = 11,
-       IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
-       IEEE80211_RADIOTAP_DB_ANTNOISE = 13,
-       IEEE80211_RADIOTAP_RX_FLAGS = 14,
-       IEEE80211_RADIOTAP_TX_FLAGS = 15,
-       IEEE80211_RADIOTAP_RTS_RETRIES = 16,
-       IEEE80211_RADIOTAP_DATA_RETRIES = 17,
+enum ieee80211_radiotap_type
+{
+  IEEE80211_RADIOTAP_TSFT = 0,
+  IEEE80211_RADIOTAP_FLAGS = 1,
+  IEEE80211_RADIOTAP_RATE = 2,
+  IEEE80211_RADIOTAP_CHANNEL = 3,
+  IEEE80211_RADIOTAP_FHSS = 4,
+  IEEE80211_RADIOTAP_DBM_ANTSIGNAL = 5,
+  IEEE80211_RADIOTAP_DBM_ANTNOISE = 6,
+  IEEE80211_RADIOTAP_LOCK_QUALITY = 7,
+  IEEE80211_RADIOTAP_TX_ATTENUATION = 8,
+  IEEE80211_RADIOTAP_DB_TX_ATTENUATION = 9,
+  IEEE80211_RADIOTAP_DBM_TX_POWER = 10,
+  IEEE80211_RADIOTAP_ANTENNA = 11,
+  IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
+  IEEE80211_RADIOTAP_DB_ANTNOISE = 13,
+  IEEE80211_RADIOTAP_RX_FLAGS = 14,
+  IEEE80211_RADIOTAP_TX_FLAGS = 15,
+  IEEE80211_RADIOTAP_RTS_RETRIES = 16,
+  IEEE80211_RADIOTAP_DATA_RETRIES = 17,
 
-       /* valid in every it_present bitmap, even vendor namespaces */
-       IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29,
-       IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30,
-       IEEE80211_RADIOTAP_EXT = 31
+  /* valid in every it_present bitmap, even vendor namespaces */
+  IEEE80211_RADIOTAP_RADIOTAP_NAMESPACE = 29,
+  IEEE80211_RADIOTAP_VENDOR_NAMESPACE = 30,
+  IEEE80211_RADIOTAP_EXT = 31
 };
 
 /* Channel flags. */
-#define        IEEE80211_CHAN_TURBO    0x0010  /* Turbo channel */
-#define        IEEE80211_CHAN_CCK      0x0020  /* CCK channel */
-#define        IEEE80211_CHAN_OFDM     0x0040  /* OFDM channel */
-#define        IEEE80211_CHAN_2GHZ     0x0080  /* 2 GHz spectrum channel. */
-#define        IEEE80211_CHAN_5GHZ     0x0100  /* 5 GHz spectrum channel */
-#define        IEEE80211_CHAN_PASSIVE  0x0200  /* Only passive scan allowed */
-#define        IEEE80211_CHAN_DYN      0x0400  /* Dynamic CCK-OFDM channel */
-#define        IEEE80211_CHAN_GFSK     0x0800  /* GFSK channel (FHSS PHY) */
+#define        IEEE80211_CHAN_TURBO    0x0010  /* Turbo channel */
+#define        IEEE80211_CHAN_CCK      0x0020  /* CCK channel */
+#define        IEEE80211_CHAN_OFDM     0x0040  /* OFDM channel */
+#define        IEEE80211_CHAN_2GHZ     0x0080  /* 2 GHz spectrum channel. */
+#define        IEEE80211_CHAN_5GHZ     0x0100  /* 5 GHz spectrum channel */
+#define        IEEE80211_CHAN_PASSIVE  0x0200  /* Only passive scan allowed */
+#define        IEEE80211_CHAN_DYN      0x0400  /* Dynamic CCK-OFDM channel */
+#define        IEEE80211_CHAN_GFSK     0x0800  /* GFSK channel (FHSS PHY) */
 
 /* For IEEE80211_RADIOTAP_FLAGS */
-#define        IEEE80211_RADIOTAP_F_CFP        0x01    /* sent/received
-                                                * during CFP
-                                                */
-#define        IEEE80211_RADIOTAP_F_SHORTPRE   0x02    /* sent/received
-                                                * with short
-                                                * preamble
-                                                */
-#define        IEEE80211_RADIOTAP_F_WEP        0x04    /* sent/received
-                                                * with WEP encryption
-                                                */
-#define        IEEE80211_RADIOTAP_F_FRAG       0x08    /* sent/received
-                                                * with fragmentation
-                                                */
-#define        IEEE80211_RADIOTAP_F_FCS        0x10    /* frame includes FCS */
-#define        IEEE80211_RADIOTAP_F_DATAPAD    0x20    /* frame has padding between
-                                                * 802.11 header and payload
-                                                * (to 32-bit boundary)
-                                                */
-#define IEEE80211_RADIOTAP_F_BADFCS    0x40    /* bad FCS */
+#define        IEEE80211_RADIOTAP_F_CFP        0x01    /* sent/received
+                                                 * during CFP
+                                                 */
+#define        IEEE80211_RADIOTAP_F_SHORTPRE   0x02    /* sent/received
+                                                 * with short
+                                                 * preamble
+                                                 */
+#define        IEEE80211_RADIOTAP_F_WEP        0x04    /* sent/received
+                                                 * with WEP encryption
+                                                 */
+#define        IEEE80211_RADIOTAP_F_FRAG       0x08    /* sent/received
+                                                 * with fragmentation
+                                                 */
+#define        IEEE80211_RADIOTAP_F_FCS        0x10    /* frame includes FCS */
+#define        IEEE80211_RADIOTAP_F_DATAPAD    0x20    /* frame has padding between
+                                                 * 802.11 header and payload
+                                                 * (to 32-bit boundary)
+                                                 */
+#define IEEE80211_RADIOTAP_F_BADFCS    0x40    /* bad FCS */
 
 /* For IEEE80211_RADIOTAP_RX_FLAGS */
-#define IEEE80211_RADIOTAP_F_RX_BADPLCP        0x0002  /* frame has bad PLCP */
+#define IEEE80211_RADIOTAP_F_RX_BADPLCP        0x0002  /* frame has bad PLCP */
 
 /* For IEEE80211_RADIOTAP_TX_FLAGS */
-#define IEEE80211_RADIOTAP_F_TX_FAIL   0x0001  /* failed due to excessive
-                                                * retries */
-#define IEEE80211_RADIOTAP_F_TX_CTS    0x0002  /* used cts 'protection' */
-#define IEEE80211_RADIOTAP_F_TX_RTS    0x0004  /* used rts/cts handshake */
+#define IEEE80211_RADIOTAP_F_TX_FAIL   0x0001  /* failed due to excessive
+                                                 * retries */
+#define IEEE80211_RADIOTAP_F_TX_CTS    0x0002  /* used cts 'protection' */
+#define IEEE80211_RADIOTAP_F_TX_RTS    0x0004  /* used rts/cts handshake */
 
 /* Ugly macro to convert literal channel numbers into their mhz equivalents
  * There are certianly some conditions that will break this (like feeding it '30')
@@ -254,12 +256,20 @@ enum ieee80211_radiotap_type {
        ((x) + 1000) * 5)
 
 /* helpers */
-static inline int ieee80211_get_radiotap_len(unsigned char *data)
+static inline u16
+get_unaligned_le16 (const u8 *p)
+{
+  return p[0] | p[1] << 8;
+}
+
+
+static inline int
+ieee80211_get_radiotap_len (unsigned char *data)
 {
-       struct ieee80211_radiotap_header *hdr =
-               (struct ieee80211_radiotap_header *)data;
+  struct ieee80211_radiotap_header *hdr =
+      (struct ieee80211_radiotap_header *) data;
 
-       return get_unaligned_le16(&hdr->it_len);
+  return get_unaligned_le16 ((const u8 *) &hdr->it_len);
 }
 
-#endif                         /* IEEE80211_RADIOTAP_H */
+#endif /* IEEE80211_RADIOTAP_H */