blob: 09a0b268e5cfe5718252202d2a7e7ef7436b4f71 [file] [log] [blame]
Johannes Berg704232c2007-04-23 12:20:05 -07001#ifndef __NET_CFG80211_H
2#define __NET_CFG80211_H
3
4#include <linux/netlink.h>
5#include <linux/skbuff.h>
Johannes Berg55682962007-09-20 13:09:35 -04006#include <linux/nl80211.h>
Johannes Berg2a519312009-02-10 21:25:55 +01007#include <linux/if_ether.h>
8#include <linux/ieee80211.h>
9#include <linux/wireless.h>
10#include <net/iw_handler.h>
Johannes Berg704232c2007-04-23 12:20:05 -070011#include <net/genetlink.h>
Johannes Bergfee52672008-11-26 22:36:31 +010012/* remove once we remove the wext stuff */
13#include <net/iw_handler.h>
Johannes Berg704232c2007-04-23 12:20:05 -070014
15/*
16 * 802.11 configuration in-kernel interface
17 *
Johannes Berg55682962007-09-20 13:09:35 -040018 * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net>
Johannes Berg704232c2007-04-23 12:20:05 -070019 */
20
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +010021/**
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 */
26struct vif_params {
27 u8 *mesh_id;
28 int mesh_id_len;
29};
30
Andy Green179f8312007-07-10 19:29:38 +020031/* 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
47struct 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
59extern int ieee80211_radiotap_iterator_init(
60 struct ieee80211_radiotap_iterator *iterator,
61 struct ieee80211_radiotap_header *radiotap_header,
62 int max_length);
63
64extern int ieee80211_radiotap_iterator_next(
65 struct ieee80211_radiotap_iterator *iterator);
66
67
Johannes Berg41ade002007-12-19 02:03:29 +010068 /**
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 */
80struct key_params {
81 u8 *key;
82 u8 *seq;
83 int key_len;
84 int seq_len;
85 u32 cipher;
86};
87
Johannes Berged1b6cc2007-12-19 02:03:32 +010088/**
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 */
102struct beacon_parameters {
103 u8 *head, *tail;
104 int interval, dtim_period;
105 int head_len, tail_len;
106};
107
Johannes Berg5727ef12007-12-19 02:03:34 +0100108/**
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
Jouni Malinen5394af42009-01-08 13:31:59 +0200119 * @STATION_FLAG_MFP: station uses management frame protection
Johannes Berg5727ef12007-12-19 02:03:34 +0100120 */
121enum 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,
Jouni Malinen5394af42009-01-08 13:31:59 +0200126 STATION_FLAG_MFP = 1<<NL80211_STA_FLAG_MFP,
Johannes Berg5727ef12007-12-19 02:03:34 +0100127};
128
129/**
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100130 * 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 */
136enum plink_actions {
137 PLINK_ACTION_INVALID,
138 PLINK_ACTION_OPEN,
139 PLINK_ACTION_BLOCK,
140};
141
142/**
Johannes Berg5727ef12007-12-19 02:03:34 +0100143 * 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 */
155struct 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;
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100162 u8 plink_action;
Jouni Malinen36aedc92008-08-25 11:58:58 +0300163 struct ieee80211_ht_cap *ht_capa;
Johannes Berg5727ef12007-12-19 02:03:34 +0100164};
165
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100166/**
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100167 * enum station_info_flags - station information flags
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100168 *
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100169 * Used by the driver to indicate which info in &struct station_info
170 * it has filled in during get_station() or dump_station().
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100171 *
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100172 * @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
Henning Rogge420e7fa2008-12-11 22:04:19 +0100178 * @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)
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100181 */
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100182enum station_info_flags {
183 STATION_INFO_INACTIVE_TIME = 1<<0,
184 STATION_INFO_RX_BYTES = 1<<1,
185 STATION_INFO_TX_BYTES = 1<<2,
186 STATION_INFO_LLID = 1<<3,
187 STATION_INFO_PLID = 1<<4,
188 STATION_INFO_PLINK_STATE = 1<<5,
Henning Rogge420e7fa2008-12-11 22:04:19 +0100189 STATION_INFO_SIGNAL = 1<<6,
190 STATION_INFO_TX_BITRATE = 1<<7,
191};
192
193/**
194 * enum station_info_rate_flags - bitrate info flags
195 *
196 * Used by the driver to indicate the specific rate transmission
197 * type for 802.11n transmissions.
198 *
199 * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled
200 * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission
201 * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
202 */
203enum rate_info_flags {
204 RATE_INFO_FLAGS_MCS = 1<<0,
205 RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1,
206 RATE_INFO_FLAGS_SHORT_GI = 1<<2,
207};
208
209/**
210 * struct rate_info - bitrate information
211 *
212 * Information about a receiving or transmitting bitrate
213 *
214 * @flags: bitflag of flags from &enum rate_info_flags
215 * @mcs: mcs index if struct describes a 802.11n bitrate
216 * @legacy: bitrate in 100kbit/s for 802.11abg
217 */
218struct rate_info {
219 u8 flags;
220 u8 mcs;
221 u16 legacy;
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100222};
223
224/**
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100225 * struct station_info - station information
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100226 *
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100227 * Station information filled by driver for get_station() and dump_station.
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100228 *
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100229 * @filled: bitflag of flags from &enum station_info_flags
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100230 * @inactive_time: time since last station activity (tx/rx) in milliseconds
231 * @rx_bytes: bytes received from this station
232 * @tx_bytes: bytes transmitted to this station
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100233 * @llid: mesh local link id
234 * @plid: mesh peer link id
235 * @plink_state: mesh peer link state
Henning Rogge420e7fa2008-12-11 22:04:19 +0100236 * @signal: signal strength of last received packet in dBm
237 * @txrate: current unicast bitrate to this station
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100238 */
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100239struct station_info {
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100240 u32 filled;
241 u32 inactive_time;
242 u32 rx_bytes;
243 u32 tx_bytes;
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100244 u16 llid;
245 u16 plid;
246 u8 plink_state;
Henning Rogge420e7fa2008-12-11 22:04:19 +0100247 s8 signal;
248 struct rate_info txrate;
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100249};
250
Michael Wu66f7ac52008-01-31 19:48:22 +0100251/**
252 * enum monitor_flags - monitor flags
253 *
254 * Monitor interface configuration flags. Note that these must be the bits
255 * according to the nl80211 flags.
256 *
257 * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
258 * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
259 * @MONITOR_FLAG_CONTROL: pass control frames
260 * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
261 * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
262 */
263enum monitor_flags {
264 MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
265 MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
266 MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
267 MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
268 MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
269};
270
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100271/**
272 * enum mpath_info_flags - mesh path information flags
273 *
274 * Used by the driver to indicate which info in &struct mpath_info it has filled
275 * in during get_station() or dump_station().
276 *
277 * MPATH_INFO_FRAME_QLEN: @frame_qlen filled
278 * MPATH_INFO_DSN: @dsn filled
279 * MPATH_INFO_METRIC: @metric filled
280 * MPATH_INFO_EXPTIME: @exptime filled
281 * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
282 * MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
283 * MPATH_INFO_FLAGS: @flags filled
284 */
285enum mpath_info_flags {
286 MPATH_INFO_FRAME_QLEN = BIT(0),
287 MPATH_INFO_DSN = BIT(1),
288 MPATH_INFO_METRIC = BIT(2),
289 MPATH_INFO_EXPTIME = BIT(3),
290 MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
291 MPATH_INFO_DISCOVERY_RETRIES = BIT(5),
292 MPATH_INFO_FLAGS = BIT(6),
293};
294
295/**
296 * struct mpath_info - mesh path information
297 *
298 * Mesh path information filled by driver for get_mpath() and dump_mpath().
299 *
300 * @filled: bitfield of flags from &enum mpath_info_flags
301 * @frame_qlen: number of queued frames for this destination
302 * @dsn: destination sequence number
303 * @metric: metric (cost) of this mesh path
304 * @exptime: expiration time for the mesh path from now, in msecs
305 * @flags: mesh path flags
306 * @discovery_timeout: total mesh path discovery timeout, in msecs
307 * @discovery_retries: mesh path discovery retries
308 */
309struct mpath_info {
310 u32 filled;
311 u32 frame_qlen;
312 u32 dsn;
313 u32 metric;
314 u32 exptime;
315 u32 discovery_timeout;
316 u8 discovery_retries;
317 u8 flags;
318};
319
Jouni Malinen9f1ba902008-08-07 20:07:01 +0300320/**
321 * struct bss_parameters - BSS parameters
322 *
323 * Used to change BSS parameters (mainly for AP mode).
324 *
325 * @use_cts_prot: Whether to use CTS protection
326 * (0 = no, 1 = yes, -1 = do not change)
327 * @use_short_preamble: Whether the use of short preambles is allowed
328 * (0 = no, 1 = yes, -1 = do not change)
329 * @use_short_slot_time: Whether the use of short slot time is allowed
330 * (0 = no, 1 = yes, -1 = do not change)
Jouni Malinen90c97a02008-10-30 16:59:22 +0200331 * @basic_rates: basic rates in IEEE 802.11 format
332 * (or NULL for no change)
333 * @basic_rates_len: number of basic rates
Jouni Malinen9f1ba902008-08-07 20:07:01 +0300334 */
335struct bss_parameters {
336 int use_cts_prot;
337 int use_short_preamble;
338 int use_short_slot_time;
Jouni Malinen90c97a02008-10-30 16:59:22 +0200339 u8 *basic_rates;
340 u8 basic_rates_len;
Jouni Malinen9f1ba902008-08-07 20:07:01 +0300341};
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100342
Luis R. Rodriguezb2e1b302008-09-09 23:19:48 -0700343/**
344 * enum reg_set_by - Indicates who is trying to set the regulatory domain
345 * @REGDOM_SET_BY_INIT: regulatory domain was set by initialization. We will be
346 * using a static world regulatory domain by default.
347 * @REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world regulatory domain.
348 * @REGDOM_SET_BY_USER: User asked the wireless core to set the
349 * regulatory domain.
350 * @REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the wireless core
351 * it thinks its knows the regulatory domain we should be in.
352 * @REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an 802.11 country
353 * information element with regulatory information it thinks we
354 * should consider.
355 */
356enum reg_set_by {
357 REGDOM_SET_BY_INIT,
358 REGDOM_SET_BY_CORE,
359 REGDOM_SET_BY_USER,
360 REGDOM_SET_BY_DRIVER,
361 REGDOM_SET_BY_COUNTRY_IE,
362};
363
Luis R. Rodriguez716f9392009-01-22 15:05:51 -0800364/**
365 * enum environment_cap - Environment parsed from country IE
366 * @ENVIRON_ANY: indicates country IE applies to both indoor and
367 * outdoor operation.
368 * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
369 * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
370 */
371enum environment_cap {
372 ENVIRON_ANY,
373 ENVIRON_INDOOR,
374 ENVIRON_OUTDOOR,
375};
376
377/**
378 * struct regulatory_request - receipt of last regulatory request
379 *
380 * @wiphy: this is set if this request's initiator is
381 * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
382 * can be used by the wireless core to deal with conflicts
383 * and potentially inform users of which devices specifically
384 * cased the conflicts.
385 * @initiator: indicates who sent this request, could be any of
386 * of those set in reg_set_by, %REGDOM_SET_BY_*
387 * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
388 * regulatory domain. We have a few special codes:
389 * 00 - World regulatory domain
390 * 99 - built by driver but a specific alpha2 cannot be determined
391 * 98 - result of an intersection between two regulatory domains
392 * @intersect: indicates whether the wireless core should intersect
393 * the requested regulatory domain with the presently set regulatory
394 * domain.
395 * @country_ie_checksum: checksum of the last processed and accepted
396 * country IE
397 * @country_ie_env: lets us know if the AP is telling us we are outdoor,
398 * indoor, or if it doesn't matter
399 */
400struct regulatory_request {
401 struct wiphy *wiphy;
402 enum reg_set_by initiator;
403 char alpha2[2];
404 bool intersect;
405 u32 country_ie_checksum;
406 enum environment_cap country_ie_env;
407};
408
Luis R. Rodriguezb2e1b302008-09-09 23:19:48 -0700409struct ieee80211_freq_range {
410 u32 start_freq_khz;
411 u32 end_freq_khz;
412 u32 max_bandwidth_khz;
413};
414
415struct ieee80211_power_rule {
416 u32 max_antenna_gain;
417 u32 max_eirp;
418};
419
420struct ieee80211_reg_rule {
421 struct ieee80211_freq_range freq_range;
422 struct ieee80211_power_rule power_rule;
423 u32 flags;
424};
425
426struct ieee80211_regdomain {
427 u32 n_reg_rules;
428 char alpha2[2];
429 struct ieee80211_reg_rule reg_rules[];
430};
431
Luis R. Rodriguezb219cee2008-10-30 13:33:55 -0700432#define MHZ_TO_KHZ(freq) ((freq) * 1000)
433#define KHZ_TO_MHZ(freq) ((freq) / 1000)
434#define DBI_TO_MBI(gain) ((gain) * 100)
435#define MBI_TO_DBI(gain) ((gain) / 100)
436#define DBM_TO_MBM(gain) ((gain) * 100)
437#define MBM_TO_DBM(gain) ((gain) / 100)
Luis R. Rodriguezb2e1b302008-09-09 23:19:48 -0700438
439#define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \
Luis R. Rodriguezb219cee2008-10-30 13:33:55 -0700440 .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
441 .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
442 .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
443 .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \
444 .power_rule.max_eirp = DBM_TO_MBM(eirp), \
Luis R. Rodriguezb2e1b302008-09-09 23:19:48 -0700445 .flags = reg_flags, \
446 }
447
colin@cozybit.com93da9cc2008-10-21 12:03:48 -0700448struct mesh_config {
449 /* Timeouts in ms */
450 /* Mesh plink management parameters */
451 u16 dot11MeshRetryTimeout;
452 u16 dot11MeshConfirmTimeout;
453 u16 dot11MeshHoldingTimeout;
454 u16 dot11MeshMaxPeerLinks;
455 u8 dot11MeshMaxRetries;
456 u8 dot11MeshTTL;
457 bool auto_open_plinks;
458 /* HWMP parameters */
459 u8 dot11MeshHWMPmaxPREQretries;
460 u32 path_refresh_time;
461 u16 min_discovery_timeout;
462 u32 dot11MeshHWMPactivePathTimeout;
463 u16 dot11MeshHWMPpreqMinInterval;
464 u16 dot11MeshHWMPnetDiameterTraversalTime;
465};
466
Jouni Malinen31888482008-10-30 16:59:24 +0200467/**
468 * struct ieee80211_txq_params - TX queue parameters
469 * @queue: TX queue identifier (NL80211_TXQ_Q_*)
470 * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
471 * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
472 * 1..32767]
473 * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
474 * 1..32767]
475 * @aifs: Arbitration interframe space [0..255]
476 */
477struct ieee80211_txq_params {
478 enum nl80211_txq_q queue;
479 u16 txop;
480 u16 cwmin;
481 u16 cwmax;
482 u8 aifs;
483};
484
Jouni Malinen9aed3cc2009-01-13 16:03:29 +0200485/**
486 * struct mgmt_extra_ie_params - Extra management frame IE parameters
487 *
488 * Used to add extra IE(s) into management frames. If the driver cannot add the
489 * requested data into all management frames of the specified subtype that are
490 * generated in kernel or firmware/hardware, it must reject the configuration
491 * call. The IE data buffer is added to the end of the specified management
492 * frame body after all other IEs. This addition is not applied to frames that
493 * are injected through a monitor interface.
494 *
495 * @subtype: Management frame subtype
496 * @ies: IE data buffer or %NULL to remove previous data
497 * @ies_len: Length of @ies in octets
498 */
499struct mgmt_extra_ie_params {
500 u8 subtype;
501 u8 *ies;
502 int ies_len;
503};
504
Johannes Berg704232c2007-04-23 12:20:05 -0700505/* from net/wireless.h */
506struct wiphy;
507
Jouni Malinen72bdcf32008-11-26 16:15:24 +0200508/* from net/ieee80211.h */
509struct ieee80211_channel;
510
Johannes Berg704232c2007-04-23 12:20:05 -0700511/**
Johannes Berg2a519312009-02-10 21:25:55 +0100512 * struct cfg80211_ssid - SSID description
513 * @ssid: the SSID
514 * @ssid_len: length of the ssid
515 */
516struct cfg80211_ssid {
517 u8 ssid[IEEE80211_MAX_SSID_LEN];
518 u8 ssid_len;
519};
520
521/**
522 * struct cfg80211_scan_request - scan request description
523 *
524 * @ssids: SSIDs to scan for (active scan only)
525 * @n_ssids: number of SSIDs
526 * @channels: channels to scan on.
527 * @n_channels: number of channels for each band
528 * @wiphy: the wiphy this was for
529 * @ifidx: the interface index
530 */
531struct cfg80211_scan_request {
532 struct cfg80211_ssid *ssids;
533 int n_ssids;
534 struct ieee80211_channel **channels;
535 u32 n_channels;
536
537 /* internal */
538 struct wiphy *wiphy;
539 int ifidx;
540};
541
542/**
543 * enum cfg80211_signal_type - signal type
544 *
545 * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
546 * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
547 * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
548 */
549enum cfg80211_signal_type {
550 CFG80211_SIGNAL_TYPE_NONE,
551 CFG80211_SIGNAL_TYPE_MBM,
552 CFG80211_SIGNAL_TYPE_UNSPEC,
553};
554
555/**
556 * struct cfg80211_bss - BSS description
557 *
558 * This structure describes a BSS (which may also be a mesh network)
559 * for use in scan results and similar.
560 *
561 * @bssid: BSSID of the BSS
562 * @tsf: timestamp of last received update
563 * @beacon_interval: the beacon interval as from the frame
564 * @capability: the capability field in host byte order
565 * @information_elements: the information elements (Note that there
566 * is no guarantee that these are well-formed!)
567 * @len_information_elements: total length of the information elements
568 * @signal: signal strength value
569 * @signal_type: signal type
570 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
571 */
572struct cfg80211_bss {
573 struct ieee80211_channel *channel;
574
575 u8 bssid[ETH_ALEN];
576 u64 tsf;
577 u16 beacon_interval;
578 u16 capability;
579 u8 *information_elements;
580 size_t len_information_elements;
581
582 s32 signal;
583 enum cfg80211_signal_type signal_type;
584
585 u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
586};
587
588/**
Johannes Berg704232c2007-04-23 12:20:05 -0700589 * struct cfg80211_ops - backend description for wireless configuration
590 *
591 * This struct is registered by fullmac card drivers and/or wireless stacks
592 * in order to handle configuration requests on their interfaces.
593 *
594 * All callbacks except where otherwise noted should return 0
595 * on success or a negative error code.
596 *
Johannes Berg43fb45cb2007-04-24 14:07:27 -0700597 * All operations are currently invoked under rtnl for consistency with the
598 * wireless extensions but this is subject to reevaluation as soon as this
599 * code is used more widely and we have a first user without wext.
600 *
Johannes Berg0378b3f2009-01-19 11:20:52 -0500601 * @suspend: wiphy device needs to be suspended
602 * @resume: wiphy device needs to be resumed
603 *
Johannes Berg60719ff2008-09-16 14:55:09 +0200604 * @add_virtual_intf: create a new virtual interface with the given name,
605 * must set the struct wireless_dev's iftype.
Johannes Berg704232c2007-04-23 12:20:05 -0700606 *
607 * @del_virtual_intf: remove the virtual interface determined by ifindex.
Johannes Berg55682962007-09-20 13:09:35 -0400608 *
Johannes Berg60719ff2008-09-16 14:55:09 +0200609 * @change_virtual_intf: change type/configuration of virtual interface,
610 * keep the struct wireless_dev's iftype updated.
Johannes Berg55682962007-09-20 13:09:35 -0400611 *
Johannes Berg41ade002007-12-19 02:03:29 +0100612 * @add_key: add a key with the given parameters. @mac_addr will be %NULL
613 * when adding a group key.
614 *
615 * @get_key: get information about the key with the given parameters.
616 * @mac_addr will be %NULL when requesting information for a group
617 * key. All pointers given to the @callback function need not be valid
618 * after it returns.
619 *
620 * @del_key: remove a key given the @mac_addr (%NULL for a group key)
621 * and @key_index
622 *
623 * @set_default_key: set the default key on an interface
Johannes Berged1b6cc2007-12-19 02:03:32 +0100624 *
Jouni Malinen3cfcf6ac2009-01-08 13:32:02 +0200625 * @set_default_mgmt_key: set the default management frame key on an interface
626 *
Johannes Berged1b6cc2007-12-19 02:03:32 +0100627 * @add_beacon: Add a beacon with given parameters, @head, @interval
628 * and @dtim_period will be valid, @tail is optional.
629 * @set_beacon: Change the beacon parameters for an access point mode
630 * interface. This should reject the call when no beacon has been
631 * configured.
632 * @del_beacon: Remove beacon configuration and stop sending the beacon.
Johannes Berg5727ef12007-12-19 02:03:34 +0100633 *
634 * @add_station: Add a new station.
635 *
636 * @del_station: Remove a station; @mac may be NULL to remove all stations.
637 *
638 * @change_station: Modify a given station.
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100639 *
colin@cozybit.com93da9cc2008-10-21 12:03:48 -0700640 * @get_mesh_params: Put the current mesh parameters into *params
641 *
642 * @set_mesh_params: Set mesh parameters.
643 * The mask is a bitfield which tells us which parameters to
644 * set, and which to leave alone.
645 *
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100646 * @set_mesh_cfg: set mesh parameters (by now, just mesh id)
Jouni Malinen9f1ba902008-08-07 20:07:01 +0300647 *
648 * @change_bss: Modify parameters for a given BSS.
Jouni Malinen31888482008-10-30 16:59:24 +0200649 *
650 * @set_txq_params: Set TX queue parameters
Jouni Malinen72bdcf32008-11-26 16:15:24 +0200651 *
652 * @set_channel: Set channel
Jouni Malinen9aed3cc2009-01-13 16:03:29 +0200653 *
654 * @set_mgmt_extra_ie: Set extra IE data for management frames
Johannes Berg2a519312009-02-10 21:25:55 +0100655 *
656 * @scan: Request to do a scan. If returning zero, the scan request is given
657 * the driver, and will be valid until passed to cfg80211_scan_done().
658 * For scan results, call cfg80211_inform_bss(); you can call this outside
659 * the scan/scan_done bracket too.
Johannes Berg704232c2007-04-23 12:20:05 -0700660 */
661struct cfg80211_ops {
Johannes Berg0378b3f2009-01-19 11:20:52 -0500662 int (*suspend)(struct wiphy *wiphy);
663 int (*resume)(struct wiphy *wiphy);
664
Johannes Berg704232c2007-04-23 12:20:05 -0700665 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100666 enum nl80211_iftype type, u32 *flags,
667 struct vif_params *params);
Johannes Berg704232c2007-04-23 12:20:05 -0700668 int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
Johannes Berg55682962007-09-20 13:09:35 -0400669 int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex,
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100670 enum nl80211_iftype type, u32 *flags,
671 struct vif_params *params);
Johannes Berg41ade002007-12-19 02:03:29 +0100672
673 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
674 u8 key_index, u8 *mac_addr,
675 struct key_params *params);
676 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
677 u8 key_index, u8 *mac_addr, void *cookie,
678 void (*callback)(void *cookie, struct key_params*));
679 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
680 u8 key_index, u8 *mac_addr);
681 int (*set_default_key)(struct wiphy *wiphy,
682 struct net_device *netdev,
683 u8 key_index);
Jouni Malinen3cfcf6ac2009-01-08 13:32:02 +0200684 int (*set_default_mgmt_key)(struct wiphy *wiphy,
685 struct net_device *netdev,
686 u8 key_index);
Johannes Berged1b6cc2007-12-19 02:03:32 +0100687
688 int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev,
689 struct beacon_parameters *info);
690 int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev,
691 struct beacon_parameters *info);
692 int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev);
Johannes Berg5727ef12007-12-19 02:03:34 +0100693
694
695 int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
696 u8 *mac, struct station_parameters *params);
697 int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
698 u8 *mac);
699 int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
700 u8 *mac, struct station_parameters *params);
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100701 int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100702 u8 *mac, struct station_info *sinfo);
703 int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
704 int idx, u8 *mac, struct station_info *sinfo);
705
706 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
707 u8 *dst, u8 *next_hop);
708 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
709 u8 *dst);
710 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
711 u8 *dst, u8 *next_hop);
712 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
713 u8 *dst, u8 *next_hop,
714 struct mpath_info *pinfo);
715 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
716 int idx, u8 *dst, u8 *next_hop,
717 struct mpath_info *pinfo);
colin@cozybit.com93da9cc2008-10-21 12:03:48 -0700718 int (*get_mesh_params)(struct wiphy *wiphy,
719 struct net_device *dev,
720 struct mesh_config *conf);
721 int (*set_mesh_params)(struct wiphy *wiphy,
722 struct net_device *dev,
723 const struct mesh_config *nconf, u32 mask);
Jouni Malinen9f1ba902008-08-07 20:07:01 +0300724 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
725 struct bss_parameters *params);
Jouni Malinen31888482008-10-30 16:59:24 +0200726
727 int (*set_txq_params)(struct wiphy *wiphy,
728 struct ieee80211_txq_params *params);
Jouni Malinen72bdcf32008-11-26 16:15:24 +0200729
730 int (*set_channel)(struct wiphy *wiphy,
731 struct ieee80211_channel *chan,
Sujith094d05d2008-12-12 11:57:43 +0530732 enum nl80211_channel_type channel_type);
Jouni Malinen9aed3cc2009-01-13 16:03:29 +0200733
734 int (*set_mgmt_extra_ie)(struct wiphy *wiphy,
735 struct net_device *dev,
736 struct mgmt_extra_ie_params *params);
Johannes Berg2a519312009-02-10 21:25:55 +0100737
738 int (*scan)(struct wiphy *wiphy, struct net_device *dev,
739 struct cfg80211_scan_request *request);
Johannes Berg704232c2007-04-23 12:20:05 -0700740};
741
Johannes Bergfee52672008-11-26 22:36:31 +0100742/* temporary wext handlers */
743int cfg80211_wext_giwname(struct net_device *dev,
744 struct iw_request_info *info,
745 char *name, char *extra);
Johannes Berge60c7742008-11-26 23:31:40 +0100746int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
747 u32 *mode, char *extra);
748int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
749 u32 *mode, char *extra);
Johannes Berg2a519312009-02-10 21:25:55 +0100750int cfg80211_wext_siwscan(struct net_device *dev,
751 struct iw_request_info *info,
752 union iwreq_data *wrqu, char *extra);
753int cfg80211_wext_giwscan(struct net_device *dev,
754 struct iw_request_info *info,
755 struct iw_point *data, char *extra);
756
757/**
758 * cfg80211_scan_done - notify that scan finished
759 *
760 * @request: the corresponding scan request
761 * @aborted: set to true if the scan was aborted for any reason,
762 * userspace will be notified of that
763 */
764void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
765
766/**
767 * cfg80211_inform_bss - inform cfg80211 of a new BSS
768 *
769 * @wiphy: the wiphy reporting the BSS
770 * @bss: the found BSS
771 * @gfp: context flags
772 *
773 * This informs cfg80211 that BSS information was found and
774 * the BSS should be updated/added.
775 */
776struct cfg80211_bss*
777cfg80211_inform_bss_frame(struct wiphy *wiphy,
778 struct ieee80211_channel *channel,
779 struct ieee80211_mgmt *mgmt, size_t len,
780 s32 signal, enum cfg80211_signal_type sigtype,
781 gfp_t gfp);
782
783struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
784 struct ieee80211_channel *channel,
785 const u8 *bssid,
786 const u8 *ssid, size_t ssid_len);
787struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
788 struct ieee80211_channel *channel,
789 const u8 *meshid, size_t meshidlen,
790 const u8 *meshcfg);
791void cfg80211_put_bss(struct cfg80211_bss *bss);
Johannes Bergfee52672008-11-26 22:36:31 +0100792
Johannes Berg704232c2007-04-23 12:20:05 -0700793#endif /* __NET_CFG80211_H */