scan.h 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. /**
  2. * Interface for the wlan network scan routines
  3. *
  4. * Driver interface functions and type declarations for the scan module
  5. * implemented in wlan_scan.c.
  6. */
  7. #ifndef _WLAN_SCAN_H
  8. #define _WLAN_SCAN_H
  9. #include <net/ieee80211.h>
  10. #include "hostcmd.h"
  11. /**
  12. * @brief Maximum number of channels that can be sent in a setuserscan ioctl
  13. *
  14. * @sa wlan_ioctl_user_scan_cfg
  15. */
  16. #define WLAN_IOCTL_USER_SCAN_CHAN_MAX 50
  17. //! Infrastructure BSS scan type in wlan_scan_cmd_config
  18. #define WLAN_SCAN_BSS_TYPE_BSS 1
  19. //! Adhoc BSS scan type in wlan_scan_cmd_config
  20. #define WLAN_SCAN_BSS_TYPE_IBSS 2
  21. //! Adhoc or Infrastructure BSS scan type in wlan_scan_cmd_config, no filter
  22. #define WLAN_SCAN_BSS_TYPE_ANY 3
  23. /**
  24. * @brief Structure used internally in the wlan driver to configure a scan.
  25. *
  26. * Sent to the command processing module to configure the firmware
  27. * scan command prepared by libertas_cmd_80211_scan.
  28. *
  29. * @sa wlan_scan_networks
  30. *
  31. */
  32. struct wlan_scan_cmd_config {
  33. /**
  34. * @brief BSS type to be sent in the firmware command
  35. *
  36. * Field can be used to restrict the types of networks returned in the
  37. * scan. valid settings are:
  38. *
  39. * - WLAN_SCAN_BSS_TYPE_BSS (infrastructure)
  40. * - WLAN_SCAN_BSS_TYPE_IBSS (adhoc)
  41. * - WLAN_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure)
  42. */
  43. u8 bsstype;
  44. /**
  45. * @brief Specific BSSID used to filter scan results in the firmware
  46. */
  47. u8 specificBSSID[ETH_ALEN];
  48. /**
  49. * @brief length of TLVs sent in command starting at tlvBuffer
  50. */
  51. int tlvbufferlen;
  52. /**
  53. * @brief SSID TLV(s) and ChanList TLVs to be sent in the firmware command
  54. *
  55. * @sa TLV_TYPE_CHANLIST, mrvlietypes_chanlistparamset_t
  56. * @sa TLV_TYPE_SSID, mrvlietypes_ssidparamset_t
  57. */
  58. u8 tlvbuffer[1]; //!< SSID TLV(s) and ChanList TLVs are stored here
  59. };
  60. /**
  61. * @brief IOCTL channel sub-structure sent in wlan_ioctl_user_scan_cfg
  62. *
  63. * Multiple instances of this structure are included in the IOCTL command
  64. * to configure a instance of a scan on the specific channel.
  65. */
  66. struct wlan_ioctl_user_scan_chan {
  67. u8 channumber; //!< channel Number to scan
  68. u8 radiotype; //!< Radio type: 'B/G' band = 0, 'A' band = 1
  69. u8 scantype; //!< Scan type: Active = 0, Passive = 1
  70. u16 scantime; //!< Scan duration in milliseconds; if 0 default used
  71. };
  72. /**
  73. * @brief IOCTL input structure to configure an immediate scan cmd to firmware
  74. *
  75. * Used in the setuserscan (WLAN_SET_USER_SCAN) private ioctl. Specifies
  76. * a number of parameters to be used in general for the scan as well
  77. * as a channel list (wlan_ioctl_user_scan_chan) for each scan period
  78. * desired.
  79. *
  80. * @sa libertas_set_user_scan_ioctl
  81. */
  82. struct wlan_ioctl_user_scan_cfg {
  83. /**
  84. * @brief Flag set to keep the previous scan table intact
  85. *
  86. * If set, the scan results will accumulate, replacing any previous
  87. * matched entries for a BSS with the new scan data
  88. */
  89. u8 keeppreviousscan; //!< Do not erase the existing scan results
  90. /**
  91. * @brief BSS type to be sent in the firmware command
  92. *
  93. * Field can be used to restrict the types of networks returned in the
  94. * scan. valid settings are:
  95. *
  96. * - WLAN_SCAN_BSS_TYPE_BSS (infrastructure)
  97. * - WLAN_SCAN_BSS_TYPE_IBSS (adhoc)
  98. * - WLAN_SCAN_BSS_TYPE_ANY (unrestricted, adhoc and infrastructure)
  99. */
  100. u8 bsstype;
  101. /**
  102. * @brief Configure the number of probe requests for active chan scans
  103. */
  104. u8 numprobes;
  105. /**
  106. * @brief BSSID filter sent in the firmware command to limit the results
  107. */
  108. u8 specificBSSID[ETH_ALEN];
  109. /**
  110. * @brief SSID filter sent in the firmware command to limit the results
  111. */
  112. char specificSSID[IW_ESSID_MAX_SIZE + 1];
  113. /**
  114. * @brief Variable number (fixed maximum) of channels to scan up
  115. */
  116. struct wlan_ioctl_user_scan_chan chanlist[WLAN_IOCTL_USER_SCAN_CHAN_MAX];
  117. };
  118. /**
  119. * @brief Structure used to store information for each beacon/probe response
  120. */
  121. struct bss_descriptor {
  122. u8 macaddress[ETH_ALEN];
  123. struct WLAN_802_11_SSID ssid;
  124. /* WEP encryption requirement */
  125. u32 privacy;
  126. /* receive signal strength in dBm */
  127. long rssi;
  128. u32 channel;
  129. u16 beaconperiod;
  130. u32 atimwindow;
  131. u8 mode;
  132. u8 libertas_supported_rates[WLAN_SUPPORTED_RATES];
  133. int extra_ie;
  134. u8 timestamp[8]; //!< TSF value included in the beacon/probe response
  135. union ieeetypes_phyparamset phyparamset;
  136. union IEEEtypes_ssparamset ssparamset;
  137. struct ieeetypes_capinfo cap;
  138. u8 datarates[WLAN_SUPPORTED_RATES];
  139. __le64 networktsf; //!< TSF timestamp from the current firmware TSF
  140. struct ieeetypes_countryinfofullset countryinfo;
  141. u8 wpa_ie[MAX_WPA_IE_LEN];
  142. size_t wpa_ie_len;
  143. u8 rsn_ie[MAX_WPA_IE_LEN];
  144. size_t rsn_ie_len;
  145. };
  146. extern int libertas_SSID_cmp(struct WLAN_802_11_SSID *ssid1,
  147. struct WLAN_802_11_SSID *ssid2);
  148. extern int libertas_find_SSID_in_list(wlan_adapter * adapter, struct WLAN_802_11_SSID *ssid,
  149. u8 * bssid, u8 mode);
  150. int libertas_find_best_SSID_in_list(wlan_adapter * adapter, u8 mode);
  151. extern int libertas_find_BSSID_in_list(wlan_adapter * adapter, u8 * bssid, u8 mode);
  152. int libertas_find_best_network_SSID(wlan_private * priv,
  153. struct WLAN_802_11_SSID *pSSID,
  154. u8 preferred_mode, u8 *out_mode);
  155. extern int libertas_send_specific_SSID_scan(wlan_private * priv,
  156. struct WLAN_802_11_SSID *prequestedssid,
  157. u8 keeppreviousscan);
  158. extern int libertas_send_specific_BSSID_scan(wlan_private * priv,
  159. u8 * bssid, u8 keeppreviousscan);
  160. extern int libertas_cmd_80211_scan(wlan_private * priv,
  161. struct cmd_ds_command *cmd,
  162. void *pdata_buf);
  163. extern int libertas_ret_80211_scan(wlan_private * priv,
  164. struct cmd_ds_command *resp);
  165. int wlan_scan_networks(wlan_private * priv,
  166. const struct wlan_ioctl_user_scan_cfg * puserscanin);
  167. struct ifreq;
  168. struct iw_point;
  169. struct iw_param;
  170. struct iw_request_info;
  171. extern int libertas_get_scan(struct net_device *dev, struct iw_request_info *info,
  172. struct iw_point *dwrq, char *extra);
  173. extern int libertas_set_scan(struct net_device *dev, struct iw_request_info *info,
  174. struct iw_param *vwrq, char *extra);
  175. #endif /* _WLAN_SCAN_H */