nl80211: Add Michael MIC failure event
[pandora-kernel.git] / include / net / cfg80211.h
1 #ifndef __NET_CFG80211_H
2 #define __NET_CFG80211_H
3
4 #include <linux/netlink.h>
5 #include <linux/skbuff.h>
6 #include <linux/nl80211.h>
7 #include <linux/if_ether.h>
8 #include <linux/ieee80211.h>
9 #include <linux/wireless.h>
10 #include <net/iw_handler.h>
11 #include <net/genetlink.h>
12 /* remove once we remove the wext stuff */
13
14 /*
15  * 802.11 configuration in-kernel interface
16  *
17  * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net>
18  */
19
20 /**
21  * struct vif_params - describes virtual interface parameters
22  * @mesh_id: mesh ID to use
23  * @mesh_id_len: length of the mesh ID
24  */
25 struct vif_params {
26        u8 *mesh_id;
27        int mesh_id_len;
28 };
29
30 /* Radiotap header iteration
31  *   implemented in net/wireless/radiotap.c
32  *   docs in Documentation/networking/radiotap-headers.txt
33  */
34 /**
35  * struct ieee80211_radiotap_iterator - tracks walk thru present radiotap args
36  * @rtheader: pointer to the radiotap header we are walking through
37  * @max_length: length of radiotap header in cpu byte ordering
38  * @this_arg_index: IEEE80211_RADIOTAP_... index of current arg
39  * @this_arg: pointer to current radiotap arg
40  * @arg_index: internal next argument index
41  * @arg: internal next argument pointer
42  * @next_bitmap: internal pointer to next present u32
43  * @bitmap_shifter: internal shifter for curr u32 bitmap, b0 set == arg present
44  */
45
46 struct ieee80211_radiotap_iterator {
47         struct ieee80211_radiotap_header *rtheader;
48         int max_length;
49         int this_arg_index;
50         u8 *this_arg;
51
52         int arg_index;
53         u8 *arg;
54         __le32 *next_bitmap;
55         u32 bitmap_shifter;
56 };
57
58 extern int ieee80211_radiotap_iterator_init(
59    struct ieee80211_radiotap_iterator *iterator,
60    struct ieee80211_radiotap_header *radiotap_header,
61    int max_length);
62
63 extern int ieee80211_radiotap_iterator_next(
64    struct ieee80211_radiotap_iterator *iterator);
65
66
67  /**
68  * struct key_params - key information
69  *
70  * Information about a key
71  *
72  * @key: key material
73  * @key_len: length of key material
74  * @cipher: cipher suite selector
75  * @seq: sequence counter (IV/PN) for TKIP and CCMP keys, only used
76  *      with the get_key() callback, must be in little endian,
77  *      length given by @seq_len.
78  */
79 struct key_params {
80         u8 *key;
81         u8 *seq;
82         int key_len;
83         int seq_len;
84         u32 cipher;
85 };
86
87 /**
88  * struct beacon_parameters - beacon parameters
89  *
90  * Used to configure the beacon for an interface.
91  *
92  * @head: head portion of beacon (before TIM IE)
93  *     or %NULL if not changed
94  * @tail: tail portion of beacon (after TIM IE)
95  *     or %NULL if not changed
96  * @interval: beacon interval or zero if not changed
97  * @dtim_period: DTIM period or zero if not changed
98  * @head_len: length of @head
99  * @tail_len: length of @tail
100  */
101 struct beacon_parameters {
102         u8 *head, *tail;
103         int interval, dtim_period;
104         int head_len, tail_len;
105 };
106
107 /**
108  * enum station_flags - station flags
109  *
110  * Station capability flags. Note that these must be the bits
111  * according to the nl80211 flags.
112  *
113  * @STATION_FLAG_CHANGED: station flags were changed
114  * @STATION_FLAG_AUTHORIZED: station is authorized to send frames (802.1X)
115  * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames
116  *      with short preambles
117  * @STATION_FLAG_WME: station is WME/QoS capable
118  * @STATION_FLAG_MFP: station uses management frame protection
119  */
120 enum station_flags {
121         STATION_FLAG_CHANGED            = 1<<0,
122         STATION_FLAG_AUTHORIZED         = 1<<NL80211_STA_FLAG_AUTHORIZED,
123         STATION_FLAG_SHORT_PREAMBLE     = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE,
124         STATION_FLAG_WME                = 1<<NL80211_STA_FLAG_WME,
125         STATION_FLAG_MFP                = 1<<NL80211_STA_FLAG_MFP,
126 };
127
128 /**
129  * enum plink_action - actions to perform in mesh peers
130  *
131  * @PLINK_ACTION_INVALID: action 0 is reserved
132  * @PLINK_ACTION_OPEN: start mesh peer link establishment
133  * @PLINK_ACTION_BLOCL: block traffic from this mesh peer
134  */
135 enum plink_actions {
136         PLINK_ACTION_INVALID,
137         PLINK_ACTION_OPEN,
138         PLINK_ACTION_BLOCK,
139 };
140
141 /**
142  * struct station_parameters - station parameters
143  *
144  * Used to change and create a new station.
145  *
146  * @vlan: vlan interface station should belong to
147  * @supported_rates: supported rates in IEEE 802.11 format
148  *      (or NULL for no change)
149  * @supported_rates_len: number of supported rates
150  * @station_flags: station flags (see &enum station_flags)
151  * @listen_interval: listen interval or -1 for no change
152  * @aid: AID or zero for no change
153  */
154 struct station_parameters {
155         u8 *supported_rates;
156         struct net_device *vlan;
157         u32 station_flags;
158         int listen_interval;
159         u16 aid;
160         u8 supported_rates_len;
161         u8 plink_action;
162         struct ieee80211_ht_cap *ht_capa;
163 };
164
165 /**
166  * enum station_info_flags - station information flags
167  *
168  * Used by the driver to indicate which info in &struct station_info
169  * it has filled in during get_station() or dump_station().
170  *
171  * @STATION_INFO_INACTIVE_TIME: @inactive_time filled
172  * @STATION_INFO_RX_BYTES: @rx_bytes filled
173  * @STATION_INFO_TX_BYTES: @tx_bytes filled
174  * @STATION_INFO_LLID: @llid filled
175  * @STATION_INFO_PLID: @plid filled
176  * @STATION_INFO_PLINK_STATE: @plink_state filled
177  * @STATION_INFO_SIGNAL: @signal filled
178  * @STATION_INFO_TX_BITRATE: @tx_bitrate fields are filled
179  *  (tx_bitrate, tx_bitrate_flags and tx_bitrate_mcs)
180  * @STATION_INFO_RX_PACKETS: @rx_packets filled
181  * @STATION_INFO_TX_PACKETS: @tx_packets filled
182  */
183 enum station_info_flags {
184         STATION_INFO_INACTIVE_TIME      = 1<<0,
185         STATION_INFO_RX_BYTES           = 1<<1,
186         STATION_INFO_TX_BYTES           = 1<<2,
187         STATION_INFO_LLID               = 1<<3,
188         STATION_INFO_PLID               = 1<<4,
189         STATION_INFO_PLINK_STATE        = 1<<5,
190         STATION_INFO_SIGNAL             = 1<<6,
191         STATION_INFO_TX_BITRATE         = 1<<7,
192         STATION_INFO_RX_PACKETS         = 1<<8,
193         STATION_INFO_TX_PACKETS         = 1<<9,
194 };
195
196 /**
197  * enum station_info_rate_flags - bitrate info flags
198  *
199  * Used by the driver to indicate the specific rate transmission
200  * type for 802.11n transmissions.
201  *
202  * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled
203  * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission
204  * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
205  */
206 enum rate_info_flags {
207         RATE_INFO_FLAGS_MCS             = 1<<0,
208         RATE_INFO_FLAGS_40_MHZ_WIDTH    = 1<<1,
209         RATE_INFO_FLAGS_SHORT_GI        = 1<<2,
210 };
211
212 /**
213  * struct rate_info - bitrate information
214  *
215  * Information about a receiving or transmitting bitrate
216  *
217  * @flags: bitflag of flags from &enum rate_info_flags
218  * @mcs: mcs index if struct describes a 802.11n bitrate
219  * @legacy: bitrate in 100kbit/s for 802.11abg
220  */
221 struct rate_info {
222         u8 flags;
223         u8 mcs;
224         u16 legacy;
225 };
226
227 /**
228  * struct station_info - station information
229  *
230  * Station information filled by driver for get_station() and dump_station.
231  *
232  * @filled: bitflag of flags from &enum station_info_flags
233  * @inactive_time: time since last station activity (tx/rx) in milliseconds
234  * @rx_bytes: bytes received from this station
235  * @tx_bytes: bytes transmitted to this station
236  * @llid: mesh local link id
237  * @plid: mesh peer link id
238  * @plink_state: mesh peer link state
239  * @signal: signal strength of last received packet in dBm
240  * @txrate: current unicast bitrate to this station
241  * @rx_packets: packets received from this station
242  * @tx_packets: packets transmitted to this station
243  */
244 struct station_info {
245         u32 filled;
246         u32 inactive_time;
247         u32 rx_bytes;
248         u32 tx_bytes;
249         u16 llid;
250         u16 plid;
251         u8 plink_state;
252         s8 signal;
253         struct rate_info txrate;
254         u32 rx_packets;
255         u32 tx_packets;
256 };
257
258 /**
259  * enum monitor_flags - monitor flags
260  *
261  * Monitor interface configuration flags. Note that these must be the bits
262  * according to the nl80211 flags.
263  *
264  * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
265  * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
266  * @MONITOR_FLAG_CONTROL: pass control frames
267  * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
268  * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
269  */
270 enum monitor_flags {
271         MONITOR_FLAG_FCSFAIL            = 1<<NL80211_MNTR_FLAG_FCSFAIL,
272         MONITOR_FLAG_PLCPFAIL           = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
273         MONITOR_FLAG_CONTROL            = 1<<NL80211_MNTR_FLAG_CONTROL,
274         MONITOR_FLAG_OTHER_BSS          = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
275         MONITOR_FLAG_COOK_FRAMES        = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
276 };
277
278 /**
279  * enum mpath_info_flags -  mesh path information flags
280  *
281  * Used by the driver to indicate which info in &struct mpath_info it has filled
282  * in during get_station() or dump_station().
283  *
284  * MPATH_INFO_FRAME_QLEN: @frame_qlen filled
285  * MPATH_INFO_DSN: @dsn filled
286  * MPATH_INFO_METRIC: @metric filled
287  * MPATH_INFO_EXPTIME: @exptime filled
288  * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
289  * MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
290  * MPATH_INFO_FLAGS: @flags filled
291  */
292 enum mpath_info_flags {
293         MPATH_INFO_FRAME_QLEN           = BIT(0),
294         MPATH_INFO_DSN                  = BIT(1),
295         MPATH_INFO_METRIC               = BIT(2),
296         MPATH_INFO_EXPTIME              = BIT(3),
297         MPATH_INFO_DISCOVERY_TIMEOUT    = BIT(4),
298         MPATH_INFO_DISCOVERY_RETRIES    = BIT(5),
299         MPATH_INFO_FLAGS                = BIT(6),
300 };
301
302 /**
303  * struct mpath_info - mesh path information
304  *
305  * Mesh path information filled by driver for get_mpath() and dump_mpath().
306  *
307  * @filled: bitfield of flags from &enum mpath_info_flags
308  * @frame_qlen: number of queued frames for this destination
309  * @dsn: destination sequence number
310  * @metric: metric (cost) of this mesh path
311  * @exptime: expiration time for the mesh path from now, in msecs
312  * @flags: mesh path flags
313  * @discovery_timeout: total mesh path discovery timeout, in msecs
314  * @discovery_retries: mesh path discovery retries
315  */
316 struct mpath_info {
317         u32 filled;
318         u32 frame_qlen;
319         u32 dsn;
320         u32 metric;
321         u32 exptime;
322         u32 discovery_timeout;
323         u8 discovery_retries;
324         u8 flags;
325 };
326
327 /**
328  * struct bss_parameters - BSS parameters
329  *
330  * Used to change BSS parameters (mainly for AP mode).
331  *
332  * @use_cts_prot: Whether to use CTS protection
333  *      (0 = no, 1 = yes, -1 = do not change)
334  * @use_short_preamble: Whether the use of short preambles is allowed
335  *      (0 = no, 1 = yes, -1 = do not change)
336  * @use_short_slot_time: Whether the use of short slot time is allowed
337  *      (0 = no, 1 = yes, -1 = do not change)
338  * @basic_rates: basic rates in IEEE 802.11 format
339  *      (or NULL for no change)
340  * @basic_rates_len: number of basic rates
341  */
342 struct bss_parameters {
343         int use_cts_prot;
344         int use_short_preamble;
345         int use_short_slot_time;
346         u8 *basic_rates;
347         u8 basic_rates_len;
348 };
349
350 /**
351  * enum environment_cap - Environment parsed from country IE
352  * @ENVIRON_ANY: indicates country IE applies to both indoor and
353  *      outdoor operation.
354  * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
355  * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
356  */
357 enum environment_cap {
358         ENVIRON_ANY,
359         ENVIRON_INDOOR,
360         ENVIRON_OUTDOOR,
361 };
362
363 /**
364  * struct regulatory_request - used to keep track of regulatory requests
365  *
366  * @wiphy_idx: this is set if this request's initiator is
367  *      %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
368  *      can be used by the wireless core to deal with conflicts
369  *      and potentially inform users of which devices specifically
370  *      cased the conflicts.
371  * @initiator: indicates who sent this request, could be any of
372  *      of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*)
373  * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
374  *      regulatory domain. We have a few special codes:
375  *      00 - World regulatory domain
376  *      99 - built by driver but a specific alpha2 cannot be determined
377  *      98 - result of an intersection between two regulatory domains
378  * @intersect: indicates whether the wireless core should intersect
379  *      the requested regulatory domain with the presently set regulatory
380  *      domain.
381  * @country_ie_checksum: checksum of the last processed and accepted
382  *      country IE
383  * @country_ie_env: lets us know if the AP is telling us we are outdoor,
384  *      indoor, or if it doesn't matter
385  * @list: used to insert into the reg_requests_list linked list
386  */
387 struct regulatory_request {
388         int wiphy_idx;
389         enum nl80211_reg_initiator initiator;
390         char alpha2[2];
391         bool intersect;
392         u32 country_ie_checksum;
393         enum environment_cap country_ie_env;
394         struct list_head list;
395 };
396
397 struct ieee80211_freq_range {
398         u32 start_freq_khz;
399         u32 end_freq_khz;
400         u32 max_bandwidth_khz;
401 };
402
403 struct ieee80211_power_rule {
404         u32 max_antenna_gain;
405         u32 max_eirp;
406 };
407
408 struct ieee80211_reg_rule {
409         struct ieee80211_freq_range freq_range;
410         struct ieee80211_power_rule power_rule;
411         u32 flags;
412 };
413
414 struct ieee80211_regdomain {
415         u32 n_reg_rules;
416         char alpha2[2];
417         struct ieee80211_reg_rule reg_rules[];
418 };
419
420 #define MHZ_TO_KHZ(freq) ((freq) * 1000)
421 #define KHZ_TO_MHZ(freq) ((freq) / 1000)
422 #define DBI_TO_MBI(gain) ((gain) * 100)
423 #define MBI_TO_DBI(gain) ((gain) / 100)
424 #define DBM_TO_MBM(gain) ((gain) * 100)
425 #define MBM_TO_DBM(gain) ((gain) / 100)
426
427 #define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \
428         .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
429         .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
430         .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
431         .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \
432         .power_rule.max_eirp = DBM_TO_MBM(eirp), \
433         .flags = reg_flags, \
434         }
435
436 struct mesh_config {
437         /* Timeouts in ms */
438         /* Mesh plink management parameters */
439         u16 dot11MeshRetryTimeout;
440         u16 dot11MeshConfirmTimeout;
441         u16 dot11MeshHoldingTimeout;
442         u16 dot11MeshMaxPeerLinks;
443         u8  dot11MeshMaxRetries;
444         u8  dot11MeshTTL;
445         bool auto_open_plinks;
446         /* HWMP parameters */
447         u8  dot11MeshHWMPmaxPREQretries;
448         u32 path_refresh_time;
449         u16 min_discovery_timeout;
450         u32 dot11MeshHWMPactivePathTimeout;
451         u16 dot11MeshHWMPpreqMinInterval;
452         u16 dot11MeshHWMPnetDiameterTraversalTime;
453 };
454
455 /**
456  * struct ieee80211_txq_params - TX queue parameters
457  * @queue: TX queue identifier (NL80211_TXQ_Q_*)
458  * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
459  * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
460  *      1..32767]
461  * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
462  *      1..32767]
463  * @aifs: Arbitration interframe space [0..255]
464  */
465 struct ieee80211_txq_params {
466         enum nl80211_txq_q queue;
467         u16 txop;
468         u16 cwmin;
469         u16 cwmax;
470         u8 aifs;
471 };
472
473 /* from net/wireless.h */
474 struct wiphy;
475
476 /* from net/ieee80211.h */
477 struct ieee80211_channel;
478
479 /**
480  * struct cfg80211_ssid - SSID description
481  * @ssid: the SSID
482  * @ssid_len: length of the ssid
483  */
484 struct cfg80211_ssid {
485         u8 ssid[IEEE80211_MAX_SSID_LEN];
486         u8 ssid_len;
487 };
488
489 /**
490  * struct cfg80211_scan_request - scan request description
491  *
492  * @ssids: SSIDs to scan for (active scan only)
493  * @n_ssids: number of SSIDs
494  * @channels: channels to scan on.
495  * @n_channels: number of channels for each band
496  * @ie: optional information element(s) to add into Probe Request or %NULL
497  * @ie_len: length of ie in octets
498  * @wiphy: the wiphy this was for
499  * @ifidx: the interface index
500  */
501 struct cfg80211_scan_request {
502         struct cfg80211_ssid *ssids;
503         int n_ssids;
504         struct ieee80211_channel **channels;
505         u32 n_channels;
506         u8 *ie;
507         size_t ie_len;
508
509         /* internal */
510         struct wiphy *wiphy;
511         int ifidx;
512 };
513
514 /**
515  * enum cfg80211_signal_type - signal type
516  *
517  * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
518  * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
519  * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
520  */
521 enum cfg80211_signal_type {
522         CFG80211_SIGNAL_TYPE_NONE,
523         CFG80211_SIGNAL_TYPE_MBM,
524         CFG80211_SIGNAL_TYPE_UNSPEC,
525 };
526
527 /**
528  * struct cfg80211_bss - BSS description
529  *
530  * This structure describes a BSS (which may also be a mesh network)
531  * for use in scan results and similar.
532  *
533  * @bssid: BSSID of the BSS
534  * @tsf: timestamp of last received update
535  * @beacon_interval: the beacon interval as from the frame
536  * @capability: the capability field in host byte order
537  * @information_elements: the information elements (Note that there
538  *      is no guarantee that these are well-formed!)
539  * @len_information_elements: total length of the information elements
540  * @signal: signal strength value (type depends on the wiphy's signal_type)
541  * @hold: BSS should not expire
542  * @free_priv: function pointer to free private data
543  * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
544  */
545 struct cfg80211_bss {
546         struct ieee80211_channel *channel;
547
548         u8 bssid[ETH_ALEN];
549         u64 tsf;
550         u16 beacon_interval;
551         u16 capability;
552         u8 *information_elements;
553         size_t len_information_elements;
554
555         s32 signal;
556
557         void (*free_priv)(struct cfg80211_bss *bss);
558         u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
559 };
560
561 /**
562  * struct cfg80211_auth_request - Authentication request data
563  *
564  * This structure provides information needed to complete IEEE 802.11
565  * authentication.
566  * NOTE: This structure will likely change when more code from mac80211 is
567  * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too.
568  * Before using this in a driver that does not use mac80211, it would be better
569  * to check the status of that work and better yet, volunteer to work on it.
570  *
571  * @chan: The channel to use or %NULL if not specified (auto-select based on
572  *      scan results)
573  * @peer_addr: The address of the peer STA (AP BSSID in infrastructure case);
574  *      this field is required to be present; if the driver wants to help with
575  *      BSS selection, it should use (yet to be added) MLME event to allow user
576  *      space SME to be notified of roaming candidate, so that the SME can then
577  *      use the authentication request with the recommended BSSID and whatever
578  *      other data may be needed for authentication/association
579  * @ssid: SSID or %NULL if not yet available
580  * @ssid_len: Length of ssid in octets
581  * @auth_type: Authentication type (algorithm)
582  * @ie: Extra IEs to add to Authentication frame or %NULL
583  * @ie_len: Length of ie buffer in octets
584  */
585 struct cfg80211_auth_request {
586         struct ieee80211_channel *chan;
587         u8 *peer_addr;
588         const u8 *ssid;
589         size_t ssid_len;
590         enum nl80211_auth_type auth_type;
591         const u8 *ie;
592         size_t ie_len;
593 };
594
595 /**
596  * struct cfg80211_assoc_request - (Re)Association request data
597  *
598  * This structure provides information needed to complete IEEE 802.11
599  * (re)association.
600  * NOTE: This structure will likely change when more code from mac80211 is
601  * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too.
602  * Before using this in a driver that does not use mac80211, it would be better
603  * to check the status of that work and better yet, volunteer to work on it.
604  *
605  * @chan: The channel to use or %NULL if not specified (auto-select based on
606  *      scan results)
607  * @peer_addr: The address of the peer STA (AP BSSID); this field is required
608  *      to be present and the STA must be in State 2 (authenticated) with the
609  *      peer STA
610  * @ssid: SSID
611  * @ssid_len: Length of ssid in octets
612  * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
613  * @ie_len: Length of ie buffer in octets
614  */
615 struct cfg80211_assoc_request {
616         struct ieee80211_channel *chan;
617         u8 *peer_addr;
618         const u8 *ssid;
619         size_t ssid_len;
620         const u8 *ie;
621         size_t ie_len;
622 };
623
624 /**
625  * struct cfg80211_deauth_request - Deauthentication request data
626  *
627  * This structure provides information needed to complete IEEE 802.11
628  * deauthentication.
629  *
630  * @peer_addr: The address of the peer STA (AP BSSID); this field is required
631  *      to be present and the STA must be authenticated with the peer STA
632  * @ie: Extra IEs to add to Deauthentication frame or %NULL
633  * @ie_len: Length of ie buffer in octets
634  */
635 struct cfg80211_deauth_request {
636         u8 *peer_addr;
637         u16 reason_code;
638         const u8 *ie;
639         size_t ie_len;
640 };
641
642 /**
643  * struct cfg80211_disassoc_request - Disassociation request data
644  *
645  * This structure provides information needed to complete IEEE 802.11
646  * disassocation.
647  *
648  * @peer_addr: The address of the peer STA (AP BSSID); this field is required
649  *      to be present and the STA must be associated with the peer STA
650  * @ie: Extra IEs to add to Disassociation frame or %NULL
651  * @ie_len: Length of ie buffer in octets
652  */
653 struct cfg80211_disassoc_request {
654         u8 *peer_addr;
655         u16 reason_code;
656         const u8 *ie;
657         size_t ie_len;
658 };
659
660 /**
661  * struct cfg80211_ops - backend description for wireless configuration
662  *
663  * This struct is registered by fullmac card drivers and/or wireless stacks
664  * in order to handle configuration requests on their interfaces.
665  *
666  * All callbacks except where otherwise noted should return 0
667  * on success or a negative error code.
668  *
669  * All operations are currently invoked under rtnl for consistency with the
670  * wireless extensions but this is subject to reevaluation as soon as this
671  * code is used more widely and we have a first user without wext.
672  *
673  * @suspend: wiphy device needs to be suspended
674  * @resume: wiphy device needs to be resumed
675  *
676  * @add_virtual_intf: create a new virtual interface with the given name,
677  *      must set the struct wireless_dev's iftype.
678  *
679  * @del_virtual_intf: remove the virtual interface determined by ifindex.
680  *
681  * @change_virtual_intf: change type/configuration of virtual interface,
682  *      keep the struct wireless_dev's iftype updated.
683  *
684  * @add_key: add a key with the given parameters. @mac_addr will be %NULL
685  *      when adding a group key.
686  *
687  * @get_key: get information about the key with the given parameters.
688  *      @mac_addr will be %NULL when requesting information for a group
689  *      key. All pointers given to the @callback function need not be valid
690  *      after it returns.
691  *
692  * @del_key: remove a key given the @mac_addr (%NULL for a group key)
693  *      and @key_index
694  *
695  * @set_default_key: set the default key on an interface
696  *
697  * @set_default_mgmt_key: set the default management frame key on an interface
698  *
699  * @add_beacon: Add a beacon with given parameters, @head, @interval
700  *      and @dtim_period will be valid, @tail is optional.
701  * @set_beacon: Change the beacon parameters for an access point mode
702  *      interface. This should reject the call when no beacon has been
703  *      configured.
704  * @del_beacon: Remove beacon configuration and stop sending the beacon.
705  *
706  * @add_station: Add a new station.
707  *
708  * @del_station: Remove a station; @mac may be NULL to remove all stations.
709  *
710  * @change_station: Modify a given station.
711  *
712  * @get_mesh_params: Put the current mesh parameters into *params
713  *
714  * @set_mesh_params: Set mesh parameters.
715  *      The mask is a bitfield which tells us which parameters to
716  *      set, and which to leave alone.
717  *
718  * @set_mesh_cfg: set mesh parameters (by now, just mesh id)
719  *
720  * @change_bss: Modify parameters for a given BSS.
721  *
722  * @set_txq_params: Set TX queue parameters
723  *
724  * @set_channel: Set channel
725  *
726  * @scan: Request to do a scan. If returning zero, the scan request is given
727  *      the driver, and will be valid until passed to cfg80211_scan_done().
728  *      For scan results, call cfg80211_inform_bss(); you can call this outside
729  *      the scan/scan_done bracket too.
730  *
731  * @auth: Request to authenticate with the specified peer
732  * @assoc: Request to (re)associate with the specified peer
733  * @deauth: Request to deauthenticate from the specified peer
734  * @disassoc: Request to disassociate from the specified peer
735  */
736 struct cfg80211_ops {
737         int     (*suspend)(struct wiphy *wiphy);
738         int     (*resume)(struct wiphy *wiphy);
739
740         int     (*add_virtual_intf)(struct wiphy *wiphy, char *name,
741                                     enum nl80211_iftype type, u32 *flags,
742                                     struct vif_params *params);
743         int     (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
744         int     (*change_virtual_intf)(struct wiphy *wiphy, int ifindex,
745                                        enum nl80211_iftype type, u32 *flags,
746                                        struct vif_params *params);
747
748         int     (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
749                            u8 key_index, u8 *mac_addr,
750                            struct key_params *params);
751         int     (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
752                            u8 key_index, u8 *mac_addr, void *cookie,
753                            void (*callback)(void *cookie, struct key_params*));
754         int     (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
755                            u8 key_index, u8 *mac_addr);
756         int     (*set_default_key)(struct wiphy *wiphy,
757                                    struct net_device *netdev,
758                                    u8 key_index);
759         int     (*set_default_mgmt_key)(struct wiphy *wiphy,
760                                         struct net_device *netdev,
761                                         u8 key_index);
762
763         int     (*add_beacon)(struct wiphy *wiphy, struct net_device *dev,
764                               struct beacon_parameters *info);
765         int     (*set_beacon)(struct wiphy *wiphy, struct net_device *dev,
766                               struct beacon_parameters *info);
767         int     (*del_beacon)(struct wiphy *wiphy, struct net_device *dev);
768
769
770         int     (*add_station)(struct wiphy *wiphy, struct net_device *dev,
771                                u8 *mac, struct station_parameters *params);
772         int     (*del_station)(struct wiphy *wiphy, struct net_device *dev,
773                                u8 *mac);
774         int     (*change_station)(struct wiphy *wiphy, struct net_device *dev,
775                                   u8 *mac, struct station_parameters *params);
776         int     (*get_station)(struct wiphy *wiphy, struct net_device *dev,
777                                u8 *mac, struct station_info *sinfo);
778         int     (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
779                                int idx, u8 *mac, struct station_info *sinfo);
780
781         int     (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
782                                u8 *dst, u8 *next_hop);
783         int     (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
784                                u8 *dst);
785         int     (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
786                                   u8 *dst, u8 *next_hop);
787         int     (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
788                                u8 *dst, u8 *next_hop,
789                                struct mpath_info *pinfo);
790         int     (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
791                                int idx, u8 *dst, u8 *next_hop,
792                                struct mpath_info *pinfo);
793         int     (*get_mesh_params)(struct wiphy *wiphy,
794                                 struct net_device *dev,
795                                 struct mesh_config *conf);
796         int     (*set_mesh_params)(struct wiphy *wiphy,
797                                 struct net_device *dev,
798                                 const struct mesh_config *nconf, u32 mask);
799         int     (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
800                               struct bss_parameters *params);
801
802         int     (*set_txq_params)(struct wiphy *wiphy,
803                                   struct ieee80211_txq_params *params);
804
805         int     (*set_channel)(struct wiphy *wiphy,
806                                struct ieee80211_channel *chan,
807                                enum nl80211_channel_type channel_type);
808
809         int     (*scan)(struct wiphy *wiphy, struct net_device *dev,
810                         struct cfg80211_scan_request *request);
811
812         int     (*auth)(struct wiphy *wiphy, struct net_device *dev,
813                         struct cfg80211_auth_request *req);
814         int     (*assoc)(struct wiphy *wiphy, struct net_device *dev,
815                          struct cfg80211_assoc_request *req);
816         int     (*deauth)(struct wiphy *wiphy, struct net_device *dev,
817                           struct cfg80211_deauth_request *req);
818         int     (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
819                             struct cfg80211_disassoc_request *req);
820 };
821
822 /* temporary wext handlers */
823 int cfg80211_wext_giwname(struct net_device *dev,
824                           struct iw_request_info *info,
825                           char *name, char *extra);
826 int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
827                           u32 *mode, char *extra);
828 int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
829                           u32 *mode, char *extra);
830 int cfg80211_wext_siwscan(struct net_device *dev,
831                           struct iw_request_info *info,
832                           union iwreq_data *wrqu, char *extra);
833 int cfg80211_wext_giwscan(struct net_device *dev,
834                           struct iw_request_info *info,
835                           struct iw_point *data, char *extra);
836 int cfg80211_wext_giwrange(struct net_device *dev,
837                            struct iw_request_info *info,
838                            struct iw_point *data, char *extra);
839
840 /**
841  * cfg80211_scan_done - notify that scan finished
842  *
843  * @request: the corresponding scan request
844  * @aborted: set to true if the scan was aborted for any reason,
845  *      userspace will be notified of that
846  */
847 void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
848
849 /**
850  * cfg80211_inform_bss - inform cfg80211 of a new BSS
851  *
852  * @wiphy: the wiphy reporting the BSS
853  * @bss: the found BSS
854  * @signal: the signal strength, type depends on the wiphy's signal_type
855  * @gfp: context flags
856  *
857  * This informs cfg80211 that BSS information was found and
858  * the BSS should be updated/added.
859  */
860 struct cfg80211_bss*
861 cfg80211_inform_bss_frame(struct wiphy *wiphy,
862                           struct ieee80211_channel *channel,
863                           struct ieee80211_mgmt *mgmt, size_t len,
864                           s32 signal, gfp_t gfp);
865
866 struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
867                                       struct ieee80211_channel *channel,
868                                       const u8 *bssid,
869                                       const u8 *ssid, size_t ssid_len,
870                                       u16 capa_mask, u16 capa_val);
871 static inline struct cfg80211_bss *
872 cfg80211_get_ibss(struct wiphy *wiphy,
873                   struct ieee80211_channel *channel,
874                   const u8 *ssid, size_t ssid_len)
875 {
876         return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
877                                 WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
878 }
879
880 struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
881                                        struct ieee80211_channel *channel,
882                                        const u8 *meshid, size_t meshidlen,
883                                        const u8 *meshcfg);
884 void cfg80211_put_bss(struct cfg80211_bss *bss);
885 /**
886  * cfg80211_unlink_bss - unlink BSS from internal data structures
887  * @wiphy: the wiphy
888  * @bss: the bss to remove
889  *
890  * This function removes the given BSS from the internal data structures
891  * thereby making it no longer show up in scan results etc. Use this
892  * function when you detect a BSS is gone. Normally BSSes will also time
893  * out, so it is not necessary to use this function at all.
894  */
895 void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
896
897 /**
898  * cfg80211_send_rx_auth - notification of processed authentication
899  * @dev: network device
900  * @buf: authentication frame (header + body)
901  * @len: length of the frame data
902  *
903  * This function is called whenever an authentication has been processed in
904  * station mode.
905  */
906 void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
907
908 /**
909  * cfg80211_send_rx_assoc - notification of processed association
910  * @dev: network device
911  * @buf: (re)association response frame (header + body)
912  * @len: length of the frame data
913  *
914  * This function is called whenever a (re)association response has been
915  * processed in station mode.
916  */
917 void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
918
919 /**
920  * cfg80211_send_deauth - notification of processed deauthentication
921  * @dev: network device
922  * @buf: deauthentication frame (header + body)
923  * @len: length of the frame data
924  *
925  * This function is called whenever deauthentication has been processed in
926  * station mode. This includes both received deauthentication frames and
927  * locally generated ones.
928  */
929 void cfg80211_send_deauth(struct net_device *dev, const u8 *buf, size_t len);
930
931 /**
932  * cfg80211_send_disassoc - notification of processed disassociation
933  * @dev: network device
934  * @buf: disassociation response frame (header + body)
935  * @len: length of the frame data
936  *
937  * This function is called whenever disassociation has been processed in
938  * station mode. This includes both received disassociation frames and locally
939  * generated ones.
940  */
941 void cfg80211_send_disassoc(struct net_device *dev, const u8 *buf, size_t len);
942
943 /**
944  * cfg80211_hold_bss - exclude bss from expiration
945  * @bss: bss which should not expire
946  *
947  * In a case when the BSS is not updated but it shouldn't expire this
948  * function can be used to mark the BSS to be excluded from expiration.
949  */
950 void cfg80211_hold_bss(struct cfg80211_bss *bss);
951
952 /**
953  * cfg80211_unhold_bss - remove expiration exception from the BSS
954  * @bss: bss which can expire again
955  *
956  * This function marks the BSS to be expirable again.
957  */
958 void cfg80211_unhold_bss(struct cfg80211_bss *bss);
959
960 /**
961  * cfg80211_michael_mic_failure - notification of Michael MIC failure (TKIP)
962  * @dev: network device
963  * @addr: The source MAC address of the frame
964  * @key_type: The key type that the received frame used
965  * @key_id: Key identifier (0..3)
966  * @tsc: The TSC value of the frame that generated the MIC failure (6 octets)
967  *
968  * This function is called whenever the local MAC detects a MIC failure in a
969  * received frame. This matches with MLME-MICHAELMICFAILURE.indication()
970  * primitive.
971  */
972 void cfg80211_michael_mic_failure(struct net_device *dev, const u8 *addr,
973                                   enum nl80211_key_type key_type, int key_id,
974                                   const u8 *tsc);
975
976 #endif /* __NET_CFG80211_H */