driver.h 117 KB

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