driver.h 59 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778
  1. /*
  2. * WPA Supplicant - driver interface definition
  3. * Copyright (c) 2003-2009, 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. #ifndef DRIVER_H
  15. #define DRIVER_H
  16. #define WPA_SUPPLICANT_DRIVER_VERSION 3
  17. #include "defs.h"
  18. #define HOSTAPD_CHAN_DISABLED 0x00000001
  19. #define HOSTAPD_CHAN_PASSIVE_SCAN 0x00000002
  20. #define HOSTAPD_CHAN_NO_IBSS 0x00000004
  21. #define HOSTAPD_CHAN_RADAR 0x00000008
  22. struct hostapd_channel_data {
  23. short chan; /* channel number (IEEE 802.11) */
  24. short freq; /* frequency in MHz */
  25. int flag; /* flag for hostapd use (HOSTAPD_CHAN_*) */
  26. u8 max_tx_power; /* maximum transmit power in dBm */
  27. };
  28. #define HOSTAPD_RATE_ERP 0x00000001
  29. #define HOSTAPD_RATE_BASIC 0x00000002
  30. #define HOSTAPD_RATE_PREAMBLE2 0x00000004
  31. #define HOSTAPD_RATE_SUPPORTED 0x00000010
  32. #define HOSTAPD_RATE_OFDM 0x00000020
  33. #define HOSTAPD_RATE_CCK 0x00000040
  34. #define HOSTAPD_RATE_MANDATORY 0x00000100
  35. struct hostapd_rate_data {
  36. int rate; /* rate in 100 kbps */
  37. int flags; /* HOSTAPD_RATE_ flags */
  38. };
  39. struct hostapd_hw_modes {
  40. hostapd_hw_mode mode;
  41. int num_channels;
  42. struct hostapd_channel_data *channels;
  43. int num_rates;
  44. struct hostapd_rate_data *rates;
  45. u16 ht_capab;
  46. };
  47. #define AUTH_ALG_OPEN_SYSTEM 0x01
  48. #define AUTH_ALG_SHARED_KEY 0x02
  49. #define AUTH_ALG_LEAP 0x04
  50. #define AUTH_ALG_FT 0x08
  51. #define IEEE80211_MODE_INFRA 0
  52. #define IEEE80211_MODE_IBSS 1
  53. #define IEEE80211_MODE_AP 2
  54. #define IEEE80211_CAP_ESS 0x0001
  55. #define IEEE80211_CAP_IBSS 0x0002
  56. #define IEEE80211_CAP_PRIVACY 0x0010
  57. #define SSID_MAX_WPA_IE_LEN 40
  58. /**
  59. * struct wpa_scan_result - Scan results (old structure)
  60. * @bssid: BSSID
  61. * @ssid: SSID
  62. * @ssid_len: length of the ssid
  63. * @wpa_ie: WPA IE
  64. * @wpa_ie_len: length of the wpa_ie
  65. * @rsn_ie: RSN IE
  66. * @rsn_ie_len: length of the RSN IE
  67. * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
  68. * @caps: capability information field in host byte order
  69. * @qual: signal quality
  70. * @noise: noise level
  71. * @level: signal level
  72. * @maxrate: maximum supported rate
  73. * @mdie_present: Whether MDIE was included in Beacon/ProbeRsp frame
  74. * @mdie: Mobility domain identifier IE (IEEE 802.11r MDIE) (starting from
  75. * IE type field)
  76. * @tsf: Timestamp
  77. *
  78. * This structure is used as a generic format for scan results from the
  79. * driver. Each driver interface implementation is responsible for converting
  80. * the driver or OS specific scan results into this format.
  81. *
  82. * This structure is the old data structure used for scan results. It is
  83. * obsoleted by the new struct wpa_scan_res structure and the old version is
  84. * only included for backwards compatibility with existing driver wrapper
  85. * implementations. New implementations are encouraged to implement for struct
  86. * wpa_scan_res. The old structure will be removed at some point.
  87. */
  88. struct wpa_scan_result {
  89. u8 bssid[ETH_ALEN];
  90. u8 ssid[32];
  91. size_t ssid_len;
  92. u8 wpa_ie[SSID_MAX_WPA_IE_LEN];
  93. size_t wpa_ie_len;
  94. u8 rsn_ie[SSID_MAX_WPA_IE_LEN];
  95. size_t rsn_ie_len;
  96. int freq;
  97. u16 caps;
  98. int qual;
  99. int noise;
  100. int level;
  101. int maxrate;
  102. int mdie_present;
  103. u8 mdie[5];
  104. u64 tsf;
  105. };
  106. #define WPA_SCAN_QUAL_INVALID BIT(0)
  107. #define WPA_SCAN_NOISE_INVALID BIT(1)
  108. #define WPA_SCAN_LEVEL_INVALID BIT(2)
  109. #define WPA_SCAN_LEVEL_DBM BIT(3)
  110. /**
  111. * struct wpa_scan_res - Scan result for an BSS/IBSS
  112. * @flags: information flags about the BSS/IBSS (WPA_SCAN_*)
  113. * @bssid: BSSID
  114. * @freq: frequency of the channel in MHz (e.g., 2412 = channel 1)
  115. * @beacon_int: beacon interval in TUs (host byte order)
  116. * @caps: capability information field in host byte order
  117. * @qual: signal quality
  118. * @noise: noise level
  119. * @level: signal level
  120. * @tsf: Timestamp
  121. * @age: Age of the information in milliseconds (i.e., how many milliseconds
  122. * ago the last Beacon or Probe Response frame was received)
  123. * @ie_len: length of the following IE field in octets
  124. *
  125. * This structure is used as a generic format for scan results from the
  126. * driver. Each driver interface implementation is responsible for converting
  127. * the driver or OS specific scan results into this format.
  128. *
  129. * If the driver does not support reporting all IEs, the IE data structure is
  130. * constructed of the IEs that are available. This field will also need to
  131. * include SSID in IE format. All drivers are encouraged to be extended to
  132. * report all IEs to make it easier to support future additions.
  133. */
  134. struct wpa_scan_res {
  135. unsigned int flags;
  136. u8 bssid[ETH_ALEN];
  137. int freq;
  138. u16 beacon_int;
  139. u16 caps;
  140. int qual;
  141. int noise;
  142. int level;
  143. u64 tsf;
  144. unsigned int age;
  145. size_t ie_len;
  146. /* followed by ie_len octets of IEs */
  147. };
  148. /**
  149. * struct wpa_scan_results - Scan results
  150. * @res: Array of pointers to allocated variable length scan result entries
  151. * @num: Number of entries in the scan result array
  152. */
  153. struct wpa_scan_results {
  154. struct wpa_scan_res **res;
  155. size_t num;
  156. };
  157. /**
  158. * struct wpa_interface_info - Network interface information
  159. * @next: Pointer to the next interface or NULL if this is the last one
  160. * @ifname: Interface name that can be used with init() or init2()
  161. * @desc: Human readable adapter description (e.g., vendor/model) or NULL if
  162. * not available
  163. * @drv_bame: struct wpa_driver_ops::name (note: unlike other strings, this one
  164. * is not an allocated copy, i.e., get_interfaces() caller will not free
  165. * this)
  166. */
  167. struct wpa_interface_info {
  168. struct wpa_interface_info *next;
  169. char *ifname;
  170. char *desc;
  171. const char *drv_name;
  172. };
  173. #define WPAS_MAX_SCAN_SSIDS 4
  174. /**
  175. * struct wpa_driver_scan_params - Scan parameters
  176. * Data for struct wpa_driver_ops::scan2().
  177. */
  178. struct wpa_driver_scan_params {
  179. /**
  180. * ssids - SSIDs to scan for
  181. */
  182. struct wpa_driver_scan_ssid {
  183. /**
  184. * ssid - specific SSID to scan for (ProbeReq)
  185. * %NULL or zero-length SSID is used to indicate active scan
  186. * with wildcard SSID.
  187. */
  188. const u8 *ssid;
  189. /**
  190. * ssid_len: Length of the SSID in octets
  191. */
  192. size_t ssid_len;
  193. } ssids[WPAS_MAX_SCAN_SSIDS];
  194. /**
  195. * num_ssids - Number of entries in ssids array
  196. * Zero indicates a request for a passive scan.
  197. */
  198. size_t num_ssids;
  199. /**
  200. * extra_ies - Extra IE(s) to add into Probe Request or %NULL
  201. */
  202. const u8 *extra_ies;
  203. /**
  204. * extra_ies_len - Length of extra_ies in octets
  205. */
  206. size_t extra_ies_len;
  207. /**
  208. * freqs - Array of frequencies to scan or %NULL for all frequencies
  209. *
  210. * The frequency is set in MHz. The array is zero-terminated.
  211. */
  212. int *freqs;
  213. };
  214. /**
  215. * struct wpa_driver_auth_params - Authentication parameters
  216. * Data for struct wpa_driver_ops::authenticate().
  217. */
  218. struct wpa_driver_auth_params {
  219. int freq;
  220. const u8 *bssid;
  221. const u8 *ssid;
  222. size_t ssid_len;
  223. int auth_alg;
  224. const u8 *ie;
  225. size_t ie_len;
  226. const u8 *wep_key[4];
  227. size_t wep_key_len[4];
  228. int wep_tx_keyidx;
  229. };
  230. /**
  231. * struct wpa_driver_associate_params - Association parameters
  232. * Data for struct wpa_driver_ops::associate().
  233. */
  234. struct wpa_driver_associate_params {
  235. /**
  236. * bssid - BSSID of the selected AP
  237. * This can be %NULL, if ap_scan=2 mode is used and the driver is
  238. * responsible for selecting with which BSS to associate. */
  239. const u8 *bssid;
  240. /**
  241. * ssid - The selected SSID
  242. */
  243. const u8 *ssid;
  244. size_t ssid_len;
  245. /**
  246. * freq - Frequency of the channel the selected AP is using
  247. * Frequency that the selected AP is using (in MHz as
  248. * reported in the scan results)
  249. */
  250. int freq;
  251. /**
  252. * wpa_ie - WPA information element for (Re)Association Request
  253. * WPA information element to be included in (Re)Association
  254. * Request (including information element id and length). Use
  255. * of this WPA IE is optional. If the driver generates the WPA
  256. * IE, it can use pairwise_suite, group_suite, and
  257. * key_mgmt_suite to select proper algorithms. In this case,
  258. * the driver has to notify wpa_supplicant about the used WPA
  259. * IE by generating an event that the interface code will
  260. * convert into EVENT_ASSOCINFO data (see below).
  261. *
  262. * When using WPA2/IEEE 802.11i, wpa_ie is used for RSN IE
  263. * instead. The driver can determine which version is used by
  264. * looking at the first byte of the IE (0xdd for WPA, 0x30 for
  265. * WPA2/RSN).
  266. *
  267. * When using WPS, wpa_ie is used for WPS IE instead of WPA/RSN IE.
  268. */
  269. const u8 *wpa_ie;
  270. /**
  271. * wpa_ie_len - length of the wpa_ie
  272. */
  273. size_t wpa_ie_len;
  274. /* The selected pairwise/group cipher and key management
  275. * suites. These are usually ignored if @wpa_ie is used. */
  276. wpa_cipher pairwise_suite;
  277. wpa_cipher group_suite;
  278. wpa_key_mgmt key_mgmt_suite;
  279. /**
  280. * auth_alg - Allowed authentication algorithms
  281. * Bit field of AUTH_ALG_*
  282. */
  283. int auth_alg;
  284. /**
  285. * mode - Operation mode (infra/ibss) IEEE80211_MODE_*
  286. */
  287. int mode;
  288. /**
  289. * wep_key - WEP keys for static WEP configuration
  290. */
  291. const u8 *wep_key[4];
  292. /**
  293. * wep_key_len - WEP key length for static WEP configuration
  294. */
  295. size_t wep_key_len[4];
  296. /**
  297. * wep_tx_keyidx - WEP TX key index for static WEP configuration
  298. */
  299. int wep_tx_keyidx;
  300. /**
  301. * mgmt_frame_protection - IEEE 802.11w management frame protection
  302. */
  303. enum {
  304. NO_MGMT_FRAME_PROTECTION,
  305. MGMT_FRAME_PROTECTION_OPTIONAL,
  306. MGMT_FRAME_PROTECTION_REQUIRED
  307. } mgmt_frame_protection;
  308. /**
  309. * ft_ies - IEEE 802.11r / FT information elements
  310. * If the supplicant is using IEEE 802.11r (FT) and has the needed keys
  311. * for fast transition, this parameter is set to include the IEs that
  312. * are to be sent in the next FT Authentication Request message.
  313. * update_ft_ies() handler is called to update the IEs for further
  314. * FT messages in the sequence.
  315. *
  316. * The driver should use these IEs only if the target AP is advertising
  317. * the same mobility domain as the one included in the MDIE here.
  318. *
  319. * In ap_scan=2 mode, the driver can use these IEs when moving to a new
  320. * AP after the initial association. These IEs can only be used if the
  321. * target AP is advertising support for FT and is using the same MDIE
  322. * and SSID as the current AP.
  323. *
  324. * The driver is responsible for reporting the FT IEs received from the
  325. * AP's response using wpa_supplicant_event() with EVENT_FT_RESPONSE
  326. * type. update_ft_ies() handler will then be called with the FT IEs to
  327. * include in the next frame in the authentication sequence.
  328. */
  329. const u8 *ft_ies;
  330. /**
  331. * ft_ies_len - Length of ft_ies in bytes
  332. */
  333. size_t ft_ies_len;
  334. /**
  335. * ft_md - FT Mobility domain (6 octets) (also included inside ft_ies)
  336. *
  337. * This value is provided to allow the driver interface easier access
  338. * to the current mobility domain. This value is set to %NULL if no
  339. * mobility domain is currently active.
  340. */
  341. const u8 *ft_md;
  342. /**
  343. * passphrase - RSN passphrase for PSK
  344. *
  345. * This value is made available only for WPA/WPA2-Personal (PSK) and
  346. * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
  347. * the 8..63 character ASCII passphrase, if available. Please note that
  348. * this can be %NULL if passphrase was not used to generate the PSK. In
  349. * that case, the psk field must be used to fetch the PSK.
  350. */
  351. const char *passphrase;
  352. /**
  353. * psk - RSN PSK (alternative for passphrase for PSK)
  354. *
  355. * This value is made available only for WPA/WPA2-Personal (PSK) and
  356. * only for drivers that set WPA_DRIVER_FLAGS_4WAY_HANDSHAKE. This is
  357. * the 32-octet (256-bit) PSK, if available. The driver wrapper should
  358. * be prepared to handle %NULL value as an error.
  359. */
  360. const u8 *psk;
  361. /**
  362. * drop_unencrypted - Enable/disable unencrypted frame filtering
  363. *
  364. * Configure the driver to drop all non-EAPOL frames (both receive and
  365. * transmit paths). Unencrypted EAPOL frames (ethertype 0x888e) must
  366. * still be allowed for key negotiation.
  367. */
  368. int drop_unencrypted;
  369. };
  370. /**
  371. * struct wpa_driver_capa - Driver capability information
  372. */
  373. struct wpa_driver_capa {
  374. #define WPA_DRIVER_CAPA_KEY_MGMT_WPA 0x00000001
  375. #define WPA_DRIVER_CAPA_KEY_MGMT_WPA2 0x00000002
  376. #define WPA_DRIVER_CAPA_KEY_MGMT_WPA_PSK 0x00000004
  377. #define WPA_DRIVER_CAPA_KEY_MGMT_WPA2_PSK 0x00000008
  378. #define WPA_DRIVER_CAPA_KEY_MGMT_WPA_NONE 0x00000010
  379. #define WPA_DRIVER_CAPA_KEY_MGMT_FT 0x00000020
  380. #define WPA_DRIVER_CAPA_KEY_MGMT_FT_PSK 0x00000040
  381. unsigned int key_mgmt;
  382. #define WPA_DRIVER_CAPA_ENC_WEP40 0x00000001
  383. #define WPA_DRIVER_CAPA_ENC_WEP104 0x00000002
  384. #define WPA_DRIVER_CAPA_ENC_TKIP 0x00000004
  385. #define WPA_DRIVER_CAPA_ENC_CCMP 0x00000008
  386. unsigned int enc;
  387. #define WPA_DRIVER_AUTH_OPEN 0x00000001
  388. #define WPA_DRIVER_AUTH_SHARED 0x00000002
  389. #define WPA_DRIVER_AUTH_LEAP 0x00000004
  390. unsigned int auth;
  391. /* Driver generated WPA/RSN IE */
  392. #define WPA_DRIVER_FLAGS_DRIVER_IE 0x00000001
  393. /* Driver needs static WEP key setup after association command */
  394. #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC 0x00000002
  395. #define WPA_DRIVER_FLAGS_USER_SPACE_MLME 0x00000004
  396. /* Driver takes care of RSN 4-way handshake internally; PMK is configured with
  397. * struct wpa_driver_ops::set_key using alg = WPA_ALG_PMK */
  398. #define WPA_DRIVER_FLAGS_4WAY_HANDSHAKE 0x00000008
  399. #define WPA_DRIVER_FLAGS_WIRED 0x00000010
  400. /* Driver provides separate commands for authentication and association (SME in
  401. * wpa_supplicant). */
  402. #define WPA_DRIVER_FLAGS_SME 0x00000020
  403. /* Driver supports AP mode */
  404. #define WPA_DRIVER_FLAGS_AP 0x00000040
  405. /* Driver needs static WEP key setup after association has been completed */
  406. #define WPA_DRIVER_FLAGS_SET_KEYS_AFTER_ASSOC_DONE 0x00000080
  407. unsigned int flags;
  408. int max_scan_ssids;
  409. };
  410. struct ieee80211_rx_status {
  411. int channel;
  412. int ssi;
  413. };
  414. struct hostapd_data;
  415. struct hostap_sta_driver_data {
  416. unsigned long rx_packets, tx_packets, rx_bytes, tx_bytes;
  417. unsigned long current_tx_rate;
  418. unsigned long inactive_msec;
  419. unsigned long flags;
  420. unsigned long num_ps_buf_frames;
  421. unsigned long tx_retry_failed;
  422. unsigned long tx_retry_count;
  423. int last_rssi;
  424. int last_ack_rssi;
  425. };
  426. struct hostapd_sta_add_params {
  427. const u8 *addr;
  428. u16 aid;
  429. u16 capability;
  430. const u8 *supp_rates;
  431. size_t supp_rates_len;
  432. int flags;
  433. u16 listen_interval;
  434. const struct ht_cap_ie *ht_capabilities;
  435. };
  436. struct hostapd_freq_params {
  437. int mode;
  438. int freq;
  439. int channel;
  440. int ht_enabled;
  441. int sec_channel_offset; /* 0 = HT40 disabled, -1 = HT40 enabled,
  442. * secondary channel below primary, 1 = HT40
  443. * enabled, secondary channel above primary */
  444. };
  445. enum hostapd_driver_if_type {
  446. HOSTAPD_IF_VLAN
  447. };
  448. struct wpa_init_params {
  449. const u8 *bssid;
  450. const char *ifname;
  451. const u8 *ssid;
  452. size_t ssid_len;
  453. const char *test_socket;
  454. int use_pae_group_addr;
  455. char **bridge;
  456. size_t num_bridge;
  457. u8 *own_addr; /* buffer for writing own MAC address */
  458. };
  459. /**
  460. * struct wpa_driver_ops - Driver interface API definition
  461. *
  462. * This structure defines the API that each driver interface needs to implement
  463. * for core wpa_supplicant code. All driver specific functionality is captured
  464. * in this wrapper.
  465. */
  466. struct wpa_driver_ops {
  467. /** Name of the driver interface */
  468. const char *name;
  469. /** One line description of the driver interface */
  470. const char *desc;
  471. /**
  472. * get_bssid - Get the current BSSID
  473. * @priv: private driver interface data
  474. * @bssid: buffer for BSSID (ETH_ALEN = 6 bytes)
  475. *
  476. * Returns: 0 on success, -1 on failure
  477. *
  478. * Query kernel driver for the current BSSID and copy it to bssid.
  479. * Setting bssid to 00:00:00:00:00:00 is recommended if the STA is not
  480. * associated.
  481. */
  482. int (*get_bssid)(void *priv, u8 *bssid);
  483. /**
  484. * get_ssid - Get the current SSID
  485. * @priv: private driver interface data
  486. * @ssid: buffer for SSID (at least 32 bytes)
  487. *
  488. * Returns: Length of the SSID on success, -1 on failure
  489. *
  490. * Query kernel driver for the current SSID and copy it to ssid.
  491. * Returning zero is recommended if the STA is not associated.
  492. *
  493. * Note: SSID is an array of octets, i.e., it is not nul terminated and
  494. * can, at least in theory, contain control characters (including nul)
  495. * and as such, should be processed as binary data, not a printable
  496. * string.
  497. */
  498. int (*get_ssid)(void *priv, u8 *ssid);
  499. /**
  500. * set_wpa - Enable/disable WPA support (OBSOLETE)
  501. * @priv: private driver interface data
  502. * @enabled: 1 = enable, 0 = disable
  503. *
  504. * Returns: 0 on success, -1 on failure
  505. *
  506. * Note: This function is included for backwards compatibility. This is
  507. * called only just after init and just before deinit, so these
  508. * functions can be used to implement same functionality and the driver
  509. * interface need not define this function.
  510. *
  511. * Configure the kernel driver to enable/disable WPA support. This may
  512. * be empty function, if WPA support is always enabled. Common
  513. * configuration items are WPA IE (clearing it when WPA support is
  514. * disabled), Privacy flag configuration for capability field (note:
  515. * this the value need to set in associate handler to allow plaintext
  516. * mode to be used) when trying to associate with, roaming mode (can
  517. * allow wpa_supplicant to control roaming if ap_scan=1 is used;
  518. * however, drivers can also implement roaming if desired, especially
  519. * ap_scan=2 mode is used for this).
  520. */
  521. int (*set_wpa)(void *priv, int enabled);
  522. /**
  523. * set_key - Configure encryption key
  524. * @priv: private driver interface data
  525. * @alg: encryption algorithm (%WPA_ALG_NONE, %WPA_ALG_WEP,
  526. * %WPA_ALG_TKIP, %WPA_ALG_CCMP, %WPA_ALG_IGTK, %WPA_ALG_PMK);
  527. * %WPA_ALG_NONE clears the key.
  528. * @addr: address of the peer STA or ff:ff:ff:ff:ff:ff for
  529. * broadcast/default keys
  530. * @key_idx: key index (0..3), usually 0 for unicast keys; 0..4095 for
  531. * IGTK
  532. * @set_tx: configure this key as the default Tx key (only used when
  533. * driver does not support separate unicast/individual key
  534. * @seq: sequence number/packet number, seq_len octets, the next
  535. * packet number to be used for in replay protection; configured
  536. * for Rx keys (in most cases, this is only used with broadcast
  537. * keys and set to zero for unicast keys)
  538. * @seq_len: length of the seq, depends on the algorithm:
  539. * TKIP: 6 octets, CCMP: 6 octets, IGTK: 6 octets
  540. * @key: key buffer; TKIP: 16-byte temporal key, 8-byte Tx Mic key,
  541. * 8-byte Rx Mic Key
  542. * @key_len: length of the key buffer in octets (WEP: 5 or 13,
  543. * TKIP: 32, CCMP: 16, IGTK: 16)
  544. *
  545. * Returns: 0 on success, -1 on failure
  546. *
  547. * Configure the given key for the kernel driver. If the driver
  548. * supports separate individual keys (4 default keys + 1 individual),
  549. * addr can be used to determine whether the key is default or
  550. * individual. If only 4 keys are supported, the default key with key
  551. * index 0 is used as the individual key. STA must be configured to use
  552. * it as the default Tx key (set_tx is set) and accept Rx for all the
  553. * key indexes. In most cases, WPA uses only key indexes 1 and 2 for
  554. * broadcast keys, so key index 0 is available for this kind of
  555. * configuration.
  556. *
  557. * Please note that TKIP keys include separate TX and RX MIC keys and
  558. * some drivers may expect them in different order than wpa_supplicant
  559. * is using. If the TX/RX keys are swapped, all TKIP encrypted packets
  560. * will tricker Michael MIC errors. This can be fixed by changing the
  561. * order of MIC keys by swapping te bytes 16..23 and 24..31 of the key
  562. * in driver_*.c set_key() implementation, see driver_ndis.c for an
  563. * example on how this can be done.
  564. */
  565. int (*set_key)(void *priv, wpa_alg alg, const u8 *addr,
  566. int key_idx, int set_tx, const u8 *seq, size_t seq_len,
  567. const u8 *key, size_t key_len);
  568. /**
  569. * init - Initialize driver interface
  570. * @ctx: context to be used when calling wpa_supplicant functions,
  571. * e.g., wpa_supplicant_event()
  572. * @ifname: interface name, e.g., wlan0
  573. *
  574. * Returns: Pointer to private data, %NULL on failure
  575. *
  576. * Initialize driver interface, including event processing for kernel
  577. * driver events (e.g., associated, scan results, Michael MIC failure).
  578. * This function can allocate a private configuration data area for
  579. * @ctx, file descriptor, interface name, etc. information that may be
  580. * needed in future driver operations. If this is not used, non-NULL
  581. * value will need to be returned because %NULL is used to indicate
  582. * failure. The returned value will be used as 'void *priv' data for
  583. * all other driver_ops functions.
  584. *
  585. * The main event loop (eloop.c) of wpa_supplicant can be used to
  586. * register callback for read sockets (eloop_register_read_sock()).
  587. *
  588. * See below for more information about events and
  589. * wpa_supplicant_event() function.
  590. */
  591. void * (*init)(void *ctx, const char *ifname);
  592. /**
  593. * deinit - Deinitialize driver interface
  594. * @priv: private driver interface data from init()
  595. *
  596. * Shut down driver interface and processing of driver events. Free
  597. * private data buffer if one was allocated in init() handler.
  598. */
  599. void (*deinit)(void *priv);
  600. /**
  601. * set_param - Set driver configuration parameters
  602. * @priv: private driver interface data from init()
  603. * @param: driver specific configuration parameters
  604. *
  605. * Returns: 0 on success, -1 on failure
  606. *
  607. * Optional handler for notifying driver interface about configuration
  608. * parameters (driver_param).
  609. */
  610. int (*set_param)(void *priv, const char *param);
  611. /**
  612. * set_countermeasures - Enable/disable TKIP countermeasures
  613. * @priv: private driver interface data
  614. * @enabled: 1 = countermeasures enabled, 0 = disabled
  615. *
  616. * Returns: 0 on success, -1 on failure
  617. *
  618. * Configure TKIP countermeasures. When these are enabled, the driver
  619. * should drop all received and queued frames that are using TKIP.
  620. */
  621. int (*set_countermeasures)(void *priv, int enabled);
  622. /**
  623. * set_drop_unencrypted - Enable/disable unencrypted frame filtering
  624. * @priv: private driver interface data
  625. * @enabled: 1 = unencrypted Tx/Rx frames will be dropped, 0 = disabled
  626. *
  627. * Returns: 0 on success, -1 on failure
  628. *
  629. * Configure the driver to drop all non-EAPOL frames (both receive and
  630. * transmit paths). Unencrypted EAPOL frames (ethertype 0x888e) must
  631. * still be allowed for key negotiation.
  632. *
  633. * This function is deprecated. New driver wrapper implementations
  634. * should use associate() parameter drop_unencrypted instead.
  635. */
  636. int (*set_drop_unencrypted)(void *priv, int enabled);
  637. /**
  638. * scan - Request the driver to initiate scan (old version)
  639. * @priv: private driver interface data
  640. * @ssid: specific SSID to scan for (ProbeReq) or %NULL to scan for
  641. * all SSIDs (either active scan with wildcard SSID or passive
  642. * scan)
  643. * @ssid_len: length of the SSID
  644. *
  645. * Returns: 0 on success, -1 on failure
  646. *
  647. * Once the scan results are ready, the driver should report scan
  648. * results event for wpa_supplicant which will eventually request the
  649. * results with wpa_driver_get_scan_results().
  650. *
  651. * This function is deprecated. New driver wrapper implementations
  652. * should implement support for scan2().
  653. */
  654. int (*scan)(void *priv, const u8 *ssid, size_t ssid_len);
  655. /**
  656. * get_scan_results - Fetch the latest scan results (old version)
  657. * @priv: private driver interface data
  658. * @results: pointer to buffer for scan results
  659. * @max_size: maximum number of entries (buffer size)
  660. *
  661. * Returns: Number of scan result entries used on success, -1 on
  662. * failure
  663. *
  664. * If scan results include more than max_size BSSes, max_size will be
  665. * returned and the remaining entries will not be included in the
  666. * buffer.
  667. *
  668. * This function is deprecated. New driver wrapper implementations
  669. * should implement support for get_scan_results2().
  670. */
  671. int (*get_scan_results)(void *priv,
  672. struct wpa_scan_result *results,
  673. size_t max_size);
  674. /**
  675. * deauthenticate - Request driver to deauthenticate
  676. * @priv: private driver interface data
  677. * @addr: peer address (BSSID of the AP)
  678. * @reason_code: 16-bit reason code to be sent in the deauthentication
  679. * frame
  680. *
  681. * Returns: 0 on success, -1 on failure
  682. */
  683. int (*deauthenticate)(void *priv, const u8 *addr, int reason_code);
  684. /**
  685. * disassociate - Request driver to disassociate
  686. * @priv: private driver interface data
  687. * @addr: peer address (BSSID of the AP)
  688. * @reason_code: 16-bit reason code to be sent in the disassociation
  689. * frame
  690. *
  691. * Returns: 0 on success, -1 on failure
  692. */
  693. int (*disassociate)(void *priv, const u8 *addr, int reason_code);
  694. /**
  695. * associate - Request driver to associate
  696. * @priv: private driver interface data
  697. * @params: association parameters
  698. *
  699. * Returns: 0 on success, -1 on failure
  700. */
  701. int (*associate)(void *priv,
  702. struct wpa_driver_associate_params *params);
  703. /**
  704. * set_auth_alg - Set IEEE 802.11 authentication algorithm
  705. * @priv: private driver interface data
  706. * @auth_alg: bit field of AUTH_ALG_*
  707. *
  708. * If the driver supports more than one authentication algorithm at the
  709. * same time, it should configure all supported algorithms. If not, one
  710. * algorithm needs to be selected arbitrarily. Open System
  711. * authentication should be ok for most cases and it is recommended to
  712. * be used if other options are not supported. Static WEP configuration
  713. * may also use Shared Key authentication and LEAP requires its own
  714. * algorithm number. For LEAP, user can make sure that only one
  715. * algorithm is used at a time by configuring LEAP as the only
  716. * supported EAP method. This information is also available in
  717. * associate() params, so set_auth_alg may not be needed in case of
  718. * most drivers.
  719. *
  720. * This function is deprecated. New driver wrapper implementations
  721. * should use associate() parameter auth_alg instead.
  722. *
  723. * Returns: 0 on success, -1 on failure
  724. */
  725. int (*set_auth_alg)(void *priv, int auth_alg);
  726. /**
  727. * add_pmkid - Add PMKSA cache entry to the driver
  728. * @priv: private driver interface data
  729. * @bssid: BSSID for the PMKSA cache entry
  730. * @pmkid: PMKID for the PMKSA cache entry
  731. *
  732. * Returns: 0 on success, -1 on failure
  733. *
  734. * This function is called when a new PMK is received, as a result of
  735. * either normal authentication or RSN pre-authentication.
  736. *
  737. * If the driver generates RSN IE, i.e., it does not use wpa_ie in
  738. * associate(), add_pmkid() can be used to add new PMKSA cache entries
  739. * in the driver. If the driver uses wpa_ie from wpa_supplicant, this
  740. * driver_ops function does not need to be implemented. Likewise, if
  741. * the driver does not support WPA, this function is not needed.
  742. */
  743. int (*add_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
  744. /**
  745. * remove_pmkid - Remove PMKSA cache entry to the driver
  746. * @priv: private driver interface data
  747. * @bssid: BSSID for the PMKSA cache entry
  748. * @pmkid: PMKID for the PMKSA cache entry
  749. *
  750. * Returns: 0 on success, -1 on failure
  751. *
  752. * This function is called when the supplicant drops a PMKSA cache
  753. * entry for any reason.
  754. *
  755. * If the driver generates RSN IE, i.e., it does not use wpa_ie in
  756. * associate(), remove_pmkid() can be used to synchronize PMKSA caches
  757. * between the driver and wpa_supplicant. If the driver uses wpa_ie
  758. * from wpa_supplicant, this driver_ops function does not need to be
  759. * implemented. Likewise, if the driver does not support WPA, this
  760. * function is not needed.
  761. */
  762. int (*remove_pmkid)(void *priv, const u8 *bssid, const u8 *pmkid);
  763. /**
  764. * flush_pmkid - Flush PMKSA cache
  765. * @priv: private driver interface data
  766. *
  767. * Returns: 0 on success, -1 on failure
  768. *
  769. * This function is called when the supplicant drops all PMKSA cache
  770. * entries for any reason.
  771. *
  772. * If the driver generates RSN IE, i.e., it does not use wpa_ie in
  773. * associate(), remove_pmkid() can be used to synchronize PMKSA caches
  774. * between the driver and wpa_supplicant. If the driver uses wpa_ie
  775. * from wpa_supplicant, this driver_ops function does not need to be
  776. * implemented. Likewise, if the driver does not support WPA, this
  777. * function is not needed.
  778. */
  779. int (*flush_pmkid)(void *priv);
  780. /**
  781. * get_capa - Get driver capabilities
  782. * @priv: private driver interface data
  783. *
  784. * Returns: 0 on success, -1 on failure
  785. *
  786. * Get driver/firmware/hardware capabilities.
  787. */
  788. int (*get_capa)(void *priv, struct wpa_driver_capa *capa);
  789. /**
  790. * poll - Poll driver for association information
  791. * @priv: private driver interface data
  792. *
  793. * This is an option callback that can be used when the driver does not
  794. * provide event mechanism for association events. This is called when
  795. * receiving WPA EAPOL-Key messages that require association
  796. * information. The driver interface is supposed to generate associnfo
  797. * event before returning from this callback function. In addition, the
  798. * driver interface should generate an association event after having
  799. * sent out associnfo.
  800. */
  801. void (*poll)(void *priv);
  802. /**
  803. * get_ifname - Get interface name
  804. * @priv: private driver interface data
  805. *
  806. * Returns: Pointer to the interface name. This can differ from the
  807. * interface name used in init() call. Init() is called first.
  808. *
  809. * This optional function can be used to allow the driver interface to
  810. * replace the interface name with something else, e.g., based on an
  811. * interface mapping from a more descriptive name.
  812. */
  813. const char * (*get_ifname)(void *priv);
  814. /**
  815. * get_mac_addr - Get own MAC address
  816. * @priv: private driver interface data
  817. *
  818. * Returns: Pointer to own MAC address or %NULL on failure
  819. *
  820. * This optional function can be used to get the own MAC address of the
  821. * device from the driver interface code. This is only needed if the
  822. * l2_packet implementation for the OS does not provide easy access to
  823. * a MAC address. */
  824. const u8 * (*get_mac_addr)(void *priv);
  825. /**
  826. * send_eapol - Optional function for sending EAPOL packets
  827. * @priv: private driver interface data
  828. * @dest: Destination MAC address
  829. * @proto: Ethertype
  830. * @data: EAPOL packet starting with IEEE 802.1X header
  831. * @data_len: Size of the EAPOL packet
  832. *
  833. * Returns: 0 on success, -1 on failure
  834. *
  835. * This optional function can be used to override l2_packet operations
  836. * with driver specific functionality. If this function pointer is set,
  837. * l2_packet module is not used at all and the driver interface code is
  838. * responsible for receiving and sending all EAPOL packets. The
  839. * received EAPOL packets are sent to core code by calling
  840. * wpa_supplicant_rx_eapol(). The driver interface is required to
  841. * implement get_mac_addr() handler if send_eapol() is used.
  842. */
  843. int (*send_eapol)(void *priv, const u8 *dest, u16 proto,
  844. const u8 *data, size_t data_len);
  845. /**
  846. * set_operstate - Sets device operating state to DORMANT or UP
  847. * @priv: private driver interface data
  848. * @state: 0 = dormant, 1 = up
  849. * Returns: 0 on success, -1 on failure
  850. *
  851. * This is an optional function that can be used on operating systems
  852. * that support a concept of controlling network device state from user
  853. * space applications. This function, if set, gets called with
  854. * state = 1 when authentication has been completed and with state = 0
  855. * when connection is lost.
  856. */
  857. int (*set_operstate)(void *priv, int state);
  858. /**
  859. * mlme_setprotection - MLME-SETPROTECTION.request primitive
  860. * @priv: Private driver interface data
  861. * @addr: Address of the station for which to set protection (may be
  862. * %NULL for group keys)
  863. * @protect_type: MLME_SETPROTECTION_PROTECT_TYPE_*
  864. * @key_type: MLME_SETPROTECTION_KEY_TYPE_*
  865. * Returns: 0 on success, -1 on failure
  866. *
  867. * This is an optional function that can be used to set the driver to
  868. * require protection for Tx and/or Rx frames. This uses the layer
  869. * interface defined in IEEE 802.11i-2004 clause 10.3.22.1
  870. * (MLME-SETPROTECTION.request). Many drivers do not use explicit
  871. * set protection operation; instead, they set protection implicitly
  872. * based on configured keys.
  873. */
  874. int (*mlme_setprotection)(void *priv, const u8 *addr, int protect_type,
  875. int key_type);
  876. /**
  877. * get_hw_feature_data - Get hardware support data (channels and rates)
  878. * @priv: Private driver interface data
  879. * @num_modes: Variable for returning the number of returned modes
  880. * flags: Variable for returning hardware feature flags
  881. * Returns: Pointer to allocated hardware data on success or %NULL on
  882. * failure. Caller is responsible for freeing this.
  883. *
  884. * This function is only needed for drivers that export MLME
  885. * (management frame processing) to wpa_supplicant.
  886. */
  887. struct hostapd_hw_modes * (*get_hw_feature_data)(void *priv,
  888. u16 *num_modes,
  889. u16 *flags);
  890. /**
  891. * set_channel - Set channel
  892. * @priv: Private driver interface data
  893. * @phymode: HOSTAPD_MODE_IEEE80211B, ..
  894. * @chan: IEEE 802.11 channel number
  895. * @freq: Frequency of the channel in MHz
  896. * Returns: 0 on success, -1 on failure
  897. *
  898. * This function is only needed for drivers that export MLME
  899. * (management frame processing) to wpa_supplicant.
  900. */
  901. int (*set_channel)(void *priv, hostapd_hw_mode phymode, int chan,
  902. int freq);
  903. /**
  904. * set_ssid - Set SSID
  905. * @priv: Private driver interface data
  906. * @ssid: SSID
  907. * @ssid_len: SSID length
  908. * Returns: 0 on success, -1 on failure
  909. *
  910. * This function is only needed for drivers that export MLME
  911. * (management frame processing) to wpa_supplicant.
  912. */
  913. int (*set_ssid)(void *priv, const u8 *ssid, size_t ssid_len);
  914. /**
  915. * set_bssid - Set BSSID
  916. * @priv: Private driver interface data
  917. * @bssid: BSSID
  918. * Returns: 0 on success, -1 on failure
  919. *
  920. * This function is only needed for drivers that export MLME
  921. * (management frame processing) to wpa_supplicant.
  922. */
  923. int (*set_bssid)(void *priv, const u8 *bssid);
  924. /**
  925. * send_mlme - Send management frame from MLME
  926. * @priv: Private driver interface data
  927. * @data: IEEE 802.11 management frame with IEEE 802.11 header
  928. * @data_len: Size of the management frame
  929. * Returns: 0 on success, -1 on failure
  930. *
  931. * This function is only needed for drivers that export MLME
  932. * (management frame processing) to wpa_supplicant.
  933. */
  934. int (*send_mlme)(void *priv, const u8 *data, size_t data_len);
  935. /**
  936. * mlme_add_sta - Add a STA entry into the driver/netstack
  937. * @priv: Private driver interface data
  938. * @addr: MAC address of the STA (e.g., BSSID of the AP)
  939. * @supp_rates: Supported rate set (from (Re)AssocResp); in IEEE 802.11
  940. * format (one octet per rate, 1 = 0.5 Mbps)
  941. * @supp_rates_len: Number of entries in supp_rates
  942. * Returns: 0 on success, -1 on failure
  943. *
  944. * This function is only needed for drivers that export MLME
  945. * (management frame processing) to wpa_supplicant. When the MLME code
  946. * completes association with an AP, this function is called to
  947. * configure the driver/netstack with a STA entry for data frame
  948. * processing (TX rate control, encryption/decryption).
  949. */
  950. int (*mlme_add_sta)(void *priv, const u8 *addr, const u8 *supp_rates,
  951. size_t supp_rates_len);
  952. /**
  953. * mlme_remove_sta - Remove a STA entry from the driver/netstack
  954. * @priv: Private driver interface data
  955. * @addr: MAC address of the STA (e.g., BSSID of the AP)
  956. * Returns: 0 on success, -1 on failure
  957. *
  958. * This function is only needed for drivers that export MLME
  959. * (management frame processing) to wpa_supplicant.
  960. */
  961. int (*mlme_remove_sta)(void *priv, const u8 *addr);
  962. /**
  963. * update_ft_ies - Update FT (IEEE 802.11r) IEs
  964. * @priv: Private driver interface data
  965. * @md: Mobility domain (2 octets) (also included inside ies)
  966. * @ies: FT IEs (MDIE, FTIE, ...) or %NULL to remove IEs
  967. * @ies_len: Length of FT IEs in bytes
  968. * Returns: 0 on success, -1 on failure
  969. *
  970. * The supplicant uses this callback to let the driver know that keying
  971. * material for FT is available and that the driver can use the
  972. * provided IEs in the next message in FT authentication sequence.
  973. *
  974. * This function is only needed for driver that support IEEE 802.11r
  975. * (Fast BSS Transition).
  976. */
  977. int (*update_ft_ies)(void *priv, const u8 *md, const u8 *ies,
  978. size_t ies_len);
  979. /**
  980. * send_ft_action - Send FT Action frame (IEEE 802.11r)
  981. * @priv: Private driver interface data
  982. * @action: Action field value
  983. * @target_ap: Target AP address
  984. * @ies: FT IEs (MDIE, FTIE, ...) (FT Request action frame body)
  985. * @ies_len: Length of FT IEs in bytes
  986. * Returns: 0 on success, -1 on failure
  987. *
  988. * The supplicant uses this callback to request the driver to transmit
  989. * an FT Action frame (action category 6) for over-the-DS fast BSS
  990. * transition.
  991. */
  992. int (*send_ft_action)(void *priv, u8 action, const u8 *target_ap,
  993. const u8 *ies, size_t ies_len);
  994. /**
  995. * get_scan_results2 - Fetch the latest scan results
  996. * @priv: private driver interface data
  997. *
  998. * Returns: Allocated buffer of scan results (caller is responsible for
  999. * freeing the data structure) on success, NULL on failure
  1000. */
  1001. struct wpa_scan_results * (*get_scan_results2)(void *priv);
  1002. /**
  1003. * set_probe_req_ie - Set information element(s) for Probe Request
  1004. * @priv: private driver interface data
  1005. * @ies: Information elements to append or %NULL to remove extra IEs
  1006. * @ies_len: Length of the IE buffer in octets
  1007. * Returns: 0 on success, -1 on failure
  1008. */
  1009. int (*set_probe_req_ie)(void *priv, const u8 *ies, size_t ies_len);
  1010. /**
  1011. * set_mode - Request driver to set the operating mode
  1012. * @priv: private driver interface data
  1013. * @mode: Operation mode (infra/ibss) IEEE80211_MODE_*
  1014. *
  1015. * This handler will be called before any key configuration and call to
  1016. * associate() handler in order to allow the operation mode to be
  1017. * configured as early as possible. This information is also available
  1018. * in associate() params and as such, driver wrappers may not need
  1019. * to implement set_mode() handler.
  1020. *
  1021. * This function is deprecated. New driver wrapper implementations
  1022. * should use associate() parameter mode instead.
  1023. *
  1024. * Returns: 0 on success, -1 on failure
  1025. */
  1026. int (*set_mode)(void *priv, int mode);
  1027. /**
  1028. * set_country - Set country
  1029. * @priv: Private driver interface data
  1030. * @alpha2: country to which to switch to
  1031. * Returns: 0 on success, -1 on failure
  1032. *
  1033. * This function is for drivers which support some form
  1034. * of setting a regulatory domain.
  1035. */
  1036. int (*set_country)(void *priv, const char *alpha2);
  1037. /**
  1038. * global_init - Global driver initialization
  1039. * Returns: Pointer to private data (global), %NULL on failure
  1040. *
  1041. * This optional function is called to initialize the driver wrapper
  1042. * for global data, i.e., data that applies to all interfaces. If this
  1043. * function is implemented, global_deinit() will also need to be
  1044. * implemented to free the private data. The driver will also likely
  1045. * use init2() function instead of init() to get the pointer to global
  1046. * data available to per-interface initializer.
  1047. */
  1048. void * (*global_init)(void);
  1049. /**
  1050. * global_deinit - Global driver deinitialization
  1051. * @priv: private driver global data from global_init()
  1052. *
  1053. * Terminate any global driver related functionality and free the
  1054. * global data structure.
  1055. */
  1056. void (*global_deinit)(void *priv);
  1057. /**
  1058. * init2 - Initialize driver interface (with global data)
  1059. * @ctx: context to be used when calling wpa_supplicant functions,
  1060. * e.g., wpa_supplicant_event()
  1061. * @ifname: interface name, e.g., wlan0
  1062. * @global_priv: private driver global data from global_init()
  1063. * Returns: Pointer to private data, %NULL on failure
  1064. *
  1065. * This function can be used instead of init() if the driver wrapper
  1066. * uses global data.
  1067. */
  1068. void * (*init2)(void *ctx, const char *ifname, void *global_priv);
  1069. /**
  1070. * get_interfaces - Get information about available interfaces
  1071. * @global_priv: private driver global data from global_init()
  1072. * Returns: Allocated buffer of interface information (caller is
  1073. * responsible for freeing the data structure) on success, NULL on
  1074. * failure
  1075. */
  1076. struct wpa_interface_info * (*get_interfaces)(void *global_priv);
  1077. /**
  1078. * scan2 - Request the driver to initiate scan
  1079. * @priv: private driver interface data
  1080. * @params: Scan parameters
  1081. *
  1082. * Returns: 0 on success, -1 on failure
  1083. *
  1084. * Once the scan results are ready, the driver should report scan
  1085. * results event for wpa_supplicant which will eventually request the
  1086. * results with wpa_driver_get_scan_results2().
  1087. */
  1088. int (*scan2)(void *priv, struct wpa_driver_scan_params *params);
  1089. /**
  1090. * authenticate - Request driver to authenticate
  1091. * @priv: private driver interface data
  1092. * @params: authentication parameters
  1093. * Returns: 0 on success, -1 on failure
  1094. *
  1095. * This is an optional function that can be used with drivers that
  1096. * support separate authentication and association steps, i.e., when
  1097. * wpa_supplicant can act as the SME. If not implemented, associate()
  1098. * function is expected to take care of IEEE 802.11 authentication,
  1099. * too.
  1100. */
  1101. int (*authenticate)(void *priv,
  1102. struct wpa_driver_auth_params *params);
  1103. int (*set_beacon)(void *priv, const u8 *head, size_t head_len,
  1104. const u8 *tail, size_t tail_len, int dtim_period);
  1105. int (*set_beacon_int)(void *priv, int value);
  1106. void * (*hapd_init)(struct hostapd_data *hapd,
  1107. struct wpa_init_params *params);
  1108. void (*hapd_deinit)(void *priv);
  1109. /**
  1110. * set_8021x - enable/disable IEEE 802.1X support
  1111. * @ifname: Interface name (for multi-SSID/VLAN support)
  1112. * @priv: driver private data
  1113. * @enabled: 1 = enable, 0 = disable
  1114. *
  1115. * Returns: 0 on success, -1 on failure
  1116. *
  1117. * Configure the kernel driver to enable/disable 802.1X support.
  1118. * This may be an empty function if 802.1X support is always enabled.
  1119. */
  1120. int (*set_ieee8021x)(const char *ifname, void *priv, int enabled);
  1121. /**
  1122. * set_privacy - enable/disable privacy
  1123. * @priv: driver private data
  1124. * @enabled: 1 = privacy enabled, 0 = disabled
  1125. *
  1126. * Return: 0 on success, -1 on failure
  1127. *
  1128. * Configure privacy.
  1129. */
  1130. int (*set_privacy)(const char *ifname, void *priv, int enabled);
  1131. int (*hapd_set_key)(const char *ifname, void *priv, wpa_alg alg,
  1132. const u8 *addr, int key_idx, int set_tx,
  1133. const u8 *seq, size_t seq_len,
  1134. const u8 *key, size_t key_len);
  1135. int (*get_seqnum)(const char *ifname, void *priv, const u8 *addr,
  1136. int idx, u8 *seq);
  1137. int (*get_seqnum_igtk)(const char *ifname, void *priv, const u8 *addr,
  1138. int idx, u8 *seq);
  1139. int (*flush)(void *priv);
  1140. int (*set_generic_elem)(const char *ifname, void *priv, const u8 *elem,
  1141. size_t elem_len);
  1142. int (*read_sta_data)(void *priv, struct hostap_sta_driver_data *data,
  1143. const u8 *addr);
  1144. int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data,
  1145. size_t data_len, int encrypt,
  1146. const u8 *own_addr);
  1147. int (*sta_deauth)(void *priv, const u8 *own_addr, const u8 *addr,
  1148. int reason);
  1149. int (*sta_disassoc)(void *priv, const u8 *own_addr, const u8 *addr,
  1150. int reason);
  1151. int (*sta_remove)(void *priv, const u8 *addr);
  1152. int (*hapd_get_ssid)(const char *ifname, void *priv, u8 *buf, int len);
  1153. int (*hapd_set_ssid)(const char *ifname, void *priv, const u8 *buf,
  1154. int len);
  1155. int (*hapd_set_countermeasures)(void *priv, int enabled);
  1156. int (*sta_add)(const char *ifname, void *priv,
  1157. struct hostapd_sta_add_params *params);
  1158. int (*get_inact_sec)(void *priv, const u8 *addr);
  1159. int (*sta_clear_stats)(void *priv, const u8 *addr);
  1160. int (*set_freq)(void *priv, struct hostapd_freq_params *freq);
  1161. int (*set_rts)(void *priv, int rts);
  1162. int (*set_frag)(void *priv, int frag);
  1163. int (*sta_set_flags)(void *priv, const u8 *addr,
  1164. int total_flags, int flags_or, int flags_and);
  1165. int (*set_rate_sets)(void *priv, int *supp_rates, int *basic_rates,
  1166. int mode);
  1167. int (*hapd_set_beacon)(const char *ifname, void *priv,
  1168. const u8 *head, size_t head_len,
  1169. const u8 *tail, size_t tail_len,
  1170. int dtim_period);
  1171. /* Configure internal bridge:
  1172. * 0 = disabled, i.e., client separation is enabled (no bridging of
  1173. * packets between associated STAs
  1174. * 1 = enabled, i.e., bridge packets between associated STAs (default)
  1175. */
  1176. int (*set_internal_bridge)(void *priv, int value);
  1177. int (*set_cts_protect)(void *priv, int value);
  1178. int (*set_preamble)(void *priv, int value);
  1179. int (*set_short_slot_time)(void *priv, int value);
  1180. int (*set_tx_queue_params)(void *priv, int queue, int aifs, int cw_min,
  1181. int cw_max, int burst_time);
  1182. int (*bss_add)(void *priv, const char *ifname, const u8 *bssid);
  1183. int (*bss_remove)(void *priv, const char *ifname);
  1184. int (*valid_bss_mask)(void *priv, const u8 *addr, const u8 *mask);
  1185. int (*if_add)(const char *iface, void *priv,
  1186. enum hostapd_driver_if_type type, char *ifname,
  1187. const u8 *addr);
  1188. int (*if_update)(void *priv, enum hostapd_driver_if_type type,
  1189. char *ifname, const u8 *addr);
  1190. int (*if_remove)(void *priv, enum hostapd_driver_if_type type,
  1191. const char *ifname, const u8 *addr);
  1192. int (*set_sta_vlan)(void *priv, const u8 *addr, const char *ifname,
  1193. int vlan_id);
  1194. /**
  1195. * commit - Optional commit changes handler
  1196. * @priv: driver private data
  1197. * Returns: 0 on success, -1 on failure
  1198. *
  1199. * This optional handler function can be registered if the driver
  1200. * interface implementation needs to commit changes (e.g., by setting
  1201. * network interface up) at the end of initial configuration. If set,
  1202. * this handler will be called after initial setup has been completed.
  1203. */
  1204. int (*commit)(void *priv);
  1205. int (*send_ether)(void *priv, const u8 *dst, const u8 *src, u16 proto,
  1206. const u8 *data, size_t data_len);
  1207. int (*set_radius_acl_auth)(void *priv, const u8 *mac, int accepted,
  1208. u32 session_timeout);
  1209. int (*set_radius_acl_expire)(void *priv, const u8 *mac);
  1210. int (*set_ht_params)(const char *ifname, void *priv,
  1211. const u8 *ht_capab, size_t ht_capab_len,
  1212. const u8 *ht_oper, size_t ht_oper_len);
  1213. int (*set_wps_beacon_ie)(const char *ifname, void *priv,
  1214. const u8 *ie, size_t len);
  1215. int (*set_wps_probe_resp_ie)(const char *ifname, void *priv,
  1216. const u8 *ie, size_t len);
  1217. /**
  1218. * set_supp_port - Set IEEE 802.1X Supplicant Port status
  1219. * @priv: Private driver interface data
  1220. * @authorized: Whether the port is authorized
  1221. * Returns: 0 on success, -1 on failure
  1222. */
  1223. int (*set_supp_port)(void *priv, int authorized);
  1224. };
  1225. /**
  1226. * enum wpa_event_type - Event type for wpa_supplicant_event() calls
  1227. */
  1228. typedef enum wpa_event_type {
  1229. /**
  1230. * EVENT_ASSOC - Association completed
  1231. *
  1232. * This event needs to be delivered when the driver completes IEEE
  1233. * 802.11 association or reassociation successfully.
  1234. * wpa_driver_ops::get_bssid() is expected to provide the current BSSID
  1235. * after this event has been generated. In addition, optional
  1236. * EVENT_ASSOCINFO may be generated just before EVENT_ASSOC to provide
  1237. * more information about the association. If the driver interface gets
  1238. * both of these events at the same time, it can also include the
  1239. * assoc_info data in EVENT_ASSOC call.
  1240. */
  1241. EVENT_ASSOC,
  1242. /**
  1243. * EVENT_DISASSOC - Association lost
  1244. *
  1245. * This event should be called when association is lost either due to
  1246. * receiving deauthenticate or disassociate frame from the AP or when
  1247. * sending either of these frames to the current AP. If the driver
  1248. * supports separate deauthentication event, EVENT_DISASSOC should only
  1249. * be used for disassociation and EVENT_DEAUTH for deauthentication.
  1250. */
  1251. EVENT_DISASSOC,
  1252. /**
  1253. * EVENT_MICHAEL_MIC_FAILURE - Michael MIC (TKIP) detected
  1254. *
  1255. * This event must be delivered when a Michael MIC error is detected by
  1256. * the local driver. Additional data for event processing is
  1257. * provided with union wpa_event_data::michael_mic_failure. This
  1258. * information is used to request new encyption key and to initiate
  1259. * TKIP countermeasures if needed.
  1260. */
  1261. EVENT_MICHAEL_MIC_FAILURE,
  1262. /**
  1263. * EVENT_SCAN_RESULTS - Scan results available
  1264. *
  1265. * This event must be called whenever scan results are available to be
  1266. * fetched with struct wpa_driver_ops::get_scan_results(). This event
  1267. * is expected to be used some time after struct wpa_driver_ops::scan()
  1268. * is called. If the driver provides an unsolicited event when the scan
  1269. * has been completed, this event can be used to trigger
  1270. * EVENT_SCAN_RESULTS call. If such event is not available from the
  1271. * driver, the driver wrapper code is expected to use a registered
  1272. * timeout to generate EVENT_SCAN_RESULTS call after the time that the
  1273. * scan is expected to be completed.
  1274. */
  1275. EVENT_SCAN_RESULTS,
  1276. /**
  1277. * EVENT_ASSOCINFO - Report optional extra information for association
  1278. *
  1279. * This event can be used to report extra association information for
  1280. * EVENT_ASSOC processing. This extra information includes IEs from
  1281. * association frames and Beacon/Probe Response frames in union
  1282. * wpa_event_data::assoc_info. EVENT_ASSOCINFO must be send just before
  1283. * EVENT_ASSOC. Alternatively, the driver interface can include
  1284. * assoc_info data in the EVENT_ASSOC call if it has all the
  1285. * information available at the same point.
  1286. */
  1287. EVENT_ASSOCINFO,
  1288. /**
  1289. * EVENT_INTERFACE_STATUS - Report interface status changes
  1290. *
  1291. * This optional event can be used to report changes in interface
  1292. * status (interface added/removed) using union
  1293. * wpa_event_data::interface_status. This can be used to trigger
  1294. * wpa_supplicant to stop and re-start processing for the interface,
  1295. * e.g., when a cardbus card is ejected/inserted.
  1296. */
  1297. EVENT_INTERFACE_STATUS,
  1298. /**
  1299. * EVENT_PMKID_CANDIDATE - Report a candidate AP for pre-authentication
  1300. *
  1301. * This event can be used to inform wpa_supplicant about candidates for
  1302. * RSN (WPA2) pre-authentication. If wpa_supplicant is not responsible
  1303. * for scan request (ap_scan=2 mode), this event is required for
  1304. * pre-authentication. If wpa_supplicant is performing scan request
  1305. * (ap_scan=1), this event is optional since scan results can be used
  1306. * to add pre-authentication candidates. union
  1307. * wpa_event_data::pmkid_candidate is used to report the BSSID of the
  1308. * candidate and priority of the candidate, e.g., based on the signal
  1309. * strength, in order to try to pre-authenticate first with candidates
  1310. * that are most likely targets for re-association.
  1311. *
  1312. * EVENT_PMKID_CANDIDATE can be called whenever the driver has updates
  1313. * on the candidate list. In addition, it can be called for the current
  1314. * AP and APs that have existing PMKSA cache entries. wpa_supplicant
  1315. * will automatically skip pre-authentication in cases where a valid
  1316. * PMKSA exists. When more than one candidate exists, this event should
  1317. * be generated once for each candidate.
  1318. *
  1319. * Driver will be notified about successful pre-authentication with
  1320. * struct wpa_driver_ops::add_pmkid() calls.
  1321. */
  1322. EVENT_PMKID_CANDIDATE,
  1323. /**
  1324. * EVENT_STKSTART - Request STK handshake (MLME-STKSTART.request)
  1325. *
  1326. * This event can be used to inform wpa_supplicant about desire to set
  1327. * up secure direct link connection between two stations as defined in
  1328. * IEEE 802.11e with a new PeerKey mechanism that replaced the original
  1329. * STAKey negotiation. The caller will need to set peer address for the
  1330. * event.
  1331. */
  1332. EVENT_STKSTART,
  1333. /**
  1334. * EVENT_FT_RESPONSE - Report FT (IEEE 802.11r) response IEs
  1335. *
  1336. * The driver is expected to report the received FT IEs from
  1337. * FT authentication sequence from the AP. The FT IEs are included in
  1338. * the extra information in union wpa_event_data::ft_ies.
  1339. */
  1340. EVENT_FT_RESPONSE,
  1341. /**
  1342. * EVENT_IBSS_RSN_START - Request RSN authentication in IBSS
  1343. *
  1344. * The driver can use this event to inform wpa_supplicant about a STA
  1345. * in an IBSS with which protected frames could be exchanged. This
  1346. * event starts RSN authentication with the other STA to authenticate
  1347. * the STA and set up encryption keys with it.
  1348. */
  1349. EVENT_IBSS_RSN_START,
  1350. /**
  1351. * EVENT_AUTH - Authentication result
  1352. *
  1353. * This event should be called when authentication attempt has been
  1354. * completed. This is only used if the driver supports separate
  1355. * authentication step (struct wpa_driver_ops::authenticate).
  1356. * Information about authentication result is included in
  1357. * union wpa_event_data::auth.
  1358. */
  1359. EVENT_AUTH,
  1360. /**
  1361. * EVENT_DEAUTH - Authentication lost
  1362. *
  1363. * This event should be called when authentication is lost either due
  1364. * to receiving deauthenticate frame from the AP or when sending that
  1365. * frame to the current AP.
  1366. */
  1367. EVENT_DEAUTH,
  1368. /**
  1369. * EVENT_ASSOC_REJECT - Association rejected
  1370. *
  1371. * This event should be called when (re)association attempt has been
  1372. * rejected by the AP. Information about authentication result is
  1373. * included in union wpa_event_data::assoc_reject.
  1374. */
  1375. EVENT_ASSOC_REJECT,
  1376. /**
  1377. * EVENT_AUTH_TIMED_OUT - Authentication timed out
  1378. */
  1379. EVENT_AUTH_TIMED_OUT,
  1380. /**
  1381. * EVENT_ASSOC_TIMED_OUT - Association timed out
  1382. */
  1383. EVENT_ASSOC_TIMED_OUT
  1384. } wpa_event_type;
  1385. /**
  1386. * union wpa_event_data - Additional data for wpa_supplicant_event() calls
  1387. */
  1388. union wpa_event_data {
  1389. /**
  1390. * struct assoc_info - Data for EVENT_ASSOC and EVENT_ASSOCINFO events
  1391. *
  1392. * This structure is optional for EVENT_ASSOC calls and required for
  1393. * EVENT_ASSOCINFO calls. By using EVENT_ASSOC with this data, the
  1394. * driver interface does not need to generate separate EVENT_ASSOCINFO
  1395. * calls.
  1396. */
  1397. struct assoc_info {
  1398. /**
  1399. * req_ies - (Re)Association Request IEs
  1400. *
  1401. * If the driver generates WPA/RSN IE, this event data must be
  1402. * returned for WPA handshake to have needed information. If
  1403. * wpa_supplicant-generated WPA/RSN IE is used, this
  1404. * information event is optional.
  1405. *
  1406. * This should start with the first IE (fixed fields before IEs
  1407. * are not included).
  1408. */
  1409. u8 *req_ies;
  1410. /**
  1411. * req_ies_len - Length of req_ies in bytes
  1412. */
  1413. size_t req_ies_len;
  1414. /**
  1415. * resp_ies - (Re)Association Response IEs
  1416. *
  1417. * Optional association data from the driver. This data is not
  1418. * required WPA, but may be useful for some protocols and as
  1419. * such, should be reported if this is available to the driver
  1420. * interface.
  1421. *
  1422. * This should start with the first IE (fixed fields before IEs
  1423. * are not included).
  1424. */
  1425. u8 *resp_ies;
  1426. /**
  1427. * resp_ies_len - Length of resp_ies in bytes
  1428. */
  1429. size_t resp_ies_len;
  1430. /**
  1431. * beacon_ies - Beacon or Probe Response IEs
  1432. *
  1433. * Optional Beacon/ProbeResp data: IEs included in Beacon or
  1434. * Probe Response frames from the current AP (i.e., the one
  1435. * that the client just associated with). This information is
  1436. * used to update WPA/RSN IE for the AP. If this field is not
  1437. * set, the results from previous scan will be used. If no
  1438. * data for the new AP is found, scan results will be requested
  1439. * again (without scan request). At this point, the driver is
  1440. * expected to provide WPA/RSN IE for the AP (if WPA/WPA2 is
  1441. * used).
  1442. *
  1443. * This should start with the first IE (fixed fields before IEs
  1444. * are not included).
  1445. */
  1446. u8 *beacon_ies;
  1447. /**
  1448. * beacon_ies_len - Length of beacon_ies */
  1449. size_t beacon_ies_len;
  1450. } assoc_info;
  1451. /**
  1452. * struct michael_mic_failure - Data for EVENT_MICHAEL_MIC_FAILURE
  1453. */
  1454. struct michael_mic_failure {
  1455. int unicast;
  1456. const u8 *src;
  1457. } michael_mic_failure;
  1458. /**
  1459. * struct interface_status - Data for EVENT_INTERFACE_STATUS
  1460. */
  1461. struct interface_status {
  1462. char ifname[100];
  1463. enum {
  1464. EVENT_INTERFACE_ADDED, EVENT_INTERFACE_REMOVED
  1465. } ievent;
  1466. } interface_status;
  1467. /**
  1468. * struct pmkid_candidate - Data for EVENT_PMKID_CANDIDATE
  1469. */
  1470. struct pmkid_candidate {
  1471. /** BSSID of the PMKID candidate */
  1472. u8 bssid[ETH_ALEN];
  1473. /** Smaller the index, higher the priority */
  1474. int index;
  1475. /** Whether RSN IE includes pre-authenticate flag */
  1476. int preauth;
  1477. } pmkid_candidate;
  1478. /**
  1479. * struct stkstart - Data for EVENT_STKSTART
  1480. */
  1481. struct stkstart {
  1482. u8 peer[ETH_ALEN];
  1483. } stkstart;
  1484. /**
  1485. * struct ft_ies - FT information elements (EVENT_FT_RESPONSE)
  1486. *
  1487. * During FT (IEEE 802.11r) authentication sequence, the driver is
  1488. * expected to use this event to report received FT IEs (MDIE, FTIE,
  1489. * RSN IE, TIE, possible resource request) to the supplicant. The FT
  1490. * IEs for the next message will be delivered through the
  1491. * struct wpa_driver_ops::update_ft_ies() callback.
  1492. */
  1493. struct ft_ies {
  1494. const u8 *ies;
  1495. size_t ies_len;
  1496. int ft_action;
  1497. u8 target_ap[ETH_ALEN];
  1498. /** Optional IE(s), e.g., WMM TSPEC(s), for RIC-Request */
  1499. const u8 *ric_ies;
  1500. /** Length of ric_ies buffer in octets */
  1501. size_t ric_ies_len;
  1502. } ft_ies;
  1503. /**
  1504. * struct ibss_rsn_start - Data for EVENT_IBSS_RSN_START
  1505. */
  1506. struct ibss_rsn_start {
  1507. u8 peer[ETH_ALEN];
  1508. } ibss_rsn_start;
  1509. /**
  1510. * struct auth_info - Data for EVENT_AUTH events
  1511. */
  1512. struct auth_info {
  1513. u8 peer[ETH_ALEN];
  1514. u16 auth_type;
  1515. u16 status_code;
  1516. const u8 *ies;
  1517. size_t ies_len;
  1518. } auth;
  1519. /**
  1520. * struct assoc_reject - Data for EVENT_ASSOC_REJECT events
  1521. */
  1522. struct assoc_reject {
  1523. /**
  1524. * resp_ies - (Re)Association Response IEs
  1525. *
  1526. * Optional association data from the driver. This data is not
  1527. * required WPA, but may be useful for some protocols and as
  1528. * such, should be reported if this is available to the driver
  1529. * interface.
  1530. *
  1531. * This should start with the first IE (fixed fields before IEs
  1532. * are not included).
  1533. */
  1534. u8 *resp_ies;
  1535. /**
  1536. * resp_ies_len - Length of resp_ies in bytes
  1537. */
  1538. size_t resp_ies_len;
  1539. /**
  1540. * status_code - Status Code from (Re)association Response
  1541. */
  1542. u16 status_code;
  1543. } assoc_reject;
  1544. struct timeout_event {
  1545. u8 addr[ETH_ALEN];
  1546. } timeout_event;
  1547. };
  1548. /**
  1549. * wpa_supplicant_event - Report a driver event for wpa_supplicant
  1550. * @ctx: Context pointer (wpa_s); this is the ctx variable registered
  1551. * with struct wpa_driver_ops::init()
  1552. * @event: event type (defined above)
  1553. * @data: possible extra data for the event
  1554. *
  1555. * Driver wrapper code should call this function whenever an event is received
  1556. * from the driver.
  1557. */
  1558. void wpa_supplicant_event(void *ctx, wpa_event_type event,
  1559. union wpa_event_data *data);
  1560. /**
  1561. * wpa_supplicant_rx_eapol - Deliver a received EAPOL frame to wpa_supplicant
  1562. * @ctx: Context pointer (wpa_s); this is the ctx variable registered
  1563. * with struct wpa_driver_ops::init()
  1564. * @src_addr: Source address of the EAPOL frame
  1565. * @buf: EAPOL data starting from the EAPOL header (i.e., no Ethernet header)
  1566. * @len: Length of the EAPOL data
  1567. *
  1568. * This function is called for each received EAPOL frame. Most driver
  1569. * interfaces rely on more generic OS mechanism for receiving frames through
  1570. * l2_packet, but if such a mechanism is not available, the driver wrapper may
  1571. * take care of received EAPOL frames and deliver them to the core supplicant
  1572. * code by calling this function.
  1573. */
  1574. void wpa_supplicant_rx_eapol(void *ctx, const u8 *src_addr,
  1575. const u8 *buf, size_t len);
  1576. void wpa_supplicant_sta_rx(void *ctx, const u8 *buf, size_t len,
  1577. struct ieee80211_rx_status *rx_status);
  1578. const u8 * wpa_scan_get_ie(const struct wpa_scan_res *res, u8 ie);
  1579. #define WPA_IE_VENDOR_TYPE 0x0050f201
  1580. #define WPS_IE_VENDOR_TYPE 0x0050f204
  1581. const u8 * wpa_scan_get_vendor_ie(const struct wpa_scan_res *res,
  1582. u32 vendor_type);
  1583. struct wpabuf * wpa_scan_get_vendor_ie_multi(const struct wpa_scan_res *res,
  1584. u32 vendor_type);
  1585. int wpa_scan_get_max_rate(const struct wpa_scan_res *res);
  1586. void wpa_scan_results_free(struct wpa_scan_results *res);
  1587. void wpa_scan_sort_results(struct wpa_scan_results *res);
  1588. /* hostapd functions for driver wrappers */
  1589. struct sta_info;
  1590. struct ieee80211_hdr;
  1591. void hostapd_new_assoc_sta(struct hostapd_data *hapd, struct sta_info *sta,
  1592. int reassoc);
  1593. void hostapd_tx_status(struct hostapd_data *hapd, const u8 *addr,
  1594. const u8 *buf, size_t len, int ack);
  1595. void hostapd_rx_from_unknown_sta(struct hostapd_data *hapd,
  1596. const struct ieee80211_hdr *hdr, size_t len);
  1597. int hostapd_notif_assoc(struct hostapd_data *hapd, const u8 *addr,
  1598. const u8 *ie, size_t ielen);
  1599. void hostapd_notif_disassoc(struct hostapd_data *hapd, const u8 *addr);
  1600. void hostapd_eapol_receive(struct hostapd_data *hapd, const u8 *sa,
  1601. const u8 *buf, size_t len);
  1602. struct hostapd_frame_info {
  1603. u32 phytype;
  1604. u32 channel;
  1605. u32 datarate;
  1606. u32 ssi_signal;
  1607. };
  1608. void hostapd_mgmt_rx(struct hostapd_data *hapd, u8 *buf, size_t len,
  1609. u16 stype, struct hostapd_frame_info *fi);
  1610. void hostapd_mgmt_tx_cb(struct hostapd_data *hapd, u8 *buf, size_t len,
  1611. u16 stype, int ok);
  1612. void hostapd_michael_mic_failure(struct hostapd_data *hapd, const u8 *addr);
  1613. struct hostapd_data * hostapd_sta_get_bss(struct hostapd_data *hapd,
  1614. const u8 *addr);
  1615. void hostapd_probe_req_rx(struct hostapd_data *hapd, const u8 *sa,
  1616. const u8 *ie, size_t ie_len);
  1617. #endif /* DRIVER_H */