Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 1 | /* Copyright (C) 2006, Red Hat, Inc. */ |
| 2 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 3 | #ifndef _LBS_ASSOC_H_ |
| 4 | #define _LBS_ASSOC_H_ |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 5 | |
Holger Schurig | 2d46502 | 2009-10-22 15:30:48 +0200 | [diff] [blame] | 6 | |
| 7 | #include "defs.h" |
| 8 | #include "host.h" |
| 9 | |
| 10 | |
| 11 | struct lbs_private; |
| 12 | |
| 13 | /* |
| 14 | * In theory, the IE is limited to the IE length, 255, |
| 15 | * but in practice 64 bytes are enough. |
| 16 | */ |
| 17 | #define MAX_WPA_IE_LEN 64 |
| 18 | |
| 19 | |
| 20 | |
| 21 | struct lbs_802_11_security { |
| 22 | u8 WPAenabled; |
| 23 | u8 WPA2enabled; |
| 24 | u8 wep_enabled; |
| 25 | u8 auth_mode; |
| 26 | u32 key_mgmt; |
| 27 | }; |
| 28 | |
| 29 | /** Current Basic Service Set State Structure */ |
| 30 | struct current_bss_params { |
| 31 | /** bssid */ |
| 32 | u8 bssid[ETH_ALEN]; |
| 33 | /** ssid */ |
| 34 | u8 ssid[IEEE80211_MAX_SSID_LEN + 1]; |
| 35 | u8 ssid_len; |
| 36 | |
| 37 | /** band */ |
| 38 | u8 band; |
Holger Schurig | c14951f | 2009-10-22 15:30:50 +0200 | [diff] [blame] | 39 | /** channel is directly in priv->channel */ |
Holger Schurig | 2d46502 | 2009-10-22 15:30:48 +0200 | [diff] [blame] | 40 | /** zero-terminated array of supported data rates */ |
| 41 | u8 rates[MAX_RATES + 1]; |
| 42 | }; |
| 43 | |
| 44 | /** |
| 45 | * @brief Structure used to store information for each beacon/probe response |
| 46 | */ |
| 47 | struct bss_descriptor { |
| 48 | u8 bssid[ETH_ALEN]; |
| 49 | |
| 50 | u8 ssid[IEEE80211_MAX_SSID_LEN + 1]; |
| 51 | u8 ssid_len; |
| 52 | |
| 53 | u16 capability; |
| 54 | u32 rssi; |
| 55 | u32 channel; |
| 56 | u16 beaconperiod; |
| 57 | __le16 atimwindow; |
| 58 | |
| 59 | /* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */ |
| 60 | u8 mode; |
| 61 | |
| 62 | /* zero-terminated array of supported data rates */ |
| 63 | u8 rates[MAX_RATES + 1]; |
| 64 | |
| 65 | unsigned long last_scanned; |
| 66 | |
| 67 | union ieee_phy_param_set phy; |
| 68 | union ieee_ss_param_set ss; |
| 69 | |
| 70 | u8 wpa_ie[MAX_WPA_IE_LEN]; |
| 71 | size_t wpa_ie_len; |
| 72 | u8 rsn_ie[MAX_WPA_IE_LEN]; |
| 73 | size_t rsn_ie_len; |
| 74 | |
| 75 | u8 mesh; |
| 76 | |
| 77 | struct list_head list; |
| 78 | }; |
| 79 | |
| 80 | /** Association request |
| 81 | * |
| 82 | * Encapsulates all the options that describe a specific assocation request |
| 83 | * or configuration of the wireless card's radio, mode, and security settings. |
| 84 | */ |
| 85 | struct assoc_request { |
| 86 | #define ASSOC_FLAG_SSID 1 |
| 87 | #define ASSOC_FLAG_CHANNEL 2 |
| 88 | #define ASSOC_FLAG_BAND 3 |
| 89 | #define ASSOC_FLAG_MODE 4 |
| 90 | #define ASSOC_FLAG_BSSID 5 |
| 91 | #define ASSOC_FLAG_WEP_KEYS 6 |
| 92 | #define ASSOC_FLAG_WEP_TX_KEYIDX 7 |
| 93 | #define ASSOC_FLAG_WPA_MCAST_KEY 8 |
| 94 | #define ASSOC_FLAG_WPA_UCAST_KEY 9 |
| 95 | #define ASSOC_FLAG_SECINFO 10 |
| 96 | #define ASSOC_FLAG_WPA_IE 11 |
| 97 | unsigned long flags; |
| 98 | |
| 99 | u8 ssid[IEEE80211_MAX_SSID_LEN + 1]; |
| 100 | u8 ssid_len; |
| 101 | u8 channel; |
| 102 | u8 band; |
| 103 | u8 mode; |
| 104 | u8 bssid[ETH_ALEN] __attribute__ ((aligned (2))); |
| 105 | |
| 106 | /** WEP keys */ |
| 107 | struct enc_key wep_keys[4]; |
| 108 | u16 wep_tx_keyidx; |
| 109 | |
| 110 | /** WPA keys */ |
| 111 | struct enc_key wpa_mcast_key; |
| 112 | struct enc_key wpa_unicast_key; |
| 113 | |
| 114 | struct lbs_802_11_security secinfo; |
| 115 | |
| 116 | /** WPA Information Elements*/ |
| 117 | u8 wpa_ie[MAX_WPA_IE_LEN]; |
| 118 | u8 wpa_ie_len; |
| 119 | |
| 120 | /* BSS to associate with for infrastructure of Ad-Hoc join */ |
| 121 | struct bss_descriptor bss; |
| 122 | }; |
| 123 | |
| 124 | |
| 125 | extern u8 lbs_bg_rates[MAX_RATES]; |
Marcelo Tosatti | 876c9d3 | 2007-02-10 12:25:27 -0200 | [diff] [blame] | 126 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 127 | void lbs_association_worker(struct work_struct *work); |
David Woodhouse | aa21c00 | 2007-12-08 20:04:36 +0000 | [diff] [blame] | 128 | struct assoc_request *lbs_get_association_request(struct lbs_private *priv); |
Luis Carlos Cobo Rus | b8bedef | 2007-05-30 12:14:34 -0400 | [diff] [blame] | 129 | |
Dan Williams | f5fe1fd | 2008-08-21 21:46:59 -0400 | [diff] [blame] | 130 | int lbs_adhoc_stop(struct lbs_private *priv); |
| 131 | |
Holger Schurig | 697900a | 2008-04-02 16:27:10 +0200 | [diff] [blame] | 132 | int lbs_cmd_80211_deauthenticate(struct lbs_private *priv, |
Dan Williams | 191bb40 | 2008-08-21 17:46:18 -0400 | [diff] [blame] | 133 | u8 bssid[ETH_ALEN], u16 reason); |
Holger Schurig | 697900a | 2008-04-02 16:27:10 +0200 | [diff] [blame] | 134 | |
Holger Schurig | d0de374 | 2009-10-22 15:30:51 +0200 | [diff] [blame^] | 135 | int lbs_cmd_802_11_rssi(struct lbs_private *priv, |
| 136 | struct cmd_ds_command *cmd); |
| 137 | int lbs_ret_802_11_rssi(struct lbs_private *priv, |
| 138 | struct cmd_ds_command *resp); |
| 139 | |
| 140 | int lbs_cmd_bcn_ctrl(struct lbs_private *priv, |
| 141 | struct cmd_ds_command *cmd, |
| 142 | u16 cmd_action); |
| 143 | int lbs_ret_802_11_bcn_ctrl(struct lbs_private *priv, |
| 144 | struct cmd_ds_command *resp); |
| 145 | |
| 146 | int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action, |
| 147 | struct assoc_request *assoc); |
| 148 | |
| 149 | int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, uint16_t cmd_action, |
| 150 | uint16_t *enable); |
| 151 | |
| 152 | int lbs_cmd_802_11_key_material(struct lbs_private *priv, uint16_t cmd_action, |
| 153 | struct assoc_request *assoc); |
| 154 | |
Holger Schurig | 1007832 | 2007-11-15 18:05:47 -0500 | [diff] [blame] | 155 | #endif /* _LBS_ASSOC_H */ |