00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053 #ifndef _LINUX_P80211NETDEV_H
00054 #define _LINUX_P80211NETDEV_H
00055
00056
00057
00058
00059 #define WLAN_DEVICE_CLOSED 0
00060 #define WLAN_DEVICE_OPEN 1
00061
00062 #define WLAN_MACMODE_NONE 0
00063 #define WLAN_MACMODE_IBSS_STA 1
00064 #define WLAN_MACMODE_ESS_STA 2
00065 #define WLAN_MACMODE_ESS_AP 3
00066
00067
00068 #define WLAN_MSD_START -1
00069 #define WLAN_MSD_DRIVERLOADED 0
00070 #define WLAN_MSD_HWPRESENT_PENDING 1
00071 #define WLAN_MSD_HWFAIL 2
00072 #define WLAN_MSD_HWPRESENT 3
00073 #define WLAN_MSD_FWLOAD_PENDING 4
00074 #define WLAN_MSD_FWLOAD 5
00075 #define WLAN_MSD_RUNNING_PENDING 6
00076 #define WLAN_MSD_RUNNING 7
00077
00078 #ifndef ETH_P_ECONET
00079 #define ETH_P_ECONET 0x0018
00080 #endif
00081
00082 #define ETH_P_80211_RAW (ETH_P_ECONET + 1)
00083
00084 #ifndef ARPHRD_IEEE80211
00085 #define ARPHRD_IEEE80211 801
00086 #endif
00087
00088 #ifndef ARPHRD_IEEE80211_PRISM
00089 #define ARPHRD_IEEE80211_PRISM 802
00090 #endif
00091
00092
00093 #define P80211_NSDCAP_HARDWAREWEP 0x01
00094 #define P80211_NSDCAP_TIEDWEP 0x02
00095 #define P80211_NSDCAP_NOHOSTWEP 0x04
00096 #define P80211_NSDCAP_PBCC 0x08
00097 #define P80211_NSDCAP_SHORT_PREAMBLE 0x10
00098 #define P80211_NSDCAP_AGILITY 0x20
00099 #define P80211_NSDCAP_AP_RETRANSMIT 0x40
00100 #define P80211_NSDCAP_HWFRAGMENT 0x80
00101 #define P80211_NSDCAP_AUTOJOIN 0x100
00102 #define P80211_NSDCAP_NOSCAN 0x200
00103
00104
00105
00106
00107
00108
00109
00110
00111 typedef struct p80211_frmrx_t
00112 {
00113 UINT32 mgmt;
00114 UINT32 assocreq;
00115 UINT32 assocresp;
00116 UINT32 reassocreq;
00117 UINT32 reassocresp;
00118 UINT32 probereq;
00119 UINT32 proberesp;
00120 UINT32 beacon;
00121 UINT32 atim;
00122 UINT32 disassoc;
00123 UINT32 authen;
00124 UINT32 deauthen;
00125 UINT32 mgmt_unknown;
00126 UINT32 ctl;
00127 UINT32 pspoll;
00128 UINT32 rts;
00129 UINT32 cts;
00130 UINT32 ack;
00131 UINT32 cfend;
00132 UINT32 cfendcfack;
00133 UINT32 ctl_unknown;
00134 UINT32 data;
00135 UINT32 dataonly;
00136 UINT32 data_cfack;
00137 UINT32 data_cfpoll;
00138 UINT32 data__cfack_cfpoll;
00139 UINT32 null;
00140 UINT32 cfack;
00141 UINT32 cfpoll;
00142 UINT32 cfack_cfpoll;
00143 UINT32 data_unknown;
00144 UINT32 decrypt;
00145 UINT32 decrypt_err;
00146 } p80211_frmrx_t;
00147
00148
00149 #ifdef WIRELESS_EXT
00150
00151 struct iw_statistics* p80211wext_get_wireless_stats(netdevice_t *dev);
00152
00153 int p80211wext_support_ioctl(netdevice_t *dev, struct ifreq *ifr, int cmd);
00154 #if WIRELESS_EXT > 12
00155 extern struct iw_handler_def p80211wext_handler_def;
00156 #endif
00157 #endif
00158
00159
00160 #define NUM_WEPKEYS 4
00161 #define MAX_KEYLEN 32
00162
00163 #define HOSTWEP_DEFAULTKEY_MASK (BIT1|BIT0)
00164 #define HOSTWEP_DECRYPT BIT4
00165 #define HOSTWEP_ENCRYPT BIT5
00166 #define HOSTWEP_PRIVACYINVOKED BIT6
00167 #define HOSTWEP_EXCLUDEUNENCRYPTED BIT7
00168
00169 extern int wlan_watchdog;
00170 extern int wlan_wext_write;
00171
00172
00173 typedef struct wlandevice
00174 {
00175 struct wlandevice *next;
00176 void *priv;
00177
00178
00179 char name[WLAN_DEVNAMELEN_MAX];
00180 char *nsdname;
00181
00182 UINT32 state;
00183 UINT32 msdstate;
00184 UINT32 hwremoved;
00185
00186
00187 UINT irq;
00188 UINT iobase;
00189 UINT membase;
00190 UINT32 nsdcaps;
00191
00192
00193 UINT ethconv;
00194
00195
00196 int (*open)(struct wlandevice *wlandev);
00197 int (*close)(struct wlandevice *wlandev);
00198 void (*reset)(struct wlandevice *wlandev );
00199 int (*txframe)(struct wlandevice *wlandev, struct sk_buff *skb, p80211_hdr_t *p80211_hdr, p80211_metawep_t *p80211_wep);
00200 int (*mlmerequest)(struct wlandevice *wlandev, p80211msg_t *msg);
00201 int (*set_multicast_list)(struct wlandevice *wlandev,
00202 netdevice_t *dev);
00203 void (*tx_timeout)(struct wlandevice *wlandev);
00204
00205 #ifdef CONFIG_PROC_FS
00206 int (*nsd_proc_read)(char *page, char **start, off_t offset, int count, int *eof, void *data);
00207 #endif
00208
00209
00210 UINT8 bssid[WLAN_BSSID_LEN];
00211 p80211pstr32_t ssid;
00212 UINT32 macmode;
00213 UINT shortpreamble;
00214
00215
00216 UINT8 wep_keys[NUM_WEPKEYS][MAX_KEYLEN];
00217 UINT8 wep_keylens[NUM_WEPKEYS];
00218 int hostwep;
00219
00220
00221 UINT32 request_pending;
00222
00223
00224
00225
00226 netdevice_t *netdev;
00227 struct net_device_stats linux_stats;
00228
00229 #ifdef CONFIG_PROC_FS
00230
00231 struct proc_dir_entry *procdir;
00232 struct proc_dir_entry *procwlandev;
00233 #endif
00234
00235
00236 #ifndef _LINUX_INTERRUPT_H
00237 #error "You forgot to #include <linux/interrupt.h>!"
00238 #endif
00239
00240 #ifdef DECLARE_TASKLET
00241 struct tasklet_struct rx_bh;
00242 #else
00243 struct work_struct rx_bh;
00244 #endif
00245 struct sk_buff_head nsd_rxq;
00246
00247
00248 struct p80211_frmrx_t rx;
00249
00250
00251 #ifndef WIRELESS_EXT
00252 #error "you forgot to include linux/wireless.h"
00253 #endif
00254
00255 #ifdef WIRELESS_EXT
00256
00257 struct iw_statistics wstats;
00258
00259
00260 UINT8 spy_number;
00261 char spy_address[IW_MAX_SPY][ETH_ALEN];
00262 struct iw_quality spy_stat[IW_MAX_SPY];
00263
00264 #endif
00265
00266 } wlandevice_t;
00267
00268
00269 int wep_change_key(wlandevice_t *wlandev, int keynum, UINT8* key, int keylen);
00270 int wep_decrypt(wlandevice_t *wlandev, UINT8 *buf, UINT32 len, int key_override, UINT8 *iv, UINT8 *icv);
00271 int wep_encrypt(wlandevice_t *wlandev, UINT8 *buf, UINT8 *dst, UINT32 len, int keynum, UINT8 *iv, UINT8 *icv);
00272
00273
00274
00275
00276
00277
00278
00279 void p80211netdev_startup(void);
00280 void p80211netdev_shutdown(void);
00281 int wlan_setup(wlandevice_t *wlandev);
00282 int wlan_unsetup(wlandevice_t *wlandev);
00283 int register_wlandev(wlandevice_t *wlandev);
00284 int unregister_wlandev(wlandevice_t *wlandev);
00285 void p80211netdev_rx(wlandevice_t *wlandev, struct sk_buff *skb);
00286 void p80211netdev_hwremoved(wlandevice_t *wlandev);
00287 void p80211_suspend(wlandevice_t *wlandev);
00288 void p80211_resume(wlandevice_t *wlandev);
00289
00290
00291
00292
00293 static inline void
00294 p80211netdev_stop_queue(wlandevice_t *wlandev)
00295 {
00296 if ( !wlandev ) return;
00297 if ( !wlandev->netdev ) return;
00298 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38) )
00299 wlandev->netdev->tbusy = 1;
00300 wlandev->netdev->start = 0;
00301 #else
00302 netif_stop_queue(wlandev->netdev);
00303 #endif
00304 }
00305
00306 static inline void
00307 p80211netdev_start_queue(wlandevice_t *wlandev)
00308 {
00309 if ( !wlandev ) return;
00310 if ( !wlandev->netdev ) return;
00311 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38) )
00312 wlandev->netdev->tbusy = 0;
00313 wlandev->netdev->start = 1;
00314 #else
00315 netif_start_queue(wlandev->netdev);
00316 #endif
00317 }
00318
00319 static inline void
00320 p80211netdev_wake_queue(wlandevice_t *wlandev)
00321 {
00322 if ( !wlandev ) return;
00323 if ( !wlandev->netdev ) return;
00324 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,3,38) )
00325 wlandev->netdev->tbusy = 0;
00326 mark_bh(NET_BH);
00327 #else
00328 netif_wake_queue(wlandev->netdev);
00329 #endif
00330 }
00331
00332 #ifdef CONFIG_HOTPLUG
00333 #define WLAN_HOTPLUG_REGISTER "register"
00334 #define WLAN_HOTPLUG_REMOVE "remove"
00335 #define WLAN_HOTPLUG_STARTUP "startup"
00336 #define WLAN_HOTPLUG_SHUTDOWN "shutdown"
00337 #define WLAN_HOTPLUG_SUSPEND "suspend"
00338 #define WLAN_HOTPLUG_RESUME "resume"
00339 int p80211_run_sbin_hotplug(wlandevice_t *wlandev, char *action);
00340 #endif
00341
00342 #endif