driver.h 150 KB

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