📄 ieee80211_i.h
字号:
/* * Copyright 2002-2005, Instant802 Networks, Inc. * Copyright 2005, Devicescape Software, Inc. * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License version 2 as * published by the Free Software Foundation. */#ifndef IEEE80211_I_H#define IEEE80211_I_H#include <linux/kernel.h>#include <linux/device.h>#include <linux/if_ether.h>#include <linux/interrupt.h>#include <linux/list.h>#include <linux/netdevice.h>#include <linux/skbuff.h>#include <linux/workqueue.h>#include <linux/types.h>#include <linux/spinlock.h>#include <linux/etherdevice.h>#include <net/wireless.h>#include "ieee80211_key.h"#include "sta_info.h"/* ieee80211.o internal definitions, etc. These are not included into * low-level drivers. */#ifndef ETH_P_PAE#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */#endif /* ETH_P_PAE */#define WLAN_FC_DATA_PRESENT(fc) (((fc) & 0x4c) == 0x08)struct ieee80211_local;#define IEEE80211_ALIGN32_PAD(a) ((4 - ((a) & 3)) & 3)/* Maximum number of broadcast/multicast frames to buffer when some of the * associated stations are using power saving. */#define AP_MAX_BC_BUFFER 128/* Maximum number of frames buffered to all STAs, including multicast frames. * Note: increasing this limit increases the potential memory requirement. Each * frame can be up to about 2 kB long. */#define TOTAL_MAX_TX_BUFFER 512/* Required encryption head and tailroom */#define IEEE80211_ENCRYPT_HEADROOM 8#define IEEE80211_ENCRYPT_TAILROOM 12/* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent * reception of at least three fragmented frames. This limit can be increased * by changing this define, at the cost of slower frame reassembly and * increased memory use (about 2 kB of RAM per entry). */#define IEEE80211_FRAGMENT_MAX 4struct ieee80211_fragment_entry { unsigned long first_frag_time; unsigned int seq; unsigned int rx_queue; unsigned int last_frag; unsigned int extra_len; struct sk_buff_head skb_list; int ccmp; /* Whether fragments were encrypted with CCMP */ u8 last_pn[6]; /* PN of the last fragment if CCMP was used */};struct ieee80211_sta_bss { struct list_head list; struct ieee80211_sta_bss *hnext; atomic_t users; u8 bssid[ETH_ALEN]; u8 ssid[IEEE80211_MAX_SSID_LEN]; size_t ssid_len; u16 capability; /* host byte order */ int hw_mode; int channel; int freq; int rssi, signal, noise; u8 *wpa_ie; size_t wpa_ie_len; u8 *rsn_ie; size_t rsn_ie_len; u8 *wmm_ie; size_t wmm_ie_len;#define IEEE80211_MAX_SUPP_RATES 32 u8 supp_rates[IEEE80211_MAX_SUPP_RATES]; size_t supp_rates_len; int beacon_int; u64 timestamp; int probe_resp; unsigned long last_update; /* during assocation, we save an ERP value from a probe response so * that we can feed ERP info to the driver when handling the * association completes. these fields probably won't be up-to-date * otherwise, you probably don't want to use them. */ int has_erp_value; u8 erp_value;};typedef enum { TXRX_CONTINUE, TXRX_DROP, TXRX_QUEUED} ieee80211_txrx_result;/* flags used in struct ieee80211_txrx_data.flags *//* whether the MSDU was fragmented */#define IEEE80211_TXRXD_FRAGMENTED BIT(0)#define IEEE80211_TXRXD_TXUNICAST BIT(1)#define IEEE80211_TXRXD_TXPS_BUFFERED BIT(2)#define IEEE80211_TXRXD_TXPROBE_LAST_FRAG BIT(3)#define IEEE80211_TXRXD_RXIN_SCAN BIT(4)/* frame is destined to interface currently processed (incl. multicast frames) */#define IEEE80211_TXRXD_RXRA_MATCH BIT(5)#define IEEE80211_TXRXD_TX_INJECTED BIT(6)struct ieee80211_txrx_data { struct sk_buff *skb; struct net_device *dev; struct ieee80211_local *local; struct ieee80211_sub_if_data *sdata; struct sta_info *sta; u16 fc, ethertype; struct ieee80211_key *key; unsigned int flags; union { struct { struct ieee80211_tx_control *control; struct ieee80211_hw_mode *mode; struct ieee80211_rate *rate; /* use this rate (if set) for last fragment; rate can * be set to lower rate for the first fragments, e.g., * when using CTS protection with IEEE 802.11g. */ struct ieee80211_rate *last_frag_rate; int last_frag_hwrate; /* Extra fragments (in addition to the first fragment * in skb) */ int num_extra_frag; struct sk_buff **extra_frag; } tx; struct { struct ieee80211_rx_status *status; int sent_ps_buffered; int queue; int load; u32 tkip_iv32; u16 tkip_iv16; } rx; } u;};/* flags used in struct ieee80211_tx_packet_data.flags */#define IEEE80211_TXPD_REQ_TX_STATUS BIT(0)#define IEEE80211_TXPD_DO_NOT_ENCRYPT BIT(1)#define IEEE80211_TXPD_REQUEUE BIT(2)/* Stored in sk_buff->cb */struct ieee80211_tx_packet_data { int ifindex; unsigned long jiffies; unsigned int flags; u8 queue;};struct ieee80211_tx_stored_packet { struct ieee80211_tx_control control; struct sk_buff *skb; int num_extra_frag; struct sk_buff **extra_frag; int last_frag_rateidx; int last_frag_hwrate; struct ieee80211_rate *last_frag_rate; unsigned int last_frag_rate_ctrl_probe;};typedef ieee80211_txrx_result (*ieee80211_tx_handler)(struct ieee80211_txrx_data *tx);typedef ieee80211_txrx_result (*ieee80211_rx_handler)(struct ieee80211_txrx_data *rx);struct ieee80211_if_ap { u8 *beacon_head, *beacon_tail; int beacon_head_len, beacon_tail_len; struct list_head vlans; u8 ssid[IEEE80211_MAX_SSID_LEN]; size_t ssid_len; /* yes, this looks ugly, but guarantees that we can later use * bitmap_empty :) * NB: don't ever use set_bit, use bss_tim_set/bss_tim_clear! */ u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)]; atomic_t num_sta_ps; /* number of stations in PS mode */ struct sk_buff_head ps_bc_buf; int dtim_period, dtim_count; int force_unicast_rateidx; /* forced TX rateidx for unicast frames */ int max_ratectrl_rateidx; /* max TX rateidx for rate control */ int num_beacons; /* number of TXed beacon frames for this BSS */};struct ieee80211_if_wds { u8 remote_addr[ETH_ALEN]; struct sta_info *sta;};struct ieee80211_if_vlan { struct ieee80211_sub_if_data *ap; struct list_head list;};/* flags used in struct ieee80211_if_sta.flags */#define IEEE80211_STA_SSID_SET BIT(0)#define IEEE80211_STA_BSSID_SET BIT(1)#define IEEE80211_STA_PREV_BSSID_SET BIT(2)#define IEEE80211_STA_AUTHENTICATED BIT(3)#define IEEE80211_STA_ASSOCIATED BIT(4)#define IEEE80211_STA_PROBEREQ_POLL BIT(5)#define IEEE80211_STA_CREATE_IBSS BIT(6)#define IEEE80211_STA_MIXED_CELL BIT(7)#define IEEE80211_STA_WMM_ENABLED BIT(8)#define IEEE80211_STA_AUTO_SSID_SEL BIT(10)#define IEEE80211_STA_AUTO_BSSID_SEL BIT(11)#define IEEE80211_STA_AUTO_CHANNEL_SEL BIT(12)#define IEEE80211_STA_PRIVACY_INVOKED BIT(13)struct ieee80211_if_sta { enum { IEEE80211_DISABLED, IEEE80211_AUTHENTICATE, IEEE80211_ASSOCIATE, IEEE80211_ASSOCIATED, IEEE80211_IBSS_SEARCH, IEEE80211_IBSS_JOINED } state; struct timer_list timer; struct work_struct work; u8 bssid[ETH_ALEN], prev_bssid[ETH_ALEN]; u8 ssid[IEEE80211_MAX_SSID_LEN]; size_t ssid_len; u8 scan_ssid[IEEE80211_MAX_SSID_LEN]; size_t scan_ssid_len; u16 aid; u16 ap_capab, capab; u8 *extra_ie; /* to be added to the end of AssocReq */ size_t extra_ie_len; /* The last AssocReq/Resp IEs */ u8 *assocreq_ies, *assocresp_ies; size_t assocreq_ies_len, assocresp_ies_len; int auth_tries, assoc_tries; unsigned int flags;#define IEEE80211_STA_REQ_SCAN 0#define IEEE80211_STA_REQ_AUTH 1#define IEEE80211_STA_REQ_RUN 2 unsigned long request; struct sk_buff_head skb_queue; unsigned long last_probe;#define IEEE80211_AUTH_ALG_OPEN BIT(0)#define IEEE80211_AUTH_ALG_SHARED_KEY BIT(1)#define IEEE80211_AUTH_ALG_LEAP BIT(2) unsigned int auth_algs; /* bitfield of allowed auth algs */ int auth_alg; /* currently used IEEE 802.11 authentication algorithm */ int auth_transaction; unsigned long ibss_join_req; struct sk_buff *probe_resp; /* ProbeResp template for IBSS */ u32 supp_rates_bits; int wmm_last_param_set;};/* flags used in struct ieee80211_sub_if_data.flags */#define IEEE80211_SDATA_ALLMULTI BIT(0)#define IEEE80211_SDATA_PROMISC BIT(1)#define IEEE80211_SDATA_USE_PROTECTION BIT(2) /* CTS protect ERP frames *//* use short preamble with IEEE 802.11b: this flag is set when the AP or beacon * generator reports that there are no present stations that cannot support short * preambles */#define IEEE80211_SDATA_SHORT_PREAMBLE BIT(3)#define IEEE80211_SDATA_USERSPACE_MLME BIT(4)struct ieee80211_sub_if_data { struct list_head list; enum ieee80211_if_types type; struct wireless_dev wdev; /* keys */ struct list_head key_list; struct net_device *dev; struct ieee80211_local *local; unsigned int flags; int drop_unencrypted; int eapol; /* 0 = process EAPOL frames as normal data frames, * 1 = send EAPOL frames through wlan#ap to hostapd * (default) */ int ieee802_1x; /* IEEE 802.1X PAE - drop packet to/from unauthorized * port */ u16 sequence; /* Fragment table for host-based reassembly */ struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX]; unsigned int fragment_next;#define NUM_DEFAULT_KEYS 4 struct ieee80211_key *keys[NUM_DEFAULT_KEYS]; struct ieee80211_key *default_key; struct ieee80211_if_ap *bss; /* BSS that this device belongs to */ union { struct ieee80211_if_ap ap; struct ieee80211_if_wds wds; struct ieee80211_if_vlan vlan; struct ieee80211_if_sta sta; } u; int channel_use; int channel_use_raw;#ifdef CONFIG_MAC80211_DEBUGFS struct dentry *debugfsdir; union { struct { struct dentry *channel_use; struct dentry *drop_unencrypted; struct dentry *eapol; struct dentry *ieee8021_x; struct dentry *state; struct dentry *bssid; struct dentry *prev_bssid; struct dentry *ssid_len; struct dentry *aid; struct dentry *ap_capab; struct dentry *capab; struct dentry *extra_ie_len; struct dentry *auth_tries; struct dentry *assoc_tries; struct dentry *auth_algs; struct dentry *auth_alg; struct dentry *auth_transaction; struct dentry *flags; } sta; struct { struct dentry *channel_use; struct dentry *drop_unencrypted; struct dentry *eapol; struct dentry *ieee8021_x; struct dentry *num_sta_ps; struct dentry *dtim_period; struct dentry *dtim_count; struct dentry *num_beacons; struct dentry *force_unicast_rateidx; struct dentry *max_ratectrl_rateidx; struct dentry *num_buffered_multicast; struct dentry *beacon_head_len; struct dentry *beacon_tail_len; } ap; struct { struct dentry *channel_use; struct dentry *drop_unencrypted; struct dentry *eapol; struct dentry *ieee8021_x; struct dentry *peer; } wds; struct { struct dentry *channel_use; struct dentry *drop_unencrypted; struct dentry *eapol; struct dentry *ieee8021_x; } vlan; struct { struct dentry *mode; } monitor; struct dentry *default_key; } debugfs;#endif};#define IEEE80211_DEV_TO_SUB_IF(dev) netdev_priv(dev)enum { IEEE80211_RX_MSG = 1, IEEE80211_TX_STATUS_MSG = 2,};struct ieee80211_local { /* embed the driver visible part. * don't cast (use the static inlines below), but we keep * it first anyway so they become a no-op */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -