📄 ieee80211.h
字号:
u8 rates[MAX_RATES_LENGTH]; u8 rates_len; u8 rates_ex[MAX_RATES_EX_LENGTH]; u8 rates_ex_len; unsigned long last_scanned; u8 mode; u8 flags; u32 last_associate; u32 time_stamp[2]; u16 beacon_interval; u16 listen_interval; u16 atim_window; u8 erp_value; u8 wpa_ie[MAX_WPA_IE_LEN]; size_t wpa_ie_len; u8 rsn_ie[MAX_WPA_IE_LEN]; size_t rsn_ie_len; struct ieee80211_tim_parameters tim; struct list_head list;};enum ieee80211_state { IEEE80211_UNINITIALIZED = 0, IEEE80211_INITIALIZED, IEEE80211_ASSOCIATING, IEEE80211_ASSOCIATED, IEEE80211_AUTHENTICATING, IEEE80211_AUTHENTICATED, IEEE80211_SHUTDOWN};#define DEFAULT_MAX_SCAN_AGE (15 * HZ)#define DEFAULT_FTS 2346#define CFG_IEEE80211_RESERVE_FCS (1<<0)#define CFG_IEEE80211_COMPUTE_FCS (1<<1)#define CFG_IEEE80211_RTS (1<<2)#define IEEE80211_24GHZ_MIN_CHANNEL 1#define IEEE80211_24GHZ_MAX_CHANNEL 14#define IEEE80211_24GHZ_CHANNELS 14#define IEEE80211_52GHZ_MIN_CHANNEL 36#define IEEE80211_52GHZ_MAX_CHANNEL 165#define IEEE80211_52GHZ_CHANNELS 32enum { IEEE80211_CH_PASSIVE_ONLY = (1 << 0), IEEE80211_CH_B_ONLY = (1 << 2), IEEE80211_CH_NO_IBSS = (1 << 3), IEEE80211_CH_UNIFORM_SPREADING = (1 << 4), IEEE80211_CH_RADAR_DETECT = (1 << 5), IEEE80211_CH_INVALID = (1 << 6),};struct ieee80211_channel { u32 freq; u8 channel; u8 flags; u8 max_power;};struct ieee80211_geo { u8 name[4]; u8 bg_channels; u8 a_channels; struct ieee80211_channel bg[IEEE80211_24GHZ_CHANNELS]; struct ieee80211_channel a[IEEE80211_52GHZ_CHANNELS];};struct ieee80211_device { struct net_device *dev; struct ieee80211_security sec; /* Bookkeeping structures */ struct net_device_stats stats; struct ieee80211_stats ieee_stats; struct ieee80211_geo geo; /* Probe / Beacon management */ struct list_head network_free_list; struct list_head network_list; struct ieee80211_network *networks; int scans; int scan_age; int iw_mode; /* operating mode (IW_MODE_*) */ struct iw_spy_data spy_data; /* iwspy support */ spinlock_t lock; int tx_headroom; /* Set to size of any additional room needed at front * of allocated Tx SKBs */ u32 config; /* WEP and other encryption related settings at the device level */ int open_wep; /* Set to 1 to allow unencrypted frames */ int reset_on_keychange; /* Set to 1 if the HW needs to be reset on * WEP key changes */ /* If the host performs {en,de}cryption, then set to 1 */ int host_encrypt; int host_encrypt_msdu; int host_decrypt; /* host performs multicast decryption */ int host_mc_decrypt; int host_open_frag; int host_build_iv; int ieee802_1x; /* is IEEE 802.1X used */ /* WPA data */ int wpa_enabled; int drop_unencrypted; int privacy_invoked; size_t wpa_ie_len; u8 *wpa_ie; struct list_head crypt_deinit_list; struct ieee80211_crypt_data *crypt[WEP_KEYS]; int tx_keyidx; /* default TX key index (crypt[tx_keyidx]) */ struct timer_list crypt_deinit_timer; int crypt_quiesced; int bcrx_sta_key; /* use individual keys to override default keys even * with RX of broad/multicast frames */ /* Fragmentation structures */ struct ieee80211_frag_entry frag_cache[IEEE80211_FRAG_CACHE_LEN]; unsigned int frag_next_idx; u16 fts; /* Fragmentation Threshold */ u16 rts; /* RTS threshold */ /* Association info */ u8 bssid[ETH_ALEN]; enum ieee80211_state state; int mode; /* A, B, G */ int modulation; /* CCK, OFDM */ int freq_band; /* 2.4Ghz, 5.2Ghz, Mixed */ int abg_true; /* ABG flag */ int perfect_rssi; int worst_rssi; /* Callback functions */ void (*set_security) (struct net_device * dev, struct ieee80211_security * sec); int (*hard_start_xmit) (struct ieee80211_txb * txb, struct net_device * dev, int pri); int (*reset_port) (struct net_device * dev); int (*is_queue_full) (struct net_device * dev, int pri); int (*handle_management) (struct net_device * dev, struct ieee80211_network * network, u16 type); /* Typical STA methods */ int (*handle_auth) (struct net_device * dev, struct ieee80211_auth * auth); int (*handle_deauth) (struct net_device * dev, struct ieee80211_auth * auth); int (*handle_disassoc) (struct net_device * dev, struct ieee80211_disassoc * assoc); int (*handle_beacon) (struct net_device * dev, struct ieee80211_beacon * beacon, struct ieee80211_network * network); int (*handle_probe_response) (struct net_device * dev, struct ieee80211_probe_response * resp, struct ieee80211_network * network); int (*handle_probe_request) (struct net_device * dev, struct ieee80211_probe_request * req, struct ieee80211_rx_stats * stats); int (*handle_assoc_response) (struct net_device * dev, struct ieee80211_assoc_response * resp, struct ieee80211_network * network); /* Typical AP methods */ int (*handle_assoc_request) (struct net_device * dev); int (*handle_reassoc_request) (struct net_device * dev, struct ieee80211_reassoc_request * req); /* This must be the last item so that it points to the data * allocated beyond this structure by alloc_ieee80211 */ u8 priv[0];};#define IEEE_A (1<<0)#define IEEE_B (1<<1)#define IEEE_G (1<<2)#define IEEE_MODE_MASK (IEEE_A|IEEE_B|IEEE_G)#include <linux/version.h> /* KERNEL_VERSION */#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12)static inline int is_multicast_ether_addr(const u8 *addr){ return addr[0] & 0x01;}#endifstatic inline void *ieee80211_priv(struct net_device *dev){ return ((struct ieee80211_device *)netdev_priv(dev))->priv;}static inline int ieee80211_is_broadcast_ether_addr(const u8 *addr){ return (addr[0] == 0xff && addr[1] == 0xff && addr[2] == 0xff && addr[3] == 0xff && addr[4] == 0xff && addr[5] == 0xff);}static inline int ieee80211_is_empty_essid(const char *essid, int essid_len){ /* Single white space is for Linksys APs */ if (essid_len == 1 && essid[0] == ' ') return 1; /* Otherwise, if the entire essid is 0, we assume it is hidden */ while (essid_len) { essid_len--; if (essid[essid_len] != '\0') return 0; } return 1;}static inline int ieee80211_is_valid_mode(struct ieee80211_device *ieee, int mode){ /* * It is possible for both access points and our device to support * combinations of modes, so as long as there is one valid combination * of ap/device supported modes, then return success * */ if ((mode & IEEE_A) && (ieee->modulation & IEEE80211_OFDM_MODULATION) && (ieee->freq_band & IEEE80211_52GHZ_BAND)) return 1; if ((mode & IEEE_G) && (ieee->modulation & IEEE80211_OFDM_MODULATION) && (ieee->freq_band & IEEE80211_24GHZ_BAND)) return 1; if ((mode & IEEE_B) && (ieee->modulation & IEEE80211_CCK_MODULATION) && (ieee->freq_band & IEEE80211_24GHZ_BAND)) return 1; return 0;}static inline int ieee80211_get_hdrlen(u16 fc){ int hdrlen = IEEE80211_3ADDR_LEN; u16 stype = WLAN_FC_GET_STYPE(fc); switch (WLAN_FC_GET_TYPE(fc)) { case IEEE80211_FTYPE_DATA: if ((fc & IEEE80211_FCTL_FROMDS) && (fc & IEEE80211_FCTL_TODS)) hdrlen = IEEE80211_4ADDR_LEN; if (stype & IEEE80211_STYPE_QOS_DATA) hdrlen += 2; break; case IEEE80211_FTYPE_CTL: switch (WLAN_FC_GET_STYPE(fc)) { case IEEE80211_STYPE_CTS: case IEEE80211_STYPE_ACK: hdrlen = IEEE80211_1ADDR_LEN; break; default: hdrlen = IEEE80211_2ADDR_LEN; break; } break; } return hdrlen;}static inline u8 *ieee80211_get_payload(struct ieee80211_hdr *hdr){ switch (ieee80211_get_hdrlen(le16_to_cpu(hdr->frame_ctl))) { case IEEE80211_1ADDR_LEN: return ((struct ieee80211_hdr_1addr *)hdr)->payload; case IEEE80211_2ADDR_LEN: return ((struct ieee80211_hdr_2addr *)hdr)->payload; case IEEE80211_3ADDR_LEN: return ((struct ieee80211_hdr_3addr *)hdr)->payload; case IEEE80211_4ADDR_LEN: return ((struct ieee80211_hdr_4addr *)hdr)->payload; }}static inline int ieee80211_is_ofdm_rate(u8 rate){ switch (rate & ~IEEE80211_BASIC_RATE_MASK) { case IEEE80211_OFDM_RATE_6MB: case IEEE80211_OFDM_RATE_9MB: case IEEE80211_OFDM_RATE_12MB: case IEEE80211_OFDM_RATE_18MB: case IEEE80211_OFDM_RATE_24MB: case IEEE80211_OFDM_RATE_36MB: case IEEE80211_OFDM_RATE_48MB: case IEEE80211_OFDM_RATE_54MB: return 1; } return 0;}static inline int ieee80211_is_cck_rate(u8 rate){ switch (rate & ~IEEE80211_BASIC_RATE_MASK) { case IEEE80211_CCK_RATE_1MB: case IEEE80211_CCK_RATE_2MB: case IEEE80211_CCK_RATE_5MB: case IEEE80211_CCK_RATE_11MB: return 1; } return 0;}/* ieee80211.c */extern void free_ieee80211(struct net_device *dev);extern struct net_device *alloc_ieee80211(int sizeof_priv);extern int ieee80211_set_encryption(struct ieee80211_device *ieee);/* ieee80211_tx.c */extern int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev);extern void ieee80211_txb_free(struct ieee80211_txb *);extern int ieee80211_tx_frame(struct ieee80211_device *ieee, struct ieee80211_hdr *frame, int len);/* ieee80211_rx.c */extern int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, struct ieee80211_rx_stats *rx_stats);extern void ieee80211_rx_mgt(struct ieee80211_device *ieee, struct ieee80211_hdr_4addr *header, struct ieee80211_rx_stats *stats);/* ieee80211_geo.c */extern const struct ieee80211_geo *ieee80211_get_geo(struct ieee80211_device *ieee);extern int ieee80211_set_geo(struct ieee80211_device *ieee, const struct ieee80211_geo *geo);extern int ieee80211_is_valid_channel(struct ieee80211_device *ieee, u8 channel);extern int ieee80211_channel_to_index(struct ieee80211_device *ieee, u8 channel);extern u8 ieee80211_freq_to_channel(struct ieee80211_device *ieee, u32 freq);/* ieee80211_wx.c */extern int ieee80211_wx_get_scan(struct ieee80211_device *ieee, struct iw_request_info *info, union iwreq_data *wrqu, char *key);extern int ieee80211_wx_set_encode(struct ieee80211_device *ieee, struct iw_request_info *info, union iwreq_data *wrqu, char *key);extern int ieee80211_wx_get_encode(struct ieee80211_device *ieee, struct iw_request_info *info, union iwreq_data *wrqu, char *key);extern int ieee80211_wx_set_encodeext(struct ieee80211_device *ieee, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);extern int ieee80211_wx_get_encodeext(struct ieee80211_device *ieee, struct iw_request_info *info, union iwreq_data *wrqu, char *extra);static inline void ieee80211_increment_scans(struct ieee80211_device *ieee){ ieee->scans++;}static inline int ieee80211_get_scans(struct ieee80211_device *ieee){ return ieee->scans;}#endif /* IEEE80211_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -