wext.c 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /*
  2. * Intel Wireless Multicomm 3200 WiFi driver
  3. *
  4. * Copyright (C) 2009 Intel Corporation <ilw@linux.intel.com>
  5. * Samuel Ortiz <samuel.ortiz@intel.com>
  6. * Zhu Yi <yi.zhu@intel.com>
  7. *
  8. * This program is free software; you can redistribute it and/or
  9. * modify it under the terms of the GNU General Public License version
  10. * 2 as published by the Free Software Foundation.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
  20. * 02110-1301, USA.
  21. *
  22. */
  23. #include <linux/wireless.h>
  24. #include <net/cfg80211.h>
  25. #include "iwm.h"
  26. #include "commands.h"
  27. static int iwm_wext_siwap(struct net_device *dev, struct iw_request_info *info,
  28. struct sockaddr *ap_addr, char *extra)
  29. {
  30. struct iwm_priv *iwm = ndev_to_iwm(dev);
  31. switch (iwm->conf.mode) {
  32. case UMAC_MODE_IBSS:
  33. return cfg80211_ibss_wext_siwap(dev, info, ap_addr, extra);
  34. case UMAC_MODE_BSS:
  35. return cfg80211_mgd_wext_siwap(dev, info, ap_addr, extra);
  36. default:
  37. return -EOPNOTSUPP;
  38. }
  39. }
  40. static int iwm_wext_giwap(struct net_device *dev, struct iw_request_info *info,
  41. struct sockaddr *ap_addr, char *extra)
  42. {
  43. struct iwm_priv *iwm = ndev_to_iwm(dev);
  44. switch (iwm->conf.mode) {
  45. case UMAC_MODE_IBSS:
  46. return cfg80211_ibss_wext_giwap(dev, info, ap_addr, extra);
  47. case UMAC_MODE_BSS:
  48. return cfg80211_mgd_wext_giwap(dev, info, ap_addr, extra);
  49. default:
  50. return -EOPNOTSUPP;
  51. }
  52. }
  53. static int iwm_wext_siwessid(struct net_device *dev,
  54. struct iw_request_info *info,
  55. struct iw_point *data, char *ssid)
  56. {
  57. struct iwm_priv *iwm = ndev_to_iwm(dev);
  58. switch (iwm->conf.mode) {
  59. case UMAC_MODE_IBSS:
  60. return cfg80211_ibss_wext_siwessid(dev, info, data, ssid);
  61. case UMAC_MODE_BSS:
  62. return cfg80211_mgd_wext_siwessid(dev, info, data, ssid);
  63. default:
  64. return -EOPNOTSUPP;
  65. }
  66. }
  67. static int iwm_wext_giwessid(struct net_device *dev,
  68. struct iw_request_info *info,
  69. struct iw_point *data, char *ssid)
  70. {
  71. struct iwm_priv *iwm = ndev_to_iwm(dev);
  72. switch (iwm->conf.mode) {
  73. case UMAC_MODE_IBSS:
  74. return cfg80211_ibss_wext_giwessid(dev, info, data, ssid);
  75. case UMAC_MODE_BSS:
  76. return cfg80211_mgd_wext_giwessid(dev, info, data, ssid);
  77. default:
  78. return -EOPNOTSUPP;
  79. }
  80. }
  81. static const iw_handler iwm_handlers[] =
  82. {
  83. (iw_handler) NULL, /* SIOCSIWCOMMIT */
  84. (iw_handler) cfg80211_wext_giwname, /* SIOCGIWNAME */
  85. (iw_handler) NULL, /* SIOCSIWNWID */
  86. (iw_handler) NULL, /* SIOCGIWNWID */
  87. (iw_handler) cfg80211_wext_siwfreq, /* SIOCSIWFREQ */
  88. (iw_handler) cfg80211_wext_giwfreq, /* SIOCGIWFREQ */
  89. (iw_handler) cfg80211_wext_siwmode, /* SIOCSIWMODE */
  90. (iw_handler) cfg80211_wext_giwmode, /* SIOCGIWMODE */
  91. (iw_handler) NULL, /* SIOCSIWSENS */
  92. (iw_handler) NULL, /* SIOCGIWSENS */
  93. (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */
  94. (iw_handler) cfg80211_wext_giwrange, /* SIOCGIWRANGE */
  95. (iw_handler) NULL /* not used */, /* SIOCSIWPRIV */
  96. (iw_handler) NULL /* kernel code */, /* SIOCGIWPRIV */
  97. (iw_handler) NULL /* not used */, /* SIOCSIWSTATS */
  98. (iw_handler) NULL /* kernel code */, /* SIOCGIWSTATS */
  99. (iw_handler) NULL, /* SIOCSIWSPY */
  100. (iw_handler) NULL, /* SIOCGIWSPY */
  101. (iw_handler) NULL, /* SIOCSIWTHRSPY */
  102. (iw_handler) NULL, /* SIOCGIWTHRSPY */
  103. (iw_handler) iwm_wext_siwap, /* SIOCSIWAP */
  104. (iw_handler) iwm_wext_giwap, /* SIOCGIWAP */
  105. (iw_handler) NULL, /* SIOCSIWMLME */
  106. (iw_handler) NULL, /* SIOCGIWAPLIST */
  107. (iw_handler) cfg80211_wext_siwscan, /* SIOCSIWSCAN */
  108. (iw_handler) cfg80211_wext_giwscan, /* SIOCGIWSCAN */
  109. (iw_handler) iwm_wext_siwessid, /* SIOCSIWESSID */
  110. (iw_handler) iwm_wext_giwessid, /* SIOCGIWESSID */
  111. (iw_handler) NULL, /* SIOCSIWNICKN */
  112. (iw_handler) NULL, /* SIOCGIWNICKN */
  113. (iw_handler) NULL, /* -- hole -- */
  114. (iw_handler) NULL, /* -- hole -- */
  115. (iw_handler) NULL, /* SIOCSIWRATE */
  116. (iw_handler) cfg80211_wext_giwrate, /* SIOCGIWRATE */
  117. (iw_handler) cfg80211_wext_siwrts, /* SIOCSIWRTS */
  118. (iw_handler) cfg80211_wext_giwrts, /* SIOCGIWRTS */
  119. (iw_handler) cfg80211_wext_siwfrag, /* SIOCSIWFRAG */
  120. (iw_handler) cfg80211_wext_giwfrag, /* SIOCGIWFRAG */
  121. (iw_handler) cfg80211_wext_siwtxpower, /* SIOCSIWTXPOW */
  122. (iw_handler) cfg80211_wext_giwtxpower, /* SIOCGIWTXPOW */
  123. (iw_handler) NULL, /* SIOCSIWRETRY */
  124. (iw_handler) NULL, /* SIOCGIWRETRY */
  125. (iw_handler) cfg80211_wext_siwencode, /* SIOCSIWENCODE */
  126. (iw_handler) cfg80211_wext_giwencode, /* SIOCGIWENCODE */
  127. (iw_handler) cfg80211_wext_siwpower, /* SIOCSIWPOWER */
  128. (iw_handler) cfg80211_wext_giwpower, /* SIOCGIWPOWER */
  129. (iw_handler) NULL, /* -- hole -- */
  130. (iw_handler) NULL, /* -- hole -- */
  131. (iw_handler) cfg80211_wext_siwgenie, /* SIOCSIWGENIE */
  132. (iw_handler) NULL, /* SIOCGIWGENIE */
  133. (iw_handler) cfg80211_wext_siwauth, /* SIOCSIWAUTH */
  134. (iw_handler) cfg80211_wext_giwauth, /* SIOCGIWAUTH */
  135. (iw_handler) cfg80211_wext_siwencodeext, /* SIOCSIWENCODEEXT */
  136. (iw_handler) NULL, /* SIOCGIWENCODEEXT */
  137. (iw_handler) NULL, /* SIOCSIWPMKSA */
  138. (iw_handler) NULL, /* -- hole -- */
  139. };
  140. const struct iw_handler_def iwm_iw_handler_def = {
  141. .num_standard = ARRAY_SIZE(iwm_handlers),
  142. .standard = (iw_handler *) iwm_handlers,
  143. .get_wireless_stats = cfg80211_wireless_stats,
  144. };