driver.h 137 KB

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