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 ******************************************************************************/
  15#ifndef __WLAN_BSSDEF_H__
  16#define __WLAN_BSSDEF_H__
  17
  18
  19#define MAX_IE_SZ                       768
  20
  21#define NDIS_802_11_LENGTH_SSID         32
  22#define NDIS_802_11_LENGTH_RATES        8
  23#define NDIS_802_11_LENGTH_RATES_EX     16
  24
  25#define NDIS_802_11_RSSI long           /*  in dBm */
  26
  27struct ndis_802_11_ssid {
  28        u32  SsidLength;
  29        u8  Ssid[32];
  30};
  31
  32enum NDIS_802_11_NETWORK_TYPE {
  33        Ndis802_11FH,
  34        Ndis802_11DS,
  35        Ndis802_11OFDM5,
  36        Ndis802_11OFDM24,
  37        Ndis802_11NetworkTypeMax    /*  dummy upper bound */
  38};
  39
  40struct ndis_802_11_config_fh {
  41        u32           Length;           /*  Length of structure */
  42        u32           HopPattern;       /*  As defined by 802.11, MSB set */
  43        u32           HopSet;           /*  to one if non-802.11 */
  44        u32           DwellTime;        /*  units are Kusec */
  45};
  46
  47/*
  48 *      FW will only save the channel number in DSConfig.
  49 *      ODI Handler will convert the channel number to freq. number.
  50 */
  51struct ndis_802_11_config {
  52        u32           Length;             /*  Length of structure */
  53        u32           BeaconPeriod;       /*  units are Kusec */
  54        u32           ATIMWindow;         /*  units are Kusec */
  55        u32           DSConfig;           /*  Frequency, units are kHz */
  56        struct ndis_802_11_config_fh    FHConfig;
  57};
  58
  59enum ndis_802_11_network_infra {
  60        Ndis802_11IBSS,
  61        Ndis802_11Infrastructure,
  62        Ndis802_11AutoUnknown,
  63        Ndis802_11InfrastructureMax,     /*  dummy upper bound */
  64        Ndis802_11APMode
  65};
  66
  67struct ndis_802_11_fixed_ie {
  68        u8  Timestamp[8];
  69        u16  BeaconInterval;
  70        u16  Capabilities;
  71};
  72
  73
  74
  75struct ndis_802_11_var_ie {
  76        u8  ElementID;
  77        u8  Length;
  78        u8  data[1];
  79};
  80
  81/*
  82 * Length is the 4 bytes multiples of the sume of
  83 *      [ETH_ALEN] + 2 + sizeof (struct ndis_802_11_ssid) + sizeof (u32)
  84 *      + sizeof (NDIS_802_11_RSSI) + sizeof (enum NDIS_802_11_NETWORK_TYPE)
  85 *      + sizeof (struct ndis_802_11_config)
  86 *      + NDIS_802_11_LENGTH_RATES_EX + ie_length
  87 *
  88 * Except the ie_length, all other fields are fixed length.
  89 * Therefore, we can define a macro to represent the partial sum.
  90 */
  91
  92enum ndis_802_11_auth_mode {
  93        Ndis802_11AuthModeOpen,
  94        Ndis802_11AuthModeShared,
  95        Ndis802_11AuthModeAutoSwitch,
  96        Ndis802_11AuthModeWPA,
  97        Ndis802_11AuthModeWPAPSK,
  98        Ndis802_11AuthModeWPANone,
  99        Ndis802_11AuthModeWAPI,
 100        Ndis802_11AuthModeMax   /*  Not a real mode, upper bound */
 101};
 102
 103enum ndis_802_11_wep_status {
 104        Ndis802_11WEPEnabled,
 105        Ndis802_11Encryption1Enabled = Ndis802_11WEPEnabled,
 106        Ndis802_11WEPDisabled,
 107        Ndis802_11EncryptionDisabled = Ndis802_11WEPDisabled,
 108        Ndis802_11WEPKeyAbsent,
 109        Ndis802_11Encryption1KeyAbsent = Ndis802_11WEPKeyAbsent,
 110        Ndis802_11WEPNotSupported,
 111        Ndis802_11EncryptionNotSupported = Ndis802_11WEPNotSupported,
 112        Ndis802_11Encryption2Enabled,
 113        Ndis802_11Encryption2KeyAbsent,
 114        Ndis802_11Encryption3Enabled,
 115        Ndis802_11Encryption3KeyAbsent,
 116        Ndis802_11_EncryptionWAPI
 117};
 118
 119#define NDIS_802_11_AI_REQFI_CAPABILITIES      1
 120#define NDIS_802_11_AI_REQFI_LISTENINTERVAL    2
 121#define NDIS_802_11_AI_REQFI_CURRENTAPADDRESS  4
 122
 123#define NDIS_802_11_AI_RESFI_CAPABILITIES      1
 124#define NDIS_802_11_AI_RESFI_STATUSCODE        2
 125#define NDIS_802_11_AI_RESFI_ASSOCIATIONID     4
 126
 127enum ndis_802_11_reload_def {
 128        Ndis802_11ReloadWEPKeys
 129};
 130
 131struct ndis_802_11_wep {
 132        u32     Length;        /*  Length of this structure */
 133        u32     KeyIndex;      /*  0 is the per-client key,
 134                                * 1-N are the global keys
 135                                */
 136        u32     KeyLength;     /*  length of key in bytes */
 137        u8     KeyMaterial[16];/*  variable len depending on above field */
 138};
 139
 140enum ndis_802_11_status_type {
 141        Ndis802_11StatusType_Authentication,
 142        Ndis802_11StatusType_MediaStreamMode,
 143        Ndis802_11StatusType_PMKID_CandidateList,
 144        Ndis802_11StatusTypeMax    /*  not a real type, defined as
 145                                    * an upper bound
 146                                    */
 147};
 148
 149/*  mask for authentication/integrity fields */
 150#define NDIS_802_11_AUTH_REQUEST_AUTH_FIELDS            0x0f
 151#define NDIS_802_11_AUTH_REQUEST_REAUTH                 0x01
 152#define NDIS_802_11_AUTH_REQUEST_KEYUPDATE              0x02
 153#define NDIS_802_11_AUTH_REQUEST_PAIRWISE_ERROR         0x06
 154#define NDIS_802_11_AUTH_REQUEST_GROUP_ERROR            0x0E
 155
 156/*  MIC check time, 60 seconds. */
 157#define MIC_CHECK_TIME  60000000
 158
 159#ifndef Ndis802_11APMode
 160#define Ndis802_11APMode (Ndis802_11InfrastructureMax+1)
 161#endif
 162
 163struct wlan_phy_info {
 164        u8      SignalStrength;/* in percentage) */
 165        u8      SignalQuality;/* in percentage) */
 166        u8      Optimum_antenna;  /* for Antenna diversity */
 167        u8      Reserved_0;
 168};
 169
 170struct wlan_bcn_info {
 171        /* these infor get from rtw_get_encrypt_info when
 172         *       * translate scan to UI
 173         */
 174        u8 encryp_protocol;/* ENCRYP_PROTOCOL_E: OPEN/WEP/WPA/WPA2/WAPI */
 175        int group_cipher; /* WPA/WPA2 group cipher */
 176        int pairwise_cipher;/* WPA/WPA2/WEP pairwise cipher */
 177        int is_8021x;
 178
 179        /* bwmode 20/40 and ch_offset UP/LOW */
 180        unsigned short  ht_cap_info;
 181        unsigned char   ht_info_infos_0;
 182};
 183
 184/* temporally add #pragma pack for structure alignment issue of
 185 *   struct wlan_bssid_ex and get_struct wlan_bssid_ex_sz()
 186 */
 187struct wlan_bssid_ex {
 188        u32  Length;
 189        unsigned char MacAddress[ETH_ALEN];
 190        u8  Reserved[2];/* 0]: IS beacon frame */
 191        struct ndis_802_11_ssid  Ssid;
 192        u32  Privacy;
 193        NDIS_802_11_RSSI  Rssi;/* in dBM,raw data ,get from PHY) */
 194        enum  NDIS_802_11_NETWORK_TYPE  NetworkTypeInUse;
 195        struct ndis_802_11_config  Configuration;
 196        enum ndis_802_11_network_infra  InfrastructureMode;
 197        unsigned char SupportedRates[NDIS_802_11_LENGTH_RATES_EX];
 198        struct wlan_phy_info    PhyInfo;
 199        u32  ie_length;
 200        u8  ies[MAX_IE_SZ];     /* timestamp, beacon interval, and
 201                                 * capability information)
 202                                 */
 203} __packed;
 204
 205static inline uint get_wlan_bssid_ex_sz(struct wlan_bssid_ex *bss)
 206{
 207        return sizeof(struct wlan_bssid_ex) - MAX_IE_SZ + bss->ie_length;
 208}
 209
 210struct  wlan_network {
 211        struct list_head list;
 212        int     network_type;   /* refer to ieee80211.h for WIRELESS_11A/B/G */
 213        int     fixed;          /*  set fixed when not to be removed
 214                                 *  in site-surveying
 215                                 */
 216        unsigned long   last_scanned; /* timestamp for the network */
 217        int     aid;            /* will only be valid when a BSS is joinned. */
 218        int     join_res;
 219        struct wlan_bssid_ex    network; /* must be the last item */
 220        struct wlan_bcn_info    BcnInfo;
 221};
 222
 223enum VRTL_CARRIER_SENSE {
 224        DISABLE_VCS,
 225        ENABLE_VCS,
 226        AUTO_VCS
 227};
 228
 229enum VCS_TYPE {
 230        NONE_VCS,
 231        RTS_CTS,
 232        CTS_TO_SELF
 233};
 234
 235#define PWR_CAM 0
 236#define PWR_MINPS 1
 237#define PWR_MAXPS 2
 238#define PWR_UAPSD 3
 239#define PWR_VOIP 4
 240
 241enum UAPSD_MAX_SP {
 242        NO_LIMIT,
 243        TWO_MSDU,
 244        FOUR_MSDU,
 245        SIX_MSDU
 246};
 247
 248#define NUM_PRE_AUTH_KEY 16
 249#define NUM_PMKID_CACHE NUM_PRE_AUTH_KEY
 250
 251#endif /* ifndef WLAN_BSSDEF_H_ */
 252