driver.h 108 KB

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