driver.h 126 KB

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