wl_iw.h 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. /*
  2. * Linux Wireless Extensions support
  3. *
  4. * Copyright (C) 1999-2014, Broadcom Corporation
  5. *
  6. * Unless you and Broadcom execute a separate written software license
  7. * agreement governing use of this software, this software is licensed to you
  8. * under the terms of the GNU General Public License version 2 (the "GPL"),
  9. * available at http://www.broadcom.com/licenses/GPLv2.php, with the
  10. * following added to such license:
  11. *
  12. * As a special exception, the copyright holders of this software give you
  13. * permission to link this software with independent modules, and to copy and
  14. * distribute the resulting executable under terms of your choice, provided that
  15. * you also meet, for each linked independent module, the terms and conditions of
  16. * the license of that module. An independent module is a module which is not
  17. * derived from this software. The special exception does not apply to any
  18. * modifications of the software.
  19. *
  20. * Notwithstanding the above, under no circumstances may you combine this
  21. * software in any way with any other Broadcom software provided under a license
  22. * other than the GPL, without Broadcom's express prior written consent.
  23. *
  24. * $Id: wl_iw.h 291086 2011-10-21 01:17:24Z $
  25. */
  26. #ifndef _wl_iw_h_
  27. #define _wl_iw_h_
  28. #include <linux/wireless.h>
  29. #include <typedefs.h>
  30. #include <proto/ethernet.h>
  31. #include <wlioctl.h>
  32. #define WL_SCAN_PARAMS_SSID_MAX 10
  33. #define GET_SSID "SSID="
  34. #define GET_CHANNEL "CH="
  35. #define GET_NPROBE "NPROBE="
  36. #define GET_ACTIVE_ASSOC_DWELL "ACTIVE="
  37. #define GET_PASSIVE_ASSOC_DWELL "PASSIVE="
  38. #define GET_HOME_DWELL "HOME="
  39. #define GET_SCAN_TYPE "TYPE="
  40. #define BAND_GET_CMD "GETBAND"
  41. #define BAND_SET_CMD "SETBAND"
  42. #define DTIM_SKIP_GET_CMD "DTIMSKIPGET"
  43. #define DTIM_SKIP_SET_CMD "DTIMSKIPSET"
  44. #define SETSUSPEND_CMD "SETSUSPENDOPT"
  45. #define PNOSSIDCLR_SET_CMD "PNOSSIDCLR"
  46. /* Lin - Is the extra space needed? */
  47. #define PNOSETUP_SET_CMD "PNOSETUP " /* TLV command has extra end space */
  48. #define PNOENABLE_SET_CMD "PNOFORCE"
  49. #define PNODEBUG_SET_CMD "PNODEBUG"
  50. #define TXPOWER_SET_CMD "TXPOWER"
  51. #define MAC2STR(a) (a)[0], (a)[1], (a)[2], (a)[3], (a)[4], (a)[5]
  52. #define MACSTR "%02x:%02x:%02x:%02x:%02x:%02x"
  53. /* Structure to keep global parameters */
  54. typedef struct wl_iw_extra_params {
  55. int target_channel; /* target channel */
  56. } wl_iw_extra_params_t;
  57. struct cntry_locales_custom {
  58. char iso_abbrev[WLC_CNTRY_BUF_SZ]; /* ISO 3166-1 country abbreviation */
  59. char custom_locale[WLC_CNTRY_BUF_SZ]; /* Custom firmware locale */
  60. int32 custom_locale_rev; /* Custom local revisin default -1 */
  61. };
  62. /* ============================================== */
  63. /* Defines from wlc_pub.h */
  64. #define WL_IW_RSSI_MINVAL -200 /* Low value, e.g. for forcing roam */
  65. #define WL_IW_RSSI_NO_SIGNAL -91 /* NDIS RSSI link quality cutoffs */
  66. #define WL_IW_RSSI_VERY_LOW -80 /* Very low quality cutoffs */
  67. #define WL_IW_RSSI_LOW -70 /* Low quality cutoffs */
  68. #define WL_IW_RSSI_GOOD -68 /* Good quality cutoffs */
  69. #define WL_IW_RSSI_VERY_GOOD -58 /* Very good quality cutoffs */
  70. #define WL_IW_RSSI_EXCELLENT -57 /* Excellent quality cutoffs */
  71. #define WL_IW_RSSI_INVALID 0 /* invalid RSSI value */
  72. #define MAX_WX_STRING 80
  73. #define SSID_FMT_BUF_LEN ((4 * 32) + 1)
  74. #define isprint(c) bcm_isprint(c)
  75. #define WL_IW_SET_ACTIVE_SCAN (SIOCIWFIRSTPRIV+1)
  76. #define WL_IW_GET_RSSI (SIOCIWFIRSTPRIV+3)
  77. #define WL_IW_SET_PASSIVE_SCAN (SIOCIWFIRSTPRIV+5)
  78. #define WL_IW_GET_LINK_SPEED (SIOCIWFIRSTPRIV+7)
  79. #define WL_IW_GET_CURR_MACADDR (SIOCIWFIRSTPRIV+9)
  80. #define WL_IW_SET_STOP (SIOCIWFIRSTPRIV+11)
  81. #define WL_IW_SET_START (SIOCIWFIRSTPRIV+13)
  82. #define G_SCAN_RESULTS 8*1024
  83. #define WE_ADD_EVENT_FIX 0x80
  84. #define G_WLAN_SET_ON 0
  85. #define G_WLAN_SET_OFF 1
  86. typedef struct wl_iw {
  87. char nickname[IW_ESSID_MAX_SIZE];
  88. struct iw_statistics wstats;
  89. int spy_num;
  90. uint32 pwsec; /* pairwise wsec setting */
  91. uint32 gwsec; /* group wsec setting */
  92. bool privacy_invoked; /* IW_AUTH_PRIVACY_INVOKED setting */
  93. struct ether_addr spy_addr[IW_MAX_SPY];
  94. struct iw_quality spy_qual[IW_MAX_SPY];
  95. void *wlinfo;
  96. } wl_iw_t;
  97. struct wl_ctrl {
  98. struct timer_list *timer;
  99. struct net_device *dev;
  100. long sysioc_pid;
  101. struct semaphore sysioc_sem;
  102. struct completion sysioc_exited;
  103. };
  104. #if WIRELESS_EXT > 12
  105. #include <net/iw_handler.h>
  106. extern const struct iw_handler_def wl_iw_handler_def;
  107. #endif /* WIRELESS_EXT > 12 */
  108. extern int wl_iw_ioctl(struct net_device *dev, struct ifreq *rq, int cmd);
  109. extern void wl_iw_event(struct net_device *dev, wl_event_msg_t *e, void* data);
  110. extern int wl_iw_get_wireless_stats(struct net_device *dev, struct iw_statistics *wstats);
  111. int wl_iw_attach(struct net_device *dev, void * dhdp);
  112. int wl_iw_send_priv_event(struct net_device *dev, char *flag);
  113. void wl_iw_detach(void);
  114. #define CSCAN_COMMAND "CSCAN "
  115. #define CSCAN_TLV_PREFIX 'S'
  116. #define CSCAN_TLV_VERSION 1
  117. #define CSCAN_TLV_SUBVERSION 0
  118. #define CSCAN_TLV_TYPE_SSID_IE 'S'
  119. #define CSCAN_TLV_TYPE_CHANNEL_IE 'C'
  120. #define CSCAN_TLV_TYPE_NPROBE_IE 'N'
  121. #define CSCAN_TLV_TYPE_ACTIVE_IE 'A'
  122. #define CSCAN_TLV_TYPE_PASSIVE_IE 'P'
  123. #define CSCAN_TLV_TYPE_HOME_IE 'H'
  124. #define CSCAN_TLV_TYPE_STYPE_IE 'T'
  125. #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
  126. #define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \
  127. iwe_stream_add_event(info, stream, ends, iwe, extra)
  128. #define IWE_STREAM_ADD_VALUE(info, event, value, ends, iwe, event_len) \
  129. iwe_stream_add_value(info, event, value, ends, iwe, event_len)
  130. #define IWE_STREAM_ADD_POINT(info, stream, ends, iwe, extra) \
  131. iwe_stream_add_point(info, stream, ends, iwe, extra)
  132. #else
  133. #define IWE_STREAM_ADD_EVENT(info, stream, ends, iwe, extra) \
  134. iwe_stream_add_event(stream, ends, iwe, extra)
  135. #define IWE_STREAM_ADD_VALUE(info, event, value, ends, iwe, event_len) \
  136. iwe_stream_add_value(event, value, ends, iwe, event_len)
  137. #define IWE_STREAM_ADD_POINT(info, stream, ends, iwe, extra) \
  138. iwe_stream_add_point(stream, ends, iwe, extra)
  139. #endif
  140. #endif /* _wl_iw_h_ */