driver.h 131 KB

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