cfg80211.h 31 KB

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