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