driver.h 151 KB

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