blob: 5389afdc129756abcef4c088b2c7adfd84165670 [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)
Jouni Malinen98c8a60a2009-02-17 13:24:57 +0200181 * @STATION_INFO_RX_PACKETS: @rx_packets filled
182 * @STATION_INFO_TX_PACKETS: @tx_packets filled
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100183 */
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100184enum 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,
Henning Rogge420e7fa2008-12-11 22:04:19 +0100191 STATION_INFO_SIGNAL = 1<<6,
192 STATION_INFO_TX_BITRATE = 1<<7,
Jouni Malinen98c8a60a2009-02-17 13:24:57 +0200193 STATION_INFO_RX_PACKETS = 1<<8,
194 STATION_INFO_TX_PACKETS = 1<<9,
Henning Rogge420e7fa2008-12-11 22:04:19 +0100195};
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 */
207enum 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 */
222struct rate_info {
223 u8 flags;
224 u8 mcs;
225 u16 legacy;
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100226};
227
228/**
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100229 * struct station_info - station information
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100230 *
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100231 * Station information filled by driver for get_station() and dump_station.
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100232 *
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100233 * @filled: bitflag of flags from &enum station_info_flags
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100234 * @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
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100237 * @llid: mesh local link id
238 * @plid: mesh peer link id
239 * @plink_state: mesh peer link state
Henning Rogge420e7fa2008-12-11 22:04:19 +0100240 * @signal: signal strength of last received packet in dBm
241 * @txrate: current unicast bitrate to this station
Jouni Malinen98c8a60a2009-02-17 13:24:57 +0200242 * @rx_packets: packets received from this station
243 * @tx_packets: packets transmitted to this station
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100244 */
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100245struct station_info {
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100246 u32 filled;
247 u32 inactive_time;
248 u32 rx_bytes;
249 u32 tx_bytes;
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100250 u16 llid;
251 u16 plid;
252 u8 plink_state;
Henning Rogge420e7fa2008-12-11 22:04:19 +0100253 s8 signal;
254 struct rate_info txrate;
Jouni Malinen98c8a60a2009-02-17 13:24:57 +0200255 u32 rx_packets;
256 u32 tx_packets;
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100257};
258
Michael Wu66f7ac52008-01-31 19:48:22 +0100259/**
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 */
271enum 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
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100279/**
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 */
293enum 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 */
317struct 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
Jouni Malinen9f1ba902008-08-07 20:07:01 +0300328/**
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)
Jouni Malinen90c97a02008-10-30 16:59:22 +0200339 * @basic_rates: basic rates in IEEE 802.11 format
340 * (or NULL for no change)
341 * @basic_rates_len: number of basic rates
Jouni Malinen9f1ba902008-08-07 20:07:01 +0300342 */
343struct bss_parameters {
344 int use_cts_prot;
345 int use_short_preamble;
346 int use_short_slot_time;
Jouni Malinen90c97a02008-10-30 16:59:22 +0200347 u8 *basic_rates;
348 u8 basic_rates_len;
Jouni Malinen9f1ba902008-08-07 20:07:01 +0300349};
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100350
Luis R. Rodriguezb2e1b302008-09-09 23:19:48 -0700351/**
Luis R. Rodriguez716f9392009-01-22 15:05:51 -0800352 * enum environment_cap - Environment parsed from country IE
353 * @ENVIRON_ANY: indicates country IE applies to both indoor and
Luis R. Rodriguez7db90f42009-03-09 22:07:41 -0400354 * outdoor operation.
Luis R. Rodriguez716f9392009-01-22 15:05:51 -0800355 * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
356 * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
357 */
358enum environment_cap {
359 ENVIRON_ANY,
360 ENVIRON_INDOOR,
361 ENVIRON_OUTDOOR,
362};
363
364/**
Luis R. Rodriguez806a9e32009-02-21 00:04:26 -0500365 * struct regulatory_request - used to keep track of regulatory requests
Luis R. Rodriguez716f9392009-01-22 15:05:51 -0800366 *
Luis R. Rodriguez806a9e32009-02-21 00:04:26 -0500367 * @wiphy_idx: this is set if this request's initiator is
Luis R. Rodriguez716f9392009-01-22 15:05:51 -0800368 * %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
Luis R. Rodriguez7db90f42009-03-09 22:07:41 -0400373 * of those set in nl80211_reg_initiator (%NL80211_REGDOM_SET_BY_*)
Luis R. Rodriguez716f9392009-01-22 15:05:51 -0800374 * @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
Luis R. Rodriguezfe33eb32009-02-21 00:04:30 -0500386 * @list: used to insert into the reg_requests_list linked list
Luis R. Rodriguez716f9392009-01-22 15:05:51 -0800387 */
388struct regulatory_request {
Luis R. Rodriguez806a9e32009-02-21 00:04:26 -0500389 int wiphy_idx;
Luis R. Rodriguez7db90f42009-03-09 22:07:41 -0400390 enum nl80211_reg_initiator initiator;
Luis R. Rodriguez716f9392009-01-22 15:05:51 -0800391 char alpha2[2];
392 bool intersect;
393 u32 country_ie_checksum;
394 enum environment_cap country_ie_env;
Luis R. Rodriguezfe33eb32009-02-21 00:04:30 -0500395 struct list_head list;
Luis R. Rodriguez716f9392009-01-22 15:05:51 -0800396};
397
Luis R. Rodriguezb2e1b302008-09-09 23:19:48 -0700398struct ieee80211_freq_range {
399 u32 start_freq_khz;
400 u32 end_freq_khz;
401 u32 max_bandwidth_khz;
402};
403
404struct ieee80211_power_rule {
405 u32 max_antenna_gain;
406 u32 max_eirp;
407};
408
409struct ieee80211_reg_rule {
410 struct ieee80211_freq_range freq_range;
411 struct ieee80211_power_rule power_rule;
412 u32 flags;
413};
414
415struct ieee80211_regdomain {
416 u32 n_reg_rules;
417 char alpha2[2];
418 struct ieee80211_reg_rule reg_rules[];
419};
420
Luis R. Rodriguezb219cee2008-10-30 13:33:55 -0700421#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)
Luis R. Rodriguezb2e1b302008-09-09 23:19:48 -0700427
428#define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \
Luis R. Rodriguezb219cee2008-10-30 13:33:55 -0700429 .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), \
Luis R. Rodriguezb2e1b302008-09-09 23:19:48 -0700434 .flags = reg_flags, \
435 }
436
colin@cozybit.com93da9cc2008-10-21 12:03:48 -0700437struct 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
Jouni Malinen31888482008-10-30 16:59:24 +0200456/**
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 */
466struct ieee80211_txq_params {
467 enum nl80211_txq_q queue;
468 u16 txop;
469 u16 cwmin;
470 u16 cwmax;
471 u8 aifs;
472};
473
Johannes Berg704232c2007-04-23 12:20:05 -0700474/* from net/wireless.h */
475struct wiphy;
476
Jouni Malinen72bdcf32008-11-26 16:15:24 +0200477/* from net/ieee80211.h */
478struct ieee80211_channel;
479
Johannes Berg704232c2007-04-23 12:20:05 -0700480/**
Johannes Berg2a519312009-02-10 21:25:55 +0100481 * struct cfg80211_ssid - SSID description
482 * @ssid: the SSID
483 * @ssid_len: length of the ssid
484 */
485struct cfg80211_ssid {
486 u8 ssid[IEEE80211_MAX_SSID_LEN];
487 u8 ssid_len;
488};
489
490/**
491 * struct cfg80211_scan_request - scan request description
492 *
493 * @ssids: SSIDs to scan for (active scan only)
494 * @n_ssids: number of SSIDs
495 * @channels: channels to scan on.
496 * @n_channels: number of channels for each band
Jouni Malinen70692ad2009-02-16 19:39:13 +0200497 * @ie: optional information element(s) to add into Probe Request or %NULL
498 * @ie_len: length of ie in octets
Johannes Berg2a519312009-02-10 21:25:55 +0100499 * @wiphy: the wiphy this was for
500 * @ifidx: the interface index
501 */
502struct cfg80211_scan_request {
503 struct cfg80211_ssid *ssids;
504 int n_ssids;
505 struct ieee80211_channel **channels;
506 u32 n_channels;
Jouni Malinen70692ad2009-02-16 19:39:13 +0200507 u8 *ie;
508 size_t ie_len;
Johannes Berg2a519312009-02-10 21:25:55 +0100509
510 /* internal */
511 struct wiphy *wiphy;
512 int ifidx;
513};
514
515/**
516 * enum cfg80211_signal_type - signal type
517 *
518 * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
519 * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
520 * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
521 */
522enum cfg80211_signal_type {
523 CFG80211_SIGNAL_TYPE_NONE,
524 CFG80211_SIGNAL_TYPE_MBM,
525 CFG80211_SIGNAL_TYPE_UNSPEC,
526};
527
528/**
529 * struct cfg80211_bss - BSS description
530 *
531 * This structure describes a BSS (which may also be a mesh network)
532 * for use in scan results and similar.
533 *
534 * @bssid: BSSID of the BSS
535 * @tsf: timestamp of last received update
536 * @beacon_interval: the beacon interval as from the frame
537 * @capability: the capability field in host byte order
538 * @information_elements: the information elements (Note that there
539 * is no guarantee that these are well-formed!)
540 * @len_information_elements: total length of the information elements
Johannes Berg77965c92009-02-18 18:45:06 +0100541 * @signal: signal strength value (type depends on the wiphy's signal_type)
Kalle Valoa08c1c12009-03-22 21:57:28 +0200542 * @hold: BSS should not expire
Johannes Berg78c1c7e2009-02-10 21:25:57 +0100543 * @free_priv: function pointer to free private data
Johannes Berg2a519312009-02-10 21:25:55 +0100544 * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
545 */
546struct cfg80211_bss {
547 struct ieee80211_channel *channel;
548
549 u8 bssid[ETH_ALEN];
550 u64 tsf;
551 u16 beacon_interval;
552 u16 capability;
553 u8 *information_elements;
554 size_t len_information_elements;
555
556 s32 signal;
Johannes Berg2a519312009-02-10 21:25:55 +0100557
Johannes Berg78c1c7e2009-02-10 21:25:57 +0100558 void (*free_priv)(struct cfg80211_bss *bss);
Johannes Berg2a519312009-02-10 21:25:55 +0100559 u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
560};
561
562/**
Jouni Malinen636a5d32009-03-19 13:39:22 +0200563 * struct cfg80211_auth_request - Authentication request data
564 *
565 * This structure provides information needed to complete IEEE 802.11
566 * authentication.
567 * NOTE: This structure will likely change when more code from mac80211 is
568 * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too.
569 * Before using this in a driver that does not use mac80211, it would be better
570 * to check the status of that work and better yet, volunteer to work on it.
571 *
572 * @chan: The channel to use or %NULL if not specified (auto-select based on
573 * scan results)
574 * @peer_addr: The address of the peer STA (AP BSSID in infrastructure case);
575 * this field is required to be present; if the driver wants to help with
576 * BSS selection, it should use (yet to be added) MLME event to allow user
577 * space SME to be notified of roaming candidate, so that the SME can then
578 * use the authentication request with the recommended BSSID and whatever
579 * other data may be needed for authentication/association
580 * @ssid: SSID or %NULL if not yet available
581 * @ssid_len: Length of ssid in octets
582 * @auth_type: Authentication type (algorithm)
583 * @ie: Extra IEs to add to Authentication frame or %NULL
584 * @ie_len: Length of ie buffer in octets
585 */
586struct cfg80211_auth_request {
587 struct ieee80211_channel *chan;
588 u8 *peer_addr;
589 const u8 *ssid;
590 size_t ssid_len;
591 enum nl80211_auth_type auth_type;
592 const u8 *ie;
593 size_t ie_len;
594};
595
596/**
597 * struct cfg80211_assoc_request - (Re)Association request data
598 *
599 * This structure provides information needed to complete IEEE 802.11
600 * (re)association.
601 * NOTE: This structure will likely change when more code from mac80211 is
602 * moved into cfg80211 so that non-mac80211 drivers can benefit from it, too.
603 * Before using this in a driver that does not use mac80211, it would be better
604 * to check the status of that work and better yet, volunteer to work on it.
605 *
606 * @chan: The channel to use or %NULL if not specified (auto-select based on
607 * scan results)
608 * @peer_addr: The address of the peer STA (AP BSSID); this field is required
609 * to be present and the STA must be in State 2 (authenticated) with the
610 * peer STA
611 * @ssid: SSID
612 * @ssid_len: Length of ssid in octets
613 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL
614 * @ie_len: Length of ie buffer in octets
615 */
616struct cfg80211_assoc_request {
617 struct ieee80211_channel *chan;
618 u8 *peer_addr;
619 const u8 *ssid;
620 size_t ssid_len;
621 const u8 *ie;
622 size_t ie_len;
623};
624
625/**
626 * struct cfg80211_deauth_request - Deauthentication request data
627 *
628 * This structure provides information needed to complete IEEE 802.11
629 * deauthentication.
630 *
631 * @peer_addr: The address of the peer STA (AP BSSID); this field is required
632 * to be present and the STA must be authenticated with the peer STA
633 * @ie: Extra IEs to add to Deauthentication frame or %NULL
634 * @ie_len: Length of ie buffer in octets
635 */
636struct cfg80211_deauth_request {
637 u8 *peer_addr;
638 u16 reason_code;
639 const u8 *ie;
640 size_t ie_len;
641};
642
643/**
644 * struct cfg80211_disassoc_request - Disassociation request data
645 *
646 * This structure provides information needed to complete IEEE 802.11
647 * disassocation.
648 *
649 * @peer_addr: The address of the peer STA (AP BSSID); this field is required
650 * to be present and the STA must be associated with the peer STA
651 * @ie: Extra IEs to add to Disassociation frame or %NULL
652 * @ie_len: Length of ie buffer in octets
653 */
654struct cfg80211_disassoc_request {
655 u8 *peer_addr;
656 u16 reason_code;
657 const u8 *ie;
658 size_t ie_len;
659};
660
661/**
Johannes Berg704232c2007-04-23 12:20:05 -0700662 * struct cfg80211_ops - backend description for wireless configuration
663 *
664 * This struct is registered by fullmac card drivers and/or wireless stacks
665 * in order to handle configuration requests on their interfaces.
666 *
667 * All callbacks except where otherwise noted should return 0
668 * on success or a negative error code.
669 *
Johannes Berg43fb45cb2007-04-24 14:07:27 -0700670 * All operations are currently invoked under rtnl for consistency with the
671 * wireless extensions but this is subject to reevaluation as soon as this
672 * code is used more widely and we have a first user without wext.
673 *
Johannes Berg0378b3f2009-01-19 11:20:52 -0500674 * @suspend: wiphy device needs to be suspended
675 * @resume: wiphy device needs to be resumed
676 *
Johannes Berg60719ff2008-09-16 14:55:09 +0200677 * @add_virtual_intf: create a new virtual interface with the given name,
678 * must set the struct wireless_dev's iftype.
Johannes Berg704232c2007-04-23 12:20:05 -0700679 *
680 * @del_virtual_intf: remove the virtual interface determined by ifindex.
Johannes Berg55682962007-09-20 13:09:35 -0400681 *
Johannes Berg60719ff2008-09-16 14:55:09 +0200682 * @change_virtual_intf: change type/configuration of virtual interface,
683 * keep the struct wireless_dev's iftype updated.
Johannes Berg55682962007-09-20 13:09:35 -0400684 *
Johannes Berg41ade002007-12-19 02:03:29 +0100685 * @add_key: add a key with the given parameters. @mac_addr will be %NULL
686 * when adding a group key.
687 *
688 * @get_key: get information about the key with the given parameters.
689 * @mac_addr will be %NULL when requesting information for a group
690 * key. All pointers given to the @callback function need not be valid
691 * after it returns.
692 *
693 * @del_key: remove a key given the @mac_addr (%NULL for a group key)
694 * and @key_index
695 *
696 * @set_default_key: set the default key on an interface
Johannes Berged1b6cc2007-12-19 02:03:32 +0100697 *
Jouni Malinen3cfcf6a2009-01-08 13:32:02 +0200698 * @set_default_mgmt_key: set the default management frame key on an interface
699 *
Johannes Berged1b6cc2007-12-19 02:03:32 +0100700 * @add_beacon: Add a beacon with given parameters, @head, @interval
701 * and @dtim_period will be valid, @tail is optional.
702 * @set_beacon: Change the beacon parameters for an access point mode
703 * interface. This should reject the call when no beacon has been
704 * configured.
705 * @del_beacon: Remove beacon configuration and stop sending the beacon.
Johannes Berg5727ef12007-12-19 02:03:34 +0100706 *
707 * @add_station: Add a new station.
708 *
709 * @del_station: Remove a station; @mac may be NULL to remove all stations.
710 *
711 * @change_station: Modify a given station.
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100712 *
colin@cozybit.com93da9cc2008-10-21 12:03:48 -0700713 * @get_mesh_params: Put the current mesh parameters into *params
714 *
715 * @set_mesh_params: Set mesh parameters.
716 * The mask is a bitfield which tells us which parameters to
717 * set, and which to leave alone.
718 *
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100719 * @set_mesh_cfg: set mesh parameters (by now, just mesh id)
Jouni Malinen9f1ba902008-08-07 20:07:01 +0300720 *
721 * @change_bss: Modify parameters for a given BSS.
Jouni Malinen31888482008-10-30 16:59:24 +0200722 *
723 * @set_txq_params: Set TX queue parameters
Jouni Malinen72bdcf32008-11-26 16:15:24 +0200724 *
725 * @set_channel: Set channel
Jouni Malinen9aed3cc2009-01-13 16:03:29 +0200726 *
Johannes Berg2a519312009-02-10 21:25:55 +0100727 * @scan: Request to do a scan. If returning zero, the scan request is given
728 * the driver, and will be valid until passed to cfg80211_scan_done().
729 * For scan results, call cfg80211_inform_bss(); you can call this outside
730 * the scan/scan_done bracket too.
Jouni Malinen636a5d32009-03-19 13:39:22 +0200731 *
732 * @auth: Request to authenticate with the specified peer
733 * @assoc: Request to (re)associate with the specified peer
734 * @deauth: Request to deauthenticate from the specified peer
735 * @disassoc: Request to disassociate from the specified peer
Johannes Berg704232c2007-04-23 12:20:05 -0700736 */
737struct cfg80211_ops {
Johannes Berg0378b3f2009-01-19 11:20:52 -0500738 int (*suspend)(struct wiphy *wiphy);
739 int (*resume)(struct wiphy *wiphy);
740
Johannes Berg704232c2007-04-23 12:20:05 -0700741 int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100742 enum nl80211_iftype type, u32 *flags,
743 struct vif_params *params);
Johannes Berg704232c2007-04-23 12:20:05 -0700744 int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
Johannes Berg55682962007-09-20 13:09:35 -0400745 int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex,
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100746 enum nl80211_iftype type, u32 *flags,
747 struct vif_params *params);
Johannes Berg41ade002007-12-19 02:03:29 +0100748
749 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
750 u8 key_index, u8 *mac_addr,
751 struct key_params *params);
752 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
753 u8 key_index, u8 *mac_addr, void *cookie,
754 void (*callback)(void *cookie, struct key_params*));
755 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
756 u8 key_index, u8 *mac_addr);
757 int (*set_default_key)(struct wiphy *wiphy,
758 struct net_device *netdev,
759 u8 key_index);
Jouni Malinen3cfcf6a2009-01-08 13:32:02 +0200760 int (*set_default_mgmt_key)(struct wiphy *wiphy,
761 struct net_device *netdev,
762 u8 key_index);
Johannes Berged1b6cc2007-12-19 02:03:32 +0100763
764 int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev,
765 struct beacon_parameters *info);
766 int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev,
767 struct beacon_parameters *info);
768 int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev);
Johannes Berg5727ef12007-12-19 02:03:34 +0100769
770
771 int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
772 u8 *mac, struct station_parameters *params);
773 int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
774 u8 *mac);
775 int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
776 u8 *mac, struct station_parameters *params);
Johannes Bergfd5b74d2007-12-19 02:03:36 +0100777 int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
Luis Carlos Cobo2ec600d2008-02-23 15:17:06 +0100778 u8 *mac, struct station_info *sinfo);
779 int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
780 int idx, u8 *mac, struct station_info *sinfo);
781
782 int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
783 u8 *dst, u8 *next_hop);
784 int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
785 u8 *dst);
786 int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
787 u8 *dst, u8 *next_hop);
788 int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
789 u8 *dst, u8 *next_hop,
790 struct mpath_info *pinfo);
791 int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
792 int idx, u8 *dst, u8 *next_hop,
793 struct mpath_info *pinfo);
colin@cozybit.com93da9cc2008-10-21 12:03:48 -0700794 int (*get_mesh_params)(struct wiphy *wiphy,
795 struct net_device *dev,
796 struct mesh_config *conf);
797 int (*set_mesh_params)(struct wiphy *wiphy,
798 struct net_device *dev,
799 const struct mesh_config *nconf, u32 mask);
Jouni Malinen9f1ba902008-08-07 20:07:01 +0300800 int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
801 struct bss_parameters *params);
Jouni Malinen31888482008-10-30 16:59:24 +0200802
803 int (*set_txq_params)(struct wiphy *wiphy,
804 struct ieee80211_txq_params *params);
Jouni Malinen72bdcf32008-11-26 16:15:24 +0200805
806 int (*set_channel)(struct wiphy *wiphy,
807 struct ieee80211_channel *chan,
Sujith094d05d2008-12-12 11:57:43 +0530808 enum nl80211_channel_type channel_type);
Jouni Malinen9aed3cc2009-01-13 16:03:29 +0200809
Johannes Berg2a519312009-02-10 21:25:55 +0100810 int (*scan)(struct wiphy *wiphy, struct net_device *dev,
811 struct cfg80211_scan_request *request);
Jouni Malinen636a5d32009-03-19 13:39:22 +0200812
813 int (*auth)(struct wiphy *wiphy, struct net_device *dev,
814 struct cfg80211_auth_request *req);
815 int (*assoc)(struct wiphy *wiphy, struct net_device *dev,
816 struct cfg80211_assoc_request *req);
817 int (*deauth)(struct wiphy *wiphy, struct net_device *dev,
818 struct cfg80211_deauth_request *req);
819 int (*disassoc)(struct wiphy *wiphy, struct net_device *dev,
820 struct cfg80211_disassoc_request *req);
Johannes Berg704232c2007-04-23 12:20:05 -0700821};
822
Johannes Bergfee52672008-11-26 22:36:31 +0100823/* temporary wext handlers */
824int cfg80211_wext_giwname(struct net_device *dev,
825 struct iw_request_info *info,
826 char *name, char *extra);
Johannes Berge60c7742008-11-26 23:31:40 +0100827int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
828 u32 *mode, char *extra);
829int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
830 u32 *mode, char *extra);
Johannes Berg2a519312009-02-10 21:25:55 +0100831int cfg80211_wext_siwscan(struct net_device *dev,
832 struct iw_request_info *info,
833 union iwreq_data *wrqu, char *extra);
834int cfg80211_wext_giwscan(struct net_device *dev,
835 struct iw_request_info *info,
836 struct iw_point *data, char *extra);
Johannes Berg4aa188e2009-02-18 19:32:08 +0100837int cfg80211_wext_giwrange(struct net_device *dev,
838 struct iw_request_info *info,
839 struct iw_point *data, char *extra);
Johannes Berg2a519312009-02-10 21:25:55 +0100840
841/**
842 * cfg80211_scan_done - notify that scan finished
843 *
844 * @request: the corresponding scan request
845 * @aborted: set to true if the scan was aborted for any reason,
846 * userspace will be notified of that
847 */
848void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
849
850/**
851 * cfg80211_inform_bss - inform cfg80211 of a new BSS
852 *
853 * @wiphy: the wiphy reporting the BSS
854 * @bss: the found BSS
Johannes Berg77965c92009-02-18 18:45:06 +0100855 * @signal: the signal strength, type depends on the wiphy's signal_type
Johannes Berg2a519312009-02-10 21:25:55 +0100856 * @gfp: context flags
857 *
858 * This informs cfg80211 that BSS information was found and
859 * the BSS should be updated/added.
860 */
861struct cfg80211_bss*
862cfg80211_inform_bss_frame(struct wiphy *wiphy,
863 struct ieee80211_channel *channel,
864 struct ieee80211_mgmt *mgmt, size_t len,
Johannes Berg77965c92009-02-18 18:45:06 +0100865 s32 signal, gfp_t gfp);
Johannes Berg2a519312009-02-10 21:25:55 +0100866
867struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
868 struct ieee80211_channel *channel,
869 const u8 *bssid,
Johannes Berg79420f02009-02-10 21:25:59 +0100870 const u8 *ssid, size_t ssid_len,
871 u16 capa_mask, u16 capa_val);
872static inline struct cfg80211_bss *
873cfg80211_get_ibss(struct wiphy *wiphy,
874 struct ieee80211_channel *channel,
875 const u8 *ssid, size_t ssid_len)
876{
877 return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
878 WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
879}
880
Johannes Berg2a519312009-02-10 21:25:55 +0100881struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
882 struct ieee80211_channel *channel,
883 const u8 *meshid, size_t meshidlen,
884 const u8 *meshcfg);
885void cfg80211_put_bss(struct cfg80211_bss *bss);
Johannes Bergd491af12009-02-10 21:25:58 +0100886/**
887 * cfg80211_unlink_bss - unlink BSS from internal data structures
888 * @wiphy: the wiphy
889 * @bss: the bss to remove
890 *
891 * This function removes the given BSS from the internal data structures
892 * thereby making it no longer show up in scan results etc. Use this
893 * function when you detect a BSS is gone. Normally BSSes will also time
894 * out, so it is not necessary to use this function at all.
895 */
896void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
Johannes Bergfee52672008-11-26 22:36:31 +0100897
Jouni Malinen6039f6d2009-03-19 13:39:21 +0200898/**
899 * cfg80211_send_rx_auth - notification of processed authentication
900 * @dev: network device
901 * @buf: authentication frame (header + body)
902 * @len: length of the frame data
903 *
904 * This function is called whenever an authentication has been processed in
905 * station mode.
906 */
907void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len);
908
909/**
910 * cfg80211_send_rx_assoc - notification of processed association
911 * @dev: network device
912 * @buf: (re)association response frame (header + body)
913 * @len: length of the frame data
914 *
915 * This function is called whenever a (re)association response has been
916 * processed in station mode.
917 */
918void cfg80211_send_rx_assoc(struct net_device *dev, const u8 *buf, size_t len);
919
920/**
921 * cfg80211_send_rx_deauth - notification of processed deauthentication
922 * @dev: network device
923 * @buf: deauthentication frame (header + body)
924 * @len: length of the frame data
925 *
926 * This function is called whenever deauthentication has been processed in
927 * station mode.
928 */
929void cfg80211_send_rx_deauth(struct net_device *dev, const u8 *buf,
930 size_t len);
931
932/**
933 * cfg80211_send_rx_disassoc - notification of processed disassociation
934 * @dev: network device
935 * @buf: disassociation response frame (header + body)
936 * @len: length of the frame data
937 *
938 * This function is called whenever disassociation has been processed in
939 * station mode.
940 */
941void cfg80211_send_rx_disassoc(struct net_device *dev, const u8 *buf,
942 size_t len);
943
Kalle Valoa08c1c12009-03-22 21:57:28 +0200944/**
945 * cfg80211_hold_bss - exclude bss from expiration
946 * @bss: bss which should not expire
947 *
948 * In a case when the BSS is not updated but it shouldn't expire this
949 * function can be used to mark the BSS to be excluded from expiration.
950 */
951void cfg80211_hold_bss(struct cfg80211_bss *bss);
952
953/**
954 * cfg80211_unhold_bss - remove expiration exception from the BSS
955 * @bss: bss which can expire again
956 *
957 * This function marks the BSS to be expirable again.
958 */
959void cfg80211_unhold_bss(struct cfg80211_bss *bss);
960
Johannes Berg704232c2007-04-23 12:20:05 -0700961#endif /* __NET_CFG80211_H */