driver.h 98 KB

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