driver.h 100 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229
  1. /*
  2. * Driver interface definition
  3. * Copyright (c) 2003-2010, Jouni Malinen <j@w1.fi>
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License version 2 as
  7. * published by the Free Software Foundation.
  8. *
  9. * Alternatively, this software may be distributed under the terms of BSD
  10. * license.
  11. *
  12. * See README and COPYING for more details.
  13. *
  14. * This file defines a driver interface used by both %wpa_supplicant and
  15. * hostapd. The first part of the file defines data structures used in various
  16. * driver operations. This is followed by the struct wpa_driver_ops that each
  17. * driver wrapper will beed to define with callback functions for requesting
  18. * driver operations. After this, there are definitions for driver event
  19. * reporting with wpa_supplicant_event() and some convenience helper functions
  20. * that can be used to report events.
  21. */
  22. #ifndef DRIVER_H
  23. #define DRIVER_H
  24. #define WPA_SUPPLICANT_DRIVER_VERSION 4
  25. #include "common/defs.h"
  26. #define HOSTAPD_CHAN_DISABLED 0x00000001
  27. #define HOSTAPD_CHAN_PASSIVE_SCAN 0x00000002
  28. #define HOSTAPD_CHAN_NO_IBSS 0x00000004
  29. #define HOSTAPD_CHAN_RADAR 0x00000008
  30. #define HOSTAPD_CHAN_HT40PLUS 0x00000010
  31. #define HOSTAPD_CHAN_HT40MINUS 0x00000020
  32. #define HOSTAPD_CHAN_HT40 0x00000040
  33. /**
  34. * struct hostapd_channel_data - Channel information
  35. */
  36. struct hostapd_channel_data {
  37. /**
  38. * chan - Channel number (IEEE 802.11)
  39. */
  40. short chan;
  41. /**
  42. * freq - Frequency in MHz
  43. */
  44. short freq;
  45. /**
  46. * flag - Channel flags (HOSTAPD_CHAN_*)
  47. */
  48. int flag;
  49. /**
  50. * max_tx_power - maximum transmit power in dBm
  51. */
  52. u8 max_tx_power;
  53. };
  54. /**
  55. * struct hostapd_hw_modes - Supported hardware mode information
  56. */
  57. struct hostapd_hw_modes {
  58. /**
  59. * mode - Hardware mode
  60. */
  61. enum hostapd_hw_mode mode;
  62. /**
  63. * num_channels - Number of entries in the channels array
  64. */
  65. int num_channels;
  66. /**
  67. * channels - Array of supported channels
  68. */
  69. struct hostapd_channel_data *channels;
  70. /**
  71. * num_rates - Number of entries in the rates array
  72. */
  73. int num_rates;
  74. /**
  75. * rates - Array of supported rates in 100 kbps units
  76. */
  77. int *rates;
  78. /**
  79. * ht_capab - HT (IEEE 802.11n) capabilities
  80. */
  81. u16 ht_capab;
  82. /**
  83. * mcs_set - MCS (IEEE 802.11n) rate parameters
  84. */
  85. u8 mcs_set[16];
  86. /**
  87. * a_mpdu_params - A-MPDU (IEEE 802.11n) parameters
  88. */
  89. u8 a_mpdu_params;
  90. };
  91. #define IEEE80211_MODE_INFRA 0
  92. #define IEEE80211_MODE_IBSS 1
  93. #define IEEE80211_MODE_AP 2
  94. #define IEEE80211_CAP_ESS 0x0001
  95. #define IEEE80211_CAP_IBSS 0x0002
  96. #define IEEE80211_CAP_PRIVACY 0x0010
  97. #define WPA_SCAN_QUAL_INVALID BIT(0)
  98. #define WPA_SCAN_NOISE_INVALID BIT(1)
  99. #define WPA_SCAN_LEVEL_INVALID BIT(2)
  100. #define WPA_SCAN_LEVEL_DBM BIT(3)
  101. #define WPA_SCAN_AUTHENTICATED BIT(4)
  102. #define WPA_SCAN_ASSOCIATED BIT(5)
  103. /**
  104. * struct wpa_scan_res - Scan result for an BSS/IBSS
  105. * @flags: information flags about the BSS/IBSS (WPA_SCAN_*)
  106. * @bssid: BSSID
  107. * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
  108. * @beacon_int: beacon interval in TUs (host byte order)
  109. * @caps: capability information field in host byte order
  110. * @qual: signal quality
  111. * @noise: noise level
  112. * @level: signal level
  113. * @tsf: Timestamp
  114. * @age: Age of the information in milliseconds (i.e., how many milliseconds
  115. * ago the last Beacon or Probe Response frame was received)
  116. * @ie_len: length of the following IE field in octets
  117. * @beacon_ie_len: length of the following Beacon IE field in octets
  118. *
  119. * This structure is used as a generic format for scan results from the
  120. * driver. Each driver interface implementation is responsible for converting
  121. * the driver or OS specific scan results into this format.
  122. *
  123. * If the driver does not support reporting all IEs, the IE data structure is
  124. * constructed of the IEs that are available. This field will also need to
  125. * include SSID in IE format. All drivers are encouraged to be extended to
  126. * report all IEs to make it easier to support future additions.
  127. */
  128. struct wpa_scan_res {
  129. unsigned int flags;
  130. u8 bssid[ETH_ALEN];
  131. int freq;
  132. u16 beacon_int;
  133. u16 caps;
  134. int qual;
  135. int noise;
  136. int level;
  137. u64 tsf;
  138. unsigned int age;
  139. size_t ie_len;
  140. size_t beacon_ie_len;
  141. /*
  142. * Followed by ie_len octets of IEs from Probe Response frame (or if
  143. * the driver does not indicate source of IEs, these may also be from
  144. * Beacon frame). After the first set of IEs, another set of IEs may
  145. * follow (with beacon_ie_len octets of data) if the driver provides
  146. * both IE sets.
  147. */
  148. };
  149. /**
  150. * struct wpa_scan_results - Scan results
  151. * @res: Array of pointers to allocated variable length scan result entries
  152. * @num: Number of entries in the scan result array
  153. */
  154. struct wpa_scan_results {
  155. struct wpa_scan_res **res;
  156. size_t num;
  157. };
  158. /**
  159. * struct wpa_interface_info - Network interface information
  160. * @next: Pointer to the next interface or NULL if this is the last one
  161. * @ifname: Interface name that can be used with init() or init2()
  162. * @desc: Human readable adapter description (e.g., vendor/model) or NULL if
  163. * not available
  164. * @drv_name: struct wpa_driver_ops::name (note: unlike other strings, this one
  165. * is not an allocated copy, i.e., get_interfaces() caller will not free
  166. * this)
  167. */
  168. struct wpa_interface_info {
  169. struct wpa_interface_info *next;
  170. char *ifname;
  171. char *desc;
  172. const char *drv_name;
  173. };
  174. #define WPAS_MAX_SCAN_SSIDS 4
  175. /**
  176. * struct wpa_driver_scan_params - Scan parameters
  177. * Data for struct wpa_driver_ops::scan2().
  178. */
  179. struct wpa_driver_scan_params {
  180. /**
  181. * ssids - SSIDs to scan for
  182. */
  183. struct wpa_driver_scan_ssid {
  184. /**
  185. * ssid - specific SSID to scan for (ProbeReq)
  186. * %NULL or zero-length SSID is used to indicate active scan
  187. * with wildcard SSID.
  188. */
  189. const u8 *ssid;
  190. /**
  191. * ssid_len: Length of the SSID in octets
  192. */
  193. size_t ssid_len;
  194. } ssids[WPAS_MAX_SCAN_SSIDS];
  195. /**
  196. * num_ssids - Number of entries in ssids array
  197. * Zero indicates a request for a passive scan.
  198. */
  199. size_t num_ssids;
  200. /**
  201. * extra_ies - Extra IE(s) to add into Probe Request or %NULL
  202. */
  203. const u8 *extra_ies;
  204. /**
  205. * extra_ies_len - Length of extra_ies in octets
  206. */
  207. size_t extra_ies_len;
  208. /**
  209. * freqs - Array of frequencies to scan or %NULL for all frequencies
  210. *
  211. * The frequency is set in MHz. The array is zero-terminated.
  212. */
  213. int *freqs;
  214. /**
  215. * filter_ssids - Filter for reporting SSIDs
  216. *
  217. * This optional parameter can be used to request the driver wrapper to
  218. * filter scan results to include only the specified SSIDs. %NULL
  219. * indicates that no filtering is to be done. This can be used to
  220. * reduce memory needs for scan results in environments that have large
  221. * number of APs with different SSIDs.
  222. *
  223. * The driver wrapper is allowed to take this allocated buffer into its
  224. * own use by setting the pointer to %NULL. In that case, the driver
  225. * wrapper is responsible for freeing the buffer with os_free() once it
  226. * is not needed anymore.
  227. */
  228. struct wpa_driver_scan_filter {
  229. u8 ssid[32];
  230. size_t ssid_len;
  231. } *filter_ssids;
  232. /**
  233. * num_filter_ssids - Number of entries in filter_ssids array
  234. */
  235. size_t num_filter_ssids;
  236. };
  237. /**
  238. * struct wpa_driver_auth_params - Authentication parameters
  239. * Data for struct wpa_driver_ops::authenticate().
  240. */
  241. struct wpa_driver_auth_params {
  242. int freq;
  243. const u8 *bssid;
  244. const u8 *ssid;
  245. size_t ssid_len;
  246. int auth_alg;
  247. const u8 *ie;
  248. size_t ie_len;
  249. const u8 *wep_key[4];
  250. size_t wep_key_len[4];
  251. int wep_tx_keyidx;
  252. int local_state_change;
  253. };
  254. enum wps_mode {
  255. WPS_MODE_NONE /* no WPS provisioning being used */,
  256. WPS_MODE_OPEN /* WPS provisioning with AP that is in open mode */,
  257. WPS_MODE_PRIVACY /* WPS provisioning with AP that is using protection
  258. */
  259. };
  260. /**
  261. * struct wpa_driver_associate_params - Association parameters
  262. * Data for struct wpa_driver_ops::associate().
  263. */
  264. struct wpa_driver_associate_params {
  265. /**
  266. * bssid - BSSID of the selected AP
  267. * This can be %NULL, if ap_scan=2 mode is used and the driver is
  268. * responsible for selecting with which BSS to associate. */
  269. const u8 *bssid;
  270. /**
  271. * ssid - The selected SSID
  272. */
  273. const u8 *ssid;
  274. /**
  275. * ssid_len - Length of the SSID (1..32)
  276. */
  277. size_t ssid_len;
  278. /**
  279. * freq - Frequency of the channel the selected AP is using
  280. * Frequency that the selected AP is using (in MHz as
  281. * reported in the scan results)
  282. */
  283. int freq;
  284. /**
  285. * wpa_ie - WPA information element for (Re)Association Request
  286. * WPA information element to be included in (Re)Association
  287. * Request (including information element id and length). Use
  288. * of this WPA IE is optional. If the driver generates the WPA
  289. * IE, it can use pairwise_suite, group_suite, and
  290. * key_mgmt_suite to select proper algorithms. In this case,
  291. * the driver has to notify wpa_supplicant about the used WPA
  292. * IE by generating an event that the interface code will
  293. * convert into EVENT_ASSOCINFO data (see below).
  294. *
  295. * When using WPA2/IEEE 802.11i, wpa_ie is used for RSN IE
  296. * instead. The driver can determine which version is used by
  297. * looking at the first byte of the IE (0xdd for WPA, 0x30 for
  298. * WPA2/RSN).
  299. *
  300. * When using WPS, wpa_ie is used for WPS IE instead of WPA/RSN IE.
  301. */
  302. const u8 *wpa_ie;
  303. /**
  304. * wpa_ie_len - length of the wpa_ie
  305. */
  306. size_t wpa_ie_len;
  307. /**
  308. * pairwise_suite - Selected pairwise cipher suite
  309. *
  310. * This is usually ignored if @wpa_ie is used.
  311. */
  312. enum wpa_cipher pairwise_suite;
  313. /**
  314. * group_suite - Selected group cipher suite
  315. *
  316. * This is usually ignored if @wpa_ie is used.
  317. */
  318. enum wpa_cipher group_suite;
  319. /**
  320. * key_mgmt_suite - Selected key management suite
  321. *
  322. * This is usually ignored if @wpa_ie is used.
  323. */
  324. enum wpa_key_mgmt key_mgmt_suite;
  325. /**
  326. * auth_alg - Allowed authentication algorithms
  327. * Bit field of WPA_AUTH_ALG_*
  328. */
  329. int auth_alg;
  330. /**
  331. * mode - Operation mode (infra/ibss) IEEE80211_MODE_*
  332. */
  333. int mode;
  334. /**
  335. * wep_key - WEP keys for static WEP configuration
  336. */
  337. const u8 *wep_key[4];
  338. /**
  339. * wep_key_len - WEP key length for static WEP configuration
  340. */
  341. size_t wep_key_len[4];
  342. /**
  343. * wep_tx_keyidx - WEP TX key index for static WEP configuration
  344. */
  345. int wep_tx_keyidx;
  346. /**
  347. * mgmt_frame_protection - IEEE 802.11w management frame protection
  348. */
  349. enum mfp_options mgmt_frame_protection;
  350. /**
  351. * ft_ies - IEEE 802.11r / FT information elements
  352. * If the supplicant is using IEEE 802.11r (FT) and has the needed keys
  353. * for fast transition, this parameter is set to include the IEs that
  354. * are to be sent in the next FT Authentication Request message.
  355. * update_ft_ies() handler is called to update the IEs for further
  356. * FT messages in the sequence.
  357. *
  358. * The driver should use these IEs only if the target AP is advertising
  359. * the same mobility domain as the one included in the MDIE here.
  360. *
  361. * In ap_scan=2 mode, the driver can use these IEs when moving to a new
  362. * AP after the initial association. These IEs can only be used if the
  363. * target AP is advertising support for FT and is using the same MDIE
  364. * and SSID as the current AP.
  365. *
  366. * The driver is responsible for reporting the FT IEs received from the
  367. * AP's response using wpa_supplicant_event() with EVENT_FT_RESPONSE
  368. * type. update_ft_ies() handler will then be called with the FT IEs to
  369. * include in the next frame in the authentication sequence.
  370. */
  371. const u8 *ft_ies;
  372. /**
  373. * ft_ies_len - Length of ft_ies in bytes
  374. */
  375. size_t ft_ies_len;
  376. /**
  377. * ft_md - FT Mobility domain (6 octets) (also included inside ft_ies)
  378. *
  379. * This value is provided to allow the driver interface easier access
  380. * to the current mobility domain. This value is set to %NULL if no
  381. * mobility domain is currently active.
  382. */
  383. const u8 *ft_md;
  384. /**
  385. * passphrase - RSN passphrase for PSK
  386. *
  387. * This value is made available only for WPA/WPA2-Personal (PSK) and
  388. * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
  389. * the 8..63 character ASCII passphrase, if available. Please note that
  390. * this can be %NULL if passphrase was not used to generate the PSK. In
  391. * that case, the psk field must be used to fetch the PSK.
  392. */
  393. const char *passphrase;
  394. /**
  395. * psk - RSN PSK (alternative for passphrase for PSK)
  396. *
  397. * This value is made available only for WPA/WPA2-Personal (PSK) and
  398. * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
  399. * the 32-octet (256-bit) PSK, if available. The driver wrapper should
  400. * be prepared to handle %NULL value as an error.
  401. */
  402. const u8 *psk;
  403. /**
  404. * drop_unencrypted - Enable/disable unencrypted frame filtering
  405. *
  406. * Configure the driver to drop all non-EAPOL frames (both receive and
  407. * transmit paths). Unencrypted EAPOL frames (ethertype 0x888e) must
  408. * still be allowed for key negotiation.
  409. */
  410. int drop_unencrypted;
  411. /**
  412. * prev_bssid - Previously used BSSID in this ESS
  413. *
  414. * When not %NULL, this is a request to use reassociation instead of
  415. * association.
  416. */
  417. const u8 *prev_bssid;
  418. /**
  419. * wps - WPS mode
  420. *
  421. * If the driver needs to do special configuration for WPS association,
  422. * this variable provides more information on what type of association
  423. * is being requested. Most drivers should not need ot use this.
  424. */
  425. enum wps_mode wps;
  426. /**
  427. * p2p - Whether this connection is a P2P group
  428. */
  429. int p2p;
  430. /**
  431. * uapsd - UAPSD parameters for the network
  432. * -1 = do not change defaults
  433. * AP mode: 1 = enabled, 0 = disabled
  434. * STA mode: bits 0..3 UAPSD enabled for VO,VI,BK,BE
  435. */
  436. int uapsd;
  437. };
  438. /**
  439. * struct wpa_driver_capa - Driver capability information
  440. */
  441. struct wpa_driver_capa {
  442. #define WPA_DRIVER_CAPA_KEY_MGMT_WPA 0x00000001
  443. #define WPA_DRIVER_CAPA_KEY_MGMT_WPA2 0x00000002
  444. #define WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK 0x00000004
  445. #define WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK 0x00000008
  446. #define WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE 0x00000010
  447. #define WPA_DRIVER_CAPA_KEY_MGMT_FT 0x00000020
  448. #define WPA_DRIVER_CAPA_KEY_MGMT_FT_PSK 0x00000040
  449. unsigned int key_mgmt;
  450. #define WPA_DRIVER_CAPA_ENC_WEP40 0x00000001
  451. #define WPA_DRIVER_CAPA_ENC_WEP104 0x00000002
  452. #define WPA_DRIVER_CAPA_ENC_TKIP 0x00000004
  453. #define WPA_DRIVER_CAPA_ENC_CCMP 0x00000008
  454. unsigned int enc;
  455. #define WPA_DRIVER_AUTH_OPEN 0x00000001
  456. #define WPA_DRIVER_AUTH_SHARED 0x00000002
  457. #define WPA_DRIVER_AUTH_LEAP 0x00000004
  458. unsigned int auth;
  459. /* Driver generated WPA/RSN IE */
  460. #define WPA_DRIVER_FLAGS_DRIVER_IE 0x00000001
  461. /* Driver needs static WEP key setup after association command */
  462. #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002
  463. #define WPA_DRIVER_FLAGS_USER_SPACE_MLME 0x00000004
  464. /* Driver takes care of RSN 4-way handshake internally; PMK is configured with
  465. * struct wpa_driver_ops::set_key using alg = WPA_ALG_PMK */
  466. #define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE 0x00000008
  467. #define WPA_DRIVER_FLAGS_WIRED 0x00000010
  468. /* Driver provides separate commands for authentication and association (SME in
  469. * wpa_supplicant). */
  470. #define WPA_DRIVER_FLAGS_SME 0x00000020
  471. /* Driver supports AP mode */
  472. #define WPA_DRIVER_FLAGS_AP 0x00000040
  473. /* Driver needs static WEP key setup after association has been completed */
  474. #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE 0x00000080
  475. /* Driver takes care of P2P management operations */
  476. #define WPA_DRIVER_FLAGS_P2P_MGMT 0x00000100
  477. /* Driver supports concurrent P2P operations */
  478. #define WPA_DRIVER_FLAGS_P2P_CONCURRENT 0x00000200
  479. /*
  480. * Driver uses the initial interface as a dedicated management interface, i.e.,
  481. * it cannot be used for P2P group operations or non-P2P purposes.
  482. */
  483. #define WPA_DRIVER_FLAGS_P2P_DEDICATED_INTERFACE 0x00000400
  484. /* This interface is P2P capable (P2P Device, GO, or P2P Client */
  485. #define WPA_DRIVER_FLAGS_P2P_CAPABLE 0x00000800
  486. /* Driver supports concurrent operations on multiple channels */
  487. #define WPA_DRIVER_FLAGS_MULTI_CHANNEL_CONCURRENT 0x00001000
  488. /*
  489. * Driver uses the initial interface for P2P management interface and non-P2P
  490. * purposes (e.g., connect to infra AP), but this interface cannot be used for
  491. * P2P group operations.
  492. */
  493. #define WPA_DRIVER_FLAGS_P2P_MGMT_AND_NON_P2P 0x00002000
  494. /*
  495. * Driver is known to use sane error codes, i.e., when it indicates that
  496. * something (e.g., association) fails, there was indeed a failure and the
  497. * operation does not end up getting completed successfully later.
  498. */
  499. #define WPA_DRIVER_FLAGS_SANE_ERROR_CODES 0x00004000
  500. /* Driver supports off-channel TX */
  501. #define WPA_DRIVER_FLAGS_OFFCHANNEL_TX 0x00008000
  502. /* Driver indicates TX status events for EAPOL Data frames */
  503. #define WPA_DRIVER_FLAGS_EAPOL_TX_STATUS 0x00010000
  504. unsigned int flags;
  505. int max_scan_ssids;
  506. /**
  507. * max_remain_on_chan - Maximum remain-on-channel duration in msec
  508. */
  509. unsigned int max_remain_on_chan;
  510. /**
  511. * max_stations - Maximum number of associated stations the driver
  512. * supports in AP mode
  513. */
  514. unsigned int max_stations;
  515. };
  516. struct hostapd_data;
  517. struct hostap_sta_driver_data {
  518. unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes;
  519. unsigned long current_tx_rate;
  520. unsigned long inactive_msec;
  521. unsigned long flags;
  522. unsigned long num_ps_buf_frames;
  523. unsigned long tx_retry_failed;
  524. unsigned long tx_retry_count;
  525. int last_rssi;
  526. int last_ack_rssi;
  527. };
  528. struct hostapd_sta_add_params {
  529. const u8 *addr;
  530. u16 aid;
  531. u16 capability;
  532. const u8 *supp_rates;
  533. size_t supp_rates_len;
  534. u16 listen_interval;
  535. const struct ieee80211_ht_capabilities *ht_capabilities;
  536. };
  537. struct hostapd_freq_params {
  538. int mode;
  539. int freq;
  540. int channel;
  541. int ht_enabled;
  542. int sec_channel_offset; /* 0 = HT40 disabled, -1 = HT40 enabled,
  543. * secondary channel below primary, 1 = HT40
  544. * enabled, secondary channel above primary */
  545. };
  546. enum wpa_driver_if_type {
  547. /**
  548. * WPA_IF_STATION - Station mode interface
  549. */
  550. WPA_IF_STATION,
  551. /**
  552. * WPA_IF_AP_VLAN - AP mode VLAN interface
  553. *
  554. * This interface shares its address and Beacon frame with the main
  555. * BSS.
  556. */
  557. WPA_IF_AP_VLAN,
  558. /**
  559. * WPA_IF_AP_BSS - AP mode BSS interface
  560. *
  561. * This interface has its own address and Beacon frame.
  562. */
  563. WPA_IF_AP_BSS,
  564. /**
  565. * WPA_IF_P2P_GO - P2P Group Owner
  566. */
  567. WPA_IF_P2P_GO,
  568. /**
  569. * WPA_IF_P2P_CLIENT - P2P Client
  570. */
  571. WPA_IF_P2P_CLIENT,
  572. /**
  573. * WPA_IF_P2P_GROUP - P2P Group interface (will become either
  574. * WPA_IF_P2P_GO or WPA_IF_P2P_CLIENT, but the role is not yet known)
  575. */
  576. WPA_IF_P2P_GROUP
  577. };
  578. struct wpa_init_params {
  579. const u8 *bssid;
  580. const char *ifname;
  581. const u8 *ssid;
  582. size_t ssid_len;
  583. const char *test_socket;
  584. int use_pae_group_addr;
  585. char **bridge;
  586. size_t num_bridge;
  587. u8 *own_addr; /* buffer for writing own MAC address */
  588. };
  589. struct wpa_bss_params {
  590. /** Interface name (for multi-SSID/VLAN support) */
  591. const char *ifname;
  592. /** Whether IEEE 802.1X or WPA/WPA2 is enabled */
  593. int enabled;
  594. int wpa;
  595. int ieee802_1x;
  596. int wpa_group;
  597. int wpa_pairwise;
  598. int wpa_key_mgmt;
  599. int rsn_preauth;
  600. };
  601. #define WPA_STA_AUTHORIZED BIT(0)
  602. #define WPA_STA_WMM BIT(1)
  603. #define WPA_STA_SHORT_PREAMBLE BIT(2)
  604. #define WPA_STA_MFP BIT(3)
  605. /**
  606. * struct p2p_params - P2P parameters for driver-based P2P management
  607. */
  608. struct p2p_params {
  609. const char *dev_name;
  610. u8 pri_dev_type[8];
  611. #define DRV_MAX_SEC_DEV_TYPES 5
  612. u8 sec_dev_type[DRV_MAX_SEC_DEV_TYPES][8];
  613. size_t num_sec_dev_types;
  614. };
  615. enum tdls_oper {
  616. TDLS_DISCOVERY_REQ,
  617. TDLS_SETUP,
  618. TDLS_TEARDOWN,
  619. TDLS_ENABLE_LINK,
  620. TDLS_DISABLE_LINK,
  621. TDLS_ENABLE,
  622. TDLS_DISABLE
  623. };
  624. /**
  625. * struct wpa_signal_info - Information about channel signal quality
  626. */
  627. struct wpa_signal_info {
  628. u32 frequency;
  629. int above_threshold;
  630. int current_signal;
  631. int current_noise;
  632. int current_txrate;
  633. };
  634. /**
  635. * struct wpa_driver_ops - Driver interface API definition
  636. *
  637. * This structure defines the API that each driver interface needs to implement
  638. * for core wpa_supplicant code. All driver specific functionality is captured
  639. * in this wrapper.
  640. */
  641. struct wpa_driver_ops {
  642. /** Name of the driver interface */
  643. const char *name;
  644. /** One line description of the driver interface */
  645. const char *desc;
  646. /**
  647. * get_bssid - Get the current BSSID
  648. * @priv: private driver interface data
  649. * @bssid: buffer for BSSID (ETH_ALEN = 6 bytes)
  650. *
  651. * Returns: 0 on success, -1 on failure
  652. *
  653. * Query kernel driver for the current BSSID and copy it to bssid.
  654. * Setting bssid to 00:00:00:00:00:00 is recommended if the STA is not
  655. * associated.
  656. */
  657. int (*get_bssid)(void *priv, u8 *bssid);
  658. /**
  659. * get_ssid - Get the current SSID
  660. * @priv: private driver interface data
  661. * @ssid: buffer for SSID (at least 32 bytes)
  662. *
  663. * Returns: Length of the SSID on success, -1 on failure
  664. *
  665. * Query kernel driver for the current SSID and copy it to ssid.
  666. * Returning zero is recommended if the STA is not associated.
  667. *
  668. * Note: SSID is an array of octets, i.e., it is not nul terminated and
  669. * can, at least in theory, contain control characters (including nul)
  670. * and as such, should be processed as binary data, not a printable
  671. * string.
  672. */
  673. int (*get_ssid)(void *priv, u8 *ssid);
  674. /**
  675. * set_key - Configure encryption key
  676. * @ifname: Interface name (for multi-SSID/VLAN support)
  677. * @priv: private driver interface data
  678. * @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP,
  679. * %WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK);
  680. * %WPA_ALG_NONE clears the key.
  681. * @addr: Address of the peer STA (BSSID of the current AP when setting
  682. * pairwise key in station mode), ff:ff:ff:ff:ff:ff for
  683. * broadcast keys, %NULL for default keys that are used both for
  684. * broadcast and unicast; when clearing keys, %NULL is used to
  685. * indicate that both the broadcast-only and default key of the
  686. * specified key index is to be cleared
  687. * @key_idx: key index (0..3), usually 0 for unicast keys; 0..4095 for
  688. * IGTK
  689. * @set_tx: configure this key as the default Tx key (only used when
  690. * driver does not support separate unicast/individual key
  691. * @seq: sequence number/packet number, seq_len octets, the next
  692. * packet number to be used for in replay protection; configured
  693. * for Rx keys (in most cases, this is only used with broadcast
  694. * keys and set to zero for unicast keys); %NULL if not set
  695. * @seq_len: length of the seq, depends on the algorithm:
  696. * TKIP: 6 octets, CCMP: 6 octets, IGTK: 6 octets
  697. * @key: key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key,
  698. * 8-byte Rx Mic Key
  699. * @key_len: length of the key buffer in octets (WEP: 5 or 13,
  700. * TKIP: 32, CCMP: 16, IGTK: 16)
  701. *
  702. * Returns: 0 on success, -1 on failure
  703. *
  704. * Configure the given key for the kernel driver. If the driver
  705. * supports separate individual keys (4 default keys + 1 individual),
  706. * addr can be used to determine whether the key is default or
  707. * individual. If only 4 keys are supported, the default key with key
  708. * index 0 is used as the individual key. STA must be configured to use
  709. * it as the default Tx key (set_tx is set) and accept Rx for all the
  710. * key indexes. In most cases, WPA uses only key indexes 1 and 2 for
  711. * broadcast keys, so key index 0 is available for this kind of
  712. * configuration.
  713. *
  714. * Please note that TKIP keys include separate TX and RX MIC keys and
  715. * some drivers may expect them in different order than wpa_supplicant
  716. * is using. If the TX/RX keys are swapped, all TKIP encrypted packets
  717. * will trigger Michael MIC errors. This can be fixed by changing the
  718. * order of MIC keys by swapping te bytes 16..23 and 24..31 of the key
  719. * in driver_*.c set_key() implementation, see driver_ndis.c for an
  720. * example on how this can be done.
  721. */
  722. int (*set_key)(const char *ifname, void *priv, enum wpa_alg alg,
  723. const u8 *addr, int key_idx, int set_tx,
  724. const u8 *seq, size_t seq_len,
  725. const u8 *key, size_t key_len);
  726. /**
  727. * init - Initialize driver interface
  728. * @ctx: context to be used when calling wpa_supplicant functions,
  729. * e.g., wpa_supplicant_event()
  730. * @ifname: interface name, e.g., wlan0
  731. *
  732. * Returns: Pointer to private data, %NULL on failure
  733. *
  734. * Initialize driver interface, including event processing for kernel
  735. * driver events (e.g., associated, scan results, Michael MIC failure).
  736. * This function can allocate a private configuration data area for
  737. * @ctx, file descriptor, interface name, etc. information that may be
  738. * needed in future driver operations. If this is not used, non-NULL
  739. * value will need to be returned because %NULL is used to indicate
  740. * failure. The returned value will be used as 'void *priv' data for
  741. * all other driver_ops functions.
  742. *
  743. * The main event loop (eloop.c) of wpa_supplicant can be used to
  744. * register callback for read sockets (eloop_register_read_sock()).
  745. *
  746. * See below for more information about events and
  747. * wpa_supplicant_event() function.
  748. */
  749. void * (*init)(void *ctx, const char *ifname);
  750. /**
  751. * deinit - Deinitialize driver interface
  752. * @priv: private driver interface data from init()
  753. *
  754. * Shut down driver interface and processing of driver events. Free
  755. * private data buffer if one was allocated in init() handler.
  756. */
  757. void (*deinit)(void *priv);
  758. /**
  759. * set_param - Set driver configuration parameters
  760. * @priv: private driver interface data from init()
  761. * @param: driver specific configuration parameters
  762. *
  763. * Returns: 0 on success, -1 on failure
  764. *
  765. * Optional handler for notifying driver interface about configuration
  766. * parameters (driver_param).
  767. */
  768. int (*set_param)(void *priv, const char *param);
  769. /**
  770. * set_countermeasures - Enable/disable TKIP countermeasures
  771. * @priv: private driver interface data
  772. * @enabled: 1 = countermeasures enabled, 0 = disabled
  773. *
  774. * Returns: 0 on success, -1 on failure
  775. *
  776. * Configure TKIP countermeasures. When these are enabled, the driver
  777. * should drop all received and queued frames that are using TKIP.
  778. */
  779. int (*set_countermeasures)(void *priv, int enabled);
  780. /**
  781. * deauthenticate - Request driver to deauthenticate
  782. * @priv: private driver interface data
  783. * @addr: peer address (BSSID of the AP)
  784. * @reason_code: 16-bit reason code to be sent in the deauthentication
  785. * frame
  786. *
  787. * Returns: 0 on success, -1 on failure
  788. */
  789. int (*deauthenticate)(void *priv, const u8 *addr, int reason_code);
  790. /**
  791. * disassociate - Request driver to disassociate
  792. * @priv: private driver interface data
  793. * @addr: peer address (BSSID of the AP)
  794. * @reason_code: 16-bit reason code to be sent in the disassociation
  795. * frame
  796. *
  797. * Returns: 0 on success, -1 on failure
  798. */
  799. int (*disassociate)(void *priv, const u8 *addr, int reason_code);
  800. /**
  801. * associate - Request driver to associate
  802. * @priv: private driver interface data
  803. * @params: association parameters
  804. *
  805. * Returns: 0 on success, -1 on failure
  806. */
  807. int (*associate)(void *priv,
  808. struct wpa_driver_associate_params *params);
  809. /**
  810. * add_pmkid - Add PMKSA cache entry to the driver
  811. * @priv: private driver interface data
  812. * @bssid: BSSID for the PMKSA cache entry
  813. * @pmkid: PMKID for the PMKSA cache entry
  814. *
  815. * Returns: 0 on success, -1 on failure
  816. *
  817. * This function is called when a new PMK is received, as a result of
  818. * either normal authentication or RSN pre-authentication.
  819. *
  820. * If the driver generates RSN IE, i.e., it does not use wpa_ie in
  821. * associate(), add_pmkid() can be used to add new PMKSA cache entries
  822. * in the driver. If the driver uses wpa_ie from wpa_supplicant, this
  823. * driver_ops function does not need to be implemented. Likewise, if
  824. * the driver does not support WPA, this function is not needed.
  825. */
  826. int (*add_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
  827. /**
  828. * remove_pmkid - Remove PMKSA cache entry to the driver
  829. * @priv: private driver interface data
  830. * @bssid: BSSID for the PMKSA cache entry
  831. * @pmkid: PMKID for the PMKSA cache entry
  832. *
  833. * Returns: 0 on success, -1 on failure
  834. *
  835. * This function is called when the supplicant drops a PMKSA cache
  836. * entry for any reason.
  837. *
  838. * If the driver generates RSN IE, i.e., it does not use wpa_ie in
  839. * associate(), remove_pmkid() can be used to synchronize PMKSA caches
  840. * between the driver and wpa_supplicant. If the driver uses wpa_ie
  841. * from wpa_supplicant, this driver_ops function does not need to be
  842. * implemented. Likewise, if the driver does not support WPA, this
  843. * function is not needed.
  844. */
  845. int (*remove_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
  846. /**
  847. * flush_pmkid - Flush PMKSA cache
  848. * @priv: private driver interface data
  849. *
  850. * Returns: 0 on success, -1 on failure
  851. *
  852. * This function is called when the supplicant drops all PMKSA cache
  853. * entries for any reason.
  854. *
  855. * If the driver generates RSN IE, i.e., it does not use wpa_ie in
  856. * associate(), remove_pmkid() can be used to synchronize PMKSA caches
  857. * between the driver and wpa_supplicant. If the driver uses wpa_ie
  858. * from wpa_supplicant, this driver_ops function does not need to be
  859. * implemented. Likewise, if the driver does not support WPA, this
  860. * function is not needed.
  861. */
  862. int (*flush_pmkid)(void *priv);
  863. /**
  864. * get_capa - Get driver capabilities
  865. * @priv: private driver interface data
  866. *
  867. * Returns: 0 on success, -1 on failure
  868. *
  869. * Get driver/firmware/hardware capabilities.
  870. */
  871. int (*get_capa)(void *priv, struct wpa_driver_capa *capa);
  872. /**
  873. * poll - Poll driver for association information
  874. * @priv: private driver interface data
  875. *
  876. * This is an option callback that can be used when the driver does not
  877. * provide event mechanism for association events. This is called when
  878. * receiving WPA EAPOL-Key messages that require association
  879. * information. The driver interface is supposed to generate associnfo
  880. * event before returning from this callback function. In addition, the
  881. * driver interface should generate an association event after having
  882. * sent out associnfo.
  883. */
  884. void (*poll)(void *priv);
  885. /**
  886. * get_ifname - Get interface name
  887. * @priv: private driver interface data
  888. *
  889. * Returns: Pointer to the interface name. This can differ from the
  890. * interface name used in init() call. Init() is called first.
  891. *
  892. * This optional function can be used to allow the driver interface to
  893. * replace the interface name with something else, e.g., based on an
  894. * interface mapping from a more descriptive name.
  895. */
  896. const char * (*get_ifname)(void *priv);
  897. /**
  898. * get_mac_addr - Get own MAC address
  899. * @priv: private driver interface data
  900. *
  901. * Returns: Pointer to own MAC address or %NULL on failure
  902. *
  903. * This optional function can be used to get the own MAC address of the
  904. * device from the driver interface code. This is only needed if the
  905. * l2_packet implementation for the OS does not provide easy access to
  906. * a MAC address. */
  907. const u8 * (*get_mac_addr)(void *priv);
  908. /**
  909. * send_eapol - Optional function for sending EAPOL packets
  910. * @priv: private driver interface data
  911. * @dest: Destination MAC address
  912. * @proto: Ethertype
  913. * @data: EAPOL packet starting with IEEE 802.1X header
  914. * @data_len: Size of the EAPOL packet
  915. *
  916. * Returns: 0 on success, -1 on failure
  917. *
  918. * This optional function can be used to override l2_packet operations
  919. * with driver specific functionality. If this function pointer is set,
  920. * l2_packet module is not used at all and the driver interface code is
  921. * responsible for receiving and sending all EAPOL packets. The
  922. * received EAPOL packets are sent to core code with EVENT_EAPOL_RX
  923. * event. The driver interface is required to implement get_mac_addr()
  924. * handler if send_eapol() is used.
  925. */
  926. int (*send_eapol)(void *priv, const u8 *dest, u16 proto,
  927. const u8 *data, size_t data_len);
  928. /**
  929. * set_operstate - Sets device operating state to DORMANT or UP
  930. * @priv: private driver interface data
  931. * @state: 0 = dormant, 1 = up
  932. * Returns: 0 on success, -1 on failure
  933. *
  934. * This is an optional function that can be used on operating systems
  935. * that support a concept of controlling network device state from user
  936. * space applications. This function, if set, gets called with
  937. * state = 1 when authentication has been completed and with state = 0
  938. * when connection is lost.
  939. */
  940. int (*set_operstate)(void *priv, int state);
  941. /**
  942. * mlme_setprotection - MLME-SETPROTECTION.request primitive
  943. * @priv: Private driver interface data
  944. * @addr: Address of the station for which to set protection (may be
  945. * %NULL for group keys)
  946. * @protect_type: MLME_SETPROTECTION_PROTECT_TYPE_*
  947. * @key_type: MLME_SETPROTECTION_KEY_TYPE_*
  948. * Returns: 0 on success, -1 on failure
  949. *
  950. * This is an optional function that can be used to set the driver to
  951. * require protection for Tx and/or Rx frames. This uses the layer
  952. * interface defined in IEEE 802.11i-2004 clause 10.3.22.1
  953. * (MLME-SETPROTECTION.request). Many drivers do not use explicit
  954. * set protection operation; instead, they set protection implicitly
  955. * based on configured keys.
  956. */
  957. int (*mlme_setprotection)(void *priv, const u8 *addr, int protect_type,
  958. int key_type);
  959. /**
  960. * get_hw_feature_data - Get hardware support data (channels and rates)
  961. * @priv: Private driver interface data
  962. * @num_modes: Variable for returning the number of returned modes
  963. * flags: Variable for returning hardware feature flags
  964. * Returns: Pointer to allocated hardware data on success or %NULL on
  965. * failure. Caller is responsible for freeing this.
  966. *
  967. * This function is only needed for drivers that export MLME
  968. * (management frame processing) to %wpa_supplicant or hostapd.
  969. */
  970. struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv,
  971. u16 *num_modes,
  972. u16 *flags);
  973. /**
  974. * set_channel - Set channel
  975. * @priv: Private driver interface data
  976. * @phymode: HOSTAPD_MODE_IEEE80211B, ..
  977. * @chan: IEEE 802.11 channel number
  978. * @freq: Frequency of the channel in MHz
  979. * Returns: 0 on success, -1 on failure
  980. *
  981. * This function is only needed for drivers that export MLME
  982. * (management frame processing) to wpa_supplicant.
  983. */
  984. int (*set_channel)(void *priv, enum hostapd_hw_mode phymode, int chan,
  985. int freq);
  986. /**
  987. * set_ssid - Set SSID
  988. * @priv: Private driver interface data
  989. * @ssid: SSID
  990. * @ssid_len: SSID length
  991. * Returns: 0 on success, -1 on failure
  992. *
  993. * This function is only needed for drivers that export MLME
  994. * (management frame processing) to wpa_supplicant.
  995. */
  996. int (*set_ssid)(void *priv, const u8 *ssid, size_t ssid_len);
  997. /**
  998. * set_bssid - Set BSSID
  999. * @priv: Private driver interface data
  1000. * @bssid: BSSID
  1001. * Returns: 0 on success, -1 on failure
  1002. *
  1003. * This function is only needed for drivers that export MLME
  1004. * (management frame processing) to wpa_supplicant.
  1005. */
  1006. int (*set_bssid)(void *priv, const u8 *bssid);
  1007. /**
  1008. * send_mlme - Send management frame from MLME
  1009. * @priv: Private driver interface data
  1010. * @data: IEEE 802.11 management frame with IEEE 802.11 header
  1011. * @data_len: Size of the management frame
  1012. * Returns: 0 on success, -1 on failure
  1013. *
  1014. * This function is only needed for drivers that export MLME
  1015. * (management frame processing) to wpa_supplicant.
  1016. */
  1017. int (*send_mlme)(void *priv, const u8 *data, size_t data_len);
  1018. /**
  1019. * mlme_add_sta - Add a STA entry into the driver/netstack
  1020. * @priv: Private driver interface data
  1021. * @addr: MAC address of the STA (e.g., BSSID of the AP)
  1022. * @supp_rates: Supported rate set (from (Re)AssocResp); in IEEE 802.11
  1023. * format (one octet per rate, 1 = 0.5 Mbps)
  1024. * @supp_rates_len: Number of entries in supp_rates
  1025. * Returns: 0 on success, -1 on failure
  1026. *
  1027. * This function is only needed for drivers that export MLME
  1028. * (management frame processing) to wpa_supplicant. When the MLME code
  1029. * completes association with an AP, this function is called to
  1030. * configure the driver/netstack with a STA entry for data frame
  1031. * processing (TX rate control, encryption/decryption).
  1032. */
  1033. int (*mlme_add_sta)(void *priv, const u8 *addr, const u8 *supp_rates,
  1034. size_t supp_rates_len);
  1035. /**
  1036. * mlme_remove_sta - Remove a STA entry from the driver/netstack
  1037. * @priv: Private driver interface data
  1038. * @addr: MAC address of the STA (e.g., BSSID of the AP)
  1039. * Returns: 0 on success, -1 on failure
  1040. *
  1041. * This function is only needed for drivers that export MLME
  1042. * (management frame processing) to wpa_supplicant.
  1043. */
  1044. int (*mlme_remove_sta)(void *priv, const u8 *addr);
  1045. /**
  1046. * update_ft_ies - Update FT (IEEE 802.11r) IEs
  1047. * @priv: Private driver interface data
  1048. * @md: Mobility domain (2 octets) (also included inside ies)
  1049. * @ies: FT IEs (MDIE, FTIE, ...) or %NULL to remove IEs
  1050. * @ies_len: Length of FT IEs in bytes
  1051. * Returns: 0 on success, -1 on failure
  1052. *
  1053. * The supplicant uses this callback to let the driver know that keying
  1054. * material for FT is available and that the driver can use the
  1055. * provided IEs in the next message in FT authentication sequence.
  1056. *
  1057. * This function is only needed for driver that support IEEE 802.11r
  1058. * (Fast BSS Transition).
  1059. */
  1060. int (*update_ft_ies)(void *priv, const u8 *md, const u8 *ies,
  1061. size_t ies_len);
  1062. /**
  1063. * send_ft_action - Send FT Action frame (IEEE 802.11r)
  1064. * @priv: Private driver interface data
  1065. * @action: Action field value
  1066. * @target_ap: Target AP address
  1067. * @ies: FT IEs (MDIE, FTIE, ...) (FT Request action frame body)
  1068. * @ies_len: Length of FT IEs in bytes
  1069. * Returns: 0 on success, -1 on failure
  1070. *
  1071. * The supplicant uses this callback to request the driver to transmit
  1072. * an FT Action frame (action category 6) for over-the-DS fast BSS
  1073. * transition.
  1074. */
  1075. int (*send_ft_action)(void *priv, u8 action, const u8 *target_ap,
  1076. const u8 *ies, size_t ies_len);
  1077. /**
  1078. * get_scan_results2 - Fetch the latest scan results
  1079. * @priv: private driver interface data
  1080. *
  1081. * Returns: Allocated buffer of scan results (caller is responsible for
  1082. * freeing the data structure) on success, NULL on failure
  1083. */
  1084. struct wpa_scan_results * (*get_scan_results2)(void *priv);
  1085. /**
  1086. * set_country - Set country
  1087. * @priv: Private driver interface data
  1088. * @alpha2: country to which to switch to
  1089. * Returns: 0 on success, -1 on failure
  1090. *
  1091. * This function is for drivers which support some form
  1092. * of setting a regulatory domain.
  1093. */
  1094. int (*set_country)(void *priv, const char *alpha2);
  1095. /**
  1096. * global_init - Global driver initialization
  1097. * Returns: Pointer to private data (global), %NULL on failure
  1098. *
  1099. * This optional function is called to initialize the driver wrapper
  1100. * for global data, i.e., data that applies to all interfaces. If this
  1101. * function is implemented, global_deinit() will also need to be
  1102. * implemented to free the private data. The driver will also likely
  1103. * use init2() function instead of init() to get the pointer to global
  1104. * data available to per-interface initializer.
  1105. */
  1106. void * (*global_init)(void);
  1107. /**
  1108. * global_deinit - Global driver deinitialization
  1109. * @priv: private driver global data from global_init()
  1110. *
  1111. * Terminate any global driver related functionality and free the
  1112. * global data structure.
  1113. */
  1114. void (*global_deinit)(void *priv);
  1115. /**
  1116. * init2 - Initialize driver interface (with global data)
  1117. * @ctx: context to be used when calling wpa_supplicant functions,
  1118. * e.g., wpa_supplicant_event()
  1119. * @ifname: interface name, e.g., wlan0
  1120. * @global_priv: private driver global data from global_init()
  1121. * Returns: Pointer to private data, %NULL on failure
  1122. *
  1123. * This function can be used instead of init() if the driver wrapper
  1124. * uses global data.
  1125. */
  1126. void * (*init2)(void *ctx, const char *ifname, void *global_priv);
  1127. /**
  1128. * get_interfaces - Get information about available interfaces
  1129. * @global_priv: private driver global data from global_init()
  1130. * Returns: Allocated buffer of interface information (caller is
  1131. * responsible for freeing the data structure) on success, NULL on
  1132. * failure
  1133. */
  1134. struct wpa_interface_info * (*get_interfaces)(void *global_priv);
  1135. /**
  1136. * scan2 - Request the driver to initiate scan
  1137. * @priv: private driver interface data
  1138. * @params: Scan parameters
  1139. *
  1140. * Returns: 0 on success, -1 on failure
  1141. *
  1142. * Once the scan results are ready, the driver should report scan
  1143. * results event for wpa_supplicant which will eventually request the
  1144. * results with wpa_driver_get_scan_results2().
  1145. */
  1146. int (*scan2)(void *priv, struct wpa_driver_scan_params *params);
  1147. /**
  1148. * authenticate - Request driver to authenticate
  1149. * @priv: private driver interface data
  1150. * @params: authentication parameters
  1151. * Returns: 0 on success, -1 on failure
  1152. *
  1153. * This is an optional function that can be used with drivers that
  1154. * support separate authentication and association steps, i.e., when
  1155. * wpa_supplicant can act as the SME. If not implemented, associate()
  1156. * function is expected to take care of IEEE 802.11 authentication,
  1157. * too.
  1158. */
  1159. int (*authenticate)(void *priv,
  1160. struct wpa_driver_auth_params *params);
  1161. /**
  1162. * set_beacon - Set Beacon frame template
  1163. * @priv: Private driver interface data
  1164. * @head: Beacon head from IEEE 802.11 header to IEs before TIM IE
  1165. * @head_len: Length of the head buffer in octets
  1166. * @tail: Beacon tail following TIM IE
  1167. * @tail_len: Length of the tail buffer in octets
  1168. * @dtim_period: DTIM period
  1169. * @beacon_int: Beacon interval
  1170. * Returns: 0 on success, -1 on failure
  1171. *
  1172. * This function is used to configure Beacon template for the driver in
  1173. * AP mode. The driver is responsible for building the full Beacon
  1174. * frame by concatenating the head part with TIM IE generated by the
  1175. * driver/firmware and finishing with the tail part.
  1176. */
  1177. int (*set_beacon)(void *priv, const u8 *head, size_t head_len,
  1178. const u8 *tail, size_t tail_len, int dtim_period,
  1179. int beacon_int);
  1180. /**
  1181. * hapd_init - Initialize driver interface (hostapd only)
  1182. * @hapd: Pointer to hostapd context
  1183. * @params: Configuration for the driver wrapper
  1184. * Returns: Pointer to private data, %NULL on failure
  1185. *
  1186. * This function is used instead of init() or init2() when the driver
  1187. * wrapper is used withh hostapd.
  1188. */
  1189. void * (*hapd_init)(struct hostapd_data *hapd,
  1190. struct wpa_init_params *params);
  1191. /**
  1192. * hapd_deinit - Deinitialize driver interface (hostapd only)
  1193. * @priv: Private driver interface data from hapd_init()
  1194. */
  1195. void (*hapd_deinit)(void *priv);
  1196. /**
  1197. * set_ieee8021x - Enable/disable IEEE 802.1X support (AP only)
  1198. * @priv: Private driver interface data
  1199. * @params: BSS parameters
  1200. * Returns: 0 on success, -1 on failure
  1201. *
  1202. * This is an optional function to configure the kernel driver to
  1203. * enable/disable IEEE 802.1X support and set WPA/WPA2 parameters. This
  1204. * can be left undefined (set to %NULL) if IEEE 802.1X support is
  1205. * always enabled and the driver uses set_beacon() to set WPA/RSN IE
  1206. * for Beacon frames.
  1207. */
  1208. int (*set_ieee8021x)(void *priv, struct wpa_bss_params *params);
  1209. /**
  1210. * set_privacy - Enable/disable privacy (AP only)
  1211. * @priv: Private driver interface data
  1212. * @enabled: 1 = privacy enabled, 0 = disabled
  1213. * Returns: 0 on success, -1 on failure
  1214. *
  1215. * This is an optional function to configure privacy field in the
  1216. * kernel driver for Beacon frames. This can be left undefined (set to
  1217. * %NULL) if the driver uses the Beacon template from set_beacon().
  1218. */
  1219. int (*set_privacy)(void *priv, int enabled);
  1220. /**
  1221. * get_seqnum - Fetch the current TSC/packet number (AP only)
  1222. * @ifname: The interface name (main or virtual)
  1223. * @priv: Private driver interface data
  1224. * @addr: MAC address of the station or %NULL for group keys
  1225. * @idx: Key index
  1226. * @seq: Buffer for returning the latest used TSC/packet number
  1227. * Returns: 0 on success, -1 on failure
  1228. *
  1229. * This function is used to fetch the last used TSC/packet number for
  1230. * a TKIP, CCMP, or BIP/IGTK key. It is mainly used with group keys, so
  1231. * there is no strict requirement on implementing support for unicast
  1232. * keys (i.e., addr != %NULL).
  1233. */
  1234. int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
  1235. int idx, u8 *seq);
  1236. /**
  1237. * flush - Flush all association stations (AP only)
  1238. * @priv: Private driver interface data
  1239. * Returns: 0 on success, -1 on failure
  1240. *
  1241. * This function requests the driver to disassociate all associated
  1242. * stations. This function does not need to be implemented if the
  1243. * driver does not process association frames internally.
  1244. */
  1245. int (*flush)(void *priv);
  1246. /**
  1247. * set_generic_elem - Add IEs into Beacon/Probe Response frames (AP)
  1248. * @priv: Private driver interface data
  1249. * @elem: Information elements
  1250. * @elem_len: Length of the elem buffer in octets
  1251. * Returns: 0 on success, -1 on failure
  1252. *
  1253. * This is an optional function to add information elements in the
  1254. * kernel driver for Beacon and Probe Response frames. This can be left
  1255. * undefined (set to %NULL) if the driver uses the Beacon template from
  1256. * set_beacon().
  1257. */
  1258. int (*set_generic_elem)(void *priv, const u8 *elem, size_t elem_len);
  1259. /**
  1260. * read_sta_data - Fetch station data (AP only)
  1261. * @priv: Private driver interface data
  1262. * @data: Buffer for returning station information
  1263. * @addr: MAC address of the station
  1264. * Returns: 0 on success, -1 on failure
  1265. */
  1266. int (*read_sta_data)(void *priv, struct hostap_sta_driver_data *data,
  1267. const u8 *addr);
  1268. /**
  1269. * hapd_send_eapol - Send an EAPOL packet (AP only)
  1270. * @priv: private driver interface data
  1271. * @addr: Destination MAC address
  1272. * @data: EAPOL packet starting with IEEE 802.1X header
  1273. * @data_len: Length of the EAPOL packet in octets
  1274. * @encrypt: Whether the frame should be encrypted
  1275. * @own_addr: Source MAC address
  1276. * @flags: WPA_STA_* flags for the destination station
  1277. *
  1278. * Returns: 0 on success, -1 on failure
  1279. */
  1280. int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data,
  1281. size_t data_len, int encrypt,
  1282. const u8 *own_addr, u32 flags);
  1283. /**
  1284. * sta_deauth - Deauthenticate a station (AP only)
  1285. * @priv: Private driver interface data
  1286. * @own_addr: Source address and BSSID for the Deauthentication frame
  1287. * @addr: MAC address of the station to deauthenticate
  1288. * @reason: Reason code for the Deauthentiation frame
  1289. * Returns: 0 on success, -1 on failure
  1290. *
  1291. * This function requests a specific station to be deauthenticated and
  1292. * a Deauthentication frame to be sent to it.
  1293. */
  1294. int (*sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr,
  1295. int reason);
  1296. /**
  1297. * sta_disassoc - Disassociate a station (AP only)
  1298. * @priv: Private driver interface data
  1299. * @own_addr: Source address and BSSID for the Disassociation frame
  1300. * @addr: MAC address of the station to disassociate
  1301. * @reason: Reason code for the Disassociation frame
  1302. * Returns: 0 on success, -1 on failure
  1303. *
  1304. * This function requests a specific station to be disassociated and
  1305. * a Disassociation frame to be sent to it.
  1306. */
  1307. int (*sta_disassoc)(void *priv, const u8 *own_addr, const u8 *addr,
  1308. int reason);
  1309. /**
  1310. * sta_remove - Remove a station entry (AP only)
  1311. * @priv: Private driver interface data
  1312. * @addr: MAC address of the station to be removed
  1313. * Returns: 0 on success, -1 on failure
  1314. */
  1315. int (*sta_remove)(void *priv, const u8 *addr);
  1316. /**
  1317. * hapd_get_ssid - Get the current SSID (AP only)
  1318. * @priv: Private driver interface data
  1319. * @buf: Buffer for returning the SSID
  1320. * @len: Maximum length of the buffer
  1321. * Returns: Length of the SSID on success, -1 on failure
  1322. *
  1323. * This function need not be implemented if the driver uses Beacon
  1324. * template from set_beacon() and does not reply to Probe Request
  1325. * frames.
  1326. */
  1327. int (*hapd_get_ssid)(void *priv, u8 *buf, int len);
  1328. /**
  1329. * hapd_set_ssid - Set SSID (AP only)
  1330. * @priv: Private driver interface data
  1331. * @buf: SSID
  1332. * @len: Length of the SSID in octets
  1333. * Returns: 0 on success, -1 on failure
  1334. */
  1335. int (*hapd_set_ssid)(void *priv, const u8 *buf, int len);
  1336. /**
  1337. * hapd_set_countermeasures - Enable/disable TKIP countermeasures (AP)
  1338. * @priv: Private driver interface data
  1339. * @enabled: 1 = countermeasures enabled, 0 = disabled
  1340. * Returns: 0 on success, -1 on failure
  1341. *
  1342. * This need not be implemented if the driver does not take care of
  1343. * association processing.
  1344. */
  1345. int (*hapd_set_countermeasures)(void *priv, int enabled);
  1346. /**
  1347. * sta_add - Add a station entry
  1348. * @priv: Private driver interface data
  1349. * @params: Station parameters
  1350. * Returns: 0 on success, -1 on failure
  1351. *
  1352. * This function is used to add a station entry to the driver once the
  1353. * station has completed association. This is only used if the driver
  1354. * does not take care of association processing.
  1355. */
  1356. int (*sta_add)(void *priv, struct hostapd_sta_add_params *params);
  1357. /**
  1358. * get_inact_sec - Get station inactivity duration (AP only)
  1359. * @priv: Private driver interface data
  1360. * @addr: Station address
  1361. * Returns: Number of seconds station has been inactive, -1 on failure
  1362. */
  1363. int (*get_inact_sec)(void *priv, const u8 *addr);
  1364. /**
  1365. * sta_clear_stats - Clear station statistics (AP only)
  1366. * @priv: Private driver interface data
  1367. * @addr: Station address
  1368. * Returns: 0 on success, -1 on failure
  1369. */
  1370. int (*sta_clear_stats)(void *priv, const u8 *addr);
  1371. /**
  1372. * set_freq - Set channel/frequency (AP only)
  1373. * @priv: Private driver interface data
  1374. * @freq: Channel parameters
  1375. * Returns: 0 on success, -1 on failure
  1376. */
  1377. int (*set_freq)(void *priv, struct hostapd_freq_params *freq);
  1378. /**
  1379. * set_rts - Set RTS threshold
  1380. * @priv: Private driver interface data
  1381. * @rts: RTS threshold in octets
  1382. * Returns: 0 on success, -1 on failure
  1383. */
  1384. int (*set_rts)(void *priv, int rts);
  1385. /**
  1386. * set_frag - Set fragmentation threshold
  1387. * @priv: Private driver interface data
  1388. * @frag: Fragmentation threshold in octets
  1389. * Returns: 0 on success, -1 on failure
  1390. */
  1391. int (*set_frag)(void *priv, int frag);
  1392. /**
  1393. * sta_set_flags - Set station flags (AP only)
  1394. * @priv: Private driver interface data
  1395. * @addr: Station address
  1396. * @total_flags: Bitmap of all WPA_STA_* flags currently set
  1397. * @flags_or: Bitmap of WPA_STA_* flags to add
  1398. * @flags_and: Bitmap of WPA_STA_* flags to us as a mask
  1399. * Returns: 0 on success, -1 on failure
  1400. */
  1401. int (*sta_set_flags)(void *priv, const u8 *addr,
  1402. int total_flags, int flags_or, int flags_and);
  1403. /**
  1404. * set_rate_sets - Set supported and basic rate sets (AP only)
  1405. * @priv: Private driver interface data
  1406. * @supp_rates: -1 terminated array of supported rates in 100 kbps
  1407. * @basic_rates: -1 terminated array of basic rates in 100 kbps
  1408. * @mode: hardware mode (HOSTAPD_MODE_*)
  1409. * Returns: 0 on success, -1 on failure
  1410. */
  1411. int (*set_rate_sets)(void *priv, int *supp_rates, int *basic_rates,
  1412. int mode);
  1413. /**
  1414. * set_cts_protect - Set CTS protection mode (AP only)
  1415. * @priv: Private driver interface data
  1416. * @value: Whether CTS protection is enabled
  1417. * Returns: 0 on success, -1 on failure
  1418. */
  1419. int (*set_cts_protect)(void *priv, int value);
  1420. /**
  1421. * set_preamble - Set preamble mode (AP only)
  1422. * @priv: Private driver interface data
  1423. * @value: Whether short preamble is enabled
  1424. * Returns: 0 on success, -1 on failure
  1425. */
  1426. int (*set_preamble)(void *priv, int value);
  1427. /**
  1428. * set_short_slot_time - Set short slot time (AP only)
  1429. * @priv: Private driver interface data
  1430. * @value: Whether short slot time is enabled
  1431. * Returns: 0 on success, -1 on failure
  1432. */
  1433. int (*set_short_slot_time)(void *priv, int value);
  1434. /**
  1435. * set_tx_queue_params - Set TX queue parameters
  1436. * @priv: Private driver interface data
  1437. * @queue: Queue number (0 = VO, 1 = VI, 2 = BE, 3 = BK)
  1438. * @aifs: AIFS
  1439. * @cw_min: cwMin
  1440. * @cw_max: cwMax
  1441. * @burst_time: Maximum length for bursting in 0.1 msec units
  1442. */
  1443. int (*set_tx_queue_params)(void *priv, int queue, int aifs, int cw_min,
  1444. int cw_max, int burst_time);
  1445. /**
  1446. * valid_bss_mask - Validate BSSID mask
  1447. * @priv: Private driver interface data
  1448. * @addr: Address
  1449. * @mask: Mask
  1450. * Returns: 0 if mask is valid, -1 if mask is not valid, 1 if mask can
  1451. * be used, but the main interface address must be the first address in
  1452. * the block if mask is applied
  1453. */
  1454. int (*valid_bss_mask)(void *priv, const u8 *addr, const u8 *mask);
  1455. /**
  1456. * if_add - Add a virtual interface
  1457. * @priv: Private driver interface data
  1458. * @type: Interface type
  1459. * @ifname: Interface name for the new virtual interface
  1460. * @addr: Local address to use for the interface or %NULL to use the
  1461. * parent interface address
  1462. * @bss_ctx: BSS context for %WPA_IF_AP_BSS interfaces
  1463. * @drv_priv: Pointer for overwriting the driver context or %NULL if
  1464. * not allowed (applies only to %WPA_IF_AP_BSS type)
  1465. * @force_ifname: Buffer for returning an interface name that the
  1466. * driver ended up using if it differs from the requested ifname
  1467. * @if_addr: Buffer for returning the allocated interface address
  1468. * (this may differ from the requested addr if the driver cannot
  1469. * change interface address)
  1470. * @bridge: Bridge interface to use or %NULL if no bridge configured
  1471. * Returns: 0 on success, -1 on failure
  1472. */
  1473. int (*if_add)(void *priv, enum wpa_driver_if_type type,
  1474. const char *ifname, const u8 *addr, void *bss_ctx,
  1475. void **drv_priv, char *force_ifname, u8 *if_addr,
  1476. const char *bridge);
  1477. /**
  1478. * if_remove - Remove a virtual interface
  1479. * @priv: Private driver interface data
  1480. * @type: Interface type
  1481. * @ifname: Interface name of the virtual interface to be removed
  1482. * Returns: 0 on success, -1 on failure
  1483. */
  1484. int (*if_remove)(void *priv, enum wpa_driver_if_type type,
  1485. const char *ifname);
  1486. /**
  1487. * set_sta_vlan - Bind a station into a specific interface (AP only)
  1488. * @priv: Private driver interface data
  1489. * @ifname: Interface (main or virtual BSS or VLAN)
  1490. * @addr: MAC address of the associated station
  1491. * @vlan_id: VLAN ID
  1492. * Returns: 0 on success, -1 on failure
  1493. *
  1494. * This function is used to bind a station to a specific virtual
  1495. * interface. It is only used if when virtual interfaces are supported,
  1496. * e.g., to assign stations to different VLAN interfaces based on
  1497. * information from a RADIUS server. This allows separate broadcast
  1498. * domains to be used with a single BSS.
  1499. */
  1500. int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname,
  1501. int vlan_id);
  1502. /**
  1503. * commit - Optional commit changes handler (AP only)
  1504. * @priv: driver private data
  1505. * Returns: 0 on success, -1 on failure
  1506. *
  1507. * This optional handler function can be registered if the driver
  1508. * interface implementation needs to commit changes (e.g., by setting
  1509. * network interface up) at the end of initial configuration. If set,
  1510. * this handler will be called after initial setup has been completed.
  1511. */
  1512. int (*commit)(void *priv);
  1513. /**
  1514. * send_ether - Send an ethernet packet (AP only)
  1515. * @priv: private driver interface data
  1516. * @dst: Destination MAC address
  1517. * @src: Source MAC address
  1518. * @proto: Ethertype
  1519. * @data: EAPOL packet starting with IEEE 802.1X header
  1520. * @data_len: Length of the EAPOL packet in octets
  1521. * Returns: 0 on success, -1 on failure
  1522. */
  1523. int (*send_ether)(void *priv, const u8 *dst, const u8 *src, u16 proto,
  1524. const u8 *data, size_t data_len);
  1525. /**
  1526. * set_radius_acl_auth - Notification of RADIUS ACL change
  1527. * @priv: Private driver interface data
  1528. * @mac: MAC address of the station
  1529. * @accepted: Whether the station was accepted
  1530. * @session_timeout: Session timeout for the station
  1531. * Returns: 0 on success, -1 on failure
  1532. */
  1533. int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted,
  1534. u32 session_timeout);
  1535. /**
  1536. * set_radius_acl_expire - Notification of RADIUS ACL expiration
  1537. * @priv: Private driver interface data
  1538. * @mac: MAC address of the station
  1539. * Returns: 0 on success, -1 on failure
  1540. */
  1541. int (*set_radius_acl_expire)(void *priv, const u8 *mac);
  1542. /**
  1543. * set_ht_params - Set HT parameters (AP only)
  1544. * @priv: Private driver interface data
  1545. * @ht_capab: HT Capabilities IE
  1546. * @ht_capab_len: Length of ht_capab in octets
  1547. * @ht_oper: HT Operation IE
  1548. * @ht_oper_len: Length of ht_oper in octets
  1549. * Returns: 0 on success, -1 on failure
  1550. */
  1551. int (*set_ht_params)(void *priv,
  1552. const u8 *ht_capab, size_t ht_capab_len,
  1553. const u8 *ht_oper, size_t ht_oper_len);
  1554. /**
  1555. * set_ap_wps_ie - Add WPS IE(s) into Beacon/Probe Response frames (AP)
  1556. * @priv: Private driver interface data
  1557. * @beacon: WPS IE(s) for Beacon frames or %NULL to remove extra IE(s)
  1558. * @proberesp: WPS IE(s) for Probe Response frames or %NULL to remove
  1559. * extra IE(s)
  1560. * @assocresp: WPS IE(s) for (Re)Association Response frames or %NULL
  1561. * to remove extra IE(s)
  1562. * Returns: 0 on success, -1 on failure
  1563. *
  1564. * This is an optional function to add WPS IE in the kernel driver for
  1565. * Beacon and Probe Response frames. This can be left undefined (set
  1566. * to %NULL) if the driver uses the Beacon template from set_beacon()
  1567. * and does not process Probe Request frames. If the driver takes care
  1568. * of (Re)Association frame processing, the assocresp buffer includes
  1569. * WPS IE(s) that need to be added to (Re)Association Response frames
  1570. * whenever a (Re)Association Request frame indicated use of WPS.
  1571. *
  1572. * This will also be used to add P2P IE(s) into Beacon/Probe Response
  1573. * frames when operating as a GO. The driver is responsible for adding
  1574. * timing related attributes (e.g., NoA) in addition to the IEs
  1575. * included here by appending them after these buffers. This call is
  1576. * also used to provide Probe Response IEs for P2P Listen state
  1577. * operations for drivers that generate the Probe Response frames
  1578. * internally.
  1579. */
  1580. int (*set_ap_wps_ie)(void *priv, const struct wpabuf *beacon,
  1581. const struct wpabuf *proberesp,
  1582. const struct wpabuf *assocresp);
  1583. /**
  1584. * set_supp_port - Set IEEE 802.1X Supplicant Port status
  1585. * @priv: Private driver interface data
  1586. * @authorized: Whether the port is authorized
  1587. * Returns: 0 on success, -1 on failure
  1588. */
  1589. int (*set_supp_port)(void *priv, int authorized);
  1590. /**
  1591. * set_wds_sta - Bind a station into a 4-address WDS (AP only)
  1592. * @priv: Private driver interface data
  1593. * @addr: MAC address of the associated station
  1594. * @aid: Association ID
  1595. * @val: 1 = bind to 4-address WDS; 0 = unbind
  1596. * @bridge_ifname: Bridge interface to use for the WDS station or %NULL
  1597. * to indicate that bridge is not to be used
  1598. * Returns: 0 on success, -1 on failure
  1599. */
  1600. int (*set_wds_sta)(void *priv, const u8 *addr, int aid, int val,
  1601. const char *bridge_ifname);
  1602. /**
  1603. * send_action - Transmit an Action frame
  1604. * @priv: Private driver interface data
  1605. * @freq: Frequency (in MHz) of the channel
  1606. * @wait: Time to wait off-channel for a response (in ms), or zero
  1607. * @dst: Destination MAC address (Address 1)
  1608. * @src: Source MAC address (Address 2)
  1609. * @bssid: BSSID (Address 3)
  1610. * @data: Frame body
  1611. * @data_len: data length in octets
  1612. * Returns: 0 on success, -1 on failure
  1613. *
  1614. * This command can be used to request the driver to transmit an action
  1615. * frame to the specified destination.
  1616. *
  1617. * If the %WPA_DRIVER_FLAGS_OFFCHANNEL_TX flag is set, the frame will
  1618. * be transmitted on the given channel and the device will wait for a
  1619. * response on that channel for the given wait time.
  1620. *
  1621. * If the flag is not set, the wait time will be ignored. In this case,
  1622. * if a remain-on-channel duration is in progress, the frame must be
  1623. * transmitted on that channel; alternatively the frame may be sent on
  1624. * the current operational channel (if in associated state in station
  1625. * mode or while operating as an AP.)
  1626. */
  1627. int (*send_action)(void *priv, unsigned int freq, unsigned int wait,
  1628. const u8 *dst, const u8 *src, const u8 *bssid,
  1629. const u8 *data, size_t data_len);
  1630. /**
  1631. * send_action_cancel_wait - Cancel action frame TX wait
  1632. * @priv: Private driver interface data
  1633. *
  1634. * This command cancels the wait time associated with sending an action
  1635. * frame. It is only available when %WPA_DRIVER_FLAGS_OFFCHANNEL_TX is
  1636. * set in the driver flags.
  1637. */
  1638. void (*send_action_cancel_wait)(void *priv);
  1639. /**
  1640. * remain_on_channel - Remain awake on a channel
  1641. * @priv: Private driver interface data
  1642. * @freq: Frequency (in MHz) of the channel
  1643. * @duration: Duration in milliseconds
  1644. * Returns: 0 on success, -1 on failure
  1645. *
  1646. * This command is used to request the driver to remain awake on the
  1647. * specified channel for the specified duration and report received
  1648. * Action frames with EVENT_RX_ACTION events. Optionally, received
  1649. * Probe Request frames may also be requested to be reported by calling
  1650. * probe_req_report(). These will be reported with EVENT_RX_PROBE_REQ.
  1651. *
  1652. * The driver may not be at the requested channel when this function
  1653. * returns, i.e., the return code is only indicating whether the
  1654. * request was accepted. The caller will need to wait until the
  1655. * EVENT_REMAIN_ON_CHANNEL event indicates that the driver has
  1656. * completed the channel change. This may take some time due to other
  1657. * need for the radio and the caller should be prepared to timing out
  1658. * its wait since there are no guarantees on when this request can be
  1659. * executed.
  1660. */
  1661. int (*remain_on_channel)(void *priv, unsigned int freq,
  1662. unsigned int duration);
  1663. /**
  1664. * cancel_remain_on_channel - Cancel remain-on-channel operation
  1665. * @priv: Private driver interface data
  1666. *
  1667. * This command can be used to cancel a remain-on-channel operation
  1668. * before its originally requested duration has passed. This could be
  1669. * used, e.g., when remain_on_channel() is used to request extra time
  1670. * to receive a response to an Action frame and the response is
  1671. * received when there is still unneeded time remaining on the
  1672. * remain-on-channel operation.
  1673. */
  1674. int (*cancel_remain_on_channel)(void *priv);
  1675. /**
  1676. * probe_req_report - Request Probe Request frames to be indicated
  1677. * @priv: Private driver interface data
  1678. * @report: Whether to report received Probe Request frames
  1679. * Returns: 0 on success, -1 on failure (or if not supported)
  1680. *
  1681. * This command can be used to request the driver to indicate when
  1682. * Probe Request frames are received with EVENT_RX_PROBE_REQ events.
  1683. * Since this operation may require extra resources, e.g., due to less
  1684. * optimal hardware/firmware RX filtering, many drivers may disable
  1685. * Probe Request reporting at least in station mode. This command is
  1686. * used to notify the driver when the Probe Request frames need to be
  1687. * reported, e.g., during remain-on-channel operations.
  1688. */
  1689. int (*probe_req_report)(void *priv, int report);
  1690. /**
  1691. * disable_11b_rates - Set whether IEEE 802.11b rates are used for TX
  1692. * @priv: Private driver interface data
  1693. * @disabled: Whether IEEE 802.11b rates are disabled
  1694. * Returns: 0 on success, -1 on failure (or if not supported)
  1695. *
  1696. * This command is used to disable IEEE 802.11b rates (1, 2, 5.5, and
  1697. * 11 Mbps) as TX rates for data and management frames. This can be
  1698. * used to optimize channel use when there is no need to support IEEE
  1699. * 802.11b-only devices.
  1700. */
  1701. int (*disable_11b_rates)(void *priv, int disabled);
  1702. /**
  1703. * deinit_ap - Deinitialize AP mode
  1704. * @priv: Private driver interface data
  1705. * Returns: 0 on success, -1 on failure (or if not supported)
  1706. *
  1707. * This optional function can be used to disable AP mode related
  1708. * configuration and change the driver mode to station mode to allow
  1709. * normal station operations like scanning to be completed.
  1710. */
  1711. int (*deinit_ap)(void *priv);
  1712. /**
  1713. * suspend - Notification on system suspend/hibernate event
  1714. * @priv: Private driver interface data
  1715. */
  1716. void (*suspend)(void *priv);
  1717. /**
  1718. * resume - Notification on system resume/thaw event
  1719. * @priv: Private driver interface data
  1720. */
  1721. void (*resume)(void *priv);
  1722. /**
  1723. * signal_monitor - Set signal monitoring parameters
  1724. * @priv: Private driver interface data
  1725. * @threshold: Threshold value for signal change events; 0 = disabled
  1726. * @hysteresis: Minimum change in signal strength before indicating a
  1727. * new event
  1728. * Returns: 0 on success, -1 on failure (or if not supported)
  1729. *
  1730. * This function can be used to configure monitoring of signal strength
  1731. * with the current AP. Whenever signal strength drops below the
  1732. * %threshold value or increases above it, EVENT_SIGNAL_CHANGE event
  1733. * should be generated assuming the signal strength has changed at
  1734. * least %hysteresis from the previously indicated signal change event.
  1735. */
  1736. int (*signal_monitor)(void *priv, int threshold, int hysteresis);
  1737. /**
  1738. * send_frame - Send IEEE 802.11 frame (testing use only)
  1739. * @priv: Private driver interface data
  1740. * @data: IEEE 802.11 frame with IEEE 802.11 header
  1741. * @data_len: Size of the frame
  1742. * @encrypt: Whether to encrypt the frame (if keys are set)
  1743. * Returns: 0 on success, -1 on failure
  1744. *
  1745. * This function is only used for debugging purposes and is not
  1746. * required to be implemented for normal operations.
  1747. */
  1748. int (*send_frame)(void *priv, const u8 *data, size_t data_len,
  1749. int encrypt);
  1750. /**
  1751. * shared_freq - Get operating frequency of shared interface(s)
  1752. * @priv: Private driver interface data
  1753. * Returns: Operating frequency in MHz, 0 if no shared operation in
  1754. * use, or -1 on failure
  1755. *
  1756. * This command can be used to request the current operating frequency
  1757. * of any virtual interface that shares the same radio to provide
  1758. * information for channel selection for other virtual interfaces.
  1759. */
  1760. int (*shared_freq)(void *priv);
  1761. /**
  1762. * get_noa - Get current Notice of Absence attribute payload
  1763. * @priv: Private driver interface data
  1764. * @buf: Buffer for returning NoA
  1765. * @buf_len: Buffer length in octets
  1766. * Returns: Number of octets used in buf, 0 to indicate no NoA is being
  1767. * advertized, or -1 on failure
  1768. *
  1769. * This function is used to fetch the current Notice of Absence
  1770. * attribute value from GO.
  1771. */
  1772. int (*get_noa)(void *priv, u8 *buf, size_t buf_len);
  1773. /**
  1774. * set_noa - Set Notice of Absence parameters for GO (testing)
  1775. * @priv: Private driver interface data
  1776. * @count: Count
  1777. * @start: Start time in ms from next TBTT
  1778. * @duration: Duration in ms
  1779. * Returns: 0 on success or -1 on failure
  1780. *
  1781. * This function is used to set Notice of Absence parameters for GO. It
  1782. * is used only for testing. To disable NoA, all parameters are set to
  1783. * 0.
  1784. */
  1785. int (*set_noa)(void *priv, u8 count, int start, int duration);
  1786. /**
  1787. * set_p2p_powersave - Set P2P power save options
  1788. * @priv: Private driver interface data
  1789. * @legacy_ps: 0 = disable, 1 = enable, 2 = maximum PS, -1 = no change
  1790. * @opp_ps: 0 = disable, 1 = enable, -1 = no change
  1791. * @ctwindow: 0.. = change (msec), -1 = no change
  1792. * Returns: 0 on success or -1 on failure
  1793. */
  1794. int (*set_p2p_powersave)(void *priv, int legacy_ps, int opp_ps,
  1795. int ctwindow);
  1796. /**
  1797. * ampdu - Enable/disable aggregation
  1798. * @priv: Private driver interface data
  1799. * @ampdu: 1/0 = enable/disable A-MPDU aggregation
  1800. * Returns: 0 on success or -1 on failure
  1801. */
  1802. int (*ampdu)(void *priv, int ampdu);
  1803. /**
  1804. * set_intra_bss - Enables/Disables intra BSS bridging
  1805. */
  1806. int (*set_intra_bss)(void *priv, int enabled);
  1807. /**
  1808. * get_radio_name - Get physical radio name for the device
  1809. * @priv: Private driver interface data
  1810. * Returns: Radio name or %NULL if not known
  1811. *
  1812. * The returned data must not be modified by the caller. It is assumed
  1813. * that any interface that has the same radio name as another is
  1814. * sharing the same physical radio. This information can be used to
  1815. * share scan results etc. information between the virtual interfaces
  1816. * to speed up various operations.
  1817. */
  1818. const char * (*get_radio_name)(void *priv);
  1819. /**
  1820. * p2p_find - Start P2P Device Discovery
  1821. * @priv: Private driver interface data
  1822. * @timeout: Timeout for find operation in seconds or 0 for no timeout
  1823. * @type: Device Discovery type (enum p2p_discovery_type)
  1824. * Returns: 0 on success, -1 on failure
  1825. *
  1826. * This function is only used if the driver implements P2P management,
  1827. * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
  1828. * struct wpa_driver_capa.
  1829. */
  1830. int (*p2p_find)(void *priv, unsigned int timeout, int type);
  1831. /**
  1832. * p2p_stop_find - Stop P2P Device Discovery
  1833. * @priv: Private driver interface data
  1834. * Returns: 0 on success, -1 on failure
  1835. *
  1836. * This function is only used if the driver implements P2P management,
  1837. * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
  1838. * struct wpa_driver_capa.
  1839. */
  1840. int (*p2p_stop_find)(void *priv);
  1841. /**
  1842. * p2p_listen - Start P2P Listen state for specified duration
  1843. * @priv: Private driver interface data
  1844. * @timeout: Listen state duration in milliseconds
  1845. * Returns: 0 on success, -1 on failure
  1846. *
  1847. * This function can be used to request the P2P module to keep the
  1848. * device discoverable on the listen channel for an extended set of
  1849. * time. At least in its current form, this is mainly used for testing
  1850. * purposes and may not be of much use for normal P2P operations.
  1851. *
  1852. * This function is only used if the driver implements P2P management,
  1853. * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
  1854. * struct wpa_driver_capa.
  1855. */
  1856. int (*p2p_listen)(void *priv, unsigned int timeout);
  1857. /**
  1858. * p2p_connect - Start P2P group formation (GO negotiation)
  1859. * @priv: Private driver interface data
  1860. * @peer_addr: MAC address of the peer P2P client
  1861. * @wps_method: enum p2p_wps_method value indicating config method
  1862. * @go_intent: Local GO intent value (1..15)
  1863. * @own_interface_addr: Intended interface address to use with the
  1864. * group
  1865. * @force_freq: The only allowed channel frequency in MHz or 0
  1866. * @persistent_group: Whether to create persistent group
  1867. * Returns: 0 on success, -1 on failure
  1868. *
  1869. * This function is only used if the driver implements P2P management,
  1870. * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
  1871. * struct wpa_driver_capa.
  1872. */
  1873. int (*p2p_connect)(void *priv, const u8 *peer_addr, int wps_method,
  1874. int go_intent, const u8 *own_interface_addr,
  1875. unsigned int force_freq, int persistent_group);
  1876. /**
  1877. * wps_success_cb - Report successfully completed WPS provisioning
  1878. * @priv: Private driver interface data
  1879. * @peer_addr: Peer address
  1880. * Returns: 0 on success, -1 on failure
  1881. *
  1882. * This function is used to report successfully completed WPS
  1883. * provisioning during group formation in both GO/Registrar and
  1884. * client/Enrollee roles.
  1885. *
  1886. * This function is only used if the driver implements P2P management,
  1887. * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
  1888. * struct wpa_driver_capa.
  1889. */
  1890. int (*wps_success_cb)(void *priv, const u8 *peer_addr);
  1891. /**
  1892. * p2p_group_formation_failed - Report failed WPS provisioning
  1893. * @priv: Private driver interface data
  1894. * Returns: 0 on success, -1 on failure
  1895. *
  1896. * This function is used to report failed group formation. This can
  1897. * happen either due to failed WPS provisioning or due to 15 second
  1898. * timeout during the provisioning phase.
  1899. *
  1900. * This function is only used if the driver implements P2P management,
  1901. * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
  1902. * struct wpa_driver_capa.
  1903. */
  1904. int (*p2p_group_formation_failed)(void *priv);
  1905. /**
  1906. * p2p_set_params - Set P2P parameters
  1907. * @priv: Private driver interface data
  1908. * @params: P2P parameters
  1909. * Returns: 0 on success, -1 on failure
  1910. *
  1911. * This function is only used if the driver implements P2P management,
  1912. * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
  1913. * struct wpa_driver_capa.
  1914. */
  1915. int (*p2p_set_params)(void *priv, const struct p2p_params *params);
  1916. /**
  1917. * p2p_prov_disc_req - Send Provision Discovery Request
  1918. * @priv: Private driver interface data
  1919. * @peer_addr: MAC address of the peer P2P client
  1920. * @config_methods: WPS Config Methods value (only one bit set)
  1921. * Returns: 0 on success, -1 on failure
  1922. *
  1923. * This function can be used to request a discovered P2P peer to
  1924. * display a PIN (config_methods = WPS_CONFIG_DISPLAY) or be prepared
  1925. * to enter a PIN from us (config_methods = WPS_CONFIG_KEYPAD). The
  1926. * Provision Discovery Request frame is transmitted once immediately
  1927. * and if no response is received, the frame will be sent again
  1928. * whenever the target device is discovered during device dsicovery
  1929. * (start with a p2p_find() call). Response from the peer is indicated
  1930. * with the EVENT_P2P_PROV_DISC_RESPONSE event.
  1931. *
  1932. * This function is only used if the driver implements P2P management,
  1933. * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
  1934. * struct wpa_driver_capa.
  1935. */
  1936. int (*p2p_prov_disc_req)(void *priv, const u8 *peer_addr,
  1937. u16 config_methods);
  1938. /**
  1939. * p2p_sd_request - Schedule a service discovery query
  1940. * @priv: Private driver interface data
  1941. * @dst: Destination peer or %NULL to apply for all peers
  1942. * @tlvs: P2P Service Query TLV(s)
  1943. * Returns: Reference to the query or 0 on failure
  1944. *
  1945. * Response to the query is indicated with the
  1946. * EVENT_P2P_SD_RESPONSE driver event.
  1947. *
  1948. * This function is only used if the driver implements P2P management,
  1949. * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
  1950. * struct wpa_driver_capa.
  1951. */
  1952. u64 (*p2p_sd_request)(void *priv, const u8 *dst,
  1953. const struct wpabuf *tlvs);
  1954. /**
  1955. * p2p_sd_cancel_request - Cancel a pending service discovery query
  1956. * @priv: Private driver interface data
  1957. * @req: Query reference from p2p_sd_request()
  1958. * Returns: 0 on success, -1 on failure
  1959. *
  1960. * This function is only used if the driver implements P2P management,
  1961. * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
  1962. * struct wpa_driver_capa.
  1963. */
  1964. int (*p2p_sd_cancel_request)(void *priv, u64 req);
  1965. /**
  1966. * p2p_sd_response - Send response to a service discovery query
  1967. * @priv: Private driver interface data
  1968. * @freq: Frequency from EVENT_P2P_SD_REQUEST event
  1969. * @dst: Destination address from EVENT_P2P_SD_REQUEST event
  1970. * @dialog_token: Dialog token from EVENT_P2P_SD_REQUEST event
  1971. * @resp_tlvs: P2P Service Response TLV(s)
  1972. * Returns: 0 on success, -1 on failure
  1973. *
  1974. * This function is called as a response to the request indicated with
  1975. * the EVENT_P2P_SD_REQUEST driver event.
  1976. *
  1977. * This function is only used if the driver implements P2P management,
  1978. * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
  1979. * struct wpa_driver_capa.
  1980. */
  1981. int (*p2p_sd_response)(void *priv, int freq, const u8 *dst,
  1982. u8 dialog_token,
  1983. const struct wpabuf *resp_tlvs);
  1984. /**
  1985. * p2p_service_update - Indicate a change in local services
  1986. * @priv: Private driver interface data
  1987. * Returns: 0 on success, -1 on failure
  1988. *
  1989. * This function needs to be called whenever there is a change in
  1990. * availability of the local services. This will increment the
  1991. * Service Update Indicator value which will be used in SD Request and
  1992. * Response frames.
  1993. *
  1994. * This function is only used if the driver implements P2P management,
  1995. * i.e., if it sets WPA_DRIVER_FLAGS_P2P_MGMT in
  1996. * struct wpa_driver_capa.
  1997. */
  1998. int (*p2p_service_update)(void *priv);
  1999. /**
  2000. * p2p_reject - Reject peer device (explicitly block connections)
  2001. * @priv: Private driver interface data
  2002. * @addr: MAC address of the peer
  2003. * Returns: 0 on success, -1 on failure
  2004. */
  2005. int (*p2p_reject)(void *priv, const u8 *addr);
  2006. /**
  2007. * p2p_invite - Invite a P2P Device into a group
  2008. * @priv: Private driver interface data
  2009. * @peer: Device Address of the peer P2P Device
  2010. * @role: Local role in the group
  2011. * @bssid: Group BSSID or %NULL if not known
  2012. * @ssid: Group SSID
  2013. * @ssid_len: Length of ssid in octets
  2014. * @go_dev_addr: Forced GO Device Address or %NULL if none
  2015. * @persistent_group: Whether this is to reinvoke a persistent group
  2016. * Returns: 0 on success, -1 on failure
  2017. */
  2018. int (*p2p_invite)(void *priv, const u8 *peer, int role,
  2019. const u8 *bssid, const u8 *ssid, size_t ssid_len,
  2020. const u8 *go_dev_addr, int persistent_group);
  2021. /**
  2022. * send_tdls_mgmt - for sending TDLS management packets
  2023. * @priv: private driver interface data
  2024. * @dst: Destination (peer) MAC address
  2025. * @action_code: TDLS action code for the mssage
  2026. * @dialog_token: Dialog Token to use in the message (if needed)
  2027. * @status_code: Status Code or Reason Code to use (if needed)
  2028. * @buf: TDLS IEs to add to the message
  2029. * @len: Length of buf in octets
  2030. * Returns: 0 on success, -1 on failure
  2031. *
  2032. * This optional function can be used to send packet to driver which is
  2033. * responsible for receiving and sending all TDLS packets.
  2034. */
  2035. int (*send_tdls_mgmt)(void *priv, const u8 *dst, u8 action_code,
  2036. u8 dialog_token, u16 status_code,
  2037. const u8 *buf, size_t len);
  2038. int (*tdls_oper)(void *priv, enum tdls_oper oper, const u8 *peer);
  2039. /**
  2040. * signal_poll - Get current connection information
  2041. * @priv: Private driver interface data
  2042. * @signal_info: Connection info structure
  2043. */
  2044. int (*signal_poll)(void *priv, struct wpa_signal_info *signal_info);
  2045. };
  2046. /**
  2047. * enum wpa_event_type - Event type for wpa_supplicant_event() calls
  2048. */
  2049. enum wpa_event_type {
  2050. /**
  2051. * EVENT_ASSOC - Association completed
  2052. *
  2053. * This event needs to be delivered when the driver completes IEEE
  2054. * 802.11 association or reassociation successfully.
  2055. * wpa_driver_ops::get_bssid() is expected to provide the current BSSID
  2056. * after this event has been generated. In addition, optional
  2057. * EVENT_ASSOCINFO may be generated just before EVENT_ASSOC to provide
  2058. * more information about the association. If the driver interface gets
  2059. * both of these events at the same time, it can also include the
  2060. * assoc_info data in EVENT_ASSOC call.
  2061. */
  2062. EVENT_ASSOC,
  2063. /**
  2064. * EVENT_DISASSOC - Association lost
  2065. *
  2066. * This event should be called when association is lost either due to
  2067. * receiving deauthenticate or disassociate frame from the AP or when
  2068. * sending either of these frames to the current AP. If the driver
  2069. * supports separate deauthentication event, EVENT_DISASSOC should only
  2070. * be used for disassociation and EVENT_DEAUTH for deauthentication.
  2071. * In AP mode, union wpa_event_data::disassoc_info is required.
  2072. */
  2073. EVENT_DISASSOC,
  2074. /**
  2075. * EVENT_MICHAEL_MIC_FAILURE - Michael MIC (TKIP) detected
  2076. *
  2077. * This event must be delivered when a Michael MIC error is detected by
  2078. * the local driver. Additional data for event processing is
  2079. * provided with union wpa_event_data::michael_mic_failure. This
  2080. * information is used to request new encyption key and to initiate
  2081. * TKIP countermeasures if needed.
  2082. */
  2083. EVENT_MICHAEL_MIC_FAILURE,
  2084. /**
  2085. * EVENT_SCAN_RESULTS - Scan results available
  2086. *
  2087. * This event must be called whenever scan results are available to be
  2088. * fetched with struct wpa_driver_ops::get_scan_results(). This event
  2089. * is expected to be used some time after struct wpa_driver_ops::scan()
  2090. * is called. If the driver provides an unsolicited event when the scan
  2091. * has been completed, this event can be used to trigger
  2092. * EVENT_SCAN_RESULTS call. If such event is not available from the
  2093. * driver, the driver wrapper code is expected to use a registered
  2094. * timeout to generate EVENT_SCAN_RESULTS call after the time that the
  2095. * scan is expected to be completed. Optional information about
  2096. * completed scan can be provided with union wpa_event_data::scan_info.
  2097. */
  2098. EVENT_SCAN_RESULTS,
  2099. /**
  2100. * EVENT_ASSOCINFO - Report optional extra information for association
  2101. *
  2102. * This event can be used to report extra association information for
  2103. * EVENT_ASSOC processing. This extra information includes IEs from
  2104. * association frames and Beacon/Probe Response frames in union
  2105. * wpa_event_data::assoc_info. EVENT_ASSOCINFO must be send just before
  2106. * EVENT_ASSOC. Alternatively, the driver interface can include
  2107. * assoc_info data in the EVENT_ASSOC call if it has all the
  2108. * information available at the same point.
  2109. */
  2110. EVENT_ASSOCINFO,
  2111. /**
  2112. * EVENT_INTERFACE_STATUS - Report interface status changes
  2113. *
  2114. * This optional event can be used to report changes in interface
  2115. * status (interface added/removed) using union
  2116. * wpa_event_data::interface_status. This can be used to trigger
  2117. * wpa_supplicant to stop and re-start processing for the interface,
  2118. * e.g., when a cardbus card is ejected/inserted.
  2119. */
  2120. EVENT_INTERFACE_STATUS,
  2121. /**
  2122. * EVENT_PMKID_CANDIDATE - Report a candidate AP for pre-authentication
  2123. *
  2124. * This event can be used to inform wpa_supplicant about candidates for
  2125. * RSN (WPA2) pre-authentication. If wpa_supplicant is not responsible
  2126. * for scan request (ap_scan=2 mode), this event is required for
  2127. * pre-authentication. If wpa_supplicant is performing scan request
  2128. * (ap_scan=1), this event is optional since scan results can be used
  2129. * to add pre-authentication candidates. union
  2130. * wpa_event_data::pmkid_candidate is used to report the BSSID of the
  2131. * candidate and priority of the candidate, e.g., based on the signal
  2132. * strength, in order to try to pre-authenticate first with candidates
  2133. * that are most likely targets for re-association.
  2134. *
  2135. * EVENT_PMKID_CANDIDATE can be called whenever the driver has updates
  2136. * on the candidate list. In addition, it can be called for the current
  2137. * AP and APs that have existing PMKSA cache entries. wpa_supplicant
  2138. * will automatically skip pre-authentication in cases where a valid
  2139. * PMKSA exists. When more than one candidate exists, this event should
  2140. * be generated once for each candidate.
  2141. *
  2142. * Driver will be notified about successful pre-authentication with
  2143. * struct wpa_driver_ops::add_pmkid() calls.
  2144. */
  2145. EVENT_PMKID_CANDIDATE,
  2146. /**
  2147. * EVENT_STKSTART - Request STK handshake (MLME-STKSTART.request)
  2148. *
  2149. * This event can be used to inform wpa_supplicant about desire to set
  2150. * up secure direct link connection between two stations as defined in
  2151. * IEEE 802.11e with a new PeerKey mechanism that replaced the original
  2152. * STAKey negotiation. The caller will need to set peer address for the
  2153. * event.
  2154. */
  2155. EVENT_STKSTART,
  2156. /**
  2157. * EVENT_TDLS - Request TDLS operation
  2158. *
  2159. * This event can be used to request a TDLS operation to be performed.
  2160. */
  2161. EVENT_TDLS,
  2162. /**
  2163. * EVENT_FT_RESPONSE - Report FT (IEEE 802.11r) response IEs
  2164. *
  2165. * The driver is expected to report the received FT IEs from
  2166. * FT authentication sequence from the AP. The FT IEs are included in
  2167. * the extra information in union wpa_event_data::ft_ies.
  2168. */
  2169. EVENT_FT_RESPONSE,
  2170. /**
  2171. * EVENT_IBSS_RSN_START - Request RSN authentication in IBSS
  2172. *
  2173. * The driver can use this event to inform wpa_supplicant about a STA
  2174. * in an IBSS with which protected frames could be exchanged. This
  2175. * event starts RSN authentication with the other STA to authenticate
  2176. * the STA and set up encryption keys with it.
  2177. */
  2178. EVENT_IBSS_RSN_START,
  2179. /**
  2180. * EVENT_AUTH - Authentication result
  2181. *
  2182. * This event should be called when authentication attempt has been
  2183. * completed. This is only used if the driver supports separate
  2184. * authentication step (struct wpa_driver_ops::authenticate).
  2185. * Information about authentication result is included in
  2186. * union wpa_event_data::auth.
  2187. */
  2188. EVENT_AUTH,
  2189. /**
  2190. * EVENT_DEAUTH - Authentication lost
  2191. *
  2192. * This event should be called when authentication is lost either due
  2193. * to receiving deauthenticate frame from the AP or when sending that
  2194. * frame to the current AP.
  2195. * In AP mode, union wpa_event_data::deauth_info is required.
  2196. */
  2197. EVENT_DEAUTH,
  2198. /**
  2199. * EVENT_ASSOC_REJECT - Association rejected
  2200. *
  2201. * This event should be called when (re)association attempt has been
  2202. * rejected by the AP. Information about the association response is
  2203. * included in union wpa_event_data::assoc_reject.
  2204. */
  2205. EVENT_ASSOC_REJECT,
  2206. /**
  2207. * EVENT_AUTH_TIMED_OUT - Authentication timed out
  2208. */
  2209. EVENT_AUTH_TIMED_OUT,
  2210. /**
  2211. * EVENT_ASSOC_TIMED_OUT - Association timed out
  2212. */
  2213. EVENT_ASSOC_TIMED_OUT,
  2214. /**
  2215. * EVENT_FT_RRB_RX - FT (IEEE 802.11r) RRB frame received
  2216. */
  2217. EVENT_FT_RRB_RX,
  2218. /**
  2219. * EVENT_WPS_BUTTON_PUSHED - Report hardware push button press for WPS
  2220. */
  2221. EVENT_WPS_BUTTON_PUSHED,
  2222. /**
  2223. * EVENT_TX_STATUS - Report TX status
  2224. */
  2225. EVENT_TX_STATUS,
  2226. /**
  2227. * EVENT_RX_FROM_UNKNOWN - Report RX from unknown STA
  2228. */
  2229. EVENT_RX_FROM_UNKNOWN,
  2230. /**
  2231. * EVENT_RX_MGMT - Report RX of a management frame
  2232. */
  2233. EVENT_RX_MGMT,
  2234. /**
  2235. * EVENT_RX_ACTION - Action frame received
  2236. *
  2237. * This event is used to indicate when an Action frame has been
  2238. * received. Information about the received frame is included in
  2239. * union wpa_event_data::rx_action.
  2240. */
  2241. EVENT_RX_ACTION,
  2242. /**
  2243. * EVENT_REMAIN_ON_CHANNEL - Remain-on-channel duration started
  2244. *
  2245. * This event is used to indicate when the driver has started the
  2246. * requested remain-on-channel duration. Information about the
  2247. * operation is included in union wpa_event_data::remain_on_channel.
  2248. */
  2249. EVENT_REMAIN_ON_CHANNEL,
  2250. /**
  2251. * EVENT_CANCEL_REMAIN_ON_CHANNEL - Remain-on-channel timed out
  2252. *
  2253. * This event is used to indicate when the driver has completed
  2254. * remain-on-channel duration, i.e., may noot be available on the
  2255. * requested channel anymore. Information about the
  2256. * operation is included in union wpa_event_data::remain_on_channel.
  2257. */
  2258. EVENT_CANCEL_REMAIN_ON_CHANNEL,
  2259. /**
  2260. * EVENT_MLME_RX - Report reception of frame for MLME (test use only)
  2261. *
  2262. * This event is used only by driver_test.c and userspace MLME.
  2263. */
  2264. EVENT_MLME_RX,
  2265. /**
  2266. * EVENT_RX_PROBE_REQ - Indicate received Probe Request frame
  2267. *
  2268. * This event is used to indicate when a Probe Request frame has been
  2269. * received. Information about the received frame is included in
  2270. * union wpa_event_data::rx_probe_req. The driver is required to report
  2271. * these events only after successfully completed probe_req_report()
  2272. * commands to request the events (i.e., report parameter is non-zero)
  2273. * in station mode. In AP mode, Probe Request frames should always be
  2274. * reported.
  2275. */
  2276. EVENT_RX_PROBE_REQ,
  2277. /**
  2278. * EVENT_NEW_STA - New wired device noticed
  2279. *
  2280. * This event is used to indicate that a new device has been detected
  2281. * in a network that does not use association-like functionality (i.e.,
  2282. * mainly wired Ethernet). This can be used to start EAPOL
  2283. * authenticator when receiving a frame from a device. The address of
  2284. * the device is included in union wpa_event_data::new_sta.
  2285. */
  2286. EVENT_NEW_STA,
  2287. /**
  2288. * EVENT_EAPOL_RX - Report received EAPOL frame
  2289. *
  2290. * When in AP mode with hostapd, this event is required to be used to
  2291. * deliver the receive EAPOL frames from the driver. With
  2292. * %wpa_supplicant, this event is used only if the send_eapol() handler
  2293. * is used to override the use of l2_packet for EAPOL frame TX.
  2294. */
  2295. EVENT_EAPOL_RX,
  2296. /**
  2297. * EVENT_SIGNAL_CHANGE - Indicate change in signal strength
  2298. *
  2299. * This event is used to indicate changes in the signal strength
  2300. * observed in frames received from the current AP if signal strength
  2301. * monitoring has been enabled with signal_monitor().
  2302. */
  2303. EVENT_SIGNAL_CHANGE,
  2304. /**
  2305. * EVENT_INTERFACE_ENABLED - Notify that interface was enabled
  2306. *
  2307. * This event is used to indicate that the interface was enabled after
  2308. * having been previously disabled, e.g., due to rfkill.
  2309. */
  2310. EVENT_INTERFACE_ENABLED,
  2311. /**
  2312. * EVENT_INTERFACE_DISABLED - Notify that interface was disabled
  2313. *
  2314. * This event is used to indicate that the interface was disabled,
  2315. * e.g., due to rfkill.
  2316. */
  2317. EVENT_INTERFACE_DISABLED,
  2318. /**
  2319. * EVENT_CHANNEL_LIST_CHANGED - Channel list changed
  2320. *
  2321. * This event is used to indicate that the channel list has changed,
  2322. * e.g., because of a regulatory domain change triggered by scan
  2323. * results including an AP advertising a country code.
  2324. */
  2325. EVENT_CHANNEL_LIST_CHANGED,
  2326. /**
  2327. * EVENT_INTERFACE_UNAVAILABLE - Notify that interface is unavailable
  2328. *
  2329. * This event is used to indicate that the driver cannot maintain this
  2330. * interface in its operation mode anymore. The most likely use for
  2331. * this is to indicate that AP mode operation is not available due to
  2332. * operating channel would need to be changed to a DFS channel when
  2333. * the driver does not support radar detection and another virtual
  2334. * interfaces caused the operating channel to change. Other similar
  2335. * resource conflicts could also trigger this for station mode
  2336. * interfaces.
  2337. */
  2338. EVENT_INTERFACE_UNAVAILABLE,
  2339. /**
  2340. * EVENT_BEST_CHANNEL
  2341. *
  2342. * Driver generates this event whenever it detects a better channel
  2343. * (e.g., based on RSSI or channel use). This information can be used
  2344. * to improve channel selection for a new AP/P2P group.
  2345. */
  2346. EVENT_BEST_CHANNEL,
  2347. /**
  2348. * EVENT_UNPROT_DEAUTH - Unprotected Deauthentication frame received
  2349. *
  2350. * This event should be called when a Deauthentication frame is dropped
  2351. * due to it not being protected (MFP/IEEE 802.11w).
  2352. * union wpa_event_data::unprot_deauth is required to provide more
  2353. * details of the frame.
  2354. */
  2355. EVENT_UNPROT_DEAUTH,
  2356. /**
  2357. * EVENT_UNPROT_DISASSOC - Unprotected Disassociation frame received
  2358. *
  2359. * This event should be called when a Disassociation frame is dropped
  2360. * due to it not being protected (MFP/IEEE 802.11w).
  2361. * union wpa_event_data::unprot_disassoc is required to provide more
  2362. * details of the frame.
  2363. */
  2364. EVENT_UNPROT_DISASSOC,
  2365. /**
  2366. * EVENT_STATION_LOW_ACK
  2367. *
  2368. * Driver generates this event whenever it detected that a particular
  2369. * station was lost. Detection can be through massive transmission
  2370. * failures for example.
  2371. */
  2372. EVENT_STATION_LOW_ACK,
  2373. /**
  2374. * EVENT_P2P_DEV_FOUND - Report a discovered P2P device
  2375. *
  2376. * This event is used only if the driver implements P2P management
  2377. * internally. Event data is stored in
  2378. * union wpa_event_data::p2p_dev_found.
  2379. */
  2380. EVENT_P2P_DEV_FOUND,
  2381. /**
  2382. * EVENT_P2P_GO_NEG_REQ_RX - Report reception of GO Negotiation Request
  2383. *
  2384. * This event is used only if the driver implements P2P management
  2385. * internally. Event data is stored in
  2386. * union wpa_event_data::p2p_go_neg_req_rx.
  2387. */
  2388. EVENT_P2P_GO_NEG_REQ_RX,
  2389. /**
  2390. * EVENT_P2P_GO_NEG_COMPLETED - Report completion of GO Negotiation
  2391. *
  2392. * This event is used only if the driver implements P2P management
  2393. * internally. Event data is stored in
  2394. * union wpa_event_data::p2p_go_neg_completed.
  2395. */
  2396. EVENT_P2P_GO_NEG_COMPLETED,
  2397. EVENT_P2P_PROV_DISC_REQUEST,
  2398. EVENT_P2P_PROV_DISC_RESPONSE,
  2399. EVENT_P2P_SD_REQUEST,
  2400. EVENT_P2P_SD_RESPONSE,
  2401. /**
  2402. * EVENT_IBSS_PEER_LOST - IBSS peer not reachable anymore
  2403. */
  2404. EVENT_IBSS_PEER_LOST
  2405. };
  2406. /**
  2407. * union wpa_event_data - Additional data for wpa_supplicant_event() calls
  2408. */
  2409. union wpa_event_data {
  2410. /**
  2411. * struct assoc_info - Data for EVENT_ASSOC and EVENT_ASSOCINFO events
  2412. *
  2413. * This structure is optional for EVENT_ASSOC calls and required for
  2414. * EVENT_ASSOCINFO calls. By using EVENT_ASSOC with this data, the
  2415. * driver interface does not need to generate separate EVENT_ASSOCINFO
  2416. * calls.
  2417. */
  2418. struct assoc_info {
  2419. /**
  2420. * reassoc - Flag to indicate association or reassociation
  2421. */
  2422. int reassoc;
  2423. /**
  2424. * req_ies - (Re)Association Request IEs
  2425. *
  2426. * If the driver generates WPA/RSN IE, this event data must be
  2427. * returned for WPA handshake to have needed information. If
  2428. * wpa_supplicant-generated WPA/RSN IE is used, this
  2429. * information event is optional.
  2430. *
  2431. * This should start with the first IE (fixed fields before IEs
  2432. * are not included).
  2433. */
  2434. const u8 *req_ies;
  2435. /**
  2436. * req_ies_len - Length of req_ies in bytes
  2437. */
  2438. size_t req_ies_len;
  2439. /**
  2440. * resp_ies - (Re)Association Response IEs
  2441. *
  2442. * Optional association data from the driver. This data is not
  2443. * required WPA, but may be useful for some protocols and as
  2444. * such, should be reported if this is available to the driver
  2445. * interface.
  2446. *
  2447. * This should start with the first IE (fixed fields before IEs
  2448. * are not included).
  2449. */
  2450. const u8 *resp_ies;
  2451. /**
  2452. * resp_ies_len - Length of resp_ies in bytes
  2453. */
  2454. size_t resp_ies_len;
  2455. /**
  2456. * beacon_ies - Beacon or Probe Response IEs
  2457. *
  2458. * Optional Beacon/ProbeResp data: IEs included in Beacon or
  2459. * Probe Response frames from the current AP (i.e., the one
  2460. * that the client just associated with). This information is
  2461. * used to update WPA/RSN IE for the AP. If this field is not
  2462. * set, the results from previous scan will be used. If no
  2463. * data for the new AP is found, scan results will be requested
  2464. * again (without scan request). At this point, the driver is
  2465. * expected to provide WPA/RSN IE for the AP (if WPA/WPA2 is
  2466. * used).
  2467. *
  2468. * This should start with the first IE (fixed fields before IEs
  2469. * are not included).
  2470. */
  2471. const u8 *beacon_ies;
  2472. /**
  2473. * beacon_ies_len - Length of beacon_ies */
  2474. size_t beacon_ies_len;
  2475. /**
  2476. * freq - Frequency of the operational channel in MHz
  2477. */
  2478. unsigned int freq;
  2479. /**
  2480. * addr - Station address (for AP mode)
  2481. */
  2482. const u8 *addr;
  2483. } assoc_info;
  2484. /**
  2485. * struct disassoc_info - Data for EVENT_DISASSOC events
  2486. */
  2487. struct disassoc_info {
  2488. /**
  2489. * addr - Station address (for AP mode)
  2490. */
  2491. const u8 *addr;
  2492. /**
  2493. * reason_code - Reason Code (host byte order) used in
  2494. * Deauthentication frame
  2495. */
  2496. u16 reason_code;
  2497. /**
  2498. * ie - Optional IE(s) in Disassociation frame
  2499. */
  2500. const u8 *ie;
  2501. /**
  2502. * ie_len - Length of ie buffer in octets
  2503. */
  2504. size_t ie_len;
  2505. } disassoc_info;
  2506. /**
  2507. * struct deauth_info - Data for EVENT_DEAUTH events
  2508. */
  2509. struct deauth_info {
  2510. /**
  2511. * addr - Station address (for AP mode)
  2512. */
  2513. const u8 *addr;
  2514. /**
  2515. * reason_code - Reason Code (host byte order) used in
  2516. * Deauthentication frame
  2517. */
  2518. u16 reason_code;
  2519. /**
  2520. * ie - Optional IE(s) in Deauthentication frame
  2521. */
  2522. const u8 *ie;
  2523. /**
  2524. * ie_len - Length of ie buffer in octets
  2525. */
  2526. size_t ie_len;
  2527. } deauth_info;
  2528. /**
  2529. * struct michael_mic_failure - Data for EVENT_MICHAEL_MIC_FAILURE
  2530. */
  2531. struct michael_mic_failure {
  2532. int unicast;
  2533. const u8 *src;
  2534. } michael_mic_failure;
  2535. /**
  2536. * struct interface_status - Data for EVENT_INTERFACE_STATUS
  2537. */
  2538. struct interface_status {
  2539. char ifname[100];
  2540. enum {
  2541. EVENT_INTERFACE_ADDED, EVENT_INTERFACE_REMOVED
  2542. } ievent;
  2543. } interface_status;
  2544. /**
  2545. * struct pmkid_candidate - Data for EVENT_PMKID_CANDIDATE
  2546. */
  2547. struct pmkid_candidate {
  2548. /** BSSID of the PMKID candidate */
  2549. u8 bssid[ETH_ALEN];
  2550. /** Smaller the index, higher the priority */
  2551. int index;
  2552. /** Whether RSN IE includes pre-authenticate flag */
  2553. int preauth;
  2554. } pmkid_candidate;
  2555. /**
  2556. * struct stkstart - Data for EVENT_STKSTART
  2557. */
  2558. struct stkstart {
  2559. u8 peer[ETH_ALEN];
  2560. } stkstart;
  2561. /**
  2562. * struct tdls - Data for EVENT_TDLS
  2563. */
  2564. struct tdls {
  2565. u8 peer[ETH_ALEN];
  2566. enum {
  2567. TDLS_REQUEST_SETUP,
  2568. TDLS_REQUEST_TEARDOWN
  2569. } oper;
  2570. u16 reason_code; /* for teardown */
  2571. } tdls;
  2572. /**
  2573. * struct ft_ies - FT information elements (EVENT_FT_RESPONSE)
  2574. *
  2575. * During FT (IEEE 802.11r) authentication sequence, the driver is
  2576. * expected to use this event to report received FT IEs (MDIE, FTIE,
  2577. * RSN IE, TIE, possible resource request) to the supplicant. The FT
  2578. * IEs for the next message will be delivered through the
  2579. * struct wpa_driver_ops::update_ft_ies() callback.
  2580. */
  2581. struct ft_ies {
  2582. const u8 *ies;
  2583. size_t ies_len;
  2584. int ft_action;
  2585. u8 target_ap[ETH_ALEN];
  2586. /** Optional IE(s), e.g., WMM TSPEC(s), for RIC-Request */
  2587. const u8 *ric_ies;
  2588. /** Length of ric_ies buffer in octets */
  2589. size_t ric_ies_len;
  2590. } ft_ies;
  2591. /**
  2592. * struct ibss_rsn_start - Data for EVENT_IBSS_RSN_START
  2593. */
  2594. struct ibss_rsn_start {
  2595. u8 peer[ETH_ALEN];
  2596. } ibss_rsn_start;
  2597. /**
  2598. * struct auth_info - Data for EVENT_AUTH events
  2599. */
  2600. struct auth_info {
  2601. u8 peer[ETH_ALEN];
  2602. u16 auth_type;
  2603. u16 status_code;
  2604. const u8 *ies;
  2605. size_t ies_len;
  2606. } auth;
  2607. /**
  2608. * struct assoc_reject - Data for EVENT_ASSOC_REJECT events
  2609. */
  2610. struct assoc_reject {
  2611. /**
  2612. * bssid - BSSID of the AP that rejected association
  2613. */
  2614. const u8 *bssid;
  2615. /**
  2616. * resp_ies - (Re)Association Response IEs
  2617. *
  2618. * Optional association data from the driver. This data is not
  2619. * required WPA, but may be useful for some protocols and as
  2620. * such, should be reported if this is available to the driver
  2621. * interface.
  2622. *
  2623. * This should start with the first IE (fixed fields before IEs
  2624. * are not included).
  2625. */
  2626. const u8 *resp_ies;
  2627. /**
  2628. * resp_ies_len - Length of resp_ies in bytes
  2629. */
  2630. size_t resp_ies_len;
  2631. /**
  2632. * status_code - Status Code from (Re)association Response
  2633. */
  2634. u16 status_code;
  2635. } assoc_reject;
  2636. struct timeout_event {
  2637. u8 addr[ETH_ALEN];
  2638. } timeout_event;
  2639. /**
  2640. * struct ft_rrb_rx - Data for EVENT_FT_RRB_RX events
  2641. */
  2642. struct ft_rrb_rx {
  2643. const u8 *src;
  2644. const u8 *data;
  2645. size_t data_len;
  2646. } ft_rrb_rx;
  2647. /**
  2648. * struct tx_status - Data for EVENT_TX_STATUS events
  2649. */
  2650. struct tx_status {
  2651. u16 type;
  2652. u16 stype;
  2653. const u8 *dst;
  2654. const u8 *data;
  2655. size_t data_len;
  2656. int ack;
  2657. } tx_status;
  2658. /**
  2659. * struct rx_from_unknown - Data for EVENT_RX_FROM_UNKNOWN events
  2660. */
  2661. struct rx_from_unknown {
  2662. const u8 *frame;
  2663. size_t len;
  2664. } rx_from_unknown;
  2665. /**
  2666. * struct rx_mgmt - Data for EVENT_RX_MGMT events
  2667. */
  2668. struct rx_mgmt {
  2669. const u8 *frame;
  2670. size_t frame_len;
  2671. u32 datarate;
  2672. u32 ssi_signal;
  2673. } rx_mgmt;
  2674. /**
  2675. * struct rx_action - Data for EVENT_RX_ACTION events
  2676. */
  2677. struct rx_action {
  2678. /**
  2679. * da - Destination address of the received Action frame
  2680. */
  2681. const u8 *da;
  2682. /**
  2683. * sa - Source address of the received Action frame
  2684. */
  2685. const u8 *sa;
  2686. /**
  2687. * bssid - Address 3 of the received Action frame
  2688. */
  2689. const u8 *bssid;
  2690. /**
  2691. * category - Action frame category
  2692. */
  2693. u8 category;
  2694. /**
  2695. * data - Action frame body after category field
  2696. */
  2697. const u8 *data;
  2698. /**
  2699. * len - Length of data in octets
  2700. */
  2701. size_t len;
  2702. /**
  2703. * freq - Frequency (in MHz) on which the frame was received
  2704. */
  2705. int freq;
  2706. } rx_action;
  2707. /**
  2708. * struct remain_on_channel - Data for EVENT_REMAIN_ON_CHANNEL events
  2709. *
  2710. * This is also used with EVENT_CANCEL_REMAIN_ON_CHANNEL events.
  2711. */
  2712. struct remain_on_channel {
  2713. /**
  2714. * freq - Channel frequency in MHz
  2715. */
  2716. unsigned int freq;
  2717. /**
  2718. * duration - Duration to remain on the channel in milliseconds
  2719. */
  2720. unsigned int duration;
  2721. } remain_on_channel;
  2722. /**
  2723. * struct scan_info - Optional data for EVENT_SCAN_RESULTS events
  2724. * @aborted: Whether the scan was aborted
  2725. * @freqs: Scanned frequencies in MHz (%NULL = all channels scanned)
  2726. * @num_freqs: Number of entries in freqs array
  2727. * @ssids: Scanned SSIDs (%NULL or zero-length SSID indicates wildcard
  2728. * SSID)
  2729. * @num_ssids: Number of entries in ssids array
  2730. */
  2731. struct scan_info {
  2732. int aborted;
  2733. const int *freqs;
  2734. size_t num_freqs;
  2735. struct wpa_driver_scan_ssid ssids[WPAS_MAX_SCAN_SSIDS];
  2736. size_t num_ssids;
  2737. } scan_info;
  2738. /**
  2739. * struct mlme_rx - Data for EVENT_MLME_RX events
  2740. */
  2741. struct mlme_rx {
  2742. const u8 *buf;
  2743. size_t len;
  2744. int freq;
  2745. int channel;
  2746. int ssi;
  2747. } mlme_rx;
  2748. /**
  2749. * struct rx_probe_req - Data for EVENT_RX_PROBE_REQ events
  2750. */
  2751. struct rx_probe_req {
  2752. /**
  2753. * sa - Source address of the received Probe Request frame
  2754. */
  2755. const u8 *sa;
  2756. /**
  2757. * ie - IEs from the Probe Request body
  2758. */
  2759. const u8 *ie;
  2760. /**
  2761. * ie_len - Length of ie buffer in octets
  2762. */
  2763. size_t ie_len;
  2764. } rx_probe_req;
  2765. /**
  2766. * struct new_sta - Data for EVENT_NEW_STA events
  2767. */
  2768. struct new_sta {
  2769. const u8 *addr;
  2770. } new_sta;
  2771. /**
  2772. * struct eapol_rx - Data for EVENT_EAPOL_RX events
  2773. */
  2774. struct eapol_rx {
  2775. const u8 *src;
  2776. const u8 *data;
  2777. size_t data_len;
  2778. } eapol_rx;
  2779. /**
  2780. * signal_change - Data for EVENT_SIGNAL_CHANGE events
  2781. */
  2782. struct wpa_signal_info signal_change;
  2783. /**
  2784. * struct best_channel - Data for EVENT_BEST_CHANNEL events
  2785. * @freq_24: Best 2.4 GHz band channel frequency in MHz
  2786. * @freq_5: Best 5 GHz band channel frequency in MHz
  2787. * @freq_overall: Best channel frequency in MHz
  2788. *
  2789. * 0 can be used to indicate no preference in either band.
  2790. */
  2791. struct best_channel {
  2792. int freq_24;
  2793. int freq_5;
  2794. int freq_overall;
  2795. } best_chan;
  2796. struct unprot_deauth {
  2797. const u8 *sa;
  2798. const u8 *da;
  2799. u16 reason_code;
  2800. } unprot_deauth;
  2801. struct unprot_disassoc {
  2802. const u8 *sa;
  2803. const u8 *da;
  2804. u16 reason_code;
  2805. } unprot_disassoc;
  2806. /**
  2807. * struct low_ack - Data for EVENT_STATION_LOW_ACK events
  2808. * @addr: station address
  2809. */
  2810. struct low_ack {
  2811. u8 addr[ETH_ALEN];
  2812. } low_ack;
  2813. /**
  2814. * struct p2p_dev_found - Data for EVENT_P2P_DEV_FOUND
  2815. */
  2816. struct p2p_dev_found {
  2817. const u8 *addr;
  2818. const u8 *dev_addr;
  2819. const u8 *pri_dev_type;
  2820. const char *dev_name;
  2821. u16 config_methods;
  2822. u8 dev_capab;
  2823. u8 group_capab;
  2824. } p2p_dev_found;
  2825. /**
  2826. * struct p2p_go_neg_req_rx - Data for EVENT_P2P_GO_NEG_REQ_RX
  2827. */
  2828. struct p2p_go_neg_req_rx {
  2829. const u8 *src;
  2830. u16 dev_passwd_id;
  2831. } p2p_go_neg_req_rx;
  2832. /**
  2833. * struct p2p_go_neg_completed - Data for EVENT_P2P_GO_NEG_COMPLETED
  2834. */
  2835. struct p2p_go_neg_completed {
  2836. struct p2p_go_neg_results *res;
  2837. } p2p_go_neg_completed;
  2838. struct p2p_prov_disc_req {
  2839. const u8 *peer;
  2840. u16 config_methods;
  2841. const u8 *dev_addr;
  2842. const u8 *pri_dev_type;
  2843. const char *dev_name;
  2844. u16 supp_config_methods;
  2845. u8 dev_capab;
  2846. u8 group_capab;
  2847. } p2p_prov_disc_req;
  2848. struct p2p_prov_disc_resp {
  2849. const u8 *peer;
  2850. u16 config_methods;
  2851. } p2p_prov_disc_resp;
  2852. struct p2p_sd_req {
  2853. int freq;
  2854. const u8 *sa;
  2855. u8 dialog_token;
  2856. u16 update_indic;
  2857. const u8 *tlvs;
  2858. size_t tlvs_len;
  2859. } p2p_sd_req;
  2860. struct p2p_sd_resp {
  2861. const u8 *sa;
  2862. u16 update_indic;
  2863. const u8 *tlvs;
  2864. size_t tlvs_len;
  2865. } p2p_sd_resp;
  2866. /**
  2867. * struct ibss_peer_lost - Data for EVENT_IBSS_PEER_LOST
  2868. */
  2869. struct ibss_peer_lost {
  2870. u8 peer[ETH_ALEN];
  2871. } ibss_peer_lost;
  2872. };
  2873. /**
  2874. * wpa_supplicant_event - Report a driver event for wpa_supplicant
  2875. * @ctx: Context pointer (wpa_s); this is the ctx variable registered
  2876. * with struct wpa_driver_ops::init()
  2877. * @event: event type (defined above)
  2878. * @data: possible extra data for the event
  2879. *
  2880. * Driver wrapper code should call this function whenever an event is received
  2881. * from the driver.
  2882. */
  2883. void wpa_supplicant_event(void *ctx, enum wpa_event_type event,
  2884. union wpa_event_data *data);
  2885. /*
  2886. * The following inline functions are provided for convenience to simplify
  2887. * event indication for some of the common events.
  2888. */
  2889. static inline void drv_event_assoc(void *ctx, const u8 *addr, const u8 *ie,
  2890. size_t ielen, int reassoc)
  2891. {
  2892. union wpa_event_data event;
  2893. os_memset(&event, 0, sizeof(event));
  2894. event.assoc_info.reassoc = reassoc;
  2895. event.assoc_info.req_ies = ie;
  2896. event.assoc_info.req_ies_len = ielen;
  2897. event.assoc_info.addr = addr;
  2898. wpa_supplicant_event(ctx, EVENT_ASSOC, &event);
  2899. }
  2900. static inline void drv_event_disassoc(void *ctx, const u8 *addr)
  2901. {
  2902. union wpa_event_data event;
  2903. os_memset(&event, 0, sizeof(event));
  2904. event.disassoc_info.addr = addr;
  2905. wpa_supplicant_event(ctx, EVENT_DISASSOC, &event);
  2906. }
  2907. static inline void drv_event_eapol_rx(void *ctx, const u8 *src, const u8 *data,
  2908. size_t data_len)
  2909. {
  2910. union wpa_event_data event;
  2911. os_memset(&event, 0, sizeof(event));
  2912. event.eapol_rx.src = src;
  2913. event.eapol_rx.data = data;
  2914. event.eapol_rx.data_len = data_len;
  2915. wpa_supplicant_event(ctx, EVENT_EAPOL_RX, &event);
  2916. }
  2917. #endif /* DRIVER_H */