driver.h 107 KB

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