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