p80211netdev.h 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  1. /* p80211netdev.h
  2. *
  3. * WLAN net device structure and functions
  4. *
  5. * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved.
  6. * --------------------------------------------------------------------
  7. *
  8. * linux-wlan
  9. *
  10. * The contents of this file are subject to the Mozilla Public
  11. * License Version 1.1 (the "License"); you may not use this file
  12. * except in compliance with the License. You may obtain a copy of
  13. * the License at http://www.mozilla.org/MPL/
  14. *
  15. * Software distributed under the License is distributed on an "AS
  16. * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  17. * implied. See the License for the specific language governing
  18. * rights and limitations under the License.
  19. *
  20. * Alternatively, the contents of this file may be used under the
  21. * terms of the GNU Public License version 2 (the "GPL"), in which
  22. * case the provisions of the GPL are applicable instead of the
  23. * above. If you wish to allow the use of your version of this file
  24. * only under the terms of the GPL and not to allow others to use
  25. * your version of this file under the MPL, indicate your decision
  26. * by deleting the provisions above and replace them with the notice
  27. * and other provisions required by the GPL. If you do not delete
  28. * the provisions above, a recipient may use your version of this
  29. * file under either the MPL or the GPL.
  30. *
  31. * --------------------------------------------------------------------
  32. *
  33. * Inquiries regarding the linux-wlan Open Source project can be
  34. * made directly to:
  35. *
  36. * AbsoluteValue Systems Inc.
  37. * info@linux-wlan.com
  38. * http://www.linux-wlan.com
  39. *
  40. * --------------------------------------------------------------------
  41. *
  42. * Portions of the development of this software were funded by
  43. * Intersil Corporation as part of PRISM(R) chipset product development.
  44. *
  45. * --------------------------------------------------------------------
  46. *
  47. * This file declares the structure type that represents each wlan
  48. * interface.
  49. *
  50. * --------------------------------------------------------------------
  51. */
  52. #ifndef _LINUX_P80211NETDEV_H
  53. #define _LINUX_P80211NETDEV_H
  54. #include <linux/interrupt.h>
  55. #include <linux/wireless.h>
  56. #include <linux/netdevice.h>
  57. #undef netdevice_t
  58. typedef struct net_device netdevice_t;
  59. #define WLAN_RELEASE "0.3.0-staging"
  60. #define WLAN_DEVICE_CLOSED 0
  61. #define WLAN_DEVICE_OPEN 1
  62. #define WLAN_MACMODE_NONE 0
  63. #define WLAN_MACMODE_IBSS_STA 1
  64. #define WLAN_MACMODE_ESS_STA 2
  65. #define WLAN_MACMODE_ESS_AP 3
  66. /* MSD States */
  67. #define WLAN_MSD_HWPRESENT_PENDING 1
  68. #define WLAN_MSD_HWFAIL 2
  69. #define WLAN_MSD_HWPRESENT 3
  70. #define WLAN_MSD_FWLOAD_PENDING 4
  71. #define WLAN_MSD_FWLOAD 5
  72. #define WLAN_MSD_RUNNING_PENDING 6
  73. #define WLAN_MSD_RUNNING 7
  74. #ifndef ETH_P_ECONET
  75. #define ETH_P_ECONET 0x0018 /* needed for 2.2.x kernels */
  76. #endif
  77. #define ETH_P_80211_RAW (ETH_P_ECONET + 1)
  78. #ifndef ARPHRD_IEEE80211
  79. #define ARPHRD_IEEE80211 801 /* kernel 2.4.6 */
  80. #endif
  81. #ifndef ARPHRD_IEEE80211_PRISM /* kernel 2.4.18 */
  82. #define ARPHRD_IEEE80211_PRISM 802
  83. #endif
  84. /*--- NSD Capabilities Flags ------------------------------*/
  85. #define P80211_NSDCAP_HARDWAREWEP 0x01 /* hardware wep engine */
  86. #define P80211_NSDCAP_SHORT_PREAMBLE 0x10 /* hardware supports */
  87. #define P80211_NSDCAP_HWFRAGMENT 0x80 /* nsd handles frag/defrag */
  88. #define P80211_NSDCAP_AUTOJOIN 0x100 /* nsd does autojoin */
  89. #define P80211_NSDCAP_NOSCAN 0x200 /* nsd can scan */
  90. /* Received frame statistics */
  91. typedef struct p80211_frmrx_t {
  92. u32 mgmt;
  93. u32 assocreq;
  94. u32 assocresp;
  95. u32 reassocreq;
  96. u32 reassocresp;
  97. u32 probereq;
  98. u32 proberesp;
  99. u32 beacon;
  100. u32 atim;
  101. u32 disassoc;
  102. u32 authen;
  103. u32 deauthen;
  104. u32 mgmt_unknown;
  105. u32 ctl;
  106. u32 pspoll;
  107. u32 rts;
  108. u32 cts;
  109. u32 ack;
  110. u32 cfend;
  111. u32 cfendcfack;
  112. u32 ctl_unknown;
  113. u32 data;
  114. u32 dataonly;
  115. u32 data_cfack;
  116. u32 data_cfpoll;
  117. u32 data__cfack_cfpoll;
  118. u32 null;
  119. u32 cfack;
  120. u32 cfpoll;
  121. u32 cfack_cfpoll;
  122. u32 data_unknown;
  123. u32 decrypt;
  124. u32 decrypt_err;
  125. } p80211_frmrx_t;
  126. /* called by /proc/net/wireless */
  127. struct iw_statistics *p80211wext_get_wireless_stats(netdevice_t *dev);
  128. /* wireless extensions' ioctls */
  129. extern struct iw_handler_def p80211wext_handler_def;
  130. int p80211wext_event_associated(struct wlandevice *wlandev, int assoc);
  131. /* WEP stuff */
  132. #define NUM_WEPKEYS 4
  133. #define MAX_KEYLEN 32
  134. #define HOSTWEP_DEFAULTKEY_MASK (BIT(1)|BIT(0))
  135. #define HOSTWEP_SHAREDKEY BIT(3)
  136. #define HOSTWEP_DECRYPT BIT(4)
  137. #define HOSTWEP_ENCRYPT BIT(5)
  138. #define HOSTWEP_PRIVACYINVOKED BIT(6)
  139. #define HOSTWEP_EXCLUDEUNENCRYPTED BIT(7)
  140. extern int wlan_watchdog;
  141. extern int wlan_wext_write;
  142. /* WLAN device type */
  143. typedef struct wlandevice {
  144. struct wlandevice *next; /* link for list of devices */
  145. void *priv; /* private data for MSD */
  146. /* Subsystem State */
  147. char name[WLAN_DEVNAMELEN_MAX]; /* Dev name, from register_wlandev() */
  148. char *nsdname;
  149. u32 state; /* Device I/F state (open/closed) */
  150. u32 msdstate; /* state of underlying driver */
  151. u32 hwremoved; /* Has the hw been yanked out? */
  152. /* Hardware config */
  153. unsigned int irq;
  154. unsigned int iobase;
  155. unsigned int membase;
  156. u32 nsdcaps; /* NSD Capabilities flags */
  157. /* Config vars */
  158. unsigned int ethconv;
  159. /* device methods (init by MSD, used by p80211 */
  160. int (*open)(struct wlandevice *wlandev);
  161. int (*close)(struct wlandevice *wlandev);
  162. void (*reset)(struct wlandevice *wlandev);
  163. int (*txframe)(struct wlandevice *wlandev, struct sk_buff *skb,
  164. union p80211_hdr *p80211_hdr,
  165. struct p80211_metawep *p80211_wep);
  166. int (*mlmerequest)(struct wlandevice *wlandev, struct p80211msg *msg);
  167. int (*set_multicast_list)(struct wlandevice *wlandev,
  168. netdevice_t *dev);
  169. void (*tx_timeout)(struct wlandevice *wlandev);
  170. /* 802.11 State */
  171. u8 bssid[WLAN_BSSID_LEN];
  172. p80211pstr32_t ssid;
  173. u32 macmode;
  174. int linkstatus;
  175. /* WEP State */
  176. u8 wep_keys[NUM_WEPKEYS][MAX_KEYLEN];
  177. u8 wep_keylens[NUM_WEPKEYS];
  178. int hostwep;
  179. /* Request/Confirm i/f state (used by p80211) */
  180. unsigned long request_pending; /* flag, access atomically */
  181. /* netlink socket */
  182. /* queue for indications waiting for cmd completion */
  183. /* Linux netdevice and support */
  184. netdevice_t *netdev; /* ptr to linux netdevice */
  185. /* Rx bottom half */
  186. struct tasklet_struct rx_bh;
  187. struct sk_buff_head nsd_rxq;
  188. /* 802.11 device statistics */
  189. struct p80211_frmrx_t rx;
  190. struct iw_statistics wstats;
  191. /* jkriegl: iwspy fields */
  192. u8 spy_number;
  193. char spy_address[IW_MAX_SPY][ETH_ALEN];
  194. struct iw_quality spy_stat[IW_MAX_SPY];
  195. } wlandevice_t;
  196. /* WEP stuff */
  197. int wep_change_key(wlandevice_t *wlandev, int keynum, u8 *key, int keylen);
  198. int wep_decrypt(wlandevice_t *wlandev, u8 *buf, u32 len, int key_override,
  199. u8 *iv, u8 *icv);
  200. int wep_encrypt(wlandevice_t *wlandev, u8 *buf, u8 *dst, u32 len, int keynum,
  201. u8 *iv, u8 *icv);
  202. int wlan_setup(wlandevice_t *wlandev, struct device *physdev);
  203. void wlan_unsetup(wlandevice_t *wlandev);
  204. int register_wlandev(wlandevice_t *wlandev);
  205. int unregister_wlandev(wlandevice_t *wlandev);
  206. void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb);
  207. void p80211netdev_hwremoved(wlandevice_t *wlandev);
  208. #endif