driver.h 115 KB

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