assoc.h 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. /* Copyright (C) 2006, Red Hat, Inc. */
  2. #ifndef _LBS_ASSOC_H_
  3. #define _LBS_ASSOC_H_
  4. #include "defs.h"
  5. #include "host.h"
  6. struct lbs_private;
  7. /*
  8. * In theory, the IE is limited to the IE length, 255,
  9. * but in practice 64 bytes are enough.
  10. */
  11. #define MAX_WPA_IE_LEN 64
  12. struct lbs_802_11_security {
  13. u8 WPAenabled;
  14. u8 WPA2enabled;
  15. u8 wep_enabled;
  16. u8 auth_mode;
  17. u32 key_mgmt;
  18. };
  19. /** Current Basic Service Set State Structure */
  20. struct current_bss_params {
  21. /** bssid */
  22. u8 bssid[ETH_ALEN];
  23. /** ssid */
  24. u8 ssid[IEEE80211_MAX_SSID_LEN + 1];
  25. u8 ssid_len;
  26. /** band */
  27. u8 band;
  28. /** channel is directly in priv->channel */
  29. /** zero-terminated array of supported data rates */
  30. u8 rates[MAX_RATES + 1];
  31. };
  32. /**
  33. * @brief Structure used to store information for each beacon/probe response
  34. */
  35. struct bss_descriptor {
  36. u8 bssid[ETH_ALEN];
  37. u8 ssid[IEEE80211_MAX_SSID_LEN + 1];
  38. u8 ssid_len;
  39. u16 capability;
  40. u32 rssi;
  41. u32 channel;
  42. u16 beaconperiod;
  43. __le16 atimwindow;
  44. /* IW_MODE_AUTO, IW_MODE_ADHOC, IW_MODE_INFRA */
  45. u8 mode;
  46. /* zero-terminated array of supported data rates */
  47. u8 rates[MAX_RATES + 1];
  48. unsigned long last_scanned;
  49. union ieee_phy_param_set phy;
  50. union ieee_ss_param_set ss;
  51. u8 wpa_ie[MAX_WPA_IE_LEN];
  52. size_t wpa_ie_len;
  53. u8 rsn_ie[MAX_WPA_IE_LEN];
  54. size_t rsn_ie_len;
  55. u8 mesh;
  56. struct list_head list;
  57. };
  58. /** Association request
  59. *
  60. * Encapsulates all the options that describe a specific assocation request
  61. * or configuration of the wireless card's radio, mode, and security settings.
  62. */
  63. struct assoc_request {
  64. #define ASSOC_FLAG_SSID 1
  65. #define ASSOC_FLAG_CHANNEL 2
  66. #define ASSOC_FLAG_BAND 3
  67. #define ASSOC_FLAG_MODE 4
  68. #define ASSOC_FLAG_BSSID 5
  69. #define ASSOC_FLAG_WEP_KEYS 6
  70. #define ASSOC_FLAG_WEP_TX_KEYIDX 7
  71. #define ASSOC_FLAG_WPA_MCAST_KEY 8
  72. #define ASSOC_FLAG_WPA_UCAST_KEY 9
  73. #define ASSOC_FLAG_SECINFO 10
  74. #define ASSOC_FLAG_WPA_IE 11
  75. unsigned long flags;
  76. u8 ssid[IEEE80211_MAX_SSID_LEN + 1];
  77. u8 ssid_len;
  78. u8 channel;
  79. u8 band;
  80. u8 mode;
  81. u8 bssid[ETH_ALEN] __attribute__ ((aligned (2)));
  82. /** WEP keys */
  83. struct enc_key wep_keys[4];
  84. u16 wep_tx_keyidx;
  85. /** WPA keys */
  86. struct enc_key wpa_mcast_key;
  87. struct enc_key wpa_unicast_key;
  88. struct lbs_802_11_security secinfo;
  89. /** WPA Information Elements*/
  90. u8 wpa_ie[MAX_WPA_IE_LEN];
  91. u8 wpa_ie_len;
  92. /* BSS to associate with for infrastructure of Ad-Hoc join */
  93. struct bss_descriptor bss;
  94. };
  95. extern u8 lbs_bg_rates[MAX_RATES];
  96. void lbs_association_worker(struct work_struct *work);
  97. struct assoc_request *lbs_get_association_request(struct lbs_private *priv);
  98. int lbs_adhoc_stop(struct lbs_private *priv);
  99. int lbs_cmd_80211_deauthenticate(struct lbs_private *priv,
  100. u8 bssid[ETH_ALEN], u16 reason);
  101. int lbs_cmd_802_11_rssi(struct lbs_private *priv,
  102. struct cmd_ds_command *cmd);
  103. int lbs_ret_802_11_rssi(struct lbs_private *priv,
  104. struct cmd_ds_command *resp);
  105. int lbs_cmd_bcn_ctrl(struct lbs_private *priv,
  106. struct cmd_ds_command *cmd,
  107. u16 cmd_action);
  108. int lbs_ret_802_11_bcn_ctrl(struct lbs_private *priv,
  109. struct cmd_ds_command *resp);
  110. int lbs_cmd_802_11_set_wep(struct lbs_private *priv, uint16_t cmd_action,
  111. struct assoc_request *assoc);
  112. int lbs_cmd_802_11_enable_rsn(struct lbs_private *priv, uint16_t cmd_action,
  113. uint16_t *enable);
  114. int lbs_cmd_802_11_key_material(struct lbs_private *priv, uint16_t cmd_action,
  115. struct assoc_request *assoc);
  116. #endif /* _LBS_ASSOC_H */