driver.h 134 KB

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