linux/drivers/staging/rtl8188eu/include/wlan_bssdef.h
<<
>>
Prefs
   1/******************************************************************************
   2 *
   3 * Copyright(c) 2007 - 2011 Realtek Corporation. All rights reserved.
   4 *
   5 * This program is free software; you can redistribute it and/or modify it
   6 * under the terms of version 2 of the GNU General Public License as
   7 * published by the Free Software Foundation.
   8 *
   9 * This program is distributed in the hope that it will be useful, but WITHOUT
  10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  12 * more details.
  13 *
  14 * You should have received a copy of the GNU General Public License along with
  15 * this program; if not, write to the Free Software Foundation, Inc.,
  16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
  17 *
  18 *
  19 ******************************************************************************/
  20#ifndef __WLAN_BSSDEF_H__
  21#define __WLAN_BSSDEF_H__
  22
  23
  24#define MAX_IE_SZ                       768
  25
  26#define NDIS_802_11_LENGTH_SSID         32
  27#define NDIS_802_11_LENGTH_RATES        8
  28#define NDIS_802_11_LENGTH_RATES_EX     16
  29
  30#define NDIS_802_11_RSSI long           /*  in dBm */
  31
  32struct ndis_802_11_ssid {
  33        u32  SsidLength;
  34        u8  Ssid[32];
  35};
  36
  37enum NDIS_802_11_NETWORK_TYPE {
  38        Ndis802_11FH,
  39        Ndis802_11DS,
  40        Ndis802_11OFDM5,
  41        Ndis802_11OFDM24,
  42        Ndis802_11NetworkTypeMax    /*  dummy upper bound */
  43};
  44
  45struct ndis_802_11_config_fh {
  46        u32           Length;           /*  Length of structure */
  47        u32           HopPattern;       /*  As defined by 802.11, MSB set */
  48        u32           HopSet;           /*  to one if non-802.11 */
  49        u32           DwellTime;        /*  units are Kusec */
  50};
  51
  52/*
  53 *      FW will only save the channel number in DSConfig.
  54 *      ODI Handler will convert the channel number to freq. number.
  55 */
  56struct ndis_802_11_config {
  57        u32           Length;             /*  Length of structure */
  58        u32           BeaconPeriod;       /*  units are Kusec */
  59        u32           ATIMWindow;         /*  units are Kusec */
  60        u32           DSConfig;           /*  Frequency, units are kHz */
  61        struct ndis_802_11_config_fh    FHConfig;
  62};
  63
  64enum ndis_802_11_network_infra {
  65        Ndis802_11IBSS,
  66        Ndis802_11Infrastructure,
  67        Ndis802_11AutoUnknown,
  68        Ndis802_11InfrastructureMax,     /*  dummy upper bound */
  69        Ndis802_11APMode
  70};
  71
  72struct ndis_802_11_fixed_ie {
  73        u8  Timestamp[8];
  74        u16  BeaconInterval;
  75        u16  Capabilities;
  76};
  77
  78
  79
  80struct ndis_802_11_var_ie {
  81        u8  ElementID;
  82        u8  Length;
  83        u8  data[1];
  84};
  85
  86/*
  87 * Length is the 4 bytes multiples of the sume of
  88 *      [ETH_ALEN] + 2 + sizeof (struct ndis_802_11_ssid) + sizeof (u32)
  89 *      + sizeof (NDIS_802_11_RSSI) + sizeof (enum NDIS_802_11_NETWORK_TYPE)
  90 *      + sizeof (struct ndis_802_11_config)
  91 *      + NDIS_802_11_LENGTH_RATES_EX + IELength
  92 *
  93 * Except the IELength, all other fields are fixed length.
  94 * Therefore, we can define a macro to represent the partial sum. */
  95
  96enum ndis_802_11_auth_mode {
  97        Ndis802_11AuthModeOpen,
  98        Ndis802_11AuthModeShared,
  99        Ndis802_11AuthModeAutoSwitch,
 100        Ndis802_11AuthModeWPA,
 101        Ndis802_11AuthModeWPAPSK,
 102        Ndis802_11AuthModeWPANone,
 103        Ndis802_11AuthModeWAPI,
 104        Ndis802_11AuthModeMax   /*  Not a real mode, upper bound */
 105};
 106
 107enum ndis_802_11_wep_status {
 108        Ndis802_11WEPEnabled,
 109        Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
 110        Ndis802_11WEPDisabled,
 111        Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
 112        Ndis802_11WEPKeyAbsent,
 113        Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
 114        Ndis802_11WEPNotSupported,
 115        Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
 116        Ndis802_11Encryption2Enabled,
 117        Ndis802_11Encryption2KeyAbsent,
 118        Ndis802_11Encryption3Enabled,
 119        Ndis802_11Encryption3KeyAbsent,
 120        Ndis802_11_EncryptionWAPI
 121};
 122
 123#define NDIS_802_11_AI_REQFI_CAPABILITIES      1
 124#define NDIS_802_11_AI_REQFI_LISTENINTERVAL    2
 125#define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS  4
 126
 127#define NDIS_802_11_AI_RESFI_CAPABILITIES      1
 128#define NDIS_802_11_AI_RESFI_STATUSCODE        2
 129#define NDIS_802_11_AI_RESFI_ASSOCIATIONID     4
 130
 131struct ndis_802_11_ai_reqfi {
 132    u16 Capabilities;
 133    u16 ListenInterval;
 134    unsigned char CurrentAPAddress[ETH_ALEN];
 135};
 136
 137struct ndis_802_11_ai_resfi {
 138    u16 Capabilities;
 139    u16 StatusCode;
 140    u16 AssociationId;
 141};
 142
 143struct ndis_802_11_assoc_info {
 144        u32  Length;
 145        u16 AvailableRequestFixedIEs;
 146        struct ndis_802_11_ai_reqfi    RequestFixedIEs;
 147        u32  RequestIELength;
 148        u32  OffsetRequestIEs;
 149        u16 AvailableResponseFixedIEs;
 150        struct ndis_802_11_ai_resfi    ResponseFixedIEs;
 151        u32  ResponseIELength;
 152        u32  OffsetResponseIEs;
 153};
 154
 155enum ndis_802_11_reload_def {
 156        Ndis802_11ReloadWEPKeys
 157};
 158
 159struct ndis_802_11_remove_key {
 160        u32                   Length;        /*  Length */
 161        u32                   KeyIndex;
 162        unsigned char BSSID[ETH_ALEN];
 163};
 164
 165struct ndis_802_11_wep {
 166        u32     Length;        /*  Length of this structure */
 167        u32     KeyIndex;      /*  0 is the per-client key,
 168                                  * 1-N are the global keys */
 169        u32     KeyLength;     /*  length of key in bytes */
 170        u8     KeyMaterial[16];/*  variable len depending on above field */
 171};
 172
 173struct ndis_802_11_auth_req {
 174        u32 Length;            /*  Length of structure */
 175        unsigned char Bssid[ETH_ALEN];
 176        u32 Flags;
 177};
 178
 179enum ndis_802_11_status_type {
 180        Ndis802_11StatusType_Authentication,
 181        Ndis802_11StatusType_MediaStreamMode,
 182        Ndis802_11StatusType_PMKID_CandidateList,
 183        Ndis802_11StatusTypeMax    /*  not a real type, defined as
 184                                    * an upper bound */
 185};
 186
 187struct ndis_802_11_status_ind {
 188        enum ndis_802_11_status_type StatusType;
 189};
 190
 191/*  mask for authentication/integrity fields */
 192#define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS            0x0f
 193#define NDIS_802_11_AUTH_REQUEST_REAUTH                 0x01
 194#define NDIS_802_11_AUTH_REQUEST_KEYUPDATE              0x02
 195#define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR         0x06
 196#define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR            0x0E
 197
 198/*  MIC check time, 60 seconds. */
 199#define MIC_CHECK_TIME  60000000
 200
 201struct ndis_802_11_auth_evt {
 202        struct ndis_802_11_status_ind       Status;
 203        struct ndis_802_11_auth_req  Request[1];
 204};
 205
 206struct ndis_802_11_test {
 207        u32 Length;
 208        u32 Type;
 209        union {
 210                struct ndis_802_11_auth_evt AuthenticationEvent;
 211                NDIS_802_11_RSSI RssiTrigger;
 212        } tt;
 213};
 214
 215
 216#ifndef Ndis802_11APMode
 217#define Ndis802_11APMode (Ndis802_11InfrastructureMax+1)
 218#endif
 219
 220struct wlan_phy_info {
 221        u8      SignalStrength;/* in percentage) */
 222        u8      SignalQuality;/* in percentage) */
 223        u8      Optimum_antenna;  /* for Antenna diversity */
 224        u8      Reserved_0;
 225};
 226
 227struct wlan_bcn_info {
 228        /* these infor get from rtw_get_encrypt_info when
 229         *       * translate scan to UI */
 230        u8 encryp_protocol;/* ENCRYP_PROTOCOL_E: OPEN/WEP/WPA/WPA2/WAPI */
 231        int group_cipher; /* WPA/WPA2 group cipher */
 232        int pairwise_cipher;/* WPA/WPA2/WEP pairwise cipher */
 233        int is_8021x;
 234
 235        /* bwmode 20/40 and ch_offset UP/LOW */
 236        unsigned short  ht_cap_info;
 237        unsigned char   ht_info_infos_0;
 238};
 239
 240/* temporally add #pragma pack for structure alignment issue of
 241*   struct wlan_bssid_ex and get_struct wlan_bssid_ex_sz()
 242*/
 243struct wlan_bssid_ex {
 244        u32  Length;
 245        unsigned char MacAddress[ETH_ALEN];
 246        u8  Reserved[2];/* 0]: IS beacon frame */
 247        struct ndis_802_11_ssid  Ssid;
 248        u32  Privacy;
 249        NDIS_802_11_RSSI  Rssi;/* in dBM,raw data ,get from PHY) */
 250        enum  NDIS_802_11_NETWORK_TYPE  NetworkTypeInUse;
 251        struct ndis_802_11_config  Configuration;
 252        enum ndis_802_11_network_infra  InfrastructureMode;
 253        unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
 254        struct wlan_phy_info    PhyInfo;
 255        u32  IELength;
 256        u8  IEs[MAX_IE_SZ];     /* timestamp, beacon interval, and
 257                                 * capability information) */
 258} __packed;
 259
 260static inline uint get_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss)
 261{
 262        return sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + bss->IELength;
 263}
 264
 265struct  wlan_network {
 266        struct list_head list;
 267        int     network_type;   /* refer to ieee80211.h for WIRELESS_11A/B/G */
 268        int     fixed;          /*  set fixed when not to be removed
 269                                 *  in site-surveying */
 270        unsigned long   last_scanned; /* timestamp for the network */
 271        int     aid;            /* will only be valid when a BSS is joinned. */
 272        int     join_res;
 273        struct wlan_bssid_ex    network; /* must be the last item */
 274        struct wlan_bcn_info    BcnInfo;
 275};
 276
 277enum VRTL_CARRIER_SENSE {
 278        DISABLE_VCS,
 279        ENABLE_VCS,
 280        AUTO_VCS
 281};
 282
 283enum VCS_TYPE {
 284        NONE_VCS,
 285        RTS_CTS,
 286        CTS_TO_SELF
 287};
 288
 289#define PWR_CAM 0
 290#define PWR_MINPS 1
 291#define PWR_MAXPS 2
 292#define PWR_UAPSD 3
 293#define PWR_VOIP 4
 294
 295enum UAPSD_MAX_SP {
 296        NO_LIMIT,
 297        TWO_MSDU,
 298        FOUR_MSDU,
 299        SIX_MSDU
 300};
 301
 302#define NUM_PRE_AUTH_KEY 16
 303#define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY
 304
 305/*
 306*       WPA2
 307*/
 308
 309struct pmkid_candidate {
 310        unsigned char BSSID[ETH_ALEN];
 311        u32 Flags;
 312};
 313
 314struct ndis_802_11_pmkid_list {
 315        u32 Version;       /*  Version of the structure */
 316        u32 NumCandidates; /*  No. of pmkid candidates */
 317        struct pmkid_candidate CandidateList[1];
 318};
 319
 320struct ndis_802_11_auth_encrypt {
 321        enum ndis_802_11_auth_mode AuthModeSupported;
 322        enum ndis_802_11_wep_status EncryptStatusSupported;
 323};
 324
 325struct ndis_802_11_cap {
 326        u32  Length;
 327        u32  Version;
 328        u32  NoOfPMKIDs;
 329        u32  NoOfAuthEncryptPairsSupported;
 330        struct ndis_802_11_auth_encrypt AuthenticationEncryptionSupported[1];
 331};
 332
 333#endif /* ifndef WLAN_BSSDEF_H_ */
 334