cfg80211.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816
  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. */
  167. enum station_info_flags {
  168. STATION_INFO_INACTIVE_TIME = 1<<0,
  169. STATION_INFO_RX_BYTES = 1<<1,
  170. STATION_INFO_TX_BYTES = 1<<2,
  171. STATION_INFO_LLID = 1<<3,
  172. STATION_INFO_PLID = 1<<4,
  173. STATION_INFO_PLINK_STATE = 1<<5,
  174. STATION_INFO_SIGNAL = 1<<6,
  175. STATION_INFO_TX_BITRATE = 1<<7,
  176. };
  177. /**
  178. * enum station_info_rate_flags - bitrate info flags
  179. *
  180. * Used by the driver to indicate the specific rate transmission
  181. * type for 802.11n transmissions.
  182. *
  183. * @RATE_INFO_FLAGS_MCS: @tx_bitrate_mcs filled
  184. * @RATE_INFO_FLAGS_40_MHZ_WIDTH: 40 Mhz width transmission
  185. * @RATE_INFO_FLAGS_SHORT_GI: 400ns guard interval
  186. */
  187. enum rate_info_flags {
  188. RATE_INFO_FLAGS_MCS = 1<<0,
  189. RATE_INFO_FLAGS_40_MHZ_WIDTH = 1<<1,
  190. RATE_INFO_FLAGS_SHORT_GI = 1<<2,
  191. };
  192. /**
  193. * struct rate_info - bitrate information
  194. *
  195. * Information about a receiving or transmitting bitrate
  196. *
  197. * @flags: bitflag of flags from &enum rate_info_flags
  198. * @mcs: mcs index if struct describes a 802.11n bitrate
  199. * @legacy: bitrate in 100kbit/s for 802.11abg
  200. */
  201. struct rate_info {
  202. u8 flags;
  203. u8 mcs;
  204. u16 legacy;
  205. };
  206. /**
  207. * struct station_info - station information
  208. *
  209. * Station information filled by driver for get_station() and dump_station.
  210. *
  211. * @filled: bitflag of flags from &enum station_info_flags
  212. * @inactive_time: time since last station activity (tx/rx) in milliseconds
  213. * @rx_bytes: bytes received from this station
  214. * @tx_bytes: bytes transmitted to this station
  215. * @llid: mesh local link id
  216. * @plid: mesh peer link id
  217. * @plink_state: mesh peer link state
  218. * @signal: signal strength of last received packet in dBm
  219. * @txrate: current unicast bitrate to this station
  220. */
  221. struct station_info {
  222. u32 filled;
  223. u32 inactive_time;
  224. u32 rx_bytes;
  225. u32 tx_bytes;
  226. u16 llid;
  227. u16 plid;
  228. u8 plink_state;
  229. s8 signal;
  230. struct rate_info txrate;
  231. };
  232. /**
  233. * enum monitor_flags - monitor flags
  234. *
  235. * Monitor interface configuration flags. Note that these must be the bits
  236. * according to the nl80211 flags.
  237. *
  238. * @MONITOR_FLAG_FCSFAIL: pass frames with bad FCS
  239. * @MONITOR_FLAG_PLCPFAIL: pass frames with bad PLCP
  240. * @MONITOR_FLAG_CONTROL: pass control frames
  241. * @MONITOR_FLAG_OTHER_BSS: disable BSSID filtering
  242. * @MONITOR_FLAG_COOK_FRAMES: report frames after processing
  243. */
  244. enum monitor_flags {
  245. MONITOR_FLAG_FCSFAIL = 1<<NL80211_MNTR_FLAG_FCSFAIL,
  246. MONITOR_FLAG_PLCPFAIL = 1<<NL80211_MNTR_FLAG_PLCPFAIL,
  247. MONITOR_FLAG_CONTROL = 1<<NL80211_MNTR_FLAG_CONTROL,
  248. MONITOR_FLAG_OTHER_BSS = 1<<NL80211_MNTR_FLAG_OTHER_BSS,
  249. MONITOR_FLAG_COOK_FRAMES = 1<<NL80211_MNTR_FLAG_COOK_FRAMES,
  250. };
  251. /**
  252. * enum mpath_info_flags - mesh path information flags
  253. *
  254. * Used by the driver to indicate which info in &struct mpath_info it has filled
  255. * in during get_station() or dump_station().
  256. *
  257. * MPATH_INFO_FRAME_QLEN: @frame_qlen filled
  258. * MPATH_INFO_DSN: @dsn filled
  259. * MPATH_INFO_METRIC: @metric filled
  260. * MPATH_INFO_EXPTIME: @exptime filled
  261. * MPATH_INFO_DISCOVERY_TIMEOUT: @discovery_timeout filled
  262. * MPATH_INFO_DISCOVERY_RETRIES: @discovery_retries filled
  263. * MPATH_INFO_FLAGS: @flags filled
  264. */
  265. enum mpath_info_flags {
  266. MPATH_INFO_FRAME_QLEN = BIT(0),
  267. MPATH_INFO_DSN = BIT(1),
  268. MPATH_INFO_METRIC = BIT(2),
  269. MPATH_INFO_EXPTIME = BIT(3),
  270. MPATH_INFO_DISCOVERY_TIMEOUT = BIT(4),
  271. MPATH_INFO_DISCOVERY_RETRIES = BIT(5),
  272. MPATH_INFO_FLAGS = BIT(6),
  273. };
  274. /**
  275. * struct mpath_info - mesh path information
  276. *
  277. * Mesh path information filled by driver for get_mpath() and dump_mpath().
  278. *
  279. * @filled: bitfield of flags from &enum mpath_info_flags
  280. * @frame_qlen: number of queued frames for this destination
  281. * @dsn: destination sequence number
  282. * @metric: metric (cost) of this mesh path
  283. * @exptime: expiration time for the mesh path from now, in msecs
  284. * @flags: mesh path flags
  285. * @discovery_timeout: total mesh path discovery timeout, in msecs
  286. * @discovery_retries: mesh path discovery retries
  287. */
  288. struct mpath_info {
  289. u32 filled;
  290. u32 frame_qlen;
  291. u32 dsn;
  292. u32 metric;
  293. u32 exptime;
  294. u32 discovery_timeout;
  295. u8 discovery_retries;
  296. u8 flags;
  297. };
  298. /**
  299. * struct bss_parameters - BSS parameters
  300. *
  301. * Used to change BSS parameters (mainly for AP mode).
  302. *
  303. * @use_cts_prot: Whether to use CTS protection
  304. * (0 = no, 1 = yes, -1 = do not change)
  305. * @use_short_preamble: Whether the use of short preambles is allowed
  306. * (0 = no, 1 = yes, -1 = do not change)
  307. * @use_short_slot_time: Whether the use of short slot time is allowed
  308. * (0 = no, 1 = yes, -1 = do not change)
  309. * @basic_rates: basic rates in IEEE 802.11 format
  310. * (or NULL for no change)
  311. * @basic_rates_len: number of basic rates
  312. */
  313. struct bss_parameters {
  314. int use_cts_prot;
  315. int use_short_preamble;
  316. int use_short_slot_time;
  317. u8 *basic_rates;
  318. u8 basic_rates_len;
  319. };
  320. /**
  321. * enum reg_set_by - Indicates who is trying to set the regulatory domain
  322. * @REGDOM_SET_BY_INIT: regulatory domain was set by initialization. We will be
  323. * using a static world regulatory domain by default.
  324. * @REGDOM_SET_BY_CORE: Core queried CRDA for a dynamic world regulatory domain.
  325. * @REGDOM_SET_BY_USER: User asked the wireless core to set the
  326. * regulatory domain.
  327. * @REGDOM_SET_BY_DRIVER: a wireless drivers has hinted to the wireless core
  328. * it thinks its knows the regulatory domain we should be in.
  329. * @REGDOM_SET_BY_COUNTRY_IE: the wireless core has received an 802.11 country
  330. * information element with regulatory information it thinks we
  331. * should consider.
  332. */
  333. enum reg_set_by {
  334. REGDOM_SET_BY_INIT,
  335. REGDOM_SET_BY_CORE,
  336. REGDOM_SET_BY_USER,
  337. REGDOM_SET_BY_DRIVER,
  338. REGDOM_SET_BY_COUNTRY_IE,
  339. };
  340. /**
  341. * enum environment_cap - Environment parsed from country IE
  342. * @ENVIRON_ANY: indicates country IE applies to both indoor and
  343. * outdoor operation.
  344. * @ENVIRON_INDOOR: indicates country IE applies only to indoor operation
  345. * @ENVIRON_OUTDOOR: indicates country IE applies only to outdoor operation
  346. */
  347. enum environment_cap {
  348. ENVIRON_ANY,
  349. ENVIRON_INDOOR,
  350. ENVIRON_OUTDOOR,
  351. };
  352. /**
  353. * struct regulatory_request - receipt of last regulatory request
  354. *
  355. * @wiphy: this is set if this request's initiator is
  356. * %REGDOM_SET_BY_COUNTRY_IE or %REGDOM_SET_BY_DRIVER. This
  357. * can be used by the wireless core to deal with conflicts
  358. * and potentially inform users of which devices specifically
  359. * cased the conflicts.
  360. * @initiator: indicates who sent this request, could be any of
  361. * of those set in reg_set_by, %REGDOM_SET_BY_*
  362. * @alpha2: the ISO / IEC 3166 alpha2 country code of the requested
  363. * regulatory domain. We have a few special codes:
  364. * 00 - World regulatory domain
  365. * 99 - built by driver but a specific alpha2 cannot be determined
  366. * 98 - result of an intersection between two regulatory domains
  367. * @intersect: indicates whether the wireless core should intersect
  368. * the requested regulatory domain with the presently set regulatory
  369. * domain.
  370. * @country_ie_checksum: checksum of the last processed and accepted
  371. * country IE
  372. * @country_ie_env: lets us know if the AP is telling us we are outdoor,
  373. * indoor, or if it doesn't matter
  374. */
  375. struct regulatory_request {
  376. struct wiphy *wiphy;
  377. enum reg_set_by initiator;
  378. char alpha2[2];
  379. bool intersect;
  380. u32 country_ie_checksum;
  381. enum environment_cap country_ie_env;
  382. };
  383. struct ieee80211_freq_range {
  384. u32 start_freq_khz;
  385. u32 end_freq_khz;
  386. u32 max_bandwidth_khz;
  387. };
  388. struct ieee80211_power_rule {
  389. u32 max_antenna_gain;
  390. u32 max_eirp;
  391. };
  392. struct ieee80211_reg_rule {
  393. struct ieee80211_freq_range freq_range;
  394. struct ieee80211_power_rule power_rule;
  395. u32 flags;
  396. };
  397. struct ieee80211_regdomain {
  398. u32 n_reg_rules;
  399. char alpha2[2];
  400. struct ieee80211_reg_rule reg_rules[];
  401. };
  402. #define MHZ_TO_KHZ(freq) ((freq) * 1000)
  403. #define KHZ_TO_MHZ(freq) ((freq) / 1000)
  404. #define DBI_TO_MBI(gain) ((gain) * 100)
  405. #define MBI_TO_DBI(gain) ((gain) / 100)
  406. #define DBM_TO_MBM(gain) ((gain) * 100)
  407. #define MBM_TO_DBM(gain) ((gain) / 100)
  408. #define REG_RULE(start, end, bw, gain, eirp, reg_flags) { \
  409. .freq_range.start_freq_khz = MHZ_TO_KHZ(start), \
  410. .freq_range.end_freq_khz = MHZ_TO_KHZ(end), \
  411. .freq_range.max_bandwidth_khz = MHZ_TO_KHZ(bw), \
  412. .power_rule.max_antenna_gain = DBI_TO_MBI(gain), \
  413. .power_rule.max_eirp = DBM_TO_MBM(eirp), \
  414. .flags = reg_flags, \
  415. }
  416. struct mesh_config {
  417. /* Timeouts in ms */
  418. /* Mesh plink management parameters */
  419. u16 dot11MeshRetryTimeout;
  420. u16 dot11MeshConfirmTimeout;
  421. u16 dot11MeshHoldingTimeout;
  422. u16 dot11MeshMaxPeerLinks;
  423. u8 dot11MeshMaxRetries;
  424. u8 dot11MeshTTL;
  425. bool auto_open_plinks;
  426. /* HWMP parameters */
  427. u8 dot11MeshHWMPmaxPREQretries;
  428. u32 path_refresh_time;
  429. u16 min_discovery_timeout;
  430. u32 dot11MeshHWMPactivePathTimeout;
  431. u16 dot11MeshHWMPpreqMinInterval;
  432. u16 dot11MeshHWMPnetDiameterTraversalTime;
  433. };
  434. /**
  435. * struct ieee80211_txq_params - TX queue parameters
  436. * @queue: TX queue identifier (NL80211_TXQ_Q_*)
  437. * @txop: Maximum burst time in units of 32 usecs, 0 meaning disabled
  438. * @cwmin: Minimum contention window [a value of the form 2^n-1 in the range
  439. * 1..32767]
  440. * @cwmax: Maximum contention window [a value of the form 2^n-1 in the range
  441. * 1..32767]
  442. * @aifs: Arbitration interframe space [0..255]
  443. */
  444. struct ieee80211_txq_params {
  445. enum nl80211_txq_q queue;
  446. u16 txop;
  447. u16 cwmin;
  448. u16 cwmax;
  449. u8 aifs;
  450. };
  451. /**
  452. * struct mgmt_extra_ie_params - Extra management frame IE parameters
  453. *
  454. * Used to add extra IE(s) into management frames. If the driver cannot add the
  455. * requested data into all management frames of the specified subtype that are
  456. * generated in kernel or firmware/hardware, it must reject the configuration
  457. * call. The IE data buffer is added to the end of the specified management
  458. * frame body after all other IEs. This addition is not applied to frames that
  459. * are injected through a monitor interface.
  460. *
  461. * @subtype: Management frame subtype
  462. * @ies: IE data buffer or %NULL to remove previous data
  463. * @ies_len: Length of @ies in octets
  464. */
  465. struct mgmt_extra_ie_params {
  466. u8 subtype;
  467. u8 *ies;
  468. int ies_len;
  469. };
  470. /* from net/wireless.h */
  471. struct wiphy;
  472. /* from net/ieee80211.h */
  473. struct ieee80211_channel;
  474. /**
  475. * struct cfg80211_ssid - SSID description
  476. * @ssid: the SSID
  477. * @ssid_len: length of the ssid
  478. */
  479. struct cfg80211_ssid {
  480. u8 ssid[IEEE80211_MAX_SSID_LEN];
  481. u8 ssid_len;
  482. };
  483. /**
  484. * struct cfg80211_scan_request - scan request description
  485. *
  486. * @ssids: SSIDs to scan for (active scan only)
  487. * @n_ssids: number of SSIDs
  488. * @channels: channels to scan on.
  489. * @n_channels: number of channels for each band
  490. * @wiphy: the wiphy this was for
  491. * @ifidx: the interface index
  492. */
  493. struct cfg80211_scan_request {
  494. struct cfg80211_ssid *ssids;
  495. int n_ssids;
  496. struct ieee80211_channel **channels;
  497. u32 n_channels;
  498. /* internal */
  499. struct wiphy *wiphy;
  500. int ifidx;
  501. };
  502. /**
  503. * enum cfg80211_signal_type - signal type
  504. *
  505. * @CFG80211_SIGNAL_TYPE_NONE: no signal strength information available
  506. * @CFG80211_SIGNAL_TYPE_MBM: signal strength in mBm (100*dBm)
  507. * @CFG80211_SIGNAL_TYPE_UNSPEC: signal strength, increasing from 0 through 100
  508. */
  509. enum cfg80211_signal_type {
  510. CFG80211_SIGNAL_TYPE_NONE,
  511. CFG80211_SIGNAL_TYPE_MBM,
  512. CFG80211_SIGNAL_TYPE_UNSPEC,
  513. };
  514. /**
  515. * struct cfg80211_bss - BSS description
  516. *
  517. * This structure describes a BSS (which may also be a mesh network)
  518. * for use in scan results and similar.
  519. *
  520. * @bssid: BSSID of the BSS
  521. * @tsf: timestamp of last received update
  522. * @beacon_interval: the beacon interval as from the frame
  523. * @capability: the capability field in host byte order
  524. * @information_elements: the information elements (Note that there
  525. * is no guarantee that these are well-formed!)
  526. * @len_information_elements: total length of the information elements
  527. * @signal: signal strength value
  528. * @signal_type: signal type
  529. * @free_priv: function pointer to free private data
  530. * @priv: private area for driver use, has at least wiphy->bss_priv_size bytes
  531. */
  532. struct cfg80211_bss {
  533. struct ieee80211_channel *channel;
  534. u8 bssid[ETH_ALEN];
  535. u64 tsf;
  536. u16 beacon_interval;
  537. u16 capability;
  538. u8 *information_elements;
  539. size_t len_information_elements;
  540. s32 signal;
  541. enum cfg80211_signal_type signal_type;
  542. void (*free_priv)(struct cfg80211_bss *bss);
  543. u8 priv[0] __attribute__((__aligned__(sizeof(void *))));
  544. };
  545. /**
  546. * struct cfg80211_ops - backend description for wireless configuration
  547. *
  548. * This struct is registered by fullmac card drivers and/or wireless stacks
  549. * in order to handle configuration requests on their interfaces.
  550. *
  551. * All callbacks except where otherwise noted should return 0
  552. * on success or a negative error code.
  553. *
  554. * All operations are currently invoked under rtnl for consistency with the
  555. * wireless extensions but this is subject to reevaluation as soon as this
  556. * code is used more widely and we have a first user without wext.
  557. *
  558. * @suspend: wiphy device needs to be suspended
  559. * @resume: wiphy device needs to be resumed
  560. *
  561. * @add_virtual_intf: create a new virtual interface with the given name,
  562. * must set the struct wireless_dev's iftype.
  563. *
  564. * @del_virtual_intf: remove the virtual interface determined by ifindex.
  565. *
  566. * @change_virtual_intf: change type/configuration of virtual interface,
  567. * keep the struct wireless_dev's iftype updated.
  568. *
  569. * @add_key: add a key with the given parameters. @mac_addr will be %NULL
  570. * when adding a group key.
  571. *
  572. * @get_key: get information about the key with the given parameters.
  573. * @mac_addr will be %NULL when requesting information for a group
  574. * key. All pointers given to the @callback function need not be valid
  575. * after it returns.
  576. *
  577. * @del_key: remove a key given the @mac_addr (%NULL for a group key)
  578. * and @key_index
  579. *
  580. * @set_default_key: set the default key on an interface
  581. *
  582. * @set_default_mgmt_key: set the default management frame key on an interface
  583. *
  584. * @add_beacon: Add a beacon with given parameters, @head, @interval
  585. * and @dtim_period will be valid, @tail is optional.
  586. * @set_beacon: Change the beacon parameters for an access point mode
  587. * interface. This should reject the call when no beacon has been
  588. * configured.
  589. * @del_beacon: Remove beacon configuration and stop sending the beacon.
  590. *
  591. * @add_station: Add a new station.
  592. *
  593. * @del_station: Remove a station; @mac may be NULL to remove all stations.
  594. *
  595. * @change_station: Modify a given station.
  596. *
  597. * @get_mesh_params: Put the current mesh parameters into *params
  598. *
  599. * @set_mesh_params: Set mesh parameters.
  600. * The mask is a bitfield which tells us which parameters to
  601. * set, and which to leave alone.
  602. *
  603. * @set_mesh_cfg: set mesh parameters (by now, just mesh id)
  604. *
  605. * @change_bss: Modify parameters for a given BSS.
  606. *
  607. * @set_txq_params: Set TX queue parameters
  608. *
  609. * @set_channel: Set channel
  610. *
  611. * @set_mgmt_extra_ie: Set extra IE data for management frames
  612. *
  613. * @scan: Request to do a scan. If returning zero, the scan request is given
  614. * the driver, and will be valid until passed to cfg80211_scan_done().
  615. * For scan results, call cfg80211_inform_bss(); you can call this outside
  616. * the scan/scan_done bracket too.
  617. */
  618. struct cfg80211_ops {
  619. int (*suspend)(struct wiphy *wiphy);
  620. int (*resume)(struct wiphy *wiphy);
  621. int (*add_virtual_intf)(struct wiphy *wiphy, char *name,
  622. enum nl80211_iftype type, u32 *flags,
  623. struct vif_params *params);
  624. int (*del_virtual_intf)(struct wiphy *wiphy, int ifindex);
  625. int (*change_virtual_intf)(struct wiphy *wiphy, int ifindex,
  626. enum nl80211_iftype type, u32 *flags,
  627. struct vif_params *params);
  628. int (*add_key)(struct wiphy *wiphy, struct net_device *netdev,
  629. u8 key_index, u8 *mac_addr,
  630. struct key_params *params);
  631. int (*get_key)(struct wiphy *wiphy, struct net_device *netdev,
  632. u8 key_index, u8 *mac_addr, void *cookie,
  633. void (*callback)(void *cookie, struct key_params*));
  634. int (*del_key)(struct wiphy *wiphy, struct net_device *netdev,
  635. u8 key_index, u8 *mac_addr);
  636. int (*set_default_key)(struct wiphy *wiphy,
  637. struct net_device *netdev,
  638. u8 key_index);
  639. int (*set_default_mgmt_key)(struct wiphy *wiphy,
  640. struct net_device *netdev,
  641. u8 key_index);
  642. int (*add_beacon)(struct wiphy *wiphy, struct net_device *dev,
  643. struct beacon_parameters *info);
  644. int (*set_beacon)(struct wiphy *wiphy, struct net_device *dev,
  645. struct beacon_parameters *info);
  646. int (*del_beacon)(struct wiphy *wiphy, struct net_device *dev);
  647. int (*add_station)(struct wiphy *wiphy, struct net_device *dev,
  648. u8 *mac, struct station_parameters *params);
  649. int (*del_station)(struct wiphy *wiphy, struct net_device *dev,
  650. u8 *mac);
  651. int (*change_station)(struct wiphy *wiphy, struct net_device *dev,
  652. u8 *mac, struct station_parameters *params);
  653. int (*get_station)(struct wiphy *wiphy, struct net_device *dev,
  654. u8 *mac, struct station_info *sinfo);
  655. int (*dump_station)(struct wiphy *wiphy, struct net_device *dev,
  656. int idx, u8 *mac, struct station_info *sinfo);
  657. int (*add_mpath)(struct wiphy *wiphy, struct net_device *dev,
  658. u8 *dst, u8 *next_hop);
  659. int (*del_mpath)(struct wiphy *wiphy, struct net_device *dev,
  660. u8 *dst);
  661. int (*change_mpath)(struct wiphy *wiphy, struct net_device *dev,
  662. u8 *dst, u8 *next_hop);
  663. int (*get_mpath)(struct wiphy *wiphy, struct net_device *dev,
  664. u8 *dst, u8 *next_hop,
  665. struct mpath_info *pinfo);
  666. int (*dump_mpath)(struct wiphy *wiphy, struct net_device *dev,
  667. int idx, u8 *dst, u8 *next_hop,
  668. struct mpath_info *pinfo);
  669. int (*get_mesh_params)(struct wiphy *wiphy,
  670. struct net_device *dev,
  671. struct mesh_config *conf);
  672. int (*set_mesh_params)(struct wiphy *wiphy,
  673. struct net_device *dev,
  674. const struct mesh_config *nconf, u32 mask);
  675. int (*change_bss)(struct wiphy *wiphy, struct net_device *dev,
  676. struct bss_parameters *params);
  677. int (*set_txq_params)(struct wiphy *wiphy,
  678. struct ieee80211_txq_params *params);
  679. int (*set_channel)(struct wiphy *wiphy,
  680. struct ieee80211_channel *chan,
  681. enum nl80211_channel_type channel_type);
  682. int (*set_mgmt_extra_ie)(struct wiphy *wiphy,
  683. struct net_device *dev,
  684. struct mgmt_extra_ie_params *params);
  685. int (*scan)(struct wiphy *wiphy, struct net_device *dev,
  686. struct cfg80211_scan_request *request);
  687. };
  688. /* temporary wext handlers */
  689. int cfg80211_wext_giwname(struct net_device *dev,
  690. struct iw_request_info *info,
  691. char *name, char *extra);
  692. int cfg80211_wext_siwmode(struct net_device *dev, struct iw_request_info *info,
  693. u32 *mode, char *extra);
  694. int cfg80211_wext_giwmode(struct net_device *dev, struct iw_request_info *info,
  695. u32 *mode, char *extra);
  696. int cfg80211_wext_siwscan(struct net_device *dev,
  697. struct iw_request_info *info,
  698. union iwreq_data *wrqu, char *extra);
  699. int cfg80211_wext_giwscan(struct net_device *dev,
  700. struct iw_request_info *info,
  701. struct iw_point *data, char *extra);
  702. /**
  703. * cfg80211_scan_done - notify that scan finished
  704. *
  705. * @request: the corresponding scan request
  706. * @aborted: set to true if the scan was aborted for any reason,
  707. * userspace will be notified of that
  708. */
  709. void cfg80211_scan_done(struct cfg80211_scan_request *request, bool aborted);
  710. /**
  711. * cfg80211_inform_bss - inform cfg80211 of a new BSS
  712. *
  713. * @wiphy: the wiphy reporting the BSS
  714. * @bss: the found BSS
  715. * @gfp: context flags
  716. *
  717. * This informs cfg80211 that BSS information was found and
  718. * the BSS should be updated/added.
  719. */
  720. struct cfg80211_bss*
  721. cfg80211_inform_bss_frame(struct wiphy *wiphy,
  722. struct ieee80211_channel *channel,
  723. struct ieee80211_mgmt *mgmt, size_t len,
  724. s32 signal, enum cfg80211_signal_type sigtype,
  725. gfp_t gfp);
  726. struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
  727. struct ieee80211_channel *channel,
  728. const u8 *bssid,
  729. const u8 *ssid, size_t ssid_len,
  730. u16 capa_mask, u16 capa_val);
  731. static inline struct cfg80211_bss *
  732. cfg80211_get_ibss(struct wiphy *wiphy,
  733. struct ieee80211_channel *channel,
  734. const u8 *ssid, size_t ssid_len)
  735. {
  736. return cfg80211_get_bss(wiphy, channel, NULL, ssid, ssid_len,
  737. WLAN_CAPABILITY_IBSS, WLAN_CAPABILITY_IBSS);
  738. }
  739. struct cfg80211_bss *cfg80211_get_mesh(struct wiphy *wiphy,
  740. struct ieee80211_channel *channel,
  741. const u8 *meshid, size_t meshidlen,
  742. const u8 *meshcfg);
  743. void cfg80211_put_bss(struct cfg80211_bss *bss);
  744. /**
  745. * cfg80211_unlink_bss - unlink BSS from internal data structures
  746. * @wiphy: the wiphy
  747. * @bss: the bss to remove
  748. *
  749. * This function removes the given BSS from the internal data structures
  750. * thereby making it no longer show up in scan results etc. Use this
  751. * function when you detect a BSS is gone. Normally BSSes will also time
  752. * out, so it is not necessary to use this function at all.
  753. */
  754. void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *bss);
  755. #endif /* __NET_CFG80211_H */