scan.h 6.4 KB

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