cfg80211.h 30 KB

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