driver.h 150 KB

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