xref: /linux/include/net/cfg80211.h (revision de95a54b1aebe5592cae971ca5e5d9ec6a381a17)
1704232c2SJohannes Berg #ifndef __NET_CFG80211_H
2704232c2SJohannes Berg #define __NET_CFG80211_H
3704232c2SJohannes Berg 
4704232c2SJohannes Berg #include <linux/netlink.h>
5704232c2SJohannes Berg #include <linux/skbuff.h>
655682965SJohannes Berg #include <linux/nl80211.h>
72a519311SJohannes Berg #include <linux/if_ether.h>
82a519311SJohannes Berg #include <linux/ieee80211.h>
92a519311SJohannes Berg #include <linux/wireless.h>
102a519311SJohannes Berg #include <net/iw_handler.h>
11704232c2SJohannes Berg #include <net/genetlink.h>
12fee52678SJohannes Berg /* remove once we remove the wext stuff */
13704232c2SJohannes Berg 
14704232c2SJohannes Berg /*
15704232c2SJohannes Berg  * 802.11 configuration in-kernel interface
16704232c2SJohannes Berg  *
1755682965SJohannes Berg  * Copyright 2006, 2007	Johannes Berg <johannes@sipsolutions.net>
18704232c2SJohannes Berg  */
19704232c2SJohannes Berg 
202ec600d6SLuis Carlos Cobo /**
212ec600d6SLuis Carlos Cobo  * struct vif_params - describes virtual interface parameters
222ec600d6SLuis Carlos Cobo  * @mesh_id: mesh ID to use
232ec600d6SLuis Carlos Cobo  * @mesh_id_len: length of the mesh ID
242ec600d6SLuis Carlos Cobo  */
252ec600d6SLuis Carlos Cobo struct vif_params {
262ec600d6SLuis Carlos Cobo        u8 *mesh_id;
272ec600d6SLuis Carlos Cobo        int mesh_id_len;
282ec600d6SLuis Carlos Cobo };
292ec600d6SLuis Carlos Cobo 
30179f831bSAndy Green /* Radiotap header iteration
31179f831bSAndy Green  *   implemented in net/wireless/radiotap.c
32179f831bSAndy Green  *   docs in Documentation/networking/radiotap-headers.txt
33179f831bSAndy Green  */
34179f831bSAndy Green /**
35179f831bSAndy Green  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
36179f831bSAndy Green  * @rtheader: pointer to the radiotap header we are walking through
37179f831bSAndy Green  * @max_length: length of radiotap header in cpu byte ordering
38179f831bSAndy Green  * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg
39179f831bSAndy Green  * @this_arg: pointer to current radiotap arg
40179f831bSAndy Green  * @arg_index: internal next argument index
41179f831bSAndy Green  * @arg: internal next argument pointer
42179f831bSAndy Green  * @next_bitmap: internal pointer to next present u32
43179f831bSAndy Green  * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
44179f831bSAndy Green  */
45179f831bSAndy Green 
46179f831bSAndy Green struct ieee80211_radiotap_iterator {
47179f831bSAndy Green 	struct ieee80211_radiotap_header *rtheader;
48179f831bSAndy Green 	int max_length;
49179f831bSAndy Green 	int this_arg_index;
50179f831bSAndy Green 	u8 *this_arg;
51179f831bSAndy Green 
52179f831bSAndy Green 	int arg_index;
53179f831bSAndy Green 	u8 *arg;
54179f831bSAndy Green 	__le32 *next_bitmap;
55179f831bSAndy Green 	u32 bitmap_shifter;
56179f831bSAndy Green };
57179f831bSAndy Green 
58179f831bSAndy Green extern int ieee80211_radiotap_iterator_init(
59179f831bSAndy Green    struct ieee80211_radiotap_iterator *iterator,
60179f831bSAndy Green    struct ieee80211_radiotap_header *radiotap_header,
61179f831bSAndy Green    int max_length);
62179f831bSAndy Green 
63179f831bSAndy Green extern int ieee80211_radiotap_iterator_next(
64179f831bSAndy Green    struct ieee80211_radiotap_iterator *iterator);
65179f831bSAndy Green 
66179f831bSAndy Green 
6741ade00fSJohannes Berg  /**
6841ade00fSJohannes Berg  * struct key_params - key information
6941ade00fSJohannes Berg  *
7041ade00fSJohannes Berg  * Information about a key
7141ade00fSJohannes Berg  *
7241ade00fSJohannes Berg  * @key: key material
7341ade00fSJohannes Berg  * @key_len: length of key material
7441ade00fSJohannes Berg  * @cipher: cipher suite selector
7541ade00fSJohannes Berg  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
7641ade00fSJohannes Berg  *	with the get_key() callback, must be in little endian,
7741ade00fSJohannes Berg  *	length given by @seq_len.
7841ade00fSJohannes Berg  */
7941ade00fSJohannes Berg struct key_params {
8041ade00fSJohannes Berg 	u8 *key;
8141ade00fSJohannes Berg 	u8 *seq;
8241ade00fSJohannes Berg 	int key_len;
8341ade00fSJohannes Berg 	int seq_len;
8441ade00fSJohannes Berg 	u32 cipher;
8541ade00fSJohannes Berg };
8641ade00fSJohannes Berg 
87ed1b6cc7SJohannes Berg /**
88ed1b6cc7SJohannes Berg  * struct beacon_parameters - beacon parameters
89ed1b6cc7SJohannes Berg  *
90ed1b6cc7SJohannes Berg  * Used to configure the beacon for an interface.
91ed1b6cc7SJohannes Berg  *
92ed1b6cc7SJohannes Berg  * @head: head portion of beacon (before TIM IE)
93ed1b6cc7SJohannes Berg  *     or %NULL if not changed
94ed1b6cc7SJohannes Berg  * @tail: tail portion of beacon (after TIM IE)
95ed1b6cc7SJohannes Berg  *     or %NULL if not changed
96ed1b6cc7SJohannes Berg  * @interval: beacon interval or zero if not changed
97ed1b6cc7SJohannes Berg  * @dtim_period: DTIM period or zero if not changed
98ed1b6cc7SJohannes Berg  * @head_len: length of @head
99ed1b6cc7SJohannes Berg  * @tail_len: length of @tail
100ed1b6cc7SJohannes Berg  */
101ed1b6cc7SJohannes Berg struct beacon_parameters {
102ed1b6cc7SJohannes Berg 	u8 *head, *tail;
103ed1b6cc7SJohannes Berg 	int interval, dtim_period;
104ed1b6cc7SJohannes Berg 	int head_len, tail_len;
105ed1b6cc7SJohannes Berg };
106ed1b6cc7SJohannes Berg 
1075727ef1bSJohannes Berg /**
1085727ef1bSJohannes Berg  * enum station_flags - station flags
1095727ef1bSJohannes Berg  *
1105727ef1bSJohannes Berg  * Station capability flags. Note that these must be the bits
1115727ef1bSJohannes Berg  * according to the nl80211 flags.
1125727ef1bSJohannes Berg  *
1135727ef1bSJohannes Berg  * @STATION_FLAG_CHANGED: station flags were changed
1145727ef1bSJohannes Berg  * @STATION_FLAG_AUTHORIZED: station is authorized to send frames (802.1X)
1155727ef1bSJohannes Berg  * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
1165727ef1bSJohannes Berg  *	with short preambles
1175727ef1bSJohannes Berg  * @STATION_FLAG_WME: station is WME/QoS capable
1185394af4dSJouni Malinen  * @STATION_FLAG_MFP: station uses management frame protection
1195727ef1bSJohannes Berg  */
1205727ef1bSJohannes Berg enum station_flags {
1215727ef1bSJohannes Berg 	STATION_FLAG_CHANGED		= 1<<0,
1225727ef1bSJohannes Berg 	STATION_FLAG_AUTHORIZED		= 1<<NL80211_STA_FLAG_AUTHORIZED,
1235727ef1bSJohannes Berg 	STATION_FLAG_SHORT_PREAMBLE	= 1<<NL80211_STA_FLAG_SHORT_PREAMBLE,
1245727ef1bSJohannes Berg 	STATION_FLAG_WME		= 1<<NL80211_STA_FLAG_WME,
1255394af4dSJouni Malinen 	STATION_FLAG_MFP		= 1<<NL80211_STA_FLAG_MFP,
1265727ef1bSJohannes Berg };
1275727ef1bSJohannes Berg 
1285727ef1bSJohannes Berg /**
1292ec600d6SLuis Carlos Cobo  * enum plink_action - actions to perform in mesh peers
1302ec600d6SLuis Carlos Cobo  *
1312ec600d6SLuis Carlos Cobo  * @PLINK_ACTION_INVALID: action 0 is reserved
1322ec600d6SLuis Carlos Cobo  * @PLINK_ACTION_OPEN: start mesh peer link establishment
1332ec600d6SLuis Carlos Cobo  * @PLINK_ACTION_BLOCL: block traffic from this mesh peer
1342ec600d6SLuis Carlos Cobo  */
1352ec600d6SLuis Carlos Cobo enum plink_actions {
1362ec600d6SLuis Carlos Cobo 	PLINK_ACTION_INVALID,
1372ec600d6SLuis Carlos Cobo 	PLINK_ACTION_OPEN,
1382ec600d6SLuis Carlos Cobo 	PLINK_ACTION_BLOCK,
1392ec600d6SLuis Carlos Cobo };
1402ec600d6SLuis Carlos Cobo 
1412ec600d6SLuis Carlos Cobo /**
1425727ef1bSJohannes Berg  * struct station_parameters - station parameters
1435727ef1bSJohannes Berg  *
1445727ef1bSJohannes Berg  * Used to change and create a new station.
1455727ef1bSJohannes Berg  *
1465727ef1bSJohannes Berg  * @vlan: vlan interface station should belong to
1475727ef1bSJohannes Berg  * @supported_rates: supported rates in IEEE 802.11 format
1485727ef1bSJohannes Berg  *	(or NULL for no change)
1495727ef1bSJohannes Berg  * @supported_rates_len: number of supported rates
1505727ef1bSJohannes Berg  * @station_flags: station flags (see &enum station_flags)
1515727ef1bSJohannes Berg  * @listen_interval: listen interval or -1 for no change
1525727ef1bSJohannes Berg  * @aid: AID or zero for no change
1535727ef1bSJohannes Berg  */
1545727ef1bSJohannes Berg struct station_parameters {
1555727ef1bSJohannes Berg 	u8 *supported_rates;
1565727ef1bSJohannes Berg 	struct net_device *vlan;
1575727ef1bSJohannes Berg 	u32 station_flags;
1585727ef1bSJohannes Berg 	int listen_interval;
1595727ef1bSJohannes Berg 	u16 aid;
1605727ef1bSJohannes Berg 	u8 supported_rates_len;
1612ec600d6SLuis Carlos Cobo 	u8 plink_action;
16236aedc90SJouni Malinen 	struct ieee80211_ht_cap *ht_capa;
1635727ef1bSJohannes Berg };
1645727ef1bSJohannes Berg 
165fd5b74dcSJohannes Berg /**
1662ec600d6SLuis Carlos Cobo  * enum station_info_flags - station information flags
167fd5b74dcSJohannes Berg  *
1682ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct station_info
1692ec600d6SLuis Carlos Cobo  * it has filled in during get_station() or dump_station().
170fd5b74dcSJohannes Berg  *
1712ec600d6SLuis Carlos Cobo  * @STATION_INFO_INACTIVE_TIME: @inactive_time filled
1722ec600d6SLuis Carlos Cobo  * @STATION_INFO_RX_BYTES: @rx_bytes filled
1732ec600d6SLuis Carlos Cobo  * @STATION_INFO_TX_BYTES: @tx_bytes filled
1742ec600d6SLuis Carlos Cobo  * @STATION_INFO_LLID: @llid filled
1752ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLID: @plid filled
1762ec600d6SLuis Carlos Cobo  * @STATION_INFO_PLINK_STATE: @plink_state filled
177420e7fabSHenning Rogge  * @STATION_INFO_SIGNAL: @signal filled
178420e7fabSHenning Rogge  * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled
179420e7fabSHenning Rogge  *  (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
18098c8a60aSJouni Malinen  * @STATION_INFO_RX_PACKETS: @rx_packets filled
18198c8a60aSJouni Malinen  * @STATION_INFO_TX_PACKETS: @tx_packets filled
182fd5b74dcSJohannes Berg  */
1832ec600d6SLuis Carlos Cobo enum station_info_flags {
1842ec600d6SLuis Carlos Cobo 	STATION_INFO_INACTIVE_TIME	= 1<<0,
1852ec600d6SLuis Carlos Cobo 	STATION_INFO_RX_BYTES		= 1<<1,
1862ec600d6SLuis Carlos Cobo 	STATION_INFO_TX_BYTES		= 1<<2,
1872ec600d6SLuis Carlos Cobo 	STATION_INFO_LLID		= 1<<3,
1882ec600d6SLuis Carlos Cobo 	STATION_INFO_PLID		= 1<<4,
1892ec600d6SLuis Carlos Cobo 	STATION_INFO_PLINK_STATE	= 1<<5,
190420e7fabSHenning Rogge 	STATION_INFO_SIGNAL		= 1<<6,
191420e7fabSHenning Rogge 	STATION_INFO_TX_BITRATE		= 1<<7,
19298c8a60aSJouni Malinen 	STATION_INFO_RX_PACKETS		= 1<<8,
19398c8a60aSJouni Malinen 	STATION_INFO_TX_PACKETS		= 1<<9,
194420e7fabSHenning Rogge };
195420e7fabSHenning Rogge 
196420e7fabSHenning Rogge /**
197420e7fabSHenning Rogge  * enum station_info_rate_flags - bitrate info flags
198420e7fabSHenning Rogge  *
199420e7fabSHenning Rogge  * Used by the driver to indicate the specific rate transmission
200420e7fabSHenning Rogge  * type for 802.11n transmissions.
201420e7fabSHenning Rogge  *
202420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled
203420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission
204420e7fabSHenning Rogge  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
205420e7fabSHenning Rogge  */
206420e7fabSHenning Rogge enum rate_info_flags {
207420e7fabSHenning Rogge 	RATE_INFO_FLAGS_MCS		= 1<<0,
208420e7fabSHenning Rogge 	RATE_INFO_FLAGS_40_MHZ_WIDTH	= 1<<1,
209420e7fabSHenning Rogge 	RATE_INFO_FLAGS_SHORT_GI	= 1<<2,
210420e7fabSHenning Rogge };
211420e7fabSHenning Rogge 
212420e7fabSHenning Rogge /**
213420e7fabSHenning Rogge  * struct rate_info - bitrate information
214420e7fabSHenning Rogge  *
215420e7fabSHenning Rogge  * Information about a receiving or transmitting bitrate
216420e7fabSHenning Rogge  *
217420e7fabSHenning Rogge  * @flags: bitflag of flags from &enum rate_info_flags
218420e7fabSHenning Rogge  * @mcs: mcs index if struct describes a 802.11n bitrate
219420e7fabSHenning Rogge  * @legacy: bitrate in 100kbit/s for 802.11abg
220420e7fabSHenning Rogge  */
221420e7fabSHenning Rogge struct rate_info {
222420e7fabSHenning Rogge 	u8 flags;
223420e7fabSHenning Rogge 	u8 mcs;
224420e7fabSHenning Rogge 	u16 legacy;
225fd5b74dcSJohannes Berg };
226fd5b74dcSJohannes Berg 
227fd5b74dcSJohannes Berg /**
2282ec600d6SLuis Carlos Cobo  * struct station_info - station information
229fd5b74dcSJohannes Berg  *
2302ec600d6SLuis Carlos Cobo  * Station information filled by driver for get_station() and dump_station.
231fd5b74dcSJohannes Berg  *
2322ec600d6SLuis Carlos Cobo  * @filled: bitflag of flags from &enum station_info_flags
233fd5b74dcSJohannes Berg  * @inactive_time: time since last station activity (tx/rx) in milliseconds
234fd5b74dcSJohannes Berg  * @rx_bytes: bytes received from this station
235fd5b74dcSJohannes Berg  * @tx_bytes: bytes transmitted to this station
2362ec600d6SLuis Carlos Cobo  * @llid: mesh local link id
2372ec600d6SLuis Carlos Cobo  * @plid: mesh peer link id
2382ec600d6SLuis Carlos Cobo  * @plink_state: mesh peer link state
239420e7fabSHenning Rogge  * @signal: signal strength of last received packet in dBm
240420e7fabSHenning Rogge  * @txrate: current unicast bitrate to this station
24198c8a60aSJouni Malinen  * @rx_packets: packets received from this station
24298c8a60aSJouni Malinen  * @tx_packets: packets transmitted to this station
243fd5b74dcSJohannes Berg  */
2442ec600d6SLuis Carlos Cobo struct station_info {
245fd5b74dcSJohannes Berg 	u32 filled;
246fd5b74dcSJohannes Berg 	u32 inactive_time;
247fd5b74dcSJohannes Berg 	u32 rx_bytes;
248fd5b74dcSJohannes Berg 	u32 tx_bytes;
2492ec600d6SLuis Carlos Cobo 	u16 llid;
2502ec600d6SLuis Carlos Cobo 	u16 plid;
2512ec600d6SLuis Carlos Cobo 	u8 plink_state;
252420e7fabSHenning Rogge 	s8 signal;
253420e7fabSHenning Rogge 	struct rate_info txrate;
25498c8a60aSJouni Malinen 	u32 rx_packets;
25598c8a60aSJouni Malinen 	u32 tx_packets;
256fd5b74dcSJohannes Berg };
257fd5b74dcSJohannes Berg 
25866f7ac50SMichael Wu /**
25966f7ac50SMichael Wu  * enum monitor_flags - monitor flags
26066f7ac50SMichael Wu  *
26166f7ac50SMichael Wu  * Monitor interface configuration flags. Note that these must be the bits
26266f7ac50SMichael Wu  * according to the nl80211 flags.
26366f7ac50SMichael Wu  *
26466f7ac50SMichael Wu  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
26566f7ac50SMichael Wu  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
26666f7ac50SMichael Wu  * @MONITOR_FLAG_CONTROL: pass control frames
26766f7ac50SMichael Wu  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
26866f7ac50SMichael Wu  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
26966f7ac50SMichael Wu  */
27066f7ac50SMichael Wu enum monitor_flags {
27166f7ac50SMichael Wu 	MONITOR_FLAG_FCSFAIL		= 1<<NL80211_MNTR_FLAG_FCSFAIL,
27266f7ac50SMichael Wu 	MONITOR_FLAG_PLCPFAIL		= 1<<NL80211_MNTR_FLAG_PLCPFAIL,
27366f7ac50SMichael Wu 	MONITOR_FLAG_CONTROL		= 1<<NL80211_MNTR_FLAG_CONTROL,
27466f7ac50SMichael Wu 	MONITOR_FLAG_OTHER_BSS		= 1<<NL80211_MNTR_FLAG_OTHER_BSS,
27566f7ac50SMichael Wu 	MONITOR_FLAG_COOK_FRAMES	= 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
27666f7ac50SMichael Wu };
27766f7ac50SMichael Wu 
2782ec600d6SLuis Carlos Cobo /**
2792ec600d6SLuis Carlos Cobo  * enum mpath_info_flags -  mesh path information flags
2802ec600d6SLuis Carlos Cobo  *
2812ec600d6SLuis Carlos Cobo  * Used by the driver to indicate which info in &struct mpath_info it has filled
2822ec600d6SLuis Carlos Cobo  * in during get_station() or dump_station().
2832ec600d6SLuis Carlos Cobo  *
2842ec600d6SLuis Carlos Cobo  * MPATH_INFO_FRAME_QLEN: @frame_qlen filled
2852ec600d6SLuis Carlos Cobo  * MPATH_INFO_DSN: @dsn filled
2862ec600d6SLuis Carlos Cobo  * MPATH_INFO_METRIC: @metric filled
2872ec600d6SLuis Carlos Cobo  * MPATH_INFO_EXPTIME: @exptime filled
2882ec600d6SLuis Carlos Cobo  * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
2892ec600d6SLuis Carlos Cobo  * MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
2902ec600d6SLuis Carlos Cobo  * MPATH_INFO_FLAGS: @flags filled
2912ec600d6SLuis Carlos Cobo  */
2922ec600d6SLuis Carlos Cobo enum mpath_info_flags {
2932ec600d6SLuis Carlos Cobo 	MPATH_INFO_FRAME_QLEN		= BIT(0),
2942ec600d6SLuis Carlos Cobo 	MPATH_INFO_DSN			= BIT(1),
2952ec600d6SLuis Carlos Cobo 	MPATH_INFO_METRIC		= BIT(2),
2962ec600d6SLuis Carlos Cobo 	MPATH_INFO_EXPTIME		= BIT(3),
2972ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_TIMEOUT	= BIT(4),
2982ec600d6SLuis Carlos Cobo 	MPATH_INFO_DISCOVERY_RETRIES	= BIT(5),
2992ec600d6SLuis Carlos Cobo 	MPATH_INFO_FLAGS		= BIT(6),
3002ec600d6SLuis Carlos Cobo };
3012ec600d6SLuis Carlos Cobo 
3022ec600d6SLuis Carlos Cobo /**
3032ec600d6SLuis Carlos Cobo  * struct mpath_info - mesh path information
3042ec600d6SLuis Carlos Cobo  *
3052ec600d6SLuis Carlos Cobo  * Mesh path information filled by driver for get_mpath() and dump_mpath().
3062ec600d6SLuis Carlos Cobo  *
3072ec600d6SLuis Carlos Cobo  * @filled: bitfield of flags from &enum mpath_info_flags
3082ec600d6SLuis Carlos Cobo  * @frame_qlen: number of queued frames for this destination
3092ec600d6SLuis Carlos Cobo  * @dsn: destination sequence number
3102ec600d6SLuis Carlos Cobo  * @metric: metric (cost) of this mesh path
3112ec600d6SLuis Carlos Cobo  * @exptime: expiration time for the mesh path from now, in msecs
3122ec600d6SLuis Carlos Cobo  * @flags: mesh path flags
3132ec600d6SLuis Carlos Cobo  * @discovery_timeout: total mesh path discovery timeout, in msecs
3142ec600d6SLuis Carlos Cobo  * @discovery_retries: mesh path discovery retries
3152ec600d6SLuis Carlos Cobo  */
3162ec600d6SLuis Carlos Cobo struct mpath_info {
3172ec600d6SLuis Carlos Cobo 	u32 filled;
3182ec600d6SLuis Carlos Cobo 	u32 frame_qlen;
3192ec600d6SLuis Carlos Cobo 	u32 dsn;
3202ec600d6SLuis Carlos Cobo 	u32 metric;
3212ec600d6SLuis Carlos Cobo 	u32 exptime;
3222ec600d6SLuis Carlos Cobo 	u32 discovery_timeout;
3232ec600d6SLuis Carlos Cobo 	u8 discovery_retries;
3242ec600d6SLuis Carlos Cobo 	u8 flags;
3252ec600d6SLuis Carlos Cobo };
3262ec600d6SLuis Carlos Cobo 
3279f1ba906SJouni Malinen /**
3289f1ba906SJouni Malinen  * struct bss_parameters - BSS parameters
3299f1ba906SJouni Malinen  *
3309f1ba906SJouni Malinen  * Used to change BSS parameters (mainly for AP mode).
3319f1ba906SJouni Malinen  *
3329f1ba906SJouni Malinen  * @use_cts_prot: Whether to use CTS protection
3339f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
3349f1ba906SJouni Malinen  * @use_short_preamble: Whether the use of short preambles is allowed
3359f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
3369f1ba906SJouni Malinen  * @use_short_slot_time: Whether the use of short slot time is allowed
3379f1ba906SJouni Malinen  *	(0 = no, 1 = yes, -1 = do not change)
33890c97a04SJouni Malinen  * @basic_rates: basic rates in IEEE 802.11 format
33990c97a04SJouni Malinen  *	(or NULL for no change)
34090c97a04SJouni Malinen  * @basic_rates_len: number of basic rates
3419f1ba906SJouni Malinen  */
3429f1ba906SJouni Malinen struct bss_parameters {
3439f1ba906SJouni Malinen 	int use_cts_prot;
3449f1ba906SJouni Malinen 	int use_short_preamble;
3459f1ba906SJouni Malinen 	int use_short_slot_time;
34690c97a04SJouni Malinen 	u8 *basic_rates;
34790c97a04SJouni Malinen 	u8 basic_rates_len;
3489f1ba906SJouni Malinen };
3492ec600d6SLuis Carlos Cobo 
350b2e1b302SLuis R. Rodriguez /**
351716f9392SLuis R. Rodriguez  * enum environment_cap - Environment parsed from country IE
352716f9392SLuis R. Rodriguez  * @ENVIRON_ANY: indicates country IE applies to both indoor and
353716f9392SLuis R. Rodriguez  *	outdoor operation.
354716f9392SLuis R. Rodriguez  * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
355716f9392SLuis R. Rodriguez  * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
356716f9392SLuis R. Rodriguez  */
357716f9392SLuis R. Rodriguez enum environment_cap {
358716f9392SLuis R. Rodriguez 	ENVIRON_ANY,
359716f9392SLuis R. Rodriguez 	ENVIRON_INDOOR,
360716f9392SLuis R. Rodriguez 	ENVIRON_OUTDOOR,
361716f9392SLuis R. Rodriguez };
362716f9392SLuis R. Rodriguez 
363716f9392SLuis R. Rodriguez /**
364806a9e39SLuis R. Rodriguez  * struct regulatory_request - used to keep track of regulatory requests
365716f9392SLuis R. Rodriguez  *
366806a9e39SLuis R. Rodriguez  * @wiphy_idx: this is set if this request's initiator is
367716f9392SLuis R. Rodriguez  * 	%REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
368716f9392SLuis R. Rodriguez  * 	can be used by the wireless core to deal with conflicts
369716f9392SLuis R. Rodriguez  * 	and potentially inform users of which devices specifically
370716f9392SLuis R. Rodriguez  * 	cased the conflicts.
371716f9392SLuis R. Rodriguez  * @initiator: indicates who sent this request, could be any of
3727db90f4aSLuis R. Rodriguez  * 	of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*)
373716f9392SLuis R. Rodriguez  * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
374716f9392SLuis R. Rodriguez  * 	regulatory domain. We have a few special codes:
375716f9392SLuis R. Rodriguez  * 	00 - World regulatory domain
376716f9392SLuis R. Rodriguez  * 	99 - built by driver but a specific alpha2 cannot be determined
377716f9392SLuis R. Rodriguez  * 	98 - result of an intersection between two regulatory domains
378716f9392SLuis R. Rodriguez  * @intersect: indicates whether the wireless core should intersect
379716f9392SLuis R. Rodriguez  * 	the requested regulatory domain with the presently set regulatory
380716f9392SLuis R. Rodriguez  * 	domain.
381716f9392SLuis R. Rodriguez  * @country_ie_checksum: checksum of the last processed and accepted
382716f9392SLuis R. Rodriguez  * 	country IE
383716f9392SLuis R. Rodriguez  * @country_ie_env: lets us know if the AP is telling us we are outdoor,
384716f9392SLuis R. Rodriguez  * 	indoor, or if it doesn't matter
385fe33eb39SLuis R. Rodriguez  * @list: used to insert into the reg_requests_list linked list
386716f9392SLuis R. Rodriguez  */
387716f9392SLuis R. Rodriguez struct regulatory_request {
388806a9e39SLuis R. Rodriguez 	int wiphy_idx;
3897db90f4aSLuis R. Rodriguez 	enum nl80211_reg_initiator initiator;
390716f9392SLuis R. Rodriguez 	char alpha2[2];
391716f9392SLuis R. Rodriguez 	bool intersect;
392716f9392SLuis R. Rodriguez 	u32 country_ie_checksum;
393716f9392SLuis R. Rodriguez 	enum environment_cap country_ie_env;
394fe33eb39SLuis R. Rodriguez 	struct list_head list;
395716f9392SLuis R. Rodriguez };
396716f9392SLuis R. Rodriguez 
397b2e1b302SLuis R. Rodriguez struct ieee80211_freq_range {
398b2e1b302SLuis R. Rodriguez 	u32 start_freq_khz;
399b2e1b302SLuis R. Rodriguez 	u32 end_freq_khz;
400b2e1b302SLuis R. Rodriguez 	u32 max_bandwidth_khz;
401b2e1b302SLuis R. Rodriguez };
402b2e1b302SLuis R. Rodriguez 
403b2e1b302SLuis R. Rodriguez struct ieee80211_power_rule {
404b2e1b302SLuis R. Rodriguez 	u32 max_antenna_gain;
405b2e1b302SLuis R. Rodriguez 	u32 max_eirp;
406b2e1b302SLuis R. Rodriguez };
407b2e1b302SLuis R. Rodriguez 
408b2e1b302SLuis R. Rodriguez struct ieee80211_reg_rule {
409b2e1b302SLuis R. Rodriguez 	struct ieee80211_freq_range freq_range;
410b2e1b302SLuis R. Rodriguez 	struct ieee80211_power_rule power_rule;
411b2e1b302SLuis R. Rodriguez 	u32 flags;
412b2e1b302SLuis R. Rodriguez };
413b2e1b302SLuis R. Rodriguez 
414b2e1b302SLuis R. Rodriguez struct ieee80211_regdomain {
415b2e1b302SLuis R. Rodriguez 	u32 n_reg_rules;
416b2e1b302SLuis R. Rodriguez 	char alpha2[2];
417b2e1b302SLuis R. Rodriguez 	struct ieee80211_reg_rule reg_rules[];
418b2e1b302SLuis R. Rodriguez };
419b2e1b302SLuis R. Rodriguez 
420b219cee1SLuis R. Rodriguez #define MHZ_TO_KHZ(freq) ((freq) * 1000)
421b219cee1SLuis R. Rodriguez #define KHZ_TO_MHZ(freq) ((freq) / 1000)
422b219cee1SLuis R. Rodriguez #define DBI_TO_MBI(gain) ((gain) * 100)
423b219cee1SLuis R. Rodriguez #define MBI_TO_DBI(gain) ((gain) / 100)
424b219cee1SLuis R. Rodriguez #define DBM_TO_MBM(gain) ((gain) * 100)
425b219cee1SLuis R. Rodriguez #define MBM_TO_DBM(gain) ((gain) / 100)
426b2e1b302SLuis R. Rodriguez 
427b2e1b302SLuis R. Rodriguez #define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \
428b219cee1SLuis R. Rodriguez 	.freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
429b219cee1SLuis R. Rodriguez 	.freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
430b219cee1SLuis R. Rodriguez 	.freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
431b219cee1SLuis R. Rodriguez 	.power_rule.max_antenna_gain = DBI_TO_MBI(gain), \
432b219cee1SLuis R. Rodriguez 	.power_rule.max_eirp = DBM_TO_MBM(eirp), \
433b2e1b302SLuis R. Rodriguez 	.flags = reg_flags, \
434b2e1b302SLuis R. Rodriguez 	}
435b2e1b302SLuis R. Rodriguez 
43693da9cc1Scolin@cozybit.com struct mesh_config {
43793da9cc1Scolin@cozybit.com 	/* Timeouts in ms */
43893da9cc1Scolin@cozybit.com 	/* Mesh plink management parameters */
43993da9cc1Scolin@cozybit.com 	u16 dot11MeshRetryTimeout;
44093da9cc1Scolin@cozybit.com 	u16 dot11MeshConfirmTimeout;
44193da9cc1Scolin@cozybit.com 	u16 dot11MeshHoldingTimeout;
44293da9cc1Scolin@cozybit.com 	u16 dot11MeshMaxPeerLinks;
44393da9cc1Scolin@cozybit.com 	u8  dot11MeshMaxRetries;
44493da9cc1Scolin@cozybit.com 	u8  dot11MeshTTL;
44593da9cc1Scolin@cozybit.com 	bool auto_open_plinks;
44693da9cc1Scolin@cozybit.com 	/* HWMP parameters */
44793da9cc1Scolin@cozybit.com 	u8  dot11MeshHWMPmaxPREQretries;
44893da9cc1Scolin@cozybit.com 	u32 path_refresh_time;
44993da9cc1Scolin@cozybit.com 	u16 min_discovery_timeout;
45093da9cc1Scolin@cozybit.com 	u32 dot11MeshHWMPactivePathTimeout;
45193da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPpreqMinInterval;
45293da9cc1Scolin@cozybit.com 	u16 dot11MeshHWMPnetDiameterTraversalTime;
45393da9cc1Scolin@cozybit.com };
45493da9cc1Scolin@cozybit.com 
45531888487SJouni Malinen /**
45631888487SJouni Malinen  * struct ieee80211_txq_params - TX queue parameters
45731888487SJouni Malinen  * @queue: TX queue identifier (NL80211_TXQ_Q_*)
45831888487SJouni Malinen  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
45931888487SJouni Malinen  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
46031888487SJouni Malinen  *	1..32767]
46131888487SJouni Malinen  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
46231888487SJouni Malinen  *	1..32767]
46331888487SJouni Malinen  * @aifs: Arbitration interframe space [0..255]
46431888487SJouni Malinen  */
46531888487SJouni Malinen struct ieee80211_txq_params {
46631888487SJouni Malinen 	enum nl80211_txq_q queue;
46731888487SJouni Malinen 	u16 txop;
46831888487SJouni Malinen 	u16 cwmin;
46931888487SJouni Malinen 	u16 cwmax;
47031888487SJouni Malinen 	u8 aifs;
47131888487SJouni Malinen };
47231888487SJouni Malinen 
473704232c2SJohannes Berg /* from net/wireless.h */
474704232c2SJohannes Berg struct wiphy;
475704232c2SJohannes Berg 
47672bdcf34SJouni Malinen /* from net/ieee80211.h */
47772bdcf34SJouni Malinen struct ieee80211_channel;
47872bdcf34SJouni Malinen 
479704232c2SJohannes Berg /**
4802a519311SJohannes Berg  * struct cfg80211_ssid - SSID description
4812a519311SJohannes Berg  * @ssid: the SSID
4822a519311SJohannes Berg  * @ssid_len: length of the ssid
4832a519311SJohannes Berg  */
4842a519311SJohannes Berg struct cfg80211_ssid {
4852a519311SJohannes Berg 	u8 ssid[IEEE80211_MAX_SSID_LEN];
4862a519311SJohannes Berg 	u8 ssid_len;
4872a519311SJohannes Berg };
4882a519311SJohannes Berg 
4892a519311SJohannes Berg /**
4902a519311SJohannes Berg  * struct cfg80211_scan_request - scan request description
4912a519311SJohannes Berg  *
4922a519311SJohannes Berg  * @ssids: SSIDs to scan for (active scan only)
4932a519311SJohannes Berg  * @n_ssids: number of SSIDs
4942a519311SJohannes Berg  * @channels: channels to scan on.
4952a519311SJohannes Berg  * @n_channels: number of channels for each band
49670692ad2SJouni Malinen  * @ie: optional information element(s) to add into Probe Request or %NULL
49770692ad2SJouni Malinen  * @ie_len: length of ie in octets
4982a519311SJohannes Berg  * @wiphy: the wiphy this was for
4992a519311SJohannes Berg  * @ifidx: the interface index
5002a519311SJohannes Berg  */
5012a519311SJohannes Berg struct cfg80211_scan_request {
5022a519311SJohannes Berg 	struct cfg80211_ssid *ssids;
5032a519311SJohannes Berg 	int n_ssids;
5042a519311SJohannes Berg 	struct ieee80211_channel **channels;
5052a519311SJohannes Berg 	u32 n_channels;
506*de95a54bSJohannes Berg 	const u8 *ie;
50770692ad2SJouni Malinen 	size_t ie_len;
5082a519311SJohannes Berg 
5092a519311SJohannes Berg 	/* internal */
5102a519311SJohannes Berg 	struct wiphy *wiphy;
5112a519311SJohannes Berg 	int ifidx;
5122a519311SJohannes Berg };
5132a519311SJohannes Berg 
5142a519311SJohannes Berg /**
5152a519311SJohannes Berg  * enum cfg80211_signal_type - signal type
5162a519311SJohannes Berg  *
5172a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
5182a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
5192a519311SJohannes Berg  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
5202a519311SJohannes Berg  */
5212a519311SJohannes Berg enum cfg80211_signal_type {
5222a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_NONE,
5232a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_MBM,
5242a519311SJohannes Berg 	CFG80211_SIGNAL_TYPE_UNSPEC,
5252a519311SJohannes Berg };
5262a519311SJohannes Berg 
5272a519311SJohannes Berg /**
5282a519311SJohannes Berg  * struct cfg80211_bss - BSS description
5292a519311SJohannes Berg  *
5302a519311SJohannes Berg  * This structure describes a BSS (which may also be a mesh network)
5312a519311SJohannes Berg  * for use in scan results and similar.
5322a519311SJohannes Berg  *
5332a519311SJohannes Berg  * @bssid: BSSID of the BSS
5342a519311SJohannes Berg  * @tsf: timestamp of last received update
5352a519311SJohannes Berg  * @beacon_interval: the beacon interval as from the frame
5362a519311SJohannes Berg  * @capability: the capability field in host byte order
5372a519311SJohannes Berg  * @information_elements: the information elements (Note that there
5382a519311SJohannes Berg  *	is no guarantee that these are well-formed!)
5392a519311SJohannes Berg  * @len_information_elements: total length of the information elements
54077965c97SJohannes Berg  * @signal: signal strength value (type depends on the wiphy's signal_type)
541a08c1c1aSKalle Valo  * @hold: BSS should not expire
54278c1c7e1SJohannes Berg  * @free_priv: function pointer to free private data
5432a519311SJohannes Berg  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
5442a519311SJohannes Berg  */
5452a519311SJohannes Berg struct cfg80211_bss {
5462a519311SJohannes Berg 	struct ieee80211_channel *channel;
5472a519311SJohannes Berg 
5482a519311SJohannes Berg 	u8 bssid[ETH_ALEN];
5492a519311SJohannes Berg 	u64 tsf;
5502a519311SJohannes Berg 	u16 beacon_interval;
5512a519311SJohannes Berg 	u16 capability;
5522a519311SJohannes Berg 	u8 *information_elements;
5532a519311SJohannes Berg 	size_t len_information_elements;
5542a519311SJohannes Berg 
5552a519311SJohannes Berg 	s32 signal;
5562a519311SJohannes Berg 
55778c1c7e1SJohannes Berg 	void (*free_priv)(struct cfg80211_bss *bss);
5582a519311SJohannes Berg 	u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
5592a519311SJohannes Berg };
5602a519311SJohannes Berg 
5612a519311SJohannes Berg /**
562636a5d36SJouni Malinen  * struct cfg80211_auth_request - Authentication request data
563636a5d36SJouni Malinen  *
564636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
565636a5d36SJouni Malinen  * authentication.
566636a5d36SJouni Malinen  * NOTE: This structure will likely change when more code from mac80211 is
567636a5d36SJouni Malinen  * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too.
568636a5d36SJouni Malinen  * Before using this in a driver that does not use mac80211, it would be better
569636a5d36SJouni Malinen  * to check the status of that work and better yet, volunteer to work on it.
570636a5d36SJouni Malinen  *
571636a5d36SJouni Malinen  * @chan: The channel to use or %NULL if not specified (auto-select based on
572636a5d36SJouni Malinen  *	scan results)
573636a5d36SJouni Malinen  * @peer_addr: The address of the peer STA (AP BSSID in infrastructure case);
574636a5d36SJouni Malinen  *	this field is required to be present; if the driver wants to help with
575636a5d36SJouni Malinen  *	BSS selection, it should use (yet to be added) MLME event to allow user
576636a5d36SJouni Malinen  *	space SME to be notified of roaming candidate, so that the SME can then
577636a5d36SJouni Malinen  *	use the authentication request with the recommended BSSID and whatever
578636a5d36SJouni Malinen  *	other data may be needed for authentication/association
579636a5d36SJouni Malinen  * @ssid: SSID or %NULL if not yet available
580636a5d36SJouni Malinen  * @ssid_len: Length of ssid in octets
581636a5d36SJouni Malinen  * @auth_type: Authentication type (algorithm)
582636a5d36SJouni Malinen  * @ie: Extra IEs to add to Authentication frame or %NULL
583636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
584636a5d36SJouni Malinen  */
585636a5d36SJouni Malinen struct cfg80211_auth_request {
586636a5d36SJouni Malinen 	struct ieee80211_channel *chan;
587636a5d36SJouni Malinen 	u8 *peer_addr;
588636a5d36SJouni Malinen 	const u8 *ssid;
589636a5d36SJouni Malinen 	size_t ssid_len;
590636a5d36SJouni Malinen 	enum nl80211_auth_type auth_type;
591636a5d36SJouni Malinen 	const u8 *ie;
592636a5d36SJouni Malinen 	size_t ie_len;
593636a5d36SJouni Malinen };
594636a5d36SJouni Malinen 
595636a5d36SJouni Malinen /**
596636a5d36SJouni Malinen  * struct cfg80211_assoc_request - (Re)Association request data
597636a5d36SJouni Malinen  *
598636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
599636a5d36SJouni Malinen  * (re)association.
600636a5d36SJouni Malinen  * NOTE: This structure will likely change when more code from mac80211 is
601636a5d36SJouni Malinen  * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too.
602636a5d36SJouni Malinen  * Before using this in a driver that does not use mac80211, it would be better
603636a5d36SJouni Malinen  * to check the status of that work and better yet, volunteer to work on it.
604636a5d36SJouni Malinen  *
605636a5d36SJouni Malinen  * @chan: The channel to use or %NULL if not specified (auto-select based on
606636a5d36SJouni Malinen  *	scan results)
607636a5d36SJouni Malinen  * @peer_addr: The address of the peer STA (AP BSSID); this field is required
608636a5d36SJouni Malinen  *	to be present and the STA must be in State 2 (authenticated) with the
609636a5d36SJouni Malinen  *	peer STA
610636a5d36SJouni Malinen  * @ssid: SSID
611636a5d36SJouni Malinen  * @ssid_len: Length of ssid in octets
612636a5d36SJouni Malinen  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
613636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
614636a5d36SJouni Malinen  */
615636a5d36SJouni Malinen struct cfg80211_assoc_request {
616636a5d36SJouni Malinen 	struct ieee80211_channel *chan;
617636a5d36SJouni Malinen 	u8 *peer_addr;
618636a5d36SJouni Malinen 	const u8 *ssid;
619636a5d36SJouni Malinen 	size_t ssid_len;
620636a5d36SJouni Malinen 	const u8 *ie;
621636a5d36SJouni Malinen 	size_t ie_len;
622636a5d36SJouni Malinen };
623636a5d36SJouni Malinen 
624636a5d36SJouni Malinen /**
625636a5d36SJouni Malinen  * struct cfg80211_deauth_request - Deauthentication request data
626636a5d36SJouni Malinen  *
627636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
628636a5d36SJouni Malinen  * deauthentication.
629636a5d36SJouni Malinen  *
630636a5d36SJouni Malinen  * @peer_addr: The address of the peer STA (AP BSSID); this field is required
631636a5d36SJouni Malinen  *	to be present and the STA must be authenticated with the peer STA
632636a5d36SJouni Malinen  * @ie: Extra IEs to add to Deauthentication frame or %NULL
633636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
634636a5d36SJouni Malinen  */
635636a5d36SJouni Malinen struct cfg80211_deauth_request {
636636a5d36SJouni Malinen 	u8 *peer_addr;
637636a5d36SJouni Malinen 	u16 reason_code;
638636a5d36SJouni Malinen 	const u8 *ie;
639636a5d36SJouni Malinen 	size_t ie_len;
640636a5d36SJouni Malinen };
641636a5d36SJouni Malinen 
642636a5d36SJouni Malinen /**
643636a5d36SJouni Malinen  * struct cfg80211_disassoc_request - Disassociation request data
644636a5d36SJouni Malinen  *
645636a5d36SJouni Malinen  * This structure provides information needed to complete IEEE 802.11
646636a5d36SJouni Malinen  * disassocation.
647636a5d36SJouni Malinen  *
648636a5d36SJouni Malinen  * @peer_addr: The address of the peer STA (AP BSSID); this field is required
649636a5d36SJouni Malinen  *	to be present and the STA must be associated with the peer STA
650636a5d36SJouni Malinen  * @ie: Extra IEs to add to Disassociation frame or %NULL
651636a5d36SJouni Malinen  * @ie_len: Length of ie buffer in octets
652636a5d36SJouni Malinen  */
653636a5d36SJouni Malinen struct cfg80211_disassoc_request {
654636a5d36SJouni Malinen 	u8 *peer_addr;
655636a5d36SJouni Malinen 	u16 reason_code;
656636a5d36SJouni Malinen 	const u8 *ie;
657636a5d36SJouni Malinen 	size_t ie_len;
658636a5d36SJouni Malinen };
659636a5d36SJouni Malinen 
660636a5d36SJouni Malinen /**
661704232c2SJohannes Berg  * struct cfg80211_ops - backend description for wireless configuration
662704232c2SJohannes Berg  *
663704232c2SJohannes Berg  * This struct is registered by fullmac card drivers and/or wireless stacks
664704232c2SJohannes Berg  * in order to handle configuration requests on their interfaces.
665704232c2SJohannes Berg  *
666704232c2SJohannes Berg  * All callbacks except where otherwise noted should return 0
667704232c2SJohannes Berg  * on success or a negative error code.
668704232c2SJohannes Berg  *
66943fb45cbSJohannes Berg  * All operations are currently invoked under rtnl for consistency with the
67043fb45cbSJohannes Berg  * wireless extensions but this is subject to reevaluation as soon as this
67143fb45cbSJohannes Berg  * code is used more widely and we have a first user without wext.
67243fb45cbSJohannes Berg  *
6730378b3f1SJohannes Berg  * @suspend: wiphy device needs to be suspended
6740378b3f1SJohannes Berg  * @resume: wiphy device needs to be resumed
6750378b3f1SJohannes Berg  *
67660719ffdSJohannes Berg  * @add_virtual_intf: create a new virtual interface with the given name,
67760719ffdSJohannes Berg  *	must set the struct wireless_dev's iftype.
678704232c2SJohannes Berg  *
679704232c2SJohannes Berg  * @del_virtual_intf: remove the virtual interface determined by ifindex.
68055682965SJohannes Berg  *
68160719ffdSJohannes Berg  * @change_virtual_intf: change type/configuration of virtual interface,
68260719ffdSJohannes Berg  *	keep the struct wireless_dev's iftype updated.
68355682965SJohannes Berg  *
68441ade00fSJohannes Berg  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
68541ade00fSJohannes Berg  *	when adding a group key.
68641ade00fSJohannes Berg  *
68741ade00fSJohannes Berg  * @get_key: get information about the key with the given parameters.
68841ade00fSJohannes Berg  *	@mac_addr will be %NULL when requesting information for a group
68941ade00fSJohannes Berg  *	key. All pointers given to the @callback function need not be valid
69041ade00fSJohannes Berg  *	after it returns.
69141ade00fSJohannes Berg  *
69241ade00fSJohannes Berg  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
69341ade00fSJohannes Berg  *	and @key_index
69441ade00fSJohannes Berg  *
69541ade00fSJohannes Berg  * @set_default_key: set the default key on an interface
696ed1b6cc7SJohannes Berg  *
6973cfcf6acSJouni Malinen  * @set_default_mgmt_key: set the default management frame key on an interface
6983cfcf6acSJouni Malinen  *
699ed1b6cc7SJohannes Berg  * @add_beacon: Add a beacon with given parameters, @head, @interval
700ed1b6cc7SJohannes Berg  *	and @dtim_period will be valid, @tail is optional.
701ed1b6cc7SJohannes Berg  * @set_beacon: Change the beacon parameters for an access point mode
702ed1b6cc7SJohannes Berg  *	interface. This should reject the call when no beacon has been
703ed1b6cc7SJohannes Berg  *	configured.
704ed1b6cc7SJohannes Berg  * @del_beacon: Remove beacon configuration and stop sending the beacon.
7055727ef1bSJohannes Berg  *
7065727ef1bSJohannes Berg  * @add_station: Add a new station.
7075727ef1bSJohannes Berg  *
7085727ef1bSJohannes Berg  * @del_station: Remove a station; @mac may be NULL to remove all stations.
7095727ef1bSJohannes Berg  *
7105727ef1bSJohannes Berg  * @change_station: Modify a given station.
7112ec600d6SLuis Carlos Cobo  *
71293da9cc1Scolin@cozybit.com  * @get_mesh_params: Put the current mesh parameters into *params
71393da9cc1Scolin@cozybit.com  *
71493da9cc1Scolin@cozybit.com  * @set_mesh_params: Set mesh parameters.
71593da9cc1Scolin@cozybit.com  *	The mask is a bitfield which tells us which parameters to
71693da9cc1Scolin@cozybit.com  *	set, and which to leave alone.
71793da9cc1Scolin@cozybit.com  *
7182ec600d6SLuis Carlos Cobo  * @set_mesh_cfg: set mesh parameters (by now, just mesh id)
7199f1ba906SJouni Malinen  *
7209f1ba906SJouni Malinen  * @change_bss: Modify parameters for a given BSS.
72131888487SJouni Malinen  *
72231888487SJouni Malinen  * @set_txq_params: Set TX queue parameters
72372bdcf34SJouni Malinen  *
72472bdcf34SJouni Malinen  * @set_channel: Set channel
7259aed3cc1SJouni Malinen  *
7262a519311SJohannes Berg  * @scan: Request to do a scan. If returning zero, the scan request is given
7272a519311SJohannes Berg  *	the driver, and will be valid until passed to cfg80211_scan_done().
7282a519311SJohannes Berg  *	For scan results, call cfg80211_inform_bss(); you can call this outside
7292a519311SJohannes Berg  *	the scan/scan_done bracket too.
730636a5d36SJouni Malinen  *
731636a5d36SJouni Malinen  * @auth: Request to authenticate with the specified peer
732636a5d36SJouni Malinen  * @assoc: Request to (re)associate with the specified peer
733636a5d36SJouni Malinen  * @deauth: Request to deauthenticate from the specified peer
734636a5d36SJouni Malinen  * @disassoc: Request to disassociate from the specified peer
735704232c2SJohannes Berg  */
736704232c2SJohannes Berg struct cfg80211_ops {
7370378b3f1SJohannes Berg 	int	(*suspend)(struct wiphy *wiphy);
7380378b3f1SJohannes Berg 	int	(*resume)(struct wiphy *wiphy);
7390378b3f1SJohannes Berg 
740704232c2SJohannes Berg 	int	(*add_virtual_intf)(struct wiphy *wiphy, char *name,
7412ec600d6SLuis Carlos Cobo 				    enum nl80211_iftype type, u32 *flags,
7422ec600d6SLuis Carlos Cobo 				    struct vif_params *params);
743704232c2SJohannes Berg 	int	(*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
74455682965SJohannes Berg 	int	(*change_virtual_intf)(struct wiphy *wiphy, int ifindex,
7452ec600d6SLuis Carlos Cobo 				       enum nl80211_iftype type, u32 *flags,
7462ec600d6SLuis Carlos Cobo 				       struct vif_params *params);
74741ade00fSJohannes Berg 
74841ade00fSJohannes Berg 	int	(*add_key)(struct wiphy *wiphy, struct net_device *netdev,
74941ade00fSJohannes Berg 			   u8 key_index, u8 *mac_addr,
75041ade00fSJohannes Berg 			   struct key_params *params);
75141ade00fSJohannes Berg 	int	(*get_key)(struct wiphy *wiphy, struct net_device *netdev,
75241ade00fSJohannes Berg 			   u8 key_index, u8 *mac_addr, void *cookie,
75341ade00fSJohannes Berg 			   void (*callback)(void *cookie, struct key_params*));
75441ade00fSJohannes Berg 	int	(*del_key)(struct wiphy *wiphy, struct net_device *netdev,
75541ade00fSJohannes Berg 			   u8 key_index, u8 *mac_addr);
75641ade00fSJohannes Berg 	int	(*set_default_key)(struct wiphy *wiphy,
75741ade00fSJohannes Berg 				   struct net_device *netdev,
75841ade00fSJohannes Berg 				   u8 key_index);
7593cfcf6acSJouni Malinen 	int	(*set_default_mgmt_key)(struct wiphy *wiphy,
7603cfcf6acSJouni Malinen 					struct net_device *netdev,
7613cfcf6acSJouni Malinen 					u8 key_index);
762ed1b6cc7SJohannes Berg 
763ed1b6cc7SJohannes Berg 	int	(*add_beacon)(struct wiphy *wiphy, struct net_device *dev,
764ed1b6cc7SJohannes Berg 			      struct beacon_parameters *info);
765ed1b6cc7SJohannes Berg 	int	(*set_beacon)(struct wiphy *wiphy, struct net_device *dev,
766ed1b6cc7SJohannes Berg 			      struct beacon_parameters *info);
767ed1b6cc7SJohannes Berg 	int	(*del_beacon)(struct wiphy *wiphy, struct net_device *dev);
7685727ef1bSJohannes Berg 
7695727ef1bSJohannes Berg 
7705727ef1bSJohannes Berg 	int	(*add_station)(struct wiphy *wiphy, struct net_device *dev,
7715727ef1bSJohannes Berg 			       u8 *mac, struct station_parameters *params);
7725727ef1bSJohannes Berg 	int	(*del_station)(struct wiphy *wiphy, struct net_device *dev,
7735727ef1bSJohannes Berg 			       u8 *mac);
7745727ef1bSJohannes Berg 	int	(*change_station)(struct wiphy *wiphy, struct net_device *dev,
7755727ef1bSJohannes Berg 				  u8 *mac, struct station_parameters *params);
776fd5b74dcSJohannes Berg 	int	(*get_station)(struct wiphy *wiphy, struct net_device *dev,
7772ec600d6SLuis Carlos Cobo 			       u8 *mac, struct station_info *sinfo);
7782ec600d6SLuis Carlos Cobo 	int	(*dump_station)(struct wiphy *wiphy, struct net_device *dev,
7792ec600d6SLuis Carlos Cobo 			       int idx, u8 *mac, struct station_info *sinfo);
7802ec600d6SLuis Carlos Cobo 
7812ec600d6SLuis Carlos Cobo 	int	(*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
7822ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop);
7832ec600d6SLuis Carlos Cobo 	int	(*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
7842ec600d6SLuis Carlos Cobo 			       u8 *dst);
7852ec600d6SLuis Carlos Cobo 	int	(*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
7862ec600d6SLuis Carlos Cobo 				  u8 *dst, u8 *next_hop);
7872ec600d6SLuis Carlos Cobo 	int	(*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
7882ec600d6SLuis Carlos Cobo 			       u8 *dst, u8 *next_hop,
7892ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
7902ec600d6SLuis Carlos Cobo 	int	(*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
7912ec600d6SLuis Carlos Cobo 			       int idx, u8 *dst, u8 *next_hop,
7922ec600d6SLuis Carlos Cobo 			       struct mpath_info *pinfo);
79393da9cc1Scolin@cozybit.com 	int	(*get_mesh_params)(struct wiphy *wiphy,
79493da9cc1Scolin@cozybit.com 				struct net_device *dev,
79593da9cc1Scolin@cozybit.com 				struct mesh_config *conf);
79693da9cc1Scolin@cozybit.com 	int	(*set_mesh_params)(struct wiphy *wiphy,
79793da9cc1Scolin@cozybit.com 				struct net_device *dev,
79893da9cc1Scolin@cozybit.com 				const struct mesh_config *nconf, u32 mask);
7999f1ba906SJouni Malinen 	int	(*change_bss)(struct wiphy *wiphy, struct net_device *dev,
8009f1ba906SJouni Malinen 			      struct bss_parameters *params);
80131888487SJouni Malinen 
80231888487SJouni Malinen 	int	(*set_txq_params)(struct wiphy *wiphy,
80331888487SJouni Malinen 				  struct ieee80211_txq_params *params);
80472bdcf34SJouni Malinen 
80572bdcf34SJouni Malinen 	int	(*set_channel)(struct wiphy *wiphy,
80672bdcf34SJouni Malinen 			       struct ieee80211_channel *chan,
807094d05dcSSujith 			       enum nl80211_channel_type channel_type);
8089aed3cc1SJouni Malinen 
8092a519311SJohannes Berg 	int	(*scan)(struct wiphy *wiphy, struct net_device *dev,
8102a519311SJohannes Berg 			struct cfg80211_scan_request *request);
811636a5d36SJouni Malinen 
812636a5d36SJouni Malinen 	int	(*auth)(struct wiphy *wiphy, struct net_device *dev,
813636a5d36SJouni Malinen 			struct cfg80211_auth_request *req);
814636a5d36SJouni Malinen 	int	(*assoc)(struct wiphy *wiphy, struct net_device *dev,
815636a5d36SJouni Malinen 			 struct cfg80211_assoc_request *req);
816636a5d36SJouni Malinen 	int	(*deauth)(struct wiphy *wiphy, struct net_device *dev,
817636a5d36SJouni Malinen 			  struct cfg80211_deauth_request *req);
818636a5d36SJouni Malinen 	int	(*disassoc)(struct wiphy *wiphy, struct net_device *dev,
819636a5d36SJouni Malinen 			    struct cfg80211_disassoc_request *req);
820704232c2SJohannes Berg };
821704232c2SJohannes Berg 
822fee52678SJohannes Berg /* temporary wext handlers */
823fee52678SJohannes Berg int cfg80211_wext_giwname(struct net_device *dev,
824fee52678SJohannes Berg 			  struct iw_request_info *info,
825fee52678SJohannes Berg 			  char *name, char *extra);
826e60c7744SJohannes Berg int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
827e60c7744SJohannes Berg 			  u32 *mode, char *extra);
828e60c7744SJohannes Berg int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
829e60c7744SJohannes Berg 			  u32 *mode, char *extra);
8302a519311SJohannes Berg int cfg80211_wext_siwscan(struct net_device *dev,
8312a519311SJohannes Berg 			  struct iw_request_info *info,
8322a519311SJohannes Berg 			  union iwreq_data *wrqu, char *extra);
8332a519311SJohannes Berg int cfg80211_wext_giwscan(struct net_device *dev,
8342a519311SJohannes Berg 			  struct iw_request_info *info,
8352a519311SJohannes Berg 			  struct iw_point *data, char *extra);
8364aa188e1SJohannes Berg int cfg80211_wext_giwrange(struct net_device *dev,
8374aa188e1SJohannes Berg 			   struct iw_request_info *info,
8384aa188e1SJohannes Berg 			   struct iw_point *data, char *extra);
8392a519311SJohannes Berg 
8402a519311SJohannes Berg /**
8412a519311SJohannes Berg  * cfg80211_scan_done - notify that scan finished
8422a519311SJohannes Berg  *
8432a519311SJohannes Berg  * @request: the corresponding scan request
8442a519311SJohannes Berg  * @aborted: set to true if the scan was aborted for any reason,
8452a519311SJohannes Berg  *	userspace will be notified of that
8462a519311SJohannes Berg  */
8472a519311SJohannes Berg void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
8482a519311SJohannes Berg 
8492a519311SJohannes Berg /**
8502a519311SJohannes Berg  * cfg80211_inform_bss - inform cfg80211 of a new BSS
8512a519311SJohannes Berg  *
8522a519311SJohannes Berg  * @wiphy: the wiphy reporting the BSS
8532a519311SJohannes Berg  * @bss: the found BSS
85477965c97SJohannes Berg  * @signal: the signal strength, type depends on the wiphy's signal_type
8552a519311SJohannes Berg  * @gfp: context flags
8562a519311SJohannes Berg  *
8572a519311SJohannes Berg  * This informs cfg80211 that BSS information was found and
8582a519311SJohannes Berg  * the BSS should be updated/added.
8592a519311SJohannes Berg  */
8602a519311SJohannes Berg struct cfg80211_bss*
8612a519311SJohannes Berg cfg80211_inform_bss_frame(struct wiphy *wiphy,
8622a519311SJohannes Berg 			  struct ieee80211_channel *channel,
8632a519311SJohannes Berg 			  struct ieee80211_mgmt *mgmt, size_t len,
86477965c97SJohannes Berg 			  s32 signal, gfp_t gfp);
8652a519311SJohannes Berg 
86606aa7afaSJussi Kivilinna struct cfg80211_bss*
86706aa7afaSJussi Kivilinna cfg80211_inform_bss(struct wiphy *wiphy,
86806aa7afaSJussi Kivilinna 		    struct ieee80211_channel *channel,
86906aa7afaSJussi Kivilinna 		    const u8 *bssid,
87006aa7afaSJussi Kivilinna 		    u64 timestamp, u16 capability, u16 beacon_interval,
87106aa7afaSJussi Kivilinna 		    const u8 *ie, size_t ielen,
87206aa7afaSJussi Kivilinna 		    s32 signal, gfp_t gfp);
87306aa7afaSJussi Kivilinna 
8742a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
8752a519311SJohannes Berg 				      struct ieee80211_channel *channel,
8762a519311SJohannes Berg 				      const u8 *bssid,
87779420f09SJohannes Berg 				      const u8 *ssid, size_t ssid_len,
87879420f09SJohannes Berg 				      u16 capa_mask, u16 capa_val);
87979420f09SJohannes Berg static inline struct cfg80211_bss *
88079420f09SJohannes Berg cfg80211_get_ibss(struct wiphy *wiphy,
88179420f09SJohannes Berg 		  struct ieee80211_channel *channel,
88279420f09SJohannes Berg 		  const u8 *ssid, size_t ssid_len)
88379420f09SJohannes Berg {
88479420f09SJohannes Berg 	return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
88579420f09SJohannes Berg 				WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
88679420f09SJohannes Berg }
88779420f09SJohannes Berg 
8882a519311SJohannes Berg struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
8892a519311SJohannes Berg 				       struct ieee80211_channel *channel,
8902a519311SJohannes Berg 				       const u8 *meshid, size_t meshidlen,
8912a519311SJohannes Berg 				       const u8 *meshcfg);
8922a519311SJohannes Berg void cfg80211_put_bss(struct cfg80211_bss *bss);
893d491af19SJohannes Berg /**
894d491af19SJohannes Berg  * cfg80211_unlink_bss - unlink BSS from internal data structures
895d491af19SJohannes Berg  * @wiphy: the wiphy
896d491af19SJohannes Berg  * @bss: the bss to remove
897d491af19SJohannes Berg  *
898d491af19SJohannes Berg  * This function removes the given BSS from the internal data structures
899d491af19SJohannes Berg  * thereby making it no longer show up in scan results etc. Use this
900d491af19SJohannes Berg  * function when you detect a BSS is gone. Normally BSSes will also time
901d491af19SJohannes Berg  * out, so it is not necessary to use this function at all.
902d491af19SJohannes Berg  */
903d491af19SJohannes Berg void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
904fee52678SJohannes Berg 
9056039f6d2SJouni Malinen /**
9066039f6d2SJouni Malinen  * cfg80211_send_rx_auth - notification of processed authentication
9076039f6d2SJouni Malinen  * @dev: network device
9086039f6d2SJouni Malinen  * @buf: authentication frame (header + body)
9096039f6d2SJouni Malinen  * @len: length of the frame data
9106039f6d2SJouni Malinen  *
9116039f6d2SJouni Malinen  * This function is called whenever an authentication has been processed in
9126039f6d2SJouni Malinen  * station mode.
9136039f6d2SJouni Malinen  */
9146039f6d2SJouni Malinen void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
9156039f6d2SJouni Malinen 
9166039f6d2SJouni Malinen /**
9176039f6d2SJouni Malinen  * cfg80211_send_rx_assoc - notification of processed association
9186039f6d2SJouni Malinen  * @dev: network device
9196039f6d2SJouni Malinen  * @buf: (re)association response frame (header + body)
9206039f6d2SJouni Malinen  * @len: length of the frame data
9216039f6d2SJouni Malinen  *
9226039f6d2SJouni Malinen  * This function is called whenever a (re)association response has been
9236039f6d2SJouni Malinen  * processed in station mode.
9246039f6d2SJouni Malinen  */
9256039f6d2SJouni Malinen void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
9266039f6d2SJouni Malinen 
9276039f6d2SJouni Malinen /**
92853b46b84SJouni Malinen  * cfg80211_send_deauth - notification of processed deauthentication
9296039f6d2SJouni Malinen  * @dev: network device
9306039f6d2SJouni Malinen  * @buf: deauthentication frame (header + body)
9316039f6d2SJouni Malinen  * @len: length of the frame data
9326039f6d2SJouni Malinen  *
9336039f6d2SJouni Malinen  * This function is called whenever deauthentication has been processed in
93453b46b84SJouni Malinen  * station mode. This includes both received deauthentication frames and
93553b46b84SJouni Malinen  * locally generated ones.
9366039f6d2SJouni Malinen  */
93753b46b84SJouni Malinen void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
9386039f6d2SJouni Malinen 
9396039f6d2SJouni Malinen /**
94053b46b84SJouni Malinen  * cfg80211_send_disassoc - notification of processed disassociation
9416039f6d2SJouni Malinen  * @dev: network device
9426039f6d2SJouni Malinen  * @buf: disassociation response frame (header + body)
9436039f6d2SJouni Malinen  * @len: length of the frame data
9446039f6d2SJouni Malinen  *
9456039f6d2SJouni Malinen  * This function is called whenever disassociation has been processed in
94653b46b84SJouni Malinen  * station mode. This includes both received disassociation frames and locally
94753b46b84SJouni Malinen  * generated ones.
9486039f6d2SJouni Malinen  */
94953b46b84SJouni Malinen void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
9506039f6d2SJouni Malinen 
951a08c1c1aSKalle Valo /**
952a08c1c1aSKalle Valo  * cfg80211_hold_bss - exclude bss from expiration
953a08c1c1aSKalle Valo  * @bss: bss which should not expire
954a08c1c1aSKalle Valo  *
955a08c1c1aSKalle Valo  * In a case when the BSS is not updated but it shouldn't expire this
956a08c1c1aSKalle Valo  * function can be used to mark the BSS to be excluded from expiration.
957a08c1c1aSKalle Valo  */
958a08c1c1aSKalle Valo void cfg80211_hold_bss(struct cfg80211_bss *bss);
959a08c1c1aSKalle Valo 
960a08c1c1aSKalle Valo /**
961a08c1c1aSKalle Valo  * cfg80211_unhold_bss - remove expiration exception from the BSS
962a08c1c1aSKalle Valo  * @bss: bss which can expire again
963a08c1c1aSKalle Valo  *
964a08c1c1aSKalle Valo  * This function marks the BSS to be expirable again.
965a08c1c1aSKalle Valo  */
966a08c1c1aSKalle Valo void cfg80211_unhold_bss(struct cfg80211_bss *bss);
967a08c1c1aSKalle Valo 
968a3b8b056SJouni Malinen /**
969a3b8b056SJouni Malinen  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
970a3b8b056SJouni Malinen  * @dev: network device
971a3b8b056SJouni Malinen  * @addr: The source MAC address of the frame
972a3b8b056SJouni Malinen  * @key_type: The key type that the received frame used
973a3b8b056SJouni Malinen  * @key_id: Key identifier (0..3)
974a3b8b056SJouni Malinen  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
975a3b8b056SJouni Malinen  *
976a3b8b056SJouni Malinen  * This function is called whenever the local MAC detects a MIC failure in a
977a3b8b056SJouni Malinen  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
978a3b8b056SJouni Malinen  * primitive.
979a3b8b056SJouni Malinen  */
980a3b8b056SJouni Malinen void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
981a3b8b056SJouni Malinen 				  enum nl80211_key_type key_type, int key_id,
982a3b8b056SJouni Malinen 				  const u8 *tsc);
983a3b8b056SJouni Malinen 
984704232c2SJohannes Berg #endif /* __NET_CFG80211_H */
985