driver.h 113 KB

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