1#![doc = "Netlink API for 802.11 wireless devices"]
2#![allow(clippy::all)]
3#![allow(unused_imports)]
4#![allow(unused_assignments)]
5#![allow(non_snake_case)]
6#![allow(unused_variables)]
7#![allow(irrefutable_let_patterns)]
8#![allow(unreachable_code)]
9#![allow(unreachable_patterns)]
10use crate::builtin::{PushBuiltinBitfield32, PushBuiltinNfgenmsg, PushDummy, PushNlmsghdr};
11use crate::{
12 consts,
13 traits::{NetlinkRequest, Protocol},
14 utils::*,
15};
16pub const PROTONAME: &CStr = c"nl80211";
17#[doc = "Enum - defines an integer enumeration, with values for each entry incrementing by 1, (e.g. 0, 1, 2, 3)"]
18#[derive(Debug, Clone, Copy)]
19pub enum Commands {
20 Unspec = 0,
21 GetWiphy = 1,
22 SetWiphy = 2,
23 NewWiphy = 3,
24 DelWiphy = 4,
25 GetInterface = 5,
26 SetInterface = 6,
27 NewInterface = 7,
28 DelInterface = 8,
29 GetKey = 9,
30 SetKey = 10,
31 NewKey = 11,
32 DelKey = 12,
33 GetBeacon = 13,
34 SetBeacon = 14,
35 NewBeacon = 15,
36 DelBeacon = 16,
37 GetStation = 17,
38 SetStation = 18,
39 NewStation = 19,
40 DelStation = 20,
41 GetMpath = 21,
42 SetMpath = 22,
43 NewMpath = 23,
44 DelMpath = 24,
45 SetBss = 25,
46 SetReg = 26,
47 ReqSetReg = 27,
48 GetMeshConfig = 28,
49 SetMeshConfig = 29,
50 SetMgmtExtraIe = 30,
51 GetReg = 31,
52 GetScan = 32,
53 TriggerScan = 33,
54 NewScanResults = 34,
55 ScanAborted = 35,
56 RegChange = 36,
57 Authenticate = 37,
58 Associate = 38,
59 Deauthenticate = 39,
60 Disassociate = 40,
61 MichaelMicFailure = 41,
62 RegBeaconHint = 42,
63 JoinIbss = 43,
64 LeaveIbss = 44,
65 Testmode = 45,
66 Connect = 46,
67 Roam = 47,
68 Disconnect = 48,
69 SetWiphyNetns = 49,
70 GetSurvey = 50,
71 NewSurveyResults = 51,
72 SetPmksa = 52,
73 DelPmksa = 53,
74 FlushPmksa = 54,
75 RemainOnChannel = 55,
76 CancelRemainOnChannel = 56,
77 SetTxBitrateMask = 57,
78 RegisterAction = 58,
79 Action = 59,
80 ActionTxStatus = 60,
81 SetPowerSave = 61,
82 GetPowerSave = 62,
83 SetCqm = 63,
84 NotifyCqm = 64,
85 SetChannel = 65,
86 SetWdsPeer = 66,
87 FrameWaitCancel = 67,
88 JoinMesh = 68,
89 LeaveMesh = 69,
90 UnprotDeauthenticate = 70,
91 UnprotDisassociate = 71,
92 NewPeerCandidate = 72,
93 GetWowlan = 73,
94 SetWowlan = 74,
95 StartSchedScan = 75,
96 StopSchedScan = 76,
97 SchedScanResults = 77,
98 SchedScanStopped = 78,
99 SetRekeyOffload = 79,
100 PmksaCandidate = 80,
101 TdlsOper = 81,
102 TdlsMgmt = 82,
103 UnexpectedFrame = 83,
104 ProbeClient = 84,
105 RegisterBeacons = 85,
106 Unexpected4AddrFrame = 86,
107 SetNoackMap = 87,
108 ChSwitchNotify = 88,
109 StartP2pDevice = 89,
110 StopP2pDevice = 90,
111 ConnFailed = 91,
112 SetMcastRate = 92,
113 SetMacAcl = 93,
114 RadarDetect = 94,
115 GetProtocolFeatures = 95,
116 UpdateFtIes = 96,
117 FtEvent = 97,
118 CritProtocolStart = 98,
119 CritProtocolStop = 99,
120 GetCoalesce = 100,
121 SetCoalesce = 101,
122 ChannelSwitch = 102,
123 Vendor = 103,
124 SetQosMap = 104,
125 AddTxTs = 105,
126 DelTxTs = 106,
127 GetMpp = 107,
128 JoinOcb = 108,
129 LeaveOcb = 109,
130 ChSwitchStartedNotify = 110,
131 TdlsChannelSwitch = 111,
132 TdlsCancelChannelSwitch = 112,
133 WiphyRegChange = 113,
134 AbortScan = 114,
135 StartNan = 115,
136 StopNan = 116,
137 AddNanFunction = 117,
138 DelNanFunction = 118,
139 ChangeNanConfig = 119,
140 NanMatch = 120,
141 SetMulticastToUnicast = 121,
142 UpdateConnectParams = 122,
143 SetPmk = 123,
144 DelPmk = 124,
145 PortAuthorized = 125,
146 ReloadRegdb = 126,
147 ExternalAuth = 127,
148 StaOpmodeChanged = 128,
149 ControlPortFrame = 129,
150 GetFtmResponderStats = 130,
151 PeerMeasurementStart = 131,
152 PeerMeasurementResult = 132,
153 PeerMeasurementComplete = 133,
154 NotifyRadar = 134,
155 UpdateOweInfo = 135,
156 ProbeMeshLink = 136,
157 SetTidConfig = 137,
158 UnprotBeacon = 138,
159 ControlPortFrameTxStatus = 139,
160 SetSarSpecs = 140,
161 ObssColorCollision = 141,
162 ColorChangeRequest = 142,
163 ColorChangeStarted = 143,
164 ColorChangeAborted = 144,
165 ColorChangeCompleted = 145,
166 SetFilsAad = 146,
167 AssocComeback = 147,
168 AddLink = 148,
169 RemoveLink = 149,
170 AddLinkSta = 150,
171 ModifyLinkSta = 151,
172 RemoveLinkSta = 152,
173 SetHwTimestamp = 153,
174 LinksRemoved = 154,
175 SetTidToLinkMapping = 155,
176}
177impl Commands {
178 pub fn from_value(value: u64) -> Option<Self> {
179 Some(match value {
180 0 => Self::Unspec,
181 1 => Self::GetWiphy,
182 2 => Self::SetWiphy,
183 3 => Self::NewWiphy,
184 4 => Self::DelWiphy,
185 5 => Self::GetInterface,
186 6 => Self::SetInterface,
187 7 => Self::NewInterface,
188 8 => Self::DelInterface,
189 9 => Self::GetKey,
190 10 => Self::SetKey,
191 11 => Self::NewKey,
192 12 => Self::DelKey,
193 13 => Self::GetBeacon,
194 14 => Self::SetBeacon,
195 15 => Self::NewBeacon,
196 16 => Self::DelBeacon,
197 17 => Self::GetStation,
198 18 => Self::SetStation,
199 19 => Self::NewStation,
200 20 => Self::DelStation,
201 21 => Self::GetMpath,
202 22 => Self::SetMpath,
203 23 => Self::NewMpath,
204 24 => Self::DelMpath,
205 25 => Self::SetBss,
206 26 => Self::SetReg,
207 27 => Self::ReqSetReg,
208 28 => Self::GetMeshConfig,
209 29 => Self::SetMeshConfig,
210 30 => Self::SetMgmtExtraIe,
211 31 => Self::GetReg,
212 32 => Self::GetScan,
213 33 => Self::TriggerScan,
214 34 => Self::NewScanResults,
215 35 => Self::ScanAborted,
216 36 => Self::RegChange,
217 37 => Self::Authenticate,
218 38 => Self::Associate,
219 39 => Self::Deauthenticate,
220 40 => Self::Disassociate,
221 41 => Self::MichaelMicFailure,
222 42 => Self::RegBeaconHint,
223 43 => Self::JoinIbss,
224 44 => Self::LeaveIbss,
225 45 => Self::Testmode,
226 46 => Self::Connect,
227 47 => Self::Roam,
228 48 => Self::Disconnect,
229 49 => Self::SetWiphyNetns,
230 50 => Self::GetSurvey,
231 51 => Self::NewSurveyResults,
232 52 => Self::SetPmksa,
233 53 => Self::DelPmksa,
234 54 => Self::FlushPmksa,
235 55 => Self::RemainOnChannel,
236 56 => Self::CancelRemainOnChannel,
237 57 => Self::SetTxBitrateMask,
238 58 => Self::RegisterAction,
239 59 => Self::Action,
240 60 => Self::ActionTxStatus,
241 61 => Self::SetPowerSave,
242 62 => Self::GetPowerSave,
243 63 => Self::SetCqm,
244 64 => Self::NotifyCqm,
245 65 => Self::SetChannel,
246 66 => Self::SetWdsPeer,
247 67 => Self::FrameWaitCancel,
248 68 => Self::JoinMesh,
249 69 => Self::LeaveMesh,
250 70 => Self::UnprotDeauthenticate,
251 71 => Self::UnprotDisassociate,
252 72 => Self::NewPeerCandidate,
253 73 => Self::GetWowlan,
254 74 => Self::SetWowlan,
255 75 => Self::StartSchedScan,
256 76 => Self::StopSchedScan,
257 77 => Self::SchedScanResults,
258 78 => Self::SchedScanStopped,
259 79 => Self::SetRekeyOffload,
260 80 => Self::PmksaCandidate,
261 81 => Self::TdlsOper,
262 82 => Self::TdlsMgmt,
263 83 => Self::UnexpectedFrame,
264 84 => Self::ProbeClient,
265 85 => Self::RegisterBeacons,
266 86 => Self::Unexpected4AddrFrame,
267 87 => Self::SetNoackMap,
268 88 => Self::ChSwitchNotify,
269 89 => Self::StartP2pDevice,
270 90 => Self::StopP2pDevice,
271 91 => Self::ConnFailed,
272 92 => Self::SetMcastRate,
273 93 => Self::SetMacAcl,
274 94 => Self::RadarDetect,
275 95 => Self::GetProtocolFeatures,
276 96 => Self::UpdateFtIes,
277 97 => Self::FtEvent,
278 98 => Self::CritProtocolStart,
279 99 => Self::CritProtocolStop,
280 100 => Self::GetCoalesce,
281 101 => Self::SetCoalesce,
282 102 => Self::ChannelSwitch,
283 103 => Self::Vendor,
284 104 => Self::SetQosMap,
285 105 => Self::AddTxTs,
286 106 => Self::DelTxTs,
287 107 => Self::GetMpp,
288 108 => Self::JoinOcb,
289 109 => Self::LeaveOcb,
290 110 => Self::ChSwitchStartedNotify,
291 111 => Self::TdlsChannelSwitch,
292 112 => Self::TdlsCancelChannelSwitch,
293 113 => Self::WiphyRegChange,
294 114 => Self::AbortScan,
295 115 => Self::StartNan,
296 116 => Self::StopNan,
297 117 => Self::AddNanFunction,
298 118 => Self::DelNanFunction,
299 119 => Self::ChangeNanConfig,
300 120 => Self::NanMatch,
301 121 => Self::SetMulticastToUnicast,
302 122 => Self::UpdateConnectParams,
303 123 => Self::SetPmk,
304 124 => Self::DelPmk,
305 125 => Self::PortAuthorized,
306 126 => Self::ReloadRegdb,
307 127 => Self::ExternalAuth,
308 128 => Self::StaOpmodeChanged,
309 129 => Self::ControlPortFrame,
310 130 => Self::GetFtmResponderStats,
311 131 => Self::PeerMeasurementStart,
312 132 => Self::PeerMeasurementResult,
313 133 => Self::PeerMeasurementComplete,
314 134 => Self::NotifyRadar,
315 135 => Self::UpdateOweInfo,
316 136 => Self::ProbeMeshLink,
317 137 => Self::SetTidConfig,
318 138 => Self::UnprotBeacon,
319 139 => Self::ControlPortFrameTxStatus,
320 140 => Self::SetSarSpecs,
321 141 => Self::ObssColorCollision,
322 142 => Self::ColorChangeRequest,
323 143 => Self::ColorChangeStarted,
324 144 => Self::ColorChangeAborted,
325 145 => Self::ColorChangeCompleted,
326 146 => Self::SetFilsAad,
327 147 => Self::AssocComeback,
328 148 => Self::AddLink,
329 149 => Self::RemoveLink,
330 150 => Self::AddLinkSta,
331 151 => Self::ModifyLinkSta,
332 152 => Self::RemoveLinkSta,
333 153 => Self::SetHwTimestamp,
334 154 => Self::LinksRemoved,
335 155 => Self::SetTidToLinkMapping,
336 _ => return None,
337 })
338 }
339}
340#[doc = "Flags - defines an integer enumeration, with values for each entry occupying a bit, starting from bit 0, (e.g. 1, 2, 4, 8)"]
341#[derive(Debug, Clone, Copy)]
342pub enum FeatureFlags {
343 SkTxStatus = 1 << 0,
344 HtIbss = 1 << 1,
345 InactivityTimer = 1 << 2,
346 CellBaseRegHints = 1 << 3,
347 P2pDeviceNeedsChannel = 1 << 4,
348 Sae = 1 << 5,
349 LowPriorityScan = 1 << 6,
350 ScanFlush = 1 << 7,
351 ApScan = 1 << 8,
352 VifTxpower = 1 << 9,
353 NeedObssScan = 1 << 10,
354 P2pGoCtwin = 1 << 11,
355 P2pGoOppps = 1 << 12,
356 Reserved = 1 << 13,
357 AdvertiseChanLimits = 1 << 14,
358 FullApClientState = 1 << 15,
359 UserspaceMpm = 1 << 16,
360 ActiveMonitor = 1 << 17,
361 ApModeChanWidthChange = 1 << 18,
362 DsParamSetIeInProbes = 1 << 19,
363 WfaTpcIeInProbes = 1 << 20,
364 Quiet = 1 << 21,
365 TxPowerInsertion = 1 << 22,
366 AcktoEstimation = 1 << 23,
367 StaticSmps = 1 << 24,
368 DynamicSmps = 1 << 25,
369 SupportsWmmAdmission = 1 << 26,
370 MacOnCreate = 1 << 27,
371 TdlsChannelSwitch = 1 << 28,
372 ScanRandomMacAddr = 1 << 29,
373 SchedScanRandomMacAddr = 1 << 30,
374 NoRandomMacAddr = 1 << 31,
375}
376impl FeatureFlags {
377 pub fn from_value(value: u64) -> Option<Self> {
378 Some(match value {
379 n if n == 1 << 0 => Self::SkTxStatus,
380 n if n == 1 << 1 => Self::HtIbss,
381 n if n == 1 << 2 => Self::InactivityTimer,
382 n if n == 1 << 3 => Self::CellBaseRegHints,
383 n if n == 1 << 4 => Self::P2pDeviceNeedsChannel,
384 n if n == 1 << 5 => Self::Sae,
385 n if n == 1 << 6 => Self::LowPriorityScan,
386 n if n == 1 << 7 => Self::ScanFlush,
387 n if n == 1 << 8 => Self::ApScan,
388 n if n == 1 << 9 => Self::VifTxpower,
389 n if n == 1 << 10 => Self::NeedObssScan,
390 n if n == 1 << 11 => Self::P2pGoCtwin,
391 n if n == 1 << 12 => Self::P2pGoOppps,
392 n if n == 1 << 13 => Self::Reserved,
393 n if n == 1 << 14 => Self::AdvertiseChanLimits,
394 n if n == 1 << 15 => Self::FullApClientState,
395 n if n == 1 << 16 => Self::UserspaceMpm,
396 n if n == 1 << 17 => Self::ActiveMonitor,
397 n if n == 1 << 18 => Self::ApModeChanWidthChange,
398 n if n == 1 << 19 => Self::DsParamSetIeInProbes,
399 n if n == 1 << 20 => Self::WfaTpcIeInProbes,
400 n if n == 1 << 21 => Self::Quiet,
401 n if n == 1 << 22 => Self::TxPowerInsertion,
402 n if n == 1 << 23 => Self::AcktoEstimation,
403 n if n == 1 << 24 => Self::StaticSmps,
404 n if n == 1 << 25 => Self::DynamicSmps,
405 n if n == 1 << 26 => Self::SupportsWmmAdmission,
406 n if n == 1 << 27 => Self::MacOnCreate,
407 n if n == 1 << 28 => Self::TdlsChannelSwitch,
408 n if n == 1 << 29 => Self::ScanRandomMacAddr,
409 n if n == 1 << 30 => Self::SchedScanRandomMacAddr,
410 n if n == 1 << 31 => Self::NoRandomMacAddr,
411 _ => return None,
412 })
413 }
414}
415#[doc = "Enum - defines an integer enumeration, with values for each entry incrementing by 1, (e.g. 0, 1, 2, 3)"]
416#[derive(Debug, Clone, Copy)]
417pub enum ChannelType {
418 NoHt = 0,
419 Ht20 = 1,
420 Ht40minus = 2,
421 Ht40plus = 3,
422}
423impl ChannelType {
424 pub fn from_value(value: u64) -> Option<Self> {
425 Some(match value {
426 0 => Self::NoHt,
427 1 => Self::Ht20,
428 2 => Self::Ht40minus,
429 3 => Self::Ht40plus,
430 _ => return None,
431 })
432 }
433}
434#[doc = "Flags - defines an integer enumeration, with values for each entry occupying a bit, starting from bit 0, (e.g. 1, 2, 4, 8)"]
435#[derive(Debug, Clone, Copy)]
436pub enum ProtocolFeatures {
437 SplitWiphyDump = 1 << 0,
438}
439impl ProtocolFeatures {
440 pub fn from_value(value: u64) -> Option<Self> {
441 Some(match value {
442 n if n == 1 << 0 => Self::SplitWiphyDump,
443 _ => return None,
444 })
445 }
446}
447#[derive(Clone)]
448pub enum Nl80211Attrs<'a> {
449 Wiphy(u32),
450 WiphyName(&'a CStr),
451 Ifindex(u32),
452 Ifname(&'a CStr),
453 Iftype(u32),
454 Mac(&'a [u8]),
455 KeyData(&'a [u8]),
456 KeyIdx(u8),
457 KeyCipher(u32),
458 KeySeq(&'a [u8]),
459 KeyDefault(()),
460 BeaconInterval(u32),
461 DtimPeriod(u32),
462 BeaconHead(&'a [u8]),
463 BeaconTail(&'a [u8]),
464 StaAid(u16),
465 StaFlags(&'a [u8]),
466 StaListenInterval(u16),
467 StaSupportedRates(&'a [u8]),
468 StaVlan(u32),
469 StaInfo(&'a [u8]),
470 WiphyBands(IterableWiphyBands<'a>),
471 MntrFlags(&'a [u8]),
472 MeshId(&'a [u8]),
473 StaPlinkAction(u8),
474 MpathNextHop(&'a [u8]),
475 MpathInfo(&'a [u8]),
476 BssCtsProt(u8),
477 BssShortPreamble(u8),
478 BssShortSlotTime(u8),
479 HtCapability(&'a [u8]),
480 SupportedIftypes(IterableSupportedIftypes<'a>),
481 RegAlpha2(&'a [u8]),
482 RegRules(&'a [u8]),
483 MeshConfig(&'a [u8]),
484 BssBasicRates(&'a [u8]),
485 WiphyTxqParams(&'a [u8]),
486 WiphyFreq(u32),
487 #[doc = "Associated type: \"ChannelType\" (enum)"]
488 WiphyChannelType(u32),
489 KeyDefaultMgmt(()),
490 MgmtSubtype(u8),
491 Ie(&'a [u8]),
492 MaxNumScanSsids(u8),
493 ScanFrequencies(&'a [u8]),
494 ScanSsids(&'a [u8]),
495 Generation(u32),
496 Bss(&'a [u8]),
497 RegInitiator(u8),
498 RegType(u8),
499 #[doc = "Associated type: \"Commands\" (enum)"]
500 SupportedCommands(IterableArrayU32<'a>),
501 Frame(&'a [u8]),
502 Ssid(&'a [u8]),
503 AuthType(u32),
504 ReasonCode(u16),
505 KeyType(u32),
506 MaxScanIeLen(u16),
507 CipherSuites(&'a [u8]),
508 FreqBefore(&'a [u8]),
509 FreqAfter(&'a [u8]),
510 FreqFixed(()),
511 WiphyRetryShort(u8),
512 WiphyRetryLong(u8),
513 WiphyFragThreshold(u32),
514 WiphyRtsThreshold(u32),
515 TimedOut(()),
516 UseMfp(u32),
517 StaFlags2(PushStaFlagUpdate),
518 ControlPort(()),
519 Testdata(&'a [u8]),
520 Privacy(()),
521 DisconnectedByAp(()),
522 StatusCode(u16),
523 CipherSuitesPairwise(&'a [u8]),
524 CipherSuiteGroup(u32),
525 WpaVersions(u32),
526 AkmSuites(&'a [u8]),
527 ReqIe(&'a [u8]),
528 RespIe(&'a [u8]),
529 PrevBssid(&'a [u8]),
530 Key(&'a [u8]),
531 Keys(&'a [u8]),
532 Pid(u32),
533 _4addr(u8),
534 SurveyInfo(&'a [u8]),
535 Pmkid(&'a [u8]),
536 MaxNumPmkids(u8),
537 Duration(u32),
538 Cookie(u64),
539 WiphyCoverageClass(u8),
540 TxRates(&'a [u8]),
541 FrameMatch(&'a [u8]),
542 Ack(()),
543 PsState(u32),
544 Cqm(&'a [u8]),
545 LocalStateChange(()),
546 ApIsolate(u8),
547 WiphyTxPowerSetting(u32),
548 WiphyTxPowerLevel(u32),
549 TxFrameTypes(IterableIftypeAttrs<'a>),
550 RxFrameTypes(IterableIftypeAttrs<'a>),
551 FrameType(u16),
552 ControlPortEthertype(()),
553 ControlPortNoEncrypt(()),
554 SupportIbssRsn(()),
555 WiphyAntennaTx(u32),
556 WiphyAntennaRx(u32),
557 McastRate(u32),
558 OffchannelTxOk(()),
559 BssHtOpmode(u16),
560 KeyDefaultTypes(&'a [u8]),
561 MaxRemainOnChannelDuration(u32),
562 MeshSetup(&'a [u8]),
563 WiphyAntennaAvailTx(u32),
564 WiphyAntennaAvailRx(u32),
565 SupportMeshAuth(()),
566 StaPlinkState(u8),
567 WowlanTriggers(&'a [u8]),
568 WowlanTriggersSupported(IterableWowlanTriggersAttrs<'a>),
569 SchedScanInterval(u32),
570 InterfaceCombinations(IterableArrayIfCombinationAttributes<'a>),
571 SoftwareIftypes(IterableSupportedIftypes<'a>),
572 RekeyData(&'a [u8]),
573 MaxNumSchedScanSsids(u8),
574 MaxSchedScanIeLen(u16),
575 ScanSuppRates(&'a [u8]),
576 HiddenSsid(u32),
577 IeProbeResp(&'a [u8]),
578 IeAssocResp(&'a [u8]),
579 StaWme(&'a [u8]),
580 SupportApUapsd(()),
581 RoamSupport(()),
582 SchedScanMatch(&'a [u8]),
583 MaxMatchSets(u8),
584 PmksaCandidate(&'a [u8]),
585 TxNoCckRate(()),
586 TdlsAction(u8),
587 TdlsDialogToken(u8),
588 TdlsOperation(u8),
589 TdlsSupport(()),
590 TdlsExternalSetup(()),
591 DeviceApSme(u32),
592 DontWaitForAck(()),
593 #[doc = "Associated type: \"FeatureFlags\" (1 bit per enumeration)"]
594 FeatureFlags(u32),
595 ProbeRespOffload(u32),
596 ProbeResp(&'a [u8]),
597 DfsRegion(u8),
598 DisableHt(()),
599 HtCapabilityMask(&'a [u8]),
600 NoackMap(u16),
601 InactivityTimeout(u16),
602 RxSignalDbm(u32),
603 BgScanPeriod(u16),
604 Wdev(u64),
605 UserRegHintType(u32),
606 ConnFailedReason(u32),
607 AuthData(&'a [u8]),
608 VhtCapability(&'a [u8]),
609 ScanFlags(u32),
610 ChannelWidth(u32),
611 CenterFreq1(u32),
612 CenterFreq2(u32),
613 P2pCtwindow(u8),
614 P2pOppps(u8),
615 LocalMeshPowerMode(u32),
616 AclPolicy(u32),
617 MacAddrs(&'a [u8]),
618 MacAclMax(u32),
619 RadarEvent(u32),
620 ExtCapa(&'a [u8]),
621 ExtCapaMask(&'a [u8]),
622 StaCapability(u16),
623 StaExtCapability(&'a [u8]),
624 #[doc = "Associated type: \"ProtocolFeatures\" (enum)"]
625 ProtocolFeatures(u32),
626 SplitWiphyDump(()),
627 DisableVht(()),
628 VhtCapabilityMask(&'a [u8]),
629 Mdid(u16),
630 IeRic(&'a [u8]),
631 CritProtId(u16),
632 MaxCritProtDuration(u16),
633 PeerAid(u16),
634 CoalesceRule(&'a [u8]),
635 ChSwitchCount(u32),
636 ChSwitchBlockTx(()),
637 CsaIes(&'a [u8]),
638 CntdwnOffsBeacon(&'a [u8]),
639 CntdwnOffsPresp(&'a [u8]),
640 RxmgmtFlags(&'a [u8]),
641 StaSupportedChannels(&'a [u8]),
642 StaSupportedOperClasses(&'a [u8]),
643 HandleDfs(()),
644 Support5Mhz(()),
645 Support10Mhz(()),
646 OpmodeNotif(u8),
647 VendorId(u32),
648 VendorSubcmd(u32),
649 VendorData(&'a [u8]),
650 VendorEvents(&'a [u8]),
651 QosMap(&'a [u8]),
652 MacHint(&'a [u8]),
653 WiphyFreqHint(u32),
654 MaxApAssocSta(u32),
655 TdlsPeerCapability(u32),
656 SocketOwner(()),
657 CsaCOffsetsTx(&'a [u8]),
658 MaxCsaCounters(u8),
659 TdlsInitiator(()),
660 UseRrm(()),
661 WiphyDynAck(()),
662 Tsid(u8),
663 UserPrio(u8),
664 AdmittedTime(u16),
665 SmpsMode(u8),
666 OperClass(u8),
667 MacMask(&'a [u8]),
668 WiphySelfManagedReg(()),
669 ExtFeatures(&'a [u8]),
670 SurveyRadioStats(&'a [u8]),
671 NetnsFd(u32),
672 SchedScanDelay(u32),
673 RegIndoor(()),
674 MaxNumSchedScanPlans(u32),
675 MaxScanPlanInterval(u32),
676 MaxScanPlanIterations(u32),
677 SchedScanPlans(&'a [u8]),
678 Pbss(()),
679 BssSelect(&'a [u8]),
680 StaSupportP2pPs(u8),
681 Pad(&'a [u8]),
682 IftypeExtCapa(&'a [u8]),
683 MuMimoGroupData(&'a [u8]),
684 MuMimoFollowMacAddr(&'a [u8]),
685 ScanStartTimeTsf(u64),
686 ScanStartTimeTsfBssid(&'a [u8]),
687 MeasurementDuration(u16),
688 MeasurementDurationMandatory(()),
689 MeshPeerAid(u16),
690 NanMasterPref(u8),
691 Bands(u32),
692 NanFunc(&'a [u8]),
693 NanMatch(&'a [u8]),
694 FilsKek(&'a [u8]),
695 FilsNonces(&'a [u8]),
696 MulticastToUnicastEnabled(()),
697 Bssid(&'a [u8]),
698 SchedScanRelativeRssi(i8),
699 SchedScanRssiAdjust(&'a [u8]),
700 TimeoutReason(u32),
701 FilsErpUsername(&'a [u8]),
702 FilsErpRealm(&'a [u8]),
703 FilsErpNextSeqNum(u16),
704 FilsErpRrk(&'a [u8]),
705 FilsCacheId(&'a [u8]),
706 Pmk(&'a [u8]),
707 SchedScanMulti(()),
708 SchedScanMaxReqs(u32),
709 Want1x4wayHs(()),
710 Pmkr0Name(&'a [u8]),
711 PortAuthorized(&'a [u8]),
712 ExternalAuthAction(u32),
713 ExternalAuthSupport(()),
714 Nss(u8),
715 AckSignal(i32),
716 ControlPortOverNl80211(()),
717 TxqStats(IterableTxqStatsAttrs<'a>),
718 TxqLimit(u32),
719 TxqMemoryLimit(u32),
720 TxqQuantum(u32),
721 HeCapability(&'a [u8]),
722 FtmResponder(&'a [u8]),
723 FtmResponderStats(&'a [u8]),
724 Timeout(u32),
725 PeerMeasurements(&'a [u8]),
726 AirtimeWeight(u16),
727 StaTxPowerSetting(u8),
728 StaTxPower(i16),
729 SaePassword(&'a [u8]),
730 TwtResponder(()),
731 HeObssPd(&'a [u8]),
732 WiphyEdmgChannels(u8),
733 WiphyEdmgBwConfig(u8),
734 VlanId(u16),
735 HeBssColor(&'a [u8]),
736 IftypeAkmSuites(&'a [u8]),
737 TidConfig(&'a [u8]),
738 ControlPortNoPreauth(()),
739 PmkLifetime(u32),
740 PmkReauthThreshold(u8),
741 ReceiveMulticast(()),
742 WiphyFreqOffset(u32),
743 CenterFreq1Offset(u32),
744 ScanFreqKhz(&'a [u8]),
745 He6ghzCapability(&'a [u8]),
746 FilsDiscovery(&'a [u8]),
747 UnsolBcastProbeResp(&'a [u8]),
748 S1gCapability(&'a [u8]),
749 S1gCapabilityMask(&'a [u8]),
750 SaePwe(u8),
751 ReconnectRequested(&'a [u8]),
752 SarSpec(IterableSarAttributes<'a>),
753 DisableHe(()),
754 ObssColorBitmap(u64),
755 ColorChangeCount(u8),
756 ColorChangeColor(u8),
757 ColorChangeElems(&'a [u8]),
758 MbssidConfig(&'a [u8]),
759 MbssidElems(&'a [u8]),
760 RadarBackground(()),
761 ApSettingsFlags(u32),
762 EhtCapability(&'a [u8]),
763 DisableEht(()),
764 MloLinks(&'a [u8]),
765 MloLinkId(u8),
766 MldAddr(&'a [u8]),
767 MloSupport(()),
768 MaxNumAkmSuites(&'a [u8]),
769 EmlCapability(u16),
770 MldCapaAndOps(u16),
771 TxHwTimestamp(u64),
772 RxHwTimestamp(u64),
773 TdBitmap(&'a [u8]),
774 PunctBitmap(u32),
775 MaxHwTimestampPeers(u16),
776 HwTimestampEnabled(()),
777 EmaRnrElems(&'a [u8]),
778 MloLinkDisabled(()),
779 BssDumpIncludeUseData(()),
780 MloTtlmDlink(u16),
781 MloTtlmUlink(u16),
782 AssocSppAmsdu(()),
783 WiphyRadios(&'a [u8]),
784 WiphyInterfaceCombinations(&'a [u8]),
785 VifRadioMask(u32),
786}
787impl<'a> IterableNl80211Attrs<'a> {
788 pub fn get_wiphy(&self) -> Result<u32, ErrorContext> {
789 let mut iter = self.clone();
790 iter.pos = 0;
791 for attr in iter {
792 if let Nl80211Attrs::Wiphy(val) = attr? {
793 return Ok(val);
794 }
795 }
796 Err(ErrorContext::new_missing(
797 "Nl80211Attrs",
798 "Wiphy",
799 self.orig_loc,
800 self.buf.as_ptr() as usize,
801 ))
802 }
803 pub fn get_wiphy_name(&self) -> Result<&'a CStr, ErrorContext> {
804 let mut iter = self.clone();
805 iter.pos = 0;
806 for attr in iter {
807 if let Nl80211Attrs::WiphyName(val) = attr? {
808 return Ok(val);
809 }
810 }
811 Err(ErrorContext::new_missing(
812 "Nl80211Attrs",
813 "WiphyName",
814 self.orig_loc,
815 self.buf.as_ptr() as usize,
816 ))
817 }
818 pub fn get_ifindex(&self) -> Result<u32, ErrorContext> {
819 let mut iter = self.clone();
820 iter.pos = 0;
821 for attr in iter {
822 if let Nl80211Attrs::Ifindex(val) = attr? {
823 return Ok(val);
824 }
825 }
826 Err(ErrorContext::new_missing(
827 "Nl80211Attrs",
828 "Ifindex",
829 self.orig_loc,
830 self.buf.as_ptr() as usize,
831 ))
832 }
833 pub fn get_ifname(&self) -> Result<&'a CStr, ErrorContext> {
834 let mut iter = self.clone();
835 iter.pos = 0;
836 for attr in iter {
837 if let Nl80211Attrs::Ifname(val) = attr? {
838 return Ok(val);
839 }
840 }
841 Err(ErrorContext::new_missing(
842 "Nl80211Attrs",
843 "Ifname",
844 self.orig_loc,
845 self.buf.as_ptr() as usize,
846 ))
847 }
848 pub fn get_iftype(&self) -> Result<u32, ErrorContext> {
849 let mut iter = self.clone();
850 iter.pos = 0;
851 for attr in iter {
852 if let Nl80211Attrs::Iftype(val) = attr? {
853 return Ok(val);
854 }
855 }
856 Err(ErrorContext::new_missing(
857 "Nl80211Attrs",
858 "Iftype",
859 self.orig_loc,
860 self.buf.as_ptr() as usize,
861 ))
862 }
863 pub fn get_mac(&self) -> Result<&'a [u8], ErrorContext> {
864 let mut iter = self.clone();
865 iter.pos = 0;
866 for attr in iter {
867 if let Nl80211Attrs::Mac(val) = attr? {
868 return Ok(val);
869 }
870 }
871 Err(ErrorContext::new_missing(
872 "Nl80211Attrs",
873 "Mac",
874 self.orig_loc,
875 self.buf.as_ptr() as usize,
876 ))
877 }
878 pub fn get_key_data(&self) -> Result<&'a [u8], ErrorContext> {
879 let mut iter = self.clone();
880 iter.pos = 0;
881 for attr in iter {
882 if let Nl80211Attrs::KeyData(val) = attr? {
883 return Ok(val);
884 }
885 }
886 Err(ErrorContext::new_missing(
887 "Nl80211Attrs",
888 "KeyData",
889 self.orig_loc,
890 self.buf.as_ptr() as usize,
891 ))
892 }
893 pub fn get_key_idx(&self) -> Result<u8, ErrorContext> {
894 let mut iter = self.clone();
895 iter.pos = 0;
896 for attr in iter {
897 if let Nl80211Attrs::KeyIdx(val) = attr? {
898 return Ok(val);
899 }
900 }
901 Err(ErrorContext::new_missing(
902 "Nl80211Attrs",
903 "KeyIdx",
904 self.orig_loc,
905 self.buf.as_ptr() as usize,
906 ))
907 }
908 pub fn get_key_cipher(&self) -> Result<u32, ErrorContext> {
909 let mut iter = self.clone();
910 iter.pos = 0;
911 for attr in iter {
912 if let Nl80211Attrs::KeyCipher(val) = attr? {
913 return Ok(val);
914 }
915 }
916 Err(ErrorContext::new_missing(
917 "Nl80211Attrs",
918 "KeyCipher",
919 self.orig_loc,
920 self.buf.as_ptr() as usize,
921 ))
922 }
923 pub fn get_key_seq(&self) -> Result<&'a [u8], ErrorContext> {
924 let mut iter = self.clone();
925 iter.pos = 0;
926 for attr in iter {
927 if let Nl80211Attrs::KeySeq(val) = attr? {
928 return Ok(val);
929 }
930 }
931 Err(ErrorContext::new_missing(
932 "Nl80211Attrs",
933 "KeySeq",
934 self.orig_loc,
935 self.buf.as_ptr() as usize,
936 ))
937 }
938 pub fn get_key_default(&self) -> Result<(), ErrorContext> {
939 let mut iter = self.clone();
940 iter.pos = 0;
941 for attr in iter {
942 if let Nl80211Attrs::KeyDefault(val) = attr? {
943 return Ok(val);
944 }
945 }
946 Err(ErrorContext::new_missing(
947 "Nl80211Attrs",
948 "KeyDefault",
949 self.orig_loc,
950 self.buf.as_ptr() as usize,
951 ))
952 }
953 pub fn get_beacon_interval(&self) -> Result<u32, ErrorContext> {
954 let mut iter = self.clone();
955 iter.pos = 0;
956 for attr in iter {
957 if let Nl80211Attrs::BeaconInterval(val) = attr? {
958 return Ok(val);
959 }
960 }
961 Err(ErrorContext::new_missing(
962 "Nl80211Attrs",
963 "BeaconInterval",
964 self.orig_loc,
965 self.buf.as_ptr() as usize,
966 ))
967 }
968 pub fn get_dtim_period(&self) -> Result<u32, ErrorContext> {
969 let mut iter = self.clone();
970 iter.pos = 0;
971 for attr in iter {
972 if let Nl80211Attrs::DtimPeriod(val) = attr? {
973 return Ok(val);
974 }
975 }
976 Err(ErrorContext::new_missing(
977 "Nl80211Attrs",
978 "DtimPeriod",
979 self.orig_loc,
980 self.buf.as_ptr() as usize,
981 ))
982 }
983 pub fn get_beacon_head(&self) -> Result<&'a [u8], ErrorContext> {
984 let mut iter = self.clone();
985 iter.pos = 0;
986 for attr in iter {
987 if let Nl80211Attrs::BeaconHead(val) = attr? {
988 return Ok(val);
989 }
990 }
991 Err(ErrorContext::new_missing(
992 "Nl80211Attrs",
993 "BeaconHead",
994 self.orig_loc,
995 self.buf.as_ptr() as usize,
996 ))
997 }
998 pub fn get_beacon_tail(&self) -> Result<&'a [u8], ErrorContext> {
999 let mut iter = self.clone();
1000 iter.pos = 0;
1001 for attr in iter {
1002 if let Nl80211Attrs::BeaconTail(val) = attr? {
1003 return Ok(val);
1004 }
1005 }
1006 Err(ErrorContext::new_missing(
1007 "Nl80211Attrs",
1008 "BeaconTail",
1009 self.orig_loc,
1010 self.buf.as_ptr() as usize,
1011 ))
1012 }
1013 pub fn get_sta_aid(&self) -> Result<u16, ErrorContext> {
1014 let mut iter = self.clone();
1015 iter.pos = 0;
1016 for attr in iter {
1017 if let Nl80211Attrs::StaAid(val) = attr? {
1018 return Ok(val);
1019 }
1020 }
1021 Err(ErrorContext::new_missing(
1022 "Nl80211Attrs",
1023 "StaAid",
1024 self.orig_loc,
1025 self.buf.as_ptr() as usize,
1026 ))
1027 }
1028 pub fn get_sta_flags(&self) -> Result<&'a [u8], ErrorContext> {
1029 let mut iter = self.clone();
1030 iter.pos = 0;
1031 for attr in iter {
1032 if let Nl80211Attrs::StaFlags(val) = attr? {
1033 return Ok(val);
1034 }
1035 }
1036 Err(ErrorContext::new_missing(
1037 "Nl80211Attrs",
1038 "StaFlags",
1039 self.orig_loc,
1040 self.buf.as_ptr() as usize,
1041 ))
1042 }
1043 pub fn get_sta_listen_interval(&self) -> Result<u16, ErrorContext> {
1044 let mut iter = self.clone();
1045 iter.pos = 0;
1046 for attr in iter {
1047 if let Nl80211Attrs::StaListenInterval(val) = attr? {
1048 return Ok(val);
1049 }
1050 }
1051 Err(ErrorContext::new_missing(
1052 "Nl80211Attrs",
1053 "StaListenInterval",
1054 self.orig_loc,
1055 self.buf.as_ptr() as usize,
1056 ))
1057 }
1058 pub fn get_sta_supported_rates(&self) -> Result<&'a [u8], ErrorContext> {
1059 let mut iter = self.clone();
1060 iter.pos = 0;
1061 for attr in iter {
1062 if let Nl80211Attrs::StaSupportedRates(val) = attr? {
1063 return Ok(val);
1064 }
1065 }
1066 Err(ErrorContext::new_missing(
1067 "Nl80211Attrs",
1068 "StaSupportedRates",
1069 self.orig_loc,
1070 self.buf.as_ptr() as usize,
1071 ))
1072 }
1073 pub fn get_sta_vlan(&self) -> Result<u32, ErrorContext> {
1074 let mut iter = self.clone();
1075 iter.pos = 0;
1076 for attr in iter {
1077 if let Nl80211Attrs::StaVlan(val) = attr? {
1078 return Ok(val);
1079 }
1080 }
1081 Err(ErrorContext::new_missing(
1082 "Nl80211Attrs",
1083 "StaVlan",
1084 self.orig_loc,
1085 self.buf.as_ptr() as usize,
1086 ))
1087 }
1088 pub fn get_sta_info(&self) -> Result<&'a [u8], ErrorContext> {
1089 let mut iter = self.clone();
1090 iter.pos = 0;
1091 for attr in iter {
1092 if let Nl80211Attrs::StaInfo(val) = attr? {
1093 return Ok(val);
1094 }
1095 }
1096 Err(ErrorContext::new_missing(
1097 "Nl80211Attrs",
1098 "StaInfo",
1099 self.orig_loc,
1100 self.buf.as_ptr() as usize,
1101 ))
1102 }
1103 pub fn get_wiphy_bands(&self) -> Result<IterableWiphyBands<'a>, ErrorContext> {
1104 let mut iter = self.clone();
1105 iter.pos = 0;
1106 for attr in iter {
1107 if let Nl80211Attrs::WiphyBands(val) = attr? {
1108 return Ok(val);
1109 }
1110 }
1111 Err(ErrorContext::new_missing(
1112 "Nl80211Attrs",
1113 "WiphyBands",
1114 self.orig_loc,
1115 self.buf.as_ptr() as usize,
1116 ))
1117 }
1118 pub fn get_mntr_flags(&self) -> Result<&'a [u8], ErrorContext> {
1119 let mut iter = self.clone();
1120 iter.pos = 0;
1121 for attr in iter {
1122 if let Nl80211Attrs::MntrFlags(val) = attr? {
1123 return Ok(val);
1124 }
1125 }
1126 Err(ErrorContext::new_missing(
1127 "Nl80211Attrs",
1128 "MntrFlags",
1129 self.orig_loc,
1130 self.buf.as_ptr() as usize,
1131 ))
1132 }
1133 pub fn get_mesh_id(&self) -> Result<&'a [u8], ErrorContext> {
1134 let mut iter = self.clone();
1135 iter.pos = 0;
1136 for attr in iter {
1137 if let Nl80211Attrs::MeshId(val) = attr? {
1138 return Ok(val);
1139 }
1140 }
1141 Err(ErrorContext::new_missing(
1142 "Nl80211Attrs",
1143 "MeshId",
1144 self.orig_loc,
1145 self.buf.as_ptr() as usize,
1146 ))
1147 }
1148 pub fn get_sta_plink_action(&self) -> Result<u8, ErrorContext> {
1149 let mut iter = self.clone();
1150 iter.pos = 0;
1151 for attr in iter {
1152 if let Nl80211Attrs::StaPlinkAction(val) = attr? {
1153 return Ok(val);
1154 }
1155 }
1156 Err(ErrorContext::new_missing(
1157 "Nl80211Attrs",
1158 "StaPlinkAction",
1159 self.orig_loc,
1160 self.buf.as_ptr() as usize,
1161 ))
1162 }
1163 pub fn get_mpath_next_hop(&self) -> Result<&'a [u8], ErrorContext> {
1164 let mut iter = self.clone();
1165 iter.pos = 0;
1166 for attr in iter {
1167 if let Nl80211Attrs::MpathNextHop(val) = attr? {
1168 return Ok(val);
1169 }
1170 }
1171 Err(ErrorContext::new_missing(
1172 "Nl80211Attrs",
1173 "MpathNextHop",
1174 self.orig_loc,
1175 self.buf.as_ptr() as usize,
1176 ))
1177 }
1178 pub fn get_mpath_info(&self) -> Result<&'a [u8], ErrorContext> {
1179 let mut iter = self.clone();
1180 iter.pos = 0;
1181 for attr in iter {
1182 if let Nl80211Attrs::MpathInfo(val) = attr? {
1183 return Ok(val);
1184 }
1185 }
1186 Err(ErrorContext::new_missing(
1187 "Nl80211Attrs",
1188 "MpathInfo",
1189 self.orig_loc,
1190 self.buf.as_ptr() as usize,
1191 ))
1192 }
1193 pub fn get_bss_cts_prot(&self) -> Result<u8, ErrorContext> {
1194 let mut iter = self.clone();
1195 iter.pos = 0;
1196 for attr in iter {
1197 if let Nl80211Attrs::BssCtsProt(val) = attr? {
1198 return Ok(val);
1199 }
1200 }
1201 Err(ErrorContext::new_missing(
1202 "Nl80211Attrs",
1203 "BssCtsProt",
1204 self.orig_loc,
1205 self.buf.as_ptr() as usize,
1206 ))
1207 }
1208 pub fn get_bss_short_preamble(&self) -> Result<u8, ErrorContext> {
1209 let mut iter = self.clone();
1210 iter.pos = 0;
1211 for attr in iter {
1212 if let Nl80211Attrs::BssShortPreamble(val) = attr? {
1213 return Ok(val);
1214 }
1215 }
1216 Err(ErrorContext::new_missing(
1217 "Nl80211Attrs",
1218 "BssShortPreamble",
1219 self.orig_loc,
1220 self.buf.as_ptr() as usize,
1221 ))
1222 }
1223 pub fn get_bss_short_slot_time(&self) -> Result<u8, ErrorContext> {
1224 let mut iter = self.clone();
1225 iter.pos = 0;
1226 for attr in iter {
1227 if let Nl80211Attrs::BssShortSlotTime(val) = attr? {
1228 return Ok(val);
1229 }
1230 }
1231 Err(ErrorContext::new_missing(
1232 "Nl80211Attrs",
1233 "BssShortSlotTime",
1234 self.orig_loc,
1235 self.buf.as_ptr() as usize,
1236 ))
1237 }
1238 pub fn get_ht_capability(&self) -> Result<&'a [u8], ErrorContext> {
1239 let mut iter = self.clone();
1240 iter.pos = 0;
1241 for attr in iter {
1242 if let Nl80211Attrs::HtCapability(val) = attr? {
1243 return Ok(val);
1244 }
1245 }
1246 Err(ErrorContext::new_missing(
1247 "Nl80211Attrs",
1248 "HtCapability",
1249 self.orig_loc,
1250 self.buf.as_ptr() as usize,
1251 ))
1252 }
1253 pub fn get_supported_iftypes(&self) -> Result<IterableSupportedIftypes<'a>, ErrorContext> {
1254 let mut iter = self.clone();
1255 iter.pos = 0;
1256 for attr in iter {
1257 if let Nl80211Attrs::SupportedIftypes(val) = attr? {
1258 return Ok(val);
1259 }
1260 }
1261 Err(ErrorContext::new_missing(
1262 "Nl80211Attrs",
1263 "SupportedIftypes",
1264 self.orig_loc,
1265 self.buf.as_ptr() as usize,
1266 ))
1267 }
1268 pub fn get_reg_alpha2(&self) -> Result<&'a [u8], ErrorContext> {
1269 let mut iter = self.clone();
1270 iter.pos = 0;
1271 for attr in iter {
1272 if let Nl80211Attrs::RegAlpha2(val) = attr? {
1273 return Ok(val);
1274 }
1275 }
1276 Err(ErrorContext::new_missing(
1277 "Nl80211Attrs",
1278 "RegAlpha2",
1279 self.orig_loc,
1280 self.buf.as_ptr() as usize,
1281 ))
1282 }
1283 pub fn get_reg_rules(&self) -> Result<&'a [u8], ErrorContext> {
1284 let mut iter = self.clone();
1285 iter.pos = 0;
1286 for attr in iter {
1287 if let Nl80211Attrs::RegRules(val) = attr? {
1288 return Ok(val);
1289 }
1290 }
1291 Err(ErrorContext::new_missing(
1292 "Nl80211Attrs",
1293 "RegRules",
1294 self.orig_loc,
1295 self.buf.as_ptr() as usize,
1296 ))
1297 }
1298 pub fn get_mesh_config(&self) -> Result<&'a [u8], ErrorContext> {
1299 let mut iter = self.clone();
1300 iter.pos = 0;
1301 for attr in iter {
1302 if let Nl80211Attrs::MeshConfig(val) = attr? {
1303 return Ok(val);
1304 }
1305 }
1306 Err(ErrorContext::new_missing(
1307 "Nl80211Attrs",
1308 "MeshConfig",
1309 self.orig_loc,
1310 self.buf.as_ptr() as usize,
1311 ))
1312 }
1313 pub fn get_bss_basic_rates(&self) -> Result<&'a [u8], ErrorContext> {
1314 let mut iter = self.clone();
1315 iter.pos = 0;
1316 for attr in iter {
1317 if let Nl80211Attrs::BssBasicRates(val) = attr? {
1318 return Ok(val);
1319 }
1320 }
1321 Err(ErrorContext::new_missing(
1322 "Nl80211Attrs",
1323 "BssBasicRates",
1324 self.orig_loc,
1325 self.buf.as_ptr() as usize,
1326 ))
1327 }
1328 pub fn get_wiphy_txq_params(&self) -> Result<&'a [u8], ErrorContext> {
1329 let mut iter = self.clone();
1330 iter.pos = 0;
1331 for attr in iter {
1332 if let Nl80211Attrs::WiphyTxqParams(val) = attr? {
1333 return Ok(val);
1334 }
1335 }
1336 Err(ErrorContext::new_missing(
1337 "Nl80211Attrs",
1338 "WiphyTxqParams",
1339 self.orig_loc,
1340 self.buf.as_ptr() as usize,
1341 ))
1342 }
1343 pub fn get_wiphy_freq(&self) -> Result<u32, ErrorContext> {
1344 let mut iter = self.clone();
1345 iter.pos = 0;
1346 for attr in iter {
1347 if let Nl80211Attrs::WiphyFreq(val) = attr? {
1348 return Ok(val);
1349 }
1350 }
1351 Err(ErrorContext::new_missing(
1352 "Nl80211Attrs",
1353 "WiphyFreq",
1354 self.orig_loc,
1355 self.buf.as_ptr() as usize,
1356 ))
1357 }
1358 #[doc = "Associated type: \"ChannelType\" (enum)"]
1359 pub fn get_wiphy_channel_type(&self) -> Result<u32, ErrorContext> {
1360 let mut iter = self.clone();
1361 iter.pos = 0;
1362 for attr in iter {
1363 if let Nl80211Attrs::WiphyChannelType(val) = attr? {
1364 return Ok(val);
1365 }
1366 }
1367 Err(ErrorContext::new_missing(
1368 "Nl80211Attrs",
1369 "WiphyChannelType",
1370 self.orig_loc,
1371 self.buf.as_ptr() as usize,
1372 ))
1373 }
1374 pub fn get_key_default_mgmt(&self) -> Result<(), ErrorContext> {
1375 let mut iter = self.clone();
1376 iter.pos = 0;
1377 for attr in iter {
1378 if let Nl80211Attrs::KeyDefaultMgmt(val) = attr? {
1379 return Ok(val);
1380 }
1381 }
1382 Err(ErrorContext::new_missing(
1383 "Nl80211Attrs",
1384 "KeyDefaultMgmt",
1385 self.orig_loc,
1386 self.buf.as_ptr() as usize,
1387 ))
1388 }
1389 pub fn get_mgmt_subtype(&self) -> Result<u8, ErrorContext> {
1390 let mut iter = self.clone();
1391 iter.pos = 0;
1392 for attr in iter {
1393 if let Nl80211Attrs::MgmtSubtype(val) = attr? {
1394 return Ok(val);
1395 }
1396 }
1397 Err(ErrorContext::new_missing(
1398 "Nl80211Attrs",
1399 "MgmtSubtype",
1400 self.orig_loc,
1401 self.buf.as_ptr() as usize,
1402 ))
1403 }
1404 pub fn get_ie(&self) -> Result<&'a [u8], ErrorContext> {
1405 let mut iter = self.clone();
1406 iter.pos = 0;
1407 for attr in iter {
1408 if let Nl80211Attrs::Ie(val) = attr? {
1409 return Ok(val);
1410 }
1411 }
1412 Err(ErrorContext::new_missing(
1413 "Nl80211Attrs",
1414 "Ie",
1415 self.orig_loc,
1416 self.buf.as_ptr() as usize,
1417 ))
1418 }
1419 pub fn get_max_num_scan_ssids(&self) -> Result<u8, ErrorContext> {
1420 let mut iter = self.clone();
1421 iter.pos = 0;
1422 for attr in iter {
1423 if let Nl80211Attrs::MaxNumScanSsids(val) = attr? {
1424 return Ok(val);
1425 }
1426 }
1427 Err(ErrorContext::new_missing(
1428 "Nl80211Attrs",
1429 "MaxNumScanSsids",
1430 self.orig_loc,
1431 self.buf.as_ptr() as usize,
1432 ))
1433 }
1434 pub fn get_scan_frequencies(&self) -> Result<&'a [u8], ErrorContext> {
1435 let mut iter = self.clone();
1436 iter.pos = 0;
1437 for attr in iter {
1438 if let Nl80211Attrs::ScanFrequencies(val) = attr? {
1439 return Ok(val);
1440 }
1441 }
1442 Err(ErrorContext::new_missing(
1443 "Nl80211Attrs",
1444 "ScanFrequencies",
1445 self.orig_loc,
1446 self.buf.as_ptr() as usize,
1447 ))
1448 }
1449 pub fn get_scan_ssids(&self) -> Result<&'a [u8], ErrorContext> {
1450 let mut iter = self.clone();
1451 iter.pos = 0;
1452 for attr in iter {
1453 if let Nl80211Attrs::ScanSsids(val) = attr? {
1454 return Ok(val);
1455 }
1456 }
1457 Err(ErrorContext::new_missing(
1458 "Nl80211Attrs",
1459 "ScanSsids",
1460 self.orig_loc,
1461 self.buf.as_ptr() as usize,
1462 ))
1463 }
1464 pub fn get_generation(&self) -> Result<u32, ErrorContext> {
1465 let mut iter = self.clone();
1466 iter.pos = 0;
1467 for attr in iter {
1468 if let Nl80211Attrs::Generation(val) = attr? {
1469 return Ok(val);
1470 }
1471 }
1472 Err(ErrorContext::new_missing(
1473 "Nl80211Attrs",
1474 "Generation",
1475 self.orig_loc,
1476 self.buf.as_ptr() as usize,
1477 ))
1478 }
1479 pub fn get_bss(&self) -> Result<&'a [u8], ErrorContext> {
1480 let mut iter = self.clone();
1481 iter.pos = 0;
1482 for attr in iter {
1483 if let Nl80211Attrs::Bss(val) = attr? {
1484 return Ok(val);
1485 }
1486 }
1487 Err(ErrorContext::new_missing(
1488 "Nl80211Attrs",
1489 "Bss",
1490 self.orig_loc,
1491 self.buf.as_ptr() as usize,
1492 ))
1493 }
1494 pub fn get_reg_initiator(&self) -> Result<u8, ErrorContext> {
1495 let mut iter = self.clone();
1496 iter.pos = 0;
1497 for attr in iter {
1498 if let Nl80211Attrs::RegInitiator(val) = attr? {
1499 return Ok(val);
1500 }
1501 }
1502 Err(ErrorContext::new_missing(
1503 "Nl80211Attrs",
1504 "RegInitiator",
1505 self.orig_loc,
1506 self.buf.as_ptr() as usize,
1507 ))
1508 }
1509 pub fn get_reg_type(&self) -> Result<u8, ErrorContext> {
1510 let mut iter = self.clone();
1511 iter.pos = 0;
1512 for attr in iter {
1513 if let Nl80211Attrs::RegType(val) = attr? {
1514 return Ok(val);
1515 }
1516 }
1517 Err(ErrorContext::new_missing(
1518 "Nl80211Attrs",
1519 "RegType",
1520 self.orig_loc,
1521 self.buf.as_ptr() as usize,
1522 ))
1523 }
1524 #[doc = "Associated type: \"Commands\" (enum)"]
1525 pub fn get_supported_commands(
1526 &self,
1527 ) -> Result<ArrayIterable<IterableArrayU32<'a>, u32>, ErrorContext> {
1528 for attr in self.clone() {
1529 if let Nl80211Attrs::SupportedCommands(val) = attr? {
1530 return Ok(ArrayIterable::new(val));
1531 }
1532 }
1533 Err(ErrorContext::new_missing(
1534 "Nl80211Attrs",
1535 "SupportedCommands",
1536 self.orig_loc,
1537 self.buf.as_ptr() as usize,
1538 ))
1539 }
1540 pub fn get_frame(&self) -> Result<&'a [u8], ErrorContext> {
1541 let mut iter = self.clone();
1542 iter.pos = 0;
1543 for attr in iter {
1544 if let Nl80211Attrs::Frame(val) = attr? {
1545 return Ok(val);
1546 }
1547 }
1548 Err(ErrorContext::new_missing(
1549 "Nl80211Attrs",
1550 "Frame",
1551 self.orig_loc,
1552 self.buf.as_ptr() as usize,
1553 ))
1554 }
1555 pub fn get_ssid(&self) -> Result<&'a [u8], ErrorContext> {
1556 let mut iter = self.clone();
1557 iter.pos = 0;
1558 for attr in iter {
1559 if let Nl80211Attrs::Ssid(val) = attr? {
1560 return Ok(val);
1561 }
1562 }
1563 Err(ErrorContext::new_missing(
1564 "Nl80211Attrs",
1565 "Ssid",
1566 self.orig_loc,
1567 self.buf.as_ptr() as usize,
1568 ))
1569 }
1570 pub fn get_auth_type(&self) -> Result<u32, ErrorContext> {
1571 let mut iter = self.clone();
1572 iter.pos = 0;
1573 for attr in iter {
1574 if let Nl80211Attrs::AuthType(val) = attr? {
1575 return Ok(val);
1576 }
1577 }
1578 Err(ErrorContext::new_missing(
1579 "Nl80211Attrs",
1580 "AuthType",
1581 self.orig_loc,
1582 self.buf.as_ptr() as usize,
1583 ))
1584 }
1585 pub fn get_reason_code(&self) -> Result<u16, ErrorContext> {
1586 let mut iter = self.clone();
1587 iter.pos = 0;
1588 for attr in iter {
1589 if let Nl80211Attrs::ReasonCode(val) = attr? {
1590 return Ok(val);
1591 }
1592 }
1593 Err(ErrorContext::new_missing(
1594 "Nl80211Attrs",
1595 "ReasonCode",
1596 self.orig_loc,
1597 self.buf.as_ptr() as usize,
1598 ))
1599 }
1600 pub fn get_key_type(&self) -> Result<u32, ErrorContext> {
1601 let mut iter = self.clone();
1602 iter.pos = 0;
1603 for attr in iter {
1604 if let Nl80211Attrs::KeyType(val) = attr? {
1605 return Ok(val);
1606 }
1607 }
1608 Err(ErrorContext::new_missing(
1609 "Nl80211Attrs",
1610 "KeyType",
1611 self.orig_loc,
1612 self.buf.as_ptr() as usize,
1613 ))
1614 }
1615 pub fn get_max_scan_ie_len(&self) -> Result<u16, ErrorContext> {
1616 let mut iter = self.clone();
1617 iter.pos = 0;
1618 for attr in iter {
1619 if let Nl80211Attrs::MaxScanIeLen(val) = attr? {
1620 return Ok(val);
1621 }
1622 }
1623 Err(ErrorContext::new_missing(
1624 "Nl80211Attrs",
1625 "MaxScanIeLen",
1626 self.orig_loc,
1627 self.buf.as_ptr() as usize,
1628 ))
1629 }
1630 pub fn get_cipher_suites(&self) -> Result<&'a [u8], ErrorContext> {
1631 let mut iter = self.clone();
1632 iter.pos = 0;
1633 for attr in iter {
1634 if let Nl80211Attrs::CipherSuites(val) = attr? {
1635 return Ok(val);
1636 }
1637 }
1638 Err(ErrorContext::new_missing(
1639 "Nl80211Attrs",
1640 "CipherSuites",
1641 self.orig_loc,
1642 self.buf.as_ptr() as usize,
1643 ))
1644 }
1645 pub fn get_freq_before(&self) -> Result<&'a [u8], ErrorContext> {
1646 let mut iter = self.clone();
1647 iter.pos = 0;
1648 for attr in iter {
1649 if let Nl80211Attrs::FreqBefore(val) = attr? {
1650 return Ok(val);
1651 }
1652 }
1653 Err(ErrorContext::new_missing(
1654 "Nl80211Attrs",
1655 "FreqBefore",
1656 self.orig_loc,
1657 self.buf.as_ptr() as usize,
1658 ))
1659 }
1660 pub fn get_freq_after(&self) -> Result<&'a [u8], ErrorContext> {
1661 let mut iter = self.clone();
1662 iter.pos = 0;
1663 for attr in iter {
1664 if let Nl80211Attrs::FreqAfter(val) = attr? {
1665 return Ok(val);
1666 }
1667 }
1668 Err(ErrorContext::new_missing(
1669 "Nl80211Attrs",
1670 "FreqAfter",
1671 self.orig_loc,
1672 self.buf.as_ptr() as usize,
1673 ))
1674 }
1675 pub fn get_freq_fixed(&self) -> Result<(), ErrorContext> {
1676 let mut iter = self.clone();
1677 iter.pos = 0;
1678 for attr in iter {
1679 if let Nl80211Attrs::FreqFixed(val) = attr? {
1680 return Ok(val);
1681 }
1682 }
1683 Err(ErrorContext::new_missing(
1684 "Nl80211Attrs",
1685 "FreqFixed",
1686 self.orig_loc,
1687 self.buf.as_ptr() as usize,
1688 ))
1689 }
1690 pub fn get_wiphy_retry_short(&self) -> Result<u8, ErrorContext> {
1691 let mut iter = self.clone();
1692 iter.pos = 0;
1693 for attr in iter {
1694 if let Nl80211Attrs::WiphyRetryShort(val) = attr? {
1695 return Ok(val);
1696 }
1697 }
1698 Err(ErrorContext::new_missing(
1699 "Nl80211Attrs",
1700 "WiphyRetryShort",
1701 self.orig_loc,
1702 self.buf.as_ptr() as usize,
1703 ))
1704 }
1705 pub fn get_wiphy_retry_long(&self) -> Result<u8, ErrorContext> {
1706 let mut iter = self.clone();
1707 iter.pos = 0;
1708 for attr in iter {
1709 if let Nl80211Attrs::WiphyRetryLong(val) = attr? {
1710 return Ok(val);
1711 }
1712 }
1713 Err(ErrorContext::new_missing(
1714 "Nl80211Attrs",
1715 "WiphyRetryLong",
1716 self.orig_loc,
1717 self.buf.as_ptr() as usize,
1718 ))
1719 }
1720 pub fn get_wiphy_frag_threshold(&self) -> Result<u32, ErrorContext> {
1721 let mut iter = self.clone();
1722 iter.pos = 0;
1723 for attr in iter {
1724 if let Nl80211Attrs::WiphyFragThreshold(val) = attr? {
1725 return Ok(val);
1726 }
1727 }
1728 Err(ErrorContext::new_missing(
1729 "Nl80211Attrs",
1730 "WiphyFragThreshold",
1731 self.orig_loc,
1732 self.buf.as_ptr() as usize,
1733 ))
1734 }
1735 pub fn get_wiphy_rts_threshold(&self) -> Result<u32, ErrorContext> {
1736 let mut iter = self.clone();
1737 iter.pos = 0;
1738 for attr in iter {
1739 if let Nl80211Attrs::WiphyRtsThreshold(val) = attr? {
1740 return Ok(val);
1741 }
1742 }
1743 Err(ErrorContext::new_missing(
1744 "Nl80211Attrs",
1745 "WiphyRtsThreshold",
1746 self.orig_loc,
1747 self.buf.as_ptr() as usize,
1748 ))
1749 }
1750 pub fn get_timed_out(&self) -> Result<(), ErrorContext> {
1751 let mut iter = self.clone();
1752 iter.pos = 0;
1753 for attr in iter {
1754 if let Nl80211Attrs::TimedOut(val) = attr? {
1755 return Ok(val);
1756 }
1757 }
1758 Err(ErrorContext::new_missing(
1759 "Nl80211Attrs",
1760 "TimedOut",
1761 self.orig_loc,
1762 self.buf.as_ptr() as usize,
1763 ))
1764 }
1765 pub fn get_use_mfp(&self) -> Result<u32, ErrorContext> {
1766 let mut iter = self.clone();
1767 iter.pos = 0;
1768 for attr in iter {
1769 if let Nl80211Attrs::UseMfp(val) = attr? {
1770 return Ok(val);
1771 }
1772 }
1773 Err(ErrorContext::new_missing(
1774 "Nl80211Attrs",
1775 "UseMfp",
1776 self.orig_loc,
1777 self.buf.as_ptr() as usize,
1778 ))
1779 }
1780 pub fn get_sta_flags2(&self) -> Result<PushStaFlagUpdate, ErrorContext> {
1781 let mut iter = self.clone();
1782 iter.pos = 0;
1783 for attr in iter {
1784 if let Nl80211Attrs::StaFlags2(val) = attr? {
1785 return Ok(val);
1786 }
1787 }
1788 Err(ErrorContext::new_missing(
1789 "Nl80211Attrs",
1790 "StaFlags2",
1791 self.orig_loc,
1792 self.buf.as_ptr() as usize,
1793 ))
1794 }
1795 pub fn get_control_port(&self) -> Result<(), ErrorContext> {
1796 let mut iter = self.clone();
1797 iter.pos = 0;
1798 for attr in iter {
1799 if let Nl80211Attrs::ControlPort(val) = attr? {
1800 return Ok(val);
1801 }
1802 }
1803 Err(ErrorContext::new_missing(
1804 "Nl80211Attrs",
1805 "ControlPort",
1806 self.orig_loc,
1807 self.buf.as_ptr() as usize,
1808 ))
1809 }
1810 pub fn get_testdata(&self) -> Result<&'a [u8], ErrorContext> {
1811 let mut iter = self.clone();
1812 iter.pos = 0;
1813 for attr in iter {
1814 if let Nl80211Attrs::Testdata(val) = attr? {
1815 return Ok(val);
1816 }
1817 }
1818 Err(ErrorContext::new_missing(
1819 "Nl80211Attrs",
1820 "Testdata",
1821 self.orig_loc,
1822 self.buf.as_ptr() as usize,
1823 ))
1824 }
1825 pub fn get_privacy(&self) -> Result<(), ErrorContext> {
1826 let mut iter = self.clone();
1827 iter.pos = 0;
1828 for attr in iter {
1829 if let Nl80211Attrs::Privacy(val) = attr? {
1830 return Ok(val);
1831 }
1832 }
1833 Err(ErrorContext::new_missing(
1834 "Nl80211Attrs",
1835 "Privacy",
1836 self.orig_loc,
1837 self.buf.as_ptr() as usize,
1838 ))
1839 }
1840 pub fn get_disconnected_by_ap(&self) -> Result<(), ErrorContext> {
1841 let mut iter = self.clone();
1842 iter.pos = 0;
1843 for attr in iter {
1844 if let Nl80211Attrs::DisconnectedByAp(val) = attr? {
1845 return Ok(val);
1846 }
1847 }
1848 Err(ErrorContext::new_missing(
1849 "Nl80211Attrs",
1850 "DisconnectedByAp",
1851 self.orig_loc,
1852 self.buf.as_ptr() as usize,
1853 ))
1854 }
1855 pub fn get_status_code(&self) -> Result<u16, ErrorContext> {
1856 let mut iter = self.clone();
1857 iter.pos = 0;
1858 for attr in iter {
1859 if let Nl80211Attrs::StatusCode(val) = attr? {
1860 return Ok(val);
1861 }
1862 }
1863 Err(ErrorContext::new_missing(
1864 "Nl80211Attrs",
1865 "StatusCode",
1866 self.orig_loc,
1867 self.buf.as_ptr() as usize,
1868 ))
1869 }
1870 pub fn get_cipher_suites_pairwise(&self) -> Result<&'a [u8], ErrorContext> {
1871 let mut iter = self.clone();
1872 iter.pos = 0;
1873 for attr in iter {
1874 if let Nl80211Attrs::CipherSuitesPairwise(val) = attr? {
1875 return Ok(val);
1876 }
1877 }
1878 Err(ErrorContext::new_missing(
1879 "Nl80211Attrs",
1880 "CipherSuitesPairwise",
1881 self.orig_loc,
1882 self.buf.as_ptr() as usize,
1883 ))
1884 }
1885 pub fn get_cipher_suite_group(&self) -> Result<u32, ErrorContext> {
1886 let mut iter = self.clone();
1887 iter.pos = 0;
1888 for attr in iter {
1889 if let Nl80211Attrs::CipherSuiteGroup(val) = attr? {
1890 return Ok(val);
1891 }
1892 }
1893 Err(ErrorContext::new_missing(
1894 "Nl80211Attrs",
1895 "CipherSuiteGroup",
1896 self.orig_loc,
1897 self.buf.as_ptr() as usize,
1898 ))
1899 }
1900 pub fn get_wpa_versions(&self) -> Result<u32, ErrorContext> {
1901 let mut iter = self.clone();
1902 iter.pos = 0;
1903 for attr in iter {
1904 if let Nl80211Attrs::WpaVersions(val) = attr? {
1905 return Ok(val);
1906 }
1907 }
1908 Err(ErrorContext::new_missing(
1909 "Nl80211Attrs",
1910 "WpaVersions",
1911 self.orig_loc,
1912 self.buf.as_ptr() as usize,
1913 ))
1914 }
1915 pub fn get_akm_suites(&self) -> Result<&'a [u8], ErrorContext> {
1916 let mut iter = self.clone();
1917 iter.pos = 0;
1918 for attr in iter {
1919 if let Nl80211Attrs::AkmSuites(val) = attr? {
1920 return Ok(val);
1921 }
1922 }
1923 Err(ErrorContext::new_missing(
1924 "Nl80211Attrs",
1925 "AkmSuites",
1926 self.orig_loc,
1927 self.buf.as_ptr() as usize,
1928 ))
1929 }
1930 pub fn get_req_ie(&self) -> Result<&'a [u8], ErrorContext> {
1931 let mut iter = self.clone();
1932 iter.pos = 0;
1933 for attr in iter {
1934 if let Nl80211Attrs::ReqIe(val) = attr? {
1935 return Ok(val);
1936 }
1937 }
1938 Err(ErrorContext::new_missing(
1939 "Nl80211Attrs",
1940 "ReqIe",
1941 self.orig_loc,
1942 self.buf.as_ptr() as usize,
1943 ))
1944 }
1945 pub fn get_resp_ie(&self) -> Result<&'a [u8], ErrorContext> {
1946 let mut iter = self.clone();
1947 iter.pos = 0;
1948 for attr in iter {
1949 if let Nl80211Attrs::RespIe(val) = attr? {
1950 return Ok(val);
1951 }
1952 }
1953 Err(ErrorContext::new_missing(
1954 "Nl80211Attrs",
1955 "RespIe",
1956 self.orig_loc,
1957 self.buf.as_ptr() as usize,
1958 ))
1959 }
1960 pub fn get_prev_bssid(&self) -> Result<&'a [u8], ErrorContext> {
1961 let mut iter = self.clone();
1962 iter.pos = 0;
1963 for attr in iter {
1964 if let Nl80211Attrs::PrevBssid(val) = attr? {
1965 return Ok(val);
1966 }
1967 }
1968 Err(ErrorContext::new_missing(
1969 "Nl80211Attrs",
1970 "PrevBssid",
1971 self.orig_loc,
1972 self.buf.as_ptr() as usize,
1973 ))
1974 }
1975 pub fn get_key(&self) -> Result<&'a [u8], ErrorContext> {
1976 let mut iter = self.clone();
1977 iter.pos = 0;
1978 for attr in iter {
1979 if let Nl80211Attrs::Key(val) = attr? {
1980 return Ok(val);
1981 }
1982 }
1983 Err(ErrorContext::new_missing(
1984 "Nl80211Attrs",
1985 "Key",
1986 self.orig_loc,
1987 self.buf.as_ptr() as usize,
1988 ))
1989 }
1990 pub fn get_keys(&self) -> Result<&'a [u8], ErrorContext> {
1991 let mut iter = self.clone();
1992 iter.pos = 0;
1993 for attr in iter {
1994 if let Nl80211Attrs::Keys(val) = attr? {
1995 return Ok(val);
1996 }
1997 }
1998 Err(ErrorContext::new_missing(
1999 "Nl80211Attrs",
2000 "Keys",
2001 self.orig_loc,
2002 self.buf.as_ptr() as usize,
2003 ))
2004 }
2005 pub fn get_pid(&self) -> Result<u32, ErrorContext> {
2006 let mut iter = self.clone();
2007 iter.pos = 0;
2008 for attr in iter {
2009 if let Nl80211Attrs::Pid(val) = attr? {
2010 return Ok(val);
2011 }
2012 }
2013 Err(ErrorContext::new_missing(
2014 "Nl80211Attrs",
2015 "Pid",
2016 self.orig_loc,
2017 self.buf.as_ptr() as usize,
2018 ))
2019 }
2020 pub fn get_4addr(&self) -> Result<u8, ErrorContext> {
2021 let mut iter = self.clone();
2022 iter.pos = 0;
2023 for attr in iter {
2024 if let Nl80211Attrs::_4addr(val) = attr? {
2025 return Ok(val);
2026 }
2027 }
2028 Err(ErrorContext::new_missing(
2029 "Nl80211Attrs",
2030 "4addr",
2031 self.orig_loc,
2032 self.buf.as_ptr() as usize,
2033 ))
2034 }
2035 pub fn get_survey_info(&self) -> Result<&'a [u8], ErrorContext> {
2036 let mut iter = self.clone();
2037 iter.pos = 0;
2038 for attr in iter {
2039 if let Nl80211Attrs::SurveyInfo(val) = attr? {
2040 return Ok(val);
2041 }
2042 }
2043 Err(ErrorContext::new_missing(
2044 "Nl80211Attrs",
2045 "SurveyInfo",
2046 self.orig_loc,
2047 self.buf.as_ptr() as usize,
2048 ))
2049 }
2050 pub fn get_pmkid(&self) -> Result<&'a [u8], ErrorContext> {
2051 let mut iter = self.clone();
2052 iter.pos = 0;
2053 for attr in iter {
2054 if let Nl80211Attrs::Pmkid(val) = attr? {
2055 return Ok(val);
2056 }
2057 }
2058 Err(ErrorContext::new_missing(
2059 "Nl80211Attrs",
2060 "Pmkid",
2061 self.orig_loc,
2062 self.buf.as_ptr() as usize,
2063 ))
2064 }
2065 pub fn get_max_num_pmkids(&self) -> Result<u8, ErrorContext> {
2066 let mut iter = self.clone();
2067 iter.pos = 0;
2068 for attr in iter {
2069 if let Nl80211Attrs::MaxNumPmkids(val) = attr? {
2070 return Ok(val);
2071 }
2072 }
2073 Err(ErrorContext::new_missing(
2074 "Nl80211Attrs",
2075 "MaxNumPmkids",
2076 self.orig_loc,
2077 self.buf.as_ptr() as usize,
2078 ))
2079 }
2080 pub fn get_duration(&self) -> Result<u32, ErrorContext> {
2081 let mut iter = self.clone();
2082 iter.pos = 0;
2083 for attr in iter {
2084 if let Nl80211Attrs::Duration(val) = attr? {
2085 return Ok(val);
2086 }
2087 }
2088 Err(ErrorContext::new_missing(
2089 "Nl80211Attrs",
2090 "Duration",
2091 self.orig_loc,
2092 self.buf.as_ptr() as usize,
2093 ))
2094 }
2095 pub fn get_cookie(&self) -> Result<u64, ErrorContext> {
2096 let mut iter = self.clone();
2097 iter.pos = 0;
2098 for attr in iter {
2099 if let Nl80211Attrs::Cookie(val) = attr? {
2100 return Ok(val);
2101 }
2102 }
2103 Err(ErrorContext::new_missing(
2104 "Nl80211Attrs",
2105 "Cookie",
2106 self.orig_loc,
2107 self.buf.as_ptr() as usize,
2108 ))
2109 }
2110 pub fn get_wiphy_coverage_class(&self) -> Result<u8, ErrorContext> {
2111 let mut iter = self.clone();
2112 iter.pos = 0;
2113 for attr in iter {
2114 if let Nl80211Attrs::WiphyCoverageClass(val) = attr? {
2115 return Ok(val);
2116 }
2117 }
2118 Err(ErrorContext::new_missing(
2119 "Nl80211Attrs",
2120 "WiphyCoverageClass",
2121 self.orig_loc,
2122 self.buf.as_ptr() as usize,
2123 ))
2124 }
2125 pub fn get_tx_rates(&self) -> Result<&'a [u8], ErrorContext> {
2126 let mut iter = self.clone();
2127 iter.pos = 0;
2128 for attr in iter {
2129 if let Nl80211Attrs::TxRates(val) = attr? {
2130 return Ok(val);
2131 }
2132 }
2133 Err(ErrorContext::new_missing(
2134 "Nl80211Attrs",
2135 "TxRates",
2136 self.orig_loc,
2137 self.buf.as_ptr() as usize,
2138 ))
2139 }
2140 pub fn get_frame_match(&self) -> Result<&'a [u8], ErrorContext> {
2141 let mut iter = self.clone();
2142 iter.pos = 0;
2143 for attr in iter {
2144 if let Nl80211Attrs::FrameMatch(val) = attr? {
2145 return Ok(val);
2146 }
2147 }
2148 Err(ErrorContext::new_missing(
2149 "Nl80211Attrs",
2150 "FrameMatch",
2151 self.orig_loc,
2152 self.buf.as_ptr() as usize,
2153 ))
2154 }
2155 pub fn get_ack(&self) -> Result<(), ErrorContext> {
2156 let mut iter = self.clone();
2157 iter.pos = 0;
2158 for attr in iter {
2159 if let Nl80211Attrs::Ack(val) = attr? {
2160 return Ok(val);
2161 }
2162 }
2163 Err(ErrorContext::new_missing(
2164 "Nl80211Attrs",
2165 "Ack",
2166 self.orig_loc,
2167 self.buf.as_ptr() as usize,
2168 ))
2169 }
2170 pub fn get_ps_state(&self) -> Result<u32, ErrorContext> {
2171 let mut iter = self.clone();
2172 iter.pos = 0;
2173 for attr in iter {
2174 if let Nl80211Attrs::PsState(val) = attr? {
2175 return Ok(val);
2176 }
2177 }
2178 Err(ErrorContext::new_missing(
2179 "Nl80211Attrs",
2180 "PsState",
2181 self.orig_loc,
2182 self.buf.as_ptr() as usize,
2183 ))
2184 }
2185 pub fn get_cqm(&self) -> Result<&'a [u8], ErrorContext> {
2186 let mut iter = self.clone();
2187 iter.pos = 0;
2188 for attr in iter {
2189 if let Nl80211Attrs::Cqm(val) = attr? {
2190 return Ok(val);
2191 }
2192 }
2193 Err(ErrorContext::new_missing(
2194 "Nl80211Attrs",
2195 "Cqm",
2196 self.orig_loc,
2197 self.buf.as_ptr() as usize,
2198 ))
2199 }
2200 pub fn get_local_state_change(&self) -> Result<(), ErrorContext> {
2201 let mut iter = self.clone();
2202 iter.pos = 0;
2203 for attr in iter {
2204 if let Nl80211Attrs::LocalStateChange(val) = attr? {
2205 return Ok(val);
2206 }
2207 }
2208 Err(ErrorContext::new_missing(
2209 "Nl80211Attrs",
2210 "LocalStateChange",
2211 self.orig_loc,
2212 self.buf.as_ptr() as usize,
2213 ))
2214 }
2215 pub fn get_ap_isolate(&self) -> Result<u8, ErrorContext> {
2216 let mut iter = self.clone();
2217 iter.pos = 0;
2218 for attr in iter {
2219 if let Nl80211Attrs::ApIsolate(val) = attr? {
2220 return Ok(val);
2221 }
2222 }
2223 Err(ErrorContext::new_missing(
2224 "Nl80211Attrs",
2225 "ApIsolate",
2226 self.orig_loc,
2227 self.buf.as_ptr() as usize,
2228 ))
2229 }
2230 pub fn get_wiphy_tx_power_setting(&self) -> Result<u32, ErrorContext> {
2231 let mut iter = self.clone();
2232 iter.pos = 0;
2233 for attr in iter {
2234 if let Nl80211Attrs::WiphyTxPowerSetting(val) = attr? {
2235 return Ok(val);
2236 }
2237 }
2238 Err(ErrorContext::new_missing(
2239 "Nl80211Attrs",
2240 "WiphyTxPowerSetting",
2241 self.orig_loc,
2242 self.buf.as_ptr() as usize,
2243 ))
2244 }
2245 pub fn get_wiphy_tx_power_level(&self) -> Result<u32, ErrorContext> {
2246 let mut iter = self.clone();
2247 iter.pos = 0;
2248 for attr in iter {
2249 if let Nl80211Attrs::WiphyTxPowerLevel(val) = attr? {
2250 return Ok(val);
2251 }
2252 }
2253 Err(ErrorContext::new_missing(
2254 "Nl80211Attrs",
2255 "WiphyTxPowerLevel",
2256 self.orig_loc,
2257 self.buf.as_ptr() as usize,
2258 ))
2259 }
2260 pub fn get_tx_frame_types(&self) -> Result<IterableIftypeAttrs<'a>, ErrorContext> {
2261 let mut iter = self.clone();
2262 iter.pos = 0;
2263 for attr in iter {
2264 if let Nl80211Attrs::TxFrameTypes(val) = attr? {
2265 return Ok(val);
2266 }
2267 }
2268 Err(ErrorContext::new_missing(
2269 "Nl80211Attrs",
2270 "TxFrameTypes",
2271 self.orig_loc,
2272 self.buf.as_ptr() as usize,
2273 ))
2274 }
2275 pub fn get_rx_frame_types(&self) -> Result<IterableIftypeAttrs<'a>, ErrorContext> {
2276 let mut iter = self.clone();
2277 iter.pos = 0;
2278 for attr in iter {
2279 if let Nl80211Attrs::RxFrameTypes(val) = attr? {
2280 return Ok(val);
2281 }
2282 }
2283 Err(ErrorContext::new_missing(
2284 "Nl80211Attrs",
2285 "RxFrameTypes",
2286 self.orig_loc,
2287 self.buf.as_ptr() as usize,
2288 ))
2289 }
2290 pub fn get_frame_type(&self) -> Result<u16, ErrorContext> {
2291 let mut iter = self.clone();
2292 iter.pos = 0;
2293 for attr in iter {
2294 if let Nl80211Attrs::FrameType(val) = attr? {
2295 return Ok(val);
2296 }
2297 }
2298 Err(ErrorContext::new_missing(
2299 "Nl80211Attrs",
2300 "FrameType",
2301 self.orig_loc,
2302 self.buf.as_ptr() as usize,
2303 ))
2304 }
2305 pub fn get_control_port_ethertype(&self) -> Result<(), ErrorContext> {
2306 let mut iter = self.clone();
2307 iter.pos = 0;
2308 for attr in iter {
2309 if let Nl80211Attrs::ControlPortEthertype(val) = attr? {
2310 return Ok(val);
2311 }
2312 }
2313 Err(ErrorContext::new_missing(
2314 "Nl80211Attrs",
2315 "ControlPortEthertype",
2316 self.orig_loc,
2317 self.buf.as_ptr() as usize,
2318 ))
2319 }
2320 pub fn get_control_port_no_encrypt(&self) -> Result<(), ErrorContext> {
2321 let mut iter = self.clone();
2322 iter.pos = 0;
2323 for attr in iter {
2324 if let Nl80211Attrs::ControlPortNoEncrypt(val) = attr? {
2325 return Ok(val);
2326 }
2327 }
2328 Err(ErrorContext::new_missing(
2329 "Nl80211Attrs",
2330 "ControlPortNoEncrypt",
2331 self.orig_loc,
2332 self.buf.as_ptr() as usize,
2333 ))
2334 }
2335 pub fn get_support_ibss_rsn(&self) -> Result<(), ErrorContext> {
2336 let mut iter = self.clone();
2337 iter.pos = 0;
2338 for attr in iter {
2339 if let Nl80211Attrs::SupportIbssRsn(val) = attr? {
2340 return Ok(val);
2341 }
2342 }
2343 Err(ErrorContext::new_missing(
2344 "Nl80211Attrs",
2345 "SupportIbssRsn",
2346 self.orig_loc,
2347 self.buf.as_ptr() as usize,
2348 ))
2349 }
2350 pub fn get_wiphy_antenna_tx(&self) -> Result<u32, ErrorContext> {
2351 let mut iter = self.clone();
2352 iter.pos = 0;
2353 for attr in iter {
2354 if let Nl80211Attrs::WiphyAntennaTx(val) = attr? {
2355 return Ok(val);
2356 }
2357 }
2358 Err(ErrorContext::new_missing(
2359 "Nl80211Attrs",
2360 "WiphyAntennaTx",
2361 self.orig_loc,
2362 self.buf.as_ptr() as usize,
2363 ))
2364 }
2365 pub fn get_wiphy_antenna_rx(&self) -> Result<u32, ErrorContext> {
2366 let mut iter = self.clone();
2367 iter.pos = 0;
2368 for attr in iter {
2369 if let Nl80211Attrs::WiphyAntennaRx(val) = attr? {
2370 return Ok(val);
2371 }
2372 }
2373 Err(ErrorContext::new_missing(
2374 "Nl80211Attrs",
2375 "WiphyAntennaRx",
2376 self.orig_loc,
2377 self.buf.as_ptr() as usize,
2378 ))
2379 }
2380 pub fn get_mcast_rate(&self) -> Result<u32, ErrorContext> {
2381 let mut iter = self.clone();
2382 iter.pos = 0;
2383 for attr in iter {
2384 if let Nl80211Attrs::McastRate(val) = attr? {
2385 return Ok(val);
2386 }
2387 }
2388 Err(ErrorContext::new_missing(
2389 "Nl80211Attrs",
2390 "McastRate",
2391 self.orig_loc,
2392 self.buf.as_ptr() as usize,
2393 ))
2394 }
2395 pub fn get_offchannel_tx_ok(&self) -> Result<(), ErrorContext> {
2396 let mut iter = self.clone();
2397 iter.pos = 0;
2398 for attr in iter {
2399 if let Nl80211Attrs::OffchannelTxOk(val) = attr? {
2400 return Ok(val);
2401 }
2402 }
2403 Err(ErrorContext::new_missing(
2404 "Nl80211Attrs",
2405 "OffchannelTxOk",
2406 self.orig_loc,
2407 self.buf.as_ptr() as usize,
2408 ))
2409 }
2410 pub fn get_bss_ht_opmode(&self) -> Result<u16, ErrorContext> {
2411 let mut iter = self.clone();
2412 iter.pos = 0;
2413 for attr in iter {
2414 if let Nl80211Attrs::BssHtOpmode(val) = attr? {
2415 return Ok(val);
2416 }
2417 }
2418 Err(ErrorContext::new_missing(
2419 "Nl80211Attrs",
2420 "BssHtOpmode",
2421 self.orig_loc,
2422 self.buf.as_ptr() as usize,
2423 ))
2424 }
2425 pub fn get_key_default_types(&self) -> Result<&'a [u8], ErrorContext> {
2426 let mut iter = self.clone();
2427 iter.pos = 0;
2428 for attr in iter {
2429 if let Nl80211Attrs::KeyDefaultTypes(val) = attr? {
2430 return Ok(val);
2431 }
2432 }
2433 Err(ErrorContext::new_missing(
2434 "Nl80211Attrs",
2435 "KeyDefaultTypes",
2436 self.orig_loc,
2437 self.buf.as_ptr() as usize,
2438 ))
2439 }
2440 pub fn get_max_remain_on_channel_duration(&self) -> Result<u32, ErrorContext> {
2441 let mut iter = self.clone();
2442 iter.pos = 0;
2443 for attr in iter {
2444 if let Nl80211Attrs::MaxRemainOnChannelDuration(val) = attr? {
2445 return Ok(val);
2446 }
2447 }
2448 Err(ErrorContext::new_missing(
2449 "Nl80211Attrs",
2450 "MaxRemainOnChannelDuration",
2451 self.orig_loc,
2452 self.buf.as_ptr() as usize,
2453 ))
2454 }
2455 pub fn get_mesh_setup(&self) -> Result<&'a [u8], ErrorContext> {
2456 let mut iter = self.clone();
2457 iter.pos = 0;
2458 for attr in iter {
2459 if let Nl80211Attrs::MeshSetup(val) = attr? {
2460 return Ok(val);
2461 }
2462 }
2463 Err(ErrorContext::new_missing(
2464 "Nl80211Attrs",
2465 "MeshSetup",
2466 self.orig_loc,
2467 self.buf.as_ptr() as usize,
2468 ))
2469 }
2470 pub fn get_wiphy_antenna_avail_tx(&self) -> Result<u32, ErrorContext> {
2471 let mut iter = self.clone();
2472 iter.pos = 0;
2473 for attr in iter {
2474 if let Nl80211Attrs::WiphyAntennaAvailTx(val) = attr? {
2475 return Ok(val);
2476 }
2477 }
2478 Err(ErrorContext::new_missing(
2479 "Nl80211Attrs",
2480 "WiphyAntennaAvailTx",
2481 self.orig_loc,
2482 self.buf.as_ptr() as usize,
2483 ))
2484 }
2485 pub fn get_wiphy_antenna_avail_rx(&self) -> Result<u32, ErrorContext> {
2486 let mut iter = self.clone();
2487 iter.pos = 0;
2488 for attr in iter {
2489 if let Nl80211Attrs::WiphyAntennaAvailRx(val) = attr? {
2490 return Ok(val);
2491 }
2492 }
2493 Err(ErrorContext::new_missing(
2494 "Nl80211Attrs",
2495 "WiphyAntennaAvailRx",
2496 self.orig_loc,
2497 self.buf.as_ptr() as usize,
2498 ))
2499 }
2500 pub fn get_support_mesh_auth(&self) -> Result<(), ErrorContext> {
2501 let mut iter = self.clone();
2502 iter.pos = 0;
2503 for attr in iter {
2504 if let Nl80211Attrs::SupportMeshAuth(val) = attr? {
2505 return Ok(val);
2506 }
2507 }
2508 Err(ErrorContext::new_missing(
2509 "Nl80211Attrs",
2510 "SupportMeshAuth",
2511 self.orig_loc,
2512 self.buf.as_ptr() as usize,
2513 ))
2514 }
2515 pub fn get_sta_plink_state(&self) -> Result<u8, ErrorContext> {
2516 let mut iter = self.clone();
2517 iter.pos = 0;
2518 for attr in iter {
2519 if let Nl80211Attrs::StaPlinkState(val) = attr? {
2520 return Ok(val);
2521 }
2522 }
2523 Err(ErrorContext::new_missing(
2524 "Nl80211Attrs",
2525 "StaPlinkState",
2526 self.orig_loc,
2527 self.buf.as_ptr() as usize,
2528 ))
2529 }
2530 pub fn get_wowlan_triggers(&self) -> Result<&'a [u8], ErrorContext> {
2531 let mut iter = self.clone();
2532 iter.pos = 0;
2533 for attr in iter {
2534 if let Nl80211Attrs::WowlanTriggers(val) = attr? {
2535 return Ok(val);
2536 }
2537 }
2538 Err(ErrorContext::new_missing(
2539 "Nl80211Attrs",
2540 "WowlanTriggers",
2541 self.orig_loc,
2542 self.buf.as_ptr() as usize,
2543 ))
2544 }
2545 pub fn get_wowlan_triggers_supported(
2546 &self,
2547 ) -> Result<IterableWowlanTriggersAttrs<'a>, ErrorContext> {
2548 let mut iter = self.clone();
2549 iter.pos = 0;
2550 for attr in iter {
2551 if let Nl80211Attrs::WowlanTriggersSupported(val) = attr? {
2552 return Ok(val);
2553 }
2554 }
2555 Err(ErrorContext::new_missing(
2556 "Nl80211Attrs",
2557 "WowlanTriggersSupported",
2558 self.orig_loc,
2559 self.buf.as_ptr() as usize,
2560 ))
2561 }
2562 pub fn get_sched_scan_interval(&self) -> Result<u32, ErrorContext> {
2563 let mut iter = self.clone();
2564 iter.pos = 0;
2565 for attr in iter {
2566 if let Nl80211Attrs::SchedScanInterval(val) = attr? {
2567 return Ok(val);
2568 }
2569 }
2570 Err(ErrorContext::new_missing(
2571 "Nl80211Attrs",
2572 "SchedScanInterval",
2573 self.orig_loc,
2574 self.buf.as_ptr() as usize,
2575 ))
2576 }
2577 pub fn get_interface_combinations(
2578 &self,
2579 ) -> Result<
2580 ArrayIterable<
2581 IterableArrayIfCombinationAttributes<'a>,
2582 IterableIfCombinationAttributes<'a>,
2583 >,
2584 ErrorContext,
2585 > {
2586 for attr in self.clone() {
2587 if let Nl80211Attrs::InterfaceCombinations(val) = attr? {
2588 return Ok(ArrayIterable::new(val));
2589 }
2590 }
2591 Err(ErrorContext::new_missing(
2592 "Nl80211Attrs",
2593 "InterfaceCombinations",
2594 self.orig_loc,
2595 self.buf.as_ptr() as usize,
2596 ))
2597 }
2598 pub fn get_software_iftypes(&self) -> Result<IterableSupportedIftypes<'a>, ErrorContext> {
2599 let mut iter = self.clone();
2600 iter.pos = 0;
2601 for attr in iter {
2602 if let Nl80211Attrs::SoftwareIftypes(val) = attr? {
2603 return Ok(val);
2604 }
2605 }
2606 Err(ErrorContext::new_missing(
2607 "Nl80211Attrs",
2608 "SoftwareIftypes",
2609 self.orig_loc,
2610 self.buf.as_ptr() as usize,
2611 ))
2612 }
2613 pub fn get_rekey_data(&self) -> Result<&'a [u8], ErrorContext> {
2614 let mut iter = self.clone();
2615 iter.pos = 0;
2616 for attr in iter {
2617 if let Nl80211Attrs::RekeyData(val) = attr? {
2618 return Ok(val);
2619 }
2620 }
2621 Err(ErrorContext::new_missing(
2622 "Nl80211Attrs",
2623 "RekeyData",
2624 self.orig_loc,
2625 self.buf.as_ptr() as usize,
2626 ))
2627 }
2628 pub fn get_max_num_sched_scan_ssids(&self) -> Result<u8, ErrorContext> {
2629 let mut iter = self.clone();
2630 iter.pos = 0;
2631 for attr in iter {
2632 if let Nl80211Attrs::MaxNumSchedScanSsids(val) = attr? {
2633 return Ok(val);
2634 }
2635 }
2636 Err(ErrorContext::new_missing(
2637 "Nl80211Attrs",
2638 "MaxNumSchedScanSsids",
2639 self.orig_loc,
2640 self.buf.as_ptr() as usize,
2641 ))
2642 }
2643 pub fn get_max_sched_scan_ie_len(&self) -> Result<u16, ErrorContext> {
2644 let mut iter = self.clone();
2645 iter.pos = 0;
2646 for attr in iter {
2647 if let Nl80211Attrs::MaxSchedScanIeLen(val) = attr? {
2648 return Ok(val);
2649 }
2650 }
2651 Err(ErrorContext::new_missing(
2652 "Nl80211Attrs",
2653 "MaxSchedScanIeLen",
2654 self.orig_loc,
2655 self.buf.as_ptr() as usize,
2656 ))
2657 }
2658 pub fn get_scan_supp_rates(&self) -> Result<&'a [u8], ErrorContext> {
2659 let mut iter = self.clone();
2660 iter.pos = 0;
2661 for attr in iter {
2662 if let Nl80211Attrs::ScanSuppRates(val) = attr? {
2663 return Ok(val);
2664 }
2665 }
2666 Err(ErrorContext::new_missing(
2667 "Nl80211Attrs",
2668 "ScanSuppRates",
2669 self.orig_loc,
2670 self.buf.as_ptr() as usize,
2671 ))
2672 }
2673 pub fn get_hidden_ssid(&self) -> Result<u32, ErrorContext> {
2674 let mut iter = self.clone();
2675 iter.pos = 0;
2676 for attr in iter {
2677 if let Nl80211Attrs::HiddenSsid(val) = attr? {
2678 return Ok(val);
2679 }
2680 }
2681 Err(ErrorContext::new_missing(
2682 "Nl80211Attrs",
2683 "HiddenSsid",
2684 self.orig_loc,
2685 self.buf.as_ptr() as usize,
2686 ))
2687 }
2688 pub fn get_ie_probe_resp(&self) -> Result<&'a [u8], ErrorContext> {
2689 let mut iter = self.clone();
2690 iter.pos = 0;
2691 for attr in iter {
2692 if let Nl80211Attrs::IeProbeResp(val) = attr? {
2693 return Ok(val);
2694 }
2695 }
2696 Err(ErrorContext::new_missing(
2697 "Nl80211Attrs",
2698 "IeProbeResp",
2699 self.orig_loc,
2700 self.buf.as_ptr() as usize,
2701 ))
2702 }
2703 pub fn get_ie_assoc_resp(&self) -> Result<&'a [u8], ErrorContext> {
2704 let mut iter = self.clone();
2705 iter.pos = 0;
2706 for attr in iter {
2707 if let Nl80211Attrs::IeAssocResp(val) = attr? {
2708 return Ok(val);
2709 }
2710 }
2711 Err(ErrorContext::new_missing(
2712 "Nl80211Attrs",
2713 "IeAssocResp",
2714 self.orig_loc,
2715 self.buf.as_ptr() as usize,
2716 ))
2717 }
2718 pub fn get_sta_wme(&self) -> Result<&'a [u8], ErrorContext> {
2719 let mut iter = self.clone();
2720 iter.pos = 0;
2721 for attr in iter {
2722 if let Nl80211Attrs::StaWme(val) = attr? {
2723 return Ok(val);
2724 }
2725 }
2726 Err(ErrorContext::new_missing(
2727 "Nl80211Attrs",
2728 "StaWme",
2729 self.orig_loc,
2730 self.buf.as_ptr() as usize,
2731 ))
2732 }
2733 pub fn get_support_ap_uapsd(&self) -> Result<(), ErrorContext> {
2734 let mut iter = self.clone();
2735 iter.pos = 0;
2736 for attr in iter {
2737 if let Nl80211Attrs::SupportApUapsd(val) = attr? {
2738 return Ok(val);
2739 }
2740 }
2741 Err(ErrorContext::new_missing(
2742 "Nl80211Attrs",
2743 "SupportApUapsd",
2744 self.orig_loc,
2745 self.buf.as_ptr() as usize,
2746 ))
2747 }
2748 pub fn get_roam_support(&self) -> Result<(), ErrorContext> {
2749 let mut iter = self.clone();
2750 iter.pos = 0;
2751 for attr in iter {
2752 if let Nl80211Attrs::RoamSupport(val) = attr? {
2753 return Ok(val);
2754 }
2755 }
2756 Err(ErrorContext::new_missing(
2757 "Nl80211Attrs",
2758 "RoamSupport",
2759 self.orig_loc,
2760 self.buf.as_ptr() as usize,
2761 ))
2762 }
2763 pub fn get_sched_scan_match(&self) -> Result<&'a [u8], ErrorContext> {
2764 let mut iter = self.clone();
2765 iter.pos = 0;
2766 for attr in iter {
2767 if let Nl80211Attrs::SchedScanMatch(val) = attr? {
2768 return Ok(val);
2769 }
2770 }
2771 Err(ErrorContext::new_missing(
2772 "Nl80211Attrs",
2773 "SchedScanMatch",
2774 self.orig_loc,
2775 self.buf.as_ptr() as usize,
2776 ))
2777 }
2778 pub fn get_max_match_sets(&self) -> Result<u8, ErrorContext> {
2779 let mut iter = self.clone();
2780 iter.pos = 0;
2781 for attr in iter {
2782 if let Nl80211Attrs::MaxMatchSets(val) = attr? {
2783 return Ok(val);
2784 }
2785 }
2786 Err(ErrorContext::new_missing(
2787 "Nl80211Attrs",
2788 "MaxMatchSets",
2789 self.orig_loc,
2790 self.buf.as_ptr() as usize,
2791 ))
2792 }
2793 pub fn get_pmksa_candidate(&self) -> Result<&'a [u8], ErrorContext> {
2794 let mut iter = self.clone();
2795 iter.pos = 0;
2796 for attr in iter {
2797 if let Nl80211Attrs::PmksaCandidate(val) = attr? {
2798 return Ok(val);
2799 }
2800 }
2801 Err(ErrorContext::new_missing(
2802 "Nl80211Attrs",
2803 "PmksaCandidate",
2804 self.orig_loc,
2805 self.buf.as_ptr() as usize,
2806 ))
2807 }
2808 pub fn get_tx_no_cck_rate(&self) -> Result<(), ErrorContext> {
2809 let mut iter = self.clone();
2810 iter.pos = 0;
2811 for attr in iter {
2812 if let Nl80211Attrs::TxNoCckRate(val) = attr? {
2813 return Ok(val);
2814 }
2815 }
2816 Err(ErrorContext::new_missing(
2817 "Nl80211Attrs",
2818 "TxNoCckRate",
2819 self.orig_loc,
2820 self.buf.as_ptr() as usize,
2821 ))
2822 }
2823 pub fn get_tdls_action(&self) -> Result<u8, ErrorContext> {
2824 let mut iter = self.clone();
2825 iter.pos = 0;
2826 for attr in iter {
2827 if let Nl80211Attrs::TdlsAction(val) = attr? {
2828 return Ok(val);
2829 }
2830 }
2831 Err(ErrorContext::new_missing(
2832 "Nl80211Attrs",
2833 "TdlsAction",
2834 self.orig_loc,
2835 self.buf.as_ptr() as usize,
2836 ))
2837 }
2838 pub fn get_tdls_dialog_token(&self) -> Result<u8, ErrorContext> {
2839 let mut iter = self.clone();
2840 iter.pos = 0;
2841 for attr in iter {
2842 if let Nl80211Attrs::TdlsDialogToken(val) = attr? {
2843 return Ok(val);
2844 }
2845 }
2846 Err(ErrorContext::new_missing(
2847 "Nl80211Attrs",
2848 "TdlsDialogToken",
2849 self.orig_loc,
2850 self.buf.as_ptr() as usize,
2851 ))
2852 }
2853 pub fn get_tdls_operation(&self) -> Result<u8, ErrorContext> {
2854 let mut iter = self.clone();
2855 iter.pos = 0;
2856 for attr in iter {
2857 if let Nl80211Attrs::TdlsOperation(val) = attr? {
2858 return Ok(val);
2859 }
2860 }
2861 Err(ErrorContext::new_missing(
2862 "Nl80211Attrs",
2863 "TdlsOperation",
2864 self.orig_loc,
2865 self.buf.as_ptr() as usize,
2866 ))
2867 }
2868 pub fn get_tdls_support(&self) -> Result<(), ErrorContext> {
2869 let mut iter = self.clone();
2870 iter.pos = 0;
2871 for attr in iter {
2872 if let Nl80211Attrs::TdlsSupport(val) = attr? {
2873 return Ok(val);
2874 }
2875 }
2876 Err(ErrorContext::new_missing(
2877 "Nl80211Attrs",
2878 "TdlsSupport",
2879 self.orig_loc,
2880 self.buf.as_ptr() as usize,
2881 ))
2882 }
2883 pub fn get_tdls_external_setup(&self) -> Result<(), ErrorContext> {
2884 let mut iter = self.clone();
2885 iter.pos = 0;
2886 for attr in iter {
2887 if let Nl80211Attrs::TdlsExternalSetup(val) = attr? {
2888 return Ok(val);
2889 }
2890 }
2891 Err(ErrorContext::new_missing(
2892 "Nl80211Attrs",
2893 "TdlsExternalSetup",
2894 self.orig_loc,
2895 self.buf.as_ptr() as usize,
2896 ))
2897 }
2898 pub fn get_device_ap_sme(&self) -> Result<u32, ErrorContext> {
2899 let mut iter = self.clone();
2900 iter.pos = 0;
2901 for attr in iter {
2902 if let Nl80211Attrs::DeviceApSme(val) = attr? {
2903 return Ok(val);
2904 }
2905 }
2906 Err(ErrorContext::new_missing(
2907 "Nl80211Attrs",
2908 "DeviceApSme",
2909 self.orig_loc,
2910 self.buf.as_ptr() as usize,
2911 ))
2912 }
2913 pub fn get_dont_wait_for_ack(&self) -> Result<(), ErrorContext> {
2914 let mut iter = self.clone();
2915 iter.pos = 0;
2916 for attr in iter {
2917 if let Nl80211Attrs::DontWaitForAck(val) = attr? {
2918 return Ok(val);
2919 }
2920 }
2921 Err(ErrorContext::new_missing(
2922 "Nl80211Attrs",
2923 "DontWaitForAck",
2924 self.orig_loc,
2925 self.buf.as_ptr() as usize,
2926 ))
2927 }
2928 #[doc = "Associated type: \"FeatureFlags\" (1 bit per enumeration)"]
2929 pub fn get_feature_flags(&self) -> Result<u32, ErrorContext> {
2930 let mut iter = self.clone();
2931 iter.pos = 0;
2932 for attr in iter {
2933 if let Nl80211Attrs::FeatureFlags(val) = attr? {
2934 return Ok(val);
2935 }
2936 }
2937 Err(ErrorContext::new_missing(
2938 "Nl80211Attrs",
2939 "FeatureFlags",
2940 self.orig_loc,
2941 self.buf.as_ptr() as usize,
2942 ))
2943 }
2944 pub fn get_probe_resp_offload(&self) -> Result<u32, ErrorContext> {
2945 let mut iter = self.clone();
2946 iter.pos = 0;
2947 for attr in iter {
2948 if let Nl80211Attrs::ProbeRespOffload(val) = attr? {
2949 return Ok(val);
2950 }
2951 }
2952 Err(ErrorContext::new_missing(
2953 "Nl80211Attrs",
2954 "ProbeRespOffload",
2955 self.orig_loc,
2956 self.buf.as_ptr() as usize,
2957 ))
2958 }
2959 pub fn get_probe_resp(&self) -> Result<&'a [u8], ErrorContext> {
2960 let mut iter = self.clone();
2961 iter.pos = 0;
2962 for attr in iter {
2963 if let Nl80211Attrs::ProbeResp(val) = attr? {
2964 return Ok(val);
2965 }
2966 }
2967 Err(ErrorContext::new_missing(
2968 "Nl80211Attrs",
2969 "ProbeResp",
2970 self.orig_loc,
2971 self.buf.as_ptr() as usize,
2972 ))
2973 }
2974 pub fn get_dfs_region(&self) -> Result<u8, ErrorContext> {
2975 let mut iter = self.clone();
2976 iter.pos = 0;
2977 for attr in iter {
2978 if let Nl80211Attrs::DfsRegion(val) = attr? {
2979 return Ok(val);
2980 }
2981 }
2982 Err(ErrorContext::new_missing(
2983 "Nl80211Attrs",
2984 "DfsRegion",
2985 self.orig_loc,
2986 self.buf.as_ptr() as usize,
2987 ))
2988 }
2989 pub fn get_disable_ht(&self) -> Result<(), ErrorContext> {
2990 let mut iter = self.clone();
2991 iter.pos = 0;
2992 for attr in iter {
2993 if let Nl80211Attrs::DisableHt(val) = attr? {
2994 return Ok(val);
2995 }
2996 }
2997 Err(ErrorContext::new_missing(
2998 "Nl80211Attrs",
2999 "DisableHt",
3000 self.orig_loc,
3001 self.buf.as_ptr() as usize,
3002 ))
3003 }
3004 pub fn get_ht_capability_mask(&self) -> Result<&'a [u8], ErrorContext> {
3005 let mut iter = self.clone();
3006 iter.pos = 0;
3007 for attr in iter {
3008 if let Nl80211Attrs::HtCapabilityMask(val) = attr? {
3009 return Ok(val);
3010 }
3011 }
3012 Err(ErrorContext::new_missing(
3013 "Nl80211Attrs",
3014 "HtCapabilityMask",
3015 self.orig_loc,
3016 self.buf.as_ptr() as usize,
3017 ))
3018 }
3019 pub fn get_noack_map(&self) -> Result<u16, ErrorContext> {
3020 let mut iter = self.clone();
3021 iter.pos = 0;
3022 for attr in iter {
3023 if let Nl80211Attrs::NoackMap(val) = attr? {
3024 return Ok(val);
3025 }
3026 }
3027 Err(ErrorContext::new_missing(
3028 "Nl80211Attrs",
3029 "NoackMap",
3030 self.orig_loc,
3031 self.buf.as_ptr() as usize,
3032 ))
3033 }
3034 pub fn get_inactivity_timeout(&self) -> Result<u16, ErrorContext> {
3035 let mut iter = self.clone();
3036 iter.pos = 0;
3037 for attr in iter {
3038 if let Nl80211Attrs::InactivityTimeout(val) = attr? {
3039 return Ok(val);
3040 }
3041 }
3042 Err(ErrorContext::new_missing(
3043 "Nl80211Attrs",
3044 "InactivityTimeout",
3045 self.orig_loc,
3046 self.buf.as_ptr() as usize,
3047 ))
3048 }
3049 pub fn get_rx_signal_dbm(&self) -> Result<u32, ErrorContext> {
3050 let mut iter = self.clone();
3051 iter.pos = 0;
3052 for attr in iter {
3053 if let Nl80211Attrs::RxSignalDbm(val) = attr? {
3054 return Ok(val);
3055 }
3056 }
3057 Err(ErrorContext::new_missing(
3058 "Nl80211Attrs",
3059 "RxSignalDbm",
3060 self.orig_loc,
3061 self.buf.as_ptr() as usize,
3062 ))
3063 }
3064 pub fn get_bg_scan_period(&self) -> Result<u16, ErrorContext> {
3065 let mut iter = self.clone();
3066 iter.pos = 0;
3067 for attr in iter {
3068 if let Nl80211Attrs::BgScanPeriod(val) = attr? {
3069 return Ok(val);
3070 }
3071 }
3072 Err(ErrorContext::new_missing(
3073 "Nl80211Attrs",
3074 "BgScanPeriod",
3075 self.orig_loc,
3076 self.buf.as_ptr() as usize,
3077 ))
3078 }
3079 pub fn get_wdev(&self) -> Result<u64, ErrorContext> {
3080 let mut iter = self.clone();
3081 iter.pos = 0;
3082 for attr in iter {
3083 if let Nl80211Attrs::Wdev(val) = attr? {
3084 return Ok(val);
3085 }
3086 }
3087 Err(ErrorContext::new_missing(
3088 "Nl80211Attrs",
3089 "Wdev",
3090 self.orig_loc,
3091 self.buf.as_ptr() as usize,
3092 ))
3093 }
3094 pub fn get_user_reg_hint_type(&self) -> Result<u32, ErrorContext> {
3095 let mut iter = self.clone();
3096 iter.pos = 0;
3097 for attr in iter {
3098 if let Nl80211Attrs::UserRegHintType(val) = attr? {
3099 return Ok(val);
3100 }
3101 }
3102 Err(ErrorContext::new_missing(
3103 "Nl80211Attrs",
3104 "UserRegHintType",
3105 self.orig_loc,
3106 self.buf.as_ptr() as usize,
3107 ))
3108 }
3109 pub fn get_conn_failed_reason(&self) -> Result<u32, ErrorContext> {
3110 let mut iter = self.clone();
3111 iter.pos = 0;
3112 for attr in iter {
3113 if let Nl80211Attrs::ConnFailedReason(val) = attr? {
3114 return Ok(val);
3115 }
3116 }
3117 Err(ErrorContext::new_missing(
3118 "Nl80211Attrs",
3119 "ConnFailedReason",
3120 self.orig_loc,
3121 self.buf.as_ptr() as usize,
3122 ))
3123 }
3124 pub fn get_auth_data(&self) -> Result<&'a [u8], ErrorContext> {
3125 let mut iter = self.clone();
3126 iter.pos = 0;
3127 for attr in iter {
3128 if let Nl80211Attrs::AuthData(val) = attr? {
3129 return Ok(val);
3130 }
3131 }
3132 Err(ErrorContext::new_missing(
3133 "Nl80211Attrs",
3134 "AuthData",
3135 self.orig_loc,
3136 self.buf.as_ptr() as usize,
3137 ))
3138 }
3139 pub fn get_vht_capability(&self) -> Result<&'a [u8], ErrorContext> {
3140 let mut iter = self.clone();
3141 iter.pos = 0;
3142 for attr in iter {
3143 if let Nl80211Attrs::VhtCapability(val) = attr? {
3144 return Ok(val);
3145 }
3146 }
3147 Err(ErrorContext::new_missing(
3148 "Nl80211Attrs",
3149 "VhtCapability",
3150 self.orig_loc,
3151 self.buf.as_ptr() as usize,
3152 ))
3153 }
3154 pub fn get_scan_flags(&self) -> Result<u32, ErrorContext> {
3155 let mut iter = self.clone();
3156 iter.pos = 0;
3157 for attr in iter {
3158 if let Nl80211Attrs::ScanFlags(val) = attr? {
3159 return Ok(val);
3160 }
3161 }
3162 Err(ErrorContext::new_missing(
3163 "Nl80211Attrs",
3164 "ScanFlags",
3165 self.orig_loc,
3166 self.buf.as_ptr() as usize,
3167 ))
3168 }
3169 pub fn get_channel_width(&self) -> Result<u32, ErrorContext> {
3170 let mut iter = self.clone();
3171 iter.pos = 0;
3172 for attr in iter {
3173 if let Nl80211Attrs::ChannelWidth(val) = attr? {
3174 return Ok(val);
3175 }
3176 }
3177 Err(ErrorContext::new_missing(
3178 "Nl80211Attrs",
3179 "ChannelWidth",
3180 self.orig_loc,
3181 self.buf.as_ptr() as usize,
3182 ))
3183 }
3184 pub fn get_center_freq1(&self) -> Result<u32, ErrorContext> {
3185 let mut iter = self.clone();
3186 iter.pos = 0;
3187 for attr in iter {
3188 if let Nl80211Attrs::CenterFreq1(val) = attr? {
3189 return Ok(val);
3190 }
3191 }
3192 Err(ErrorContext::new_missing(
3193 "Nl80211Attrs",
3194 "CenterFreq1",
3195 self.orig_loc,
3196 self.buf.as_ptr() as usize,
3197 ))
3198 }
3199 pub fn get_center_freq2(&self) -> Result<u32, ErrorContext> {
3200 let mut iter = self.clone();
3201 iter.pos = 0;
3202 for attr in iter {
3203 if let Nl80211Attrs::CenterFreq2(val) = attr? {
3204 return Ok(val);
3205 }
3206 }
3207 Err(ErrorContext::new_missing(
3208 "Nl80211Attrs",
3209 "CenterFreq2",
3210 self.orig_loc,
3211 self.buf.as_ptr() as usize,
3212 ))
3213 }
3214 pub fn get_p2p_ctwindow(&self) -> Result<u8, ErrorContext> {
3215 let mut iter = self.clone();
3216 iter.pos = 0;
3217 for attr in iter {
3218 if let Nl80211Attrs::P2pCtwindow(val) = attr? {
3219 return Ok(val);
3220 }
3221 }
3222 Err(ErrorContext::new_missing(
3223 "Nl80211Attrs",
3224 "P2pCtwindow",
3225 self.orig_loc,
3226 self.buf.as_ptr() as usize,
3227 ))
3228 }
3229 pub fn get_p2p_oppps(&self) -> Result<u8, ErrorContext> {
3230 let mut iter = self.clone();
3231 iter.pos = 0;
3232 for attr in iter {
3233 if let Nl80211Attrs::P2pOppps(val) = attr? {
3234 return Ok(val);
3235 }
3236 }
3237 Err(ErrorContext::new_missing(
3238 "Nl80211Attrs",
3239 "P2pOppps",
3240 self.orig_loc,
3241 self.buf.as_ptr() as usize,
3242 ))
3243 }
3244 pub fn get_local_mesh_power_mode(&self) -> Result<u32, ErrorContext> {
3245 let mut iter = self.clone();
3246 iter.pos = 0;
3247 for attr in iter {
3248 if let Nl80211Attrs::LocalMeshPowerMode(val) = attr? {
3249 return Ok(val);
3250 }
3251 }
3252 Err(ErrorContext::new_missing(
3253 "Nl80211Attrs",
3254 "LocalMeshPowerMode",
3255 self.orig_loc,
3256 self.buf.as_ptr() as usize,
3257 ))
3258 }
3259 pub fn get_acl_policy(&self) -> Result<u32, ErrorContext> {
3260 let mut iter = self.clone();
3261 iter.pos = 0;
3262 for attr in iter {
3263 if let Nl80211Attrs::AclPolicy(val) = attr? {
3264 return Ok(val);
3265 }
3266 }
3267 Err(ErrorContext::new_missing(
3268 "Nl80211Attrs",
3269 "AclPolicy",
3270 self.orig_loc,
3271 self.buf.as_ptr() as usize,
3272 ))
3273 }
3274 pub fn get_mac_addrs(&self) -> Result<&'a [u8], ErrorContext> {
3275 let mut iter = self.clone();
3276 iter.pos = 0;
3277 for attr in iter {
3278 if let Nl80211Attrs::MacAddrs(val) = attr? {
3279 return Ok(val);
3280 }
3281 }
3282 Err(ErrorContext::new_missing(
3283 "Nl80211Attrs",
3284 "MacAddrs",
3285 self.orig_loc,
3286 self.buf.as_ptr() as usize,
3287 ))
3288 }
3289 pub fn get_mac_acl_max(&self) -> Result<u32, ErrorContext> {
3290 let mut iter = self.clone();
3291 iter.pos = 0;
3292 for attr in iter {
3293 if let Nl80211Attrs::MacAclMax(val) = attr? {
3294 return Ok(val);
3295 }
3296 }
3297 Err(ErrorContext::new_missing(
3298 "Nl80211Attrs",
3299 "MacAclMax",
3300 self.orig_loc,
3301 self.buf.as_ptr() as usize,
3302 ))
3303 }
3304 pub fn get_radar_event(&self) -> Result<u32, ErrorContext> {
3305 let mut iter = self.clone();
3306 iter.pos = 0;
3307 for attr in iter {
3308 if let Nl80211Attrs::RadarEvent(val) = attr? {
3309 return Ok(val);
3310 }
3311 }
3312 Err(ErrorContext::new_missing(
3313 "Nl80211Attrs",
3314 "RadarEvent",
3315 self.orig_loc,
3316 self.buf.as_ptr() as usize,
3317 ))
3318 }
3319 pub fn get_ext_capa(&self) -> Result<&'a [u8], ErrorContext> {
3320 let mut iter = self.clone();
3321 iter.pos = 0;
3322 for attr in iter {
3323 if let Nl80211Attrs::ExtCapa(val) = attr? {
3324 return Ok(val);
3325 }
3326 }
3327 Err(ErrorContext::new_missing(
3328 "Nl80211Attrs",
3329 "ExtCapa",
3330 self.orig_loc,
3331 self.buf.as_ptr() as usize,
3332 ))
3333 }
3334 pub fn get_ext_capa_mask(&self) -> Result<&'a [u8], ErrorContext> {
3335 let mut iter = self.clone();
3336 iter.pos = 0;
3337 for attr in iter {
3338 if let Nl80211Attrs::ExtCapaMask(val) = attr? {
3339 return Ok(val);
3340 }
3341 }
3342 Err(ErrorContext::new_missing(
3343 "Nl80211Attrs",
3344 "ExtCapaMask",
3345 self.orig_loc,
3346 self.buf.as_ptr() as usize,
3347 ))
3348 }
3349 pub fn get_sta_capability(&self) -> Result<u16, ErrorContext> {
3350 let mut iter = self.clone();
3351 iter.pos = 0;
3352 for attr in iter {
3353 if let Nl80211Attrs::StaCapability(val) = attr? {
3354 return Ok(val);
3355 }
3356 }
3357 Err(ErrorContext::new_missing(
3358 "Nl80211Attrs",
3359 "StaCapability",
3360 self.orig_loc,
3361 self.buf.as_ptr() as usize,
3362 ))
3363 }
3364 pub fn get_sta_ext_capability(&self) -> Result<&'a [u8], ErrorContext> {
3365 let mut iter = self.clone();
3366 iter.pos = 0;
3367 for attr in iter {
3368 if let Nl80211Attrs::StaExtCapability(val) = attr? {
3369 return Ok(val);
3370 }
3371 }
3372 Err(ErrorContext::new_missing(
3373 "Nl80211Attrs",
3374 "StaExtCapability",
3375 self.orig_loc,
3376 self.buf.as_ptr() as usize,
3377 ))
3378 }
3379 #[doc = "Associated type: \"ProtocolFeatures\" (enum)"]
3380 pub fn get_protocol_features(&self) -> Result<u32, ErrorContext> {
3381 let mut iter = self.clone();
3382 iter.pos = 0;
3383 for attr in iter {
3384 if let Nl80211Attrs::ProtocolFeatures(val) = attr? {
3385 return Ok(val);
3386 }
3387 }
3388 Err(ErrorContext::new_missing(
3389 "Nl80211Attrs",
3390 "ProtocolFeatures",
3391 self.orig_loc,
3392 self.buf.as_ptr() as usize,
3393 ))
3394 }
3395 pub fn get_split_wiphy_dump(&self) -> Result<(), ErrorContext> {
3396 let mut iter = self.clone();
3397 iter.pos = 0;
3398 for attr in iter {
3399 if let Nl80211Attrs::SplitWiphyDump(val) = attr? {
3400 return Ok(val);
3401 }
3402 }
3403 Err(ErrorContext::new_missing(
3404 "Nl80211Attrs",
3405 "SplitWiphyDump",
3406 self.orig_loc,
3407 self.buf.as_ptr() as usize,
3408 ))
3409 }
3410 pub fn get_disable_vht(&self) -> Result<(), ErrorContext> {
3411 let mut iter = self.clone();
3412 iter.pos = 0;
3413 for attr in iter {
3414 if let Nl80211Attrs::DisableVht(val) = attr? {
3415 return Ok(val);
3416 }
3417 }
3418 Err(ErrorContext::new_missing(
3419 "Nl80211Attrs",
3420 "DisableVht",
3421 self.orig_loc,
3422 self.buf.as_ptr() as usize,
3423 ))
3424 }
3425 pub fn get_vht_capability_mask(&self) -> Result<&'a [u8], ErrorContext> {
3426 let mut iter = self.clone();
3427 iter.pos = 0;
3428 for attr in iter {
3429 if let Nl80211Attrs::VhtCapabilityMask(val) = attr? {
3430 return Ok(val);
3431 }
3432 }
3433 Err(ErrorContext::new_missing(
3434 "Nl80211Attrs",
3435 "VhtCapabilityMask",
3436 self.orig_loc,
3437 self.buf.as_ptr() as usize,
3438 ))
3439 }
3440 pub fn get_mdid(&self) -> Result<u16, ErrorContext> {
3441 let mut iter = self.clone();
3442 iter.pos = 0;
3443 for attr in iter {
3444 if let Nl80211Attrs::Mdid(val) = attr? {
3445 return Ok(val);
3446 }
3447 }
3448 Err(ErrorContext::new_missing(
3449 "Nl80211Attrs",
3450 "Mdid",
3451 self.orig_loc,
3452 self.buf.as_ptr() as usize,
3453 ))
3454 }
3455 pub fn get_ie_ric(&self) -> Result<&'a [u8], ErrorContext> {
3456 let mut iter = self.clone();
3457 iter.pos = 0;
3458 for attr in iter {
3459 if let Nl80211Attrs::IeRic(val) = attr? {
3460 return Ok(val);
3461 }
3462 }
3463 Err(ErrorContext::new_missing(
3464 "Nl80211Attrs",
3465 "IeRic",
3466 self.orig_loc,
3467 self.buf.as_ptr() as usize,
3468 ))
3469 }
3470 pub fn get_crit_prot_id(&self) -> Result<u16, ErrorContext> {
3471 let mut iter = self.clone();
3472 iter.pos = 0;
3473 for attr in iter {
3474 if let Nl80211Attrs::CritProtId(val) = attr? {
3475 return Ok(val);
3476 }
3477 }
3478 Err(ErrorContext::new_missing(
3479 "Nl80211Attrs",
3480 "CritProtId",
3481 self.orig_loc,
3482 self.buf.as_ptr() as usize,
3483 ))
3484 }
3485 pub fn get_max_crit_prot_duration(&self) -> Result<u16, ErrorContext> {
3486 let mut iter = self.clone();
3487 iter.pos = 0;
3488 for attr in iter {
3489 if let Nl80211Attrs::MaxCritProtDuration(val) = attr? {
3490 return Ok(val);
3491 }
3492 }
3493 Err(ErrorContext::new_missing(
3494 "Nl80211Attrs",
3495 "MaxCritProtDuration",
3496 self.orig_loc,
3497 self.buf.as_ptr() as usize,
3498 ))
3499 }
3500 pub fn get_peer_aid(&self) -> Result<u16, ErrorContext> {
3501 let mut iter = self.clone();
3502 iter.pos = 0;
3503 for attr in iter {
3504 if let Nl80211Attrs::PeerAid(val) = attr? {
3505 return Ok(val);
3506 }
3507 }
3508 Err(ErrorContext::new_missing(
3509 "Nl80211Attrs",
3510 "PeerAid",
3511 self.orig_loc,
3512 self.buf.as_ptr() as usize,
3513 ))
3514 }
3515 pub fn get_coalesce_rule(&self) -> Result<&'a [u8], ErrorContext> {
3516 let mut iter = self.clone();
3517 iter.pos = 0;
3518 for attr in iter {
3519 if let Nl80211Attrs::CoalesceRule(val) = attr? {
3520 return Ok(val);
3521 }
3522 }
3523 Err(ErrorContext::new_missing(
3524 "Nl80211Attrs",
3525 "CoalesceRule",
3526 self.orig_loc,
3527 self.buf.as_ptr() as usize,
3528 ))
3529 }
3530 pub fn get_ch_switch_count(&self) -> Result<u32, ErrorContext> {
3531 let mut iter = self.clone();
3532 iter.pos = 0;
3533 for attr in iter {
3534 if let Nl80211Attrs::ChSwitchCount(val) = attr? {
3535 return Ok(val);
3536 }
3537 }
3538 Err(ErrorContext::new_missing(
3539 "Nl80211Attrs",
3540 "ChSwitchCount",
3541 self.orig_loc,
3542 self.buf.as_ptr() as usize,
3543 ))
3544 }
3545 pub fn get_ch_switch_block_tx(&self) -> Result<(), ErrorContext> {
3546 let mut iter = self.clone();
3547 iter.pos = 0;
3548 for attr in iter {
3549 if let Nl80211Attrs::ChSwitchBlockTx(val) = attr? {
3550 return Ok(val);
3551 }
3552 }
3553 Err(ErrorContext::new_missing(
3554 "Nl80211Attrs",
3555 "ChSwitchBlockTx",
3556 self.orig_loc,
3557 self.buf.as_ptr() as usize,
3558 ))
3559 }
3560 pub fn get_csa_ies(&self) -> Result<&'a [u8], ErrorContext> {
3561 let mut iter = self.clone();
3562 iter.pos = 0;
3563 for attr in iter {
3564 if let Nl80211Attrs::CsaIes(val) = attr? {
3565 return Ok(val);
3566 }
3567 }
3568 Err(ErrorContext::new_missing(
3569 "Nl80211Attrs",
3570 "CsaIes",
3571 self.orig_loc,
3572 self.buf.as_ptr() as usize,
3573 ))
3574 }
3575 pub fn get_cntdwn_offs_beacon(&self) -> Result<&'a [u8], ErrorContext> {
3576 let mut iter = self.clone();
3577 iter.pos = 0;
3578 for attr in iter {
3579 if let Nl80211Attrs::CntdwnOffsBeacon(val) = attr? {
3580 return Ok(val);
3581 }
3582 }
3583 Err(ErrorContext::new_missing(
3584 "Nl80211Attrs",
3585 "CntdwnOffsBeacon",
3586 self.orig_loc,
3587 self.buf.as_ptr() as usize,
3588 ))
3589 }
3590 pub fn get_cntdwn_offs_presp(&self) -> Result<&'a [u8], ErrorContext> {
3591 let mut iter = self.clone();
3592 iter.pos = 0;
3593 for attr in iter {
3594 if let Nl80211Attrs::CntdwnOffsPresp(val) = attr? {
3595 return Ok(val);
3596 }
3597 }
3598 Err(ErrorContext::new_missing(
3599 "Nl80211Attrs",
3600 "CntdwnOffsPresp",
3601 self.orig_loc,
3602 self.buf.as_ptr() as usize,
3603 ))
3604 }
3605 pub fn get_rxmgmt_flags(&self) -> Result<&'a [u8], ErrorContext> {
3606 let mut iter = self.clone();
3607 iter.pos = 0;
3608 for attr in iter {
3609 if let Nl80211Attrs::RxmgmtFlags(val) = attr? {
3610 return Ok(val);
3611 }
3612 }
3613 Err(ErrorContext::new_missing(
3614 "Nl80211Attrs",
3615 "RxmgmtFlags",
3616 self.orig_loc,
3617 self.buf.as_ptr() as usize,
3618 ))
3619 }
3620 pub fn get_sta_supported_channels(&self) -> Result<&'a [u8], ErrorContext> {
3621 let mut iter = self.clone();
3622 iter.pos = 0;
3623 for attr in iter {
3624 if let Nl80211Attrs::StaSupportedChannels(val) = attr? {
3625 return Ok(val);
3626 }
3627 }
3628 Err(ErrorContext::new_missing(
3629 "Nl80211Attrs",
3630 "StaSupportedChannels",
3631 self.orig_loc,
3632 self.buf.as_ptr() as usize,
3633 ))
3634 }
3635 pub fn get_sta_supported_oper_classes(&self) -> Result<&'a [u8], ErrorContext> {
3636 let mut iter = self.clone();
3637 iter.pos = 0;
3638 for attr in iter {
3639 if let Nl80211Attrs::StaSupportedOperClasses(val) = attr? {
3640 return Ok(val);
3641 }
3642 }
3643 Err(ErrorContext::new_missing(
3644 "Nl80211Attrs",
3645 "StaSupportedOperClasses",
3646 self.orig_loc,
3647 self.buf.as_ptr() as usize,
3648 ))
3649 }
3650 pub fn get_handle_dfs(&self) -> Result<(), ErrorContext> {
3651 let mut iter = self.clone();
3652 iter.pos = 0;
3653 for attr in iter {
3654 if let Nl80211Attrs::HandleDfs(val) = attr? {
3655 return Ok(val);
3656 }
3657 }
3658 Err(ErrorContext::new_missing(
3659 "Nl80211Attrs",
3660 "HandleDfs",
3661 self.orig_loc,
3662 self.buf.as_ptr() as usize,
3663 ))
3664 }
3665 pub fn get_support_5_mhz(&self) -> Result<(), ErrorContext> {
3666 let mut iter = self.clone();
3667 iter.pos = 0;
3668 for attr in iter {
3669 if let Nl80211Attrs::Support5Mhz(val) = attr? {
3670 return Ok(val);
3671 }
3672 }
3673 Err(ErrorContext::new_missing(
3674 "Nl80211Attrs",
3675 "Support5Mhz",
3676 self.orig_loc,
3677 self.buf.as_ptr() as usize,
3678 ))
3679 }
3680 pub fn get_support_10_mhz(&self) -> Result<(), ErrorContext> {
3681 let mut iter = self.clone();
3682 iter.pos = 0;
3683 for attr in iter {
3684 if let Nl80211Attrs::Support10Mhz(val) = attr? {
3685 return Ok(val);
3686 }
3687 }
3688 Err(ErrorContext::new_missing(
3689 "Nl80211Attrs",
3690 "Support10Mhz",
3691 self.orig_loc,
3692 self.buf.as_ptr() as usize,
3693 ))
3694 }
3695 pub fn get_opmode_notif(&self) -> Result<u8, ErrorContext> {
3696 let mut iter = self.clone();
3697 iter.pos = 0;
3698 for attr in iter {
3699 if let Nl80211Attrs::OpmodeNotif(val) = attr? {
3700 return Ok(val);
3701 }
3702 }
3703 Err(ErrorContext::new_missing(
3704 "Nl80211Attrs",
3705 "OpmodeNotif",
3706 self.orig_loc,
3707 self.buf.as_ptr() as usize,
3708 ))
3709 }
3710 pub fn get_vendor_id(&self) -> Result<u32, ErrorContext> {
3711 let mut iter = self.clone();
3712 iter.pos = 0;
3713 for attr in iter {
3714 if let Nl80211Attrs::VendorId(val) = attr? {
3715 return Ok(val);
3716 }
3717 }
3718 Err(ErrorContext::new_missing(
3719 "Nl80211Attrs",
3720 "VendorId",
3721 self.orig_loc,
3722 self.buf.as_ptr() as usize,
3723 ))
3724 }
3725 pub fn get_vendor_subcmd(&self) -> Result<u32, ErrorContext> {
3726 let mut iter = self.clone();
3727 iter.pos = 0;
3728 for attr in iter {
3729 if let Nl80211Attrs::VendorSubcmd(val) = attr? {
3730 return Ok(val);
3731 }
3732 }
3733 Err(ErrorContext::new_missing(
3734 "Nl80211Attrs",
3735 "VendorSubcmd",
3736 self.orig_loc,
3737 self.buf.as_ptr() as usize,
3738 ))
3739 }
3740 pub fn get_vendor_data(&self) -> Result<&'a [u8], ErrorContext> {
3741 let mut iter = self.clone();
3742 iter.pos = 0;
3743 for attr in iter {
3744 if let Nl80211Attrs::VendorData(val) = attr? {
3745 return Ok(val);
3746 }
3747 }
3748 Err(ErrorContext::new_missing(
3749 "Nl80211Attrs",
3750 "VendorData",
3751 self.orig_loc,
3752 self.buf.as_ptr() as usize,
3753 ))
3754 }
3755 pub fn get_vendor_events(&self) -> Result<&'a [u8], ErrorContext> {
3756 let mut iter = self.clone();
3757 iter.pos = 0;
3758 for attr in iter {
3759 if let Nl80211Attrs::VendorEvents(val) = attr? {
3760 return Ok(val);
3761 }
3762 }
3763 Err(ErrorContext::new_missing(
3764 "Nl80211Attrs",
3765 "VendorEvents",
3766 self.orig_loc,
3767 self.buf.as_ptr() as usize,
3768 ))
3769 }
3770 pub fn get_qos_map(&self) -> Result<&'a [u8], ErrorContext> {
3771 let mut iter = self.clone();
3772 iter.pos = 0;
3773 for attr in iter {
3774 if let Nl80211Attrs::QosMap(val) = attr? {
3775 return Ok(val);
3776 }
3777 }
3778 Err(ErrorContext::new_missing(
3779 "Nl80211Attrs",
3780 "QosMap",
3781 self.orig_loc,
3782 self.buf.as_ptr() as usize,
3783 ))
3784 }
3785 pub fn get_mac_hint(&self) -> Result<&'a [u8], ErrorContext> {
3786 let mut iter = self.clone();
3787 iter.pos = 0;
3788 for attr in iter {
3789 if let Nl80211Attrs::MacHint(val) = attr? {
3790 return Ok(val);
3791 }
3792 }
3793 Err(ErrorContext::new_missing(
3794 "Nl80211Attrs",
3795 "MacHint",
3796 self.orig_loc,
3797 self.buf.as_ptr() as usize,
3798 ))
3799 }
3800 pub fn get_wiphy_freq_hint(&self) -> Result<u32, ErrorContext> {
3801 let mut iter = self.clone();
3802 iter.pos = 0;
3803 for attr in iter {
3804 if let Nl80211Attrs::WiphyFreqHint(val) = attr? {
3805 return Ok(val);
3806 }
3807 }
3808 Err(ErrorContext::new_missing(
3809 "Nl80211Attrs",
3810 "WiphyFreqHint",
3811 self.orig_loc,
3812 self.buf.as_ptr() as usize,
3813 ))
3814 }
3815 pub fn get_max_ap_assoc_sta(&self) -> Result<u32, ErrorContext> {
3816 let mut iter = self.clone();
3817 iter.pos = 0;
3818 for attr in iter {
3819 if let Nl80211Attrs::MaxApAssocSta(val) = attr? {
3820 return Ok(val);
3821 }
3822 }
3823 Err(ErrorContext::new_missing(
3824 "Nl80211Attrs",
3825 "MaxApAssocSta",
3826 self.orig_loc,
3827 self.buf.as_ptr() as usize,
3828 ))
3829 }
3830 pub fn get_tdls_peer_capability(&self) -> Result<u32, ErrorContext> {
3831 let mut iter = self.clone();
3832 iter.pos = 0;
3833 for attr in iter {
3834 if let Nl80211Attrs::TdlsPeerCapability(val) = attr? {
3835 return Ok(val);
3836 }
3837 }
3838 Err(ErrorContext::new_missing(
3839 "Nl80211Attrs",
3840 "TdlsPeerCapability",
3841 self.orig_loc,
3842 self.buf.as_ptr() as usize,
3843 ))
3844 }
3845 pub fn get_socket_owner(&self) -> Result<(), ErrorContext> {
3846 let mut iter = self.clone();
3847 iter.pos = 0;
3848 for attr in iter {
3849 if let Nl80211Attrs::SocketOwner(val) = attr? {
3850 return Ok(val);
3851 }
3852 }
3853 Err(ErrorContext::new_missing(
3854 "Nl80211Attrs",
3855 "SocketOwner",
3856 self.orig_loc,
3857 self.buf.as_ptr() as usize,
3858 ))
3859 }
3860 pub fn get_csa_c_offsets_tx(&self) -> Result<&'a [u8], ErrorContext> {
3861 let mut iter = self.clone();
3862 iter.pos = 0;
3863 for attr in iter {
3864 if let Nl80211Attrs::CsaCOffsetsTx(val) = attr? {
3865 return Ok(val);
3866 }
3867 }
3868 Err(ErrorContext::new_missing(
3869 "Nl80211Attrs",
3870 "CsaCOffsetsTx",
3871 self.orig_loc,
3872 self.buf.as_ptr() as usize,
3873 ))
3874 }
3875 pub fn get_max_csa_counters(&self) -> Result<u8, ErrorContext> {
3876 let mut iter = self.clone();
3877 iter.pos = 0;
3878 for attr in iter {
3879 if let Nl80211Attrs::MaxCsaCounters(val) = attr? {
3880 return Ok(val);
3881 }
3882 }
3883 Err(ErrorContext::new_missing(
3884 "Nl80211Attrs",
3885 "MaxCsaCounters",
3886 self.orig_loc,
3887 self.buf.as_ptr() as usize,
3888 ))
3889 }
3890 pub fn get_tdls_initiator(&self) -> Result<(), ErrorContext> {
3891 let mut iter = self.clone();
3892 iter.pos = 0;
3893 for attr in iter {
3894 if let Nl80211Attrs::TdlsInitiator(val) = attr? {
3895 return Ok(val);
3896 }
3897 }
3898 Err(ErrorContext::new_missing(
3899 "Nl80211Attrs",
3900 "TdlsInitiator",
3901 self.orig_loc,
3902 self.buf.as_ptr() as usize,
3903 ))
3904 }
3905 pub fn get_use_rrm(&self) -> Result<(), ErrorContext> {
3906 let mut iter = self.clone();
3907 iter.pos = 0;
3908 for attr in iter {
3909 if let Nl80211Attrs::UseRrm(val) = attr? {
3910 return Ok(val);
3911 }
3912 }
3913 Err(ErrorContext::new_missing(
3914 "Nl80211Attrs",
3915 "UseRrm",
3916 self.orig_loc,
3917 self.buf.as_ptr() as usize,
3918 ))
3919 }
3920 pub fn get_wiphy_dyn_ack(&self) -> Result<(), ErrorContext> {
3921 let mut iter = self.clone();
3922 iter.pos = 0;
3923 for attr in iter {
3924 if let Nl80211Attrs::WiphyDynAck(val) = attr? {
3925 return Ok(val);
3926 }
3927 }
3928 Err(ErrorContext::new_missing(
3929 "Nl80211Attrs",
3930 "WiphyDynAck",
3931 self.orig_loc,
3932 self.buf.as_ptr() as usize,
3933 ))
3934 }
3935 pub fn get_tsid(&self) -> Result<u8, ErrorContext> {
3936 let mut iter = self.clone();
3937 iter.pos = 0;
3938 for attr in iter {
3939 if let Nl80211Attrs::Tsid(val) = attr? {
3940 return Ok(val);
3941 }
3942 }
3943 Err(ErrorContext::new_missing(
3944 "Nl80211Attrs",
3945 "Tsid",
3946 self.orig_loc,
3947 self.buf.as_ptr() as usize,
3948 ))
3949 }
3950 pub fn get_user_prio(&self) -> Result<u8, ErrorContext> {
3951 let mut iter = self.clone();
3952 iter.pos = 0;
3953 for attr in iter {
3954 if let Nl80211Attrs::UserPrio(val) = attr? {
3955 return Ok(val);
3956 }
3957 }
3958 Err(ErrorContext::new_missing(
3959 "Nl80211Attrs",
3960 "UserPrio",
3961 self.orig_loc,
3962 self.buf.as_ptr() as usize,
3963 ))
3964 }
3965 pub fn get_admitted_time(&self) -> Result<u16, ErrorContext> {
3966 let mut iter = self.clone();
3967 iter.pos = 0;
3968 for attr in iter {
3969 if let Nl80211Attrs::AdmittedTime(val) = attr? {
3970 return Ok(val);
3971 }
3972 }
3973 Err(ErrorContext::new_missing(
3974 "Nl80211Attrs",
3975 "AdmittedTime",
3976 self.orig_loc,
3977 self.buf.as_ptr() as usize,
3978 ))
3979 }
3980 pub fn get_smps_mode(&self) -> Result<u8, ErrorContext> {
3981 let mut iter = self.clone();
3982 iter.pos = 0;
3983 for attr in iter {
3984 if let Nl80211Attrs::SmpsMode(val) = attr? {
3985 return Ok(val);
3986 }
3987 }
3988 Err(ErrorContext::new_missing(
3989 "Nl80211Attrs",
3990 "SmpsMode",
3991 self.orig_loc,
3992 self.buf.as_ptr() as usize,
3993 ))
3994 }
3995 pub fn get_oper_class(&self) -> Result<u8, ErrorContext> {
3996 let mut iter = self.clone();
3997 iter.pos = 0;
3998 for attr in iter {
3999 if let Nl80211Attrs::OperClass(val) = attr? {
4000 return Ok(val);
4001 }
4002 }
4003 Err(ErrorContext::new_missing(
4004 "Nl80211Attrs",
4005 "OperClass",
4006 self.orig_loc,
4007 self.buf.as_ptr() as usize,
4008 ))
4009 }
4010 pub fn get_mac_mask(&self) -> Result<&'a [u8], ErrorContext> {
4011 let mut iter = self.clone();
4012 iter.pos = 0;
4013 for attr in iter {
4014 if let Nl80211Attrs::MacMask(val) = attr? {
4015 return Ok(val);
4016 }
4017 }
4018 Err(ErrorContext::new_missing(
4019 "Nl80211Attrs",
4020 "MacMask",
4021 self.orig_loc,
4022 self.buf.as_ptr() as usize,
4023 ))
4024 }
4025 pub fn get_wiphy_self_managed_reg(&self) -> Result<(), ErrorContext> {
4026 let mut iter = self.clone();
4027 iter.pos = 0;
4028 for attr in iter {
4029 if let Nl80211Attrs::WiphySelfManagedReg(val) = attr? {
4030 return Ok(val);
4031 }
4032 }
4033 Err(ErrorContext::new_missing(
4034 "Nl80211Attrs",
4035 "WiphySelfManagedReg",
4036 self.orig_loc,
4037 self.buf.as_ptr() as usize,
4038 ))
4039 }
4040 pub fn get_ext_features(&self) -> Result<&'a [u8], ErrorContext> {
4041 let mut iter = self.clone();
4042 iter.pos = 0;
4043 for attr in iter {
4044 if let Nl80211Attrs::ExtFeatures(val) = attr? {
4045 return Ok(val);
4046 }
4047 }
4048 Err(ErrorContext::new_missing(
4049 "Nl80211Attrs",
4050 "ExtFeatures",
4051 self.orig_loc,
4052 self.buf.as_ptr() as usize,
4053 ))
4054 }
4055 pub fn get_survey_radio_stats(&self) -> Result<&'a [u8], ErrorContext> {
4056 let mut iter = self.clone();
4057 iter.pos = 0;
4058 for attr in iter {
4059 if let Nl80211Attrs::SurveyRadioStats(val) = attr? {
4060 return Ok(val);
4061 }
4062 }
4063 Err(ErrorContext::new_missing(
4064 "Nl80211Attrs",
4065 "SurveyRadioStats",
4066 self.orig_loc,
4067 self.buf.as_ptr() as usize,
4068 ))
4069 }
4070 pub fn get_netns_fd(&self) -> Result<u32, ErrorContext> {
4071 let mut iter = self.clone();
4072 iter.pos = 0;
4073 for attr in iter {
4074 if let Nl80211Attrs::NetnsFd(val) = attr? {
4075 return Ok(val);
4076 }
4077 }
4078 Err(ErrorContext::new_missing(
4079 "Nl80211Attrs",
4080 "NetnsFd",
4081 self.orig_loc,
4082 self.buf.as_ptr() as usize,
4083 ))
4084 }
4085 pub fn get_sched_scan_delay(&self) -> Result<u32, ErrorContext> {
4086 let mut iter = self.clone();
4087 iter.pos = 0;
4088 for attr in iter {
4089 if let Nl80211Attrs::SchedScanDelay(val) = attr? {
4090 return Ok(val);
4091 }
4092 }
4093 Err(ErrorContext::new_missing(
4094 "Nl80211Attrs",
4095 "SchedScanDelay",
4096 self.orig_loc,
4097 self.buf.as_ptr() as usize,
4098 ))
4099 }
4100 pub fn get_reg_indoor(&self) -> Result<(), ErrorContext> {
4101 let mut iter = self.clone();
4102 iter.pos = 0;
4103 for attr in iter {
4104 if let Nl80211Attrs::RegIndoor(val) = attr? {
4105 return Ok(val);
4106 }
4107 }
4108 Err(ErrorContext::new_missing(
4109 "Nl80211Attrs",
4110 "RegIndoor",
4111 self.orig_loc,
4112 self.buf.as_ptr() as usize,
4113 ))
4114 }
4115 pub fn get_max_num_sched_scan_plans(&self) -> Result<u32, ErrorContext> {
4116 let mut iter = self.clone();
4117 iter.pos = 0;
4118 for attr in iter {
4119 if let Nl80211Attrs::MaxNumSchedScanPlans(val) = attr? {
4120 return Ok(val);
4121 }
4122 }
4123 Err(ErrorContext::new_missing(
4124 "Nl80211Attrs",
4125 "MaxNumSchedScanPlans",
4126 self.orig_loc,
4127 self.buf.as_ptr() as usize,
4128 ))
4129 }
4130 pub fn get_max_scan_plan_interval(&self) -> Result<u32, ErrorContext> {
4131 let mut iter = self.clone();
4132 iter.pos = 0;
4133 for attr in iter {
4134 if let Nl80211Attrs::MaxScanPlanInterval(val) = attr? {
4135 return Ok(val);
4136 }
4137 }
4138 Err(ErrorContext::new_missing(
4139 "Nl80211Attrs",
4140 "MaxScanPlanInterval",
4141 self.orig_loc,
4142 self.buf.as_ptr() as usize,
4143 ))
4144 }
4145 pub fn get_max_scan_plan_iterations(&self) -> Result<u32, ErrorContext> {
4146 let mut iter = self.clone();
4147 iter.pos = 0;
4148 for attr in iter {
4149 if let Nl80211Attrs::MaxScanPlanIterations(val) = attr? {
4150 return Ok(val);
4151 }
4152 }
4153 Err(ErrorContext::new_missing(
4154 "Nl80211Attrs",
4155 "MaxScanPlanIterations",
4156 self.orig_loc,
4157 self.buf.as_ptr() as usize,
4158 ))
4159 }
4160 pub fn get_sched_scan_plans(&self) -> Result<&'a [u8], ErrorContext> {
4161 let mut iter = self.clone();
4162 iter.pos = 0;
4163 for attr in iter {
4164 if let Nl80211Attrs::SchedScanPlans(val) = attr? {
4165 return Ok(val);
4166 }
4167 }
4168 Err(ErrorContext::new_missing(
4169 "Nl80211Attrs",
4170 "SchedScanPlans",
4171 self.orig_loc,
4172 self.buf.as_ptr() as usize,
4173 ))
4174 }
4175 pub fn get_pbss(&self) -> Result<(), ErrorContext> {
4176 let mut iter = self.clone();
4177 iter.pos = 0;
4178 for attr in iter {
4179 if let Nl80211Attrs::Pbss(val) = attr? {
4180 return Ok(val);
4181 }
4182 }
4183 Err(ErrorContext::new_missing(
4184 "Nl80211Attrs",
4185 "Pbss",
4186 self.orig_loc,
4187 self.buf.as_ptr() as usize,
4188 ))
4189 }
4190 pub fn get_bss_select(&self) -> Result<&'a [u8], ErrorContext> {
4191 let mut iter = self.clone();
4192 iter.pos = 0;
4193 for attr in iter {
4194 if let Nl80211Attrs::BssSelect(val) = attr? {
4195 return Ok(val);
4196 }
4197 }
4198 Err(ErrorContext::new_missing(
4199 "Nl80211Attrs",
4200 "BssSelect",
4201 self.orig_loc,
4202 self.buf.as_ptr() as usize,
4203 ))
4204 }
4205 pub fn get_sta_support_p2p_ps(&self) -> Result<u8, ErrorContext> {
4206 let mut iter = self.clone();
4207 iter.pos = 0;
4208 for attr in iter {
4209 if let Nl80211Attrs::StaSupportP2pPs(val) = attr? {
4210 return Ok(val);
4211 }
4212 }
4213 Err(ErrorContext::new_missing(
4214 "Nl80211Attrs",
4215 "StaSupportP2pPs",
4216 self.orig_loc,
4217 self.buf.as_ptr() as usize,
4218 ))
4219 }
4220 pub fn get_pad(&self) -> Result<&'a [u8], ErrorContext> {
4221 let mut iter = self.clone();
4222 iter.pos = 0;
4223 for attr in iter {
4224 if let Nl80211Attrs::Pad(val) = attr? {
4225 return Ok(val);
4226 }
4227 }
4228 Err(ErrorContext::new_missing(
4229 "Nl80211Attrs",
4230 "Pad",
4231 self.orig_loc,
4232 self.buf.as_ptr() as usize,
4233 ))
4234 }
4235 pub fn get_iftype_ext_capa(&self) -> Result<&'a [u8], ErrorContext> {
4236 let mut iter = self.clone();
4237 iter.pos = 0;
4238 for attr in iter {
4239 if let Nl80211Attrs::IftypeExtCapa(val) = attr? {
4240 return Ok(val);
4241 }
4242 }
4243 Err(ErrorContext::new_missing(
4244 "Nl80211Attrs",
4245 "IftypeExtCapa",
4246 self.orig_loc,
4247 self.buf.as_ptr() as usize,
4248 ))
4249 }
4250 pub fn get_mu_mimo_group_data(&self) -> Result<&'a [u8], ErrorContext> {
4251 let mut iter = self.clone();
4252 iter.pos = 0;
4253 for attr in iter {
4254 if let Nl80211Attrs::MuMimoGroupData(val) = attr? {
4255 return Ok(val);
4256 }
4257 }
4258 Err(ErrorContext::new_missing(
4259 "Nl80211Attrs",
4260 "MuMimoGroupData",
4261 self.orig_loc,
4262 self.buf.as_ptr() as usize,
4263 ))
4264 }
4265 pub fn get_mu_mimo_follow_mac_addr(&self) -> Result<&'a [u8], ErrorContext> {
4266 let mut iter = self.clone();
4267 iter.pos = 0;
4268 for attr in iter {
4269 if let Nl80211Attrs::MuMimoFollowMacAddr(val) = attr? {
4270 return Ok(val);
4271 }
4272 }
4273 Err(ErrorContext::new_missing(
4274 "Nl80211Attrs",
4275 "MuMimoFollowMacAddr",
4276 self.orig_loc,
4277 self.buf.as_ptr() as usize,
4278 ))
4279 }
4280 pub fn get_scan_start_time_tsf(&self) -> Result<u64, ErrorContext> {
4281 let mut iter = self.clone();
4282 iter.pos = 0;
4283 for attr in iter {
4284 if let Nl80211Attrs::ScanStartTimeTsf(val) = attr? {
4285 return Ok(val);
4286 }
4287 }
4288 Err(ErrorContext::new_missing(
4289 "Nl80211Attrs",
4290 "ScanStartTimeTsf",
4291 self.orig_loc,
4292 self.buf.as_ptr() as usize,
4293 ))
4294 }
4295 pub fn get_scan_start_time_tsf_bssid(&self) -> Result<&'a [u8], ErrorContext> {
4296 let mut iter = self.clone();
4297 iter.pos = 0;
4298 for attr in iter {
4299 if let Nl80211Attrs::ScanStartTimeTsfBssid(val) = attr? {
4300 return Ok(val);
4301 }
4302 }
4303 Err(ErrorContext::new_missing(
4304 "Nl80211Attrs",
4305 "ScanStartTimeTsfBssid",
4306 self.orig_loc,
4307 self.buf.as_ptr() as usize,
4308 ))
4309 }
4310 pub fn get_measurement_duration(&self) -> Result<u16, ErrorContext> {
4311 let mut iter = self.clone();
4312 iter.pos = 0;
4313 for attr in iter {
4314 if let Nl80211Attrs::MeasurementDuration(val) = attr? {
4315 return Ok(val);
4316 }
4317 }
4318 Err(ErrorContext::new_missing(
4319 "Nl80211Attrs",
4320 "MeasurementDuration",
4321 self.orig_loc,
4322 self.buf.as_ptr() as usize,
4323 ))
4324 }
4325 pub fn get_measurement_duration_mandatory(&self) -> Result<(), ErrorContext> {
4326 let mut iter = self.clone();
4327 iter.pos = 0;
4328 for attr in iter {
4329 if let Nl80211Attrs::MeasurementDurationMandatory(val) = attr? {
4330 return Ok(val);
4331 }
4332 }
4333 Err(ErrorContext::new_missing(
4334 "Nl80211Attrs",
4335 "MeasurementDurationMandatory",
4336 self.orig_loc,
4337 self.buf.as_ptr() as usize,
4338 ))
4339 }
4340 pub fn get_mesh_peer_aid(&self) -> Result<u16, ErrorContext> {
4341 let mut iter = self.clone();
4342 iter.pos = 0;
4343 for attr in iter {
4344 if let Nl80211Attrs::MeshPeerAid(val) = attr? {
4345 return Ok(val);
4346 }
4347 }
4348 Err(ErrorContext::new_missing(
4349 "Nl80211Attrs",
4350 "MeshPeerAid",
4351 self.orig_loc,
4352 self.buf.as_ptr() as usize,
4353 ))
4354 }
4355 pub fn get_nan_master_pref(&self) -> Result<u8, ErrorContext> {
4356 let mut iter = self.clone();
4357 iter.pos = 0;
4358 for attr in iter {
4359 if let Nl80211Attrs::NanMasterPref(val) = attr? {
4360 return Ok(val);
4361 }
4362 }
4363 Err(ErrorContext::new_missing(
4364 "Nl80211Attrs",
4365 "NanMasterPref",
4366 self.orig_loc,
4367 self.buf.as_ptr() as usize,
4368 ))
4369 }
4370 pub fn get_bands(&self) -> Result<u32, ErrorContext> {
4371 let mut iter = self.clone();
4372 iter.pos = 0;
4373 for attr in iter {
4374 if let Nl80211Attrs::Bands(val) = attr? {
4375 return Ok(val);
4376 }
4377 }
4378 Err(ErrorContext::new_missing(
4379 "Nl80211Attrs",
4380 "Bands",
4381 self.orig_loc,
4382 self.buf.as_ptr() as usize,
4383 ))
4384 }
4385 pub fn get_nan_func(&self) -> Result<&'a [u8], ErrorContext> {
4386 let mut iter = self.clone();
4387 iter.pos = 0;
4388 for attr in iter {
4389 if let Nl80211Attrs::NanFunc(val) = attr? {
4390 return Ok(val);
4391 }
4392 }
4393 Err(ErrorContext::new_missing(
4394 "Nl80211Attrs",
4395 "NanFunc",
4396 self.orig_loc,
4397 self.buf.as_ptr() as usize,
4398 ))
4399 }
4400 pub fn get_nan_match(&self) -> Result<&'a [u8], ErrorContext> {
4401 let mut iter = self.clone();
4402 iter.pos = 0;
4403 for attr in iter {
4404 if let Nl80211Attrs::NanMatch(val) = attr? {
4405 return Ok(val);
4406 }
4407 }
4408 Err(ErrorContext::new_missing(
4409 "Nl80211Attrs",
4410 "NanMatch",
4411 self.orig_loc,
4412 self.buf.as_ptr() as usize,
4413 ))
4414 }
4415 pub fn get_fils_kek(&self) -> Result<&'a [u8], ErrorContext> {
4416 let mut iter = self.clone();
4417 iter.pos = 0;
4418 for attr in iter {
4419 if let Nl80211Attrs::FilsKek(val) = attr? {
4420 return Ok(val);
4421 }
4422 }
4423 Err(ErrorContext::new_missing(
4424 "Nl80211Attrs",
4425 "FilsKek",
4426 self.orig_loc,
4427 self.buf.as_ptr() as usize,
4428 ))
4429 }
4430 pub fn get_fils_nonces(&self) -> Result<&'a [u8], ErrorContext> {
4431 let mut iter = self.clone();
4432 iter.pos = 0;
4433 for attr in iter {
4434 if let Nl80211Attrs::FilsNonces(val) = attr? {
4435 return Ok(val);
4436 }
4437 }
4438 Err(ErrorContext::new_missing(
4439 "Nl80211Attrs",
4440 "FilsNonces",
4441 self.orig_loc,
4442 self.buf.as_ptr() as usize,
4443 ))
4444 }
4445 pub fn get_multicast_to_unicast_enabled(&self) -> Result<(), ErrorContext> {
4446 let mut iter = self.clone();
4447 iter.pos = 0;
4448 for attr in iter {
4449 if let Nl80211Attrs::MulticastToUnicastEnabled(val) = attr? {
4450 return Ok(val);
4451 }
4452 }
4453 Err(ErrorContext::new_missing(
4454 "Nl80211Attrs",
4455 "MulticastToUnicastEnabled",
4456 self.orig_loc,
4457 self.buf.as_ptr() as usize,
4458 ))
4459 }
4460 pub fn get_bssid(&self) -> Result<&'a [u8], ErrorContext> {
4461 let mut iter = self.clone();
4462 iter.pos = 0;
4463 for attr in iter {
4464 if let Nl80211Attrs::Bssid(val) = attr? {
4465 return Ok(val);
4466 }
4467 }
4468 Err(ErrorContext::new_missing(
4469 "Nl80211Attrs",
4470 "Bssid",
4471 self.orig_loc,
4472 self.buf.as_ptr() as usize,
4473 ))
4474 }
4475 pub fn get_sched_scan_relative_rssi(&self) -> Result<i8, ErrorContext> {
4476 let mut iter = self.clone();
4477 iter.pos = 0;
4478 for attr in iter {
4479 if let Nl80211Attrs::SchedScanRelativeRssi(val) = attr? {
4480 return Ok(val);
4481 }
4482 }
4483 Err(ErrorContext::new_missing(
4484 "Nl80211Attrs",
4485 "SchedScanRelativeRssi",
4486 self.orig_loc,
4487 self.buf.as_ptr() as usize,
4488 ))
4489 }
4490 pub fn get_sched_scan_rssi_adjust(&self) -> Result<&'a [u8], ErrorContext> {
4491 let mut iter = self.clone();
4492 iter.pos = 0;
4493 for attr in iter {
4494 if let Nl80211Attrs::SchedScanRssiAdjust(val) = attr? {
4495 return Ok(val);
4496 }
4497 }
4498 Err(ErrorContext::new_missing(
4499 "Nl80211Attrs",
4500 "SchedScanRssiAdjust",
4501 self.orig_loc,
4502 self.buf.as_ptr() as usize,
4503 ))
4504 }
4505 pub fn get_timeout_reason(&self) -> Result<u32, ErrorContext> {
4506 let mut iter = self.clone();
4507 iter.pos = 0;
4508 for attr in iter {
4509 if let Nl80211Attrs::TimeoutReason(val) = attr? {
4510 return Ok(val);
4511 }
4512 }
4513 Err(ErrorContext::new_missing(
4514 "Nl80211Attrs",
4515 "TimeoutReason",
4516 self.orig_loc,
4517 self.buf.as_ptr() as usize,
4518 ))
4519 }
4520 pub fn get_fils_erp_username(&self) -> Result<&'a [u8], ErrorContext> {
4521 let mut iter = self.clone();
4522 iter.pos = 0;
4523 for attr in iter {
4524 if let Nl80211Attrs::FilsErpUsername(val) = attr? {
4525 return Ok(val);
4526 }
4527 }
4528 Err(ErrorContext::new_missing(
4529 "Nl80211Attrs",
4530 "FilsErpUsername",
4531 self.orig_loc,
4532 self.buf.as_ptr() as usize,
4533 ))
4534 }
4535 pub fn get_fils_erp_realm(&self) -> Result<&'a [u8], ErrorContext> {
4536 let mut iter = self.clone();
4537 iter.pos = 0;
4538 for attr in iter {
4539 if let Nl80211Attrs::FilsErpRealm(val) = attr? {
4540 return Ok(val);
4541 }
4542 }
4543 Err(ErrorContext::new_missing(
4544 "Nl80211Attrs",
4545 "FilsErpRealm",
4546 self.orig_loc,
4547 self.buf.as_ptr() as usize,
4548 ))
4549 }
4550 pub fn get_fils_erp_next_seq_num(&self) -> Result<u16, ErrorContext> {
4551 let mut iter = self.clone();
4552 iter.pos = 0;
4553 for attr in iter {
4554 if let Nl80211Attrs::FilsErpNextSeqNum(val) = attr? {
4555 return Ok(val);
4556 }
4557 }
4558 Err(ErrorContext::new_missing(
4559 "Nl80211Attrs",
4560 "FilsErpNextSeqNum",
4561 self.orig_loc,
4562 self.buf.as_ptr() as usize,
4563 ))
4564 }
4565 pub fn get_fils_erp_rrk(&self) -> Result<&'a [u8], ErrorContext> {
4566 let mut iter = self.clone();
4567 iter.pos = 0;
4568 for attr in iter {
4569 if let Nl80211Attrs::FilsErpRrk(val) = attr? {
4570 return Ok(val);
4571 }
4572 }
4573 Err(ErrorContext::new_missing(
4574 "Nl80211Attrs",
4575 "FilsErpRrk",
4576 self.orig_loc,
4577 self.buf.as_ptr() as usize,
4578 ))
4579 }
4580 pub fn get_fils_cache_id(&self) -> Result<&'a [u8], ErrorContext> {
4581 let mut iter = self.clone();
4582 iter.pos = 0;
4583 for attr in iter {
4584 if let Nl80211Attrs::FilsCacheId(val) = attr? {
4585 return Ok(val);
4586 }
4587 }
4588 Err(ErrorContext::new_missing(
4589 "Nl80211Attrs",
4590 "FilsCacheId",
4591 self.orig_loc,
4592 self.buf.as_ptr() as usize,
4593 ))
4594 }
4595 pub fn get_pmk(&self) -> Result<&'a [u8], ErrorContext> {
4596 let mut iter = self.clone();
4597 iter.pos = 0;
4598 for attr in iter {
4599 if let Nl80211Attrs::Pmk(val) = attr? {
4600 return Ok(val);
4601 }
4602 }
4603 Err(ErrorContext::new_missing(
4604 "Nl80211Attrs",
4605 "Pmk",
4606 self.orig_loc,
4607 self.buf.as_ptr() as usize,
4608 ))
4609 }
4610 pub fn get_sched_scan_multi(&self) -> Result<(), ErrorContext> {
4611 let mut iter = self.clone();
4612 iter.pos = 0;
4613 for attr in iter {
4614 if let Nl80211Attrs::SchedScanMulti(val) = attr? {
4615 return Ok(val);
4616 }
4617 }
4618 Err(ErrorContext::new_missing(
4619 "Nl80211Attrs",
4620 "SchedScanMulti",
4621 self.orig_loc,
4622 self.buf.as_ptr() as usize,
4623 ))
4624 }
4625 pub fn get_sched_scan_max_reqs(&self) -> Result<u32, ErrorContext> {
4626 let mut iter = self.clone();
4627 iter.pos = 0;
4628 for attr in iter {
4629 if let Nl80211Attrs::SchedScanMaxReqs(val) = attr? {
4630 return Ok(val);
4631 }
4632 }
4633 Err(ErrorContext::new_missing(
4634 "Nl80211Attrs",
4635 "SchedScanMaxReqs",
4636 self.orig_loc,
4637 self.buf.as_ptr() as usize,
4638 ))
4639 }
4640 pub fn get_want_1x_4way_hs(&self) -> Result<(), ErrorContext> {
4641 let mut iter = self.clone();
4642 iter.pos = 0;
4643 for attr in iter {
4644 if let Nl80211Attrs::Want1x4wayHs(val) = attr? {
4645 return Ok(val);
4646 }
4647 }
4648 Err(ErrorContext::new_missing(
4649 "Nl80211Attrs",
4650 "Want1x4wayHs",
4651 self.orig_loc,
4652 self.buf.as_ptr() as usize,
4653 ))
4654 }
4655 pub fn get_pmkr0_name(&self) -> Result<&'a [u8], ErrorContext> {
4656 let mut iter = self.clone();
4657 iter.pos = 0;
4658 for attr in iter {
4659 if let Nl80211Attrs::Pmkr0Name(val) = attr? {
4660 return Ok(val);
4661 }
4662 }
4663 Err(ErrorContext::new_missing(
4664 "Nl80211Attrs",
4665 "Pmkr0Name",
4666 self.orig_loc,
4667 self.buf.as_ptr() as usize,
4668 ))
4669 }
4670 pub fn get_port_authorized(&self) -> Result<&'a [u8], ErrorContext> {
4671 let mut iter = self.clone();
4672 iter.pos = 0;
4673 for attr in iter {
4674 if let Nl80211Attrs::PortAuthorized(val) = attr? {
4675 return Ok(val);
4676 }
4677 }
4678 Err(ErrorContext::new_missing(
4679 "Nl80211Attrs",
4680 "PortAuthorized",
4681 self.orig_loc,
4682 self.buf.as_ptr() as usize,
4683 ))
4684 }
4685 pub fn get_external_auth_action(&self) -> Result<u32, ErrorContext> {
4686 let mut iter = self.clone();
4687 iter.pos = 0;
4688 for attr in iter {
4689 if let Nl80211Attrs::ExternalAuthAction(val) = attr? {
4690 return Ok(val);
4691 }
4692 }
4693 Err(ErrorContext::new_missing(
4694 "Nl80211Attrs",
4695 "ExternalAuthAction",
4696 self.orig_loc,
4697 self.buf.as_ptr() as usize,
4698 ))
4699 }
4700 pub fn get_external_auth_support(&self) -> Result<(), ErrorContext> {
4701 let mut iter = self.clone();
4702 iter.pos = 0;
4703 for attr in iter {
4704 if let Nl80211Attrs::ExternalAuthSupport(val) = attr? {
4705 return Ok(val);
4706 }
4707 }
4708 Err(ErrorContext::new_missing(
4709 "Nl80211Attrs",
4710 "ExternalAuthSupport",
4711 self.orig_loc,
4712 self.buf.as_ptr() as usize,
4713 ))
4714 }
4715 pub fn get_nss(&self) -> Result<u8, ErrorContext> {
4716 let mut iter = self.clone();
4717 iter.pos = 0;
4718 for attr in iter {
4719 if let Nl80211Attrs::Nss(val) = attr? {
4720 return Ok(val);
4721 }
4722 }
4723 Err(ErrorContext::new_missing(
4724 "Nl80211Attrs",
4725 "Nss",
4726 self.orig_loc,
4727 self.buf.as_ptr() as usize,
4728 ))
4729 }
4730 pub fn get_ack_signal(&self) -> Result<i32, ErrorContext> {
4731 let mut iter = self.clone();
4732 iter.pos = 0;
4733 for attr in iter {
4734 if let Nl80211Attrs::AckSignal(val) = attr? {
4735 return Ok(val);
4736 }
4737 }
4738 Err(ErrorContext::new_missing(
4739 "Nl80211Attrs",
4740 "AckSignal",
4741 self.orig_loc,
4742 self.buf.as_ptr() as usize,
4743 ))
4744 }
4745 pub fn get_control_port_over_nl80211(&self) -> Result<(), ErrorContext> {
4746 let mut iter = self.clone();
4747 iter.pos = 0;
4748 for attr in iter {
4749 if let Nl80211Attrs::ControlPortOverNl80211(val) = attr? {
4750 return Ok(val);
4751 }
4752 }
4753 Err(ErrorContext::new_missing(
4754 "Nl80211Attrs",
4755 "ControlPortOverNl80211",
4756 self.orig_loc,
4757 self.buf.as_ptr() as usize,
4758 ))
4759 }
4760 pub fn get_txq_stats(&self) -> Result<IterableTxqStatsAttrs<'a>, ErrorContext> {
4761 let mut iter = self.clone();
4762 iter.pos = 0;
4763 for attr in iter {
4764 if let Nl80211Attrs::TxqStats(val) = attr? {
4765 return Ok(val);
4766 }
4767 }
4768 Err(ErrorContext::new_missing(
4769 "Nl80211Attrs",
4770 "TxqStats",
4771 self.orig_loc,
4772 self.buf.as_ptr() as usize,
4773 ))
4774 }
4775 pub fn get_txq_limit(&self) -> Result<u32, ErrorContext> {
4776 let mut iter = self.clone();
4777 iter.pos = 0;
4778 for attr in iter {
4779 if let Nl80211Attrs::TxqLimit(val) = attr? {
4780 return Ok(val);
4781 }
4782 }
4783 Err(ErrorContext::new_missing(
4784 "Nl80211Attrs",
4785 "TxqLimit",
4786 self.orig_loc,
4787 self.buf.as_ptr() as usize,
4788 ))
4789 }
4790 pub fn get_txq_memory_limit(&self) -> Result<u32, ErrorContext> {
4791 let mut iter = self.clone();
4792 iter.pos = 0;
4793 for attr in iter {
4794 if let Nl80211Attrs::TxqMemoryLimit(val) = attr? {
4795 return Ok(val);
4796 }
4797 }
4798 Err(ErrorContext::new_missing(
4799 "Nl80211Attrs",
4800 "TxqMemoryLimit",
4801 self.orig_loc,
4802 self.buf.as_ptr() as usize,
4803 ))
4804 }
4805 pub fn get_txq_quantum(&self) -> Result<u32, ErrorContext> {
4806 let mut iter = self.clone();
4807 iter.pos = 0;
4808 for attr in iter {
4809 if let Nl80211Attrs::TxqQuantum(val) = attr? {
4810 return Ok(val);
4811 }
4812 }
4813 Err(ErrorContext::new_missing(
4814 "Nl80211Attrs",
4815 "TxqQuantum",
4816 self.orig_loc,
4817 self.buf.as_ptr() as usize,
4818 ))
4819 }
4820 pub fn get_he_capability(&self) -> Result<&'a [u8], ErrorContext> {
4821 let mut iter = self.clone();
4822 iter.pos = 0;
4823 for attr in iter {
4824 if let Nl80211Attrs::HeCapability(val) = attr? {
4825 return Ok(val);
4826 }
4827 }
4828 Err(ErrorContext::new_missing(
4829 "Nl80211Attrs",
4830 "HeCapability",
4831 self.orig_loc,
4832 self.buf.as_ptr() as usize,
4833 ))
4834 }
4835 pub fn get_ftm_responder(&self) -> Result<&'a [u8], ErrorContext> {
4836 let mut iter = self.clone();
4837 iter.pos = 0;
4838 for attr in iter {
4839 if let Nl80211Attrs::FtmResponder(val) = attr? {
4840 return Ok(val);
4841 }
4842 }
4843 Err(ErrorContext::new_missing(
4844 "Nl80211Attrs",
4845 "FtmResponder",
4846 self.orig_loc,
4847 self.buf.as_ptr() as usize,
4848 ))
4849 }
4850 pub fn get_ftm_responder_stats(&self) -> Result<&'a [u8], ErrorContext> {
4851 let mut iter = self.clone();
4852 iter.pos = 0;
4853 for attr in iter {
4854 if let Nl80211Attrs::FtmResponderStats(val) = attr? {
4855 return Ok(val);
4856 }
4857 }
4858 Err(ErrorContext::new_missing(
4859 "Nl80211Attrs",
4860 "FtmResponderStats",
4861 self.orig_loc,
4862 self.buf.as_ptr() as usize,
4863 ))
4864 }
4865 pub fn get_timeout(&self) -> Result<u32, ErrorContext> {
4866 let mut iter = self.clone();
4867 iter.pos = 0;
4868 for attr in iter {
4869 if let Nl80211Attrs::Timeout(val) = attr? {
4870 return Ok(val);
4871 }
4872 }
4873 Err(ErrorContext::new_missing(
4874 "Nl80211Attrs",
4875 "Timeout",
4876 self.orig_loc,
4877 self.buf.as_ptr() as usize,
4878 ))
4879 }
4880 pub fn get_peer_measurements(&self) -> Result<&'a [u8], ErrorContext> {
4881 let mut iter = self.clone();
4882 iter.pos = 0;
4883 for attr in iter {
4884 if let Nl80211Attrs::PeerMeasurements(val) = attr? {
4885 return Ok(val);
4886 }
4887 }
4888 Err(ErrorContext::new_missing(
4889 "Nl80211Attrs",
4890 "PeerMeasurements",
4891 self.orig_loc,
4892 self.buf.as_ptr() as usize,
4893 ))
4894 }
4895 pub fn get_airtime_weight(&self) -> Result<u16, ErrorContext> {
4896 let mut iter = self.clone();
4897 iter.pos = 0;
4898 for attr in iter {
4899 if let Nl80211Attrs::AirtimeWeight(val) = attr? {
4900 return Ok(val);
4901 }
4902 }
4903 Err(ErrorContext::new_missing(
4904 "Nl80211Attrs",
4905 "AirtimeWeight",
4906 self.orig_loc,
4907 self.buf.as_ptr() as usize,
4908 ))
4909 }
4910 pub fn get_sta_tx_power_setting(&self) -> Result<u8, ErrorContext> {
4911 let mut iter = self.clone();
4912 iter.pos = 0;
4913 for attr in iter {
4914 if let Nl80211Attrs::StaTxPowerSetting(val) = attr? {
4915 return Ok(val);
4916 }
4917 }
4918 Err(ErrorContext::new_missing(
4919 "Nl80211Attrs",
4920 "StaTxPowerSetting",
4921 self.orig_loc,
4922 self.buf.as_ptr() as usize,
4923 ))
4924 }
4925 pub fn get_sta_tx_power(&self) -> Result<i16, ErrorContext> {
4926 let mut iter = self.clone();
4927 iter.pos = 0;
4928 for attr in iter {
4929 if let Nl80211Attrs::StaTxPower(val) = attr? {
4930 return Ok(val);
4931 }
4932 }
4933 Err(ErrorContext::new_missing(
4934 "Nl80211Attrs",
4935 "StaTxPower",
4936 self.orig_loc,
4937 self.buf.as_ptr() as usize,
4938 ))
4939 }
4940 pub fn get_sae_password(&self) -> Result<&'a [u8], ErrorContext> {
4941 let mut iter = self.clone();
4942 iter.pos = 0;
4943 for attr in iter {
4944 if let Nl80211Attrs::SaePassword(val) = attr? {
4945 return Ok(val);
4946 }
4947 }
4948 Err(ErrorContext::new_missing(
4949 "Nl80211Attrs",
4950 "SaePassword",
4951 self.orig_loc,
4952 self.buf.as_ptr() as usize,
4953 ))
4954 }
4955 pub fn get_twt_responder(&self) -> Result<(), ErrorContext> {
4956 let mut iter = self.clone();
4957 iter.pos = 0;
4958 for attr in iter {
4959 if let Nl80211Attrs::TwtResponder(val) = attr? {
4960 return Ok(val);
4961 }
4962 }
4963 Err(ErrorContext::new_missing(
4964 "Nl80211Attrs",
4965 "TwtResponder",
4966 self.orig_loc,
4967 self.buf.as_ptr() as usize,
4968 ))
4969 }
4970 pub fn get_he_obss_pd(&self) -> Result<&'a [u8], ErrorContext> {
4971 let mut iter = self.clone();
4972 iter.pos = 0;
4973 for attr in iter {
4974 if let Nl80211Attrs::HeObssPd(val) = attr? {
4975 return Ok(val);
4976 }
4977 }
4978 Err(ErrorContext::new_missing(
4979 "Nl80211Attrs",
4980 "HeObssPd",
4981 self.orig_loc,
4982 self.buf.as_ptr() as usize,
4983 ))
4984 }
4985 pub fn get_wiphy_edmg_channels(&self) -> Result<u8, ErrorContext> {
4986 let mut iter = self.clone();
4987 iter.pos = 0;
4988 for attr in iter {
4989 if let Nl80211Attrs::WiphyEdmgChannels(val) = attr? {
4990 return Ok(val);
4991 }
4992 }
4993 Err(ErrorContext::new_missing(
4994 "Nl80211Attrs",
4995 "WiphyEdmgChannels",
4996 self.orig_loc,
4997 self.buf.as_ptr() as usize,
4998 ))
4999 }
5000 pub fn get_wiphy_edmg_bw_config(&self) -> Result<u8, ErrorContext> {
5001 let mut iter = self.clone();
5002 iter.pos = 0;
5003 for attr in iter {
5004 if let Nl80211Attrs::WiphyEdmgBwConfig(val) = attr? {
5005 return Ok(val);
5006 }
5007 }
5008 Err(ErrorContext::new_missing(
5009 "Nl80211Attrs",
5010 "WiphyEdmgBwConfig",
5011 self.orig_loc,
5012 self.buf.as_ptr() as usize,
5013 ))
5014 }
5015 pub fn get_vlan_id(&self) -> Result<u16, ErrorContext> {
5016 let mut iter = self.clone();
5017 iter.pos = 0;
5018 for attr in iter {
5019 if let Nl80211Attrs::VlanId(val) = attr? {
5020 return Ok(val);
5021 }
5022 }
5023 Err(ErrorContext::new_missing(
5024 "Nl80211Attrs",
5025 "VlanId",
5026 self.orig_loc,
5027 self.buf.as_ptr() as usize,
5028 ))
5029 }
5030 pub fn get_he_bss_color(&self) -> Result<&'a [u8], ErrorContext> {
5031 let mut iter = self.clone();
5032 iter.pos = 0;
5033 for attr in iter {
5034 if let Nl80211Attrs::HeBssColor(val) = attr? {
5035 return Ok(val);
5036 }
5037 }
5038 Err(ErrorContext::new_missing(
5039 "Nl80211Attrs",
5040 "HeBssColor",
5041 self.orig_loc,
5042 self.buf.as_ptr() as usize,
5043 ))
5044 }
5045 pub fn get_iftype_akm_suites(&self) -> Result<&'a [u8], ErrorContext> {
5046 let mut iter = self.clone();
5047 iter.pos = 0;
5048 for attr in iter {
5049 if let Nl80211Attrs::IftypeAkmSuites(val) = attr? {
5050 return Ok(val);
5051 }
5052 }
5053 Err(ErrorContext::new_missing(
5054 "Nl80211Attrs",
5055 "IftypeAkmSuites",
5056 self.orig_loc,
5057 self.buf.as_ptr() as usize,
5058 ))
5059 }
5060 pub fn get_tid_config(&self) -> Result<&'a [u8], ErrorContext> {
5061 let mut iter = self.clone();
5062 iter.pos = 0;
5063 for attr in iter {
5064 if let Nl80211Attrs::TidConfig(val) = attr? {
5065 return Ok(val);
5066 }
5067 }
5068 Err(ErrorContext::new_missing(
5069 "Nl80211Attrs",
5070 "TidConfig",
5071 self.orig_loc,
5072 self.buf.as_ptr() as usize,
5073 ))
5074 }
5075 pub fn get_control_port_no_preauth(&self) -> Result<(), ErrorContext> {
5076 let mut iter = self.clone();
5077 iter.pos = 0;
5078 for attr in iter {
5079 if let Nl80211Attrs::ControlPortNoPreauth(val) = attr? {
5080 return Ok(val);
5081 }
5082 }
5083 Err(ErrorContext::new_missing(
5084 "Nl80211Attrs",
5085 "ControlPortNoPreauth",
5086 self.orig_loc,
5087 self.buf.as_ptr() as usize,
5088 ))
5089 }
5090 pub fn get_pmk_lifetime(&self) -> Result<u32, ErrorContext> {
5091 let mut iter = self.clone();
5092 iter.pos = 0;
5093 for attr in iter {
5094 if let Nl80211Attrs::PmkLifetime(val) = attr? {
5095 return Ok(val);
5096 }
5097 }
5098 Err(ErrorContext::new_missing(
5099 "Nl80211Attrs",
5100 "PmkLifetime",
5101 self.orig_loc,
5102 self.buf.as_ptr() as usize,
5103 ))
5104 }
5105 pub fn get_pmk_reauth_threshold(&self) -> Result<u8, ErrorContext> {
5106 let mut iter = self.clone();
5107 iter.pos = 0;
5108 for attr in iter {
5109 if let Nl80211Attrs::PmkReauthThreshold(val) = attr? {
5110 return Ok(val);
5111 }
5112 }
5113 Err(ErrorContext::new_missing(
5114 "Nl80211Attrs",
5115 "PmkReauthThreshold",
5116 self.orig_loc,
5117 self.buf.as_ptr() as usize,
5118 ))
5119 }
5120 pub fn get_receive_multicast(&self) -> Result<(), ErrorContext> {
5121 let mut iter = self.clone();
5122 iter.pos = 0;
5123 for attr in iter {
5124 if let Nl80211Attrs::ReceiveMulticast(val) = attr? {
5125 return Ok(val);
5126 }
5127 }
5128 Err(ErrorContext::new_missing(
5129 "Nl80211Attrs",
5130 "ReceiveMulticast",
5131 self.orig_loc,
5132 self.buf.as_ptr() as usize,
5133 ))
5134 }
5135 pub fn get_wiphy_freq_offset(&self) -> Result<u32, ErrorContext> {
5136 let mut iter = self.clone();
5137 iter.pos = 0;
5138 for attr in iter {
5139 if let Nl80211Attrs::WiphyFreqOffset(val) = attr? {
5140 return Ok(val);
5141 }
5142 }
5143 Err(ErrorContext::new_missing(
5144 "Nl80211Attrs",
5145 "WiphyFreqOffset",
5146 self.orig_loc,
5147 self.buf.as_ptr() as usize,
5148 ))
5149 }
5150 pub fn get_center_freq1_offset(&self) -> Result<u32, ErrorContext> {
5151 let mut iter = self.clone();
5152 iter.pos = 0;
5153 for attr in iter {
5154 if let Nl80211Attrs::CenterFreq1Offset(val) = attr? {
5155 return Ok(val);
5156 }
5157 }
5158 Err(ErrorContext::new_missing(
5159 "Nl80211Attrs",
5160 "CenterFreq1Offset",
5161 self.orig_loc,
5162 self.buf.as_ptr() as usize,
5163 ))
5164 }
5165 pub fn get_scan_freq_khz(&self) -> Result<&'a [u8], ErrorContext> {
5166 let mut iter = self.clone();
5167 iter.pos = 0;
5168 for attr in iter {
5169 if let Nl80211Attrs::ScanFreqKhz(val) = attr? {
5170 return Ok(val);
5171 }
5172 }
5173 Err(ErrorContext::new_missing(
5174 "Nl80211Attrs",
5175 "ScanFreqKhz",
5176 self.orig_loc,
5177 self.buf.as_ptr() as usize,
5178 ))
5179 }
5180 pub fn get_he_6ghz_capability(&self) -> Result<&'a [u8], ErrorContext> {
5181 let mut iter = self.clone();
5182 iter.pos = 0;
5183 for attr in iter {
5184 if let Nl80211Attrs::He6ghzCapability(val) = attr? {
5185 return Ok(val);
5186 }
5187 }
5188 Err(ErrorContext::new_missing(
5189 "Nl80211Attrs",
5190 "He6ghzCapability",
5191 self.orig_loc,
5192 self.buf.as_ptr() as usize,
5193 ))
5194 }
5195 pub fn get_fils_discovery(&self) -> Result<&'a [u8], ErrorContext> {
5196 let mut iter = self.clone();
5197 iter.pos = 0;
5198 for attr in iter {
5199 if let Nl80211Attrs::FilsDiscovery(val) = attr? {
5200 return Ok(val);
5201 }
5202 }
5203 Err(ErrorContext::new_missing(
5204 "Nl80211Attrs",
5205 "FilsDiscovery",
5206 self.orig_loc,
5207 self.buf.as_ptr() as usize,
5208 ))
5209 }
5210 pub fn get_unsol_bcast_probe_resp(&self) -> Result<&'a [u8], ErrorContext> {
5211 let mut iter = self.clone();
5212 iter.pos = 0;
5213 for attr in iter {
5214 if let Nl80211Attrs::UnsolBcastProbeResp(val) = attr? {
5215 return Ok(val);
5216 }
5217 }
5218 Err(ErrorContext::new_missing(
5219 "Nl80211Attrs",
5220 "UnsolBcastProbeResp",
5221 self.orig_loc,
5222 self.buf.as_ptr() as usize,
5223 ))
5224 }
5225 pub fn get_s1g_capability(&self) -> Result<&'a [u8], ErrorContext> {
5226 let mut iter = self.clone();
5227 iter.pos = 0;
5228 for attr in iter {
5229 if let Nl80211Attrs::S1gCapability(val) = attr? {
5230 return Ok(val);
5231 }
5232 }
5233 Err(ErrorContext::new_missing(
5234 "Nl80211Attrs",
5235 "S1gCapability",
5236 self.orig_loc,
5237 self.buf.as_ptr() as usize,
5238 ))
5239 }
5240 pub fn get_s1g_capability_mask(&self) -> Result<&'a [u8], ErrorContext> {
5241 let mut iter = self.clone();
5242 iter.pos = 0;
5243 for attr in iter {
5244 if let Nl80211Attrs::S1gCapabilityMask(val) = attr? {
5245 return Ok(val);
5246 }
5247 }
5248 Err(ErrorContext::new_missing(
5249 "Nl80211Attrs",
5250 "S1gCapabilityMask",
5251 self.orig_loc,
5252 self.buf.as_ptr() as usize,
5253 ))
5254 }
5255 pub fn get_sae_pwe(&self) -> Result<u8, ErrorContext> {
5256 let mut iter = self.clone();
5257 iter.pos = 0;
5258 for attr in iter {
5259 if let Nl80211Attrs::SaePwe(val) = attr? {
5260 return Ok(val);
5261 }
5262 }
5263 Err(ErrorContext::new_missing(
5264 "Nl80211Attrs",
5265 "SaePwe",
5266 self.orig_loc,
5267 self.buf.as_ptr() as usize,
5268 ))
5269 }
5270 pub fn get_reconnect_requested(&self) -> Result<&'a [u8], ErrorContext> {
5271 let mut iter = self.clone();
5272 iter.pos = 0;
5273 for attr in iter {
5274 if let Nl80211Attrs::ReconnectRequested(val) = attr? {
5275 return Ok(val);
5276 }
5277 }
5278 Err(ErrorContext::new_missing(
5279 "Nl80211Attrs",
5280 "ReconnectRequested",
5281 self.orig_loc,
5282 self.buf.as_ptr() as usize,
5283 ))
5284 }
5285 pub fn get_sar_spec(&self) -> Result<IterableSarAttributes<'a>, ErrorContext> {
5286 let mut iter = self.clone();
5287 iter.pos = 0;
5288 for attr in iter {
5289 if let Nl80211Attrs::SarSpec(val) = attr? {
5290 return Ok(val);
5291 }
5292 }
5293 Err(ErrorContext::new_missing(
5294 "Nl80211Attrs",
5295 "SarSpec",
5296 self.orig_loc,
5297 self.buf.as_ptr() as usize,
5298 ))
5299 }
5300 pub fn get_disable_he(&self) -> Result<(), ErrorContext> {
5301 let mut iter = self.clone();
5302 iter.pos = 0;
5303 for attr in iter {
5304 if let Nl80211Attrs::DisableHe(val) = attr? {
5305 return Ok(val);
5306 }
5307 }
5308 Err(ErrorContext::new_missing(
5309 "Nl80211Attrs",
5310 "DisableHe",
5311 self.orig_loc,
5312 self.buf.as_ptr() as usize,
5313 ))
5314 }
5315 pub fn get_obss_color_bitmap(&self) -> Result<u64, ErrorContext> {
5316 let mut iter = self.clone();
5317 iter.pos = 0;
5318 for attr in iter {
5319 if let Nl80211Attrs::ObssColorBitmap(val) = attr? {
5320 return Ok(val);
5321 }
5322 }
5323 Err(ErrorContext::new_missing(
5324 "Nl80211Attrs",
5325 "ObssColorBitmap",
5326 self.orig_loc,
5327 self.buf.as_ptr() as usize,
5328 ))
5329 }
5330 pub fn get_color_change_count(&self) -> Result<u8, ErrorContext> {
5331 let mut iter = self.clone();
5332 iter.pos = 0;
5333 for attr in iter {
5334 if let Nl80211Attrs::ColorChangeCount(val) = attr? {
5335 return Ok(val);
5336 }
5337 }
5338 Err(ErrorContext::new_missing(
5339 "Nl80211Attrs",
5340 "ColorChangeCount",
5341 self.orig_loc,
5342 self.buf.as_ptr() as usize,
5343 ))
5344 }
5345 pub fn get_color_change_color(&self) -> Result<u8, ErrorContext> {
5346 let mut iter = self.clone();
5347 iter.pos = 0;
5348 for attr in iter {
5349 if let Nl80211Attrs::ColorChangeColor(val) = attr? {
5350 return Ok(val);
5351 }
5352 }
5353 Err(ErrorContext::new_missing(
5354 "Nl80211Attrs",
5355 "ColorChangeColor",
5356 self.orig_loc,
5357 self.buf.as_ptr() as usize,
5358 ))
5359 }
5360 pub fn get_color_change_elems(&self) -> Result<&'a [u8], ErrorContext> {
5361 let mut iter = self.clone();
5362 iter.pos = 0;
5363 for attr in iter {
5364 if let Nl80211Attrs::ColorChangeElems(val) = attr? {
5365 return Ok(val);
5366 }
5367 }
5368 Err(ErrorContext::new_missing(
5369 "Nl80211Attrs",
5370 "ColorChangeElems",
5371 self.orig_loc,
5372 self.buf.as_ptr() as usize,
5373 ))
5374 }
5375 pub fn get_mbssid_config(&self) -> Result<&'a [u8], ErrorContext> {
5376 let mut iter = self.clone();
5377 iter.pos = 0;
5378 for attr in iter {
5379 if let Nl80211Attrs::MbssidConfig(val) = attr? {
5380 return Ok(val);
5381 }
5382 }
5383 Err(ErrorContext::new_missing(
5384 "Nl80211Attrs",
5385 "MbssidConfig",
5386 self.orig_loc,
5387 self.buf.as_ptr() as usize,
5388 ))
5389 }
5390 pub fn get_mbssid_elems(&self) -> Result<&'a [u8], ErrorContext> {
5391 let mut iter = self.clone();
5392 iter.pos = 0;
5393 for attr in iter {
5394 if let Nl80211Attrs::MbssidElems(val) = attr? {
5395 return Ok(val);
5396 }
5397 }
5398 Err(ErrorContext::new_missing(
5399 "Nl80211Attrs",
5400 "MbssidElems",
5401 self.orig_loc,
5402 self.buf.as_ptr() as usize,
5403 ))
5404 }
5405 pub fn get_radar_background(&self) -> Result<(), ErrorContext> {
5406 let mut iter = self.clone();
5407 iter.pos = 0;
5408 for attr in iter {
5409 if let Nl80211Attrs::RadarBackground(val) = attr? {
5410 return Ok(val);
5411 }
5412 }
5413 Err(ErrorContext::new_missing(
5414 "Nl80211Attrs",
5415 "RadarBackground",
5416 self.orig_loc,
5417 self.buf.as_ptr() as usize,
5418 ))
5419 }
5420 pub fn get_ap_settings_flags(&self) -> Result<u32, ErrorContext> {
5421 let mut iter = self.clone();
5422 iter.pos = 0;
5423 for attr in iter {
5424 if let Nl80211Attrs::ApSettingsFlags(val) = attr? {
5425 return Ok(val);
5426 }
5427 }
5428 Err(ErrorContext::new_missing(
5429 "Nl80211Attrs",
5430 "ApSettingsFlags",
5431 self.orig_loc,
5432 self.buf.as_ptr() as usize,
5433 ))
5434 }
5435 pub fn get_eht_capability(&self) -> Result<&'a [u8], ErrorContext> {
5436 let mut iter = self.clone();
5437 iter.pos = 0;
5438 for attr in iter {
5439 if let Nl80211Attrs::EhtCapability(val) = attr? {
5440 return Ok(val);
5441 }
5442 }
5443 Err(ErrorContext::new_missing(
5444 "Nl80211Attrs",
5445 "EhtCapability",
5446 self.orig_loc,
5447 self.buf.as_ptr() as usize,
5448 ))
5449 }
5450 pub fn get_disable_eht(&self) -> Result<(), ErrorContext> {
5451 let mut iter = self.clone();
5452 iter.pos = 0;
5453 for attr in iter {
5454 if let Nl80211Attrs::DisableEht(val) = attr? {
5455 return Ok(val);
5456 }
5457 }
5458 Err(ErrorContext::new_missing(
5459 "Nl80211Attrs",
5460 "DisableEht",
5461 self.orig_loc,
5462 self.buf.as_ptr() as usize,
5463 ))
5464 }
5465 pub fn get_mlo_links(&self) -> Result<&'a [u8], ErrorContext> {
5466 let mut iter = self.clone();
5467 iter.pos = 0;
5468 for attr in iter {
5469 if let Nl80211Attrs::MloLinks(val) = attr? {
5470 return Ok(val);
5471 }
5472 }
5473 Err(ErrorContext::new_missing(
5474 "Nl80211Attrs",
5475 "MloLinks",
5476 self.orig_loc,
5477 self.buf.as_ptr() as usize,
5478 ))
5479 }
5480 pub fn get_mlo_link_id(&self) -> Result<u8, ErrorContext> {
5481 let mut iter = self.clone();
5482 iter.pos = 0;
5483 for attr in iter {
5484 if let Nl80211Attrs::MloLinkId(val) = attr? {
5485 return Ok(val);
5486 }
5487 }
5488 Err(ErrorContext::new_missing(
5489 "Nl80211Attrs",
5490 "MloLinkId",
5491 self.orig_loc,
5492 self.buf.as_ptr() as usize,
5493 ))
5494 }
5495 pub fn get_mld_addr(&self) -> Result<&'a [u8], ErrorContext> {
5496 let mut iter = self.clone();
5497 iter.pos = 0;
5498 for attr in iter {
5499 if let Nl80211Attrs::MldAddr(val) = attr? {
5500 return Ok(val);
5501 }
5502 }
5503 Err(ErrorContext::new_missing(
5504 "Nl80211Attrs",
5505 "MldAddr",
5506 self.orig_loc,
5507 self.buf.as_ptr() as usize,
5508 ))
5509 }
5510 pub fn get_mlo_support(&self) -> Result<(), ErrorContext> {
5511 let mut iter = self.clone();
5512 iter.pos = 0;
5513 for attr in iter {
5514 if let Nl80211Attrs::MloSupport(val) = attr? {
5515 return Ok(val);
5516 }
5517 }
5518 Err(ErrorContext::new_missing(
5519 "Nl80211Attrs",
5520 "MloSupport",
5521 self.orig_loc,
5522 self.buf.as_ptr() as usize,
5523 ))
5524 }
5525 pub fn get_max_num_akm_suites(&self) -> Result<&'a [u8], ErrorContext> {
5526 let mut iter = self.clone();
5527 iter.pos = 0;
5528 for attr in iter {
5529 if let Nl80211Attrs::MaxNumAkmSuites(val) = attr? {
5530 return Ok(val);
5531 }
5532 }
5533 Err(ErrorContext::new_missing(
5534 "Nl80211Attrs",
5535 "MaxNumAkmSuites",
5536 self.orig_loc,
5537 self.buf.as_ptr() as usize,
5538 ))
5539 }
5540 pub fn get_eml_capability(&self) -> Result<u16, ErrorContext> {
5541 let mut iter = self.clone();
5542 iter.pos = 0;
5543 for attr in iter {
5544 if let Nl80211Attrs::EmlCapability(val) = attr? {
5545 return Ok(val);
5546 }
5547 }
5548 Err(ErrorContext::new_missing(
5549 "Nl80211Attrs",
5550 "EmlCapability",
5551 self.orig_loc,
5552 self.buf.as_ptr() as usize,
5553 ))
5554 }
5555 pub fn get_mld_capa_and_ops(&self) -> Result<u16, ErrorContext> {
5556 let mut iter = self.clone();
5557 iter.pos = 0;
5558 for attr in iter {
5559 if let Nl80211Attrs::MldCapaAndOps(val) = attr? {
5560 return Ok(val);
5561 }
5562 }
5563 Err(ErrorContext::new_missing(
5564 "Nl80211Attrs",
5565 "MldCapaAndOps",
5566 self.orig_loc,
5567 self.buf.as_ptr() as usize,
5568 ))
5569 }
5570 pub fn get_tx_hw_timestamp(&self) -> Result<u64, ErrorContext> {
5571 let mut iter = self.clone();
5572 iter.pos = 0;
5573 for attr in iter {
5574 if let Nl80211Attrs::TxHwTimestamp(val) = attr? {
5575 return Ok(val);
5576 }
5577 }
5578 Err(ErrorContext::new_missing(
5579 "Nl80211Attrs",
5580 "TxHwTimestamp",
5581 self.orig_loc,
5582 self.buf.as_ptr() as usize,
5583 ))
5584 }
5585 pub fn get_rx_hw_timestamp(&self) -> Result<u64, ErrorContext> {
5586 let mut iter = self.clone();
5587 iter.pos = 0;
5588 for attr in iter {
5589 if let Nl80211Attrs::RxHwTimestamp(val) = attr? {
5590 return Ok(val);
5591 }
5592 }
5593 Err(ErrorContext::new_missing(
5594 "Nl80211Attrs",
5595 "RxHwTimestamp",
5596 self.orig_loc,
5597 self.buf.as_ptr() as usize,
5598 ))
5599 }
5600 pub fn get_td_bitmap(&self) -> Result<&'a [u8], ErrorContext> {
5601 let mut iter = self.clone();
5602 iter.pos = 0;
5603 for attr in iter {
5604 if let Nl80211Attrs::TdBitmap(val) = attr? {
5605 return Ok(val);
5606 }
5607 }
5608 Err(ErrorContext::new_missing(
5609 "Nl80211Attrs",
5610 "TdBitmap",
5611 self.orig_loc,
5612 self.buf.as_ptr() as usize,
5613 ))
5614 }
5615 pub fn get_punct_bitmap(&self) -> Result<u32, ErrorContext> {
5616 let mut iter = self.clone();
5617 iter.pos = 0;
5618 for attr in iter {
5619 if let Nl80211Attrs::PunctBitmap(val) = attr? {
5620 return Ok(val);
5621 }
5622 }
5623 Err(ErrorContext::new_missing(
5624 "Nl80211Attrs",
5625 "PunctBitmap",
5626 self.orig_loc,
5627 self.buf.as_ptr() as usize,
5628 ))
5629 }
5630 pub fn get_max_hw_timestamp_peers(&self) -> Result<u16, ErrorContext> {
5631 let mut iter = self.clone();
5632 iter.pos = 0;
5633 for attr in iter {
5634 if let Nl80211Attrs::MaxHwTimestampPeers(val) = attr? {
5635 return Ok(val);
5636 }
5637 }
5638 Err(ErrorContext::new_missing(
5639 "Nl80211Attrs",
5640 "MaxHwTimestampPeers",
5641 self.orig_loc,
5642 self.buf.as_ptr() as usize,
5643 ))
5644 }
5645 pub fn get_hw_timestamp_enabled(&self) -> Result<(), ErrorContext> {
5646 let mut iter = self.clone();
5647 iter.pos = 0;
5648 for attr in iter {
5649 if let Nl80211Attrs::HwTimestampEnabled(val) = attr? {
5650 return Ok(val);
5651 }
5652 }
5653 Err(ErrorContext::new_missing(
5654 "Nl80211Attrs",
5655 "HwTimestampEnabled",
5656 self.orig_loc,
5657 self.buf.as_ptr() as usize,
5658 ))
5659 }
5660 pub fn get_ema_rnr_elems(&self) -> Result<&'a [u8], ErrorContext> {
5661 let mut iter = self.clone();
5662 iter.pos = 0;
5663 for attr in iter {
5664 if let Nl80211Attrs::EmaRnrElems(val) = attr? {
5665 return Ok(val);
5666 }
5667 }
5668 Err(ErrorContext::new_missing(
5669 "Nl80211Attrs",
5670 "EmaRnrElems",
5671 self.orig_loc,
5672 self.buf.as_ptr() as usize,
5673 ))
5674 }
5675 pub fn get_mlo_link_disabled(&self) -> Result<(), ErrorContext> {
5676 let mut iter = self.clone();
5677 iter.pos = 0;
5678 for attr in iter {
5679 if let Nl80211Attrs::MloLinkDisabled(val) = attr? {
5680 return Ok(val);
5681 }
5682 }
5683 Err(ErrorContext::new_missing(
5684 "Nl80211Attrs",
5685 "MloLinkDisabled",
5686 self.orig_loc,
5687 self.buf.as_ptr() as usize,
5688 ))
5689 }
5690 pub fn get_bss_dump_include_use_data(&self) -> Result<(), ErrorContext> {
5691 let mut iter = self.clone();
5692 iter.pos = 0;
5693 for attr in iter {
5694 if let Nl80211Attrs::BssDumpIncludeUseData(val) = attr? {
5695 return Ok(val);
5696 }
5697 }
5698 Err(ErrorContext::new_missing(
5699 "Nl80211Attrs",
5700 "BssDumpIncludeUseData",
5701 self.orig_loc,
5702 self.buf.as_ptr() as usize,
5703 ))
5704 }
5705 pub fn get_mlo_ttlm_dlink(&self) -> Result<u16, ErrorContext> {
5706 let mut iter = self.clone();
5707 iter.pos = 0;
5708 for attr in iter {
5709 if let Nl80211Attrs::MloTtlmDlink(val) = attr? {
5710 return Ok(val);
5711 }
5712 }
5713 Err(ErrorContext::new_missing(
5714 "Nl80211Attrs",
5715 "MloTtlmDlink",
5716 self.orig_loc,
5717 self.buf.as_ptr() as usize,
5718 ))
5719 }
5720 pub fn get_mlo_ttlm_ulink(&self) -> Result<u16, ErrorContext> {
5721 let mut iter = self.clone();
5722 iter.pos = 0;
5723 for attr in iter {
5724 if let Nl80211Attrs::MloTtlmUlink(val) = attr? {
5725 return Ok(val);
5726 }
5727 }
5728 Err(ErrorContext::new_missing(
5729 "Nl80211Attrs",
5730 "MloTtlmUlink",
5731 self.orig_loc,
5732 self.buf.as_ptr() as usize,
5733 ))
5734 }
5735 pub fn get_assoc_spp_amsdu(&self) -> Result<(), ErrorContext> {
5736 let mut iter = self.clone();
5737 iter.pos = 0;
5738 for attr in iter {
5739 if let Nl80211Attrs::AssocSppAmsdu(val) = attr? {
5740 return Ok(val);
5741 }
5742 }
5743 Err(ErrorContext::new_missing(
5744 "Nl80211Attrs",
5745 "AssocSppAmsdu",
5746 self.orig_loc,
5747 self.buf.as_ptr() as usize,
5748 ))
5749 }
5750 pub fn get_wiphy_radios(&self) -> Result<&'a [u8], ErrorContext> {
5751 let mut iter = self.clone();
5752 iter.pos = 0;
5753 for attr in iter {
5754 if let Nl80211Attrs::WiphyRadios(val) = attr? {
5755 return Ok(val);
5756 }
5757 }
5758 Err(ErrorContext::new_missing(
5759 "Nl80211Attrs",
5760 "WiphyRadios",
5761 self.orig_loc,
5762 self.buf.as_ptr() as usize,
5763 ))
5764 }
5765 pub fn get_wiphy_interface_combinations(&self) -> Result<&'a [u8], ErrorContext> {
5766 let mut iter = self.clone();
5767 iter.pos = 0;
5768 for attr in iter {
5769 if let Nl80211Attrs::WiphyInterfaceCombinations(val) = attr? {
5770 return Ok(val);
5771 }
5772 }
5773 Err(ErrorContext::new_missing(
5774 "Nl80211Attrs",
5775 "WiphyInterfaceCombinations",
5776 self.orig_loc,
5777 self.buf.as_ptr() as usize,
5778 ))
5779 }
5780 pub fn get_vif_radio_mask(&self) -> Result<u32, ErrorContext> {
5781 let mut iter = self.clone();
5782 iter.pos = 0;
5783 for attr in iter {
5784 if let Nl80211Attrs::VifRadioMask(val) = attr? {
5785 return Ok(val);
5786 }
5787 }
5788 Err(ErrorContext::new_missing(
5789 "Nl80211Attrs",
5790 "VifRadioMask",
5791 self.orig_loc,
5792 self.buf.as_ptr() as usize,
5793 ))
5794 }
5795}
5796#[derive(Clone, Copy, Default)]
5797pub struct IterableArrayU32<'a> {
5798 buf: &'a [u8],
5799 pos: usize,
5800 orig_loc: usize,
5801}
5802impl<'a> IterableArrayU32<'a> {
5803 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
5804 Self {
5805 buf,
5806 pos: 0,
5807 orig_loc,
5808 }
5809 }
5810 pub fn get_buf(&self) -> &'a [u8] {
5811 self.buf
5812 }
5813}
5814impl<'a> Iterator for IterableArrayU32<'a> {
5815 type Item = Result<u32, ErrorContext>;
5816 fn next(&mut self) -> Option<Self::Item> {
5817 if self.buf.len() == self.pos {
5818 return None;
5819 }
5820 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
5821 {
5822 let Some(res) = parse_u32(next) else { break };
5823 return Some(Ok(res));
5824 }
5825 }
5826 Some(Err(ErrorContext::new(
5827 "u32",
5828 None,
5829 self.orig_loc,
5830 self.buf.as_ptr().wrapping_add(self.pos) as usize,
5831 )))
5832 }
5833}
5834impl<'a> IfCombinationAttributes<'a> {
5835 pub fn new_array(buf: &[u8]) -> IterableArrayIfCombinationAttributes<'_> {
5836 IterableArrayIfCombinationAttributes::with_loc(buf, buf.as_ptr() as usize)
5837 }
5838}
5839#[derive(Clone, Copy, Default)]
5840pub struct IterableArrayIfCombinationAttributes<'a> {
5841 buf: &'a [u8],
5842 pos: usize,
5843 orig_loc: usize,
5844}
5845impl<'a> IterableArrayIfCombinationAttributes<'a> {
5846 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
5847 Self {
5848 buf,
5849 pos: 0,
5850 orig_loc,
5851 }
5852 }
5853 pub fn get_buf(&self) -> &'a [u8] {
5854 self.buf
5855 }
5856}
5857impl<'a> Iterator for IterableArrayIfCombinationAttributes<'a> {
5858 type Item = Result<IterableIfCombinationAttributes<'a>, ErrorContext>;
5859 fn next(&mut self) -> Option<Self::Item> {
5860 if self.buf.len() == self.pos {
5861 return None;
5862 }
5863 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
5864 {
5865 return Some(Ok(IterableIfCombinationAttributes::with_loc(
5866 next,
5867 self.orig_loc,
5868 )));
5869 }
5870 }
5871 Some(Err(ErrorContext::new(
5872 "IfCombinationAttributes",
5873 None,
5874 self.orig_loc,
5875 self.buf.as_ptr().wrapping_add(self.pos) as usize,
5876 )))
5877 }
5878}
5879impl Nl80211Attrs<'_> {
5880 pub fn new<'a>(buf: &'a [u8]) -> IterableNl80211Attrs<'a> {
5881 IterableNl80211Attrs::with_loc(buf, buf.as_ptr() as usize)
5882 }
5883 fn attr_from_type(r#type: u16) -> Option<&'static str> {
5884 let res = match r#type {
5885 1u16 => "Wiphy",
5886 2u16 => "WiphyName",
5887 3u16 => "Ifindex",
5888 4u16 => "Ifname",
5889 5u16 => "Iftype",
5890 6u16 => "Mac",
5891 7u16 => "KeyData",
5892 8u16 => "KeyIdx",
5893 9u16 => "KeyCipher",
5894 10u16 => "KeySeq",
5895 11u16 => "KeyDefault",
5896 12u16 => "BeaconInterval",
5897 13u16 => "DtimPeriod",
5898 14u16 => "BeaconHead",
5899 15u16 => "BeaconTail",
5900 16u16 => "StaAid",
5901 17u16 => "StaFlags",
5902 18u16 => "StaListenInterval",
5903 19u16 => "StaSupportedRates",
5904 20u16 => "StaVlan",
5905 21u16 => "StaInfo",
5906 22u16 => "WiphyBands",
5907 23u16 => "MntrFlags",
5908 24u16 => "MeshId",
5909 25u16 => "StaPlinkAction",
5910 26u16 => "MpathNextHop",
5911 27u16 => "MpathInfo",
5912 28u16 => "BssCtsProt",
5913 29u16 => "BssShortPreamble",
5914 30u16 => "BssShortSlotTime",
5915 31u16 => "HtCapability",
5916 32u16 => "SupportedIftypes",
5917 33u16 => "RegAlpha2",
5918 34u16 => "RegRules",
5919 35u16 => "MeshConfig",
5920 36u16 => "BssBasicRates",
5921 37u16 => "WiphyTxqParams",
5922 38u16 => "WiphyFreq",
5923 39u16 => "WiphyChannelType",
5924 40u16 => "KeyDefaultMgmt",
5925 41u16 => "MgmtSubtype",
5926 42u16 => "Ie",
5927 43u16 => "MaxNumScanSsids",
5928 44u16 => "ScanFrequencies",
5929 45u16 => "ScanSsids",
5930 46u16 => "Generation",
5931 47u16 => "Bss",
5932 48u16 => "RegInitiator",
5933 49u16 => "RegType",
5934 50u16 => "SupportedCommands",
5935 51u16 => "Frame",
5936 52u16 => "Ssid",
5937 53u16 => "AuthType",
5938 54u16 => "ReasonCode",
5939 55u16 => "KeyType",
5940 56u16 => "MaxScanIeLen",
5941 57u16 => "CipherSuites",
5942 58u16 => "FreqBefore",
5943 59u16 => "FreqAfter",
5944 60u16 => "FreqFixed",
5945 61u16 => "WiphyRetryShort",
5946 62u16 => "WiphyRetryLong",
5947 63u16 => "WiphyFragThreshold",
5948 64u16 => "WiphyRtsThreshold",
5949 65u16 => "TimedOut",
5950 66u16 => "UseMfp",
5951 67u16 => "StaFlags2",
5952 68u16 => "ControlPort",
5953 69u16 => "Testdata",
5954 70u16 => "Privacy",
5955 71u16 => "DisconnectedByAp",
5956 72u16 => "StatusCode",
5957 73u16 => "CipherSuitesPairwise",
5958 74u16 => "CipherSuiteGroup",
5959 75u16 => "WpaVersions",
5960 76u16 => "AkmSuites",
5961 77u16 => "ReqIe",
5962 78u16 => "RespIe",
5963 79u16 => "PrevBssid",
5964 80u16 => "Key",
5965 81u16 => "Keys",
5966 82u16 => "Pid",
5967 83u16 => "4addr",
5968 84u16 => "SurveyInfo",
5969 85u16 => "Pmkid",
5970 86u16 => "MaxNumPmkids",
5971 87u16 => "Duration",
5972 88u16 => "Cookie",
5973 89u16 => "WiphyCoverageClass",
5974 90u16 => "TxRates",
5975 91u16 => "FrameMatch",
5976 92u16 => "Ack",
5977 93u16 => "PsState",
5978 94u16 => "Cqm",
5979 95u16 => "LocalStateChange",
5980 96u16 => "ApIsolate",
5981 97u16 => "WiphyTxPowerSetting",
5982 98u16 => "WiphyTxPowerLevel",
5983 99u16 => "TxFrameTypes",
5984 100u16 => "RxFrameTypes",
5985 101u16 => "FrameType",
5986 102u16 => "ControlPortEthertype",
5987 103u16 => "ControlPortNoEncrypt",
5988 104u16 => "SupportIbssRsn",
5989 105u16 => "WiphyAntennaTx",
5990 106u16 => "WiphyAntennaRx",
5991 107u16 => "McastRate",
5992 108u16 => "OffchannelTxOk",
5993 109u16 => "BssHtOpmode",
5994 110u16 => "KeyDefaultTypes",
5995 111u16 => "MaxRemainOnChannelDuration",
5996 112u16 => "MeshSetup",
5997 113u16 => "WiphyAntennaAvailTx",
5998 114u16 => "WiphyAntennaAvailRx",
5999 115u16 => "SupportMeshAuth",
6000 116u16 => "StaPlinkState",
6001 117u16 => "WowlanTriggers",
6002 118u16 => "WowlanTriggersSupported",
6003 119u16 => "SchedScanInterval",
6004 120u16 => "InterfaceCombinations",
6005 121u16 => "SoftwareIftypes",
6006 122u16 => "RekeyData",
6007 123u16 => "MaxNumSchedScanSsids",
6008 124u16 => "MaxSchedScanIeLen",
6009 125u16 => "ScanSuppRates",
6010 126u16 => "HiddenSsid",
6011 127u16 => "IeProbeResp",
6012 128u16 => "IeAssocResp",
6013 129u16 => "StaWme",
6014 130u16 => "SupportApUapsd",
6015 131u16 => "RoamSupport",
6016 132u16 => "SchedScanMatch",
6017 133u16 => "MaxMatchSets",
6018 134u16 => "PmksaCandidate",
6019 135u16 => "TxNoCckRate",
6020 136u16 => "TdlsAction",
6021 137u16 => "TdlsDialogToken",
6022 138u16 => "TdlsOperation",
6023 139u16 => "TdlsSupport",
6024 140u16 => "TdlsExternalSetup",
6025 141u16 => "DeviceApSme",
6026 142u16 => "DontWaitForAck",
6027 143u16 => "FeatureFlags",
6028 144u16 => "ProbeRespOffload",
6029 145u16 => "ProbeResp",
6030 146u16 => "DfsRegion",
6031 147u16 => "DisableHt",
6032 148u16 => "HtCapabilityMask",
6033 149u16 => "NoackMap",
6034 150u16 => "InactivityTimeout",
6035 151u16 => "RxSignalDbm",
6036 152u16 => "BgScanPeriod",
6037 153u16 => "Wdev",
6038 154u16 => "UserRegHintType",
6039 155u16 => "ConnFailedReason",
6040 156u16 => "AuthData",
6041 157u16 => "VhtCapability",
6042 158u16 => "ScanFlags",
6043 159u16 => "ChannelWidth",
6044 160u16 => "CenterFreq1",
6045 161u16 => "CenterFreq2",
6046 162u16 => "P2pCtwindow",
6047 163u16 => "P2pOppps",
6048 164u16 => "LocalMeshPowerMode",
6049 165u16 => "AclPolicy",
6050 166u16 => "MacAddrs",
6051 167u16 => "MacAclMax",
6052 168u16 => "RadarEvent",
6053 169u16 => "ExtCapa",
6054 170u16 => "ExtCapaMask",
6055 171u16 => "StaCapability",
6056 172u16 => "StaExtCapability",
6057 173u16 => "ProtocolFeatures",
6058 174u16 => "SplitWiphyDump",
6059 175u16 => "DisableVht",
6060 176u16 => "VhtCapabilityMask",
6061 177u16 => "Mdid",
6062 178u16 => "IeRic",
6063 179u16 => "CritProtId",
6064 180u16 => "MaxCritProtDuration",
6065 181u16 => "PeerAid",
6066 182u16 => "CoalesceRule",
6067 183u16 => "ChSwitchCount",
6068 184u16 => "ChSwitchBlockTx",
6069 185u16 => "CsaIes",
6070 186u16 => "CntdwnOffsBeacon",
6071 187u16 => "CntdwnOffsPresp",
6072 188u16 => "RxmgmtFlags",
6073 189u16 => "StaSupportedChannels",
6074 190u16 => "StaSupportedOperClasses",
6075 191u16 => "HandleDfs",
6076 192u16 => "Support5Mhz",
6077 193u16 => "Support10Mhz",
6078 194u16 => "OpmodeNotif",
6079 195u16 => "VendorId",
6080 196u16 => "VendorSubcmd",
6081 197u16 => "VendorData",
6082 198u16 => "VendorEvents",
6083 199u16 => "QosMap",
6084 200u16 => "MacHint",
6085 201u16 => "WiphyFreqHint",
6086 202u16 => "MaxApAssocSta",
6087 203u16 => "TdlsPeerCapability",
6088 204u16 => "SocketOwner",
6089 205u16 => "CsaCOffsetsTx",
6090 206u16 => "MaxCsaCounters",
6091 207u16 => "TdlsInitiator",
6092 208u16 => "UseRrm",
6093 209u16 => "WiphyDynAck",
6094 210u16 => "Tsid",
6095 211u16 => "UserPrio",
6096 212u16 => "AdmittedTime",
6097 213u16 => "SmpsMode",
6098 214u16 => "OperClass",
6099 215u16 => "MacMask",
6100 216u16 => "WiphySelfManagedReg",
6101 217u16 => "ExtFeatures",
6102 218u16 => "SurveyRadioStats",
6103 219u16 => "NetnsFd",
6104 220u16 => "SchedScanDelay",
6105 221u16 => "RegIndoor",
6106 222u16 => "MaxNumSchedScanPlans",
6107 223u16 => "MaxScanPlanInterval",
6108 224u16 => "MaxScanPlanIterations",
6109 225u16 => "SchedScanPlans",
6110 226u16 => "Pbss",
6111 227u16 => "BssSelect",
6112 228u16 => "StaSupportP2pPs",
6113 229u16 => "Pad",
6114 230u16 => "IftypeExtCapa",
6115 231u16 => "MuMimoGroupData",
6116 232u16 => "MuMimoFollowMacAddr",
6117 233u16 => "ScanStartTimeTsf",
6118 234u16 => "ScanStartTimeTsfBssid",
6119 235u16 => "MeasurementDuration",
6120 236u16 => "MeasurementDurationMandatory",
6121 237u16 => "MeshPeerAid",
6122 238u16 => "NanMasterPref",
6123 239u16 => "Bands",
6124 240u16 => "NanFunc",
6125 241u16 => "NanMatch",
6126 242u16 => "FilsKek",
6127 243u16 => "FilsNonces",
6128 244u16 => "MulticastToUnicastEnabled",
6129 245u16 => "Bssid",
6130 246u16 => "SchedScanRelativeRssi",
6131 247u16 => "SchedScanRssiAdjust",
6132 248u16 => "TimeoutReason",
6133 249u16 => "FilsErpUsername",
6134 250u16 => "FilsErpRealm",
6135 251u16 => "FilsErpNextSeqNum",
6136 252u16 => "FilsErpRrk",
6137 253u16 => "FilsCacheId",
6138 254u16 => "Pmk",
6139 255u16 => "SchedScanMulti",
6140 256u16 => "SchedScanMaxReqs",
6141 257u16 => "Want1x4wayHs",
6142 258u16 => "Pmkr0Name",
6143 259u16 => "PortAuthorized",
6144 260u16 => "ExternalAuthAction",
6145 261u16 => "ExternalAuthSupport",
6146 262u16 => "Nss",
6147 263u16 => "AckSignal",
6148 264u16 => "ControlPortOverNl80211",
6149 265u16 => "TxqStats",
6150 266u16 => "TxqLimit",
6151 267u16 => "TxqMemoryLimit",
6152 268u16 => "TxqQuantum",
6153 269u16 => "HeCapability",
6154 270u16 => "FtmResponder",
6155 271u16 => "FtmResponderStats",
6156 272u16 => "Timeout",
6157 273u16 => "PeerMeasurements",
6158 274u16 => "AirtimeWeight",
6159 275u16 => "StaTxPowerSetting",
6160 276u16 => "StaTxPower",
6161 277u16 => "SaePassword",
6162 278u16 => "TwtResponder",
6163 279u16 => "HeObssPd",
6164 280u16 => "WiphyEdmgChannels",
6165 281u16 => "WiphyEdmgBwConfig",
6166 282u16 => "VlanId",
6167 283u16 => "HeBssColor",
6168 284u16 => "IftypeAkmSuites",
6169 285u16 => "TidConfig",
6170 286u16 => "ControlPortNoPreauth",
6171 287u16 => "PmkLifetime",
6172 288u16 => "PmkReauthThreshold",
6173 289u16 => "ReceiveMulticast",
6174 290u16 => "WiphyFreqOffset",
6175 291u16 => "CenterFreq1Offset",
6176 292u16 => "ScanFreqKhz",
6177 293u16 => "He6ghzCapability",
6178 294u16 => "FilsDiscovery",
6179 295u16 => "UnsolBcastProbeResp",
6180 296u16 => "S1gCapability",
6181 297u16 => "S1gCapabilityMask",
6182 298u16 => "SaePwe",
6183 299u16 => "ReconnectRequested",
6184 300u16 => "SarSpec",
6185 301u16 => "DisableHe",
6186 302u16 => "ObssColorBitmap",
6187 303u16 => "ColorChangeCount",
6188 304u16 => "ColorChangeColor",
6189 305u16 => "ColorChangeElems",
6190 306u16 => "MbssidConfig",
6191 307u16 => "MbssidElems",
6192 308u16 => "RadarBackground",
6193 309u16 => "ApSettingsFlags",
6194 310u16 => "EhtCapability",
6195 311u16 => "DisableEht",
6196 312u16 => "MloLinks",
6197 313u16 => "MloLinkId",
6198 314u16 => "MldAddr",
6199 315u16 => "MloSupport",
6200 316u16 => "MaxNumAkmSuites",
6201 317u16 => "EmlCapability",
6202 318u16 => "MldCapaAndOps",
6203 319u16 => "TxHwTimestamp",
6204 320u16 => "RxHwTimestamp",
6205 321u16 => "TdBitmap",
6206 322u16 => "PunctBitmap",
6207 323u16 => "MaxHwTimestampPeers",
6208 324u16 => "HwTimestampEnabled",
6209 325u16 => "EmaRnrElems",
6210 326u16 => "MloLinkDisabled",
6211 327u16 => "BssDumpIncludeUseData",
6212 328u16 => "MloTtlmDlink",
6213 329u16 => "MloTtlmUlink",
6214 330u16 => "AssocSppAmsdu",
6215 331u16 => "WiphyRadios",
6216 332u16 => "WiphyInterfaceCombinations",
6217 333u16 => "VifRadioMask",
6218 _ => return None,
6219 };
6220 Some(res)
6221 }
6222}
6223#[derive(Clone, Copy, Default)]
6224pub struct IterableNl80211Attrs<'a> {
6225 buf: &'a [u8],
6226 pos: usize,
6227 orig_loc: usize,
6228}
6229impl<'a> IterableNl80211Attrs<'a> {
6230 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
6231 Self {
6232 buf,
6233 pos: 0,
6234 orig_loc,
6235 }
6236 }
6237 pub fn get_buf(&self) -> &'a [u8] {
6238 self.buf
6239 }
6240}
6241impl<'a> Iterator for IterableNl80211Attrs<'a> {
6242 type Item = Result<Nl80211Attrs<'a>, ErrorContext>;
6243 fn next(&mut self) -> Option<Self::Item> {
6244 if self.buf.len() == self.pos {
6245 return None;
6246 }
6247 let pos = self.pos;
6248 let mut r#type = None;
6249 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
6250 r#type = Some(header.r#type);
6251 let res = match header.r#type {
6252 1u16 => Nl80211Attrs::Wiphy({
6253 let res = parse_u32(next);
6254 let Some(val) = res else { break };
6255 val
6256 }),
6257 2u16 => Nl80211Attrs::WiphyName({
6258 let res = CStr::from_bytes_with_nul(next).ok();
6259 let Some(val) = res else { break };
6260 val
6261 }),
6262 3u16 => Nl80211Attrs::Ifindex({
6263 let res = parse_u32(next);
6264 let Some(val) = res else { break };
6265 val
6266 }),
6267 4u16 => Nl80211Attrs::Ifname({
6268 let res = CStr::from_bytes_with_nul(next).ok();
6269 let Some(val) = res else { break };
6270 val
6271 }),
6272 5u16 => Nl80211Attrs::Iftype({
6273 let res = parse_u32(next);
6274 let Some(val) = res else { break };
6275 val
6276 }),
6277 6u16 => Nl80211Attrs::Mac({
6278 let res = Some(next);
6279 let Some(val) = res else { break };
6280 val
6281 }),
6282 7u16 => Nl80211Attrs::KeyData({
6283 let res = Some(next);
6284 let Some(val) = res else { break };
6285 val
6286 }),
6287 8u16 => Nl80211Attrs::KeyIdx({
6288 let res = parse_u8(next);
6289 let Some(val) = res else { break };
6290 val
6291 }),
6292 9u16 => Nl80211Attrs::KeyCipher({
6293 let res = parse_u32(next);
6294 let Some(val) = res else { break };
6295 val
6296 }),
6297 10u16 => Nl80211Attrs::KeySeq({
6298 let res = Some(next);
6299 let Some(val) = res else { break };
6300 val
6301 }),
6302 11u16 => Nl80211Attrs::KeyDefault(()),
6303 12u16 => Nl80211Attrs::BeaconInterval({
6304 let res = parse_u32(next);
6305 let Some(val) = res else { break };
6306 val
6307 }),
6308 13u16 => Nl80211Attrs::DtimPeriod({
6309 let res = parse_u32(next);
6310 let Some(val) = res else { break };
6311 val
6312 }),
6313 14u16 => Nl80211Attrs::BeaconHead({
6314 let res = Some(next);
6315 let Some(val) = res else { break };
6316 val
6317 }),
6318 15u16 => Nl80211Attrs::BeaconTail({
6319 let res = Some(next);
6320 let Some(val) = res else { break };
6321 val
6322 }),
6323 16u16 => Nl80211Attrs::StaAid({
6324 let res = parse_u16(next);
6325 let Some(val) = res else { break };
6326 val
6327 }),
6328 17u16 => Nl80211Attrs::StaFlags({
6329 let res = Some(next);
6330 let Some(val) = res else { break };
6331 val
6332 }),
6333 18u16 => Nl80211Attrs::StaListenInterval({
6334 let res = parse_u16(next);
6335 let Some(val) = res else { break };
6336 val
6337 }),
6338 19u16 => Nl80211Attrs::StaSupportedRates({
6339 let res = Some(next);
6340 let Some(val) = res else { break };
6341 val
6342 }),
6343 20u16 => Nl80211Attrs::StaVlan({
6344 let res = parse_u32(next);
6345 let Some(val) = res else { break };
6346 val
6347 }),
6348 21u16 => Nl80211Attrs::StaInfo({
6349 let res = Some(next);
6350 let Some(val) = res else { break };
6351 val
6352 }),
6353 22u16 => Nl80211Attrs::WiphyBands({
6354 let res = Some(IterableWiphyBands::with_loc(next, self.orig_loc));
6355 let Some(val) = res else { break };
6356 val
6357 }),
6358 23u16 => Nl80211Attrs::MntrFlags({
6359 let res = Some(next);
6360 let Some(val) = res else { break };
6361 val
6362 }),
6363 24u16 => Nl80211Attrs::MeshId({
6364 let res = Some(next);
6365 let Some(val) = res else { break };
6366 val
6367 }),
6368 25u16 => Nl80211Attrs::StaPlinkAction({
6369 let res = parse_u8(next);
6370 let Some(val) = res else { break };
6371 val
6372 }),
6373 26u16 => Nl80211Attrs::MpathNextHop({
6374 let res = Some(next);
6375 let Some(val) = res else { break };
6376 val
6377 }),
6378 27u16 => Nl80211Attrs::MpathInfo({
6379 let res = Some(next);
6380 let Some(val) = res else { break };
6381 val
6382 }),
6383 28u16 => Nl80211Attrs::BssCtsProt({
6384 let res = parse_u8(next);
6385 let Some(val) = res else { break };
6386 val
6387 }),
6388 29u16 => Nl80211Attrs::BssShortPreamble({
6389 let res = parse_u8(next);
6390 let Some(val) = res else { break };
6391 val
6392 }),
6393 30u16 => Nl80211Attrs::BssShortSlotTime({
6394 let res = parse_u8(next);
6395 let Some(val) = res else { break };
6396 val
6397 }),
6398 31u16 => Nl80211Attrs::HtCapability({
6399 let res = Some(next);
6400 let Some(val) = res else { break };
6401 val
6402 }),
6403 32u16 => Nl80211Attrs::SupportedIftypes({
6404 let res = Some(IterableSupportedIftypes::with_loc(next, self.orig_loc));
6405 let Some(val) = res else { break };
6406 val
6407 }),
6408 33u16 => Nl80211Attrs::RegAlpha2({
6409 let res = Some(next);
6410 let Some(val) = res else { break };
6411 val
6412 }),
6413 34u16 => Nl80211Attrs::RegRules({
6414 let res = Some(next);
6415 let Some(val) = res else { break };
6416 val
6417 }),
6418 35u16 => Nl80211Attrs::MeshConfig({
6419 let res = Some(next);
6420 let Some(val) = res else { break };
6421 val
6422 }),
6423 36u16 => Nl80211Attrs::BssBasicRates({
6424 let res = Some(next);
6425 let Some(val) = res else { break };
6426 val
6427 }),
6428 37u16 => Nl80211Attrs::WiphyTxqParams({
6429 let res = Some(next);
6430 let Some(val) = res else { break };
6431 val
6432 }),
6433 38u16 => Nl80211Attrs::WiphyFreq({
6434 let res = parse_u32(next);
6435 let Some(val) = res else { break };
6436 val
6437 }),
6438 39u16 => Nl80211Attrs::WiphyChannelType({
6439 let res = parse_u32(next);
6440 let Some(val) = res else { break };
6441 val
6442 }),
6443 40u16 => Nl80211Attrs::KeyDefaultMgmt(()),
6444 41u16 => Nl80211Attrs::MgmtSubtype({
6445 let res = parse_u8(next);
6446 let Some(val) = res else { break };
6447 val
6448 }),
6449 42u16 => Nl80211Attrs::Ie({
6450 let res = Some(next);
6451 let Some(val) = res else { break };
6452 val
6453 }),
6454 43u16 => Nl80211Attrs::MaxNumScanSsids({
6455 let res = parse_u8(next);
6456 let Some(val) = res else { break };
6457 val
6458 }),
6459 44u16 => Nl80211Attrs::ScanFrequencies({
6460 let res = Some(next);
6461 let Some(val) = res else { break };
6462 val
6463 }),
6464 45u16 => Nl80211Attrs::ScanSsids({
6465 let res = Some(next);
6466 let Some(val) = res else { break };
6467 val
6468 }),
6469 46u16 => Nl80211Attrs::Generation({
6470 let res = parse_u32(next);
6471 let Some(val) = res else { break };
6472 val
6473 }),
6474 47u16 => Nl80211Attrs::Bss({
6475 let res = Some(next);
6476 let Some(val) = res else { break };
6477 val
6478 }),
6479 48u16 => Nl80211Attrs::RegInitiator({
6480 let res = parse_u8(next);
6481 let Some(val) = res else { break };
6482 val
6483 }),
6484 49u16 => Nl80211Attrs::RegType({
6485 let res = parse_u8(next);
6486 let Some(val) = res else { break };
6487 val
6488 }),
6489 50u16 => Nl80211Attrs::SupportedCommands({
6490 let res = Some(IterableArrayU32::with_loc(next, self.orig_loc));
6491 let Some(val) = res else { break };
6492 val
6493 }),
6494 51u16 => Nl80211Attrs::Frame({
6495 let res = Some(next);
6496 let Some(val) = res else { break };
6497 val
6498 }),
6499 52u16 => Nl80211Attrs::Ssid({
6500 let res = Some(next);
6501 let Some(val) = res else { break };
6502 val
6503 }),
6504 53u16 => Nl80211Attrs::AuthType({
6505 let res = parse_u32(next);
6506 let Some(val) = res else { break };
6507 val
6508 }),
6509 54u16 => Nl80211Attrs::ReasonCode({
6510 let res = parse_u16(next);
6511 let Some(val) = res else { break };
6512 val
6513 }),
6514 55u16 => Nl80211Attrs::KeyType({
6515 let res = parse_u32(next);
6516 let Some(val) = res else { break };
6517 val
6518 }),
6519 56u16 => Nl80211Attrs::MaxScanIeLen({
6520 let res = parse_u16(next);
6521 let Some(val) = res else { break };
6522 val
6523 }),
6524 57u16 => Nl80211Attrs::CipherSuites({
6525 let res = Some(next);
6526 let Some(val) = res else { break };
6527 val
6528 }),
6529 58u16 => Nl80211Attrs::FreqBefore({
6530 let res = Some(next);
6531 let Some(val) = res else { break };
6532 val
6533 }),
6534 59u16 => Nl80211Attrs::FreqAfter({
6535 let res = Some(next);
6536 let Some(val) = res else { break };
6537 val
6538 }),
6539 60u16 => Nl80211Attrs::FreqFixed(()),
6540 61u16 => Nl80211Attrs::WiphyRetryShort({
6541 let res = parse_u8(next);
6542 let Some(val) = res else { break };
6543 val
6544 }),
6545 62u16 => Nl80211Attrs::WiphyRetryLong({
6546 let res = parse_u8(next);
6547 let Some(val) = res else { break };
6548 val
6549 }),
6550 63u16 => Nl80211Attrs::WiphyFragThreshold({
6551 let res = parse_u32(next);
6552 let Some(val) = res else { break };
6553 val
6554 }),
6555 64u16 => Nl80211Attrs::WiphyRtsThreshold({
6556 let res = parse_u32(next);
6557 let Some(val) = res else { break };
6558 val
6559 }),
6560 65u16 => Nl80211Attrs::TimedOut(()),
6561 66u16 => Nl80211Attrs::UseMfp({
6562 let res = parse_u32(next);
6563 let Some(val) = res else { break };
6564 val
6565 }),
6566 67u16 => Nl80211Attrs::StaFlags2({
6567 let res = PushStaFlagUpdate::new_from_slice(next);
6568 let Some(val) = res else { break };
6569 val
6570 }),
6571 68u16 => Nl80211Attrs::ControlPort(()),
6572 69u16 => Nl80211Attrs::Testdata({
6573 let res = Some(next);
6574 let Some(val) = res else { break };
6575 val
6576 }),
6577 70u16 => Nl80211Attrs::Privacy(()),
6578 71u16 => Nl80211Attrs::DisconnectedByAp(()),
6579 72u16 => Nl80211Attrs::StatusCode({
6580 let res = parse_u16(next);
6581 let Some(val) = res else { break };
6582 val
6583 }),
6584 73u16 => Nl80211Attrs::CipherSuitesPairwise({
6585 let res = Some(next);
6586 let Some(val) = res else { break };
6587 val
6588 }),
6589 74u16 => Nl80211Attrs::CipherSuiteGroup({
6590 let res = parse_u32(next);
6591 let Some(val) = res else { break };
6592 val
6593 }),
6594 75u16 => Nl80211Attrs::WpaVersions({
6595 let res = parse_u32(next);
6596 let Some(val) = res else { break };
6597 val
6598 }),
6599 76u16 => Nl80211Attrs::AkmSuites({
6600 let res = Some(next);
6601 let Some(val) = res else { break };
6602 val
6603 }),
6604 77u16 => Nl80211Attrs::ReqIe({
6605 let res = Some(next);
6606 let Some(val) = res else { break };
6607 val
6608 }),
6609 78u16 => Nl80211Attrs::RespIe({
6610 let res = Some(next);
6611 let Some(val) = res else { break };
6612 val
6613 }),
6614 79u16 => Nl80211Attrs::PrevBssid({
6615 let res = Some(next);
6616 let Some(val) = res else { break };
6617 val
6618 }),
6619 80u16 => Nl80211Attrs::Key({
6620 let res = Some(next);
6621 let Some(val) = res else { break };
6622 val
6623 }),
6624 81u16 => Nl80211Attrs::Keys({
6625 let res = Some(next);
6626 let Some(val) = res else { break };
6627 val
6628 }),
6629 82u16 => Nl80211Attrs::Pid({
6630 let res = parse_u32(next);
6631 let Some(val) = res else { break };
6632 val
6633 }),
6634 83u16 => Nl80211Attrs::_4addr({
6635 let res = parse_u8(next);
6636 let Some(val) = res else { break };
6637 val
6638 }),
6639 84u16 => Nl80211Attrs::SurveyInfo({
6640 let res = Some(next);
6641 let Some(val) = res else { break };
6642 val
6643 }),
6644 85u16 => Nl80211Attrs::Pmkid({
6645 let res = Some(next);
6646 let Some(val) = res else { break };
6647 val
6648 }),
6649 86u16 => Nl80211Attrs::MaxNumPmkids({
6650 let res = parse_u8(next);
6651 let Some(val) = res else { break };
6652 val
6653 }),
6654 87u16 => Nl80211Attrs::Duration({
6655 let res = parse_u32(next);
6656 let Some(val) = res else { break };
6657 val
6658 }),
6659 88u16 => Nl80211Attrs::Cookie({
6660 let res = parse_u64(next);
6661 let Some(val) = res else { break };
6662 val
6663 }),
6664 89u16 => Nl80211Attrs::WiphyCoverageClass({
6665 let res = parse_u8(next);
6666 let Some(val) = res else { break };
6667 val
6668 }),
6669 90u16 => Nl80211Attrs::TxRates({
6670 let res = Some(next);
6671 let Some(val) = res else { break };
6672 val
6673 }),
6674 91u16 => Nl80211Attrs::FrameMatch({
6675 let res = Some(next);
6676 let Some(val) = res else { break };
6677 val
6678 }),
6679 92u16 => Nl80211Attrs::Ack(()),
6680 93u16 => Nl80211Attrs::PsState({
6681 let res = parse_u32(next);
6682 let Some(val) = res else { break };
6683 val
6684 }),
6685 94u16 => Nl80211Attrs::Cqm({
6686 let res = Some(next);
6687 let Some(val) = res else { break };
6688 val
6689 }),
6690 95u16 => Nl80211Attrs::LocalStateChange(()),
6691 96u16 => Nl80211Attrs::ApIsolate({
6692 let res = parse_u8(next);
6693 let Some(val) = res else { break };
6694 val
6695 }),
6696 97u16 => Nl80211Attrs::WiphyTxPowerSetting({
6697 let res = parse_u32(next);
6698 let Some(val) = res else { break };
6699 val
6700 }),
6701 98u16 => Nl80211Attrs::WiphyTxPowerLevel({
6702 let res = parse_u32(next);
6703 let Some(val) = res else { break };
6704 val
6705 }),
6706 99u16 => Nl80211Attrs::TxFrameTypes({
6707 let res = Some(IterableIftypeAttrs::with_loc(next, self.orig_loc));
6708 let Some(val) = res else { break };
6709 val
6710 }),
6711 100u16 => Nl80211Attrs::RxFrameTypes({
6712 let res = Some(IterableIftypeAttrs::with_loc(next, self.orig_loc));
6713 let Some(val) = res else { break };
6714 val
6715 }),
6716 101u16 => Nl80211Attrs::FrameType({
6717 let res = parse_u16(next);
6718 let Some(val) = res else { break };
6719 val
6720 }),
6721 102u16 => Nl80211Attrs::ControlPortEthertype(()),
6722 103u16 => Nl80211Attrs::ControlPortNoEncrypt(()),
6723 104u16 => Nl80211Attrs::SupportIbssRsn(()),
6724 105u16 => Nl80211Attrs::WiphyAntennaTx({
6725 let res = parse_u32(next);
6726 let Some(val) = res else { break };
6727 val
6728 }),
6729 106u16 => Nl80211Attrs::WiphyAntennaRx({
6730 let res = parse_u32(next);
6731 let Some(val) = res else { break };
6732 val
6733 }),
6734 107u16 => Nl80211Attrs::McastRate({
6735 let res = parse_u32(next);
6736 let Some(val) = res else { break };
6737 val
6738 }),
6739 108u16 => Nl80211Attrs::OffchannelTxOk(()),
6740 109u16 => Nl80211Attrs::BssHtOpmode({
6741 let res = parse_u16(next);
6742 let Some(val) = res else { break };
6743 val
6744 }),
6745 110u16 => Nl80211Attrs::KeyDefaultTypes({
6746 let res = Some(next);
6747 let Some(val) = res else { break };
6748 val
6749 }),
6750 111u16 => Nl80211Attrs::MaxRemainOnChannelDuration({
6751 let res = parse_u32(next);
6752 let Some(val) = res else { break };
6753 val
6754 }),
6755 112u16 => Nl80211Attrs::MeshSetup({
6756 let res = Some(next);
6757 let Some(val) = res else { break };
6758 val
6759 }),
6760 113u16 => Nl80211Attrs::WiphyAntennaAvailTx({
6761 let res = parse_u32(next);
6762 let Some(val) = res else { break };
6763 val
6764 }),
6765 114u16 => Nl80211Attrs::WiphyAntennaAvailRx({
6766 let res = parse_u32(next);
6767 let Some(val) = res else { break };
6768 val
6769 }),
6770 115u16 => Nl80211Attrs::SupportMeshAuth(()),
6771 116u16 => Nl80211Attrs::StaPlinkState({
6772 let res = parse_u8(next);
6773 let Some(val) = res else { break };
6774 val
6775 }),
6776 117u16 => Nl80211Attrs::WowlanTriggers({
6777 let res = Some(next);
6778 let Some(val) = res else { break };
6779 val
6780 }),
6781 118u16 => Nl80211Attrs::WowlanTriggersSupported({
6782 let res = Some(IterableWowlanTriggersAttrs::with_loc(next, self.orig_loc));
6783 let Some(val) = res else { break };
6784 val
6785 }),
6786 119u16 => Nl80211Attrs::SchedScanInterval({
6787 let res = parse_u32(next);
6788 let Some(val) = res else { break };
6789 val
6790 }),
6791 120u16 => Nl80211Attrs::InterfaceCombinations({
6792 let res = Some(IterableArrayIfCombinationAttributes::with_loc(
6793 next,
6794 self.orig_loc,
6795 ));
6796 let Some(val) = res else { break };
6797 val
6798 }),
6799 121u16 => Nl80211Attrs::SoftwareIftypes({
6800 let res = Some(IterableSupportedIftypes::with_loc(next, self.orig_loc));
6801 let Some(val) = res else { break };
6802 val
6803 }),
6804 122u16 => Nl80211Attrs::RekeyData({
6805 let res = Some(next);
6806 let Some(val) = res else { break };
6807 val
6808 }),
6809 123u16 => Nl80211Attrs::MaxNumSchedScanSsids({
6810 let res = parse_u8(next);
6811 let Some(val) = res else { break };
6812 val
6813 }),
6814 124u16 => Nl80211Attrs::MaxSchedScanIeLen({
6815 let res = parse_u16(next);
6816 let Some(val) = res else { break };
6817 val
6818 }),
6819 125u16 => Nl80211Attrs::ScanSuppRates({
6820 let res = Some(next);
6821 let Some(val) = res else { break };
6822 val
6823 }),
6824 126u16 => Nl80211Attrs::HiddenSsid({
6825 let res = parse_u32(next);
6826 let Some(val) = res else { break };
6827 val
6828 }),
6829 127u16 => Nl80211Attrs::IeProbeResp({
6830 let res = Some(next);
6831 let Some(val) = res else { break };
6832 val
6833 }),
6834 128u16 => Nl80211Attrs::IeAssocResp({
6835 let res = Some(next);
6836 let Some(val) = res else { break };
6837 val
6838 }),
6839 129u16 => Nl80211Attrs::StaWme({
6840 let res = Some(next);
6841 let Some(val) = res else { break };
6842 val
6843 }),
6844 130u16 => Nl80211Attrs::SupportApUapsd(()),
6845 131u16 => Nl80211Attrs::RoamSupport(()),
6846 132u16 => Nl80211Attrs::SchedScanMatch({
6847 let res = Some(next);
6848 let Some(val) = res else { break };
6849 val
6850 }),
6851 133u16 => Nl80211Attrs::MaxMatchSets({
6852 let res = parse_u8(next);
6853 let Some(val) = res else { break };
6854 val
6855 }),
6856 134u16 => Nl80211Attrs::PmksaCandidate({
6857 let res = Some(next);
6858 let Some(val) = res else { break };
6859 val
6860 }),
6861 135u16 => Nl80211Attrs::TxNoCckRate(()),
6862 136u16 => Nl80211Attrs::TdlsAction({
6863 let res = parse_u8(next);
6864 let Some(val) = res else { break };
6865 val
6866 }),
6867 137u16 => Nl80211Attrs::TdlsDialogToken({
6868 let res = parse_u8(next);
6869 let Some(val) = res else { break };
6870 val
6871 }),
6872 138u16 => Nl80211Attrs::TdlsOperation({
6873 let res = parse_u8(next);
6874 let Some(val) = res else { break };
6875 val
6876 }),
6877 139u16 => Nl80211Attrs::TdlsSupport(()),
6878 140u16 => Nl80211Attrs::TdlsExternalSetup(()),
6879 141u16 => Nl80211Attrs::DeviceApSme({
6880 let res = parse_u32(next);
6881 let Some(val) = res else { break };
6882 val
6883 }),
6884 142u16 => Nl80211Attrs::DontWaitForAck(()),
6885 143u16 => Nl80211Attrs::FeatureFlags({
6886 let res = parse_u32(next);
6887 let Some(val) = res else { break };
6888 val
6889 }),
6890 144u16 => Nl80211Attrs::ProbeRespOffload({
6891 let res = parse_u32(next);
6892 let Some(val) = res else { break };
6893 val
6894 }),
6895 145u16 => Nl80211Attrs::ProbeResp({
6896 let res = Some(next);
6897 let Some(val) = res else { break };
6898 val
6899 }),
6900 146u16 => Nl80211Attrs::DfsRegion({
6901 let res = parse_u8(next);
6902 let Some(val) = res else { break };
6903 val
6904 }),
6905 147u16 => Nl80211Attrs::DisableHt(()),
6906 148u16 => Nl80211Attrs::HtCapabilityMask({
6907 let res = Some(next);
6908 let Some(val) = res else { break };
6909 val
6910 }),
6911 149u16 => Nl80211Attrs::NoackMap({
6912 let res = parse_u16(next);
6913 let Some(val) = res else { break };
6914 val
6915 }),
6916 150u16 => Nl80211Attrs::InactivityTimeout({
6917 let res = parse_u16(next);
6918 let Some(val) = res else { break };
6919 val
6920 }),
6921 151u16 => Nl80211Attrs::RxSignalDbm({
6922 let res = parse_u32(next);
6923 let Some(val) = res else { break };
6924 val
6925 }),
6926 152u16 => Nl80211Attrs::BgScanPeriod({
6927 let res = parse_u16(next);
6928 let Some(val) = res else { break };
6929 val
6930 }),
6931 153u16 => Nl80211Attrs::Wdev({
6932 let res = parse_u64(next);
6933 let Some(val) = res else { break };
6934 val
6935 }),
6936 154u16 => Nl80211Attrs::UserRegHintType({
6937 let res = parse_u32(next);
6938 let Some(val) = res else { break };
6939 val
6940 }),
6941 155u16 => Nl80211Attrs::ConnFailedReason({
6942 let res = parse_u32(next);
6943 let Some(val) = res else { break };
6944 val
6945 }),
6946 156u16 => Nl80211Attrs::AuthData({
6947 let res = Some(next);
6948 let Some(val) = res else { break };
6949 val
6950 }),
6951 157u16 => Nl80211Attrs::VhtCapability({
6952 let res = Some(next);
6953 let Some(val) = res else { break };
6954 val
6955 }),
6956 158u16 => Nl80211Attrs::ScanFlags({
6957 let res = parse_u32(next);
6958 let Some(val) = res else { break };
6959 val
6960 }),
6961 159u16 => Nl80211Attrs::ChannelWidth({
6962 let res = parse_u32(next);
6963 let Some(val) = res else { break };
6964 val
6965 }),
6966 160u16 => Nl80211Attrs::CenterFreq1({
6967 let res = parse_u32(next);
6968 let Some(val) = res else { break };
6969 val
6970 }),
6971 161u16 => Nl80211Attrs::CenterFreq2({
6972 let res = parse_u32(next);
6973 let Some(val) = res else { break };
6974 val
6975 }),
6976 162u16 => Nl80211Attrs::P2pCtwindow({
6977 let res = parse_u8(next);
6978 let Some(val) = res else { break };
6979 val
6980 }),
6981 163u16 => Nl80211Attrs::P2pOppps({
6982 let res = parse_u8(next);
6983 let Some(val) = res else { break };
6984 val
6985 }),
6986 164u16 => Nl80211Attrs::LocalMeshPowerMode({
6987 let res = parse_u32(next);
6988 let Some(val) = res else { break };
6989 val
6990 }),
6991 165u16 => Nl80211Attrs::AclPolicy({
6992 let res = parse_u32(next);
6993 let Some(val) = res else { break };
6994 val
6995 }),
6996 166u16 => Nl80211Attrs::MacAddrs({
6997 let res = Some(next);
6998 let Some(val) = res else { break };
6999 val
7000 }),
7001 167u16 => Nl80211Attrs::MacAclMax({
7002 let res = parse_u32(next);
7003 let Some(val) = res else { break };
7004 val
7005 }),
7006 168u16 => Nl80211Attrs::RadarEvent({
7007 let res = parse_u32(next);
7008 let Some(val) = res else { break };
7009 val
7010 }),
7011 169u16 => Nl80211Attrs::ExtCapa({
7012 let res = Some(next);
7013 let Some(val) = res else { break };
7014 val
7015 }),
7016 170u16 => Nl80211Attrs::ExtCapaMask({
7017 let res = Some(next);
7018 let Some(val) = res else { break };
7019 val
7020 }),
7021 171u16 => Nl80211Attrs::StaCapability({
7022 let res = parse_u16(next);
7023 let Some(val) = res else { break };
7024 val
7025 }),
7026 172u16 => Nl80211Attrs::StaExtCapability({
7027 let res = Some(next);
7028 let Some(val) = res else { break };
7029 val
7030 }),
7031 173u16 => Nl80211Attrs::ProtocolFeatures({
7032 let res = parse_u32(next);
7033 let Some(val) = res else { break };
7034 val
7035 }),
7036 174u16 => Nl80211Attrs::SplitWiphyDump(()),
7037 175u16 => Nl80211Attrs::DisableVht(()),
7038 176u16 => Nl80211Attrs::VhtCapabilityMask({
7039 let res = Some(next);
7040 let Some(val) = res else { break };
7041 val
7042 }),
7043 177u16 => Nl80211Attrs::Mdid({
7044 let res = parse_u16(next);
7045 let Some(val) = res else { break };
7046 val
7047 }),
7048 178u16 => Nl80211Attrs::IeRic({
7049 let res = Some(next);
7050 let Some(val) = res else { break };
7051 val
7052 }),
7053 179u16 => Nl80211Attrs::CritProtId({
7054 let res = parse_u16(next);
7055 let Some(val) = res else { break };
7056 val
7057 }),
7058 180u16 => Nl80211Attrs::MaxCritProtDuration({
7059 let res = parse_u16(next);
7060 let Some(val) = res else { break };
7061 val
7062 }),
7063 181u16 => Nl80211Attrs::PeerAid({
7064 let res = parse_u16(next);
7065 let Some(val) = res else { break };
7066 val
7067 }),
7068 182u16 => Nl80211Attrs::CoalesceRule({
7069 let res = Some(next);
7070 let Some(val) = res else { break };
7071 val
7072 }),
7073 183u16 => Nl80211Attrs::ChSwitchCount({
7074 let res = parse_u32(next);
7075 let Some(val) = res else { break };
7076 val
7077 }),
7078 184u16 => Nl80211Attrs::ChSwitchBlockTx(()),
7079 185u16 => Nl80211Attrs::CsaIes({
7080 let res = Some(next);
7081 let Some(val) = res else { break };
7082 val
7083 }),
7084 186u16 => Nl80211Attrs::CntdwnOffsBeacon({
7085 let res = Some(next);
7086 let Some(val) = res else { break };
7087 val
7088 }),
7089 187u16 => Nl80211Attrs::CntdwnOffsPresp({
7090 let res = Some(next);
7091 let Some(val) = res else { break };
7092 val
7093 }),
7094 188u16 => Nl80211Attrs::RxmgmtFlags({
7095 let res = Some(next);
7096 let Some(val) = res else { break };
7097 val
7098 }),
7099 189u16 => Nl80211Attrs::StaSupportedChannels({
7100 let res = Some(next);
7101 let Some(val) = res else { break };
7102 val
7103 }),
7104 190u16 => Nl80211Attrs::StaSupportedOperClasses({
7105 let res = Some(next);
7106 let Some(val) = res else { break };
7107 val
7108 }),
7109 191u16 => Nl80211Attrs::HandleDfs(()),
7110 192u16 => Nl80211Attrs::Support5Mhz(()),
7111 193u16 => Nl80211Attrs::Support10Mhz(()),
7112 194u16 => Nl80211Attrs::OpmodeNotif({
7113 let res = parse_u8(next);
7114 let Some(val) = res else { break };
7115 val
7116 }),
7117 195u16 => Nl80211Attrs::VendorId({
7118 let res = parse_u32(next);
7119 let Some(val) = res else { break };
7120 val
7121 }),
7122 196u16 => Nl80211Attrs::VendorSubcmd({
7123 let res = parse_u32(next);
7124 let Some(val) = res else { break };
7125 val
7126 }),
7127 197u16 => Nl80211Attrs::VendorData({
7128 let res = Some(next);
7129 let Some(val) = res else { break };
7130 val
7131 }),
7132 198u16 => Nl80211Attrs::VendorEvents({
7133 let res = Some(next);
7134 let Some(val) = res else { break };
7135 val
7136 }),
7137 199u16 => Nl80211Attrs::QosMap({
7138 let res = Some(next);
7139 let Some(val) = res else { break };
7140 val
7141 }),
7142 200u16 => Nl80211Attrs::MacHint({
7143 let res = Some(next);
7144 let Some(val) = res else { break };
7145 val
7146 }),
7147 201u16 => Nl80211Attrs::WiphyFreqHint({
7148 let res = parse_u32(next);
7149 let Some(val) = res else { break };
7150 val
7151 }),
7152 202u16 => Nl80211Attrs::MaxApAssocSta({
7153 let res = parse_u32(next);
7154 let Some(val) = res else { break };
7155 val
7156 }),
7157 203u16 => Nl80211Attrs::TdlsPeerCapability({
7158 let res = parse_u32(next);
7159 let Some(val) = res else { break };
7160 val
7161 }),
7162 204u16 => Nl80211Attrs::SocketOwner(()),
7163 205u16 => Nl80211Attrs::CsaCOffsetsTx({
7164 let res = Some(next);
7165 let Some(val) = res else { break };
7166 val
7167 }),
7168 206u16 => Nl80211Attrs::MaxCsaCounters({
7169 let res = parse_u8(next);
7170 let Some(val) = res else { break };
7171 val
7172 }),
7173 207u16 => Nl80211Attrs::TdlsInitiator(()),
7174 208u16 => Nl80211Attrs::UseRrm(()),
7175 209u16 => Nl80211Attrs::WiphyDynAck(()),
7176 210u16 => Nl80211Attrs::Tsid({
7177 let res = parse_u8(next);
7178 let Some(val) = res else { break };
7179 val
7180 }),
7181 211u16 => Nl80211Attrs::UserPrio({
7182 let res = parse_u8(next);
7183 let Some(val) = res else { break };
7184 val
7185 }),
7186 212u16 => Nl80211Attrs::AdmittedTime({
7187 let res = parse_u16(next);
7188 let Some(val) = res else { break };
7189 val
7190 }),
7191 213u16 => Nl80211Attrs::SmpsMode({
7192 let res = parse_u8(next);
7193 let Some(val) = res else { break };
7194 val
7195 }),
7196 214u16 => Nl80211Attrs::OperClass({
7197 let res = parse_u8(next);
7198 let Some(val) = res else { break };
7199 val
7200 }),
7201 215u16 => Nl80211Attrs::MacMask({
7202 let res = Some(next);
7203 let Some(val) = res else { break };
7204 val
7205 }),
7206 216u16 => Nl80211Attrs::WiphySelfManagedReg(()),
7207 217u16 => Nl80211Attrs::ExtFeatures({
7208 let res = Some(next);
7209 let Some(val) = res else { break };
7210 val
7211 }),
7212 218u16 => Nl80211Attrs::SurveyRadioStats({
7213 let res = Some(next);
7214 let Some(val) = res else { break };
7215 val
7216 }),
7217 219u16 => Nl80211Attrs::NetnsFd({
7218 let res = parse_u32(next);
7219 let Some(val) = res else { break };
7220 val
7221 }),
7222 220u16 => Nl80211Attrs::SchedScanDelay({
7223 let res = parse_u32(next);
7224 let Some(val) = res else { break };
7225 val
7226 }),
7227 221u16 => Nl80211Attrs::RegIndoor(()),
7228 222u16 => Nl80211Attrs::MaxNumSchedScanPlans({
7229 let res = parse_u32(next);
7230 let Some(val) = res else { break };
7231 val
7232 }),
7233 223u16 => Nl80211Attrs::MaxScanPlanInterval({
7234 let res = parse_u32(next);
7235 let Some(val) = res else { break };
7236 val
7237 }),
7238 224u16 => Nl80211Attrs::MaxScanPlanIterations({
7239 let res = parse_u32(next);
7240 let Some(val) = res else { break };
7241 val
7242 }),
7243 225u16 => Nl80211Attrs::SchedScanPlans({
7244 let res = Some(next);
7245 let Some(val) = res else { break };
7246 val
7247 }),
7248 226u16 => Nl80211Attrs::Pbss(()),
7249 227u16 => Nl80211Attrs::BssSelect({
7250 let res = Some(next);
7251 let Some(val) = res else { break };
7252 val
7253 }),
7254 228u16 => Nl80211Attrs::StaSupportP2pPs({
7255 let res = parse_u8(next);
7256 let Some(val) = res else { break };
7257 val
7258 }),
7259 229u16 => Nl80211Attrs::Pad({
7260 let res = Some(next);
7261 let Some(val) = res else { break };
7262 val
7263 }),
7264 230u16 => Nl80211Attrs::IftypeExtCapa({
7265 let res = Some(next);
7266 let Some(val) = res else { break };
7267 val
7268 }),
7269 231u16 => Nl80211Attrs::MuMimoGroupData({
7270 let res = Some(next);
7271 let Some(val) = res else { break };
7272 val
7273 }),
7274 232u16 => Nl80211Attrs::MuMimoFollowMacAddr({
7275 let res = Some(next);
7276 let Some(val) = res else { break };
7277 val
7278 }),
7279 233u16 => Nl80211Attrs::ScanStartTimeTsf({
7280 let res = parse_u64(next);
7281 let Some(val) = res else { break };
7282 val
7283 }),
7284 234u16 => Nl80211Attrs::ScanStartTimeTsfBssid({
7285 let res = Some(next);
7286 let Some(val) = res else { break };
7287 val
7288 }),
7289 235u16 => Nl80211Attrs::MeasurementDuration({
7290 let res = parse_u16(next);
7291 let Some(val) = res else { break };
7292 val
7293 }),
7294 236u16 => Nl80211Attrs::MeasurementDurationMandatory(()),
7295 237u16 => Nl80211Attrs::MeshPeerAid({
7296 let res = parse_u16(next);
7297 let Some(val) = res else { break };
7298 val
7299 }),
7300 238u16 => Nl80211Attrs::NanMasterPref({
7301 let res = parse_u8(next);
7302 let Some(val) = res else { break };
7303 val
7304 }),
7305 239u16 => Nl80211Attrs::Bands({
7306 let res = parse_u32(next);
7307 let Some(val) = res else { break };
7308 val
7309 }),
7310 240u16 => Nl80211Attrs::NanFunc({
7311 let res = Some(next);
7312 let Some(val) = res else { break };
7313 val
7314 }),
7315 241u16 => Nl80211Attrs::NanMatch({
7316 let res = Some(next);
7317 let Some(val) = res else { break };
7318 val
7319 }),
7320 242u16 => Nl80211Attrs::FilsKek({
7321 let res = Some(next);
7322 let Some(val) = res else { break };
7323 val
7324 }),
7325 243u16 => Nl80211Attrs::FilsNonces({
7326 let res = Some(next);
7327 let Some(val) = res else { break };
7328 val
7329 }),
7330 244u16 => Nl80211Attrs::MulticastToUnicastEnabled(()),
7331 245u16 => Nl80211Attrs::Bssid({
7332 let res = Some(next);
7333 let Some(val) = res else { break };
7334 val
7335 }),
7336 246u16 => Nl80211Attrs::SchedScanRelativeRssi({
7337 let res = parse_i8(next);
7338 let Some(val) = res else { break };
7339 val
7340 }),
7341 247u16 => Nl80211Attrs::SchedScanRssiAdjust({
7342 let res = Some(next);
7343 let Some(val) = res else { break };
7344 val
7345 }),
7346 248u16 => Nl80211Attrs::TimeoutReason({
7347 let res = parse_u32(next);
7348 let Some(val) = res else { break };
7349 val
7350 }),
7351 249u16 => Nl80211Attrs::FilsErpUsername({
7352 let res = Some(next);
7353 let Some(val) = res else { break };
7354 val
7355 }),
7356 250u16 => Nl80211Attrs::FilsErpRealm({
7357 let res = Some(next);
7358 let Some(val) = res else { break };
7359 val
7360 }),
7361 251u16 => Nl80211Attrs::FilsErpNextSeqNum({
7362 let res = parse_u16(next);
7363 let Some(val) = res else { break };
7364 val
7365 }),
7366 252u16 => Nl80211Attrs::FilsErpRrk({
7367 let res = Some(next);
7368 let Some(val) = res else { break };
7369 val
7370 }),
7371 253u16 => Nl80211Attrs::FilsCacheId({
7372 let res = Some(next);
7373 let Some(val) = res else { break };
7374 val
7375 }),
7376 254u16 => Nl80211Attrs::Pmk({
7377 let res = Some(next);
7378 let Some(val) = res else { break };
7379 val
7380 }),
7381 255u16 => Nl80211Attrs::SchedScanMulti(()),
7382 256u16 => Nl80211Attrs::SchedScanMaxReqs({
7383 let res = parse_u32(next);
7384 let Some(val) = res else { break };
7385 val
7386 }),
7387 257u16 => Nl80211Attrs::Want1x4wayHs(()),
7388 258u16 => Nl80211Attrs::Pmkr0Name({
7389 let res = Some(next);
7390 let Some(val) = res else { break };
7391 val
7392 }),
7393 259u16 => Nl80211Attrs::PortAuthorized({
7394 let res = Some(next);
7395 let Some(val) = res else { break };
7396 val
7397 }),
7398 260u16 => Nl80211Attrs::ExternalAuthAction({
7399 let res = parse_u32(next);
7400 let Some(val) = res else { break };
7401 val
7402 }),
7403 261u16 => Nl80211Attrs::ExternalAuthSupport(()),
7404 262u16 => Nl80211Attrs::Nss({
7405 let res = parse_u8(next);
7406 let Some(val) = res else { break };
7407 val
7408 }),
7409 263u16 => Nl80211Attrs::AckSignal({
7410 let res = parse_i32(next);
7411 let Some(val) = res else { break };
7412 val
7413 }),
7414 264u16 => Nl80211Attrs::ControlPortOverNl80211(()),
7415 265u16 => Nl80211Attrs::TxqStats({
7416 let res = Some(IterableTxqStatsAttrs::with_loc(next, self.orig_loc));
7417 let Some(val) = res else { break };
7418 val
7419 }),
7420 266u16 => Nl80211Attrs::TxqLimit({
7421 let res = parse_u32(next);
7422 let Some(val) = res else { break };
7423 val
7424 }),
7425 267u16 => Nl80211Attrs::TxqMemoryLimit({
7426 let res = parse_u32(next);
7427 let Some(val) = res else { break };
7428 val
7429 }),
7430 268u16 => Nl80211Attrs::TxqQuantum({
7431 let res = parse_u32(next);
7432 let Some(val) = res else { break };
7433 val
7434 }),
7435 269u16 => Nl80211Attrs::HeCapability({
7436 let res = Some(next);
7437 let Some(val) = res else { break };
7438 val
7439 }),
7440 270u16 => Nl80211Attrs::FtmResponder({
7441 let res = Some(next);
7442 let Some(val) = res else { break };
7443 val
7444 }),
7445 271u16 => Nl80211Attrs::FtmResponderStats({
7446 let res = Some(next);
7447 let Some(val) = res else { break };
7448 val
7449 }),
7450 272u16 => Nl80211Attrs::Timeout({
7451 let res = parse_u32(next);
7452 let Some(val) = res else { break };
7453 val
7454 }),
7455 273u16 => Nl80211Attrs::PeerMeasurements({
7456 let res = Some(next);
7457 let Some(val) = res else { break };
7458 val
7459 }),
7460 274u16 => Nl80211Attrs::AirtimeWeight({
7461 let res = parse_u16(next);
7462 let Some(val) = res else { break };
7463 val
7464 }),
7465 275u16 => Nl80211Attrs::StaTxPowerSetting({
7466 let res = parse_u8(next);
7467 let Some(val) = res else { break };
7468 val
7469 }),
7470 276u16 => Nl80211Attrs::StaTxPower({
7471 let res = parse_i16(next);
7472 let Some(val) = res else { break };
7473 val
7474 }),
7475 277u16 => Nl80211Attrs::SaePassword({
7476 let res = Some(next);
7477 let Some(val) = res else { break };
7478 val
7479 }),
7480 278u16 => Nl80211Attrs::TwtResponder(()),
7481 279u16 => Nl80211Attrs::HeObssPd({
7482 let res = Some(next);
7483 let Some(val) = res else { break };
7484 val
7485 }),
7486 280u16 => Nl80211Attrs::WiphyEdmgChannels({
7487 let res = parse_u8(next);
7488 let Some(val) = res else { break };
7489 val
7490 }),
7491 281u16 => Nl80211Attrs::WiphyEdmgBwConfig({
7492 let res = parse_u8(next);
7493 let Some(val) = res else { break };
7494 val
7495 }),
7496 282u16 => Nl80211Attrs::VlanId({
7497 let res = parse_u16(next);
7498 let Some(val) = res else { break };
7499 val
7500 }),
7501 283u16 => Nl80211Attrs::HeBssColor({
7502 let res = Some(next);
7503 let Some(val) = res else { break };
7504 val
7505 }),
7506 284u16 => Nl80211Attrs::IftypeAkmSuites({
7507 let res = Some(next);
7508 let Some(val) = res else { break };
7509 val
7510 }),
7511 285u16 => Nl80211Attrs::TidConfig({
7512 let res = Some(next);
7513 let Some(val) = res else { break };
7514 val
7515 }),
7516 286u16 => Nl80211Attrs::ControlPortNoPreauth(()),
7517 287u16 => Nl80211Attrs::PmkLifetime({
7518 let res = parse_u32(next);
7519 let Some(val) = res else { break };
7520 val
7521 }),
7522 288u16 => Nl80211Attrs::PmkReauthThreshold({
7523 let res = parse_u8(next);
7524 let Some(val) = res else { break };
7525 val
7526 }),
7527 289u16 => Nl80211Attrs::ReceiveMulticast(()),
7528 290u16 => Nl80211Attrs::WiphyFreqOffset({
7529 let res = parse_u32(next);
7530 let Some(val) = res else { break };
7531 val
7532 }),
7533 291u16 => Nl80211Attrs::CenterFreq1Offset({
7534 let res = parse_u32(next);
7535 let Some(val) = res else { break };
7536 val
7537 }),
7538 292u16 => Nl80211Attrs::ScanFreqKhz({
7539 let res = Some(next);
7540 let Some(val) = res else { break };
7541 val
7542 }),
7543 293u16 => Nl80211Attrs::He6ghzCapability({
7544 let res = Some(next);
7545 let Some(val) = res else { break };
7546 val
7547 }),
7548 294u16 => Nl80211Attrs::FilsDiscovery({
7549 let res = Some(next);
7550 let Some(val) = res else { break };
7551 val
7552 }),
7553 295u16 => Nl80211Attrs::UnsolBcastProbeResp({
7554 let res = Some(next);
7555 let Some(val) = res else { break };
7556 val
7557 }),
7558 296u16 => Nl80211Attrs::S1gCapability({
7559 let res = Some(next);
7560 let Some(val) = res else { break };
7561 val
7562 }),
7563 297u16 => Nl80211Attrs::S1gCapabilityMask({
7564 let res = Some(next);
7565 let Some(val) = res else { break };
7566 val
7567 }),
7568 298u16 => Nl80211Attrs::SaePwe({
7569 let res = parse_u8(next);
7570 let Some(val) = res else { break };
7571 val
7572 }),
7573 299u16 => Nl80211Attrs::ReconnectRequested({
7574 let res = Some(next);
7575 let Some(val) = res else { break };
7576 val
7577 }),
7578 300u16 => Nl80211Attrs::SarSpec({
7579 let res = Some(IterableSarAttributes::with_loc(next, self.orig_loc));
7580 let Some(val) = res else { break };
7581 val
7582 }),
7583 301u16 => Nl80211Attrs::DisableHe(()),
7584 302u16 => Nl80211Attrs::ObssColorBitmap({
7585 let res = parse_u64(next);
7586 let Some(val) = res else { break };
7587 val
7588 }),
7589 303u16 => Nl80211Attrs::ColorChangeCount({
7590 let res = parse_u8(next);
7591 let Some(val) = res else { break };
7592 val
7593 }),
7594 304u16 => Nl80211Attrs::ColorChangeColor({
7595 let res = parse_u8(next);
7596 let Some(val) = res else { break };
7597 val
7598 }),
7599 305u16 => Nl80211Attrs::ColorChangeElems({
7600 let res = Some(next);
7601 let Some(val) = res else { break };
7602 val
7603 }),
7604 306u16 => Nl80211Attrs::MbssidConfig({
7605 let res = Some(next);
7606 let Some(val) = res else { break };
7607 val
7608 }),
7609 307u16 => Nl80211Attrs::MbssidElems({
7610 let res = Some(next);
7611 let Some(val) = res else { break };
7612 val
7613 }),
7614 308u16 => Nl80211Attrs::RadarBackground(()),
7615 309u16 => Nl80211Attrs::ApSettingsFlags({
7616 let res = parse_u32(next);
7617 let Some(val) = res else { break };
7618 val
7619 }),
7620 310u16 => Nl80211Attrs::EhtCapability({
7621 let res = Some(next);
7622 let Some(val) = res else { break };
7623 val
7624 }),
7625 311u16 => Nl80211Attrs::DisableEht(()),
7626 312u16 => Nl80211Attrs::MloLinks({
7627 let res = Some(next);
7628 let Some(val) = res else { break };
7629 val
7630 }),
7631 313u16 => Nl80211Attrs::MloLinkId({
7632 let res = parse_u8(next);
7633 let Some(val) = res else { break };
7634 val
7635 }),
7636 314u16 => Nl80211Attrs::MldAddr({
7637 let res = Some(next);
7638 let Some(val) = res else { break };
7639 val
7640 }),
7641 315u16 => Nl80211Attrs::MloSupport(()),
7642 316u16 => Nl80211Attrs::MaxNumAkmSuites({
7643 let res = Some(next);
7644 let Some(val) = res else { break };
7645 val
7646 }),
7647 317u16 => Nl80211Attrs::EmlCapability({
7648 let res = parse_u16(next);
7649 let Some(val) = res else { break };
7650 val
7651 }),
7652 318u16 => Nl80211Attrs::MldCapaAndOps({
7653 let res = parse_u16(next);
7654 let Some(val) = res else { break };
7655 val
7656 }),
7657 319u16 => Nl80211Attrs::TxHwTimestamp({
7658 let res = parse_u64(next);
7659 let Some(val) = res else { break };
7660 val
7661 }),
7662 320u16 => Nl80211Attrs::RxHwTimestamp({
7663 let res = parse_u64(next);
7664 let Some(val) = res else { break };
7665 val
7666 }),
7667 321u16 => Nl80211Attrs::TdBitmap({
7668 let res = Some(next);
7669 let Some(val) = res else { break };
7670 val
7671 }),
7672 322u16 => Nl80211Attrs::PunctBitmap({
7673 let res = parse_u32(next);
7674 let Some(val) = res else { break };
7675 val
7676 }),
7677 323u16 => Nl80211Attrs::MaxHwTimestampPeers({
7678 let res = parse_u16(next);
7679 let Some(val) = res else { break };
7680 val
7681 }),
7682 324u16 => Nl80211Attrs::HwTimestampEnabled(()),
7683 325u16 => Nl80211Attrs::EmaRnrElems({
7684 let res = Some(next);
7685 let Some(val) = res else { break };
7686 val
7687 }),
7688 326u16 => Nl80211Attrs::MloLinkDisabled(()),
7689 327u16 => Nl80211Attrs::BssDumpIncludeUseData(()),
7690 328u16 => Nl80211Attrs::MloTtlmDlink({
7691 let res = parse_u16(next);
7692 let Some(val) = res else { break };
7693 val
7694 }),
7695 329u16 => Nl80211Attrs::MloTtlmUlink({
7696 let res = parse_u16(next);
7697 let Some(val) = res else { break };
7698 val
7699 }),
7700 330u16 => Nl80211Attrs::AssocSppAmsdu(()),
7701 331u16 => Nl80211Attrs::WiphyRadios({
7702 let res = Some(next);
7703 let Some(val) = res else { break };
7704 val
7705 }),
7706 332u16 => Nl80211Attrs::WiphyInterfaceCombinations({
7707 let res = Some(next);
7708 let Some(val) = res else { break };
7709 val
7710 }),
7711 333u16 => Nl80211Attrs::VifRadioMask({
7712 let res = parse_u32(next);
7713 let Some(val) = res else { break };
7714 val
7715 }),
7716 n => {
7717 if cfg!(any(test, feature = "deny-unknown-attrs")) {
7718 break;
7719 } else {
7720 continue;
7721 }
7722 }
7723 };
7724 return Some(Ok(res));
7725 }
7726 Some(Err(ErrorContext::new(
7727 "Nl80211Attrs",
7728 r#type.and_then(|t| Nl80211Attrs::attr_from_type(t)),
7729 self.orig_loc,
7730 self.buf.as_ptr().wrapping_add(pos) as usize,
7731 )))
7732 }
7733}
7734impl std::fmt::Debug for IterableArrayU32<'_> {
7735 fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7736 fmt.debug_list()
7737 .entries(self.clone().map(FlattenErrorContext))
7738 .finish()
7739 }
7740}
7741impl std::fmt::Debug for IterableArrayIfCombinationAttributes<'_> {
7742 fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7743 fmt.debug_list()
7744 .entries(self.clone().map(FlattenErrorContext))
7745 .finish()
7746 }
7747}
7748impl<'a> std::fmt::Debug for IterableNl80211Attrs<'_> {
7749 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
7750 let mut fmt = f.debug_struct("Nl80211Attrs");
7751 for attr in self.clone() {
7752 let attr = match attr {
7753 Ok(a) => a,
7754 Err(err) => {
7755 fmt.finish()?;
7756 f.write_str("Err(")?;
7757 err.fmt(f)?;
7758 return f.write_str(")");
7759 }
7760 };
7761 match attr {
7762 Nl80211Attrs::Wiphy(val) => fmt.field("Wiphy", &val),
7763 Nl80211Attrs::WiphyName(val) => fmt.field("WiphyName", &val),
7764 Nl80211Attrs::Ifindex(val) => fmt.field("Ifindex", &val),
7765 Nl80211Attrs::Ifname(val) => fmt.field("Ifname", &val),
7766 Nl80211Attrs::Iftype(val) => fmt.field("Iftype", &val),
7767 Nl80211Attrs::Mac(val) => fmt.field("Mac", &val),
7768 Nl80211Attrs::KeyData(val) => fmt.field("KeyData", &val),
7769 Nl80211Attrs::KeyIdx(val) => fmt.field("KeyIdx", &val),
7770 Nl80211Attrs::KeyCipher(val) => fmt.field("KeyCipher", &val),
7771 Nl80211Attrs::KeySeq(val) => fmt.field("KeySeq", &val),
7772 Nl80211Attrs::KeyDefault(val) => fmt.field("KeyDefault", &val),
7773 Nl80211Attrs::BeaconInterval(val) => fmt.field("BeaconInterval", &val),
7774 Nl80211Attrs::DtimPeriod(val) => fmt.field("DtimPeriod", &val),
7775 Nl80211Attrs::BeaconHead(val) => fmt.field("BeaconHead", &val),
7776 Nl80211Attrs::BeaconTail(val) => fmt.field("BeaconTail", &val),
7777 Nl80211Attrs::StaAid(val) => fmt.field("StaAid", &val),
7778 Nl80211Attrs::StaFlags(val) => fmt.field("StaFlags", &val),
7779 Nl80211Attrs::StaListenInterval(val) => fmt.field("StaListenInterval", &val),
7780 Nl80211Attrs::StaSupportedRates(val) => fmt.field("StaSupportedRates", &val),
7781 Nl80211Attrs::StaVlan(val) => fmt.field("StaVlan", &val),
7782 Nl80211Attrs::StaInfo(val) => fmt.field("StaInfo", &val),
7783 Nl80211Attrs::WiphyBands(val) => fmt.field("WiphyBands", &val),
7784 Nl80211Attrs::MntrFlags(val) => fmt.field("MntrFlags", &val),
7785 Nl80211Attrs::MeshId(val) => fmt.field("MeshId", &val),
7786 Nl80211Attrs::StaPlinkAction(val) => fmt.field("StaPlinkAction", &val),
7787 Nl80211Attrs::MpathNextHop(val) => fmt.field("MpathNextHop", &val),
7788 Nl80211Attrs::MpathInfo(val) => fmt.field("MpathInfo", &val),
7789 Nl80211Attrs::BssCtsProt(val) => fmt.field("BssCtsProt", &val),
7790 Nl80211Attrs::BssShortPreamble(val) => fmt.field("BssShortPreamble", &val),
7791 Nl80211Attrs::BssShortSlotTime(val) => fmt.field("BssShortSlotTime", &val),
7792 Nl80211Attrs::HtCapability(val) => fmt.field("HtCapability", &val),
7793 Nl80211Attrs::SupportedIftypes(val) => fmt.field("SupportedIftypes", &val),
7794 Nl80211Attrs::RegAlpha2(val) => fmt.field("RegAlpha2", &val),
7795 Nl80211Attrs::RegRules(val) => fmt.field("RegRules", &val),
7796 Nl80211Attrs::MeshConfig(val) => fmt.field("MeshConfig", &val),
7797 Nl80211Attrs::BssBasicRates(val) => fmt.field("BssBasicRates", &val),
7798 Nl80211Attrs::WiphyTxqParams(val) => fmt.field("WiphyTxqParams", &val),
7799 Nl80211Attrs::WiphyFreq(val) => fmt.field("WiphyFreq", &val),
7800 Nl80211Attrs::WiphyChannelType(val) => fmt.field(
7801 "WiphyChannelType",
7802 &FormatEnum(val.into(), ChannelType::from_value),
7803 ),
7804 Nl80211Attrs::KeyDefaultMgmt(val) => fmt.field("KeyDefaultMgmt", &val),
7805 Nl80211Attrs::MgmtSubtype(val) => fmt.field("MgmtSubtype", &val),
7806 Nl80211Attrs::Ie(val) => fmt.field("Ie", &val),
7807 Nl80211Attrs::MaxNumScanSsids(val) => fmt.field("MaxNumScanSsids", &val),
7808 Nl80211Attrs::ScanFrequencies(val) => fmt.field("ScanFrequencies", &val),
7809 Nl80211Attrs::ScanSsids(val) => fmt.field("ScanSsids", &val),
7810 Nl80211Attrs::Generation(val) => fmt.field("Generation", &val),
7811 Nl80211Attrs::Bss(val) => fmt.field("Bss", &val),
7812 Nl80211Attrs::RegInitiator(val) => fmt.field("RegInitiator", &val),
7813 Nl80211Attrs::RegType(val) => fmt.field("RegType", &val),
7814 Nl80211Attrs::SupportedCommands(val) => fmt.field(
7815 "SupportedCommands",
7816 &MapFormatArray(val, |v| FormatEnum(v.into(), Commands::from_value)),
7817 ),
7818 Nl80211Attrs::Frame(val) => fmt.field("Frame", &val),
7819 Nl80211Attrs::Ssid(val) => fmt.field("Ssid", &val),
7820 Nl80211Attrs::AuthType(val) => fmt.field("AuthType", &val),
7821 Nl80211Attrs::ReasonCode(val) => fmt.field("ReasonCode", &val),
7822 Nl80211Attrs::KeyType(val) => fmt.field("KeyType", &val),
7823 Nl80211Attrs::MaxScanIeLen(val) => fmt.field("MaxScanIeLen", &val),
7824 Nl80211Attrs::CipherSuites(val) => fmt.field("CipherSuites", &FormatHex(val)),
7825 Nl80211Attrs::FreqBefore(val) => fmt.field("FreqBefore", &val),
7826 Nl80211Attrs::FreqAfter(val) => fmt.field("FreqAfter", &val),
7827 Nl80211Attrs::FreqFixed(val) => fmt.field("FreqFixed", &val),
7828 Nl80211Attrs::WiphyRetryShort(val) => fmt.field("WiphyRetryShort", &val),
7829 Nl80211Attrs::WiphyRetryLong(val) => fmt.field("WiphyRetryLong", &val),
7830 Nl80211Attrs::WiphyFragThreshold(val) => fmt.field("WiphyFragThreshold", &val),
7831 Nl80211Attrs::WiphyRtsThreshold(val) => fmt.field("WiphyRtsThreshold", &val),
7832 Nl80211Attrs::TimedOut(val) => fmt.field("TimedOut", &val),
7833 Nl80211Attrs::UseMfp(val) => fmt.field("UseMfp", &val),
7834 Nl80211Attrs::StaFlags2(val) => fmt.field("StaFlags2", &val),
7835 Nl80211Attrs::ControlPort(val) => fmt.field("ControlPort", &val),
7836 Nl80211Attrs::Testdata(val) => fmt.field("Testdata", &val),
7837 Nl80211Attrs::Privacy(val) => fmt.field("Privacy", &val),
7838 Nl80211Attrs::DisconnectedByAp(val) => fmt.field("DisconnectedByAp", &val),
7839 Nl80211Attrs::StatusCode(val) => fmt.field("StatusCode", &val),
7840 Nl80211Attrs::CipherSuitesPairwise(val) => fmt.field("CipherSuitesPairwise", &val),
7841 Nl80211Attrs::CipherSuiteGroup(val) => fmt.field("CipherSuiteGroup", &val),
7842 Nl80211Attrs::WpaVersions(val) => fmt.field("WpaVersions", &val),
7843 Nl80211Attrs::AkmSuites(val) => fmt.field("AkmSuites", &val),
7844 Nl80211Attrs::ReqIe(val) => fmt.field("ReqIe", &val),
7845 Nl80211Attrs::RespIe(val) => fmt.field("RespIe", &val),
7846 Nl80211Attrs::PrevBssid(val) => fmt.field("PrevBssid", &val),
7847 Nl80211Attrs::Key(val) => fmt.field("Key", &val),
7848 Nl80211Attrs::Keys(val) => fmt.field("Keys", &val),
7849 Nl80211Attrs::Pid(val) => fmt.field("Pid", &val),
7850 Nl80211Attrs::_4addr(val) => fmt.field("_4addr", &val),
7851 Nl80211Attrs::SurveyInfo(val) => fmt.field("SurveyInfo", &val),
7852 Nl80211Attrs::Pmkid(val) => fmt.field("Pmkid", &val),
7853 Nl80211Attrs::MaxNumPmkids(val) => fmt.field("MaxNumPmkids", &val),
7854 Nl80211Attrs::Duration(val) => fmt.field("Duration", &val),
7855 Nl80211Attrs::Cookie(val) => fmt.field("Cookie", &val),
7856 Nl80211Attrs::WiphyCoverageClass(val) => fmt.field("WiphyCoverageClass", &val),
7857 Nl80211Attrs::TxRates(val) => fmt.field("TxRates", &val),
7858 Nl80211Attrs::FrameMatch(val) => fmt.field("FrameMatch", &val),
7859 Nl80211Attrs::Ack(val) => fmt.field("Ack", &val),
7860 Nl80211Attrs::PsState(val) => fmt.field("PsState", &val),
7861 Nl80211Attrs::Cqm(val) => fmt.field("Cqm", &val),
7862 Nl80211Attrs::LocalStateChange(val) => fmt.field("LocalStateChange", &val),
7863 Nl80211Attrs::ApIsolate(val) => fmt.field("ApIsolate", &val),
7864 Nl80211Attrs::WiphyTxPowerSetting(val) => fmt.field("WiphyTxPowerSetting", &val),
7865 Nl80211Attrs::WiphyTxPowerLevel(val) => fmt.field("WiphyTxPowerLevel", &val),
7866 Nl80211Attrs::TxFrameTypes(val) => fmt.field("TxFrameTypes", &val),
7867 Nl80211Attrs::RxFrameTypes(val) => fmt.field("RxFrameTypes", &val),
7868 Nl80211Attrs::FrameType(val) => fmt.field("FrameType", &val),
7869 Nl80211Attrs::ControlPortEthertype(val) => fmt.field("ControlPortEthertype", &val),
7870 Nl80211Attrs::ControlPortNoEncrypt(val) => fmt.field("ControlPortNoEncrypt", &val),
7871 Nl80211Attrs::SupportIbssRsn(val) => fmt.field("SupportIbssRsn", &val),
7872 Nl80211Attrs::WiphyAntennaTx(val) => fmt.field("WiphyAntennaTx", &val),
7873 Nl80211Attrs::WiphyAntennaRx(val) => fmt.field("WiphyAntennaRx", &val),
7874 Nl80211Attrs::McastRate(val) => fmt.field("McastRate", &val),
7875 Nl80211Attrs::OffchannelTxOk(val) => fmt.field("OffchannelTxOk", &val),
7876 Nl80211Attrs::BssHtOpmode(val) => fmt.field("BssHtOpmode", &val),
7877 Nl80211Attrs::KeyDefaultTypes(val) => fmt.field("KeyDefaultTypes", &val),
7878 Nl80211Attrs::MaxRemainOnChannelDuration(val) => {
7879 fmt.field("MaxRemainOnChannelDuration", &val)
7880 }
7881 Nl80211Attrs::MeshSetup(val) => fmt.field("MeshSetup", &val),
7882 Nl80211Attrs::WiphyAntennaAvailTx(val) => fmt.field("WiphyAntennaAvailTx", &val),
7883 Nl80211Attrs::WiphyAntennaAvailRx(val) => fmt.field("WiphyAntennaAvailRx", &val),
7884 Nl80211Attrs::SupportMeshAuth(val) => fmt.field("SupportMeshAuth", &val),
7885 Nl80211Attrs::StaPlinkState(val) => fmt.field("StaPlinkState", &val),
7886 Nl80211Attrs::WowlanTriggers(val) => fmt.field("WowlanTriggers", &val),
7887 Nl80211Attrs::WowlanTriggersSupported(val) => {
7888 fmt.field("WowlanTriggersSupported", &val)
7889 }
7890 Nl80211Attrs::SchedScanInterval(val) => fmt.field("SchedScanInterval", &val),
7891 Nl80211Attrs::InterfaceCombinations(val) => {
7892 fmt.field("InterfaceCombinations", &val)
7893 }
7894 Nl80211Attrs::SoftwareIftypes(val) => fmt.field("SoftwareIftypes", &val),
7895 Nl80211Attrs::RekeyData(val) => fmt.field("RekeyData", &val),
7896 Nl80211Attrs::MaxNumSchedScanSsids(val) => fmt.field("MaxNumSchedScanSsids", &val),
7897 Nl80211Attrs::MaxSchedScanIeLen(val) => fmt.field("MaxSchedScanIeLen", &val),
7898 Nl80211Attrs::ScanSuppRates(val) => fmt.field("ScanSuppRates", &val),
7899 Nl80211Attrs::HiddenSsid(val) => fmt.field("HiddenSsid", &val),
7900 Nl80211Attrs::IeProbeResp(val) => fmt.field("IeProbeResp", &val),
7901 Nl80211Attrs::IeAssocResp(val) => fmt.field("IeAssocResp", &val),
7902 Nl80211Attrs::StaWme(val) => fmt.field("StaWme", &val),
7903 Nl80211Attrs::SupportApUapsd(val) => fmt.field("SupportApUapsd", &val),
7904 Nl80211Attrs::RoamSupport(val) => fmt.field("RoamSupport", &val),
7905 Nl80211Attrs::SchedScanMatch(val) => fmt.field("SchedScanMatch", &val),
7906 Nl80211Attrs::MaxMatchSets(val) => fmt.field("MaxMatchSets", &val),
7907 Nl80211Attrs::PmksaCandidate(val) => fmt.field("PmksaCandidate", &val),
7908 Nl80211Attrs::TxNoCckRate(val) => fmt.field("TxNoCckRate", &val),
7909 Nl80211Attrs::TdlsAction(val) => fmt.field("TdlsAction", &val),
7910 Nl80211Attrs::TdlsDialogToken(val) => fmt.field("TdlsDialogToken", &val),
7911 Nl80211Attrs::TdlsOperation(val) => fmt.field("TdlsOperation", &val),
7912 Nl80211Attrs::TdlsSupport(val) => fmt.field("TdlsSupport", &val),
7913 Nl80211Attrs::TdlsExternalSetup(val) => fmt.field("TdlsExternalSetup", &val),
7914 Nl80211Attrs::DeviceApSme(val) => fmt.field("DeviceApSme", &val),
7915 Nl80211Attrs::DontWaitForAck(val) => fmt.field("DontWaitForAck", &val),
7916 Nl80211Attrs::FeatureFlags(val) => fmt.field(
7917 "FeatureFlags",
7918 &FormatFlags(val.into(), FeatureFlags::from_value),
7919 ),
7920 Nl80211Attrs::ProbeRespOffload(val) => fmt.field("ProbeRespOffload", &val),
7921 Nl80211Attrs::ProbeResp(val) => fmt.field("ProbeResp", &val),
7922 Nl80211Attrs::DfsRegion(val) => fmt.field("DfsRegion", &val),
7923 Nl80211Attrs::DisableHt(val) => fmt.field("DisableHt", &val),
7924 Nl80211Attrs::HtCapabilityMask(val) => fmt.field("HtCapabilityMask", &val),
7925 Nl80211Attrs::NoackMap(val) => fmt.field("NoackMap", &val),
7926 Nl80211Attrs::InactivityTimeout(val) => fmt.field("InactivityTimeout", &val),
7927 Nl80211Attrs::RxSignalDbm(val) => fmt.field("RxSignalDbm", &val),
7928 Nl80211Attrs::BgScanPeriod(val) => fmt.field("BgScanPeriod", &val),
7929 Nl80211Attrs::Wdev(val) => fmt.field("Wdev", &val),
7930 Nl80211Attrs::UserRegHintType(val) => fmt.field("UserRegHintType", &val),
7931 Nl80211Attrs::ConnFailedReason(val) => fmt.field("ConnFailedReason", &val),
7932 Nl80211Attrs::AuthData(val) => fmt.field("AuthData", &val),
7933 Nl80211Attrs::VhtCapability(val) => fmt.field("VhtCapability", &val),
7934 Nl80211Attrs::ScanFlags(val) => fmt.field("ScanFlags", &val),
7935 Nl80211Attrs::ChannelWidth(val) => fmt.field("ChannelWidth", &val),
7936 Nl80211Attrs::CenterFreq1(val) => fmt.field("CenterFreq1", &val),
7937 Nl80211Attrs::CenterFreq2(val) => fmt.field("CenterFreq2", &val),
7938 Nl80211Attrs::P2pCtwindow(val) => fmt.field("P2pCtwindow", &val),
7939 Nl80211Attrs::P2pOppps(val) => fmt.field("P2pOppps", &val),
7940 Nl80211Attrs::LocalMeshPowerMode(val) => fmt.field("LocalMeshPowerMode", &val),
7941 Nl80211Attrs::AclPolicy(val) => fmt.field("AclPolicy", &val),
7942 Nl80211Attrs::MacAddrs(val) => fmt.field("MacAddrs", &val),
7943 Nl80211Attrs::MacAclMax(val) => fmt.field("MacAclMax", &val),
7944 Nl80211Attrs::RadarEvent(val) => fmt.field("RadarEvent", &val),
7945 Nl80211Attrs::ExtCapa(val) => fmt.field("ExtCapa", &val),
7946 Nl80211Attrs::ExtCapaMask(val) => fmt.field("ExtCapaMask", &val),
7947 Nl80211Attrs::StaCapability(val) => fmt.field("StaCapability", &val),
7948 Nl80211Attrs::StaExtCapability(val) => fmt.field("StaExtCapability", &val),
7949 Nl80211Attrs::ProtocolFeatures(val) => fmt.field(
7950 "ProtocolFeatures",
7951 &FormatFlags(val.into(), ProtocolFeatures::from_value),
7952 ),
7953 Nl80211Attrs::SplitWiphyDump(val) => fmt.field("SplitWiphyDump", &val),
7954 Nl80211Attrs::DisableVht(val) => fmt.field("DisableVht", &val),
7955 Nl80211Attrs::VhtCapabilityMask(val) => fmt.field("VhtCapabilityMask", &val),
7956 Nl80211Attrs::Mdid(val) => fmt.field("Mdid", &val),
7957 Nl80211Attrs::IeRic(val) => fmt.field("IeRic", &val),
7958 Nl80211Attrs::CritProtId(val) => fmt.field("CritProtId", &val),
7959 Nl80211Attrs::MaxCritProtDuration(val) => fmt.field("MaxCritProtDuration", &val),
7960 Nl80211Attrs::PeerAid(val) => fmt.field("PeerAid", &val),
7961 Nl80211Attrs::CoalesceRule(val) => fmt.field("CoalesceRule", &val),
7962 Nl80211Attrs::ChSwitchCount(val) => fmt.field("ChSwitchCount", &val),
7963 Nl80211Attrs::ChSwitchBlockTx(val) => fmt.field("ChSwitchBlockTx", &val),
7964 Nl80211Attrs::CsaIes(val) => fmt.field("CsaIes", &val),
7965 Nl80211Attrs::CntdwnOffsBeacon(val) => fmt.field("CntdwnOffsBeacon", &val),
7966 Nl80211Attrs::CntdwnOffsPresp(val) => fmt.field("CntdwnOffsPresp", &val),
7967 Nl80211Attrs::RxmgmtFlags(val) => fmt.field("RxmgmtFlags", &val),
7968 Nl80211Attrs::StaSupportedChannels(val) => fmt.field("StaSupportedChannels", &val),
7969 Nl80211Attrs::StaSupportedOperClasses(val) => {
7970 fmt.field("StaSupportedOperClasses", &val)
7971 }
7972 Nl80211Attrs::HandleDfs(val) => fmt.field("HandleDfs", &val),
7973 Nl80211Attrs::Support5Mhz(val) => fmt.field("Support5Mhz", &val),
7974 Nl80211Attrs::Support10Mhz(val) => fmt.field("Support10Mhz", &val),
7975 Nl80211Attrs::OpmodeNotif(val) => fmt.field("OpmodeNotif", &val),
7976 Nl80211Attrs::VendorId(val) => fmt.field("VendorId", &val),
7977 Nl80211Attrs::VendorSubcmd(val) => fmt.field("VendorSubcmd", &val),
7978 Nl80211Attrs::VendorData(val) => fmt.field("VendorData", &val),
7979 Nl80211Attrs::VendorEvents(val) => fmt.field("VendorEvents", &val),
7980 Nl80211Attrs::QosMap(val) => fmt.field("QosMap", &val),
7981 Nl80211Attrs::MacHint(val) => fmt.field("MacHint", &val),
7982 Nl80211Attrs::WiphyFreqHint(val) => fmt.field("WiphyFreqHint", &val),
7983 Nl80211Attrs::MaxApAssocSta(val) => fmt.field("MaxApAssocSta", &val),
7984 Nl80211Attrs::TdlsPeerCapability(val) => fmt.field("TdlsPeerCapability", &val),
7985 Nl80211Attrs::SocketOwner(val) => fmt.field("SocketOwner", &val),
7986 Nl80211Attrs::CsaCOffsetsTx(val) => fmt.field("CsaCOffsetsTx", &val),
7987 Nl80211Attrs::MaxCsaCounters(val) => fmt.field("MaxCsaCounters", &val),
7988 Nl80211Attrs::TdlsInitiator(val) => fmt.field("TdlsInitiator", &val),
7989 Nl80211Attrs::UseRrm(val) => fmt.field("UseRrm", &val),
7990 Nl80211Attrs::WiphyDynAck(val) => fmt.field("WiphyDynAck", &val),
7991 Nl80211Attrs::Tsid(val) => fmt.field("Tsid", &val),
7992 Nl80211Attrs::UserPrio(val) => fmt.field("UserPrio", &val),
7993 Nl80211Attrs::AdmittedTime(val) => fmt.field("AdmittedTime", &val),
7994 Nl80211Attrs::SmpsMode(val) => fmt.field("SmpsMode", &val),
7995 Nl80211Attrs::OperClass(val) => fmt.field("OperClass", &val),
7996 Nl80211Attrs::MacMask(val) => fmt.field("MacMask", &val),
7997 Nl80211Attrs::WiphySelfManagedReg(val) => fmt.field("WiphySelfManagedReg", &val),
7998 Nl80211Attrs::ExtFeatures(val) => fmt.field("ExtFeatures", &val),
7999 Nl80211Attrs::SurveyRadioStats(val) => fmt.field("SurveyRadioStats", &val),
8000 Nl80211Attrs::NetnsFd(val) => fmt.field("NetnsFd", &val),
8001 Nl80211Attrs::SchedScanDelay(val) => fmt.field("SchedScanDelay", &val),
8002 Nl80211Attrs::RegIndoor(val) => fmt.field("RegIndoor", &val),
8003 Nl80211Attrs::MaxNumSchedScanPlans(val) => fmt.field("MaxNumSchedScanPlans", &val),
8004 Nl80211Attrs::MaxScanPlanInterval(val) => fmt.field("MaxScanPlanInterval", &val),
8005 Nl80211Attrs::MaxScanPlanIterations(val) => {
8006 fmt.field("MaxScanPlanIterations", &val)
8007 }
8008 Nl80211Attrs::SchedScanPlans(val) => fmt.field("SchedScanPlans", &val),
8009 Nl80211Attrs::Pbss(val) => fmt.field("Pbss", &val),
8010 Nl80211Attrs::BssSelect(val) => fmt.field("BssSelect", &val),
8011 Nl80211Attrs::StaSupportP2pPs(val) => fmt.field("StaSupportP2pPs", &val),
8012 Nl80211Attrs::Pad(val) => fmt.field("Pad", &val),
8013 Nl80211Attrs::IftypeExtCapa(val) => fmt.field("IftypeExtCapa", &val),
8014 Nl80211Attrs::MuMimoGroupData(val) => fmt.field("MuMimoGroupData", &val),
8015 Nl80211Attrs::MuMimoFollowMacAddr(val) => fmt.field("MuMimoFollowMacAddr", &val),
8016 Nl80211Attrs::ScanStartTimeTsf(val) => fmt.field("ScanStartTimeTsf", &val),
8017 Nl80211Attrs::ScanStartTimeTsfBssid(val) => {
8018 fmt.field("ScanStartTimeTsfBssid", &val)
8019 }
8020 Nl80211Attrs::MeasurementDuration(val) => fmt.field("MeasurementDuration", &val),
8021 Nl80211Attrs::MeasurementDurationMandatory(val) => {
8022 fmt.field("MeasurementDurationMandatory", &val)
8023 }
8024 Nl80211Attrs::MeshPeerAid(val) => fmt.field("MeshPeerAid", &val),
8025 Nl80211Attrs::NanMasterPref(val) => fmt.field("NanMasterPref", &val),
8026 Nl80211Attrs::Bands(val) => fmt.field("Bands", &val),
8027 Nl80211Attrs::NanFunc(val) => fmt.field("NanFunc", &val),
8028 Nl80211Attrs::NanMatch(val) => fmt.field("NanMatch", &val),
8029 Nl80211Attrs::FilsKek(val) => fmt.field("FilsKek", &val),
8030 Nl80211Attrs::FilsNonces(val) => fmt.field("FilsNonces", &val),
8031 Nl80211Attrs::MulticastToUnicastEnabled(val) => {
8032 fmt.field("MulticastToUnicastEnabled", &val)
8033 }
8034 Nl80211Attrs::Bssid(val) => fmt.field("Bssid", &val),
8035 Nl80211Attrs::SchedScanRelativeRssi(val) => {
8036 fmt.field("SchedScanRelativeRssi", &val)
8037 }
8038 Nl80211Attrs::SchedScanRssiAdjust(val) => fmt.field("SchedScanRssiAdjust", &val),
8039 Nl80211Attrs::TimeoutReason(val) => fmt.field("TimeoutReason", &val),
8040 Nl80211Attrs::FilsErpUsername(val) => fmt.field("FilsErpUsername", &val),
8041 Nl80211Attrs::FilsErpRealm(val) => fmt.field("FilsErpRealm", &val),
8042 Nl80211Attrs::FilsErpNextSeqNum(val) => fmt.field("FilsErpNextSeqNum", &val),
8043 Nl80211Attrs::FilsErpRrk(val) => fmt.field("FilsErpRrk", &val),
8044 Nl80211Attrs::FilsCacheId(val) => fmt.field("FilsCacheId", &val),
8045 Nl80211Attrs::Pmk(val) => fmt.field("Pmk", &val),
8046 Nl80211Attrs::SchedScanMulti(val) => fmt.field("SchedScanMulti", &val),
8047 Nl80211Attrs::SchedScanMaxReqs(val) => fmt.field("SchedScanMaxReqs", &val),
8048 Nl80211Attrs::Want1x4wayHs(val) => fmt.field("Want1x4wayHs", &val),
8049 Nl80211Attrs::Pmkr0Name(val) => fmt.field("Pmkr0Name", &val),
8050 Nl80211Attrs::PortAuthorized(val) => fmt.field("PortAuthorized", &val),
8051 Nl80211Attrs::ExternalAuthAction(val) => fmt.field("ExternalAuthAction", &val),
8052 Nl80211Attrs::ExternalAuthSupport(val) => fmt.field("ExternalAuthSupport", &val),
8053 Nl80211Attrs::Nss(val) => fmt.field("Nss", &val),
8054 Nl80211Attrs::AckSignal(val) => fmt.field("AckSignal", &val),
8055 Nl80211Attrs::ControlPortOverNl80211(val) => {
8056 fmt.field("ControlPortOverNl80211", &val)
8057 }
8058 Nl80211Attrs::TxqStats(val) => fmt.field("TxqStats", &val),
8059 Nl80211Attrs::TxqLimit(val) => fmt.field("TxqLimit", &val),
8060 Nl80211Attrs::TxqMemoryLimit(val) => fmt.field("TxqMemoryLimit", &val),
8061 Nl80211Attrs::TxqQuantum(val) => fmt.field("TxqQuantum", &val),
8062 Nl80211Attrs::HeCapability(val) => fmt.field("HeCapability", &val),
8063 Nl80211Attrs::FtmResponder(val) => fmt.field("FtmResponder", &val),
8064 Nl80211Attrs::FtmResponderStats(val) => fmt.field("FtmResponderStats", &val),
8065 Nl80211Attrs::Timeout(val) => fmt.field("Timeout", &val),
8066 Nl80211Attrs::PeerMeasurements(val) => fmt.field("PeerMeasurements", &val),
8067 Nl80211Attrs::AirtimeWeight(val) => fmt.field("AirtimeWeight", &val),
8068 Nl80211Attrs::StaTxPowerSetting(val) => fmt.field("StaTxPowerSetting", &val),
8069 Nl80211Attrs::StaTxPower(val) => fmt.field("StaTxPower", &val),
8070 Nl80211Attrs::SaePassword(val) => fmt.field("SaePassword", &val),
8071 Nl80211Attrs::TwtResponder(val) => fmt.field("TwtResponder", &val),
8072 Nl80211Attrs::HeObssPd(val) => fmt.field("HeObssPd", &val),
8073 Nl80211Attrs::WiphyEdmgChannels(val) => fmt.field("WiphyEdmgChannels", &val),
8074 Nl80211Attrs::WiphyEdmgBwConfig(val) => fmt.field("WiphyEdmgBwConfig", &val),
8075 Nl80211Attrs::VlanId(val) => fmt.field("VlanId", &val),
8076 Nl80211Attrs::HeBssColor(val) => fmt.field("HeBssColor", &val),
8077 Nl80211Attrs::IftypeAkmSuites(val) => fmt.field("IftypeAkmSuites", &val),
8078 Nl80211Attrs::TidConfig(val) => fmt.field("TidConfig", &val),
8079 Nl80211Attrs::ControlPortNoPreauth(val) => fmt.field("ControlPortNoPreauth", &val),
8080 Nl80211Attrs::PmkLifetime(val) => fmt.field("PmkLifetime", &val),
8081 Nl80211Attrs::PmkReauthThreshold(val) => fmt.field("PmkReauthThreshold", &val),
8082 Nl80211Attrs::ReceiveMulticast(val) => fmt.field("ReceiveMulticast", &val),
8083 Nl80211Attrs::WiphyFreqOffset(val) => fmt.field("WiphyFreqOffset", &val),
8084 Nl80211Attrs::CenterFreq1Offset(val) => fmt.field("CenterFreq1Offset", &val),
8085 Nl80211Attrs::ScanFreqKhz(val) => fmt.field("ScanFreqKhz", &val),
8086 Nl80211Attrs::He6ghzCapability(val) => fmt.field("He6ghzCapability", &val),
8087 Nl80211Attrs::FilsDiscovery(val) => fmt.field("FilsDiscovery", &val),
8088 Nl80211Attrs::UnsolBcastProbeResp(val) => fmt.field("UnsolBcastProbeResp", &val),
8089 Nl80211Attrs::S1gCapability(val) => fmt.field("S1gCapability", &val),
8090 Nl80211Attrs::S1gCapabilityMask(val) => fmt.field("S1gCapabilityMask", &val),
8091 Nl80211Attrs::SaePwe(val) => fmt.field("SaePwe", &val),
8092 Nl80211Attrs::ReconnectRequested(val) => fmt.field("ReconnectRequested", &val),
8093 Nl80211Attrs::SarSpec(val) => fmt.field("SarSpec", &val),
8094 Nl80211Attrs::DisableHe(val) => fmt.field("DisableHe", &val),
8095 Nl80211Attrs::ObssColorBitmap(val) => fmt.field("ObssColorBitmap", &val),
8096 Nl80211Attrs::ColorChangeCount(val) => fmt.field("ColorChangeCount", &val),
8097 Nl80211Attrs::ColorChangeColor(val) => fmt.field("ColorChangeColor", &val),
8098 Nl80211Attrs::ColorChangeElems(val) => fmt.field("ColorChangeElems", &val),
8099 Nl80211Attrs::MbssidConfig(val) => fmt.field("MbssidConfig", &val),
8100 Nl80211Attrs::MbssidElems(val) => fmt.field("MbssidElems", &val),
8101 Nl80211Attrs::RadarBackground(val) => fmt.field("RadarBackground", &val),
8102 Nl80211Attrs::ApSettingsFlags(val) => fmt.field("ApSettingsFlags", &val),
8103 Nl80211Attrs::EhtCapability(val) => fmt.field("EhtCapability", &val),
8104 Nl80211Attrs::DisableEht(val) => fmt.field("DisableEht", &val),
8105 Nl80211Attrs::MloLinks(val) => fmt.field("MloLinks", &val),
8106 Nl80211Attrs::MloLinkId(val) => fmt.field("MloLinkId", &val),
8107 Nl80211Attrs::MldAddr(val) => fmt.field("MldAddr", &val),
8108 Nl80211Attrs::MloSupport(val) => fmt.field("MloSupport", &val),
8109 Nl80211Attrs::MaxNumAkmSuites(val) => fmt.field("MaxNumAkmSuites", &val),
8110 Nl80211Attrs::EmlCapability(val) => fmt.field("EmlCapability", &val),
8111 Nl80211Attrs::MldCapaAndOps(val) => fmt.field("MldCapaAndOps", &val),
8112 Nl80211Attrs::TxHwTimestamp(val) => fmt.field("TxHwTimestamp", &val),
8113 Nl80211Attrs::RxHwTimestamp(val) => fmt.field("RxHwTimestamp", &val),
8114 Nl80211Attrs::TdBitmap(val) => fmt.field("TdBitmap", &val),
8115 Nl80211Attrs::PunctBitmap(val) => fmt.field("PunctBitmap", &val),
8116 Nl80211Attrs::MaxHwTimestampPeers(val) => fmt.field("MaxHwTimestampPeers", &val),
8117 Nl80211Attrs::HwTimestampEnabled(val) => fmt.field("HwTimestampEnabled", &val),
8118 Nl80211Attrs::EmaRnrElems(val) => fmt.field("EmaRnrElems", &val),
8119 Nl80211Attrs::MloLinkDisabled(val) => fmt.field("MloLinkDisabled", &val),
8120 Nl80211Attrs::BssDumpIncludeUseData(val) => {
8121 fmt.field("BssDumpIncludeUseData", &val)
8122 }
8123 Nl80211Attrs::MloTtlmDlink(val) => fmt.field("MloTtlmDlink", &val),
8124 Nl80211Attrs::MloTtlmUlink(val) => fmt.field("MloTtlmUlink", &val),
8125 Nl80211Attrs::AssocSppAmsdu(val) => fmt.field("AssocSppAmsdu", &val),
8126 Nl80211Attrs::WiphyRadios(val) => fmt.field("WiphyRadios", &val),
8127 Nl80211Attrs::WiphyInterfaceCombinations(val) => {
8128 fmt.field("WiphyInterfaceCombinations", &val)
8129 }
8130 Nl80211Attrs::VifRadioMask(val) => fmt.field("VifRadioMask", &val),
8131 };
8132 }
8133 fmt.finish()
8134 }
8135}
8136impl IterableNl80211Attrs<'_> {
8137 pub fn lookup_attr(
8138 &self,
8139 offset: usize,
8140 missing_type: Option<u16>,
8141 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
8142 let mut stack = Vec::new();
8143 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
8144 if cur == offset {
8145 stack.push(("Nl80211Attrs", offset));
8146 return (
8147 stack,
8148 missing_type.and_then(|t| Nl80211Attrs::attr_from_type(t)),
8149 );
8150 }
8151 if cur > offset || cur + self.buf.len() < offset {
8152 return (stack, None);
8153 }
8154 let mut attrs = self.clone();
8155 let mut last_off = cur + attrs.pos;
8156 let mut missing = None;
8157 while let Some(attr) = attrs.next() {
8158 let Ok(attr) = attr else { break };
8159 match attr {
8160 Nl80211Attrs::Wiphy(val) => {
8161 if last_off == offset {
8162 stack.push(("Wiphy", last_off));
8163 break;
8164 }
8165 }
8166 Nl80211Attrs::WiphyName(val) => {
8167 if last_off == offset {
8168 stack.push(("WiphyName", last_off));
8169 break;
8170 }
8171 }
8172 Nl80211Attrs::Ifindex(val) => {
8173 if last_off == offset {
8174 stack.push(("Ifindex", last_off));
8175 break;
8176 }
8177 }
8178 Nl80211Attrs::Ifname(val) => {
8179 if last_off == offset {
8180 stack.push(("Ifname", last_off));
8181 break;
8182 }
8183 }
8184 Nl80211Attrs::Iftype(val) => {
8185 if last_off == offset {
8186 stack.push(("Iftype", last_off));
8187 break;
8188 }
8189 }
8190 Nl80211Attrs::Mac(val) => {
8191 if last_off == offset {
8192 stack.push(("Mac", last_off));
8193 break;
8194 }
8195 }
8196 Nl80211Attrs::KeyData(val) => {
8197 if last_off == offset {
8198 stack.push(("KeyData", last_off));
8199 break;
8200 }
8201 }
8202 Nl80211Attrs::KeyIdx(val) => {
8203 if last_off == offset {
8204 stack.push(("KeyIdx", last_off));
8205 break;
8206 }
8207 }
8208 Nl80211Attrs::KeyCipher(val) => {
8209 if last_off == offset {
8210 stack.push(("KeyCipher", last_off));
8211 break;
8212 }
8213 }
8214 Nl80211Attrs::KeySeq(val) => {
8215 if last_off == offset {
8216 stack.push(("KeySeq", last_off));
8217 break;
8218 }
8219 }
8220 Nl80211Attrs::KeyDefault(val) => {
8221 if last_off == offset {
8222 stack.push(("KeyDefault", last_off));
8223 break;
8224 }
8225 }
8226 Nl80211Attrs::BeaconInterval(val) => {
8227 if last_off == offset {
8228 stack.push(("BeaconInterval", last_off));
8229 break;
8230 }
8231 }
8232 Nl80211Attrs::DtimPeriod(val) => {
8233 if last_off == offset {
8234 stack.push(("DtimPeriod", last_off));
8235 break;
8236 }
8237 }
8238 Nl80211Attrs::BeaconHead(val) => {
8239 if last_off == offset {
8240 stack.push(("BeaconHead", last_off));
8241 break;
8242 }
8243 }
8244 Nl80211Attrs::BeaconTail(val) => {
8245 if last_off == offset {
8246 stack.push(("BeaconTail", last_off));
8247 break;
8248 }
8249 }
8250 Nl80211Attrs::StaAid(val) => {
8251 if last_off == offset {
8252 stack.push(("StaAid", last_off));
8253 break;
8254 }
8255 }
8256 Nl80211Attrs::StaFlags(val) => {
8257 if last_off == offset {
8258 stack.push(("StaFlags", last_off));
8259 break;
8260 }
8261 }
8262 Nl80211Attrs::StaListenInterval(val) => {
8263 if last_off == offset {
8264 stack.push(("StaListenInterval", last_off));
8265 break;
8266 }
8267 }
8268 Nl80211Attrs::StaSupportedRates(val) => {
8269 if last_off == offset {
8270 stack.push(("StaSupportedRates", last_off));
8271 break;
8272 }
8273 }
8274 Nl80211Attrs::StaVlan(val) => {
8275 if last_off == offset {
8276 stack.push(("StaVlan", last_off));
8277 break;
8278 }
8279 }
8280 Nl80211Attrs::StaInfo(val) => {
8281 if last_off == offset {
8282 stack.push(("StaInfo", last_off));
8283 break;
8284 }
8285 }
8286 Nl80211Attrs::WiphyBands(val) => {
8287 (stack, missing) = val.lookup_attr(offset, missing_type);
8288 if !stack.is_empty() {
8289 break;
8290 }
8291 }
8292 Nl80211Attrs::MntrFlags(val) => {
8293 if last_off == offset {
8294 stack.push(("MntrFlags", last_off));
8295 break;
8296 }
8297 }
8298 Nl80211Attrs::MeshId(val) => {
8299 if last_off == offset {
8300 stack.push(("MeshId", last_off));
8301 break;
8302 }
8303 }
8304 Nl80211Attrs::StaPlinkAction(val) => {
8305 if last_off == offset {
8306 stack.push(("StaPlinkAction", last_off));
8307 break;
8308 }
8309 }
8310 Nl80211Attrs::MpathNextHop(val) => {
8311 if last_off == offset {
8312 stack.push(("MpathNextHop", last_off));
8313 break;
8314 }
8315 }
8316 Nl80211Attrs::MpathInfo(val) => {
8317 if last_off == offset {
8318 stack.push(("MpathInfo", last_off));
8319 break;
8320 }
8321 }
8322 Nl80211Attrs::BssCtsProt(val) => {
8323 if last_off == offset {
8324 stack.push(("BssCtsProt", last_off));
8325 break;
8326 }
8327 }
8328 Nl80211Attrs::BssShortPreamble(val) => {
8329 if last_off == offset {
8330 stack.push(("BssShortPreamble", last_off));
8331 break;
8332 }
8333 }
8334 Nl80211Attrs::BssShortSlotTime(val) => {
8335 if last_off == offset {
8336 stack.push(("BssShortSlotTime", last_off));
8337 break;
8338 }
8339 }
8340 Nl80211Attrs::HtCapability(val) => {
8341 if last_off == offset {
8342 stack.push(("HtCapability", last_off));
8343 break;
8344 }
8345 }
8346 Nl80211Attrs::SupportedIftypes(val) => {
8347 (stack, missing) = val.lookup_attr(offset, missing_type);
8348 if !stack.is_empty() {
8349 break;
8350 }
8351 }
8352 Nl80211Attrs::RegAlpha2(val) => {
8353 if last_off == offset {
8354 stack.push(("RegAlpha2", last_off));
8355 break;
8356 }
8357 }
8358 Nl80211Attrs::RegRules(val) => {
8359 if last_off == offset {
8360 stack.push(("RegRules", last_off));
8361 break;
8362 }
8363 }
8364 Nl80211Attrs::MeshConfig(val) => {
8365 if last_off == offset {
8366 stack.push(("MeshConfig", last_off));
8367 break;
8368 }
8369 }
8370 Nl80211Attrs::BssBasicRates(val) => {
8371 if last_off == offset {
8372 stack.push(("BssBasicRates", last_off));
8373 break;
8374 }
8375 }
8376 Nl80211Attrs::WiphyTxqParams(val) => {
8377 if last_off == offset {
8378 stack.push(("WiphyTxqParams", last_off));
8379 break;
8380 }
8381 }
8382 Nl80211Attrs::WiphyFreq(val) => {
8383 if last_off == offset {
8384 stack.push(("WiphyFreq", last_off));
8385 break;
8386 }
8387 }
8388 Nl80211Attrs::WiphyChannelType(val) => {
8389 if last_off == offset {
8390 stack.push(("WiphyChannelType", last_off));
8391 break;
8392 }
8393 }
8394 Nl80211Attrs::KeyDefaultMgmt(val) => {
8395 if last_off == offset {
8396 stack.push(("KeyDefaultMgmt", last_off));
8397 break;
8398 }
8399 }
8400 Nl80211Attrs::MgmtSubtype(val) => {
8401 if last_off == offset {
8402 stack.push(("MgmtSubtype", last_off));
8403 break;
8404 }
8405 }
8406 Nl80211Attrs::Ie(val) => {
8407 if last_off == offset {
8408 stack.push(("Ie", last_off));
8409 break;
8410 }
8411 }
8412 Nl80211Attrs::MaxNumScanSsids(val) => {
8413 if last_off == offset {
8414 stack.push(("MaxNumScanSsids", last_off));
8415 break;
8416 }
8417 }
8418 Nl80211Attrs::ScanFrequencies(val) => {
8419 if last_off == offset {
8420 stack.push(("ScanFrequencies", last_off));
8421 break;
8422 }
8423 }
8424 Nl80211Attrs::ScanSsids(val) => {
8425 if last_off == offset {
8426 stack.push(("ScanSsids", last_off));
8427 break;
8428 }
8429 }
8430 Nl80211Attrs::Generation(val) => {
8431 if last_off == offset {
8432 stack.push(("Generation", last_off));
8433 break;
8434 }
8435 }
8436 Nl80211Attrs::Bss(val) => {
8437 if last_off == offset {
8438 stack.push(("Bss", last_off));
8439 break;
8440 }
8441 }
8442 Nl80211Attrs::RegInitiator(val) => {
8443 if last_off == offset {
8444 stack.push(("RegInitiator", last_off));
8445 break;
8446 }
8447 }
8448 Nl80211Attrs::RegType(val) => {
8449 if last_off == offset {
8450 stack.push(("RegType", last_off));
8451 break;
8452 }
8453 }
8454 Nl80211Attrs::SupportedCommands(val) => {
8455 if last_off == offset {
8456 stack.push(("SupportedCommands", last_off));
8457 break;
8458 }
8459 }
8460 Nl80211Attrs::Frame(val) => {
8461 if last_off == offset {
8462 stack.push(("Frame", last_off));
8463 break;
8464 }
8465 }
8466 Nl80211Attrs::Ssid(val) => {
8467 if last_off == offset {
8468 stack.push(("Ssid", last_off));
8469 break;
8470 }
8471 }
8472 Nl80211Attrs::AuthType(val) => {
8473 if last_off == offset {
8474 stack.push(("AuthType", last_off));
8475 break;
8476 }
8477 }
8478 Nl80211Attrs::ReasonCode(val) => {
8479 if last_off == offset {
8480 stack.push(("ReasonCode", last_off));
8481 break;
8482 }
8483 }
8484 Nl80211Attrs::KeyType(val) => {
8485 if last_off == offset {
8486 stack.push(("KeyType", last_off));
8487 break;
8488 }
8489 }
8490 Nl80211Attrs::MaxScanIeLen(val) => {
8491 if last_off == offset {
8492 stack.push(("MaxScanIeLen", last_off));
8493 break;
8494 }
8495 }
8496 Nl80211Attrs::CipherSuites(val) => {
8497 if last_off == offset {
8498 stack.push(("CipherSuites", last_off));
8499 break;
8500 }
8501 }
8502 Nl80211Attrs::FreqBefore(val) => {
8503 if last_off == offset {
8504 stack.push(("FreqBefore", last_off));
8505 break;
8506 }
8507 }
8508 Nl80211Attrs::FreqAfter(val) => {
8509 if last_off == offset {
8510 stack.push(("FreqAfter", last_off));
8511 break;
8512 }
8513 }
8514 Nl80211Attrs::FreqFixed(val) => {
8515 if last_off == offset {
8516 stack.push(("FreqFixed", last_off));
8517 break;
8518 }
8519 }
8520 Nl80211Attrs::WiphyRetryShort(val) => {
8521 if last_off == offset {
8522 stack.push(("WiphyRetryShort", last_off));
8523 break;
8524 }
8525 }
8526 Nl80211Attrs::WiphyRetryLong(val) => {
8527 if last_off == offset {
8528 stack.push(("WiphyRetryLong", last_off));
8529 break;
8530 }
8531 }
8532 Nl80211Attrs::WiphyFragThreshold(val) => {
8533 if last_off == offset {
8534 stack.push(("WiphyFragThreshold", last_off));
8535 break;
8536 }
8537 }
8538 Nl80211Attrs::WiphyRtsThreshold(val) => {
8539 if last_off == offset {
8540 stack.push(("WiphyRtsThreshold", last_off));
8541 break;
8542 }
8543 }
8544 Nl80211Attrs::TimedOut(val) => {
8545 if last_off == offset {
8546 stack.push(("TimedOut", last_off));
8547 break;
8548 }
8549 }
8550 Nl80211Attrs::UseMfp(val) => {
8551 if last_off == offset {
8552 stack.push(("UseMfp", last_off));
8553 break;
8554 }
8555 }
8556 Nl80211Attrs::StaFlags2(val) => {
8557 if last_off == offset {
8558 stack.push(("StaFlags2", last_off));
8559 break;
8560 }
8561 }
8562 Nl80211Attrs::ControlPort(val) => {
8563 if last_off == offset {
8564 stack.push(("ControlPort", last_off));
8565 break;
8566 }
8567 }
8568 Nl80211Attrs::Testdata(val) => {
8569 if last_off == offset {
8570 stack.push(("Testdata", last_off));
8571 break;
8572 }
8573 }
8574 Nl80211Attrs::Privacy(val) => {
8575 if last_off == offset {
8576 stack.push(("Privacy", last_off));
8577 break;
8578 }
8579 }
8580 Nl80211Attrs::DisconnectedByAp(val) => {
8581 if last_off == offset {
8582 stack.push(("DisconnectedByAp", last_off));
8583 break;
8584 }
8585 }
8586 Nl80211Attrs::StatusCode(val) => {
8587 if last_off == offset {
8588 stack.push(("StatusCode", last_off));
8589 break;
8590 }
8591 }
8592 Nl80211Attrs::CipherSuitesPairwise(val) => {
8593 if last_off == offset {
8594 stack.push(("CipherSuitesPairwise", last_off));
8595 break;
8596 }
8597 }
8598 Nl80211Attrs::CipherSuiteGroup(val) => {
8599 if last_off == offset {
8600 stack.push(("CipherSuiteGroup", last_off));
8601 break;
8602 }
8603 }
8604 Nl80211Attrs::WpaVersions(val) => {
8605 if last_off == offset {
8606 stack.push(("WpaVersions", last_off));
8607 break;
8608 }
8609 }
8610 Nl80211Attrs::AkmSuites(val) => {
8611 if last_off == offset {
8612 stack.push(("AkmSuites", last_off));
8613 break;
8614 }
8615 }
8616 Nl80211Attrs::ReqIe(val) => {
8617 if last_off == offset {
8618 stack.push(("ReqIe", last_off));
8619 break;
8620 }
8621 }
8622 Nl80211Attrs::RespIe(val) => {
8623 if last_off == offset {
8624 stack.push(("RespIe", last_off));
8625 break;
8626 }
8627 }
8628 Nl80211Attrs::PrevBssid(val) => {
8629 if last_off == offset {
8630 stack.push(("PrevBssid", last_off));
8631 break;
8632 }
8633 }
8634 Nl80211Attrs::Key(val) => {
8635 if last_off == offset {
8636 stack.push(("Key", last_off));
8637 break;
8638 }
8639 }
8640 Nl80211Attrs::Keys(val) => {
8641 if last_off == offset {
8642 stack.push(("Keys", last_off));
8643 break;
8644 }
8645 }
8646 Nl80211Attrs::Pid(val) => {
8647 if last_off == offset {
8648 stack.push(("Pid", last_off));
8649 break;
8650 }
8651 }
8652 Nl80211Attrs::_4addr(val) => {
8653 if last_off == offset {
8654 stack.push(("4addr", last_off));
8655 break;
8656 }
8657 }
8658 Nl80211Attrs::SurveyInfo(val) => {
8659 if last_off == offset {
8660 stack.push(("SurveyInfo", last_off));
8661 break;
8662 }
8663 }
8664 Nl80211Attrs::Pmkid(val) => {
8665 if last_off == offset {
8666 stack.push(("Pmkid", last_off));
8667 break;
8668 }
8669 }
8670 Nl80211Attrs::MaxNumPmkids(val) => {
8671 if last_off == offset {
8672 stack.push(("MaxNumPmkids", last_off));
8673 break;
8674 }
8675 }
8676 Nl80211Attrs::Duration(val) => {
8677 if last_off == offset {
8678 stack.push(("Duration", last_off));
8679 break;
8680 }
8681 }
8682 Nl80211Attrs::Cookie(val) => {
8683 if last_off == offset {
8684 stack.push(("Cookie", last_off));
8685 break;
8686 }
8687 }
8688 Nl80211Attrs::WiphyCoverageClass(val) => {
8689 if last_off == offset {
8690 stack.push(("WiphyCoverageClass", last_off));
8691 break;
8692 }
8693 }
8694 Nl80211Attrs::TxRates(val) => {
8695 if last_off == offset {
8696 stack.push(("TxRates", last_off));
8697 break;
8698 }
8699 }
8700 Nl80211Attrs::FrameMatch(val) => {
8701 if last_off == offset {
8702 stack.push(("FrameMatch", last_off));
8703 break;
8704 }
8705 }
8706 Nl80211Attrs::Ack(val) => {
8707 if last_off == offset {
8708 stack.push(("Ack", last_off));
8709 break;
8710 }
8711 }
8712 Nl80211Attrs::PsState(val) => {
8713 if last_off == offset {
8714 stack.push(("PsState", last_off));
8715 break;
8716 }
8717 }
8718 Nl80211Attrs::Cqm(val) => {
8719 if last_off == offset {
8720 stack.push(("Cqm", last_off));
8721 break;
8722 }
8723 }
8724 Nl80211Attrs::LocalStateChange(val) => {
8725 if last_off == offset {
8726 stack.push(("LocalStateChange", last_off));
8727 break;
8728 }
8729 }
8730 Nl80211Attrs::ApIsolate(val) => {
8731 if last_off == offset {
8732 stack.push(("ApIsolate", last_off));
8733 break;
8734 }
8735 }
8736 Nl80211Attrs::WiphyTxPowerSetting(val) => {
8737 if last_off == offset {
8738 stack.push(("WiphyTxPowerSetting", last_off));
8739 break;
8740 }
8741 }
8742 Nl80211Attrs::WiphyTxPowerLevel(val) => {
8743 if last_off == offset {
8744 stack.push(("WiphyTxPowerLevel", last_off));
8745 break;
8746 }
8747 }
8748 Nl80211Attrs::TxFrameTypes(val) => {
8749 (stack, missing) = val.lookup_attr(offset, missing_type);
8750 if !stack.is_empty() {
8751 break;
8752 }
8753 }
8754 Nl80211Attrs::RxFrameTypes(val) => {
8755 (stack, missing) = val.lookup_attr(offset, missing_type);
8756 if !stack.is_empty() {
8757 break;
8758 }
8759 }
8760 Nl80211Attrs::FrameType(val) => {
8761 if last_off == offset {
8762 stack.push(("FrameType", last_off));
8763 break;
8764 }
8765 }
8766 Nl80211Attrs::ControlPortEthertype(val) => {
8767 if last_off == offset {
8768 stack.push(("ControlPortEthertype", last_off));
8769 break;
8770 }
8771 }
8772 Nl80211Attrs::ControlPortNoEncrypt(val) => {
8773 if last_off == offset {
8774 stack.push(("ControlPortNoEncrypt", last_off));
8775 break;
8776 }
8777 }
8778 Nl80211Attrs::SupportIbssRsn(val) => {
8779 if last_off == offset {
8780 stack.push(("SupportIbssRsn", last_off));
8781 break;
8782 }
8783 }
8784 Nl80211Attrs::WiphyAntennaTx(val) => {
8785 if last_off == offset {
8786 stack.push(("WiphyAntennaTx", last_off));
8787 break;
8788 }
8789 }
8790 Nl80211Attrs::WiphyAntennaRx(val) => {
8791 if last_off == offset {
8792 stack.push(("WiphyAntennaRx", last_off));
8793 break;
8794 }
8795 }
8796 Nl80211Attrs::McastRate(val) => {
8797 if last_off == offset {
8798 stack.push(("McastRate", last_off));
8799 break;
8800 }
8801 }
8802 Nl80211Attrs::OffchannelTxOk(val) => {
8803 if last_off == offset {
8804 stack.push(("OffchannelTxOk", last_off));
8805 break;
8806 }
8807 }
8808 Nl80211Attrs::BssHtOpmode(val) => {
8809 if last_off == offset {
8810 stack.push(("BssHtOpmode", last_off));
8811 break;
8812 }
8813 }
8814 Nl80211Attrs::KeyDefaultTypes(val) => {
8815 if last_off == offset {
8816 stack.push(("KeyDefaultTypes", last_off));
8817 break;
8818 }
8819 }
8820 Nl80211Attrs::MaxRemainOnChannelDuration(val) => {
8821 if last_off == offset {
8822 stack.push(("MaxRemainOnChannelDuration", last_off));
8823 break;
8824 }
8825 }
8826 Nl80211Attrs::MeshSetup(val) => {
8827 if last_off == offset {
8828 stack.push(("MeshSetup", last_off));
8829 break;
8830 }
8831 }
8832 Nl80211Attrs::WiphyAntennaAvailTx(val) => {
8833 if last_off == offset {
8834 stack.push(("WiphyAntennaAvailTx", last_off));
8835 break;
8836 }
8837 }
8838 Nl80211Attrs::WiphyAntennaAvailRx(val) => {
8839 if last_off == offset {
8840 stack.push(("WiphyAntennaAvailRx", last_off));
8841 break;
8842 }
8843 }
8844 Nl80211Attrs::SupportMeshAuth(val) => {
8845 if last_off == offset {
8846 stack.push(("SupportMeshAuth", last_off));
8847 break;
8848 }
8849 }
8850 Nl80211Attrs::StaPlinkState(val) => {
8851 if last_off == offset {
8852 stack.push(("StaPlinkState", last_off));
8853 break;
8854 }
8855 }
8856 Nl80211Attrs::WowlanTriggers(val) => {
8857 if last_off == offset {
8858 stack.push(("WowlanTriggers", last_off));
8859 break;
8860 }
8861 }
8862 Nl80211Attrs::WowlanTriggersSupported(val) => {
8863 (stack, missing) = val.lookup_attr(offset, missing_type);
8864 if !stack.is_empty() {
8865 break;
8866 }
8867 }
8868 Nl80211Attrs::SchedScanInterval(val) => {
8869 if last_off == offset {
8870 stack.push(("SchedScanInterval", last_off));
8871 break;
8872 }
8873 }
8874 Nl80211Attrs::InterfaceCombinations(val) => {
8875 for entry in val {
8876 let Ok(attr) = entry else { break };
8877 (stack, missing) = attr.lookup_attr(offset, missing_type);
8878 if !stack.is_empty() {
8879 break;
8880 }
8881 }
8882 if !stack.is_empty() {
8883 stack.push(("InterfaceCombinations", last_off));
8884 break;
8885 }
8886 }
8887 Nl80211Attrs::SoftwareIftypes(val) => {
8888 (stack, missing) = val.lookup_attr(offset, missing_type);
8889 if !stack.is_empty() {
8890 break;
8891 }
8892 }
8893 Nl80211Attrs::RekeyData(val) => {
8894 if last_off == offset {
8895 stack.push(("RekeyData", last_off));
8896 break;
8897 }
8898 }
8899 Nl80211Attrs::MaxNumSchedScanSsids(val) => {
8900 if last_off == offset {
8901 stack.push(("MaxNumSchedScanSsids", last_off));
8902 break;
8903 }
8904 }
8905 Nl80211Attrs::MaxSchedScanIeLen(val) => {
8906 if last_off == offset {
8907 stack.push(("MaxSchedScanIeLen", last_off));
8908 break;
8909 }
8910 }
8911 Nl80211Attrs::ScanSuppRates(val) => {
8912 if last_off == offset {
8913 stack.push(("ScanSuppRates", last_off));
8914 break;
8915 }
8916 }
8917 Nl80211Attrs::HiddenSsid(val) => {
8918 if last_off == offset {
8919 stack.push(("HiddenSsid", last_off));
8920 break;
8921 }
8922 }
8923 Nl80211Attrs::IeProbeResp(val) => {
8924 if last_off == offset {
8925 stack.push(("IeProbeResp", last_off));
8926 break;
8927 }
8928 }
8929 Nl80211Attrs::IeAssocResp(val) => {
8930 if last_off == offset {
8931 stack.push(("IeAssocResp", last_off));
8932 break;
8933 }
8934 }
8935 Nl80211Attrs::StaWme(val) => {
8936 if last_off == offset {
8937 stack.push(("StaWme", last_off));
8938 break;
8939 }
8940 }
8941 Nl80211Attrs::SupportApUapsd(val) => {
8942 if last_off == offset {
8943 stack.push(("SupportApUapsd", last_off));
8944 break;
8945 }
8946 }
8947 Nl80211Attrs::RoamSupport(val) => {
8948 if last_off == offset {
8949 stack.push(("RoamSupport", last_off));
8950 break;
8951 }
8952 }
8953 Nl80211Attrs::SchedScanMatch(val) => {
8954 if last_off == offset {
8955 stack.push(("SchedScanMatch", last_off));
8956 break;
8957 }
8958 }
8959 Nl80211Attrs::MaxMatchSets(val) => {
8960 if last_off == offset {
8961 stack.push(("MaxMatchSets", last_off));
8962 break;
8963 }
8964 }
8965 Nl80211Attrs::PmksaCandidate(val) => {
8966 if last_off == offset {
8967 stack.push(("PmksaCandidate", last_off));
8968 break;
8969 }
8970 }
8971 Nl80211Attrs::TxNoCckRate(val) => {
8972 if last_off == offset {
8973 stack.push(("TxNoCckRate", last_off));
8974 break;
8975 }
8976 }
8977 Nl80211Attrs::TdlsAction(val) => {
8978 if last_off == offset {
8979 stack.push(("TdlsAction", last_off));
8980 break;
8981 }
8982 }
8983 Nl80211Attrs::TdlsDialogToken(val) => {
8984 if last_off == offset {
8985 stack.push(("TdlsDialogToken", last_off));
8986 break;
8987 }
8988 }
8989 Nl80211Attrs::TdlsOperation(val) => {
8990 if last_off == offset {
8991 stack.push(("TdlsOperation", last_off));
8992 break;
8993 }
8994 }
8995 Nl80211Attrs::TdlsSupport(val) => {
8996 if last_off == offset {
8997 stack.push(("TdlsSupport", last_off));
8998 break;
8999 }
9000 }
9001 Nl80211Attrs::TdlsExternalSetup(val) => {
9002 if last_off == offset {
9003 stack.push(("TdlsExternalSetup", last_off));
9004 break;
9005 }
9006 }
9007 Nl80211Attrs::DeviceApSme(val) => {
9008 if last_off == offset {
9009 stack.push(("DeviceApSme", last_off));
9010 break;
9011 }
9012 }
9013 Nl80211Attrs::DontWaitForAck(val) => {
9014 if last_off == offset {
9015 stack.push(("DontWaitForAck", last_off));
9016 break;
9017 }
9018 }
9019 Nl80211Attrs::FeatureFlags(val) => {
9020 if last_off == offset {
9021 stack.push(("FeatureFlags", last_off));
9022 break;
9023 }
9024 }
9025 Nl80211Attrs::ProbeRespOffload(val) => {
9026 if last_off == offset {
9027 stack.push(("ProbeRespOffload", last_off));
9028 break;
9029 }
9030 }
9031 Nl80211Attrs::ProbeResp(val) => {
9032 if last_off == offset {
9033 stack.push(("ProbeResp", last_off));
9034 break;
9035 }
9036 }
9037 Nl80211Attrs::DfsRegion(val) => {
9038 if last_off == offset {
9039 stack.push(("DfsRegion", last_off));
9040 break;
9041 }
9042 }
9043 Nl80211Attrs::DisableHt(val) => {
9044 if last_off == offset {
9045 stack.push(("DisableHt", last_off));
9046 break;
9047 }
9048 }
9049 Nl80211Attrs::HtCapabilityMask(val) => {
9050 if last_off == offset {
9051 stack.push(("HtCapabilityMask", last_off));
9052 break;
9053 }
9054 }
9055 Nl80211Attrs::NoackMap(val) => {
9056 if last_off == offset {
9057 stack.push(("NoackMap", last_off));
9058 break;
9059 }
9060 }
9061 Nl80211Attrs::InactivityTimeout(val) => {
9062 if last_off == offset {
9063 stack.push(("InactivityTimeout", last_off));
9064 break;
9065 }
9066 }
9067 Nl80211Attrs::RxSignalDbm(val) => {
9068 if last_off == offset {
9069 stack.push(("RxSignalDbm", last_off));
9070 break;
9071 }
9072 }
9073 Nl80211Attrs::BgScanPeriod(val) => {
9074 if last_off == offset {
9075 stack.push(("BgScanPeriod", last_off));
9076 break;
9077 }
9078 }
9079 Nl80211Attrs::Wdev(val) => {
9080 if last_off == offset {
9081 stack.push(("Wdev", last_off));
9082 break;
9083 }
9084 }
9085 Nl80211Attrs::UserRegHintType(val) => {
9086 if last_off == offset {
9087 stack.push(("UserRegHintType", last_off));
9088 break;
9089 }
9090 }
9091 Nl80211Attrs::ConnFailedReason(val) => {
9092 if last_off == offset {
9093 stack.push(("ConnFailedReason", last_off));
9094 break;
9095 }
9096 }
9097 Nl80211Attrs::AuthData(val) => {
9098 if last_off == offset {
9099 stack.push(("AuthData", last_off));
9100 break;
9101 }
9102 }
9103 Nl80211Attrs::VhtCapability(val) => {
9104 if last_off == offset {
9105 stack.push(("VhtCapability", last_off));
9106 break;
9107 }
9108 }
9109 Nl80211Attrs::ScanFlags(val) => {
9110 if last_off == offset {
9111 stack.push(("ScanFlags", last_off));
9112 break;
9113 }
9114 }
9115 Nl80211Attrs::ChannelWidth(val) => {
9116 if last_off == offset {
9117 stack.push(("ChannelWidth", last_off));
9118 break;
9119 }
9120 }
9121 Nl80211Attrs::CenterFreq1(val) => {
9122 if last_off == offset {
9123 stack.push(("CenterFreq1", last_off));
9124 break;
9125 }
9126 }
9127 Nl80211Attrs::CenterFreq2(val) => {
9128 if last_off == offset {
9129 stack.push(("CenterFreq2", last_off));
9130 break;
9131 }
9132 }
9133 Nl80211Attrs::P2pCtwindow(val) => {
9134 if last_off == offset {
9135 stack.push(("P2pCtwindow", last_off));
9136 break;
9137 }
9138 }
9139 Nl80211Attrs::P2pOppps(val) => {
9140 if last_off == offset {
9141 stack.push(("P2pOppps", last_off));
9142 break;
9143 }
9144 }
9145 Nl80211Attrs::LocalMeshPowerMode(val) => {
9146 if last_off == offset {
9147 stack.push(("LocalMeshPowerMode", last_off));
9148 break;
9149 }
9150 }
9151 Nl80211Attrs::AclPolicy(val) => {
9152 if last_off == offset {
9153 stack.push(("AclPolicy", last_off));
9154 break;
9155 }
9156 }
9157 Nl80211Attrs::MacAddrs(val) => {
9158 if last_off == offset {
9159 stack.push(("MacAddrs", last_off));
9160 break;
9161 }
9162 }
9163 Nl80211Attrs::MacAclMax(val) => {
9164 if last_off == offset {
9165 stack.push(("MacAclMax", last_off));
9166 break;
9167 }
9168 }
9169 Nl80211Attrs::RadarEvent(val) => {
9170 if last_off == offset {
9171 stack.push(("RadarEvent", last_off));
9172 break;
9173 }
9174 }
9175 Nl80211Attrs::ExtCapa(val) => {
9176 if last_off == offset {
9177 stack.push(("ExtCapa", last_off));
9178 break;
9179 }
9180 }
9181 Nl80211Attrs::ExtCapaMask(val) => {
9182 if last_off == offset {
9183 stack.push(("ExtCapaMask", last_off));
9184 break;
9185 }
9186 }
9187 Nl80211Attrs::StaCapability(val) => {
9188 if last_off == offset {
9189 stack.push(("StaCapability", last_off));
9190 break;
9191 }
9192 }
9193 Nl80211Attrs::StaExtCapability(val) => {
9194 if last_off == offset {
9195 stack.push(("StaExtCapability", last_off));
9196 break;
9197 }
9198 }
9199 Nl80211Attrs::ProtocolFeatures(val) => {
9200 if last_off == offset {
9201 stack.push(("ProtocolFeatures", last_off));
9202 break;
9203 }
9204 }
9205 Nl80211Attrs::SplitWiphyDump(val) => {
9206 if last_off == offset {
9207 stack.push(("SplitWiphyDump", last_off));
9208 break;
9209 }
9210 }
9211 Nl80211Attrs::DisableVht(val) => {
9212 if last_off == offset {
9213 stack.push(("DisableVht", last_off));
9214 break;
9215 }
9216 }
9217 Nl80211Attrs::VhtCapabilityMask(val) => {
9218 if last_off == offset {
9219 stack.push(("VhtCapabilityMask", last_off));
9220 break;
9221 }
9222 }
9223 Nl80211Attrs::Mdid(val) => {
9224 if last_off == offset {
9225 stack.push(("Mdid", last_off));
9226 break;
9227 }
9228 }
9229 Nl80211Attrs::IeRic(val) => {
9230 if last_off == offset {
9231 stack.push(("IeRic", last_off));
9232 break;
9233 }
9234 }
9235 Nl80211Attrs::CritProtId(val) => {
9236 if last_off == offset {
9237 stack.push(("CritProtId", last_off));
9238 break;
9239 }
9240 }
9241 Nl80211Attrs::MaxCritProtDuration(val) => {
9242 if last_off == offset {
9243 stack.push(("MaxCritProtDuration", last_off));
9244 break;
9245 }
9246 }
9247 Nl80211Attrs::PeerAid(val) => {
9248 if last_off == offset {
9249 stack.push(("PeerAid", last_off));
9250 break;
9251 }
9252 }
9253 Nl80211Attrs::CoalesceRule(val) => {
9254 if last_off == offset {
9255 stack.push(("CoalesceRule", last_off));
9256 break;
9257 }
9258 }
9259 Nl80211Attrs::ChSwitchCount(val) => {
9260 if last_off == offset {
9261 stack.push(("ChSwitchCount", last_off));
9262 break;
9263 }
9264 }
9265 Nl80211Attrs::ChSwitchBlockTx(val) => {
9266 if last_off == offset {
9267 stack.push(("ChSwitchBlockTx", last_off));
9268 break;
9269 }
9270 }
9271 Nl80211Attrs::CsaIes(val) => {
9272 if last_off == offset {
9273 stack.push(("CsaIes", last_off));
9274 break;
9275 }
9276 }
9277 Nl80211Attrs::CntdwnOffsBeacon(val) => {
9278 if last_off == offset {
9279 stack.push(("CntdwnOffsBeacon", last_off));
9280 break;
9281 }
9282 }
9283 Nl80211Attrs::CntdwnOffsPresp(val) => {
9284 if last_off == offset {
9285 stack.push(("CntdwnOffsPresp", last_off));
9286 break;
9287 }
9288 }
9289 Nl80211Attrs::RxmgmtFlags(val) => {
9290 if last_off == offset {
9291 stack.push(("RxmgmtFlags", last_off));
9292 break;
9293 }
9294 }
9295 Nl80211Attrs::StaSupportedChannels(val) => {
9296 if last_off == offset {
9297 stack.push(("StaSupportedChannels", last_off));
9298 break;
9299 }
9300 }
9301 Nl80211Attrs::StaSupportedOperClasses(val) => {
9302 if last_off == offset {
9303 stack.push(("StaSupportedOperClasses", last_off));
9304 break;
9305 }
9306 }
9307 Nl80211Attrs::HandleDfs(val) => {
9308 if last_off == offset {
9309 stack.push(("HandleDfs", last_off));
9310 break;
9311 }
9312 }
9313 Nl80211Attrs::Support5Mhz(val) => {
9314 if last_off == offset {
9315 stack.push(("Support5Mhz", last_off));
9316 break;
9317 }
9318 }
9319 Nl80211Attrs::Support10Mhz(val) => {
9320 if last_off == offset {
9321 stack.push(("Support10Mhz", last_off));
9322 break;
9323 }
9324 }
9325 Nl80211Attrs::OpmodeNotif(val) => {
9326 if last_off == offset {
9327 stack.push(("OpmodeNotif", last_off));
9328 break;
9329 }
9330 }
9331 Nl80211Attrs::VendorId(val) => {
9332 if last_off == offset {
9333 stack.push(("VendorId", last_off));
9334 break;
9335 }
9336 }
9337 Nl80211Attrs::VendorSubcmd(val) => {
9338 if last_off == offset {
9339 stack.push(("VendorSubcmd", last_off));
9340 break;
9341 }
9342 }
9343 Nl80211Attrs::VendorData(val) => {
9344 if last_off == offset {
9345 stack.push(("VendorData", last_off));
9346 break;
9347 }
9348 }
9349 Nl80211Attrs::VendorEvents(val) => {
9350 if last_off == offset {
9351 stack.push(("VendorEvents", last_off));
9352 break;
9353 }
9354 }
9355 Nl80211Attrs::QosMap(val) => {
9356 if last_off == offset {
9357 stack.push(("QosMap", last_off));
9358 break;
9359 }
9360 }
9361 Nl80211Attrs::MacHint(val) => {
9362 if last_off == offset {
9363 stack.push(("MacHint", last_off));
9364 break;
9365 }
9366 }
9367 Nl80211Attrs::WiphyFreqHint(val) => {
9368 if last_off == offset {
9369 stack.push(("WiphyFreqHint", last_off));
9370 break;
9371 }
9372 }
9373 Nl80211Attrs::MaxApAssocSta(val) => {
9374 if last_off == offset {
9375 stack.push(("MaxApAssocSta", last_off));
9376 break;
9377 }
9378 }
9379 Nl80211Attrs::TdlsPeerCapability(val) => {
9380 if last_off == offset {
9381 stack.push(("TdlsPeerCapability", last_off));
9382 break;
9383 }
9384 }
9385 Nl80211Attrs::SocketOwner(val) => {
9386 if last_off == offset {
9387 stack.push(("SocketOwner", last_off));
9388 break;
9389 }
9390 }
9391 Nl80211Attrs::CsaCOffsetsTx(val) => {
9392 if last_off == offset {
9393 stack.push(("CsaCOffsetsTx", last_off));
9394 break;
9395 }
9396 }
9397 Nl80211Attrs::MaxCsaCounters(val) => {
9398 if last_off == offset {
9399 stack.push(("MaxCsaCounters", last_off));
9400 break;
9401 }
9402 }
9403 Nl80211Attrs::TdlsInitiator(val) => {
9404 if last_off == offset {
9405 stack.push(("TdlsInitiator", last_off));
9406 break;
9407 }
9408 }
9409 Nl80211Attrs::UseRrm(val) => {
9410 if last_off == offset {
9411 stack.push(("UseRrm", last_off));
9412 break;
9413 }
9414 }
9415 Nl80211Attrs::WiphyDynAck(val) => {
9416 if last_off == offset {
9417 stack.push(("WiphyDynAck", last_off));
9418 break;
9419 }
9420 }
9421 Nl80211Attrs::Tsid(val) => {
9422 if last_off == offset {
9423 stack.push(("Tsid", last_off));
9424 break;
9425 }
9426 }
9427 Nl80211Attrs::UserPrio(val) => {
9428 if last_off == offset {
9429 stack.push(("UserPrio", last_off));
9430 break;
9431 }
9432 }
9433 Nl80211Attrs::AdmittedTime(val) => {
9434 if last_off == offset {
9435 stack.push(("AdmittedTime", last_off));
9436 break;
9437 }
9438 }
9439 Nl80211Attrs::SmpsMode(val) => {
9440 if last_off == offset {
9441 stack.push(("SmpsMode", last_off));
9442 break;
9443 }
9444 }
9445 Nl80211Attrs::OperClass(val) => {
9446 if last_off == offset {
9447 stack.push(("OperClass", last_off));
9448 break;
9449 }
9450 }
9451 Nl80211Attrs::MacMask(val) => {
9452 if last_off == offset {
9453 stack.push(("MacMask", last_off));
9454 break;
9455 }
9456 }
9457 Nl80211Attrs::WiphySelfManagedReg(val) => {
9458 if last_off == offset {
9459 stack.push(("WiphySelfManagedReg", last_off));
9460 break;
9461 }
9462 }
9463 Nl80211Attrs::ExtFeatures(val) => {
9464 if last_off == offset {
9465 stack.push(("ExtFeatures", last_off));
9466 break;
9467 }
9468 }
9469 Nl80211Attrs::SurveyRadioStats(val) => {
9470 if last_off == offset {
9471 stack.push(("SurveyRadioStats", last_off));
9472 break;
9473 }
9474 }
9475 Nl80211Attrs::NetnsFd(val) => {
9476 if last_off == offset {
9477 stack.push(("NetnsFd", last_off));
9478 break;
9479 }
9480 }
9481 Nl80211Attrs::SchedScanDelay(val) => {
9482 if last_off == offset {
9483 stack.push(("SchedScanDelay", last_off));
9484 break;
9485 }
9486 }
9487 Nl80211Attrs::RegIndoor(val) => {
9488 if last_off == offset {
9489 stack.push(("RegIndoor", last_off));
9490 break;
9491 }
9492 }
9493 Nl80211Attrs::MaxNumSchedScanPlans(val) => {
9494 if last_off == offset {
9495 stack.push(("MaxNumSchedScanPlans", last_off));
9496 break;
9497 }
9498 }
9499 Nl80211Attrs::MaxScanPlanInterval(val) => {
9500 if last_off == offset {
9501 stack.push(("MaxScanPlanInterval", last_off));
9502 break;
9503 }
9504 }
9505 Nl80211Attrs::MaxScanPlanIterations(val) => {
9506 if last_off == offset {
9507 stack.push(("MaxScanPlanIterations", last_off));
9508 break;
9509 }
9510 }
9511 Nl80211Attrs::SchedScanPlans(val) => {
9512 if last_off == offset {
9513 stack.push(("SchedScanPlans", last_off));
9514 break;
9515 }
9516 }
9517 Nl80211Attrs::Pbss(val) => {
9518 if last_off == offset {
9519 stack.push(("Pbss", last_off));
9520 break;
9521 }
9522 }
9523 Nl80211Attrs::BssSelect(val) => {
9524 if last_off == offset {
9525 stack.push(("BssSelect", last_off));
9526 break;
9527 }
9528 }
9529 Nl80211Attrs::StaSupportP2pPs(val) => {
9530 if last_off == offset {
9531 stack.push(("StaSupportP2pPs", last_off));
9532 break;
9533 }
9534 }
9535 Nl80211Attrs::Pad(val) => {
9536 if last_off == offset {
9537 stack.push(("Pad", last_off));
9538 break;
9539 }
9540 }
9541 Nl80211Attrs::IftypeExtCapa(val) => {
9542 if last_off == offset {
9543 stack.push(("IftypeExtCapa", last_off));
9544 break;
9545 }
9546 }
9547 Nl80211Attrs::MuMimoGroupData(val) => {
9548 if last_off == offset {
9549 stack.push(("MuMimoGroupData", last_off));
9550 break;
9551 }
9552 }
9553 Nl80211Attrs::MuMimoFollowMacAddr(val) => {
9554 if last_off == offset {
9555 stack.push(("MuMimoFollowMacAddr", last_off));
9556 break;
9557 }
9558 }
9559 Nl80211Attrs::ScanStartTimeTsf(val) => {
9560 if last_off == offset {
9561 stack.push(("ScanStartTimeTsf", last_off));
9562 break;
9563 }
9564 }
9565 Nl80211Attrs::ScanStartTimeTsfBssid(val) => {
9566 if last_off == offset {
9567 stack.push(("ScanStartTimeTsfBssid", last_off));
9568 break;
9569 }
9570 }
9571 Nl80211Attrs::MeasurementDuration(val) => {
9572 if last_off == offset {
9573 stack.push(("MeasurementDuration", last_off));
9574 break;
9575 }
9576 }
9577 Nl80211Attrs::MeasurementDurationMandatory(val) => {
9578 if last_off == offset {
9579 stack.push(("MeasurementDurationMandatory", last_off));
9580 break;
9581 }
9582 }
9583 Nl80211Attrs::MeshPeerAid(val) => {
9584 if last_off == offset {
9585 stack.push(("MeshPeerAid", last_off));
9586 break;
9587 }
9588 }
9589 Nl80211Attrs::NanMasterPref(val) => {
9590 if last_off == offset {
9591 stack.push(("NanMasterPref", last_off));
9592 break;
9593 }
9594 }
9595 Nl80211Attrs::Bands(val) => {
9596 if last_off == offset {
9597 stack.push(("Bands", last_off));
9598 break;
9599 }
9600 }
9601 Nl80211Attrs::NanFunc(val) => {
9602 if last_off == offset {
9603 stack.push(("NanFunc", last_off));
9604 break;
9605 }
9606 }
9607 Nl80211Attrs::NanMatch(val) => {
9608 if last_off == offset {
9609 stack.push(("NanMatch", last_off));
9610 break;
9611 }
9612 }
9613 Nl80211Attrs::FilsKek(val) => {
9614 if last_off == offset {
9615 stack.push(("FilsKek", last_off));
9616 break;
9617 }
9618 }
9619 Nl80211Attrs::FilsNonces(val) => {
9620 if last_off == offset {
9621 stack.push(("FilsNonces", last_off));
9622 break;
9623 }
9624 }
9625 Nl80211Attrs::MulticastToUnicastEnabled(val) => {
9626 if last_off == offset {
9627 stack.push(("MulticastToUnicastEnabled", last_off));
9628 break;
9629 }
9630 }
9631 Nl80211Attrs::Bssid(val) => {
9632 if last_off == offset {
9633 stack.push(("Bssid", last_off));
9634 break;
9635 }
9636 }
9637 Nl80211Attrs::SchedScanRelativeRssi(val) => {
9638 if last_off == offset {
9639 stack.push(("SchedScanRelativeRssi", last_off));
9640 break;
9641 }
9642 }
9643 Nl80211Attrs::SchedScanRssiAdjust(val) => {
9644 if last_off == offset {
9645 stack.push(("SchedScanRssiAdjust", last_off));
9646 break;
9647 }
9648 }
9649 Nl80211Attrs::TimeoutReason(val) => {
9650 if last_off == offset {
9651 stack.push(("TimeoutReason", last_off));
9652 break;
9653 }
9654 }
9655 Nl80211Attrs::FilsErpUsername(val) => {
9656 if last_off == offset {
9657 stack.push(("FilsErpUsername", last_off));
9658 break;
9659 }
9660 }
9661 Nl80211Attrs::FilsErpRealm(val) => {
9662 if last_off == offset {
9663 stack.push(("FilsErpRealm", last_off));
9664 break;
9665 }
9666 }
9667 Nl80211Attrs::FilsErpNextSeqNum(val) => {
9668 if last_off == offset {
9669 stack.push(("FilsErpNextSeqNum", last_off));
9670 break;
9671 }
9672 }
9673 Nl80211Attrs::FilsErpRrk(val) => {
9674 if last_off == offset {
9675 stack.push(("FilsErpRrk", last_off));
9676 break;
9677 }
9678 }
9679 Nl80211Attrs::FilsCacheId(val) => {
9680 if last_off == offset {
9681 stack.push(("FilsCacheId", last_off));
9682 break;
9683 }
9684 }
9685 Nl80211Attrs::Pmk(val) => {
9686 if last_off == offset {
9687 stack.push(("Pmk", last_off));
9688 break;
9689 }
9690 }
9691 Nl80211Attrs::SchedScanMulti(val) => {
9692 if last_off == offset {
9693 stack.push(("SchedScanMulti", last_off));
9694 break;
9695 }
9696 }
9697 Nl80211Attrs::SchedScanMaxReqs(val) => {
9698 if last_off == offset {
9699 stack.push(("SchedScanMaxReqs", last_off));
9700 break;
9701 }
9702 }
9703 Nl80211Attrs::Want1x4wayHs(val) => {
9704 if last_off == offset {
9705 stack.push(("Want1x4wayHs", last_off));
9706 break;
9707 }
9708 }
9709 Nl80211Attrs::Pmkr0Name(val) => {
9710 if last_off == offset {
9711 stack.push(("Pmkr0Name", last_off));
9712 break;
9713 }
9714 }
9715 Nl80211Attrs::PortAuthorized(val) => {
9716 if last_off == offset {
9717 stack.push(("PortAuthorized", last_off));
9718 break;
9719 }
9720 }
9721 Nl80211Attrs::ExternalAuthAction(val) => {
9722 if last_off == offset {
9723 stack.push(("ExternalAuthAction", last_off));
9724 break;
9725 }
9726 }
9727 Nl80211Attrs::ExternalAuthSupport(val) => {
9728 if last_off == offset {
9729 stack.push(("ExternalAuthSupport", last_off));
9730 break;
9731 }
9732 }
9733 Nl80211Attrs::Nss(val) => {
9734 if last_off == offset {
9735 stack.push(("Nss", last_off));
9736 break;
9737 }
9738 }
9739 Nl80211Attrs::AckSignal(val) => {
9740 if last_off == offset {
9741 stack.push(("AckSignal", last_off));
9742 break;
9743 }
9744 }
9745 Nl80211Attrs::ControlPortOverNl80211(val) => {
9746 if last_off == offset {
9747 stack.push(("ControlPortOverNl80211", last_off));
9748 break;
9749 }
9750 }
9751 Nl80211Attrs::TxqStats(val) => {
9752 (stack, missing) = val.lookup_attr(offset, missing_type);
9753 if !stack.is_empty() {
9754 break;
9755 }
9756 }
9757 Nl80211Attrs::TxqLimit(val) => {
9758 if last_off == offset {
9759 stack.push(("TxqLimit", last_off));
9760 break;
9761 }
9762 }
9763 Nl80211Attrs::TxqMemoryLimit(val) => {
9764 if last_off == offset {
9765 stack.push(("TxqMemoryLimit", last_off));
9766 break;
9767 }
9768 }
9769 Nl80211Attrs::TxqQuantum(val) => {
9770 if last_off == offset {
9771 stack.push(("TxqQuantum", last_off));
9772 break;
9773 }
9774 }
9775 Nl80211Attrs::HeCapability(val) => {
9776 if last_off == offset {
9777 stack.push(("HeCapability", last_off));
9778 break;
9779 }
9780 }
9781 Nl80211Attrs::FtmResponder(val) => {
9782 if last_off == offset {
9783 stack.push(("FtmResponder", last_off));
9784 break;
9785 }
9786 }
9787 Nl80211Attrs::FtmResponderStats(val) => {
9788 if last_off == offset {
9789 stack.push(("FtmResponderStats", last_off));
9790 break;
9791 }
9792 }
9793 Nl80211Attrs::Timeout(val) => {
9794 if last_off == offset {
9795 stack.push(("Timeout", last_off));
9796 break;
9797 }
9798 }
9799 Nl80211Attrs::PeerMeasurements(val) => {
9800 if last_off == offset {
9801 stack.push(("PeerMeasurements", last_off));
9802 break;
9803 }
9804 }
9805 Nl80211Attrs::AirtimeWeight(val) => {
9806 if last_off == offset {
9807 stack.push(("AirtimeWeight", last_off));
9808 break;
9809 }
9810 }
9811 Nl80211Attrs::StaTxPowerSetting(val) => {
9812 if last_off == offset {
9813 stack.push(("StaTxPowerSetting", last_off));
9814 break;
9815 }
9816 }
9817 Nl80211Attrs::StaTxPower(val) => {
9818 if last_off == offset {
9819 stack.push(("StaTxPower", last_off));
9820 break;
9821 }
9822 }
9823 Nl80211Attrs::SaePassword(val) => {
9824 if last_off == offset {
9825 stack.push(("SaePassword", last_off));
9826 break;
9827 }
9828 }
9829 Nl80211Attrs::TwtResponder(val) => {
9830 if last_off == offset {
9831 stack.push(("TwtResponder", last_off));
9832 break;
9833 }
9834 }
9835 Nl80211Attrs::HeObssPd(val) => {
9836 if last_off == offset {
9837 stack.push(("HeObssPd", last_off));
9838 break;
9839 }
9840 }
9841 Nl80211Attrs::WiphyEdmgChannels(val) => {
9842 if last_off == offset {
9843 stack.push(("WiphyEdmgChannels", last_off));
9844 break;
9845 }
9846 }
9847 Nl80211Attrs::WiphyEdmgBwConfig(val) => {
9848 if last_off == offset {
9849 stack.push(("WiphyEdmgBwConfig", last_off));
9850 break;
9851 }
9852 }
9853 Nl80211Attrs::VlanId(val) => {
9854 if last_off == offset {
9855 stack.push(("VlanId", last_off));
9856 break;
9857 }
9858 }
9859 Nl80211Attrs::HeBssColor(val) => {
9860 if last_off == offset {
9861 stack.push(("HeBssColor", last_off));
9862 break;
9863 }
9864 }
9865 Nl80211Attrs::IftypeAkmSuites(val) => {
9866 if last_off == offset {
9867 stack.push(("IftypeAkmSuites", last_off));
9868 break;
9869 }
9870 }
9871 Nl80211Attrs::TidConfig(val) => {
9872 if last_off == offset {
9873 stack.push(("TidConfig", last_off));
9874 break;
9875 }
9876 }
9877 Nl80211Attrs::ControlPortNoPreauth(val) => {
9878 if last_off == offset {
9879 stack.push(("ControlPortNoPreauth", last_off));
9880 break;
9881 }
9882 }
9883 Nl80211Attrs::PmkLifetime(val) => {
9884 if last_off == offset {
9885 stack.push(("PmkLifetime", last_off));
9886 break;
9887 }
9888 }
9889 Nl80211Attrs::PmkReauthThreshold(val) => {
9890 if last_off == offset {
9891 stack.push(("PmkReauthThreshold", last_off));
9892 break;
9893 }
9894 }
9895 Nl80211Attrs::ReceiveMulticast(val) => {
9896 if last_off == offset {
9897 stack.push(("ReceiveMulticast", last_off));
9898 break;
9899 }
9900 }
9901 Nl80211Attrs::WiphyFreqOffset(val) => {
9902 if last_off == offset {
9903 stack.push(("WiphyFreqOffset", last_off));
9904 break;
9905 }
9906 }
9907 Nl80211Attrs::CenterFreq1Offset(val) => {
9908 if last_off == offset {
9909 stack.push(("CenterFreq1Offset", last_off));
9910 break;
9911 }
9912 }
9913 Nl80211Attrs::ScanFreqKhz(val) => {
9914 if last_off == offset {
9915 stack.push(("ScanFreqKhz", last_off));
9916 break;
9917 }
9918 }
9919 Nl80211Attrs::He6ghzCapability(val) => {
9920 if last_off == offset {
9921 stack.push(("He6ghzCapability", last_off));
9922 break;
9923 }
9924 }
9925 Nl80211Attrs::FilsDiscovery(val) => {
9926 if last_off == offset {
9927 stack.push(("FilsDiscovery", last_off));
9928 break;
9929 }
9930 }
9931 Nl80211Attrs::UnsolBcastProbeResp(val) => {
9932 if last_off == offset {
9933 stack.push(("UnsolBcastProbeResp", last_off));
9934 break;
9935 }
9936 }
9937 Nl80211Attrs::S1gCapability(val) => {
9938 if last_off == offset {
9939 stack.push(("S1gCapability", last_off));
9940 break;
9941 }
9942 }
9943 Nl80211Attrs::S1gCapabilityMask(val) => {
9944 if last_off == offset {
9945 stack.push(("S1gCapabilityMask", last_off));
9946 break;
9947 }
9948 }
9949 Nl80211Attrs::SaePwe(val) => {
9950 if last_off == offset {
9951 stack.push(("SaePwe", last_off));
9952 break;
9953 }
9954 }
9955 Nl80211Attrs::ReconnectRequested(val) => {
9956 if last_off == offset {
9957 stack.push(("ReconnectRequested", last_off));
9958 break;
9959 }
9960 }
9961 Nl80211Attrs::SarSpec(val) => {
9962 (stack, missing) = val.lookup_attr(offset, missing_type);
9963 if !stack.is_empty() {
9964 break;
9965 }
9966 }
9967 Nl80211Attrs::DisableHe(val) => {
9968 if last_off == offset {
9969 stack.push(("DisableHe", last_off));
9970 break;
9971 }
9972 }
9973 Nl80211Attrs::ObssColorBitmap(val) => {
9974 if last_off == offset {
9975 stack.push(("ObssColorBitmap", last_off));
9976 break;
9977 }
9978 }
9979 Nl80211Attrs::ColorChangeCount(val) => {
9980 if last_off == offset {
9981 stack.push(("ColorChangeCount", last_off));
9982 break;
9983 }
9984 }
9985 Nl80211Attrs::ColorChangeColor(val) => {
9986 if last_off == offset {
9987 stack.push(("ColorChangeColor", last_off));
9988 break;
9989 }
9990 }
9991 Nl80211Attrs::ColorChangeElems(val) => {
9992 if last_off == offset {
9993 stack.push(("ColorChangeElems", last_off));
9994 break;
9995 }
9996 }
9997 Nl80211Attrs::MbssidConfig(val) => {
9998 if last_off == offset {
9999 stack.push(("MbssidConfig", last_off));
10000 break;
10001 }
10002 }
10003 Nl80211Attrs::MbssidElems(val) => {
10004 if last_off == offset {
10005 stack.push(("MbssidElems", last_off));
10006 break;
10007 }
10008 }
10009 Nl80211Attrs::RadarBackground(val) => {
10010 if last_off == offset {
10011 stack.push(("RadarBackground", last_off));
10012 break;
10013 }
10014 }
10015 Nl80211Attrs::ApSettingsFlags(val) => {
10016 if last_off == offset {
10017 stack.push(("ApSettingsFlags", last_off));
10018 break;
10019 }
10020 }
10021 Nl80211Attrs::EhtCapability(val) => {
10022 if last_off == offset {
10023 stack.push(("EhtCapability", last_off));
10024 break;
10025 }
10026 }
10027 Nl80211Attrs::DisableEht(val) => {
10028 if last_off == offset {
10029 stack.push(("DisableEht", last_off));
10030 break;
10031 }
10032 }
10033 Nl80211Attrs::MloLinks(val) => {
10034 if last_off == offset {
10035 stack.push(("MloLinks", last_off));
10036 break;
10037 }
10038 }
10039 Nl80211Attrs::MloLinkId(val) => {
10040 if last_off == offset {
10041 stack.push(("MloLinkId", last_off));
10042 break;
10043 }
10044 }
10045 Nl80211Attrs::MldAddr(val) => {
10046 if last_off == offset {
10047 stack.push(("MldAddr", last_off));
10048 break;
10049 }
10050 }
10051 Nl80211Attrs::MloSupport(val) => {
10052 if last_off == offset {
10053 stack.push(("MloSupport", last_off));
10054 break;
10055 }
10056 }
10057 Nl80211Attrs::MaxNumAkmSuites(val) => {
10058 if last_off == offset {
10059 stack.push(("MaxNumAkmSuites", last_off));
10060 break;
10061 }
10062 }
10063 Nl80211Attrs::EmlCapability(val) => {
10064 if last_off == offset {
10065 stack.push(("EmlCapability", last_off));
10066 break;
10067 }
10068 }
10069 Nl80211Attrs::MldCapaAndOps(val) => {
10070 if last_off == offset {
10071 stack.push(("MldCapaAndOps", last_off));
10072 break;
10073 }
10074 }
10075 Nl80211Attrs::TxHwTimestamp(val) => {
10076 if last_off == offset {
10077 stack.push(("TxHwTimestamp", last_off));
10078 break;
10079 }
10080 }
10081 Nl80211Attrs::RxHwTimestamp(val) => {
10082 if last_off == offset {
10083 stack.push(("RxHwTimestamp", last_off));
10084 break;
10085 }
10086 }
10087 Nl80211Attrs::TdBitmap(val) => {
10088 if last_off == offset {
10089 stack.push(("TdBitmap", last_off));
10090 break;
10091 }
10092 }
10093 Nl80211Attrs::PunctBitmap(val) => {
10094 if last_off == offset {
10095 stack.push(("PunctBitmap", last_off));
10096 break;
10097 }
10098 }
10099 Nl80211Attrs::MaxHwTimestampPeers(val) => {
10100 if last_off == offset {
10101 stack.push(("MaxHwTimestampPeers", last_off));
10102 break;
10103 }
10104 }
10105 Nl80211Attrs::HwTimestampEnabled(val) => {
10106 if last_off == offset {
10107 stack.push(("HwTimestampEnabled", last_off));
10108 break;
10109 }
10110 }
10111 Nl80211Attrs::EmaRnrElems(val) => {
10112 if last_off == offset {
10113 stack.push(("EmaRnrElems", last_off));
10114 break;
10115 }
10116 }
10117 Nl80211Attrs::MloLinkDisabled(val) => {
10118 if last_off == offset {
10119 stack.push(("MloLinkDisabled", last_off));
10120 break;
10121 }
10122 }
10123 Nl80211Attrs::BssDumpIncludeUseData(val) => {
10124 if last_off == offset {
10125 stack.push(("BssDumpIncludeUseData", last_off));
10126 break;
10127 }
10128 }
10129 Nl80211Attrs::MloTtlmDlink(val) => {
10130 if last_off == offset {
10131 stack.push(("MloTtlmDlink", last_off));
10132 break;
10133 }
10134 }
10135 Nl80211Attrs::MloTtlmUlink(val) => {
10136 if last_off == offset {
10137 stack.push(("MloTtlmUlink", last_off));
10138 break;
10139 }
10140 }
10141 Nl80211Attrs::AssocSppAmsdu(val) => {
10142 if last_off == offset {
10143 stack.push(("AssocSppAmsdu", last_off));
10144 break;
10145 }
10146 }
10147 Nl80211Attrs::WiphyRadios(val) => {
10148 if last_off == offset {
10149 stack.push(("WiphyRadios", last_off));
10150 break;
10151 }
10152 }
10153 Nl80211Attrs::WiphyInterfaceCombinations(val) => {
10154 if last_off == offset {
10155 stack.push(("WiphyInterfaceCombinations", last_off));
10156 break;
10157 }
10158 }
10159 Nl80211Attrs::VifRadioMask(val) => {
10160 if last_off == offset {
10161 stack.push(("VifRadioMask", last_off));
10162 break;
10163 }
10164 }
10165 _ => {}
10166 };
10167 last_off = cur + attrs.pos;
10168 }
10169 if !stack.is_empty() {
10170 stack.push(("Nl80211Attrs", cur));
10171 }
10172 (stack, missing)
10173 }
10174}
10175#[derive(Clone)]
10176pub enum FrameTypeAttrs {
10177 FrameType(u16),
10178}
10179impl<'a> IterableFrameTypeAttrs<'a> {
10180 pub fn get_frame_type(&self) -> Result<u16, ErrorContext> {
10181 let mut iter = self.clone();
10182 iter.pos = 0;
10183 for attr in iter {
10184 if let FrameTypeAttrs::FrameType(val) = attr? {
10185 return Ok(val);
10186 }
10187 }
10188 Err(ErrorContext::new_missing(
10189 "FrameTypeAttrs",
10190 "FrameType",
10191 self.orig_loc,
10192 self.buf.as_ptr() as usize,
10193 ))
10194 }
10195}
10196impl FrameTypeAttrs {
10197 pub fn new<'a>(buf: &'a [u8]) -> IterableFrameTypeAttrs<'a> {
10198 IterableFrameTypeAttrs::with_loc(buf, buf.as_ptr() as usize)
10199 }
10200 fn attr_from_type(r#type: u16) -> Option<&'static str> {
10201 Nl80211Attrs::attr_from_type(r#type)
10202 }
10203}
10204#[derive(Clone, Copy, Default)]
10205pub struct IterableFrameTypeAttrs<'a> {
10206 buf: &'a [u8],
10207 pos: usize,
10208 orig_loc: usize,
10209}
10210impl<'a> IterableFrameTypeAttrs<'a> {
10211 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
10212 Self {
10213 buf,
10214 pos: 0,
10215 orig_loc,
10216 }
10217 }
10218 pub fn get_buf(&self) -> &'a [u8] {
10219 self.buf
10220 }
10221}
10222impl<'a> Iterator for IterableFrameTypeAttrs<'a> {
10223 type Item = Result<FrameTypeAttrs, ErrorContext>;
10224 fn next(&mut self) -> Option<Self::Item> {
10225 if self.buf.len() == self.pos {
10226 return None;
10227 }
10228 let pos = self.pos;
10229 let mut r#type = None;
10230 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
10231 r#type = Some(header.r#type);
10232 let res = match header.r#type {
10233 101u16 => FrameTypeAttrs::FrameType({
10234 let res = parse_u16(next);
10235 let Some(val) = res else { break };
10236 val
10237 }),
10238 n => {
10239 if cfg!(any(test, feature = "deny-unknown-attrs")) {
10240 break;
10241 } else {
10242 continue;
10243 }
10244 }
10245 };
10246 return Some(Ok(res));
10247 }
10248 Some(Err(ErrorContext::new(
10249 "FrameTypeAttrs",
10250 r#type.and_then(|t| FrameTypeAttrs::attr_from_type(t)),
10251 self.orig_loc,
10252 self.buf.as_ptr().wrapping_add(pos) as usize,
10253 )))
10254 }
10255}
10256impl std::fmt::Debug for IterableFrameTypeAttrs<'_> {
10257 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10258 let mut fmt = f.debug_struct("FrameTypeAttrs");
10259 for attr in self.clone() {
10260 let attr = match attr {
10261 Ok(a) => a,
10262 Err(err) => {
10263 fmt.finish()?;
10264 f.write_str("Err(")?;
10265 err.fmt(f)?;
10266 return f.write_str(")");
10267 }
10268 };
10269 match attr {
10270 FrameTypeAttrs::FrameType(val) => fmt.field("FrameType", &val),
10271 };
10272 }
10273 fmt.finish()
10274 }
10275}
10276impl IterableFrameTypeAttrs<'_> {
10277 pub fn lookup_attr(
10278 &self,
10279 offset: usize,
10280 missing_type: Option<u16>,
10281 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
10282 let mut stack = Vec::new();
10283 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
10284 if cur == offset {
10285 stack.push(("FrameTypeAttrs", offset));
10286 return (
10287 stack,
10288 missing_type.and_then(|t| FrameTypeAttrs::attr_from_type(t)),
10289 );
10290 }
10291 if cur > offset || cur + self.buf.len() < offset {
10292 return (stack, None);
10293 }
10294 let mut attrs = self.clone();
10295 let mut last_off = cur + attrs.pos;
10296 while let Some(attr) = attrs.next() {
10297 let Ok(attr) = attr else { break };
10298 match attr {
10299 FrameTypeAttrs::FrameType(val) => {
10300 if last_off == offset {
10301 stack.push(("FrameType", last_off));
10302 break;
10303 }
10304 }
10305 _ => {}
10306 };
10307 last_off = cur + attrs.pos;
10308 }
10309 if !stack.is_empty() {
10310 stack.push(("FrameTypeAttrs", cur));
10311 }
10312 (stack, None)
10313 }
10314}
10315#[derive(Clone)]
10316pub enum WiphyBands<'a> {
10317 #[doc = "2.4 GHz ISM band"]
10318 _2ghz(IterableBandAttrs<'a>),
10319 #[doc = "around 5 GHz band (4.9 - 5.7 GHz)"]
10320 _5ghz(IterableBandAttrs<'a>),
10321 #[doc = "around 60 GHz band (58.32 - 69.12 GHz)"]
10322 _60ghz(IterableBandAttrs<'a>),
10323 _6ghz(IterableBandAttrs<'a>),
10324 S1ghz(IterableBandAttrs<'a>),
10325 Lc(IterableBandAttrs<'a>),
10326}
10327impl<'a> IterableWiphyBands<'a> {
10328 #[doc = "2.4 GHz ISM band"]
10329 pub fn get_2ghz(&self) -> Result<IterableBandAttrs<'a>, ErrorContext> {
10330 let mut iter = self.clone();
10331 iter.pos = 0;
10332 for attr in iter {
10333 if let WiphyBands::_2ghz(val) = attr? {
10334 return Ok(val);
10335 }
10336 }
10337 Err(ErrorContext::new_missing(
10338 "WiphyBands",
10339 "2ghz",
10340 self.orig_loc,
10341 self.buf.as_ptr() as usize,
10342 ))
10343 }
10344 #[doc = "around 5 GHz band (4.9 - 5.7 GHz)"]
10345 pub fn get_5ghz(&self) -> Result<IterableBandAttrs<'a>, ErrorContext> {
10346 let mut iter = self.clone();
10347 iter.pos = 0;
10348 for attr in iter {
10349 if let WiphyBands::_5ghz(val) = attr? {
10350 return Ok(val);
10351 }
10352 }
10353 Err(ErrorContext::new_missing(
10354 "WiphyBands",
10355 "5ghz",
10356 self.orig_loc,
10357 self.buf.as_ptr() as usize,
10358 ))
10359 }
10360 #[doc = "around 60 GHz band (58.32 - 69.12 GHz)"]
10361 pub fn get_60ghz(&self) -> Result<IterableBandAttrs<'a>, ErrorContext> {
10362 let mut iter = self.clone();
10363 iter.pos = 0;
10364 for attr in iter {
10365 if let WiphyBands::_60ghz(val) = attr? {
10366 return Ok(val);
10367 }
10368 }
10369 Err(ErrorContext::new_missing(
10370 "WiphyBands",
10371 "60ghz",
10372 self.orig_loc,
10373 self.buf.as_ptr() as usize,
10374 ))
10375 }
10376 pub fn get_6ghz(&self) -> Result<IterableBandAttrs<'a>, ErrorContext> {
10377 let mut iter = self.clone();
10378 iter.pos = 0;
10379 for attr in iter {
10380 if let WiphyBands::_6ghz(val) = attr? {
10381 return Ok(val);
10382 }
10383 }
10384 Err(ErrorContext::new_missing(
10385 "WiphyBands",
10386 "6ghz",
10387 self.orig_loc,
10388 self.buf.as_ptr() as usize,
10389 ))
10390 }
10391 pub fn get_s1ghz(&self) -> Result<IterableBandAttrs<'a>, ErrorContext> {
10392 let mut iter = self.clone();
10393 iter.pos = 0;
10394 for attr in iter {
10395 if let WiphyBands::S1ghz(val) = attr? {
10396 return Ok(val);
10397 }
10398 }
10399 Err(ErrorContext::new_missing(
10400 "WiphyBands",
10401 "S1ghz",
10402 self.orig_loc,
10403 self.buf.as_ptr() as usize,
10404 ))
10405 }
10406 pub fn get_lc(&self) -> Result<IterableBandAttrs<'a>, ErrorContext> {
10407 let mut iter = self.clone();
10408 iter.pos = 0;
10409 for attr in iter {
10410 if let WiphyBands::Lc(val) = attr? {
10411 return Ok(val);
10412 }
10413 }
10414 Err(ErrorContext::new_missing(
10415 "WiphyBands",
10416 "Lc",
10417 self.orig_loc,
10418 self.buf.as_ptr() as usize,
10419 ))
10420 }
10421}
10422impl WiphyBands<'_> {
10423 pub fn new<'a>(buf: &'a [u8]) -> IterableWiphyBands<'a> {
10424 IterableWiphyBands::with_loc(buf, buf.as_ptr() as usize)
10425 }
10426 fn attr_from_type(r#type: u16) -> Option<&'static str> {
10427 let res = match r#type {
10428 0u16 => "2ghz",
10429 1u16 => "5ghz",
10430 2u16 => "60ghz",
10431 3u16 => "6ghz",
10432 4u16 => "S1ghz",
10433 5u16 => "Lc",
10434 _ => return None,
10435 };
10436 Some(res)
10437 }
10438}
10439#[derive(Clone, Copy, Default)]
10440pub struct IterableWiphyBands<'a> {
10441 buf: &'a [u8],
10442 pos: usize,
10443 orig_loc: usize,
10444}
10445impl<'a> IterableWiphyBands<'a> {
10446 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
10447 Self {
10448 buf,
10449 pos: 0,
10450 orig_loc,
10451 }
10452 }
10453 pub fn get_buf(&self) -> &'a [u8] {
10454 self.buf
10455 }
10456}
10457impl<'a> Iterator for IterableWiphyBands<'a> {
10458 type Item = Result<WiphyBands<'a>, ErrorContext>;
10459 fn next(&mut self) -> Option<Self::Item> {
10460 if self.buf.len() == self.pos {
10461 return None;
10462 }
10463 let pos = self.pos;
10464 let mut r#type = None;
10465 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
10466 r#type = Some(header.r#type);
10467 let res = match header.r#type {
10468 0u16 => WiphyBands::_2ghz({
10469 let res = Some(IterableBandAttrs::with_loc(next, self.orig_loc));
10470 let Some(val) = res else { break };
10471 val
10472 }),
10473 1u16 => WiphyBands::_5ghz({
10474 let res = Some(IterableBandAttrs::with_loc(next, self.orig_loc));
10475 let Some(val) = res else { break };
10476 val
10477 }),
10478 2u16 => WiphyBands::_60ghz({
10479 let res = Some(IterableBandAttrs::with_loc(next, self.orig_loc));
10480 let Some(val) = res else { break };
10481 val
10482 }),
10483 3u16 => WiphyBands::_6ghz({
10484 let res = Some(IterableBandAttrs::with_loc(next, self.orig_loc));
10485 let Some(val) = res else { break };
10486 val
10487 }),
10488 4u16 => WiphyBands::S1ghz({
10489 let res = Some(IterableBandAttrs::with_loc(next, self.orig_loc));
10490 let Some(val) = res else { break };
10491 val
10492 }),
10493 5u16 => WiphyBands::Lc({
10494 let res = Some(IterableBandAttrs::with_loc(next, self.orig_loc));
10495 let Some(val) = res else { break };
10496 val
10497 }),
10498 n => {
10499 if cfg!(any(test, feature = "deny-unknown-attrs")) {
10500 break;
10501 } else {
10502 continue;
10503 }
10504 }
10505 };
10506 return Some(Ok(res));
10507 }
10508 Some(Err(ErrorContext::new(
10509 "WiphyBands",
10510 r#type.and_then(|t| WiphyBands::attr_from_type(t)),
10511 self.orig_loc,
10512 self.buf.as_ptr().wrapping_add(pos) as usize,
10513 )))
10514 }
10515}
10516impl<'a> std::fmt::Debug for IterableWiphyBands<'_> {
10517 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
10518 let mut fmt = f.debug_struct("WiphyBands");
10519 for attr in self.clone() {
10520 let attr = match attr {
10521 Ok(a) => a,
10522 Err(err) => {
10523 fmt.finish()?;
10524 f.write_str("Err(")?;
10525 err.fmt(f)?;
10526 return f.write_str(")");
10527 }
10528 };
10529 match attr {
10530 WiphyBands::_2ghz(val) => fmt.field("_2ghz", &val),
10531 WiphyBands::_5ghz(val) => fmt.field("_5ghz", &val),
10532 WiphyBands::_60ghz(val) => fmt.field("_60ghz", &val),
10533 WiphyBands::_6ghz(val) => fmt.field("_6ghz", &val),
10534 WiphyBands::S1ghz(val) => fmt.field("S1ghz", &val),
10535 WiphyBands::Lc(val) => fmt.field("Lc", &val),
10536 };
10537 }
10538 fmt.finish()
10539 }
10540}
10541impl IterableWiphyBands<'_> {
10542 pub fn lookup_attr(
10543 &self,
10544 offset: usize,
10545 missing_type: Option<u16>,
10546 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
10547 let mut stack = Vec::new();
10548 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
10549 if cur == offset {
10550 stack.push(("WiphyBands", offset));
10551 return (
10552 stack,
10553 missing_type.and_then(|t| WiphyBands::attr_from_type(t)),
10554 );
10555 }
10556 if cur > offset || cur + self.buf.len() < offset {
10557 return (stack, None);
10558 }
10559 let mut attrs = self.clone();
10560 let mut last_off = cur + attrs.pos;
10561 let mut missing = None;
10562 while let Some(attr) = attrs.next() {
10563 let Ok(attr) = attr else { break };
10564 match attr {
10565 WiphyBands::_2ghz(val) => {
10566 (stack, missing) = val.lookup_attr(offset, missing_type);
10567 if !stack.is_empty() {
10568 break;
10569 }
10570 }
10571 WiphyBands::_5ghz(val) => {
10572 (stack, missing) = val.lookup_attr(offset, missing_type);
10573 if !stack.is_empty() {
10574 break;
10575 }
10576 }
10577 WiphyBands::_60ghz(val) => {
10578 (stack, missing) = val.lookup_attr(offset, missing_type);
10579 if !stack.is_empty() {
10580 break;
10581 }
10582 }
10583 WiphyBands::_6ghz(val) => {
10584 (stack, missing) = val.lookup_attr(offset, missing_type);
10585 if !stack.is_empty() {
10586 break;
10587 }
10588 }
10589 WiphyBands::S1ghz(val) => {
10590 (stack, missing) = val.lookup_attr(offset, missing_type);
10591 if !stack.is_empty() {
10592 break;
10593 }
10594 }
10595 WiphyBands::Lc(val) => {
10596 (stack, missing) = val.lookup_attr(offset, missing_type);
10597 if !stack.is_empty() {
10598 break;
10599 }
10600 }
10601 _ => {}
10602 };
10603 last_off = cur + attrs.pos;
10604 }
10605 if !stack.is_empty() {
10606 stack.push(("WiphyBands", cur));
10607 }
10608 (stack, missing)
10609 }
10610}
10611#[derive(Clone)]
10612pub enum BandAttrs<'a> {
10613 Freqs(IterableArrayFrequencyAttrs<'a>),
10614 Rates(IterableArrayBitrateAttrs<'a>),
10615 HtMcsSet(&'a [u8]),
10616 HtCapa(u16),
10617 HtAmpduFactor(u8),
10618 HtAmpduDensity(u8),
10619 VhtMcsSet(&'a [u8]),
10620 VhtCapa(u32),
10621 IftypeData(IterableArrayIftypeDataAttrs<'a>),
10622 EdmgChannels(&'a [u8]),
10623 EdmgBwConfig(&'a [u8]),
10624 S1gMcsNssSet(&'a [u8]),
10625 S1gCapa(&'a [u8]),
10626}
10627impl<'a> IterableBandAttrs<'a> {
10628 pub fn get_freqs(
10629 &self,
10630 ) -> Result<
10631 ArrayIterable<IterableArrayFrequencyAttrs<'a>, IterableFrequencyAttrs<'a>>,
10632 ErrorContext,
10633 > {
10634 for attr in self.clone() {
10635 if let BandAttrs::Freqs(val) = attr? {
10636 return Ok(ArrayIterable::new(val));
10637 }
10638 }
10639 Err(ErrorContext::new_missing(
10640 "BandAttrs",
10641 "Freqs",
10642 self.orig_loc,
10643 self.buf.as_ptr() as usize,
10644 ))
10645 }
10646 pub fn get_rates(
10647 &self,
10648 ) -> Result<ArrayIterable<IterableArrayBitrateAttrs<'a>, IterableBitrateAttrs<'a>>, ErrorContext>
10649 {
10650 for attr in self.clone() {
10651 if let BandAttrs::Rates(val) = attr? {
10652 return Ok(ArrayIterable::new(val));
10653 }
10654 }
10655 Err(ErrorContext::new_missing(
10656 "BandAttrs",
10657 "Rates",
10658 self.orig_loc,
10659 self.buf.as_ptr() as usize,
10660 ))
10661 }
10662 pub fn get_ht_mcs_set(&self) -> Result<&'a [u8], ErrorContext> {
10663 let mut iter = self.clone();
10664 iter.pos = 0;
10665 for attr in iter {
10666 if let BandAttrs::HtMcsSet(val) = attr? {
10667 return Ok(val);
10668 }
10669 }
10670 Err(ErrorContext::new_missing(
10671 "BandAttrs",
10672 "HtMcsSet",
10673 self.orig_loc,
10674 self.buf.as_ptr() as usize,
10675 ))
10676 }
10677 pub fn get_ht_capa(&self) -> Result<u16, ErrorContext> {
10678 let mut iter = self.clone();
10679 iter.pos = 0;
10680 for attr in iter {
10681 if let BandAttrs::HtCapa(val) = attr? {
10682 return Ok(val);
10683 }
10684 }
10685 Err(ErrorContext::new_missing(
10686 "BandAttrs",
10687 "HtCapa",
10688 self.orig_loc,
10689 self.buf.as_ptr() as usize,
10690 ))
10691 }
10692 pub fn get_ht_ampdu_factor(&self) -> Result<u8, ErrorContext> {
10693 let mut iter = self.clone();
10694 iter.pos = 0;
10695 for attr in iter {
10696 if let BandAttrs::HtAmpduFactor(val) = attr? {
10697 return Ok(val);
10698 }
10699 }
10700 Err(ErrorContext::new_missing(
10701 "BandAttrs",
10702 "HtAmpduFactor",
10703 self.orig_loc,
10704 self.buf.as_ptr() as usize,
10705 ))
10706 }
10707 pub fn get_ht_ampdu_density(&self) -> Result<u8, ErrorContext> {
10708 let mut iter = self.clone();
10709 iter.pos = 0;
10710 for attr in iter {
10711 if let BandAttrs::HtAmpduDensity(val) = attr? {
10712 return Ok(val);
10713 }
10714 }
10715 Err(ErrorContext::new_missing(
10716 "BandAttrs",
10717 "HtAmpduDensity",
10718 self.orig_loc,
10719 self.buf.as_ptr() as usize,
10720 ))
10721 }
10722 pub fn get_vht_mcs_set(&self) -> Result<&'a [u8], ErrorContext> {
10723 let mut iter = self.clone();
10724 iter.pos = 0;
10725 for attr in iter {
10726 if let BandAttrs::VhtMcsSet(val) = attr? {
10727 return Ok(val);
10728 }
10729 }
10730 Err(ErrorContext::new_missing(
10731 "BandAttrs",
10732 "VhtMcsSet",
10733 self.orig_loc,
10734 self.buf.as_ptr() as usize,
10735 ))
10736 }
10737 pub fn get_vht_capa(&self) -> Result<u32, ErrorContext> {
10738 let mut iter = self.clone();
10739 iter.pos = 0;
10740 for attr in iter {
10741 if let BandAttrs::VhtCapa(val) = attr? {
10742 return Ok(val);
10743 }
10744 }
10745 Err(ErrorContext::new_missing(
10746 "BandAttrs",
10747 "VhtCapa",
10748 self.orig_loc,
10749 self.buf.as_ptr() as usize,
10750 ))
10751 }
10752 pub fn get_iftype_data(
10753 &self,
10754 ) -> Result<
10755 ArrayIterable<IterableArrayIftypeDataAttrs<'a>, IterableIftypeDataAttrs<'a>>,
10756 ErrorContext,
10757 > {
10758 for attr in self.clone() {
10759 if let BandAttrs::IftypeData(val) = attr? {
10760 return Ok(ArrayIterable::new(val));
10761 }
10762 }
10763 Err(ErrorContext::new_missing(
10764 "BandAttrs",
10765 "IftypeData",
10766 self.orig_loc,
10767 self.buf.as_ptr() as usize,
10768 ))
10769 }
10770 pub fn get_edmg_channels(&self) -> Result<&'a [u8], ErrorContext> {
10771 let mut iter = self.clone();
10772 iter.pos = 0;
10773 for attr in iter {
10774 if let BandAttrs::EdmgChannels(val) = attr? {
10775 return Ok(val);
10776 }
10777 }
10778 Err(ErrorContext::new_missing(
10779 "BandAttrs",
10780 "EdmgChannels",
10781 self.orig_loc,
10782 self.buf.as_ptr() as usize,
10783 ))
10784 }
10785 pub fn get_edmg_bw_config(&self) -> Result<&'a [u8], ErrorContext> {
10786 let mut iter = self.clone();
10787 iter.pos = 0;
10788 for attr in iter {
10789 if let BandAttrs::EdmgBwConfig(val) = attr? {
10790 return Ok(val);
10791 }
10792 }
10793 Err(ErrorContext::new_missing(
10794 "BandAttrs",
10795 "EdmgBwConfig",
10796 self.orig_loc,
10797 self.buf.as_ptr() as usize,
10798 ))
10799 }
10800 pub fn get_s1g_mcs_nss_set(&self) -> Result<&'a [u8], ErrorContext> {
10801 let mut iter = self.clone();
10802 iter.pos = 0;
10803 for attr in iter {
10804 if let BandAttrs::S1gMcsNssSet(val) = attr? {
10805 return Ok(val);
10806 }
10807 }
10808 Err(ErrorContext::new_missing(
10809 "BandAttrs",
10810 "S1gMcsNssSet",
10811 self.orig_loc,
10812 self.buf.as_ptr() as usize,
10813 ))
10814 }
10815 pub fn get_s1g_capa(&self) -> Result<&'a [u8], ErrorContext> {
10816 let mut iter = self.clone();
10817 iter.pos = 0;
10818 for attr in iter {
10819 if let BandAttrs::S1gCapa(val) = attr? {
10820 return Ok(val);
10821 }
10822 }
10823 Err(ErrorContext::new_missing(
10824 "BandAttrs",
10825 "S1gCapa",
10826 self.orig_loc,
10827 self.buf.as_ptr() as usize,
10828 ))
10829 }
10830}
10831impl<'a> FrequencyAttrs<'a> {
10832 pub fn new_array(buf: &[u8]) -> IterableArrayFrequencyAttrs<'_> {
10833 IterableArrayFrequencyAttrs::with_loc(buf, buf.as_ptr() as usize)
10834 }
10835}
10836#[derive(Clone, Copy, Default)]
10837pub struct IterableArrayFrequencyAttrs<'a> {
10838 buf: &'a [u8],
10839 pos: usize,
10840 orig_loc: usize,
10841}
10842impl<'a> IterableArrayFrequencyAttrs<'a> {
10843 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
10844 Self {
10845 buf,
10846 pos: 0,
10847 orig_loc,
10848 }
10849 }
10850 pub fn get_buf(&self) -> &'a [u8] {
10851 self.buf
10852 }
10853}
10854impl<'a> Iterator for IterableArrayFrequencyAttrs<'a> {
10855 type Item = Result<IterableFrequencyAttrs<'a>, ErrorContext>;
10856 fn next(&mut self) -> Option<Self::Item> {
10857 if self.buf.len() == self.pos {
10858 return None;
10859 }
10860 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
10861 {
10862 return Some(Ok(IterableFrequencyAttrs::with_loc(next, self.orig_loc)));
10863 }
10864 }
10865 Some(Err(ErrorContext::new(
10866 "FrequencyAttrs",
10867 None,
10868 self.orig_loc,
10869 self.buf.as_ptr().wrapping_add(self.pos) as usize,
10870 )))
10871 }
10872}
10873impl BitrateAttrs {
10874 pub fn new_array(buf: &[u8]) -> IterableArrayBitrateAttrs<'_> {
10875 IterableArrayBitrateAttrs::with_loc(buf, buf.as_ptr() as usize)
10876 }
10877}
10878#[derive(Clone, Copy, Default)]
10879pub struct IterableArrayBitrateAttrs<'a> {
10880 buf: &'a [u8],
10881 pos: usize,
10882 orig_loc: usize,
10883}
10884impl<'a> IterableArrayBitrateAttrs<'a> {
10885 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
10886 Self {
10887 buf,
10888 pos: 0,
10889 orig_loc,
10890 }
10891 }
10892 pub fn get_buf(&self) -> &'a [u8] {
10893 self.buf
10894 }
10895}
10896impl<'a> Iterator for IterableArrayBitrateAttrs<'a> {
10897 type Item = Result<IterableBitrateAttrs<'a>, ErrorContext>;
10898 fn next(&mut self) -> Option<Self::Item> {
10899 if self.buf.len() == self.pos {
10900 return None;
10901 }
10902 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
10903 {
10904 return Some(Ok(IterableBitrateAttrs::with_loc(next, self.orig_loc)));
10905 }
10906 }
10907 Some(Err(ErrorContext::new(
10908 "BitrateAttrs",
10909 None,
10910 self.orig_loc,
10911 self.buf.as_ptr().wrapping_add(self.pos) as usize,
10912 )))
10913 }
10914}
10915impl<'a> IftypeDataAttrs<'a> {
10916 pub fn new_array(buf: &[u8]) -> IterableArrayIftypeDataAttrs<'_> {
10917 IterableArrayIftypeDataAttrs::with_loc(buf, buf.as_ptr() as usize)
10918 }
10919}
10920#[derive(Clone, Copy, Default)]
10921pub struct IterableArrayIftypeDataAttrs<'a> {
10922 buf: &'a [u8],
10923 pos: usize,
10924 orig_loc: usize,
10925}
10926impl<'a> IterableArrayIftypeDataAttrs<'a> {
10927 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
10928 Self {
10929 buf,
10930 pos: 0,
10931 orig_loc,
10932 }
10933 }
10934 pub fn get_buf(&self) -> &'a [u8] {
10935 self.buf
10936 }
10937}
10938impl<'a> Iterator for IterableArrayIftypeDataAttrs<'a> {
10939 type Item = Result<IterableIftypeDataAttrs<'a>, ErrorContext>;
10940 fn next(&mut self) -> Option<Self::Item> {
10941 if self.buf.len() == self.pos {
10942 return None;
10943 }
10944 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
10945 {
10946 return Some(Ok(IterableIftypeDataAttrs::with_loc(next, self.orig_loc)));
10947 }
10948 }
10949 Some(Err(ErrorContext::new(
10950 "IftypeDataAttrs",
10951 None,
10952 self.orig_loc,
10953 self.buf.as_ptr().wrapping_add(self.pos) as usize,
10954 )))
10955 }
10956}
10957impl BandAttrs<'_> {
10958 pub fn new<'a>(buf: &'a [u8]) -> IterableBandAttrs<'a> {
10959 IterableBandAttrs::with_loc(buf, buf.as_ptr() as usize)
10960 }
10961 fn attr_from_type(r#type: u16) -> Option<&'static str> {
10962 let res = match r#type {
10963 1u16 => "Freqs",
10964 2u16 => "Rates",
10965 3u16 => "HtMcsSet",
10966 4u16 => "HtCapa",
10967 5u16 => "HtAmpduFactor",
10968 6u16 => "HtAmpduDensity",
10969 7u16 => "VhtMcsSet",
10970 8u16 => "VhtCapa",
10971 9u16 => "IftypeData",
10972 10u16 => "EdmgChannels",
10973 11u16 => "EdmgBwConfig",
10974 12u16 => "S1gMcsNssSet",
10975 13u16 => "S1gCapa",
10976 _ => return None,
10977 };
10978 Some(res)
10979 }
10980}
10981#[derive(Clone, Copy, Default)]
10982pub struct IterableBandAttrs<'a> {
10983 buf: &'a [u8],
10984 pos: usize,
10985 orig_loc: usize,
10986}
10987impl<'a> IterableBandAttrs<'a> {
10988 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
10989 Self {
10990 buf,
10991 pos: 0,
10992 orig_loc,
10993 }
10994 }
10995 pub fn get_buf(&self) -> &'a [u8] {
10996 self.buf
10997 }
10998}
10999impl<'a> Iterator for IterableBandAttrs<'a> {
11000 type Item = Result<BandAttrs<'a>, ErrorContext>;
11001 fn next(&mut self) -> Option<Self::Item> {
11002 if self.buf.len() == self.pos {
11003 return None;
11004 }
11005 let pos = self.pos;
11006 let mut r#type = None;
11007 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
11008 r#type = Some(header.r#type);
11009 let res = match header.r#type {
11010 1u16 => BandAttrs::Freqs({
11011 let res = Some(IterableArrayFrequencyAttrs::with_loc(next, self.orig_loc));
11012 let Some(val) = res else { break };
11013 val
11014 }),
11015 2u16 => BandAttrs::Rates({
11016 let res = Some(IterableArrayBitrateAttrs::with_loc(next, self.orig_loc));
11017 let Some(val) = res else { break };
11018 val
11019 }),
11020 3u16 => BandAttrs::HtMcsSet({
11021 let res = Some(next);
11022 let Some(val) = res else { break };
11023 val
11024 }),
11025 4u16 => BandAttrs::HtCapa({
11026 let res = parse_u16(next);
11027 let Some(val) = res else { break };
11028 val
11029 }),
11030 5u16 => BandAttrs::HtAmpduFactor({
11031 let res = parse_u8(next);
11032 let Some(val) = res else { break };
11033 val
11034 }),
11035 6u16 => BandAttrs::HtAmpduDensity({
11036 let res = parse_u8(next);
11037 let Some(val) = res else { break };
11038 val
11039 }),
11040 7u16 => BandAttrs::VhtMcsSet({
11041 let res = Some(next);
11042 let Some(val) = res else { break };
11043 val
11044 }),
11045 8u16 => BandAttrs::VhtCapa({
11046 let res = parse_u32(next);
11047 let Some(val) = res else { break };
11048 val
11049 }),
11050 9u16 => BandAttrs::IftypeData({
11051 let res = Some(IterableArrayIftypeDataAttrs::with_loc(next, self.orig_loc));
11052 let Some(val) = res else { break };
11053 val
11054 }),
11055 10u16 => BandAttrs::EdmgChannels({
11056 let res = Some(next);
11057 let Some(val) = res else { break };
11058 val
11059 }),
11060 11u16 => BandAttrs::EdmgBwConfig({
11061 let res = Some(next);
11062 let Some(val) = res else { break };
11063 val
11064 }),
11065 12u16 => BandAttrs::S1gMcsNssSet({
11066 let res = Some(next);
11067 let Some(val) = res else { break };
11068 val
11069 }),
11070 13u16 => BandAttrs::S1gCapa({
11071 let res = Some(next);
11072 let Some(val) = res else { break };
11073 val
11074 }),
11075 n => {
11076 if cfg!(any(test, feature = "deny-unknown-attrs")) {
11077 break;
11078 } else {
11079 continue;
11080 }
11081 }
11082 };
11083 return Some(Ok(res));
11084 }
11085 Some(Err(ErrorContext::new(
11086 "BandAttrs",
11087 r#type.and_then(|t| BandAttrs::attr_from_type(t)),
11088 self.orig_loc,
11089 self.buf.as_ptr().wrapping_add(pos) as usize,
11090 )))
11091 }
11092}
11093impl std::fmt::Debug for IterableArrayFrequencyAttrs<'_> {
11094 fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11095 fmt.debug_list()
11096 .entries(self.clone().map(FlattenErrorContext))
11097 .finish()
11098 }
11099}
11100impl std::fmt::Debug for IterableArrayBitrateAttrs<'_> {
11101 fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11102 fmt.debug_list()
11103 .entries(self.clone().map(FlattenErrorContext))
11104 .finish()
11105 }
11106}
11107impl std::fmt::Debug for IterableArrayIftypeDataAttrs<'_> {
11108 fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11109 fmt.debug_list()
11110 .entries(self.clone().map(FlattenErrorContext))
11111 .finish()
11112 }
11113}
11114impl<'a> std::fmt::Debug for IterableBandAttrs<'_> {
11115 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11116 let mut fmt = f.debug_struct("BandAttrs");
11117 for attr in self.clone() {
11118 let attr = match attr {
11119 Ok(a) => a,
11120 Err(err) => {
11121 fmt.finish()?;
11122 f.write_str("Err(")?;
11123 err.fmt(f)?;
11124 return f.write_str(")");
11125 }
11126 };
11127 match attr {
11128 BandAttrs::Freqs(val) => fmt.field("Freqs", &val),
11129 BandAttrs::Rates(val) => fmt.field("Rates", &val),
11130 BandAttrs::HtMcsSet(val) => fmt.field("HtMcsSet", &val),
11131 BandAttrs::HtCapa(val) => fmt.field("HtCapa", &val),
11132 BandAttrs::HtAmpduFactor(val) => fmt.field("HtAmpduFactor", &val),
11133 BandAttrs::HtAmpduDensity(val) => fmt.field("HtAmpduDensity", &val),
11134 BandAttrs::VhtMcsSet(val) => fmt.field("VhtMcsSet", &val),
11135 BandAttrs::VhtCapa(val) => fmt.field("VhtCapa", &val),
11136 BandAttrs::IftypeData(val) => fmt.field("IftypeData", &val),
11137 BandAttrs::EdmgChannels(val) => fmt.field("EdmgChannels", &val),
11138 BandAttrs::EdmgBwConfig(val) => fmt.field("EdmgBwConfig", &val),
11139 BandAttrs::S1gMcsNssSet(val) => fmt.field("S1gMcsNssSet", &val),
11140 BandAttrs::S1gCapa(val) => fmt.field("S1gCapa", &val),
11141 };
11142 }
11143 fmt.finish()
11144 }
11145}
11146impl IterableBandAttrs<'_> {
11147 pub fn lookup_attr(
11148 &self,
11149 offset: usize,
11150 missing_type: Option<u16>,
11151 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
11152 let mut stack = Vec::new();
11153 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
11154 if cur == offset {
11155 stack.push(("BandAttrs", offset));
11156 return (
11157 stack,
11158 missing_type.and_then(|t| BandAttrs::attr_from_type(t)),
11159 );
11160 }
11161 if cur > offset || cur + self.buf.len() < offset {
11162 return (stack, None);
11163 }
11164 let mut attrs = self.clone();
11165 let mut last_off = cur + attrs.pos;
11166 let mut missing = None;
11167 while let Some(attr) = attrs.next() {
11168 let Ok(attr) = attr else { break };
11169 match attr {
11170 BandAttrs::Freqs(val) => {
11171 for entry in val {
11172 let Ok(attr) = entry else { break };
11173 (stack, missing) = attr.lookup_attr(offset, missing_type);
11174 if !stack.is_empty() {
11175 break;
11176 }
11177 }
11178 if !stack.is_empty() {
11179 stack.push(("Freqs", last_off));
11180 break;
11181 }
11182 }
11183 BandAttrs::Rates(val) => {
11184 for entry in val {
11185 let Ok(attr) = entry else { break };
11186 (stack, missing) = attr.lookup_attr(offset, missing_type);
11187 if !stack.is_empty() {
11188 break;
11189 }
11190 }
11191 if !stack.is_empty() {
11192 stack.push(("Rates", last_off));
11193 break;
11194 }
11195 }
11196 BandAttrs::HtMcsSet(val) => {
11197 if last_off == offset {
11198 stack.push(("HtMcsSet", last_off));
11199 break;
11200 }
11201 }
11202 BandAttrs::HtCapa(val) => {
11203 if last_off == offset {
11204 stack.push(("HtCapa", last_off));
11205 break;
11206 }
11207 }
11208 BandAttrs::HtAmpduFactor(val) => {
11209 if last_off == offset {
11210 stack.push(("HtAmpduFactor", last_off));
11211 break;
11212 }
11213 }
11214 BandAttrs::HtAmpduDensity(val) => {
11215 if last_off == offset {
11216 stack.push(("HtAmpduDensity", last_off));
11217 break;
11218 }
11219 }
11220 BandAttrs::VhtMcsSet(val) => {
11221 if last_off == offset {
11222 stack.push(("VhtMcsSet", last_off));
11223 break;
11224 }
11225 }
11226 BandAttrs::VhtCapa(val) => {
11227 if last_off == offset {
11228 stack.push(("VhtCapa", last_off));
11229 break;
11230 }
11231 }
11232 BandAttrs::IftypeData(val) => {
11233 for entry in val {
11234 let Ok(attr) = entry else { break };
11235 (stack, missing) = attr.lookup_attr(offset, missing_type);
11236 if !stack.is_empty() {
11237 break;
11238 }
11239 }
11240 if !stack.is_empty() {
11241 stack.push(("IftypeData", last_off));
11242 break;
11243 }
11244 }
11245 BandAttrs::EdmgChannels(val) => {
11246 if last_off == offset {
11247 stack.push(("EdmgChannels", last_off));
11248 break;
11249 }
11250 }
11251 BandAttrs::EdmgBwConfig(val) => {
11252 if last_off == offset {
11253 stack.push(("EdmgBwConfig", last_off));
11254 break;
11255 }
11256 }
11257 BandAttrs::S1gMcsNssSet(val) => {
11258 if last_off == offset {
11259 stack.push(("S1gMcsNssSet", last_off));
11260 break;
11261 }
11262 }
11263 BandAttrs::S1gCapa(val) => {
11264 if last_off == offset {
11265 stack.push(("S1gCapa", last_off));
11266 break;
11267 }
11268 }
11269 _ => {}
11270 };
11271 last_off = cur + attrs.pos;
11272 }
11273 if !stack.is_empty() {
11274 stack.push(("BandAttrs", cur));
11275 }
11276 (stack, missing)
11277 }
11278}
11279#[derive(Clone)]
11280pub enum BitrateAttrs {
11281 Rate(u32),
11282 _2ghzShortpreamble(()),
11283}
11284impl<'a> IterableBitrateAttrs<'a> {
11285 pub fn get_rate(&self) -> Result<u32, ErrorContext> {
11286 let mut iter = self.clone();
11287 iter.pos = 0;
11288 for attr in iter {
11289 if let BitrateAttrs::Rate(val) = attr? {
11290 return Ok(val);
11291 }
11292 }
11293 Err(ErrorContext::new_missing(
11294 "BitrateAttrs",
11295 "Rate",
11296 self.orig_loc,
11297 self.buf.as_ptr() as usize,
11298 ))
11299 }
11300 pub fn get_2ghz_shortpreamble(&self) -> Result<(), ErrorContext> {
11301 let mut iter = self.clone();
11302 iter.pos = 0;
11303 for attr in iter {
11304 if let BitrateAttrs::_2ghzShortpreamble(val) = attr? {
11305 return Ok(val);
11306 }
11307 }
11308 Err(ErrorContext::new_missing(
11309 "BitrateAttrs",
11310 "2ghzShortpreamble",
11311 self.orig_loc,
11312 self.buf.as_ptr() as usize,
11313 ))
11314 }
11315}
11316impl BitrateAttrs {
11317 pub fn new<'a>(buf: &'a [u8]) -> IterableBitrateAttrs<'a> {
11318 IterableBitrateAttrs::with_loc(buf, buf.as_ptr() as usize)
11319 }
11320 fn attr_from_type(r#type: u16) -> Option<&'static str> {
11321 let res = match r#type {
11322 1u16 => "Rate",
11323 2u16 => "2ghzShortpreamble",
11324 _ => return None,
11325 };
11326 Some(res)
11327 }
11328}
11329#[derive(Clone, Copy, Default)]
11330pub struct IterableBitrateAttrs<'a> {
11331 buf: &'a [u8],
11332 pos: usize,
11333 orig_loc: usize,
11334}
11335impl<'a> IterableBitrateAttrs<'a> {
11336 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
11337 Self {
11338 buf,
11339 pos: 0,
11340 orig_loc,
11341 }
11342 }
11343 pub fn get_buf(&self) -> &'a [u8] {
11344 self.buf
11345 }
11346}
11347impl<'a> Iterator for IterableBitrateAttrs<'a> {
11348 type Item = Result<BitrateAttrs, ErrorContext>;
11349 fn next(&mut self) -> Option<Self::Item> {
11350 if self.buf.len() == self.pos {
11351 return None;
11352 }
11353 let pos = self.pos;
11354 let mut r#type = None;
11355 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
11356 r#type = Some(header.r#type);
11357 let res = match header.r#type {
11358 1u16 => BitrateAttrs::Rate({
11359 let res = parse_u32(next);
11360 let Some(val) = res else { break };
11361 val
11362 }),
11363 2u16 => BitrateAttrs::_2ghzShortpreamble(()),
11364 n => {
11365 if cfg!(any(test, feature = "deny-unknown-attrs")) {
11366 break;
11367 } else {
11368 continue;
11369 }
11370 }
11371 };
11372 return Some(Ok(res));
11373 }
11374 Some(Err(ErrorContext::new(
11375 "BitrateAttrs",
11376 r#type.and_then(|t| BitrateAttrs::attr_from_type(t)),
11377 self.orig_loc,
11378 self.buf.as_ptr().wrapping_add(pos) as usize,
11379 )))
11380 }
11381}
11382impl std::fmt::Debug for IterableBitrateAttrs<'_> {
11383 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
11384 let mut fmt = f.debug_struct("BitrateAttrs");
11385 for attr in self.clone() {
11386 let attr = match attr {
11387 Ok(a) => a,
11388 Err(err) => {
11389 fmt.finish()?;
11390 f.write_str("Err(")?;
11391 err.fmt(f)?;
11392 return f.write_str(")");
11393 }
11394 };
11395 match attr {
11396 BitrateAttrs::Rate(val) => fmt.field("Rate", &val),
11397 BitrateAttrs::_2ghzShortpreamble(val) => fmt.field("_2ghzShortpreamble", &val),
11398 };
11399 }
11400 fmt.finish()
11401 }
11402}
11403impl IterableBitrateAttrs<'_> {
11404 pub fn lookup_attr(
11405 &self,
11406 offset: usize,
11407 missing_type: Option<u16>,
11408 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
11409 let mut stack = Vec::new();
11410 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
11411 if cur == offset {
11412 stack.push(("BitrateAttrs", offset));
11413 return (
11414 stack,
11415 missing_type.and_then(|t| BitrateAttrs::attr_from_type(t)),
11416 );
11417 }
11418 if cur > offset || cur + self.buf.len() < offset {
11419 return (stack, None);
11420 }
11421 let mut attrs = self.clone();
11422 let mut last_off = cur + attrs.pos;
11423 while let Some(attr) = attrs.next() {
11424 let Ok(attr) = attr else { break };
11425 match attr {
11426 BitrateAttrs::Rate(val) => {
11427 if last_off == offset {
11428 stack.push(("Rate", last_off));
11429 break;
11430 }
11431 }
11432 BitrateAttrs::_2ghzShortpreamble(val) => {
11433 if last_off == offset {
11434 stack.push(("2ghzShortpreamble", last_off));
11435 break;
11436 }
11437 }
11438 _ => {}
11439 };
11440 last_off = cur + attrs.pos;
11441 }
11442 if !stack.is_empty() {
11443 stack.push(("BitrateAttrs", cur));
11444 }
11445 (stack, None)
11446 }
11447}
11448#[derive(Clone)]
11449pub enum FrequencyAttrs<'a> {
11450 Freq(u32),
11451 Disabled(()),
11452 NoIr(()),
11453 NoIbss(()),
11454 Radar(()),
11455 MaxTxPower(u32),
11456 DfsState(u32),
11457 DfsTime(&'a [u8]),
11458 NoHt40Minus(&'a [u8]),
11459 NoHt40Plus(&'a [u8]),
11460 No80mhz(&'a [u8]),
11461 No160mhz(&'a [u8]),
11462 DfsCacTime(&'a [u8]),
11463 IndoorOnly(&'a [u8]),
11464 IrConcurrent(&'a [u8]),
11465 No20mhz(&'a [u8]),
11466 No10mhz(&'a [u8]),
11467 Wmm(IterableArrayWmmAttrs<'a>),
11468 NoHe(&'a [u8]),
11469 Offset(u32),
11470 _1mhz(&'a [u8]),
11471 _2mhz(&'a [u8]),
11472 _4mhz(&'a [u8]),
11473 _8mhz(&'a [u8]),
11474 _16mhz(&'a [u8]),
11475 No320mhz(&'a [u8]),
11476 NoEht(&'a [u8]),
11477 Psd(&'a [u8]),
11478 DfsConcurrent(&'a [u8]),
11479 No6ghzVlpClient(&'a [u8]),
11480 No6ghzAfcClient(&'a [u8]),
11481 CanMonitor(&'a [u8]),
11482 Allow6ghzVlpAp(&'a [u8]),
11483}
11484impl<'a> IterableFrequencyAttrs<'a> {
11485 pub fn get_freq(&self) -> Result<u32, ErrorContext> {
11486 let mut iter = self.clone();
11487 iter.pos = 0;
11488 for attr in iter {
11489 if let FrequencyAttrs::Freq(val) = attr? {
11490 return Ok(val);
11491 }
11492 }
11493 Err(ErrorContext::new_missing(
11494 "FrequencyAttrs",
11495 "Freq",
11496 self.orig_loc,
11497 self.buf.as_ptr() as usize,
11498 ))
11499 }
11500 pub fn get_disabled(&self) -> Result<(), ErrorContext> {
11501 let mut iter = self.clone();
11502 iter.pos = 0;
11503 for attr in iter {
11504 if let FrequencyAttrs::Disabled(val) = attr? {
11505 return Ok(val);
11506 }
11507 }
11508 Err(ErrorContext::new_missing(
11509 "FrequencyAttrs",
11510 "Disabled",
11511 self.orig_loc,
11512 self.buf.as_ptr() as usize,
11513 ))
11514 }
11515 pub fn get_no_ir(&self) -> Result<(), ErrorContext> {
11516 let mut iter = self.clone();
11517 iter.pos = 0;
11518 for attr in iter {
11519 if let FrequencyAttrs::NoIr(val) = attr? {
11520 return Ok(val);
11521 }
11522 }
11523 Err(ErrorContext::new_missing(
11524 "FrequencyAttrs",
11525 "NoIr",
11526 self.orig_loc,
11527 self.buf.as_ptr() as usize,
11528 ))
11529 }
11530 pub fn get_no_ibss(&self) -> Result<(), ErrorContext> {
11531 let mut iter = self.clone();
11532 iter.pos = 0;
11533 for attr in iter {
11534 if let FrequencyAttrs::NoIbss(val) = attr? {
11535 return Ok(val);
11536 }
11537 }
11538 Err(ErrorContext::new_missing(
11539 "FrequencyAttrs",
11540 "NoIbss",
11541 self.orig_loc,
11542 self.buf.as_ptr() as usize,
11543 ))
11544 }
11545 pub fn get_radar(&self) -> Result<(), ErrorContext> {
11546 let mut iter = self.clone();
11547 iter.pos = 0;
11548 for attr in iter {
11549 if let FrequencyAttrs::Radar(val) = attr? {
11550 return Ok(val);
11551 }
11552 }
11553 Err(ErrorContext::new_missing(
11554 "FrequencyAttrs",
11555 "Radar",
11556 self.orig_loc,
11557 self.buf.as_ptr() as usize,
11558 ))
11559 }
11560 pub fn get_max_tx_power(&self) -> Result<u32, ErrorContext> {
11561 let mut iter = self.clone();
11562 iter.pos = 0;
11563 for attr in iter {
11564 if let FrequencyAttrs::MaxTxPower(val) = attr? {
11565 return Ok(val);
11566 }
11567 }
11568 Err(ErrorContext::new_missing(
11569 "FrequencyAttrs",
11570 "MaxTxPower",
11571 self.orig_loc,
11572 self.buf.as_ptr() as usize,
11573 ))
11574 }
11575 pub fn get_dfs_state(&self) -> Result<u32, ErrorContext> {
11576 let mut iter = self.clone();
11577 iter.pos = 0;
11578 for attr in iter {
11579 if let FrequencyAttrs::DfsState(val) = attr? {
11580 return Ok(val);
11581 }
11582 }
11583 Err(ErrorContext::new_missing(
11584 "FrequencyAttrs",
11585 "DfsState",
11586 self.orig_loc,
11587 self.buf.as_ptr() as usize,
11588 ))
11589 }
11590 pub fn get_dfs_time(&self) -> Result<&'a [u8], ErrorContext> {
11591 let mut iter = self.clone();
11592 iter.pos = 0;
11593 for attr in iter {
11594 if let FrequencyAttrs::DfsTime(val) = attr? {
11595 return Ok(val);
11596 }
11597 }
11598 Err(ErrorContext::new_missing(
11599 "FrequencyAttrs",
11600 "DfsTime",
11601 self.orig_loc,
11602 self.buf.as_ptr() as usize,
11603 ))
11604 }
11605 pub fn get_no_ht40_minus(&self) -> Result<&'a [u8], ErrorContext> {
11606 let mut iter = self.clone();
11607 iter.pos = 0;
11608 for attr in iter {
11609 if let FrequencyAttrs::NoHt40Minus(val) = attr? {
11610 return Ok(val);
11611 }
11612 }
11613 Err(ErrorContext::new_missing(
11614 "FrequencyAttrs",
11615 "NoHt40Minus",
11616 self.orig_loc,
11617 self.buf.as_ptr() as usize,
11618 ))
11619 }
11620 pub fn get_no_ht40_plus(&self) -> Result<&'a [u8], ErrorContext> {
11621 let mut iter = self.clone();
11622 iter.pos = 0;
11623 for attr in iter {
11624 if let FrequencyAttrs::NoHt40Plus(val) = attr? {
11625 return Ok(val);
11626 }
11627 }
11628 Err(ErrorContext::new_missing(
11629 "FrequencyAttrs",
11630 "NoHt40Plus",
11631 self.orig_loc,
11632 self.buf.as_ptr() as usize,
11633 ))
11634 }
11635 pub fn get_no_80mhz(&self) -> Result<&'a [u8], ErrorContext> {
11636 let mut iter = self.clone();
11637 iter.pos = 0;
11638 for attr in iter {
11639 if let FrequencyAttrs::No80mhz(val) = attr? {
11640 return Ok(val);
11641 }
11642 }
11643 Err(ErrorContext::new_missing(
11644 "FrequencyAttrs",
11645 "No80mhz",
11646 self.orig_loc,
11647 self.buf.as_ptr() as usize,
11648 ))
11649 }
11650 pub fn get_no_160mhz(&self) -> Result<&'a [u8], ErrorContext> {
11651 let mut iter = self.clone();
11652 iter.pos = 0;
11653 for attr in iter {
11654 if let FrequencyAttrs::No160mhz(val) = attr? {
11655 return Ok(val);
11656 }
11657 }
11658 Err(ErrorContext::new_missing(
11659 "FrequencyAttrs",
11660 "No160mhz",
11661 self.orig_loc,
11662 self.buf.as_ptr() as usize,
11663 ))
11664 }
11665 pub fn get_dfs_cac_time(&self) -> Result<&'a [u8], ErrorContext> {
11666 let mut iter = self.clone();
11667 iter.pos = 0;
11668 for attr in iter {
11669 if let FrequencyAttrs::DfsCacTime(val) = attr? {
11670 return Ok(val);
11671 }
11672 }
11673 Err(ErrorContext::new_missing(
11674 "FrequencyAttrs",
11675 "DfsCacTime",
11676 self.orig_loc,
11677 self.buf.as_ptr() as usize,
11678 ))
11679 }
11680 pub fn get_indoor_only(&self) -> Result<&'a [u8], ErrorContext> {
11681 let mut iter = self.clone();
11682 iter.pos = 0;
11683 for attr in iter {
11684 if let FrequencyAttrs::IndoorOnly(val) = attr? {
11685 return Ok(val);
11686 }
11687 }
11688 Err(ErrorContext::new_missing(
11689 "FrequencyAttrs",
11690 "IndoorOnly",
11691 self.orig_loc,
11692 self.buf.as_ptr() as usize,
11693 ))
11694 }
11695 pub fn get_ir_concurrent(&self) -> Result<&'a [u8], ErrorContext> {
11696 let mut iter = self.clone();
11697 iter.pos = 0;
11698 for attr in iter {
11699 if let FrequencyAttrs::IrConcurrent(val) = attr? {
11700 return Ok(val);
11701 }
11702 }
11703 Err(ErrorContext::new_missing(
11704 "FrequencyAttrs",
11705 "IrConcurrent",
11706 self.orig_loc,
11707 self.buf.as_ptr() as usize,
11708 ))
11709 }
11710 pub fn get_no_20mhz(&self) -> Result<&'a [u8], ErrorContext> {
11711 let mut iter = self.clone();
11712 iter.pos = 0;
11713 for attr in iter {
11714 if let FrequencyAttrs::No20mhz(val) = attr? {
11715 return Ok(val);
11716 }
11717 }
11718 Err(ErrorContext::new_missing(
11719 "FrequencyAttrs",
11720 "No20mhz",
11721 self.orig_loc,
11722 self.buf.as_ptr() as usize,
11723 ))
11724 }
11725 pub fn get_no_10mhz(&self) -> Result<&'a [u8], ErrorContext> {
11726 let mut iter = self.clone();
11727 iter.pos = 0;
11728 for attr in iter {
11729 if let FrequencyAttrs::No10mhz(val) = attr? {
11730 return Ok(val);
11731 }
11732 }
11733 Err(ErrorContext::new_missing(
11734 "FrequencyAttrs",
11735 "No10mhz",
11736 self.orig_loc,
11737 self.buf.as_ptr() as usize,
11738 ))
11739 }
11740 pub fn get_wmm(
11741 &self,
11742 ) -> Result<ArrayIterable<IterableArrayWmmAttrs<'a>, IterableWmmAttrs<'a>>, ErrorContext> {
11743 for attr in self.clone() {
11744 if let FrequencyAttrs::Wmm(val) = attr? {
11745 return Ok(ArrayIterable::new(val));
11746 }
11747 }
11748 Err(ErrorContext::new_missing(
11749 "FrequencyAttrs",
11750 "Wmm",
11751 self.orig_loc,
11752 self.buf.as_ptr() as usize,
11753 ))
11754 }
11755 pub fn get_no_he(&self) -> Result<&'a [u8], ErrorContext> {
11756 let mut iter = self.clone();
11757 iter.pos = 0;
11758 for attr in iter {
11759 if let FrequencyAttrs::NoHe(val) = attr? {
11760 return Ok(val);
11761 }
11762 }
11763 Err(ErrorContext::new_missing(
11764 "FrequencyAttrs",
11765 "NoHe",
11766 self.orig_loc,
11767 self.buf.as_ptr() as usize,
11768 ))
11769 }
11770 pub fn get_offset(&self) -> Result<u32, ErrorContext> {
11771 let mut iter = self.clone();
11772 iter.pos = 0;
11773 for attr in iter {
11774 if let FrequencyAttrs::Offset(val) = attr? {
11775 return Ok(val);
11776 }
11777 }
11778 Err(ErrorContext::new_missing(
11779 "FrequencyAttrs",
11780 "Offset",
11781 self.orig_loc,
11782 self.buf.as_ptr() as usize,
11783 ))
11784 }
11785 pub fn get_1mhz(&self) -> Result<&'a [u8], ErrorContext> {
11786 let mut iter = self.clone();
11787 iter.pos = 0;
11788 for attr in iter {
11789 if let FrequencyAttrs::_1mhz(val) = attr? {
11790 return Ok(val);
11791 }
11792 }
11793 Err(ErrorContext::new_missing(
11794 "FrequencyAttrs",
11795 "1mhz",
11796 self.orig_loc,
11797 self.buf.as_ptr() as usize,
11798 ))
11799 }
11800 pub fn get_2mhz(&self) -> Result<&'a [u8], ErrorContext> {
11801 let mut iter = self.clone();
11802 iter.pos = 0;
11803 for attr in iter {
11804 if let FrequencyAttrs::_2mhz(val) = attr? {
11805 return Ok(val);
11806 }
11807 }
11808 Err(ErrorContext::new_missing(
11809 "FrequencyAttrs",
11810 "2mhz",
11811 self.orig_loc,
11812 self.buf.as_ptr() as usize,
11813 ))
11814 }
11815 pub fn get_4mhz(&self) -> Result<&'a [u8], ErrorContext> {
11816 let mut iter = self.clone();
11817 iter.pos = 0;
11818 for attr in iter {
11819 if let FrequencyAttrs::_4mhz(val) = attr? {
11820 return Ok(val);
11821 }
11822 }
11823 Err(ErrorContext::new_missing(
11824 "FrequencyAttrs",
11825 "4mhz",
11826 self.orig_loc,
11827 self.buf.as_ptr() as usize,
11828 ))
11829 }
11830 pub fn get_8mhz(&self) -> Result<&'a [u8], ErrorContext> {
11831 let mut iter = self.clone();
11832 iter.pos = 0;
11833 for attr in iter {
11834 if let FrequencyAttrs::_8mhz(val) = attr? {
11835 return Ok(val);
11836 }
11837 }
11838 Err(ErrorContext::new_missing(
11839 "FrequencyAttrs",
11840 "8mhz",
11841 self.orig_loc,
11842 self.buf.as_ptr() as usize,
11843 ))
11844 }
11845 pub fn get_16mhz(&self) -> Result<&'a [u8], ErrorContext> {
11846 let mut iter = self.clone();
11847 iter.pos = 0;
11848 for attr in iter {
11849 if let FrequencyAttrs::_16mhz(val) = attr? {
11850 return Ok(val);
11851 }
11852 }
11853 Err(ErrorContext::new_missing(
11854 "FrequencyAttrs",
11855 "16mhz",
11856 self.orig_loc,
11857 self.buf.as_ptr() as usize,
11858 ))
11859 }
11860 pub fn get_no_320mhz(&self) -> Result<&'a [u8], ErrorContext> {
11861 let mut iter = self.clone();
11862 iter.pos = 0;
11863 for attr in iter {
11864 if let FrequencyAttrs::No320mhz(val) = attr? {
11865 return Ok(val);
11866 }
11867 }
11868 Err(ErrorContext::new_missing(
11869 "FrequencyAttrs",
11870 "No320mhz",
11871 self.orig_loc,
11872 self.buf.as_ptr() as usize,
11873 ))
11874 }
11875 pub fn get_no_eht(&self) -> Result<&'a [u8], ErrorContext> {
11876 let mut iter = self.clone();
11877 iter.pos = 0;
11878 for attr in iter {
11879 if let FrequencyAttrs::NoEht(val) = attr? {
11880 return Ok(val);
11881 }
11882 }
11883 Err(ErrorContext::new_missing(
11884 "FrequencyAttrs",
11885 "NoEht",
11886 self.orig_loc,
11887 self.buf.as_ptr() as usize,
11888 ))
11889 }
11890 pub fn get_psd(&self) -> Result<&'a [u8], ErrorContext> {
11891 let mut iter = self.clone();
11892 iter.pos = 0;
11893 for attr in iter {
11894 if let FrequencyAttrs::Psd(val) = attr? {
11895 return Ok(val);
11896 }
11897 }
11898 Err(ErrorContext::new_missing(
11899 "FrequencyAttrs",
11900 "Psd",
11901 self.orig_loc,
11902 self.buf.as_ptr() as usize,
11903 ))
11904 }
11905 pub fn get_dfs_concurrent(&self) -> Result<&'a [u8], ErrorContext> {
11906 let mut iter = self.clone();
11907 iter.pos = 0;
11908 for attr in iter {
11909 if let FrequencyAttrs::DfsConcurrent(val) = attr? {
11910 return Ok(val);
11911 }
11912 }
11913 Err(ErrorContext::new_missing(
11914 "FrequencyAttrs",
11915 "DfsConcurrent",
11916 self.orig_loc,
11917 self.buf.as_ptr() as usize,
11918 ))
11919 }
11920 pub fn get_no_6ghz_vlp_client(&self) -> Result<&'a [u8], ErrorContext> {
11921 let mut iter = self.clone();
11922 iter.pos = 0;
11923 for attr in iter {
11924 if let FrequencyAttrs::No6ghzVlpClient(val) = attr? {
11925 return Ok(val);
11926 }
11927 }
11928 Err(ErrorContext::new_missing(
11929 "FrequencyAttrs",
11930 "No6ghzVlpClient",
11931 self.orig_loc,
11932 self.buf.as_ptr() as usize,
11933 ))
11934 }
11935 pub fn get_no_6ghz_afc_client(&self) -> Result<&'a [u8], ErrorContext> {
11936 let mut iter = self.clone();
11937 iter.pos = 0;
11938 for attr in iter {
11939 if let FrequencyAttrs::No6ghzAfcClient(val) = attr? {
11940 return Ok(val);
11941 }
11942 }
11943 Err(ErrorContext::new_missing(
11944 "FrequencyAttrs",
11945 "No6ghzAfcClient",
11946 self.orig_loc,
11947 self.buf.as_ptr() as usize,
11948 ))
11949 }
11950 pub fn get_can_monitor(&self) -> Result<&'a [u8], ErrorContext> {
11951 let mut iter = self.clone();
11952 iter.pos = 0;
11953 for attr in iter {
11954 if let FrequencyAttrs::CanMonitor(val) = attr? {
11955 return Ok(val);
11956 }
11957 }
11958 Err(ErrorContext::new_missing(
11959 "FrequencyAttrs",
11960 "CanMonitor",
11961 self.orig_loc,
11962 self.buf.as_ptr() as usize,
11963 ))
11964 }
11965 pub fn get_allow_6ghz_vlp_ap(&self) -> Result<&'a [u8], ErrorContext> {
11966 let mut iter = self.clone();
11967 iter.pos = 0;
11968 for attr in iter {
11969 if let FrequencyAttrs::Allow6ghzVlpAp(val) = attr? {
11970 return Ok(val);
11971 }
11972 }
11973 Err(ErrorContext::new_missing(
11974 "FrequencyAttrs",
11975 "Allow6ghzVlpAp",
11976 self.orig_loc,
11977 self.buf.as_ptr() as usize,
11978 ))
11979 }
11980}
11981impl WmmAttrs {
11982 pub fn new_array(buf: &[u8]) -> IterableArrayWmmAttrs<'_> {
11983 IterableArrayWmmAttrs::with_loc(buf, buf.as_ptr() as usize)
11984 }
11985}
11986#[derive(Clone, Copy, Default)]
11987pub struct IterableArrayWmmAttrs<'a> {
11988 buf: &'a [u8],
11989 pos: usize,
11990 orig_loc: usize,
11991}
11992impl<'a> IterableArrayWmmAttrs<'a> {
11993 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
11994 Self {
11995 buf,
11996 pos: 0,
11997 orig_loc,
11998 }
11999 }
12000 pub fn get_buf(&self) -> &'a [u8] {
12001 self.buf
12002 }
12003}
12004impl<'a> Iterator for IterableArrayWmmAttrs<'a> {
12005 type Item = Result<IterableWmmAttrs<'a>, ErrorContext>;
12006 fn next(&mut self) -> Option<Self::Item> {
12007 if self.buf.len() == self.pos {
12008 return None;
12009 }
12010 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
12011 {
12012 return Some(Ok(IterableWmmAttrs::with_loc(next, self.orig_loc)));
12013 }
12014 }
12015 Some(Err(ErrorContext::new(
12016 "WmmAttrs",
12017 None,
12018 self.orig_loc,
12019 self.buf.as_ptr().wrapping_add(self.pos) as usize,
12020 )))
12021 }
12022}
12023impl FrequencyAttrs<'_> {
12024 pub fn new<'a>(buf: &'a [u8]) -> IterableFrequencyAttrs<'a> {
12025 IterableFrequencyAttrs::with_loc(buf, buf.as_ptr() as usize)
12026 }
12027 fn attr_from_type(r#type: u16) -> Option<&'static str> {
12028 let res = match r#type {
12029 1u16 => "Freq",
12030 2u16 => "Disabled",
12031 3u16 => "NoIr",
12032 4u16 => "NoIbss",
12033 5u16 => "Radar",
12034 6u16 => "MaxTxPower",
12035 7u16 => "DfsState",
12036 8u16 => "DfsTime",
12037 9u16 => "NoHt40Minus",
12038 10u16 => "NoHt40Plus",
12039 11u16 => "No80mhz",
12040 12u16 => "No160mhz",
12041 13u16 => "DfsCacTime",
12042 14u16 => "IndoorOnly",
12043 15u16 => "IrConcurrent",
12044 16u16 => "No20mhz",
12045 17u16 => "No10mhz",
12046 18u16 => "Wmm",
12047 19u16 => "NoHe",
12048 20u16 => "Offset",
12049 21u16 => "1mhz",
12050 22u16 => "2mhz",
12051 23u16 => "4mhz",
12052 24u16 => "8mhz",
12053 25u16 => "16mhz",
12054 26u16 => "No320mhz",
12055 27u16 => "NoEht",
12056 28u16 => "Psd",
12057 29u16 => "DfsConcurrent",
12058 30u16 => "No6ghzVlpClient",
12059 31u16 => "No6ghzAfcClient",
12060 32u16 => "CanMonitor",
12061 33u16 => "Allow6ghzVlpAp",
12062 _ => return None,
12063 };
12064 Some(res)
12065 }
12066}
12067#[derive(Clone, Copy, Default)]
12068pub struct IterableFrequencyAttrs<'a> {
12069 buf: &'a [u8],
12070 pos: usize,
12071 orig_loc: usize,
12072}
12073impl<'a> IterableFrequencyAttrs<'a> {
12074 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
12075 Self {
12076 buf,
12077 pos: 0,
12078 orig_loc,
12079 }
12080 }
12081 pub fn get_buf(&self) -> &'a [u8] {
12082 self.buf
12083 }
12084}
12085impl<'a> Iterator for IterableFrequencyAttrs<'a> {
12086 type Item = Result<FrequencyAttrs<'a>, ErrorContext>;
12087 fn next(&mut self) -> Option<Self::Item> {
12088 if self.buf.len() == self.pos {
12089 return None;
12090 }
12091 let pos = self.pos;
12092 let mut r#type = None;
12093 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
12094 r#type = Some(header.r#type);
12095 let res = match header.r#type {
12096 1u16 => FrequencyAttrs::Freq({
12097 let res = parse_u32(next);
12098 let Some(val) = res else { break };
12099 val
12100 }),
12101 2u16 => FrequencyAttrs::Disabled(()),
12102 3u16 => FrequencyAttrs::NoIr(()),
12103 4u16 => FrequencyAttrs::NoIbss(()),
12104 5u16 => FrequencyAttrs::Radar(()),
12105 6u16 => FrequencyAttrs::MaxTxPower({
12106 let res = parse_u32(next);
12107 let Some(val) = res else { break };
12108 val
12109 }),
12110 7u16 => FrequencyAttrs::DfsState({
12111 let res = parse_u32(next);
12112 let Some(val) = res else { break };
12113 val
12114 }),
12115 8u16 => FrequencyAttrs::DfsTime({
12116 let res = Some(next);
12117 let Some(val) = res else { break };
12118 val
12119 }),
12120 9u16 => FrequencyAttrs::NoHt40Minus({
12121 let res = Some(next);
12122 let Some(val) = res else { break };
12123 val
12124 }),
12125 10u16 => FrequencyAttrs::NoHt40Plus({
12126 let res = Some(next);
12127 let Some(val) = res else { break };
12128 val
12129 }),
12130 11u16 => FrequencyAttrs::No80mhz({
12131 let res = Some(next);
12132 let Some(val) = res else { break };
12133 val
12134 }),
12135 12u16 => FrequencyAttrs::No160mhz({
12136 let res = Some(next);
12137 let Some(val) = res else { break };
12138 val
12139 }),
12140 13u16 => FrequencyAttrs::DfsCacTime({
12141 let res = Some(next);
12142 let Some(val) = res else { break };
12143 val
12144 }),
12145 14u16 => FrequencyAttrs::IndoorOnly({
12146 let res = Some(next);
12147 let Some(val) = res else { break };
12148 val
12149 }),
12150 15u16 => FrequencyAttrs::IrConcurrent({
12151 let res = Some(next);
12152 let Some(val) = res else { break };
12153 val
12154 }),
12155 16u16 => FrequencyAttrs::No20mhz({
12156 let res = Some(next);
12157 let Some(val) = res else { break };
12158 val
12159 }),
12160 17u16 => FrequencyAttrs::No10mhz({
12161 let res = Some(next);
12162 let Some(val) = res else { break };
12163 val
12164 }),
12165 18u16 => FrequencyAttrs::Wmm({
12166 let res = Some(IterableArrayWmmAttrs::with_loc(next, self.orig_loc));
12167 let Some(val) = res else { break };
12168 val
12169 }),
12170 19u16 => FrequencyAttrs::NoHe({
12171 let res = Some(next);
12172 let Some(val) = res else { break };
12173 val
12174 }),
12175 20u16 => FrequencyAttrs::Offset({
12176 let res = parse_u32(next);
12177 let Some(val) = res else { break };
12178 val
12179 }),
12180 21u16 => FrequencyAttrs::_1mhz({
12181 let res = Some(next);
12182 let Some(val) = res else { break };
12183 val
12184 }),
12185 22u16 => FrequencyAttrs::_2mhz({
12186 let res = Some(next);
12187 let Some(val) = res else { break };
12188 val
12189 }),
12190 23u16 => FrequencyAttrs::_4mhz({
12191 let res = Some(next);
12192 let Some(val) = res else { break };
12193 val
12194 }),
12195 24u16 => FrequencyAttrs::_8mhz({
12196 let res = Some(next);
12197 let Some(val) = res else { break };
12198 val
12199 }),
12200 25u16 => FrequencyAttrs::_16mhz({
12201 let res = Some(next);
12202 let Some(val) = res else { break };
12203 val
12204 }),
12205 26u16 => FrequencyAttrs::No320mhz({
12206 let res = Some(next);
12207 let Some(val) = res else { break };
12208 val
12209 }),
12210 27u16 => FrequencyAttrs::NoEht({
12211 let res = Some(next);
12212 let Some(val) = res else { break };
12213 val
12214 }),
12215 28u16 => FrequencyAttrs::Psd({
12216 let res = Some(next);
12217 let Some(val) = res else { break };
12218 val
12219 }),
12220 29u16 => FrequencyAttrs::DfsConcurrent({
12221 let res = Some(next);
12222 let Some(val) = res else { break };
12223 val
12224 }),
12225 30u16 => FrequencyAttrs::No6ghzVlpClient({
12226 let res = Some(next);
12227 let Some(val) = res else { break };
12228 val
12229 }),
12230 31u16 => FrequencyAttrs::No6ghzAfcClient({
12231 let res = Some(next);
12232 let Some(val) = res else { break };
12233 val
12234 }),
12235 32u16 => FrequencyAttrs::CanMonitor({
12236 let res = Some(next);
12237 let Some(val) = res else { break };
12238 val
12239 }),
12240 33u16 => FrequencyAttrs::Allow6ghzVlpAp({
12241 let res = Some(next);
12242 let Some(val) = res else { break };
12243 val
12244 }),
12245 n => {
12246 if cfg!(any(test, feature = "deny-unknown-attrs")) {
12247 break;
12248 } else {
12249 continue;
12250 }
12251 }
12252 };
12253 return Some(Ok(res));
12254 }
12255 Some(Err(ErrorContext::new(
12256 "FrequencyAttrs",
12257 r#type.and_then(|t| FrequencyAttrs::attr_from_type(t)),
12258 self.orig_loc,
12259 self.buf.as_ptr().wrapping_add(pos) as usize,
12260 )))
12261 }
12262}
12263impl std::fmt::Debug for IterableArrayWmmAttrs<'_> {
12264 fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12265 fmt.debug_list()
12266 .entries(self.clone().map(FlattenErrorContext))
12267 .finish()
12268 }
12269}
12270impl<'a> std::fmt::Debug for IterableFrequencyAttrs<'_> {
12271 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12272 let mut fmt = f.debug_struct("FrequencyAttrs");
12273 for attr in self.clone() {
12274 let attr = match attr {
12275 Ok(a) => a,
12276 Err(err) => {
12277 fmt.finish()?;
12278 f.write_str("Err(")?;
12279 err.fmt(f)?;
12280 return f.write_str(")");
12281 }
12282 };
12283 match attr {
12284 FrequencyAttrs::Freq(val) => fmt.field("Freq", &val),
12285 FrequencyAttrs::Disabled(val) => fmt.field("Disabled", &val),
12286 FrequencyAttrs::NoIr(val) => fmt.field("NoIr", &val),
12287 FrequencyAttrs::NoIbss(val) => fmt.field("NoIbss", &val),
12288 FrequencyAttrs::Radar(val) => fmt.field("Radar", &val),
12289 FrequencyAttrs::MaxTxPower(val) => fmt.field("MaxTxPower", &val),
12290 FrequencyAttrs::DfsState(val) => fmt.field("DfsState", &val),
12291 FrequencyAttrs::DfsTime(val) => fmt.field("DfsTime", &val),
12292 FrequencyAttrs::NoHt40Minus(val) => fmt.field("NoHt40Minus", &val),
12293 FrequencyAttrs::NoHt40Plus(val) => fmt.field("NoHt40Plus", &val),
12294 FrequencyAttrs::No80mhz(val) => fmt.field("No80mhz", &val),
12295 FrequencyAttrs::No160mhz(val) => fmt.field("No160mhz", &val),
12296 FrequencyAttrs::DfsCacTime(val) => fmt.field("DfsCacTime", &val),
12297 FrequencyAttrs::IndoorOnly(val) => fmt.field("IndoorOnly", &val),
12298 FrequencyAttrs::IrConcurrent(val) => fmt.field("IrConcurrent", &val),
12299 FrequencyAttrs::No20mhz(val) => fmt.field("No20mhz", &val),
12300 FrequencyAttrs::No10mhz(val) => fmt.field("No10mhz", &val),
12301 FrequencyAttrs::Wmm(val) => fmt.field("Wmm", &val),
12302 FrequencyAttrs::NoHe(val) => fmt.field("NoHe", &val),
12303 FrequencyAttrs::Offset(val) => fmt.field("Offset", &val),
12304 FrequencyAttrs::_1mhz(val) => fmt.field("_1mhz", &val),
12305 FrequencyAttrs::_2mhz(val) => fmt.field("_2mhz", &val),
12306 FrequencyAttrs::_4mhz(val) => fmt.field("_4mhz", &val),
12307 FrequencyAttrs::_8mhz(val) => fmt.field("_8mhz", &val),
12308 FrequencyAttrs::_16mhz(val) => fmt.field("_16mhz", &val),
12309 FrequencyAttrs::No320mhz(val) => fmt.field("No320mhz", &val),
12310 FrequencyAttrs::NoEht(val) => fmt.field("NoEht", &val),
12311 FrequencyAttrs::Psd(val) => fmt.field("Psd", &val),
12312 FrequencyAttrs::DfsConcurrent(val) => fmt.field("DfsConcurrent", &val),
12313 FrequencyAttrs::No6ghzVlpClient(val) => fmt.field("No6ghzVlpClient", &val),
12314 FrequencyAttrs::No6ghzAfcClient(val) => fmt.field("No6ghzAfcClient", &val),
12315 FrequencyAttrs::CanMonitor(val) => fmt.field("CanMonitor", &val),
12316 FrequencyAttrs::Allow6ghzVlpAp(val) => fmt.field("Allow6ghzVlpAp", &val),
12317 };
12318 }
12319 fmt.finish()
12320 }
12321}
12322impl IterableFrequencyAttrs<'_> {
12323 pub fn lookup_attr(
12324 &self,
12325 offset: usize,
12326 missing_type: Option<u16>,
12327 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
12328 let mut stack = Vec::new();
12329 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
12330 if cur == offset {
12331 stack.push(("FrequencyAttrs", offset));
12332 return (
12333 stack,
12334 missing_type.and_then(|t| FrequencyAttrs::attr_from_type(t)),
12335 );
12336 }
12337 if cur > offset || cur + self.buf.len() < offset {
12338 return (stack, None);
12339 }
12340 let mut attrs = self.clone();
12341 let mut last_off = cur + attrs.pos;
12342 let mut missing = None;
12343 while let Some(attr) = attrs.next() {
12344 let Ok(attr) = attr else { break };
12345 match attr {
12346 FrequencyAttrs::Freq(val) => {
12347 if last_off == offset {
12348 stack.push(("Freq", last_off));
12349 break;
12350 }
12351 }
12352 FrequencyAttrs::Disabled(val) => {
12353 if last_off == offset {
12354 stack.push(("Disabled", last_off));
12355 break;
12356 }
12357 }
12358 FrequencyAttrs::NoIr(val) => {
12359 if last_off == offset {
12360 stack.push(("NoIr", last_off));
12361 break;
12362 }
12363 }
12364 FrequencyAttrs::NoIbss(val) => {
12365 if last_off == offset {
12366 stack.push(("NoIbss", last_off));
12367 break;
12368 }
12369 }
12370 FrequencyAttrs::Radar(val) => {
12371 if last_off == offset {
12372 stack.push(("Radar", last_off));
12373 break;
12374 }
12375 }
12376 FrequencyAttrs::MaxTxPower(val) => {
12377 if last_off == offset {
12378 stack.push(("MaxTxPower", last_off));
12379 break;
12380 }
12381 }
12382 FrequencyAttrs::DfsState(val) => {
12383 if last_off == offset {
12384 stack.push(("DfsState", last_off));
12385 break;
12386 }
12387 }
12388 FrequencyAttrs::DfsTime(val) => {
12389 if last_off == offset {
12390 stack.push(("DfsTime", last_off));
12391 break;
12392 }
12393 }
12394 FrequencyAttrs::NoHt40Minus(val) => {
12395 if last_off == offset {
12396 stack.push(("NoHt40Minus", last_off));
12397 break;
12398 }
12399 }
12400 FrequencyAttrs::NoHt40Plus(val) => {
12401 if last_off == offset {
12402 stack.push(("NoHt40Plus", last_off));
12403 break;
12404 }
12405 }
12406 FrequencyAttrs::No80mhz(val) => {
12407 if last_off == offset {
12408 stack.push(("No80mhz", last_off));
12409 break;
12410 }
12411 }
12412 FrequencyAttrs::No160mhz(val) => {
12413 if last_off == offset {
12414 stack.push(("No160mhz", last_off));
12415 break;
12416 }
12417 }
12418 FrequencyAttrs::DfsCacTime(val) => {
12419 if last_off == offset {
12420 stack.push(("DfsCacTime", last_off));
12421 break;
12422 }
12423 }
12424 FrequencyAttrs::IndoorOnly(val) => {
12425 if last_off == offset {
12426 stack.push(("IndoorOnly", last_off));
12427 break;
12428 }
12429 }
12430 FrequencyAttrs::IrConcurrent(val) => {
12431 if last_off == offset {
12432 stack.push(("IrConcurrent", last_off));
12433 break;
12434 }
12435 }
12436 FrequencyAttrs::No20mhz(val) => {
12437 if last_off == offset {
12438 stack.push(("No20mhz", last_off));
12439 break;
12440 }
12441 }
12442 FrequencyAttrs::No10mhz(val) => {
12443 if last_off == offset {
12444 stack.push(("No10mhz", last_off));
12445 break;
12446 }
12447 }
12448 FrequencyAttrs::Wmm(val) => {
12449 for entry in val {
12450 let Ok(attr) = entry else { break };
12451 (stack, missing) = attr.lookup_attr(offset, missing_type);
12452 if !stack.is_empty() {
12453 break;
12454 }
12455 }
12456 if !stack.is_empty() {
12457 stack.push(("Wmm", last_off));
12458 break;
12459 }
12460 }
12461 FrequencyAttrs::NoHe(val) => {
12462 if last_off == offset {
12463 stack.push(("NoHe", last_off));
12464 break;
12465 }
12466 }
12467 FrequencyAttrs::Offset(val) => {
12468 if last_off == offset {
12469 stack.push(("Offset", last_off));
12470 break;
12471 }
12472 }
12473 FrequencyAttrs::_1mhz(val) => {
12474 if last_off == offset {
12475 stack.push(("1mhz", last_off));
12476 break;
12477 }
12478 }
12479 FrequencyAttrs::_2mhz(val) => {
12480 if last_off == offset {
12481 stack.push(("2mhz", last_off));
12482 break;
12483 }
12484 }
12485 FrequencyAttrs::_4mhz(val) => {
12486 if last_off == offset {
12487 stack.push(("4mhz", last_off));
12488 break;
12489 }
12490 }
12491 FrequencyAttrs::_8mhz(val) => {
12492 if last_off == offset {
12493 stack.push(("8mhz", last_off));
12494 break;
12495 }
12496 }
12497 FrequencyAttrs::_16mhz(val) => {
12498 if last_off == offset {
12499 stack.push(("16mhz", last_off));
12500 break;
12501 }
12502 }
12503 FrequencyAttrs::No320mhz(val) => {
12504 if last_off == offset {
12505 stack.push(("No320mhz", last_off));
12506 break;
12507 }
12508 }
12509 FrequencyAttrs::NoEht(val) => {
12510 if last_off == offset {
12511 stack.push(("NoEht", last_off));
12512 break;
12513 }
12514 }
12515 FrequencyAttrs::Psd(val) => {
12516 if last_off == offset {
12517 stack.push(("Psd", last_off));
12518 break;
12519 }
12520 }
12521 FrequencyAttrs::DfsConcurrent(val) => {
12522 if last_off == offset {
12523 stack.push(("DfsConcurrent", last_off));
12524 break;
12525 }
12526 }
12527 FrequencyAttrs::No6ghzVlpClient(val) => {
12528 if last_off == offset {
12529 stack.push(("No6ghzVlpClient", last_off));
12530 break;
12531 }
12532 }
12533 FrequencyAttrs::No6ghzAfcClient(val) => {
12534 if last_off == offset {
12535 stack.push(("No6ghzAfcClient", last_off));
12536 break;
12537 }
12538 }
12539 FrequencyAttrs::CanMonitor(val) => {
12540 if last_off == offset {
12541 stack.push(("CanMonitor", last_off));
12542 break;
12543 }
12544 }
12545 FrequencyAttrs::Allow6ghzVlpAp(val) => {
12546 if last_off == offset {
12547 stack.push(("Allow6ghzVlpAp", last_off));
12548 break;
12549 }
12550 }
12551 _ => {}
12552 };
12553 last_off = cur + attrs.pos;
12554 }
12555 if !stack.is_empty() {
12556 stack.push(("FrequencyAttrs", cur));
12557 }
12558 (stack, missing)
12559 }
12560}
12561#[derive(Clone)]
12562pub enum IfCombinationAttributes<'a> {
12563 Limits(IterableArrayIfaceLimitAttributes<'a>),
12564 Maxnum(u32),
12565 StaApBiMatch(()),
12566 NumChannels(u32),
12567 RadarDetectWidths(u32),
12568 RadarDetectRegions(u32),
12569 BiMinGcd(u32),
12570}
12571impl<'a> IterableIfCombinationAttributes<'a> {
12572 pub fn get_limits(
12573 &self,
12574 ) -> Result<
12575 ArrayIterable<IterableArrayIfaceLimitAttributes<'a>, IterableIfaceLimitAttributes<'a>>,
12576 ErrorContext,
12577 > {
12578 for attr in self.clone() {
12579 if let IfCombinationAttributes::Limits(val) = attr? {
12580 return Ok(ArrayIterable::new(val));
12581 }
12582 }
12583 Err(ErrorContext::new_missing(
12584 "IfCombinationAttributes",
12585 "Limits",
12586 self.orig_loc,
12587 self.buf.as_ptr() as usize,
12588 ))
12589 }
12590 pub fn get_maxnum(&self) -> Result<u32, ErrorContext> {
12591 let mut iter = self.clone();
12592 iter.pos = 0;
12593 for attr in iter {
12594 if let IfCombinationAttributes::Maxnum(val) = attr? {
12595 return Ok(val);
12596 }
12597 }
12598 Err(ErrorContext::new_missing(
12599 "IfCombinationAttributes",
12600 "Maxnum",
12601 self.orig_loc,
12602 self.buf.as_ptr() as usize,
12603 ))
12604 }
12605 pub fn get_sta_ap_bi_match(&self) -> Result<(), ErrorContext> {
12606 let mut iter = self.clone();
12607 iter.pos = 0;
12608 for attr in iter {
12609 if let IfCombinationAttributes::StaApBiMatch(val) = attr? {
12610 return Ok(val);
12611 }
12612 }
12613 Err(ErrorContext::new_missing(
12614 "IfCombinationAttributes",
12615 "StaApBiMatch",
12616 self.orig_loc,
12617 self.buf.as_ptr() as usize,
12618 ))
12619 }
12620 pub fn get_num_channels(&self) -> Result<u32, ErrorContext> {
12621 let mut iter = self.clone();
12622 iter.pos = 0;
12623 for attr in iter {
12624 if let IfCombinationAttributes::NumChannels(val) = attr? {
12625 return Ok(val);
12626 }
12627 }
12628 Err(ErrorContext::new_missing(
12629 "IfCombinationAttributes",
12630 "NumChannels",
12631 self.orig_loc,
12632 self.buf.as_ptr() as usize,
12633 ))
12634 }
12635 pub fn get_radar_detect_widths(&self) -> Result<u32, ErrorContext> {
12636 let mut iter = self.clone();
12637 iter.pos = 0;
12638 for attr in iter {
12639 if let IfCombinationAttributes::RadarDetectWidths(val) = attr? {
12640 return Ok(val);
12641 }
12642 }
12643 Err(ErrorContext::new_missing(
12644 "IfCombinationAttributes",
12645 "RadarDetectWidths",
12646 self.orig_loc,
12647 self.buf.as_ptr() as usize,
12648 ))
12649 }
12650 pub fn get_radar_detect_regions(&self) -> Result<u32, ErrorContext> {
12651 let mut iter = self.clone();
12652 iter.pos = 0;
12653 for attr in iter {
12654 if let IfCombinationAttributes::RadarDetectRegions(val) = attr? {
12655 return Ok(val);
12656 }
12657 }
12658 Err(ErrorContext::new_missing(
12659 "IfCombinationAttributes",
12660 "RadarDetectRegions",
12661 self.orig_loc,
12662 self.buf.as_ptr() as usize,
12663 ))
12664 }
12665 pub fn get_bi_min_gcd(&self) -> Result<u32, ErrorContext> {
12666 let mut iter = self.clone();
12667 iter.pos = 0;
12668 for attr in iter {
12669 if let IfCombinationAttributes::BiMinGcd(val) = attr? {
12670 return Ok(val);
12671 }
12672 }
12673 Err(ErrorContext::new_missing(
12674 "IfCombinationAttributes",
12675 "BiMinGcd",
12676 self.orig_loc,
12677 self.buf.as_ptr() as usize,
12678 ))
12679 }
12680}
12681impl<'a> IfaceLimitAttributes<'a> {
12682 pub fn new_array(buf: &[u8]) -> IterableArrayIfaceLimitAttributes<'_> {
12683 IterableArrayIfaceLimitAttributes::with_loc(buf, buf.as_ptr() as usize)
12684 }
12685}
12686#[derive(Clone, Copy, Default)]
12687pub struct IterableArrayIfaceLimitAttributes<'a> {
12688 buf: &'a [u8],
12689 pos: usize,
12690 orig_loc: usize,
12691}
12692impl<'a> IterableArrayIfaceLimitAttributes<'a> {
12693 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
12694 Self {
12695 buf,
12696 pos: 0,
12697 orig_loc,
12698 }
12699 }
12700 pub fn get_buf(&self) -> &'a [u8] {
12701 self.buf
12702 }
12703}
12704impl<'a> Iterator for IterableArrayIfaceLimitAttributes<'a> {
12705 type Item = Result<IterableIfaceLimitAttributes<'a>, ErrorContext>;
12706 fn next(&mut self) -> Option<Self::Item> {
12707 if self.buf.len() == self.pos {
12708 return None;
12709 }
12710 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
12711 {
12712 return Some(Ok(IterableIfaceLimitAttributes::with_loc(
12713 next,
12714 self.orig_loc,
12715 )));
12716 }
12717 }
12718 Some(Err(ErrorContext::new(
12719 "IfaceLimitAttributes",
12720 None,
12721 self.orig_loc,
12722 self.buf.as_ptr().wrapping_add(self.pos) as usize,
12723 )))
12724 }
12725}
12726impl IfCombinationAttributes<'_> {
12727 pub fn new<'a>(buf: &'a [u8]) -> IterableIfCombinationAttributes<'a> {
12728 IterableIfCombinationAttributes::with_loc(buf, buf.as_ptr() as usize)
12729 }
12730 fn attr_from_type(r#type: u16) -> Option<&'static str> {
12731 let res = match r#type {
12732 1u16 => "Limits",
12733 2u16 => "Maxnum",
12734 3u16 => "StaApBiMatch",
12735 4u16 => "NumChannels",
12736 5u16 => "RadarDetectWidths",
12737 6u16 => "RadarDetectRegions",
12738 7u16 => "BiMinGcd",
12739 _ => return None,
12740 };
12741 Some(res)
12742 }
12743}
12744#[derive(Clone, Copy, Default)]
12745pub struct IterableIfCombinationAttributes<'a> {
12746 buf: &'a [u8],
12747 pos: usize,
12748 orig_loc: usize,
12749}
12750impl<'a> IterableIfCombinationAttributes<'a> {
12751 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
12752 Self {
12753 buf,
12754 pos: 0,
12755 orig_loc,
12756 }
12757 }
12758 pub fn get_buf(&self) -> &'a [u8] {
12759 self.buf
12760 }
12761}
12762impl<'a> Iterator for IterableIfCombinationAttributes<'a> {
12763 type Item = Result<IfCombinationAttributes<'a>, ErrorContext>;
12764 fn next(&mut self) -> Option<Self::Item> {
12765 if self.buf.len() == self.pos {
12766 return None;
12767 }
12768 let pos = self.pos;
12769 let mut r#type = None;
12770 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
12771 r#type = Some(header.r#type);
12772 let res = match header.r#type {
12773 1u16 => IfCombinationAttributes::Limits({
12774 let res = Some(IterableArrayIfaceLimitAttributes::with_loc(
12775 next,
12776 self.orig_loc,
12777 ));
12778 let Some(val) = res else { break };
12779 val
12780 }),
12781 2u16 => IfCombinationAttributes::Maxnum({
12782 let res = parse_u32(next);
12783 let Some(val) = res else { break };
12784 val
12785 }),
12786 3u16 => IfCombinationAttributes::StaApBiMatch(()),
12787 4u16 => IfCombinationAttributes::NumChannels({
12788 let res = parse_u32(next);
12789 let Some(val) = res else { break };
12790 val
12791 }),
12792 5u16 => IfCombinationAttributes::RadarDetectWidths({
12793 let res = parse_u32(next);
12794 let Some(val) = res else { break };
12795 val
12796 }),
12797 6u16 => IfCombinationAttributes::RadarDetectRegions({
12798 let res = parse_u32(next);
12799 let Some(val) = res else { break };
12800 val
12801 }),
12802 7u16 => IfCombinationAttributes::BiMinGcd({
12803 let res = parse_u32(next);
12804 let Some(val) = res else { break };
12805 val
12806 }),
12807 n => {
12808 if cfg!(any(test, feature = "deny-unknown-attrs")) {
12809 break;
12810 } else {
12811 continue;
12812 }
12813 }
12814 };
12815 return Some(Ok(res));
12816 }
12817 Some(Err(ErrorContext::new(
12818 "IfCombinationAttributes",
12819 r#type.and_then(|t| IfCombinationAttributes::attr_from_type(t)),
12820 self.orig_loc,
12821 self.buf.as_ptr().wrapping_add(pos) as usize,
12822 )))
12823 }
12824}
12825impl std::fmt::Debug for IterableArrayIfaceLimitAttributes<'_> {
12826 fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12827 fmt.debug_list()
12828 .entries(self.clone().map(FlattenErrorContext))
12829 .finish()
12830 }
12831}
12832impl<'a> std::fmt::Debug for IterableIfCombinationAttributes<'_> {
12833 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12834 let mut fmt = f.debug_struct("IfCombinationAttributes");
12835 for attr in self.clone() {
12836 let attr = match attr {
12837 Ok(a) => a,
12838 Err(err) => {
12839 fmt.finish()?;
12840 f.write_str("Err(")?;
12841 err.fmt(f)?;
12842 return f.write_str(")");
12843 }
12844 };
12845 match attr {
12846 IfCombinationAttributes::Limits(val) => fmt.field("Limits", &val),
12847 IfCombinationAttributes::Maxnum(val) => fmt.field("Maxnum", &val),
12848 IfCombinationAttributes::StaApBiMatch(val) => fmt.field("StaApBiMatch", &val),
12849 IfCombinationAttributes::NumChannels(val) => fmt.field("NumChannels", &val),
12850 IfCombinationAttributes::RadarDetectWidths(val) => {
12851 fmt.field("RadarDetectWidths", &val)
12852 }
12853 IfCombinationAttributes::RadarDetectRegions(val) => {
12854 fmt.field("RadarDetectRegions", &val)
12855 }
12856 IfCombinationAttributes::BiMinGcd(val) => fmt.field("BiMinGcd", &val),
12857 };
12858 }
12859 fmt.finish()
12860 }
12861}
12862impl IterableIfCombinationAttributes<'_> {
12863 pub fn lookup_attr(
12864 &self,
12865 offset: usize,
12866 missing_type: Option<u16>,
12867 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
12868 let mut stack = Vec::new();
12869 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
12870 if cur == offset {
12871 stack.push(("IfCombinationAttributes", offset));
12872 return (
12873 stack,
12874 missing_type.and_then(|t| IfCombinationAttributes::attr_from_type(t)),
12875 );
12876 }
12877 if cur > offset || cur + self.buf.len() < offset {
12878 return (stack, None);
12879 }
12880 let mut attrs = self.clone();
12881 let mut last_off = cur + attrs.pos;
12882 let mut missing = None;
12883 while let Some(attr) = attrs.next() {
12884 let Ok(attr) = attr else { break };
12885 match attr {
12886 IfCombinationAttributes::Limits(val) => {
12887 for entry in val {
12888 let Ok(attr) = entry else { break };
12889 (stack, missing) = attr.lookup_attr(offset, missing_type);
12890 if !stack.is_empty() {
12891 break;
12892 }
12893 }
12894 if !stack.is_empty() {
12895 stack.push(("Limits", last_off));
12896 break;
12897 }
12898 }
12899 IfCombinationAttributes::Maxnum(val) => {
12900 if last_off == offset {
12901 stack.push(("Maxnum", last_off));
12902 break;
12903 }
12904 }
12905 IfCombinationAttributes::StaApBiMatch(val) => {
12906 if last_off == offset {
12907 stack.push(("StaApBiMatch", last_off));
12908 break;
12909 }
12910 }
12911 IfCombinationAttributes::NumChannels(val) => {
12912 if last_off == offset {
12913 stack.push(("NumChannels", last_off));
12914 break;
12915 }
12916 }
12917 IfCombinationAttributes::RadarDetectWidths(val) => {
12918 if last_off == offset {
12919 stack.push(("RadarDetectWidths", last_off));
12920 break;
12921 }
12922 }
12923 IfCombinationAttributes::RadarDetectRegions(val) => {
12924 if last_off == offset {
12925 stack.push(("RadarDetectRegions", last_off));
12926 break;
12927 }
12928 }
12929 IfCombinationAttributes::BiMinGcd(val) => {
12930 if last_off == offset {
12931 stack.push(("BiMinGcd", last_off));
12932 break;
12933 }
12934 }
12935 _ => {}
12936 };
12937 last_off = cur + attrs.pos;
12938 }
12939 if !stack.is_empty() {
12940 stack.push(("IfCombinationAttributes", cur));
12941 }
12942 (stack, missing)
12943 }
12944}
12945#[derive(Clone)]
12946pub enum IfaceLimitAttributes<'a> {
12947 Max(u32),
12948 Types(IterableSupportedIftypes<'a>),
12949}
12950impl<'a> IterableIfaceLimitAttributes<'a> {
12951 pub fn get_max(&self) -> Result<u32, ErrorContext> {
12952 let mut iter = self.clone();
12953 iter.pos = 0;
12954 for attr in iter {
12955 if let IfaceLimitAttributes::Max(val) = attr? {
12956 return Ok(val);
12957 }
12958 }
12959 Err(ErrorContext::new_missing(
12960 "IfaceLimitAttributes",
12961 "Max",
12962 self.orig_loc,
12963 self.buf.as_ptr() as usize,
12964 ))
12965 }
12966 pub fn get_types(&self) -> Result<IterableSupportedIftypes<'a>, ErrorContext> {
12967 let mut iter = self.clone();
12968 iter.pos = 0;
12969 for attr in iter {
12970 if let IfaceLimitAttributes::Types(val) = attr? {
12971 return Ok(val);
12972 }
12973 }
12974 Err(ErrorContext::new_missing(
12975 "IfaceLimitAttributes",
12976 "Types",
12977 self.orig_loc,
12978 self.buf.as_ptr() as usize,
12979 ))
12980 }
12981}
12982impl IfaceLimitAttributes<'_> {
12983 pub fn new<'a>(buf: &'a [u8]) -> IterableIfaceLimitAttributes<'a> {
12984 IterableIfaceLimitAttributes::with_loc(buf, buf.as_ptr() as usize)
12985 }
12986 fn attr_from_type(r#type: u16) -> Option<&'static str> {
12987 let res = match r#type {
12988 1u16 => "Max",
12989 2u16 => "Types",
12990 _ => return None,
12991 };
12992 Some(res)
12993 }
12994}
12995#[derive(Clone, Copy, Default)]
12996pub struct IterableIfaceLimitAttributes<'a> {
12997 buf: &'a [u8],
12998 pos: usize,
12999 orig_loc: usize,
13000}
13001impl<'a> IterableIfaceLimitAttributes<'a> {
13002 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
13003 Self {
13004 buf,
13005 pos: 0,
13006 orig_loc,
13007 }
13008 }
13009 pub fn get_buf(&self) -> &'a [u8] {
13010 self.buf
13011 }
13012}
13013impl<'a> Iterator for IterableIfaceLimitAttributes<'a> {
13014 type Item = Result<IfaceLimitAttributes<'a>, ErrorContext>;
13015 fn next(&mut self) -> Option<Self::Item> {
13016 if self.buf.len() == self.pos {
13017 return None;
13018 }
13019 let pos = self.pos;
13020 let mut r#type = None;
13021 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
13022 r#type = Some(header.r#type);
13023 let res = match header.r#type {
13024 1u16 => IfaceLimitAttributes::Max({
13025 let res = parse_u32(next);
13026 let Some(val) = res else { break };
13027 val
13028 }),
13029 2u16 => IfaceLimitAttributes::Types({
13030 let res = Some(IterableSupportedIftypes::with_loc(next, self.orig_loc));
13031 let Some(val) = res else { break };
13032 val
13033 }),
13034 n => {
13035 if cfg!(any(test, feature = "deny-unknown-attrs")) {
13036 break;
13037 } else {
13038 continue;
13039 }
13040 }
13041 };
13042 return Some(Ok(res));
13043 }
13044 Some(Err(ErrorContext::new(
13045 "IfaceLimitAttributes",
13046 r#type.and_then(|t| IfaceLimitAttributes::attr_from_type(t)),
13047 self.orig_loc,
13048 self.buf.as_ptr().wrapping_add(pos) as usize,
13049 )))
13050 }
13051}
13052impl<'a> std::fmt::Debug for IterableIfaceLimitAttributes<'_> {
13053 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13054 let mut fmt = f.debug_struct("IfaceLimitAttributes");
13055 for attr in self.clone() {
13056 let attr = match attr {
13057 Ok(a) => a,
13058 Err(err) => {
13059 fmt.finish()?;
13060 f.write_str("Err(")?;
13061 err.fmt(f)?;
13062 return f.write_str(")");
13063 }
13064 };
13065 match attr {
13066 IfaceLimitAttributes::Max(val) => fmt.field("Max", &val),
13067 IfaceLimitAttributes::Types(val) => fmt.field("Types", &val),
13068 };
13069 }
13070 fmt.finish()
13071 }
13072}
13073impl IterableIfaceLimitAttributes<'_> {
13074 pub fn lookup_attr(
13075 &self,
13076 offset: usize,
13077 missing_type: Option<u16>,
13078 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
13079 let mut stack = Vec::new();
13080 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
13081 if cur == offset {
13082 stack.push(("IfaceLimitAttributes", offset));
13083 return (
13084 stack,
13085 missing_type.and_then(|t| IfaceLimitAttributes::attr_from_type(t)),
13086 );
13087 }
13088 if cur > offset || cur + self.buf.len() < offset {
13089 return (stack, None);
13090 }
13091 let mut attrs = self.clone();
13092 let mut last_off = cur + attrs.pos;
13093 let mut missing = None;
13094 while let Some(attr) = attrs.next() {
13095 let Ok(attr) = attr else { break };
13096 match attr {
13097 IfaceLimitAttributes::Max(val) => {
13098 if last_off == offset {
13099 stack.push(("Max", last_off));
13100 break;
13101 }
13102 }
13103 IfaceLimitAttributes::Types(val) => {
13104 (stack, missing) = val.lookup_attr(offset, missing_type);
13105 if !stack.is_empty() {
13106 break;
13107 }
13108 }
13109 _ => {}
13110 };
13111 last_off = cur + attrs.pos;
13112 }
13113 if !stack.is_empty() {
13114 stack.push(("IfaceLimitAttributes", cur));
13115 }
13116 (stack, missing)
13117 }
13118}
13119#[derive(Clone)]
13120pub enum IftypeDataAttrs<'a> {
13121 Iftypes(&'a [u8]),
13122 HeCapMac(&'a [u8]),
13123 HeCapPhy(&'a [u8]),
13124 HeCapMcsSet(&'a [u8]),
13125 HeCapPpe(&'a [u8]),
13126 He6ghzCapa(&'a [u8]),
13127 VendorElems(&'a [u8]),
13128 EhtCapMac(&'a [u8]),
13129 EhtCapPhy(&'a [u8]),
13130 EhtCapMcsSet(&'a [u8]),
13131 EhtCapPpe(&'a [u8]),
13132}
13133impl<'a> IterableIftypeDataAttrs<'a> {
13134 pub fn get_iftypes(&self) -> Result<&'a [u8], ErrorContext> {
13135 let mut iter = self.clone();
13136 iter.pos = 0;
13137 for attr in iter {
13138 if let IftypeDataAttrs::Iftypes(val) = attr? {
13139 return Ok(val);
13140 }
13141 }
13142 Err(ErrorContext::new_missing(
13143 "IftypeDataAttrs",
13144 "Iftypes",
13145 self.orig_loc,
13146 self.buf.as_ptr() as usize,
13147 ))
13148 }
13149 pub fn get_he_cap_mac(&self) -> Result<&'a [u8], ErrorContext> {
13150 let mut iter = self.clone();
13151 iter.pos = 0;
13152 for attr in iter {
13153 if let IftypeDataAttrs::HeCapMac(val) = attr? {
13154 return Ok(val);
13155 }
13156 }
13157 Err(ErrorContext::new_missing(
13158 "IftypeDataAttrs",
13159 "HeCapMac",
13160 self.orig_loc,
13161 self.buf.as_ptr() as usize,
13162 ))
13163 }
13164 pub fn get_he_cap_phy(&self) -> Result<&'a [u8], ErrorContext> {
13165 let mut iter = self.clone();
13166 iter.pos = 0;
13167 for attr in iter {
13168 if let IftypeDataAttrs::HeCapPhy(val) = attr? {
13169 return Ok(val);
13170 }
13171 }
13172 Err(ErrorContext::new_missing(
13173 "IftypeDataAttrs",
13174 "HeCapPhy",
13175 self.orig_loc,
13176 self.buf.as_ptr() as usize,
13177 ))
13178 }
13179 pub fn get_he_cap_mcs_set(&self) -> Result<&'a [u8], ErrorContext> {
13180 let mut iter = self.clone();
13181 iter.pos = 0;
13182 for attr in iter {
13183 if let IftypeDataAttrs::HeCapMcsSet(val) = attr? {
13184 return Ok(val);
13185 }
13186 }
13187 Err(ErrorContext::new_missing(
13188 "IftypeDataAttrs",
13189 "HeCapMcsSet",
13190 self.orig_loc,
13191 self.buf.as_ptr() as usize,
13192 ))
13193 }
13194 pub fn get_he_cap_ppe(&self) -> Result<&'a [u8], ErrorContext> {
13195 let mut iter = self.clone();
13196 iter.pos = 0;
13197 for attr in iter {
13198 if let IftypeDataAttrs::HeCapPpe(val) = attr? {
13199 return Ok(val);
13200 }
13201 }
13202 Err(ErrorContext::new_missing(
13203 "IftypeDataAttrs",
13204 "HeCapPpe",
13205 self.orig_loc,
13206 self.buf.as_ptr() as usize,
13207 ))
13208 }
13209 pub fn get_he_6ghz_capa(&self) -> Result<&'a [u8], ErrorContext> {
13210 let mut iter = self.clone();
13211 iter.pos = 0;
13212 for attr in iter {
13213 if let IftypeDataAttrs::He6ghzCapa(val) = attr? {
13214 return Ok(val);
13215 }
13216 }
13217 Err(ErrorContext::new_missing(
13218 "IftypeDataAttrs",
13219 "He6ghzCapa",
13220 self.orig_loc,
13221 self.buf.as_ptr() as usize,
13222 ))
13223 }
13224 pub fn get_vendor_elems(&self) -> Result<&'a [u8], ErrorContext> {
13225 let mut iter = self.clone();
13226 iter.pos = 0;
13227 for attr in iter {
13228 if let IftypeDataAttrs::VendorElems(val) = attr? {
13229 return Ok(val);
13230 }
13231 }
13232 Err(ErrorContext::new_missing(
13233 "IftypeDataAttrs",
13234 "VendorElems",
13235 self.orig_loc,
13236 self.buf.as_ptr() as usize,
13237 ))
13238 }
13239 pub fn get_eht_cap_mac(&self) -> Result<&'a [u8], ErrorContext> {
13240 let mut iter = self.clone();
13241 iter.pos = 0;
13242 for attr in iter {
13243 if let IftypeDataAttrs::EhtCapMac(val) = attr? {
13244 return Ok(val);
13245 }
13246 }
13247 Err(ErrorContext::new_missing(
13248 "IftypeDataAttrs",
13249 "EhtCapMac",
13250 self.orig_loc,
13251 self.buf.as_ptr() as usize,
13252 ))
13253 }
13254 pub fn get_eht_cap_phy(&self) -> Result<&'a [u8], ErrorContext> {
13255 let mut iter = self.clone();
13256 iter.pos = 0;
13257 for attr in iter {
13258 if let IftypeDataAttrs::EhtCapPhy(val) = attr? {
13259 return Ok(val);
13260 }
13261 }
13262 Err(ErrorContext::new_missing(
13263 "IftypeDataAttrs",
13264 "EhtCapPhy",
13265 self.orig_loc,
13266 self.buf.as_ptr() as usize,
13267 ))
13268 }
13269 pub fn get_eht_cap_mcs_set(&self) -> Result<&'a [u8], ErrorContext> {
13270 let mut iter = self.clone();
13271 iter.pos = 0;
13272 for attr in iter {
13273 if let IftypeDataAttrs::EhtCapMcsSet(val) = attr? {
13274 return Ok(val);
13275 }
13276 }
13277 Err(ErrorContext::new_missing(
13278 "IftypeDataAttrs",
13279 "EhtCapMcsSet",
13280 self.orig_loc,
13281 self.buf.as_ptr() as usize,
13282 ))
13283 }
13284 pub fn get_eht_cap_ppe(&self) -> Result<&'a [u8], ErrorContext> {
13285 let mut iter = self.clone();
13286 iter.pos = 0;
13287 for attr in iter {
13288 if let IftypeDataAttrs::EhtCapPpe(val) = attr? {
13289 return Ok(val);
13290 }
13291 }
13292 Err(ErrorContext::new_missing(
13293 "IftypeDataAttrs",
13294 "EhtCapPpe",
13295 self.orig_loc,
13296 self.buf.as_ptr() as usize,
13297 ))
13298 }
13299}
13300impl IftypeDataAttrs<'_> {
13301 pub fn new<'a>(buf: &'a [u8]) -> IterableIftypeDataAttrs<'a> {
13302 IterableIftypeDataAttrs::with_loc(buf, buf.as_ptr() as usize)
13303 }
13304 fn attr_from_type(r#type: u16) -> Option<&'static str> {
13305 let res = match r#type {
13306 1u16 => "Iftypes",
13307 2u16 => "HeCapMac",
13308 3u16 => "HeCapPhy",
13309 4u16 => "HeCapMcsSet",
13310 5u16 => "HeCapPpe",
13311 6u16 => "He6ghzCapa",
13312 7u16 => "VendorElems",
13313 8u16 => "EhtCapMac",
13314 9u16 => "EhtCapPhy",
13315 10u16 => "EhtCapMcsSet",
13316 11u16 => "EhtCapPpe",
13317 _ => return None,
13318 };
13319 Some(res)
13320 }
13321}
13322#[derive(Clone, Copy, Default)]
13323pub struct IterableIftypeDataAttrs<'a> {
13324 buf: &'a [u8],
13325 pos: usize,
13326 orig_loc: usize,
13327}
13328impl<'a> IterableIftypeDataAttrs<'a> {
13329 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
13330 Self {
13331 buf,
13332 pos: 0,
13333 orig_loc,
13334 }
13335 }
13336 pub fn get_buf(&self) -> &'a [u8] {
13337 self.buf
13338 }
13339}
13340impl<'a> Iterator for IterableIftypeDataAttrs<'a> {
13341 type Item = Result<IftypeDataAttrs<'a>, ErrorContext>;
13342 fn next(&mut self) -> Option<Self::Item> {
13343 if self.buf.len() == self.pos {
13344 return None;
13345 }
13346 let pos = self.pos;
13347 let mut r#type = None;
13348 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
13349 r#type = Some(header.r#type);
13350 let res = match header.r#type {
13351 1u16 => IftypeDataAttrs::Iftypes({
13352 let res = Some(next);
13353 let Some(val) = res else { break };
13354 val
13355 }),
13356 2u16 => IftypeDataAttrs::HeCapMac({
13357 let res = Some(next);
13358 let Some(val) = res else { break };
13359 val
13360 }),
13361 3u16 => IftypeDataAttrs::HeCapPhy({
13362 let res = Some(next);
13363 let Some(val) = res else { break };
13364 val
13365 }),
13366 4u16 => IftypeDataAttrs::HeCapMcsSet({
13367 let res = Some(next);
13368 let Some(val) = res else { break };
13369 val
13370 }),
13371 5u16 => IftypeDataAttrs::HeCapPpe({
13372 let res = Some(next);
13373 let Some(val) = res else { break };
13374 val
13375 }),
13376 6u16 => IftypeDataAttrs::He6ghzCapa({
13377 let res = Some(next);
13378 let Some(val) = res else { break };
13379 val
13380 }),
13381 7u16 => IftypeDataAttrs::VendorElems({
13382 let res = Some(next);
13383 let Some(val) = res else { break };
13384 val
13385 }),
13386 8u16 => IftypeDataAttrs::EhtCapMac({
13387 let res = Some(next);
13388 let Some(val) = res else { break };
13389 val
13390 }),
13391 9u16 => IftypeDataAttrs::EhtCapPhy({
13392 let res = Some(next);
13393 let Some(val) = res else { break };
13394 val
13395 }),
13396 10u16 => IftypeDataAttrs::EhtCapMcsSet({
13397 let res = Some(next);
13398 let Some(val) = res else { break };
13399 val
13400 }),
13401 11u16 => IftypeDataAttrs::EhtCapPpe({
13402 let res = Some(next);
13403 let Some(val) = res else { break };
13404 val
13405 }),
13406 n => {
13407 if cfg!(any(test, feature = "deny-unknown-attrs")) {
13408 break;
13409 } else {
13410 continue;
13411 }
13412 }
13413 };
13414 return Some(Ok(res));
13415 }
13416 Some(Err(ErrorContext::new(
13417 "IftypeDataAttrs",
13418 r#type.and_then(|t| IftypeDataAttrs::attr_from_type(t)),
13419 self.orig_loc,
13420 self.buf.as_ptr().wrapping_add(pos) as usize,
13421 )))
13422 }
13423}
13424impl<'a> std::fmt::Debug for IterableIftypeDataAttrs<'_> {
13425 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13426 let mut fmt = f.debug_struct("IftypeDataAttrs");
13427 for attr in self.clone() {
13428 let attr = match attr {
13429 Ok(a) => a,
13430 Err(err) => {
13431 fmt.finish()?;
13432 f.write_str("Err(")?;
13433 err.fmt(f)?;
13434 return f.write_str(")");
13435 }
13436 };
13437 match attr {
13438 IftypeDataAttrs::Iftypes(val) => fmt.field("Iftypes", &val),
13439 IftypeDataAttrs::HeCapMac(val) => fmt.field("HeCapMac", &val),
13440 IftypeDataAttrs::HeCapPhy(val) => fmt.field("HeCapPhy", &val),
13441 IftypeDataAttrs::HeCapMcsSet(val) => fmt.field("HeCapMcsSet", &val),
13442 IftypeDataAttrs::HeCapPpe(val) => fmt.field("HeCapPpe", &val),
13443 IftypeDataAttrs::He6ghzCapa(val) => fmt.field("He6ghzCapa", &val),
13444 IftypeDataAttrs::VendorElems(val) => fmt.field("VendorElems", &val),
13445 IftypeDataAttrs::EhtCapMac(val) => fmt.field("EhtCapMac", &val),
13446 IftypeDataAttrs::EhtCapPhy(val) => fmt.field("EhtCapPhy", &val),
13447 IftypeDataAttrs::EhtCapMcsSet(val) => fmt.field("EhtCapMcsSet", &val),
13448 IftypeDataAttrs::EhtCapPpe(val) => fmt.field("EhtCapPpe", &val),
13449 };
13450 }
13451 fmt.finish()
13452 }
13453}
13454impl IterableIftypeDataAttrs<'_> {
13455 pub fn lookup_attr(
13456 &self,
13457 offset: usize,
13458 missing_type: Option<u16>,
13459 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
13460 let mut stack = Vec::new();
13461 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
13462 if cur == offset {
13463 stack.push(("IftypeDataAttrs", offset));
13464 return (
13465 stack,
13466 missing_type.and_then(|t| IftypeDataAttrs::attr_from_type(t)),
13467 );
13468 }
13469 if cur > offset || cur + self.buf.len() < offset {
13470 return (stack, None);
13471 }
13472 let mut attrs = self.clone();
13473 let mut last_off = cur + attrs.pos;
13474 while let Some(attr) = attrs.next() {
13475 let Ok(attr) = attr else { break };
13476 match attr {
13477 IftypeDataAttrs::Iftypes(val) => {
13478 if last_off == offset {
13479 stack.push(("Iftypes", last_off));
13480 break;
13481 }
13482 }
13483 IftypeDataAttrs::HeCapMac(val) => {
13484 if last_off == offset {
13485 stack.push(("HeCapMac", last_off));
13486 break;
13487 }
13488 }
13489 IftypeDataAttrs::HeCapPhy(val) => {
13490 if last_off == offset {
13491 stack.push(("HeCapPhy", last_off));
13492 break;
13493 }
13494 }
13495 IftypeDataAttrs::HeCapMcsSet(val) => {
13496 if last_off == offset {
13497 stack.push(("HeCapMcsSet", last_off));
13498 break;
13499 }
13500 }
13501 IftypeDataAttrs::HeCapPpe(val) => {
13502 if last_off == offset {
13503 stack.push(("HeCapPpe", last_off));
13504 break;
13505 }
13506 }
13507 IftypeDataAttrs::He6ghzCapa(val) => {
13508 if last_off == offset {
13509 stack.push(("He6ghzCapa", last_off));
13510 break;
13511 }
13512 }
13513 IftypeDataAttrs::VendorElems(val) => {
13514 if last_off == offset {
13515 stack.push(("VendorElems", last_off));
13516 break;
13517 }
13518 }
13519 IftypeDataAttrs::EhtCapMac(val) => {
13520 if last_off == offset {
13521 stack.push(("EhtCapMac", last_off));
13522 break;
13523 }
13524 }
13525 IftypeDataAttrs::EhtCapPhy(val) => {
13526 if last_off == offset {
13527 stack.push(("EhtCapPhy", last_off));
13528 break;
13529 }
13530 }
13531 IftypeDataAttrs::EhtCapMcsSet(val) => {
13532 if last_off == offset {
13533 stack.push(("EhtCapMcsSet", last_off));
13534 break;
13535 }
13536 }
13537 IftypeDataAttrs::EhtCapPpe(val) => {
13538 if last_off == offset {
13539 stack.push(("EhtCapPpe", last_off));
13540 break;
13541 }
13542 }
13543 _ => {}
13544 };
13545 last_off = cur + attrs.pos;
13546 }
13547 if !stack.is_empty() {
13548 stack.push(("IftypeDataAttrs", cur));
13549 }
13550 (stack, None)
13551 }
13552}
13553#[derive(Clone)]
13554pub enum IftypeAttrs<'a> {
13555 Unspecified(IterableFrameTypeAttrs<'a>),
13556 Adhoc(IterableFrameTypeAttrs<'a>),
13557 Station(IterableFrameTypeAttrs<'a>),
13558 Ap(IterableFrameTypeAttrs<'a>),
13559 ApVlan(IterableFrameTypeAttrs<'a>),
13560 Wds(IterableFrameTypeAttrs<'a>),
13561 Monitor(IterableFrameTypeAttrs<'a>),
13562 MeshPoint(IterableFrameTypeAttrs<'a>),
13563 P2pClient(IterableFrameTypeAttrs<'a>),
13564 P2pGo(IterableFrameTypeAttrs<'a>),
13565 P2pDevice(IterableFrameTypeAttrs<'a>),
13566 Ocb(IterableFrameTypeAttrs<'a>),
13567 Nan(IterableFrameTypeAttrs<'a>),
13568}
13569impl<'a> IterableIftypeAttrs<'a> {
13570 pub fn get_unspecified(&self) -> Result<IterableFrameTypeAttrs<'a>, ErrorContext> {
13571 let mut iter = self.clone();
13572 iter.pos = 0;
13573 for attr in iter {
13574 if let IftypeAttrs::Unspecified(val) = attr? {
13575 return Ok(val);
13576 }
13577 }
13578 Err(ErrorContext::new_missing(
13579 "IftypeAttrs",
13580 "Unspecified",
13581 self.orig_loc,
13582 self.buf.as_ptr() as usize,
13583 ))
13584 }
13585 pub fn get_adhoc(&self) -> Result<IterableFrameTypeAttrs<'a>, ErrorContext> {
13586 let mut iter = self.clone();
13587 iter.pos = 0;
13588 for attr in iter {
13589 if let IftypeAttrs::Adhoc(val) = attr? {
13590 return Ok(val);
13591 }
13592 }
13593 Err(ErrorContext::new_missing(
13594 "IftypeAttrs",
13595 "Adhoc",
13596 self.orig_loc,
13597 self.buf.as_ptr() as usize,
13598 ))
13599 }
13600 pub fn get_station(&self) -> Result<IterableFrameTypeAttrs<'a>, ErrorContext> {
13601 let mut iter = self.clone();
13602 iter.pos = 0;
13603 for attr in iter {
13604 if let IftypeAttrs::Station(val) = attr? {
13605 return Ok(val);
13606 }
13607 }
13608 Err(ErrorContext::new_missing(
13609 "IftypeAttrs",
13610 "Station",
13611 self.orig_loc,
13612 self.buf.as_ptr() as usize,
13613 ))
13614 }
13615 pub fn get_ap(&self) -> Result<IterableFrameTypeAttrs<'a>, ErrorContext> {
13616 let mut iter = self.clone();
13617 iter.pos = 0;
13618 for attr in iter {
13619 if let IftypeAttrs::Ap(val) = attr? {
13620 return Ok(val);
13621 }
13622 }
13623 Err(ErrorContext::new_missing(
13624 "IftypeAttrs",
13625 "Ap",
13626 self.orig_loc,
13627 self.buf.as_ptr() as usize,
13628 ))
13629 }
13630 pub fn get_ap_vlan(&self) -> Result<IterableFrameTypeAttrs<'a>, ErrorContext> {
13631 let mut iter = self.clone();
13632 iter.pos = 0;
13633 for attr in iter {
13634 if let IftypeAttrs::ApVlan(val) = attr? {
13635 return Ok(val);
13636 }
13637 }
13638 Err(ErrorContext::new_missing(
13639 "IftypeAttrs",
13640 "ApVlan",
13641 self.orig_loc,
13642 self.buf.as_ptr() as usize,
13643 ))
13644 }
13645 pub fn get_wds(&self) -> Result<IterableFrameTypeAttrs<'a>, ErrorContext> {
13646 let mut iter = self.clone();
13647 iter.pos = 0;
13648 for attr in iter {
13649 if let IftypeAttrs::Wds(val) = attr? {
13650 return Ok(val);
13651 }
13652 }
13653 Err(ErrorContext::new_missing(
13654 "IftypeAttrs",
13655 "Wds",
13656 self.orig_loc,
13657 self.buf.as_ptr() as usize,
13658 ))
13659 }
13660 pub fn get_monitor(&self) -> Result<IterableFrameTypeAttrs<'a>, ErrorContext> {
13661 let mut iter = self.clone();
13662 iter.pos = 0;
13663 for attr in iter {
13664 if let IftypeAttrs::Monitor(val) = attr? {
13665 return Ok(val);
13666 }
13667 }
13668 Err(ErrorContext::new_missing(
13669 "IftypeAttrs",
13670 "Monitor",
13671 self.orig_loc,
13672 self.buf.as_ptr() as usize,
13673 ))
13674 }
13675 pub fn get_mesh_point(&self) -> Result<IterableFrameTypeAttrs<'a>, ErrorContext> {
13676 let mut iter = self.clone();
13677 iter.pos = 0;
13678 for attr in iter {
13679 if let IftypeAttrs::MeshPoint(val) = attr? {
13680 return Ok(val);
13681 }
13682 }
13683 Err(ErrorContext::new_missing(
13684 "IftypeAttrs",
13685 "MeshPoint",
13686 self.orig_loc,
13687 self.buf.as_ptr() as usize,
13688 ))
13689 }
13690 pub fn get_p2p_client(&self) -> Result<IterableFrameTypeAttrs<'a>, ErrorContext> {
13691 let mut iter = self.clone();
13692 iter.pos = 0;
13693 for attr in iter {
13694 if let IftypeAttrs::P2pClient(val) = attr? {
13695 return Ok(val);
13696 }
13697 }
13698 Err(ErrorContext::new_missing(
13699 "IftypeAttrs",
13700 "P2pClient",
13701 self.orig_loc,
13702 self.buf.as_ptr() as usize,
13703 ))
13704 }
13705 pub fn get_p2p_go(&self) -> Result<IterableFrameTypeAttrs<'a>, ErrorContext> {
13706 let mut iter = self.clone();
13707 iter.pos = 0;
13708 for attr in iter {
13709 if let IftypeAttrs::P2pGo(val) = attr? {
13710 return Ok(val);
13711 }
13712 }
13713 Err(ErrorContext::new_missing(
13714 "IftypeAttrs",
13715 "P2pGo",
13716 self.orig_loc,
13717 self.buf.as_ptr() as usize,
13718 ))
13719 }
13720 pub fn get_p2p_device(&self) -> Result<IterableFrameTypeAttrs<'a>, ErrorContext> {
13721 let mut iter = self.clone();
13722 iter.pos = 0;
13723 for attr in iter {
13724 if let IftypeAttrs::P2pDevice(val) = attr? {
13725 return Ok(val);
13726 }
13727 }
13728 Err(ErrorContext::new_missing(
13729 "IftypeAttrs",
13730 "P2pDevice",
13731 self.orig_loc,
13732 self.buf.as_ptr() as usize,
13733 ))
13734 }
13735 pub fn get_ocb(&self) -> Result<IterableFrameTypeAttrs<'a>, ErrorContext> {
13736 let mut iter = self.clone();
13737 iter.pos = 0;
13738 for attr in iter {
13739 if let IftypeAttrs::Ocb(val) = attr? {
13740 return Ok(val);
13741 }
13742 }
13743 Err(ErrorContext::new_missing(
13744 "IftypeAttrs",
13745 "Ocb",
13746 self.orig_loc,
13747 self.buf.as_ptr() as usize,
13748 ))
13749 }
13750 pub fn get_nan(&self) -> Result<IterableFrameTypeAttrs<'a>, ErrorContext> {
13751 let mut iter = self.clone();
13752 iter.pos = 0;
13753 for attr in iter {
13754 if let IftypeAttrs::Nan(val) = attr? {
13755 return Ok(val);
13756 }
13757 }
13758 Err(ErrorContext::new_missing(
13759 "IftypeAttrs",
13760 "Nan",
13761 self.orig_loc,
13762 self.buf.as_ptr() as usize,
13763 ))
13764 }
13765}
13766impl IftypeAttrs<'_> {
13767 pub fn new<'a>(buf: &'a [u8]) -> IterableIftypeAttrs<'a> {
13768 IterableIftypeAttrs::with_loc(buf, buf.as_ptr() as usize)
13769 }
13770 fn attr_from_type(r#type: u16) -> Option<&'static str> {
13771 let res = match r#type {
13772 0u16 => "Unspecified",
13773 1u16 => "Adhoc",
13774 2u16 => "Station",
13775 3u16 => "Ap",
13776 4u16 => "ApVlan",
13777 5u16 => "Wds",
13778 6u16 => "Monitor",
13779 7u16 => "MeshPoint",
13780 8u16 => "P2pClient",
13781 9u16 => "P2pGo",
13782 10u16 => "P2pDevice",
13783 11u16 => "Ocb",
13784 12u16 => "Nan",
13785 _ => return None,
13786 };
13787 Some(res)
13788 }
13789}
13790#[derive(Clone, Copy, Default)]
13791pub struct IterableIftypeAttrs<'a> {
13792 buf: &'a [u8],
13793 pos: usize,
13794 orig_loc: usize,
13795}
13796impl<'a> IterableIftypeAttrs<'a> {
13797 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
13798 Self {
13799 buf,
13800 pos: 0,
13801 orig_loc,
13802 }
13803 }
13804 pub fn get_buf(&self) -> &'a [u8] {
13805 self.buf
13806 }
13807}
13808impl<'a> Iterator for IterableIftypeAttrs<'a> {
13809 type Item = Result<IftypeAttrs<'a>, ErrorContext>;
13810 fn next(&mut self) -> Option<Self::Item> {
13811 if self.buf.len() == self.pos {
13812 return None;
13813 }
13814 let pos = self.pos;
13815 let mut r#type = None;
13816 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
13817 r#type = Some(header.r#type);
13818 let res = match header.r#type {
13819 0u16 => IftypeAttrs::Unspecified({
13820 let res = Some(IterableFrameTypeAttrs::with_loc(next, self.orig_loc));
13821 let Some(val) = res else { break };
13822 val
13823 }),
13824 1u16 => IftypeAttrs::Adhoc({
13825 let res = Some(IterableFrameTypeAttrs::with_loc(next, self.orig_loc));
13826 let Some(val) = res else { break };
13827 val
13828 }),
13829 2u16 => IftypeAttrs::Station({
13830 let res = Some(IterableFrameTypeAttrs::with_loc(next, self.orig_loc));
13831 let Some(val) = res else { break };
13832 val
13833 }),
13834 3u16 => IftypeAttrs::Ap({
13835 let res = Some(IterableFrameTypeAttrs::with_loc(next, self.orig_loc));
13836 let Some(val) = res else { break };
13837 val
13838 }),
13839 4u16 => IftypeAttrs::ApVlan({
13840 let res = Some(IterableFrameTypeAttrs::with_loc(next, self.orig_loc));
13841 let Some(val) = res else { break };
13842 val
13843 }),
13844 5u16 => IftypeAttrs::Wds({
13845 let res = Some(IterableFrameTypeAttrs::with_loc(next, self.orig_loc));
13846 let Some(val) = res else { break };
13847 val
13848 }),
13849 6u16 => IftypeAttrs::Monitor({
13850 let res = Some(IterableFrameTypeAttrs::with_loc(next, self.orig_loc));
13851 let Some(val) = res else { break };
13852 val
13853 }),
13854 7u16 => IftypeAttrs::MeshPoint({
13855 let res = Some(IterableFrameTypeAttrs::with_loc(next, self.orig_loc));
13856 let Some(val) = res else { break };
13857 val
13858 }),
13859 8u16 => IftypeAttrs::P2pClient({
13860 let res = Some(IterableFrameTypeAttrs::with_loc(next, self.orig_loc));
13861 let Some(val) = res else { break };
13862 val
13863 }),
13864 9u16 => IftypeAttrs::P2pGo({
13865 let res = Some(IterableFrameTypeAttrs::with_loc(next, self.orig_loc));
13866 let Some(val) = res else { break };
13867 val
13868 }),
13869 10u16 => IftypeAttrs::P2pDevice({
13870 let res = Some(IterableFrameTypeAttrs::with_loc(next, self.orig_loc));
13871 let Some(val) = res else { break };
13872 val
13873 }),
13874 11u16 => IftypeAttrs::Ocb({
13875 let res = Some(IterableFrameTypeAttrs::with_loc(next, self.orig_loc));
13876 let Some(val) = res else { break };
13877 val
13878 }),
13879 12u16 => IftypeAttrs::Nan({
13880 let res = Some(IterableFrameTypeAttrs::with_loc(next, self.orig_loc));
13881 let Some(val) = res else { break };
13882 val
13883 }),
13884 n => {
13885 if cfg!(any(test, feature = "deny-unknown-attrs")) {
13886 break;
13887 } else {
13888 continue;
13889 }
13890 }
13891 };
13892 return Some(Ok(res));
13893 }
13894 Some(Err(ErrorContext::new(
13895 "IftypeAttrs",
13896 r#type.and_then(|t| IftypeAttrs::attr_from_type(t)),
13897 self.orig_loc,
13898 self.buf.as_ptr().wrapping_add(pos) as usize,
13899 )))
13900 }
13901}
13902impl<'a> std::fmt::Debug for IterableIftypeAttrs<'_> {
13903 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
13904 let mut fmt = f.debug_struct("IftypeAttrs");
13905 for attr in self.clone() {
13906 let attr = match attr {
13907 Ok(a) => a,
13908 Err(err) => {
13909 fmt.finish()?;
13910 f.write_str("Err(")?;
13911 err.fmt(f)?;
13912 return f.write_str(")");
13913 }
13914 };
13915 match attr {
13916 IftypeAttrs::Unspecified(val) => fmt.field("Unspecified", &val),
13917 IftypeAttrs::Adhoc(val) => fmt.field("Adhoc", &val),
13918 IftypeAttrs::Station(val) => fmt.field("Station", &val),
13919 IftypeAttrs::Ap(val) => fmt.field("Ap", &val),
13920 IftypeAttrs::ApVlan(val) => fmt.field("ApVlan", &val),
13921 IftypeAttrs::Wds(val) => fmt.field("Wds", &val),
13922 IftypeAttrs::Monitor(val) => fmt.field("Monitor", &val),
13923 IftypeAttrs::MeshPoint(val) => fmt.field("MeshPoint", &val),
13924 IftypeAttrs::P2pClient(val) => fmt.field("P2pClient", &val),
13925 IftypeAttrs::P2pGo(val) => fmt.field("P2pGo", &val),
13926 IftypeAttrs::P2pDevice(val) => fmt.field("P2pDevice", &val),
13927 IftypeAttrs::Ocb(val) => fmt.field("Ocb", &val),
13928 IftypeAttrs::Nan(val) => fmt.field("Nan", &val),
13929 };
13930 }
13931 fmt.finish()
13932 }
13933}
13934impl IterableIftypeAttrs<'_> {
13935 pub fn lookup_attr(
13936 &self,
13937 offset: usize,
13938 missing_type: Option<u16>,
13939 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
13940 let mut stack = Vec::new();
13941 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
13942 if cur == offset {
13943 stack.push(("IftypeAttrs", offset));
13944 return (
13945 stack,
13946 missing_type.and_then(|t| IftypeAttrs::attr_from_type(t)),
13947 );
13948 }
13949 if cur > offset || cur + self.buf.len() < offset {
13950 return (stack, None);
13951 }
13952 let mut attrs = self.clone();
13953 let mut last_off = cur + attrs.pos;
13954 let mut missing = None;
13955 while let Some(attr) = attrs.next() {
13956 let Ok(attr) = attr else { break };
13957 match attr {
13958 IftypeAttrs::Unspecified(val) => {
13959 (stack, missing) = val.lookup_attr(offset, missing_type);
13960 if !stack.is_empty() {
13961 break;
13962 }
13963 }
13964 IftypeAttrs::Adhoc(val) => {
13965 (stack, missing) = val.lookup_attr(offset, missing_type);
13966 if !stack.is_empty() {
13967 break;
13968 }
13969 }
13970 IftypeAttrs::Station(val) => {
13971 (stack, missing) = val.lookup_attr(offset, missing_type);
13972 if !stack.is_empty() {
13973 break;
13974 }
13975 }
13976 IftypeAttrs::Ap(val) => {
13977 (stack, missing) = val.lookup_attr(offset, missing_type);
13978 if !stack.is_empty() {
13979 break;
13980 }
13981 }
13982 IftypeAttrs::ApVlan(val) => {
13983 (stack, missing) = val.lookup_attr(offset, missing_type);
13984 if !stack.is_empty() {
13985 break;
13986 }
13987 }
13988 IftypeAttrs::Wds(val) => {
13989 (stack, missing) = val.lookup_attr(offset, missing_type);
13990 if !stack.is_empty() {
13991 break;
13992 }
13993 }
13994 IftypeAttrs::Monitor(val) => {
13995 (stack, missing) = val.lookup_attr(offset, missing_type);
13996 if !stack.is_empty() {
13997 break;
13998 }
13999 }
14000 IftypeAttrs::MeshPoint(val) => {
14001 (stack, missing) = val.lookup_attr(offset, missing_type);
14002 if !stack.is_empty() {
14003 break;
14004 }
14005 }
14006 IftypeAttrs::P2pClient(val) => {
14007 (stack, missing) = val.lookup_attr(offset, missing_type);
14008 if !stack.is_empty() {
14009 break;
14010 }
14011 }
14012 IftypeAttrs::P2pGo(val) => {
14013 (stack, missing) = val.lookup_attr(offset, missing_type);
14014 if !stack.is_empty() {
14015 break;
14016 }
14017 }
14018 IftypeAttrs::P2pDevice(val) => {
14019 (stack, missing) = val.lookup_attr(offset, missing_type);
14020 if !stack.is_empty() {
14021 break;
14022 }
14023 }
14024 IftypeAttrs::Ocb(val) => {
14025 (stack, missing) = val.lookup_attr(offset, missing_type);
14026 if !stack.is_empty() {
14027 break;
14028 }
14029 }
14030 IftypeAttrs::Nan(val) => {
14031 (stack, missing) = val.lookup_attr(offset, missing_type);
14032 if !stack.is_empty() {
14033 break;
14034 }
14035 }
14036 _ => {}
14037 };
14038 last_off = cur + attrs.pos;
14039 }
14040 if !stack.is_empty() {
14041 stack.push(("IftypeAttrs", cur));
14042 }
14043 (stack, missing)
14044 }
14045}
14046#[derive(Clone)]
14047pub enum SarAttributes<'a> {
14048 Type(u32),
14049 Specs(IterableArraySarSpecs<'a>),
14050}
14051impl<'a> IterableSarAttributes<'a> {
14052 pub fn get_type(&self) -> Result<u32, ErrorContext> {
14053 let mut iter = self.clone();
14054 iter.pos = 0;
14055 for attr in iter {
14056 if let SarAttributes::Type(val) = attr? {
14057 return Ok(val);
14058 }
14059 }
14060 Err(ErrorContext::new_missing(
14061 "SarAttributes",
14062 "Type",
14063 self.orig_loc,
14064 self.buf.as_ptr() as usize,
14065 ))
14066 }
14067 pub fn get_specs(
14068 &self,
14069 ) -> Result<ArrayIterable<IterableArraySarSpecs<'a>, IterableSarSpecs<'a>>, ErrorContext> {
14070 for attr in self.clone() {
14071 if let SarAttributes::Specs(val) = attr? {
14072 return Ok(ArrayIterable::new(val));
14073 }
14074 }
14075 Err(ErrorContext::new_missing(
14076 "SarAttributes",
14077 "Specs",
14078 self.orig_loc,
14079 self.buf.as_ptr() as usize,
14080 ))
14081 }
14082}
14083impl SarSpecs {
14084 pub fn new_array(buf: &[u8]) -> IterableArraySarSpecs<'_> {
14085 IterableArraySarSpecs::with_loc(buf, buf.as_ptr() as usize)
14086 }
14087}
14088#[derive(Clone, Copy, Default)]
14089pub struct IterableArraySarSpecs<'a> {
14090 buf: &'a [u8],
14091 pos: usize,
14092 orig_loc: usize,
14093}
14094impl<'a> IterableArraySarSpecs<'a> {
14095 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
14096 Self {
14097 buf,
14098 pos: 0,
14099 orig_loc,
14100 }
14101 }
14102 pub fn get_buf(&self) -> &'a [u8] {
14103 self.buf
14104 }
14105}
14106impl<'a> Iterator for IterableArraySarSpecs<'a> {
14107 type Item = Result<IterableSarSpecs<'a>, ErrorContext>;
14108 fn next(&mut self) -> Option<Self::Item> {
14109 if self.buf.len() == self.pos {
14110 return None;
14111 }
14112 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
14113 {
14114 return Some(Ok(IterableSarSpecs::with_loc(next, self.orig_loc)));
14115 }
14116 }
14117 Some(Err(ErrorContext::new(
14118 "SarSpecs",
14119 None,
14120 self.orig_loc,
14121 self.buf.as_ptr().wrapping_add(self.pos) as usize,
14122 )))
14123 }
14124}
14125impl SarAttributes<'_> {
14126 pub fn new<'a>(buf: &'a [u8]) -> IterableSarAttributes<'a> {
14127 IterableSarAttributes::with_loc(buf, buf.as_ptr() as usize)
14128 }
14129 fn attr_from_type(r#type: u16) -> Option<&'static str> {
14130 let res = match r#type {
14131 1u16 => "Type",
14132 2u16 => "Specs",
14133 _ => return None,
14134 };
14135 Some(res)
14136 }
14137}
14138#[derive(Clone, Copy, Default)]
14139pub struct IterableSarAttributes<'a> {
14140 buf: &'a [u8],
14141 pos: usize,
14142 orig_loc: usize,
14143}
14144impl<'a> IterableSarAttributes<'a> {
14145 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
14146 Self {
14147 buf,
14148 pos: 0,
14149 orig_loc,
14150 }
14151 }
14152 pub fn get_buf(&self) -> &'a [u8] {
14153 self.buf
14154 }
14155}
14156impl<'a> Iterator for IterableSarAttributes<'a> {
14157 type Item = Result<SarAttributes<'a>, ErrorContext>;
14158 fn next(&mut self) -> Option<Self::Item> {
14159 if self.buf.len() == self.pos {
14160 return None;
14161 }
14162 let pos = self.pos;
14163 let mut r#type = None;
14164 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
14165 r#type = Some(header.r#type);
14166 let res = match header.r#type {
14167 1u16 => SarAttributes::Type({
14168 let res = parse_u32(next);
14169 let Some(val) = res else { break };
14170 val
14171 }),
14172 2u16 => SarAttributes::Specs({
14173 let res = Some(IterableArraySarSpecs::with_loc(next, self.orig_loc));
14174 let Some(val) = res else { break };
14175 val
14176 }),
14177 n => {
14178 if cfg!(any(test, feature = "deny-unknown-attrs")) {
14179 break;
14180 } else {
14181 continue;
14182 }
14183 }
14184 };
14185 return Some(Ok(res));
14186 }
14187 Some(Err(ErrorContext::new(
14188 "SarAttributes",
14189 r#type.and_then(|t| SarAttributes::attr_from_type(t)),
14190 self.orig_loc,
14191 self.buf.as_ptr().wrapping_add(pos) as usize,
14192 )))
14193 }
14194}
14195impl std::fmt::Debug for IterableArraySarSpecs<'_> {
14196 fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14197 fmt.debug_list()
14198 .entries(self.clone().map(FlattenErrorContext))
14199 .finish()
14200 }
14201}
14202impl<'a> std::fmt::Debug for IterableSarAttributes<'_> {
14203 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14204 let mut fmt = f.debug_struct("SarAttributes");
14205 for attr in self.clone() {
14206 let attr = match attr {
14207 Ok(a) => a,
14208 Err(err) => {
14209 fmt.finish()?;
14210 f.write_str("Err(")?;
14211 err.fmt(f)?;
14212 return f.write_str(")");
14213 }
14214 };
14215 match attr {
14216 SarAttributes::Type(val) => fmt.field("Type", &val),
14217 SarAttributes::Specs(val) => fmt.field("Specs", &val),
14218 };
14219 }
14220 fmt.finish()
14221 }
14222}
14223impl IterableSarAttributes<'_> {
14224 pub fn lookup_attr(
14225 &self,
14226 offset: usize,
14227 missing_type: Option<u16>,
14228 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
14229 let mut stack = Vec::new();
14230 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
14231 if cur == offset {
14232 stack.push(("SarAttributes", offset));
14233 return (
14234 stack,
14235 missing_type.and_then(|t| SarAttributes::attr_from_type(t)),
14236 );
14237 }
14238 if cur > offset || cur + self.buf.len() < offset {
14239 return (stack, None);
14240 }
14241 let mut attrs = self.clone();
14242 let mut last_off = cur + attrs.pos;
14243 let mut missing = None;
14244 while let Some(attr) = attrs.next() {
14245 let Ok(attr) = attr else { break };
14246 match attr {
14247 SarAttributes::Type(val) => {
14248 if last_off == offset {
14249 stack.push(("Type", last_off));
14250 break;
14251 }
14252 }
14253 SarAttributes::Specs(val) => {
14254 for entry in val {
14255 let Ok(attr) = entry else { break };
14256 (stack, missing) = attr.lookup_attr(offset, missing_type);
14257 if !stack.is_empty() {
14258 break;
14259 }
14260 }
14261 if !stack.is_empty() {
14262 stack.push(("Specs", last_off));
14263 break;
14264 }
14265 }
14266 _ => {}
14267 };
14268 last_off = cur + attrs.pos;
14269 }
14270 if !stack.is_empty() {
14271 stack.push(("SarAttributes", cur));
14272 }
14273 (stack, missing)
14274 }
14275}
14276#[derive(Clone)]
14277pub enum SarSpecs {
14278 Power(i32),
14279 RangeIndex(u32),
14280 StartFreq(u32),
14281 EndFreq(u32),
14282}
14283impl<'a> IterableSarSpecs<'a> {
14284 pub fn get_power(&self) -> Result<i32, ErrorContext> {
14285 let mut iter = self.clone();
14286 iter.pos = 0;
14287 for attr in iter {
14288 if let SarSpecs::Power(val) = attr? {
14289 return Ok(val);
14290 }
14291 }
14292 Err(ErrorContext::new_missing(
14293 "SarSpecs",
14294 "Power",
14295 self.orig_loc,
14296 self.buf.as_ptr() as usize,
14297 ))
14298 }
14299 pub fn get_range_index(&self) -> Result<u32, ErrorContext> {
14300 let mut iter = self.clone();
14301 iter.pos = 0;
14302 for attr in iter {
14303 if let SarSpecs::RangeIndex(val) = attr? {
14304 return Ok(val);
14305 }
14306 }
14307 Err(ErrorContext::new_missing(
14308 "SarSpecs",
14309 "RangeIndex",
14310 self.orig_loc,
14311 self.buf.as_ptr() as usize,
14312 ))
14313 }
14314 pub fn get_start_freq(&self) -> Result<u32, ErrorContext> {
14315 let mut iter = self.clone();
14316 iter.pos = 0;
14317 for attr in iter {
14318 if let SarSpecs::StartFreq(val) = attr? {
14319 return Ok(val);
14320 }
14321 }
14322 Err(ErrorContext::new_missing(
14323 "SarSpecs",
14324 "StartFreq",
14325 self.orig_loc,
14326 self.buf.as_ptr() as usize,
14327 ))
14328 }
14329 pub fn get_end_freq(&self) -> Result<u32, ErrorContext> {
14330 let mut iter = self.clone();
14331 iter.pos = 0;
14332 for attr in iter {
14333 if let SarSpecs::EndFreq(val) = attr? {
14334 return Ok(val);
14335 }
14336 }
14337 Err(ErrorContext::new_missing(
14338 "SarSpecs",
14339 "EndFreq",
14340 self.orig_loc,
14341 self.buf.as_ptr() as usize,
14342 ))
14343 }
14344}
14345impl SarSpecs {
14346 pub fn new<'a>(buf: &'a [u8]) -> IterableSarSpecs<'a> {
14347 IterableSarSpecs::with_loc(buf, buf.as_ptr() as usize)
14348 }
14349 fn attr_from_type(r#type: u16) -> Option<&'static str> {
14350 let res = match r#type {
14351 1u16 => "Power",
14352 2u16 => "RangeIndex",
14353 3u16 => "StartFreq",
14354 4u16 => "EndFreq",
14355 _ => return None,
14356 };
14357 Some(res)
14358 }
14359}
14360#[derive(Clone, Copy, Default)]
14361pub struct IterableSarSpecs<'a> {
14362 buf: &'a [u8],
14363 pos: usize,
14364 orig_loc: usize,
14365}
14366impl<'a> IterableSarSpecs<'a> {
14367 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
14368 Self {
14369 buf,
14370 pos: 0,
14371 orig_loc,
14372 }
14373 }
14374 pub fn get_buf(&self) -> &'a [u8] {
14375 self.buf
14376 }
14377}
14378impl<'a> Iterator for IterableSarSpecs<'a> {
14379 type Item = Result<SarSpecs, ErrorContext>;
14380 fn next(&mut self) -> Option<Self::Item> {
14381 if self.buf.len() == self.pos {
14382 return None;
14383 }
14384 let pos = self.pos;
14385 let mut r#type = None;
14386 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
14387 r#type = Some(header.r#type);
14388 let res = match header.r#type {
14389 1u16 => SarSpecs::Power({
14390 let res = parse_i32(next);
14391 let Some(val) = res else { break };
14392 val
14393 }),
14394 2u16 => SarSpecs::RangeIndex({
14395 let res = parse_u32(next);
14396 let Some(val) = res else { break };
14397 val
14398 }),
14399 3u16 => SarSpecs::StartFreq({
14400 let res = parse_u32(next);
14401 let Some(val) = res else { break };
14402 val
14403 }),
14404 4u16 => SarSpecs::EndFreq({
14405 let res = parse_u32(next);
14406 let Some(val) = res else { break };
14407 val
14408 }),
14409 n => {
14410 if cfg!(any(test, feature = "deny-unknown-attrs")) {
14411 break;
14412 } else {
14413 continue;
14414 }
14415 }
14416 };
14417 return Some(Ok(res));
14418 }
14419 Some(Err(ErrorContext::new(
14420 "SarSpecs",
14421 r#type.and_then(|t| SarSpecs::attr_from_type(t)),
14422 self.orig_loc,
14423 self.buf.as_ptr().wrapping_add(pos) as usize,
14424 )))
14425 }
14426}
14427impl std::fmt::Debug for IterableSarSpecs<'_> {
14428 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14429 let mut fmt = f.debug_struct("SarSpecs");
14430 for attr in self.clone() {
14431 let attr = match attr {
14432 Ok(a) => a,
14433 Err(err) => {
14434 fmt.finish()?;
14435 f.write_str("Err(")?;
14436 err.fmt(f)?;
14437 return f.write_str(")");
14438 }
14439 };
14440 match attr {
14441 SarSpecs::Power(val) => fmt.field("Power", &val),
14442 SarSpecs::RangeIndex(val) => fmt.field("RangeIndex", &val),
14443 SarSpecs::StartFreq(val) => fmt.field("StartFreq", &val),
14444 SarSpecs::EndFreq(val) => fmt.field("EndFreq", &val),
14445 };
14446 }
14447 fmt.finish()
14448 }
14449}
14450impl IterableSarSpecs<'_> {
14451 pub fn lookup_attr(
14452 &self,
14453 offset: usize,
14454 missing_type: Option<u16>,
14455 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
14456 let mut stack = Vec::new();
14457 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
14458 if cur == offset {
14459 stack.push(("SarSpecs", offset));
14460 return (
14461 stack,
14462 missing_type.and_then(|t| SarSpecs::attr_from_type(t)),
14463 );
14464 }
14465 if cur > offset || cur + self.buf.len() < offset {
14466 return (stack, None);
14467 }
14468 let mut attrs = self.clone();
14469 let mut last_off = cur + attrs.pos;
14470 while let Some(attr) = attrs.next() {
14471 let Ok(attr) = attr else { break };
14472 match attr {
14473 SarSpecs::Power(val) => {
14474 if last_off == offset {
14475 stack.push(("Power", last_off));
14476 break;
14477 }
14478 }
14479 SarSpecs::RangeIndex(val) => {
14480 if last_off == offset {
14481 stack.push(("RangeIndex", last_off));
14482 break;
14483 }
14484 }
14485 SarSpecs::StartFreq(val) => {
14486 if last_off == offset {
14487 stack.push(("StartFreq", last_off));
14488 break;
14489 }
14490 }
14491 SarSpecs::EndFreq(val) => {
14492 if last_off == offset {
14493 stack.push(("EndFreq", last_off));
14494 break;
14495 }
14496 }
14497 _ => {}
14498 };
14499 last_off = cur + attrs.pos;
14500 }
14501 if !stack.is_empty() {
14502 stack.push(("SarSpecs", cur));
14503 }
14504 (stack, None)
14505 }
14506}
14507#[derive(Clone)]
14508pub enum SupportedIftypes {
14509 Adhoc(()),
14510 Station(()),
14511 Ap(()),
14512 ApVlan(()),
14513 Wds(()),
14514 Monitor(()),
14515 MeshPoint(()),
14516 P2pClient(()),
14517 P2pGo(()),
14518 P2pDevice(()),
14519 Ocb(()),
14520 Nan(()),
14521}
14522impl<'a> IterableSupportedIftypes<'a> {
14523 pub fn get_adhoc(&self) -> Result<(), ErrorContext> {
14524 let mut iter = self.clone();
14525 iter.pos = 0;
14526 for attr in iter {
14527 if let SupportedIftypes::Adhoc(val) = attr? {
14528 return Ok(val);
14529 }
14530 }
14531 Err(ErrorContext::new_missing(
14532 "SupportedIftypes",
14533 "Adhoc",
14534 self.orig_loc,
14535 self.buf.as_ptr() as usize,
14536 ))
14537 }
14538 pub fn get_station(&self) -> Result<(), ErrorContext> {
14539 let mut iter = self.clone();
14540 iter.pos = 0;
14541 for attr in iter {
14542 if let SupportedIftypes::Station(val) = attr? {
14543 return Ok(val);
14544 }
14545 }
14546 Err(ErrorContext::new_missing(
14547 "SupportedIftypes",
14548 "Station",
14549 self.orig_loc,
14550 self.buf.as_ptr() as usize,
14551 ))
14552 }
14553 pub fn get_ap(&self) -> Result<(), ErrorContext> {
14554 let mut iter = self.clone();
14555 iter.pos = 0;
14556 for attr in iter {
14557 if let SupportedIftypes::Ap(val) = attr? {
14558 return Ok(val);
14559 }
14560 }
14561 Err(ErrorContext::new_missing(
14562 "SupportedIftypes",
14563 "Ap",
14564 self.orig_loc,
14565 self.buf.as_ptr() as usize,
14566 ))
14567 }
14568 pub fn get_ap_vlan(&self) -> Result<(), ErrorContext> {
14569 let mut iter = self.clone();
14570 iter.pos = 0;
14571 for attr in iter {
14572 if let SupportedIftypes::ApVlan(val) = attr? {
14573 return Ok(val);
14574 }
14575 }
14576 Err(ErrorContext::new_missing(
14577 "SupportedIftypes",
14578 "ApVlan",
14579 self.orig_loc,
14580 self.buf.as_ptr() as usize,
14581 ))
14582 }
14583 pub fn get_wds(&self) -> Result<(), ErrorContext> {
14584 let mut iter = self.clone();
14585 iter.pos = 0;
14586 for attr in iter {
14587 if let SupportedIftypes::Wds(val) = attr? {
14588 return Ok(val);
14589 }
14590 }
14591 Err(ErrorContext::new_missing(
14592 "SupportedIftypes",
14593 "Wds",
14594 self.orig_loc,
14595 self.buf.as_ptr() as usize,
14596 ))
14597 }
14598 pub fn get_monitor(&self) -> Result<(), ErrorContext> {
14599 let mut iter = self.clone();
14600 iter.pos = 0;
14601 for attr in iter {
14602 if let SupportedIftypes::Monitor(val) = attr? {
14603 return Ok(val);
14604 }
14605 }
14606 Err(ErrorContext::new_missing(
14607 "SupportedIftypes",
14608 "Monitor",
14609 self.orig_loc,
14610 self.buf.as_ptr() as usize,
14611 ))
14612 }
14613 pub fn get_mesh_point(&self) -> Result<(), ErrorContext> {
14614 let mut iter = self.clone();
14615 iter.pos = 0;
14616 for attr in iter {
14617 if let SupportedIftypes::MeshPoint(val) = attr? {
14618 return Ok(val);
14619 }
14620 }
14621 Err(ErrorContext::new_missing(
14622 "SupportedIftypes",
14623 "MeshPoint",
14624 self.orig_loc,
14625 self.buf.as_ptr() as usize,
14626 ))
14627 }
14628 pub fn get_p2p_client(&self) -> Result<(), ErrorContext> {
14629 let mut iter = self.clone();
14630 iter.pos = 0;
14631 for attr in iter {
14632 if let SupportedIftypes::P2pClient(val) = attr? {
14633 return Ok(val);
14634 }
14635 }
14636 Err(ErrorContext::new_missing(
14637 "SupportedIftypes",
14638 "P2pClient",
14639 self.orig_loc,
14640 self.buf.as_ptr() as usize,
14641 ))
14642 }
14643 pub fn get_p2p_go(&self) -> Result<(), ErrorContext> {
14644 let mut iter = self.clone();
14645 iter.pos = 0;
14646 for attr in iter {
14647 if let SupportedIftypes::P2pGo(val) = attr? {
14648 return Ok(val);
14649 }
14650 }
14651 Err(ErrorContext::new_missing(
14652 "SupportedIftypes",
14653 "P2pGo",
14654 self.orig_loc,
14655 self.buf.as_ptr() as usize,
14656 ))
14657 }
14658 pub fn get_p2p_device(&self) -> Result<(), ErrorContext> {
14659 let mut iter = self.clone();
14660 iter.pos = 0;
14661 for attr in iter {
14662 if let SupportedIftypes::P2pDevice(val) = attr? {
14663 return Ok(val);
14664 }
14665 }
14666 Err(ErrorContext::new_missing(
14667 "SupportedIftypes",
14668 "P2pDevice",
14669 self.orig_loc,
14670 self.buf.as_ptr() as usize,
14671 ))
14672 }
14673 pub fn get_ocb(&self) -> Result<(), ErrorContext> {
14674 let mut iter = self.clone();
14675 iter.pos = 0;
14676 for attr in iter {
14677 if let SupportedIftypes::Ocb(val) = attr? {
14678 return Ok(val);
14679 }
14680 }
14681 Err(ErrorContext::new_missing(
14682 "SupportedIftypes",
14683 "Ocb",
14684 self.orig_loc,
14685 self.buf.as_ptr() as usize,
14686 ))
14687 }
14688 pub fn get_nan(&self) -> Result<(), ErrorContext> {
14689 let mut iter = self.clone();
14690 iter.pos = 0;
14691 for attr in iter {
14692 if let SupportedIftypes::Nan(val) = attr? {
14693 return Ok(val);
14694 }
14695 }
14696 Err(ErrorContext::new_missing(
14697 "SupportedIftypes",
14698 "Nan",
14699 self.orig_loc,
14700 self.buf.as_ptr() as usize,
14701 ))
14702 }
14703}
14704impl SupportedIftypes {
14705 pub fn new<'a>(buf: &'a [u8]) -> IterableSupportedIftypes<'a> {
14706 IterableSupportedIftypes::with_loc(buf, buf.as_ptr() as usize)
14707 }
14708 fn attr_from_type(r#type: u16) -> Option<&'static str> {
14709 let res = match r#type {
14710 1u16 => "Adhoc",
14711 2u16 => "Station",
14712 3u16 => "Ap",
14713 4u16 => "ApVlan",
14714 5u16 => "Wds",
14715 6u16 => "Monitor",
14716 7u16 => "MeshPoint",
14717 8u16 => "P2pClient",
14718 9u16 => "P2pGo",
14719 10u16 => "P2pDevice",
14720 11u16 => "Ocb",
14721 12u16 => "Nan",
14722 _ => return None,
14723 };
14724 Some(res)
14725 }
14726}
14727#[derive(Clone, Copy, Default)]
14728pub struct IterableSupportedIftypes<'a> {
14729 buf: &'a [u8],
14730 pos: usize,
14731 orig_loc: usize,
14732}
14733impl<'a> IterableSupportedIftypes<'a> {
14734 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
14735 Self {
14736 buf,
14737 pos: 0,
14738 orig_loc,
14739 }
14740 }
14741 pub fn get_buf(&self) -> &'a [u8] {
14742 self.buf
14743 }
14744}
14745impl<'a> Iterator for IterableSupportedIftypes<'a> {
14746 type Item = Result<SupportedIftypes, ErrorContext>;
14747 fn next(&mut self) -> Option<Self::Item> {
14748 if self.buf.len() == self.pos {
14749 return None;
14750 }
14751 let pos = self.pos;
14752 let mut r#type = None;
14753 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
14754 r#type = Some(header.r#type);
14755 let res = match header.r#type {
14756 1u16 => SupportedIftypes::Adhoc(()),
14757 2u16 => SupportedIftypes::Station(()),
14758 3u16 => SupportedIftypes::Ap(()),
14759 4u16 => SupportedIftypes::ApVlan(()),
14760 5u16 => SupportedIftypes::Wds(()),
14761 6u16 => SupportedIftypes::Monitor(()),
14762 7u16 => SupportedIftypes::MeshPoint(()),
14763 8u16 => SupportedIftypes::P2pClient(()),
14764 9u16 => SupportedIftypes::P2pGo(()),
14765 10u16 => SupportedIftypes::P2pDevice(()),
14766 11u16 => SupportedIftypes::Ocb(()),
14767 12u16 => SupportedIftypes::Nan(()),
14768 n => {
14769 if cfg!(any(test, feature = "deny-unknown-attrs")) {
14770 break;
14771 } else {
14772 continue;
14773 }
14774 }
14775 };
14776 return Some(Ok(res));
14777 }
14778 Some(Err(ErrorContext::new(
14779 "SupportedIftypes",
14780 r#type.and_then(|t| SupportedIftypes::attr_from_type(t)),
14781 self.orig_loc,
14782 self.buf.as_ptr().wrapping_add(pos) as usize,
14783 )))
14784 }
14785}
14786impl std::fmt::Debug for IterableSupportedIftypes<'_> {
14787 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
14788 let mut fmt = f.debug_struct("SupportedIftypes");
14789 for attr in self.clone() {
14790 let attr = match attr {
14791 Ok(a) => a,
14792 Err(err) => {
14793 fmt.finish()?;
14794 f.write_str("Err(")?;
14795 err.fmt(f)?;
14796 return f.write_str(")");
14797 }
14798 };
14799 match attr {
14800 SupportedIftypes::Adhoc(val) => fmt.field("Adhoc", &val),
14801 SupportedIftypes::Station(val) => fmt.field("Station", &val),
14802 SupportedIftypes::Ap(val) => fmt.field("Ap", &val),
14803 SupportedIftypes::ApVlan(val) => fmt.field("ApVlan", &val),
14804 SupportedIftypes::Wds(val) => fmt.field("Wds", &val),
14805 SupportedIftypes::Monitor(val) => fmt.field("Monitor", &val),
14806 SupportedIftypes::MeshPoint(val) => fmt.field("MeshPoint", &val),
14807 SupportedIftypes::P2pClient(val) => fmt.field("P2pClient", &val),
14808 SupportedIftypes::P2pGo(val) => fmt.field("P2pGo", &val),
14809 SupportedIftypes::P2pDevice(val) => fmt.field("P2pDevice", &val),
14810 SupportedIftypes::Ocb(val) => fmt.field("Ocb", &val),
14811 SupportedIftypes::Nan(val) => fmt.field("Nan", &val),
14812 };
14813 }
14814 fmt.finish()
14815 }
14816}
14817impl IterableSupportedIftypes<'_> {
14818 pub fn lookup_attr(
14819 &self,
14820 offset: usize,
14821 missing_type: Option<u16>,
14822 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
14823 let mut stack = Vec::new();
14824 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
14825 if cur == offset {
14826 stack.push(("SupportedIftypes", offset));
14827 return (
14828 stack,
14829 missing_type.and_then(|t| SupportedIftypes::attr_from_type(t)),
14830 );
14831 }
14832 if cur > offset || cur + self.buf.len() < offset {
14833 return (stack, None);
14834 }
14835 let mut attrs = self.clone();
14836 let mut last_off = cur + attrs.pos;
14837 while let Some(attr) = attrs.next() {
14838 let Ok(attr) = attr else { break };
14839 match attr {
14840 SupportedIftypes::Adhoc(val) => {
14841 if last_off == offset {
14842 stack.push(("Adhoc", last_off));
14843 break;
14844 }
14845 }
14846 SupportedIftypes::Station(val) => {
14847 if last_off == offset {
14848 stack.push(("Station", last_off));
14849 break;
14850 }
14851 }
14852 SupportedIftypes::Ap(val) => {
14853 if last_off == offset {
14854 stack.push(("Ap", last_off));
14855 break;
14856 }
14857 }
14858 SupportedIftypes::ApVlan(val) => {
14859 if last_off == offset {
14860 stack.push(("ApVlan", last_off));
14861 break;
14862 }
14863 }
14864 SupportedIftypes::Wds(val) => {
14865 if last_off == offset {
14866 stack.push(("Wds", last_off));
14867 break;
14868 }
14869 }
14870 SupportedIftypes::Monitor(val) => {
14871 if last_off == offset {
14872 stack.push(("Monitor", last_off));
14873 break;
14874 }
14875 }
14876 SupportedIftypes::MeshPoint(val) => {
14877 if last_off == offset {
14878 stack.push(("MeshPoint", last_off));
14879 break;
14880 }
14881 }
14882 SupportedIftypes::P2pClient(val) => {
14883 if last_off == offset {
14884 stack.push(("P2pClient", last_off));
14885 break;
14886 }
14887 }
14888 SupportedIftypes::P2pGo(val) => {
14889 if last_off == offset {
14890 stack.push(("P2pGo", last_off));
14891 break;
14892 }
14893 }
14894 SupportedIftypes::P2pDevice(val) => {
14895 if last_off == offset {
14896 stack.push(("P2pDevice", last_off));
14897 break;
14898 }
14899 }
14900 SupportedIftypes::Ocb(val) => {
14901 if last_off == offset {
14902 stack.push(("Ocb", last_off));
14903 break;
14904 }
14905 }
14906 SupportedIftypes::Nan(val) => {
14907 if last_off == offset {
14908 stack.push(("Nan", last_off));
14909 break;
14910 }
14911 }
14912 _ => {}
14913 };
14914 last_off = cur + attrs.pos;
14915 }
14916 if !stack.is_empty() {
14917 stack.push(("SupportedIftypes", cur));
14918 }
14919 (stack, None)
14920 }
14921}
14922#[derive(Clone)]
14923pub enum TxqStatsAttrs {
14924 BacklogBytes(u32),
14925 BacklogPackets(u32),
14926 Flows(u32),
14927 Drops(u32),
14928 EcnMarks(u32),
14929 Overlimit(u32),
14930 Overmemory(u32),
14931 Collisions(u32),
14932 TxBytes(u32),
14933 TxPackets(u32),
14934 MaxFlows(u32),
14935}
14936impl<'a> IterableTxqStatsAttrs<'a> {
14937 pub fn get_backlog_bytes(&self) -> Result<u32, ErrorContext> {
14938 let mut iter = self.clone();
14939 iter.pos = 0;
14940 for attr in iter {
14941 if let TxqStatsAttrs::BacklogBytes(val) = attr? {
14942 return Ok(val);
14943 }
14944 }
14945 Err(ErrorContext::new_missing(
14946 "TxqStatsAttrs",
14947 "BacklogBytes",
14948 self.orig_loc,
14949 self.buf.as_ptr() as usize,
14950 ))
14951 }
14952 pub fn get_backlog_packets(&self) -> Result<u32, ErrorContext> {
14953 let mut iter = self.clone();
14954 iter.pos = 0;
14955 for attr in iter {
14956 if let TxqStatsAttrs::BacklogPackets(val) = attr? {
14957 return Ok(val);
14958 }
14959 }
14960 Err(ErrorContext::new_missing(
14961 "TxqStatsAttrs",
14962 "BacklogPackets",
14963 self.orig_loc,
14964 self.buf.as_ptr() as usize,
14965 ))
14966 }
14967 pub fn get_flows(&self) -> Result<u32, ErrorContext> {
14968 let mut iter = self.clone();
14969 iter.pos = 0;
14970 for attr in iter {
14971 if let TxqStatsAttrs::Flows(val) = attr? {
14972 return Ok(val);
14973 }
14974 }
14975 Err(ErrorContext::new_missing(
14976 "TxqStatsAttrs",
14977 "Flows",
14978 self.orig_loc,
14979 self.buf.as_ptr() as usize,
14980 ))
14981 }
14982 pub fn get_drops(&self) -> Result<u32, ErrorContext> {
14983 let mut iter = self.clone();
14984 iter.pos = 0;
14985 for attr in iter {
14986 if let TxqStatsAttrs::Drops(val) = attr? {
14987 return Ok(val);
14988 }
14989 }
14990 Err(ErrorContext::new_missing(
14991 "TxqStatsAttrs",
14992 "Drops",
14993 self.orig_loc,
14994 self.buf.as_ptr() as usize,
14995 ))
14996 }
14997 pub fn get_ecn_marks(&self) -> Result<u32, ErrorContext> {
14998 let mut iter = self.clone();
14999 iter.pos = 0;
15000 for attr in iter {
15001 if let TxqStatsAttrs::EcnMarks(val) = attr? {
15002 return Ok(val);
15003 }
15004 }
15005 Err(ErrorContext::new_missing(
15006 "TxqStatsAttrs",
15007 "EcnMarks",
15008 self.orig_loc,
15009 self.buf.as_ptr() as usize,
15010 ))
15011 }
15012 pub fn get_overlimit(&self) -> Result<u32, ErrorContext> {
15013 let mut iter = self.clone();
15014 iter.pos = 0;
15015 for attr in iter {
15016 if let TxqStatsAttrs::Overlimit(val) = attr? {
15017 return Ok(val);
15018 }
15019 }
15020 Err(ErrorContext::new_missing(
15021 "TxqStatsAttrs",
15022 "Overlimit",
15023 self.orig_loc,
15024 self.buf.as_ptr() as usize,
15025 ))
15026 }
15027 pub fn get_overmemory(&self) -> Result<u32, ErrorContext> {
15028 let mut iter = self.clone();
15029 iter.pos = 0;
15030 for attr in iter {
15031 if let TxqStatsAttrs::Overmemory(val) = attr? {
15032 return Ok(val);
15033 }
15034 }
15035 Err(ErrorContext::new_missing(
15036 "TxqStatsAttrs",
15037 "Overmemory",
15038 self.orig_loc,
15039 self.buf.as_ptr() as usize,
15040 ))
15041 }
15042 pub fn get_collisions(&self) -> Result<u32, ErrorContext> {
15043 let mut iter = self.clone();
15044 iter.pos = 0;
15045 for attr in iter {
15046 if let TxqStatsAttrs::Collisions(val) = attr? {
15047 return Ok(val);
15048 }
15049 }
15050 Err(ErrorContext::new_missing(
15051 "TxqStatsAttrs",
15052 "Collisions",
15053 self.orig_loc,
15054 self.buf.as_ptr() as usize,
15055 ))
15056 }
15057 pub fn get_tx_bytes(&self) -> Result<u32, ErrorContext> {
15058 let mut iter = self.clone();
15059 iter.pos = 0;
15060 for attr in iter {
15061 if let TxqStatsAttrs::TxBytes(val) = attr? {
15062 return Ok(val);
15063 }
15064 }
15065 Err(ErrorContext::new_missing(
15066 "TxqStatsAttrs",
15067 "TxBytes",
15068 self.orig_loc,
15069 self.buf.as_ptr() as usize,
15070 ))
15071 }
15072 pub fn get_tx_packets(&self) -> Result<u32, ErrorContext> {
15073 let mut iter = self.clone();
15074 iter.pos = 0;
15075 for attr in iter {
15076 if let TxqStatsAttrs::TxPackets(val) = attr? {
15077 return Ok(val);
15078 }
15079 }
15080 Err(ErrorContext::new_missing(
15081 "TxqStatsAttrs",
15082 "TxPackets",
15083 self.orig_loc,
15084 self.buf.as_ptr() as usize,
15085 ))
15086 }
15087 pub fn get_max_flows(&self) -> Result<u32, ErrorContext> {
15088 let mut iter = self.clone();
15089 iter.pos = 0;
15090 for attr in iter {
15091 if let TxqStatsAttrs::MaxFlows(val) = attr? {
15092 return Ok(val);
15093 }
15094 }
15095 Err(ErrorContext::new_missing(
15096 "TxqStatsAttrs",
15097 "MaxFlows",
15098 self.orig_loc,
15099 self.buf.as_ptr() as usize,
15100 ))
15101 }
15102}
15103impl TxqStatsAttrs {
15104 pub fn new<'a>(buf: &'a [u8]) -> IterableTxqStatsAttrs<'a> {
15105 IterableTxqStatsAttrs::with_loc(buf, buf.as_ptr() as usize)
15106 }
15107 fn attr_from_type(r#type: u16) -> Option<&'static str> {
15108 let res = match r#type {
15109 1u16 => "BacklogBytes",
15110 2u16 => "BacklogPackets",
15111 3u16 => "Flows",
15112 4u16 => "Drops",
15113 5u16 => "EcnMarks",
15114 6u16 => "Overlimit",
15115 7u16 => "Overmemory",
15116 8u16 => "Collisions",
15117 9u16 => "TxBytes",
15118 10u16 => "TxPackets",
15119 11u16 => "MaxFlows",
15120 _ => return None,
15121 };
15122 Some(res)
15123 }
15124}
15125#[derive(Clone, Copy, Default)]
15126pub struct IterableTxqStatsAttrs<'a> {
15127 buf: &'a [u8],
15128 pos: usize,
15129 orig_loc: usize,
15130}
15131impl<'a> IterableTxqStatsAttrs<'a> {
15132 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
15133 Self {
15134 buf,
15135 pos: 0,
15136 orig_loc,
15137 }
15138 }
15139 pub fn get_buf(&self) -> &'a [u8] {
15140 self.buf
15141 }
15142}
15143impl<'a> Iterator for IterableTxqStatsAttrs<'a> {
15144 type Item = Result<TxqStatsAttrs, ErrorContext>;
15145 fn next(&mut self) -> Option<Self::Item> {
15146 if self.buf.len() == self.pos {
15147 return None;
15148 }
15149 let pos = self.pos;
15150 let mut r#type = None;
15151 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
15152 r#type = Some(header.r#type);
15153 let res = match header.r#type {
15154 1u16 => TxqStatsAttrs::BacklogBytes({
15155 let res = parse_u32(next);
15156 let Some(val) = res else { break };
15157 val
15158 }),
15159 2u16 => TxqStatsAttrs::BacklogPackets({
15160 let res = parse_u32(next);
15161 let Some(val) = res else { break };
15162 val
15163 }),
15164 3u16 => TxqStatsAttrs::Flows({
15165 let res = parse_u32(next);
15166 let Some(val) = res else { break };
15167 val
15168 }),
15169 4u16 => TxqStatsAttrs::Drops({
15170 let res = parse_u32(next);
15171 let Some(val) = res else { break };
15172 val
15173 }),
15174 5u16 => TxqStatsAttrs::EcnMarks({
15175 let res = parse_u32(next);
15176 let Some(val) = res else { break };
15177 val
15178 }),
15179 6u16 => TxqStatsAttrs::Overlimit({
15180 let res = parse_u32(next);
15181 let Some(val) = res else { break };
15182 val
15183 }),
15184 7u16 => TxqStatsAttrs::Overmemory({
15185 let res = parse_u32(next);
15186 let Some(val) = res else { break };
15187 val
15188 }),
15189 8u16 => TxqStatsAttrs::Collisions({
15190 let res = parse_u32(next);
15191 let Some(val) = res else { break };
15192 val
15193 }),
15194 9u16 => TxqStatsAttrs::TxBytes({
15195 let res = parse_u32(next);
15196 let Some(val) = res else { break };
15197 val
15198 }),
15199 10u16 => TxqStatsAttrs::TxPackets({
15200 let res = parse_u32(next);
15201 let Some(val) = res else { break };
15202 val
15203 }),
15204 11u16 => TxqStatsAttrs::MaxFlows({
15205 let res = parse_u32(next);
15206 let Some(val) = res else { break };
15207 val
15208 }),
15209 n => {
15210 if cfg!(any(test, feature = "deny-unknown-attrs")) {
15211 break;
15212 } else {
15213 continue;
15214 }
15215 }
15216 };
15217 return Some(Ok(res));
15218 }
15219 Some(Err(ErrorContext::new(
15220 "TxqStatsAttrs",
15221 r#type.and_then(|t| TxqStatsAttrs::attr_from_type(t)),
15222 self.orig_loc,
15223 self.buf.as_ptr().wrapping_add(pos) as usize,
15224 )))
15225 }
15226}
15227impl std::fmt::Debug for IterableTxqStatsAttrs<'_> {
15228 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15229 let mut fmt = f.debug_struct("TxqStatsAttrs");
15230 for attr in self.clone() {
15231 let attr = match attr {
15232 Ok(a) => a,
15233 Err(err) => {
15234 fmt.finish()?;
15235 f.write_str("Err(")?;
15236 err.fmt(f)?;
15237 return f.write_str(")");
15238 }
15239 };
15240 match attr {
15241 TxqStatsAttrs::BacklogBytes(val) => fmt.field("BacklogBytes", &val),
15242 TxqStatsAttrs::BacklogPackets(val) => fmt.field("BacklogPackets", &val),
15243 TxqStatsAttrs::Flows(val) => fmt.field("Flows", &val),
15244 TxqStatsAttrs::Drops(val) => fmt.field("Drops", &val),
15245 TxqStatsAttrs::EcnMarks(val) => fmt.field("EcnMarks", &val),
15246 TxqStatsAttrs::Overlimit(val) => fmt.field("Overlimit", &val),
15247 TxqStatsAttrs::Overmemory(val) => fmt.field("Overmemory", &val),
15248 TxqStatsAttrs::Collisions(val) => fmt.field("Collisions", &val),
15249 TxqStatsAttrs::TxBytes(val) => fmt.field("TxBytes", &val),
15250 TxqStatsAttrs::TxPackets(val) => fmt.field("TxPackets", &val),
15251 TxqStatsAttrs::MaxFlows(val) => fmt.field("MaxFlows", &val),
15252 };
15253 }
15254 fmt.finish()
15255 }
15256}
15257impl IterableTxqStatsAttrs<'_> {
15258 pub fn lookup_attr(
15259 &self,
15260 offset: usize,
15261 missing_type: Option<u16>,
15262 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
15263 let mut stack = Vec::new();
15264 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
15265 if cur == offset {
15266 stack.push(("TxqStatsAttrs", offset));
15267 return (
15268 stack,
15269 missing_type.and_then(|t| TxqStatsAttrs::attr_from_type(t)),
15270 );
15271 }
15272 if cur > offset || cur + self.buf.len() < offset {
15273 return (stack, None);
15274 }
15275 let mut attrs = self.clone();
15276 let mut last_off = cur + attrs.pos;
15277 while let Some(attr) = attrs.next() {
15278 let Ok(attr) = attr else { break };
15279 match attr {
15280 TxqStatsAttrs::BacklogBytes(val) => {
15281 if last_off == offset {
15282 stack.push(("BacklogBytes", last_off));
15283 break;
15284 }
15285 }
15286 TxqStatsAttrs::BacklogPackets(val) => {
15287 if last_off == offset {
15288 stack.push(("BacklogPackets", last_off));
15289 break;
15290 }
15291 }
15292 TxqStatsAttrs::Flows(val) => {
15293 if last_off == offset {
15294 stack.push(("Flows", last_off));
15295 break;
15296 }
15297 }
15298 TxqStatsAttrs::Drops(val) => {
15299 if last_off == offset {
15300 stack.push(("Drops", last_off));
15301 break;
15302 }
15303 }
15304 TxqStatsAttrs::EcnMarks(val) => {
15305 if last_off == offset {
15306 stack.push(("EcnMarks", last_off));
15307 break;
15308 }
15309 }
15310 TxqStatsAttrs::Overlimit(val) => {
15311 if last_off == offset {
15312 stack.push(("Overlimit", last_off));
15313 break;
15314 }
15315 }
15316 TxqStatsAttrs::Overmemory(val) => {
15317 if last_off == offset {
15318 stack.push(("Overmemory", last_off));
15319 break;
15320 }
15321 }
15322 TxqStatsAttrs::Collisions(val) => {
15323 if last_off == offset {
15324 stack.push(("Collisions", last_off));
15325 break;
15326 }
15327 }
15328 TxqStatsAttrs::TxBytes(val) => {
15329 if last_off == offset {
15330 stack.push(("TxBytes", last_off));
15331 break;
15332 }
15333 }
15334 TxqStatsAttrs::TxPackets(val) => {
15335 if last_off == offset {
15336 stack.push(("TxPackets", last_off));
15337 break;
15338 }
15339 }
15340 TxqStatsAttrs::MaxFlows(val) => {
15341 if last_off == offset {
15342 stack.push(("MaxFlows", last_off));
15343 break;
15344 }
15345 }
15346 _ => {}
15347 };
15348 last_off = cur + attrs.pos;
15349 }
15350 if !stack.is_empty() {
15351 stack.push(("TxqStatsAttrs", cur));
15352 }
15353 (stack, None)
15354 }
15355}
15356#[derive(Clone)]
15357pub enum WmmAttrs {
15358 CwMin(u16),
15359 CwMax(u16),
15360 Aifsn(u8),
15361 Txop(u16),
15362}
15363impl<'a> IterableWmmAttrs<'a> {
15364 pub fn get_cw_min(&self) -> Result<u16, ErrorContext> {
15365 let mut iter = self.clone();
15366 iter.pos = 0;
15367 for attr in iter {
15368 if let WmmAttrs::CwMin(val) = attr? {
15369 return Ok(val);
15370 }
15371 }
15372 Err(ErrorContext::new_missing(
15373 "WmmAttrs",
15374 "CwMin",
15375 self.orig_loc,
15376 self.buf.as_ptr() as usize,
15377 ))
15378 }
15379 pub fn get_cw_max(&self) -> Result<u16, ErrorContext> {
15380 let mut iter = self.clone();
15381 iter.pos = 0;
15382 for attr in iter {
15383 if let WmmAttrs::CwMax(val) = attr? {
15384 return Ok(val);
15385 }
15386 }
15387 Err(ErrorContext::new_missing(
15388 "WmmAttrs",
15389 "CwMax",
15390 self.orig_loc,
15391 self.buf.as_ptr() as usize,
15392 ))
15393 }
15394 pub fn get_aifsn(&self) -> Result<u8, ErrorContext> {
15395 let mut iter = self.clone();
15396 iter.pos = 0;
15397 for attr in iter {
15398 if let WmmAttrs::Aifsn(val) = attr? {
15399 return Ok(val);
15400 }
15401 }
15402 Err(ErrorContext::new_missing(
15403 "WmmAttrs",
15404 "Aifsn",
15405 self.orig_loc,
15406 self.buf.as_ptr() as usize,
15407 ))
15408 }
15409 pub fn get_txop(&self) -> Result<u16, ErrorContext> {
15410 let mut iter = self.clone();
15411 iter.pos = 0;
15412 for attr in iter {
15413 if let WmmAttrs::Txop(val) = attr? {
15414 return Ok(val);
15415 }
15416 }
15417 Err(ErrorContext::new_missing(
15418 "WmmAttrs",
15419 "Txop",
15420 self.orig_loc,
15421 self.buf.as_ptr() as usize,
15422 ))
15423 }
15424}
15425impl WmmAttrs {
15426 pub fn new<'a>(buf: &'a [u8]) -> IterableWmmAttrs<'a> {
15427 IterableWmmAttrs::with_loc(buf, buf.as_ptr() as usize)
15428 }
15429 fn attr_from_type(r#type: u16) -> Option<&'static str> {
15430 let res = match r#type {
15431 1u16 => "CwMin",
15432 2u16 => "CwMax",
15433 3u16 => "Aifsn",
15434 4u16 => "Txop",
15435 _ => return None,
15436 };
15437 Some(res)
15438 }
15439}
15440#[derive(Clone, Copy, Default)]
15441pub struct IterableWmmAttrs<'a> {
15442 buf: &'a [u8],
15443 pos: usize,
15444 orig_loc: usize,
15445}
15446impl<'a> IterableWmmAttrs<'a> {
15447 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
15448 Self {
15449 buf,
15450 pos: 0,
15451 orig_loc,
15452 }
15453 }
15454 pub fn get_buf(&self) -> &'a [u8] {
15455 self.buf
15456 }
15457}
15458impl<'a> Iterator for IterableWmmAttrs<'a> {
15459 type Item = Result<WmmAttrs, ErrorContext>;
15460 fn next(&mut self) -> Option<Self::Item> {
15461 if self.buf.len() == self.pos {
15462 return None;
15463 }
15464 let pos = self.pos;
15465 let mut r#type = None;
15466 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
15467 r#type = Some(header.r#type);
15468 let res = match header.r#type {
15469 1u16 => WmmAttrs::CwMin({
15470 let res = parse_u16(next);
15471 let Some(val) = res else { break };
15472 val
15473 }),
15474 2u16 => WmmAttrs::CwMax({
15475 let res = parse_u16(next);
15476 let Some(val) = res else { break };
15477 val
15478 }),
15479 3u16 => WmmAttrs::Aifsn({
15480 let res = parse_u8(next);
15481 let Some(val) = res else { break };
15482 val
15483 }),
15484 4u16 => WmmAttrs::Txop({
15485 let res = parse_u16(next);
15486 let Some(val) = res else { break };
15487 val
15488 }),
15489 n => {
15490 if cfg!(any(test, feature = "deny-unknown-attrs")) {
15491 break;
15492 } else {
15493 continue;
15494 }
15495 }
15496 };
15497 return Some(Ok(res));
15498 }
15499 Some(Err(ErrorContext::new(
15500 "WmmAttrs",
15501 r#type.and_then(|t| WmmAttrs::attr_from_type(t)),
15502 self.orig_loc,
15503 self.buf.as_ptr().wrapping_add(pos) as usize,
15504 )))
15505 }
15506}
15507impl std::fmt::Debug for IterableWmmAttrs<'_> {
15508 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
15509 let mut fmt = f.debug_struct("WmmAttrs");
15510 for attr in self.clone() {
15511 let attr = match attr {
15512 Ok(a) => a,
15513 Err(err) => {
15514 fmt.finish()?;
15515 f.write_str("Err(")?;
15516 err.fmt(f)?;
15517 return f.write_str(")");
15518 }
15519 };
15520 match attr {
15521 WmmAttrs::CwMin(val) => fmt.field("CwMin", &val),
15522 WmmAttrs::CwMax(val) => fmt.field("CwMax", &val),
15523 WmmAttrs::Aifsn(val) => fmt.field("Aifsn", &val),
15524 WmmAttrs::Txop(val) => fmt.field("Txop", &val),
15525 };
15526 }
15527 fmt.finish()
15528 }
15529}
15530impl IterableWmmAttrs<'_> {
15531 pub fn lookup_attr(
15532 &self,
15533 offset: usize,
15534 missing_type: Option<u16>,
15535 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
15536 let mut stack = Vec::new();
15537 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
15538 if cur == offset {
15539 stack.push(("WmmAttrs", offset));
15540 return (
15541 stack,
15542 missing_type.and_then(|t| WmmAttrs::attr_from_type(t)),
15543 );
15544 }
15545 if cur > offset || cur + self.buf.len() < offset {
15546 return (stack, None);
15547 }
15548 let mut attrs = self.clone();
15549 let mut last_off = cur + attrs.pos;
15550 while let Some(attr) = attrs.next() {
15551 let Ok(attr) = attr else { break };
15552 match attr {
15553 WmmAttrs::CwMin(val) => {
15554 if last_off == offset {
15555 stack.push(("CwMin", last_off));
15556 break;
15557 }
15558 }
15559 WmmAttrs::CwMax(val) => {
15560 if last_off == offset {
15561 stack.push(("CwMax", last_off));
15562 break;
15563 }
15564 }
15565 WmmAttrs::Aifsn(val) => {
15566 if last_off == offset {
15567 stack.push(("Aifsn", last_off));
15568 break;
15569 }
15570 }
15571 WmmAttrs::Txop(val) => {
15572 if last_off == offset {
15573 stack.push(("Txop", last_off));
15574 break;
15575 }
15576 }
15577 _ => {}
15578 };
15579 last_off = cur + attrs.pos;
15580 }
15581 if !stack.is_empty() {
15582 stack.push(("WmmAttrs", cur));
15583 }
15584 (stack, None)
15585 }
15586}
15587#[derive(Clone)]
15588pub enum WowlanTriggersAttrs {
15589 Any(()),
15590 Disconnect(()),
15591 MagicPkt(()),
15592 PktPattern(()),
15593 GtkRekeySupported(()),
15594 GtkRekeyFailure(()),
15595 EapIdentRequest(()),
15596 _4wayHandshake(()),
15597 RfkillRelease(()),
15598 WakeupPkt80211(()),
15599 WakeupPkt80211Len(()),
15600 WakeupPkt8023(()),
15601 WakeupPkt8023Len(()),
15602 TcpConnection(()),
15603 WakeupTcpMatch(()),
15604 WakeupTcpConnlost(()),
15605 WakeupTcpNomoretokens(()),
15606 NetDetect(()),
15607 NetDetectResults(()),
15608 UnprotectedDeauthDisassoc(()),
15609}
15610impl<'a> IterableWowlanTriggersAttrs<'a> {
15611 pub fn get_any(&self) -> Result<(), ErrorContext> {
15612 let mut iter = self.clone();
15613 iter.pos = 0;
15614 for attr in iter {
15615 if let WowlanTriggersAttrs::Any(val) = attr? {
15616 return Ok(val);
15617 }
15618 }
15619 Err(ErrorContext::new_missing(
15620 "WowlanTriggersAttrs",
15621 "Any",
15622 self.orig_loc,
15623 self.buf.as_ptr() as usize,
15624 ))
15625 }
15626 pub fn get_disconnect(&self) -> Result<(), ErrorContext> {
15627 let mut iter = self.clone();
15628 iter.pos = 0;
15629 for attr in iter {
15630 if let WowlanTriggersAttrs::Disconnect(val) = attr? {
15631 return Ok(val);
15632 }
15633 }
15634 Err(ErrorContext::new_missing(
15635 "WowlanTriggersAttrs",
15636 "Disconnect",
15637 self.orig_loc,
15638 self.buf.as_ptr() as usize,
15639 ))
15640 }
15641 pub fn get_magic_pkt(&self) -> Result<(), ErrorContext> {
15642 let mut iter = self.clone();
15643 iter.pos = 0;
15644 for attr in iter {
15645 if let WowlanTriggersAttrs::MagicPkt(val) = attr? {
15646 return Ok(val);
15647 }
15648 }
15649 Err(ErrorContext::new_missing(
15650 "WowlanTriggersAttrs",
15651 "MagicPkt",
15652 self.orig_loc,
15653 self.buf.as_ptr() as usize,
15654 ))
15655 }
15656 pub fn get_pkt_pattern(&self) -> Result<(), ErrorContext> {
15657 let mut iter = self.clone();
15658 iter.pos = 0;
15659 for attr in iter {
15660 if let WowlanTriggersAttrs::PktPattern(val) = attr? {
15661 return Ok(val);
15662 }
15663 }
15664 Err(ErrorContext::new_missing(
15665 "WowlanTriggersAttrs",
15666 "PktPattern",
15667 self.orig_loc,
15668 self.buf.as_ptr() as usize,
15669 ))
15670 }
15671 pub fn get_gtk_rekey_supported(&self) -> Result<(), ErrorContext> {
15672 let mut iter = self.clone();
15673 iter.pos = 0;
15674 for attr in iter {
15675 if let WowlanTriggersAttrs::GtkRekeySupported(val) = attr? {
15676 return Ok(val);
15677 }
15678 }
15679 Err(ErrorContext::new_missing(
15680 "WowlanTriggersAttrs",
15681 "GtkRekeySupported",
15682 self.orig_loc,
15683 self.buf.as_ptr() as usize,
15684 ))
15685 }
15686 pub fn get_gtk_rekey_failure(&self) -> Result<(), ErrorContext> {
15687 let mut iter = self.clone();
15688 iter.pos = 0;
15689 for attr in iter {
15690 if let WowlanTriggersAttrs::GtkRekeyFailure(val) = attr? {
15691 return Ok(val);
15692 }
15693 }
15694 Err(ErrorContext::new_missing(
15695 "WowlanTriggersAttrs",
15696 "GtkRekeyFailure",
15697 self.orig_loc,
15698 self.buf.as_ptr() as usize,
15699 ))
15700 }
15701 pub fn get_eap_ident_request(&self) -> Result<(), ErrorContext> {
15702 let mut iter = self.clone();
15703 iter.pos = 0;
15704 for attr in iter {
15705 if let WowlanTriggersAttrs::EapIdentRequest(val) = attr? {
15706 return Ok(val);
15707 }
15708 }
15709 Err(ErrorContext::new_missing(
15710 "WowlanTriggersAttrs",
15711 "EapIdentRequest",
15712 self.orig_loc,
15713 self.buf.as_ptr() as usize,
15714 ))
15715 }
15716 pub fn get_4way_handshake(&self) -> Result<(), ErrorContext> {
15717 let mut iter = self.clone();
15718 iter.pos = 0;
15719 for attr in iter {
15720 if let WowlanTriggersAttrs::_4wayHandshake(val) = attr? {
15721 return Ok(val);
15722 }
15723 }
15724 Err(ErrorContext::new_missing(
15725 "WowlanTriggersAttrs",
15726 "4wayHandshake",
15727 self.orig_loc,
15728 self.buf.as_ptr() as usize,
15729 ))
15730 }
15731 pub fn get_rfkill_release(&self) -> Result<(), ErrorContext> {
15732 let mut iter = self.clone();
15733 iter.pos = 0;
15734 for attr in iter {
15735 if let WowlanTriggersAttrs::RfkillRelease(val) = attr? {
15736 return Ok(val);
15737 }
15738 }
15739 Err(ErrorContext::new_missing(
15740 "WowlanTriggersAttrs",
15741 "RfkillRelease",
15742 self.orig_loc,
15743 self.buf.as_ptr() as usize,
15744 ))
15745 }
15746 pub fn get_wakeup_pkt_80211(&self) -> Result<(), ErrorContext> {
15747 let mut iter = self.clone();
15748 iter.pos = 0;
15749 for attr in iter {
15750 if let WowlanTriggersAttrs::WakeupPkt80211(val) = attr? {
15751 return Ok(val);
15752 }
15753 }
15754 Err(ErrorContext::new_missing(
15755 "WowlanTriggersAttrs",
15756 "WakeupPkt80211",
15757 self.orig_loc,
15758 self.buf.as_ptr() as usize,
15759 ))
15760 }
15761 pub fn get_wakeup_pkt_80211_len(&self) -> Result<(), ErrorContext> {
15762 let mut iter = self.clone();
15763 iter.pos = 0;
15764 for attr in iter {
15765 if let WowlanTriggersAttrs::WakeupPkt80211Len(val) = attr? {
15766 return Ok(val);
15767 }
15768 }
15769 Err(ErrorContext::new_missing(
15770 "WowlanTriggersAttrs",
15771 "WakeupPkt80211Len",
15772 self.orig_loc,
15773 self.buf.as_ptr() as usize,
15774 ))
15775 }
15776 pub fn get_wakeup_pkt_8023(&self) -> Result<(), ErrorContext> {
15777 let mut iter = self.clone();
15778 iter.pos = 0;
15779 for attr in iter {
15780 if let WowlanTriggersAttrs::WakeupPkt8023(val) = attr? {
15781 return Ok(val);
15782 }
15783 }
15784 Err(ErrorContext::new_missing(
15785 "WowlanTriggersAttrs",
15786 "WakeupPkt8023",
15787 self.orig_loc,
15788 self.buf.as_ptr() as usize,
15789 ))
15790 }
15791 pub fn get_wakeup_pkt_8023_len(&self) -> Result<(), ErrorContext> {
15792 let mut iter = self.clone();
15793 iter.pos = 0;
15794 for attr in iter {
15795 if let WowlanTriggersAttrs::WakeupPkt8023Len(val) = attr? {
15796 return Ok(val);
15797 }
15798 }
15799 Err(ErrorContext::new_missing(
15800 "WowlanTriggersAttrs",
15801 "WakeupPkt8023Len",
15802 self.orig_loc,
15803 self.buf.as_ptr() as usize,
15804 ))
15805 }
15806 pub fn get_tcp_connection(&self) -> Result<(), ErrorContext> {
15807 let mut iter = self.clone();
15808 iter.pos = 0;
15809 for attr in iter {
15810 if let WowlanTriggersAttrs::TcpConnection(val) = attr? {
15811 return Ok(val);
15812 }
15813 }
15814 Err(ErrorContext::new_missing(
15815 "WowlanTriggersAttrs",
15816 "TcpConnection",
15817 self.orig_loc,
15818 self.buf.as_ptr() as usize,
15819 ))
15820 }
15821 pub fn get_wakeup_tcp_match(&self) -> Result<(), ErrorContext> {
15822 let mut iter = self.clone();
15823 iter.pos = 0;
15824 for attr in iter {
15825 if let WowlanTriggersAttrs::WakeupTcpMatch(val) = attr? {
15826 return Ok(val);
15827 }
15828 }
15829 Err(ErrorContext::new_missing(
15830 "WowlanTriggersAttrs",
15831 "WakeupTcpMatch",
15832 self.orig_loc,
15833 self.buf.as_ptr() as usize,
15834 ))
15835 }
15836 pub fn get_wakeup_tcp_connlost(&self) -> Result<(), ErrorContext> {
15837 let mut iter = self.clone();
15838 iter.pos = 0;
15839 for attr in iter {
15840 if let WowlanTriggersAttrs::WakeupTcpConnlost(val) = attr? {
15841 return Ok(val);
15842 }
15843 }
15844 Err(ErrorContext::new_missing(
15845 "WowlanTriggersAttrs",
15846 "WakeupTcpConnlost",
15847 self.orig_loc,
15848 self.buf.as_ptr() as usize,
15849 ))
15850 }
15851 pub fn get_wakeup_tcp_nomoretokens(&self) -> Result<(), ErrorContext> {
15852 let mut iter = self.clone();
15853 iter.pos = 0;
15854 for attr in iter {
15855 if let WowlanTriggersAttrs::WakeupTcpNomoretokens(val) = attr? {
15856 return Ok(val);
15857 }
15858 }
15859 Err(ErrorContext::new_missing(
15860 "WowlanTriggersAttrs",
15861 "WakeupTcpNomoretokens",
15862 self.orig_loc,
15863 self.buf.as_ptr() as usize,
15864 ))
15865 }
15866 pub fn get_net_detect(&self) -> Result<(), ErrorContext> {
15867 let mut iter = self.clone();
15868 iter.pos = 0;
15869 for attr in iter {
15870 if let WowlanTriggersAttrs::NetDetect(val) = attr? {
15871 return Ok(val);
15872 }
15873 }
15874 Err(ErrorContext::new_missing(
15875 "WowlanTriggersAttrs",
15876 "NetDetect",
15877 self.orig_loc,
15878 self.buf.as_ptr() as usize,
15879 ))
15880 }
15881 pub fn get_net_detect_results(&self) -> Result<(), ErrorContext> {
15882 let mut iter = self.clone();
15883 iter.pos = 0;
15884 for attr in iter {
15885 if let WowlanTriggersAttrs::NetDetectResults(val) = attr? {
15886 return Ok(val);
15887 }
15888 }
15889 Err(ErrorContext::new_missing(
15890 "WowlanTriggersAttrs",
15891 "NetDetectResults",
15892 self.orig_loc,
15893 self.buf.as_ptr() as usize,
15894 ))
15895 }
15896 pub fn get_unprotected_deauth_disassoc(&self) -> Result<(), ErrorContext> {
15897 let mut iter = self.clone();
15898 iter.pos = 0;
15899 for attr in iter {
15900 if let WowlanTriggersAttrs::UnprotectedDeauthDisassoc(val) = attr? {
15901 return Ok(val);
15902 }
15903 }
15904 Err(ErrorContext::new_missing(
15905 "WowlanTriggersAttrs",
15906 "UnprotectedDeauthDisassoc",
15907 self.orig_loc,
15908 self.buf.as_ptr() as usize,
15909 ))
15910 }
15911}
15912impl WowlanTriggersAttrs {
15913 pub fn new<'a>(buf: &'a [u8]) -> IterableWowlanTriggersAttrs<'a> {
15914 IterableWowlanTriggersAttrs::with_loc(buf, buf.as_ptr() as usize)
15915 }
15916 fn attr_from_type(r#type: u16) -> Option<&'static str> {
15917 let res = match r#type {
15918 1u16 => "Any",
15919 2u16 => "Disconnect",
15920 3u16 => "MagicPkt",
15921 4u16 => "PktPattern",
15922 5u16 => "GtkRekeySupported",
15923 6u16 => "GtkRekeyFailure",
15924 7u16 => "EapIdentRequest",
15925 8u16 => "4wayHandshake",
15926 9u16 => "RfkillRelease",
15927 10u16 => "WakeupPkt80211",
15928 11u16 => "WakeupPkt80211Len",
15929 12u16 => "WakeupPkt8023",
15930 13u16 => "WakeupPkt8023Len",
15931 14u16 => "TcpConnection",
15932 15u16 => "WakeupTcpMatch",
15933 16u16 => "WakeupTcpConnlost",
15934 17u16 => "WakeupTcpNomoretokens",
15935 18u16 => "NetDetect",
15936 19u16 => "NetDetectResults",
15937 20u16 => "UnprotectedDeauthDisassoc",
15938 _ => return None,
15939 };
15940 Some(res)
15941 }
15942}
15943#[derive(Clone, Copy, Default)]
15944pub struct IterableWowlanTriggersAttrs<'a> {
15945 buf: &'a [u8],
15946 pos: usize,
15947 orig_loc: usize,
15948}
15949impl<'a> IterableWowlanTriggersAttrs<'a> {
15950 fn with_loc(buf: &'a [u8], orig_loc: usize) -> Self {
15951 Self {
15952 buf,
15953 pos: 0,
15954 orig_loc,
15955 }
15956 }
15957 pub fn get_buf(&self) -> &'a [u8] {
15958 self.buf
15959 }
15960}
15961impl<'a> Iterator for IterableWowlanTriggersAttrs<'a> {
15962 type Item = Result<WowlanTriggersAttrs, ErrorContext>;
15963 fn next(&mut self) -> Option<Self::Item> {
15964 if self.buf.len() == self.pos {
15965 return None;
15966 }
15967 let pos = self.pos;
15968 let mut r#type = None;
15969 while let Some((header, next)) = chop_header(self.buf, &mut self.pos) {
15970 r#type = Some(header.r#type);
15971 let res = match header.r#type {
15972 1u16 => WowlanTriggersAttrs::Any(()),
15973 2u16 => WowlanTriggersAttrs::Disconnect(()),
15974 3u16 => WowlanTriggersAttrs::MagicPkt(()),
15975 4u16 => WowlanTriggersAttrs::PktPattern(()),
15976 5u16 => WowlanTriggersAttrs::GtkRekeySupported(()),
15977 6u16 => WowlanTriggersAttrs::GtkRekeyFailure(()),
15978 7u16 => WowlanTriggersAttrs::EapIdentRequest(()),
15979 8u16 => WowlanTriggersAttrs::_4wayHandshake(()),
15980 9u16 => WowlanTriggersAttrs::RfkillRelease(()),
15981 10u16 => WowlanTriggersAttrs::WakeupPkt80211(()),
15982 11u16 => WowlanTriggersAttrs::WakeupPkt80211Len(()),
15983 12u16 => WowlanTriggersAttrs::WakeupPkt8023(()),
15984 13u16 => WowlanTriggersAttrs::WakeupPkt8023Len(()),
15985 14u16 => WowlanTriggersAttrs::TcpConnection(()),
15986 15u16 => WowlanTriggersAttrs::WakeupTcpMatch(()),
15987 16u16 => WowlanTriggersAttrs::WakeupTcpConnlost(()),
15988 17u16 => WowlanTriggersAttrs::WakeupTcpNomoretokens(()),
15989 18u16 => WowlanTriggersAttrs::NetDetect(()),
15990 19u16 => WowlanTriggersAttrs::NetDetectResults(()),
15991 20u16 => WowlanTriggersAttrs::UnprotectedDeauthDisassoc(()),
15992 n => {
15993 if cfg!(any(test, feature = "deny-unknown-attrs")) {
15994 break;
15995 } else {
15996 continue;
15997 }
15998 }
15999 };
16000 return Some(Ok(res));
16001 }
16002 Some(Err(ErrorContext::new(
16003 "WowlanTriggersAttrs",
16004 r#type.and_then(|t| WowlanTriggersAttrs::attr_from_type(t)),
16005 self.orig_loc,
16006 self.buf.as_ptr().wrapping_add(pos) as usize,
16007 )))
16008 }
16009}
16010impl std::fmt::Debug for IterableWowlanTriggersAttrs<'_> {
16011 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
16012 let mut fmt = f.debug_struct("WowlanTriggersAttrs");
16013 for attr in self.clone() {
16014 let attr = match attr {
16015 Ok(a) => a,
16016 Err(err) => {
16017 fmt.finish()?;
16018 f.write_str("Err(")?;
16019 err.fmt(f)?;
16020 return f.write_str(")");
16021 }
16022 };
16023 match attr {
16024 WowlanTriggersAttrs::Any(val) => fmt.field("Any", &val),
16025 WowlanTriggersAttrs::Disconnect(val) => fmt.field("Disconnect", &val),
16026 WowlanTriggersAttrs::MagicPkt(val) => fmt.field("MagicPkt", &val),
16027 WowlanTriggersAttrs::PktPattern(val) => fmt.field("PktPattern", &val),
16028 WowlanTriggersAttrs::GtkRekeySupported(val) => fmt.field("GtkRekeySupported", &val),
16029 WowlanTriggersAttrs::GtkRekeyFailure(val) => fmt.field("GtkRekeyFailure", &val),
16030 WowlanTriggersAttrs::EapIdentRequest(val) => fmt.field("EapIdentRequest", &val),
16031 WowlanTriggersAttrs::_4wayHandshake(val) => fmt.field("_4wayHandshake", &val),
16032 WowlanTriggersAttrs::RfkillRelease(val) => fmt.field("RfkillRelease", &val),
16033 WowlanTriggersAttrs::WakeupPkt80211(val) => fmt.field("WakeupPkt80211", &val),
16034 WowlanTriggersAttrs::WakeupPkt80211Len(val) => fmt.field("WakeupPkt80211Len", &val),
16035 WowlanTriggersAttrs::WakeupPkt8023(val) => fmt.field("WakeupPkt8023", &val),
16036 WowlanTriggersAttrs::WakeupPkt8023Len(val) => fmt.field("WakeupPkt8023Len", &val),
16037 WowlanTriggersAttrs::TcpConnection(val) => fmt.field("TcpConnection", &val),
16038 WowlanTriggersAttrs::WakeupTcpMatch(val) => fmt.field("WakeupTcpMatch", &val),
16039 WowlanTriggersAttrs::WakeupTcpConnlost(val) => fmt.field("WakeupTcpConnlost", &val),
16040 WowlanTriggersAttrs::WakeupTcpNomoretokens(val) => {
16041 fmt.field("WakeupTcpNomoretokens", &val)
16042 }
16043 WowlanTriggersAttrs::NetDetect(val) => fmt.field("NetDetect", &val),
16044 WowlanTriggersAttrs::NetDetectResults(val) => fmt.field("NetDetectResults", &val),
16045 WowlanTriggersAttrs::UnprotectedDeauthDisassoc(val) => {
16046 fmt.field("UnprotectedDeauthDisassoc", &val)
16047 }
16048 };
16049 }
16050 fmt.finish()
16051 }
16052}
16053impl IterableWowlanTriggersAttrs<'_> {
16054 pub fn lookup_attr(
16055 &self,
16056 offset: usize,
16057 missing_type: Option<u16>,
16058 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
16059 let mut stack = Vec::new();
16060 let cur = ErrorContext::calc_offset(self.orig_loc, self.buf.as_ptr() as usize);
16061 if cur == offset {
16062 stack.push(("WowlanTriggersAttrs", offset));
16063 return (
16064 stack,
16065 missing_type.and_then(|t| WowlanTriggersAttrs::attr_from_type(t)),
16066 );
16067 }
16068 if cur > offset || cur + self.buf.len() < offset {
16069 return (stack, None);
16070 }
16071 let mut attrs = self.clone();
16072 let mut last_off = cur + attrs.pos;
16073 while let Some(attr) = attrs.next() {
16074 let Ok(attr) = attr else { break };
16075 match attr {
16076 WowlanTriggersAttrs::Any(val) => {
16077 if last_off == offset {
16078 stack.push(("Any", last_off));
16079 break;
16080 }
16081 }
16082 WowlanTriggersAttrs::Disconnect(val) => {
16083 if last_off == offset {
16084 stack.push(("Disconnect", last_off));
16085 break;
16086 }
16087 }
16088 WowlanTriggersAttrs::MagicPkt(val) => {
16089 if last_off == offset {
16090 stack.push(("MagicPkt", last_off));
16091 break;
16092 }
16093 }
16094 WowlanTriggersAttrs::PktPattern(val) => {
16095 if last_off == offset {
16096 stack.push(("PktPattern", last_off));
16097 break;
16098 }
16099 }
16100 WowlanTriggersAttrs::GtkRekeySupported(val) => {
16101 if last_off == offset {
16102 stack.push(("GtkRekeySupported", last_off));
16103 break;
16104 }
16105 }
16106 WowlanTriggersAttrs::GtkRekeyFailure(val) => {
16107 if last_off == offset {
16108 stack.push(("GtkRekeyFailure", last_off));
16109 break;
16110 }
16111 }
16112 WowlanTriggersAttrs::EapIdentRequest(val) => {
16113 if last_off == offset {
16114 stack.push(("EapIdentRequest", last_off));
16115 break;
16116 }
16117 }
16118 WowlanTriggersAttrs::_4wayHandshake(val) => {
16119 if last_off == offset {
16120 stack.push(("4wayHandshake", last_off));
16121 break;
16122 }
16123 }
16124 WowlanTriggersAttrs::RfkillRelease(val) => {
16125 if last_off == offset {
16126 stack.push(("RfkillRelease", last_off));
16127 break;
16128 }
16129 }
16130 WowlanTriggersAttrs::WakeupPkt80211(val) => {
16131 if last_off == offset {
16132 stack.push(("WakeupPkt80211", last_off));
16133 break;
16134 }
16135 }
16136 WowlanTriggersAttrs::WakeupPkt80211Len(val) => {
16137 if last_off == offset {
16138 stack.push(("WakeupPkt80211Len", last_off));
16139 break;
16140 }
16141 }
16142 WowlanTriggersAttrs::WakeupPkt8023(val) => {
16143 if last_off == offset {
16144 stack.push(("WakeupPkt8023", last_off));
16145 break;
16146 }
16147 }
16148 WowlanTriggersAttrs::WakeupPkt8023Len(val) => {
16149 if last_off == offset {
16150 stack.push(("WakeupPkt8023Len", last_off));
16151 break;
16152 }
16153 }
16154 WowlanTriggersAttrs::TcpConnection(val) => {
16155 if last_off == offset {
16156 stack.push(("TcpConnection", last_off));
16157 break;
16158 }
16159 }
16160 WowlanTriggersAttrs::WakeupTcpMatch(val) => {
16161 if last_off == offset {
16162 stack.push(("WakeupTcpMatch", last_off));
16163 break;
16164 }
16165 }
16166 WowlanTriggersAttrs::WakeupTcpConnlost(val) => {
16167 if last_off == offset {
16168 stack.push(("WakeupTcpConnlost", last_off));
16169 break;
16170 }
16171 }
16172 WowlanTriggersAttrs::WakeupTcpNomoretokens(val) => {
16173 if last_off == offset {
16174 stack.push(("WakeupTcpNomoretokens", last_off));
16175 break;
16176 }
16177 }
16178 WowlanTriggersAttrs::NetDetect(val) => {
16179 if last_off == offset {
16180 stack.push(("NetDetect", last_off));
16181 break;
16182 }
16183 }
16184 WowlanTriggersAttrs::NetDetectResults(val) => {
16185 if last_off == offset {
16186 stack.push(("NetDetectResults", last_off));
16187 break;
16188 }
16189 }
16190 WowlanTriggersAttrs::UnprotectedDeauthDisassoc(val) => {
16191 if last_off == offset {
16192 stack.push(("UnprotectedDeauthDisassoc", last_off));
16193 break;
16194 }
16195 }
16196 _ => {}
16197 };
16198 last_off = cur + attrs.pos;
16199 }
16200 if !stack.is_empty() {
16201 stack.push(("WowlanTriggersAttrs", cur));
16202 }
16203 (stack, None)
16204 }
16205}
16206pub struct PushNl80211Attrs<Prev: Rec> {
16207 pub(crate) prev: Option<Prev>,
16208 pub(crate) header_offset: Option<usize>,
16209}
16210impl<Prev: Rec> Rec for PushNl80211Attrs<Prev> {
16211 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
16212 self.prev.as_mut().unwrap().as_rec_mut()
16213 }
16214}
16215pub struct PushArrayU32<Prev: Rec> {
16216 pub(crate) prev: Option<Prev>,
16217 pub(crate) header_offset: Option<usize>,
16218 pub(crate) counter: u16,
16219}
16220impl<Prev: Rec> Rec for PushArrayU32<Prev> {
16221 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
16222 self.prev.as_mut().unwrap().as_rec_mut()
16223 }
16224}
16225impl<Prev: Rec> PushArrayU32<Prev> {
16226 pub fn new(prev: Prev) -> Self {
16227 Self {
16228 prev: Some(prev),
16229 header_offset: None,
16230 counter: 0,
16231 }
16232 }
16233 pub fn end_array(mut self) -> Prev {
16234 let mut prev = self.prev.take().unwrap();
16235 if let Some(header_offset) = &self.header_offset {
16236 finalize_nested_header(prev.as_rec_mut(), *header_offset);
16237 }
16238 prev
16239 }
16240 pub fn entry(mut self, value: u32) -> Self {
16241 let index = self.counter;
16242 self.counter += 1;
16243 push_header(self.as_rec_mut(), index, 4 as u16);
16244 self.as_rec_mut().extend(value.to_ne_bytes());
16245 self
16246 }
16247}
16248impl<Prev: Rec> Drop for PushArrayU32<Prev> {
16249 fn drop(&mut self) {
16250 if let Some(prev) = &mut self.prev {
16251 if let Some(header_offset) = &self.header_offset {
16252 finalize_nested_header(prev.as_rec_mut(), *header_offset);
16253 }
16254 }
16255 }
16256}
16257pub struct PushArrayIfCombinationAttributes<Prev: Rec> {
16258 pub(crate) prev: Option<Prev>,
16259 pub(crate) header_offset: Option<usize>,
16260 pub(crate) counter: u16,
16261}
16262impl<Prev: Rec> Rec for PushArrayIfCombinationAttributes<Prev> {
16263 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
16264 self.prev.as_mut().unwrap().as_rec_mut()
16265 }
16266}
16267impl<Prev: Rec> PushArrayIfCombinationAttributes<Prev> {
16268 pub fn new(prev: Prev) -> Self {
16269 Self {
16270 prev: Some(prev),
16271 header_offset: None,
16272 counter: 0,
16273 }
16274 }
16275 pub fn end_array(mut self) -> Prev {
16276 let mut prev = self.prev.take().unwrap();
16277 if let Some(header_offset) = &self.header_offset {
16278 finalize_nested_header(prev.as_rec_mut(), *header_offset);
16279 }
16280 prev
16281 }
16282 pub fn entry_nested(mut self) -> PushIfCombinationAttributes<Self> {
16283 let index = self.counter;
16284 self.counter += 1;
16285 let header_offset = push_nested_header(self.as_rec_mut(), index);
16286 PushIfCombinationAttributes {
16287 prev: Some(self),
16288 header_offset: Some(header_offset),
16289 }
16290 }
16291}
16292impl<Prev: Rec> Drop for PushArrayIfCombinationAttributes<Prev> {
16293 fn drop(&mut self) {
16294 if let Some(prev) = &mut self.prev {
16295 if let Some(header_offset) = &self.header_offset {
16296 finalize_nested_header(prev.as_rec_mut(), *header_offset);
16297 }
16298 }
16299 }
16300}
16301impl<Prev: Rec> PushNl80211Attrs<Prev> {
16302 pub fn new(prev: Prev) -> Self {
16303 Self {
16304 prev: Some(prev),
16305 header_offset: None,
16306 }
16307 }
16308 pub fn end_nested(mut self) -> Prev {
16309 let mut prev = self.prev.take().unwrap();
16310 if let Some(header_offset) = &self.header_offset {
16311 finalize_nested_header(prev.as_rec_mut(), *header_offset);
16312 }
16313 prev
16314 }
16315 pub fn push_wiphy(mut self, value: u32) -> Self {
16316 push_header(self.as_rec_mut(), 1u16, 4 as u16);
16317 self.as_rec_mut().extend(value.to_ne_bytes());
16318 self
16319 }
16320 pub fn push_wiphy_name(mut self, value: &CStr) -> Self {
16321 push_header(
16322 self.as_rec_mut(),
16323 2u16,
16324 value.to_bytes_with_nul().len() as u16,
16325 );
16326 self.as_rec_mut().extend(value.to_bytes_with_nul());
16327 self
16328 }
16329 pub fn push_wiphy_name_bytes(mut self, value: &[u8]) -> Self {
16330 push_header(self.as_rec_mut(), 2u16, (value.len() + 1) as u16);
16331 self.as_rec_mut().extend(value);
16332 self.as_rec_mut().push(0);
16333 self
16334 }
16335 pub fn push_ifindex(mut self, value: u32) -> Self {
16336 push_header(self.as_rec_mut(), 3u16, 4 as u16);
16337 self.as_rec_mut().extend(value.to_ne_bytes());
16338 self
16339 }
16340 pub fn push_ifname(mut self, value: &CStr) -> Self {
16341 push_header(
16342 self.as_rec_mut(),
16343 4u16,
16344 value.to_bytes_with_nul().len() as u16,
16345 );
16346 self.as_rec_mut().extend(value.to_bytes_with_nul());
16347 self
16348 }
16349 pub fn push_ifname_bytes(mut self, value: &[u8]) -> Self {
16350 push_header(self.as_rec_mut(), 4u16, (value.len() + 1) as u16);
16351 self.as_rec_mut().extend(value);
16352 self.as_rec_mut().push(0);
16353 self
16354 }
16355 pub fn push_iftype(mut self, value: u32) -> Self {
16356 push_header(self.as_rec_mut(), 5u16, 4 as u16);
16357 self.as_rec_mut().extend(value.to_ne_bytes());
16358 self
16359 }
16360 pub fn push_mac(mut self, value: &[u8]) -> Self {
16361 push_header(self.as_rec_mut(), 6u16, value.len() as u16);
16362 self.as_rec_mut().extend(value);
16363 self
16364 }
16365 pub fn push_key_data(mut self, value: &[u8]) -> Self {
16366 push_header(self.as_rec_mut(), 7u16, value.len() as u16);
16367 self.as_rec_mut().extend(value);
16368 self
16369 }
16370 pub fn push_key_idx(mut self, value: u8) -> Self {
16371 push_header(self.as_rec_mut(), 8u16, 1 as u16);
16372 self.as_rec_mut().extend(value.to_ne_bytes());
16373 self
16374 }
16375 pub fn push_key_cipher(mut self, value: u32) -> Self {
16376 push_header(self.as_rec_mut(), 9u16, 4 as u16);
16377 self.as_rec_mut().extend(value.to_ne_bytes());
16378 self
16379 }
16380 pub fn push_key_seq(mut self, value: &[u8]) -> Self {
16381 push_header(self.as_rec_mut(), 10u16, value.len() as u16);
16382 self.as_rec_mut().extend(value);
16383 self
16384 }
16385 pub fn push_key_default(mut self, value: ()) -> Self {
16386 push_header(self.as_rec_mut(), 11u16, 0 as u16);
16387 self
16388 }
16389 pub fn push_beacon_interval(mut self, value: u32) -> Self {
16390 push_header(self.as_rec_mut(), 12u16, 4 as u16);
16391 self.as_rec_mut().extend(value.to_ne_bytes());
16392 self
16393 }
16394 pub fn push_dtim_period(mut self, value: u32) -> Self {
16395 push_header(self.as_rec_mut(), 13u16, 4 as u16);
16396 self.as_rec_mut().extend(value.to_ne_bytes());
16397 self
16398 }
16399 pub fn push_beacon_head(mut self, value: &[u8]) -> Self {
16400 push_header(self.as_rec_mut(), 14u16, value.len() as u16);
16401 self.as_rec_mut().extend(value);
16402 self
16403 }
16404 pub fn push_beacon_tail(mut self, value: &[u8]) -> Self {
16405 push_header(self.as_rec_mut(), 15u16, value.len() as u16);
16406 self.as_rec_mut().extend(value);
16407 self
16408 }
16409 pub fn push_sta_aid(mut self, value: u16) -> Self {
16410 push_header(self.as_rec_mut(), 16u16, 2 as u16);
16411 self.as_rec_mut().extend(value.to_ne_bytes());
16412 self
16413 }
16414 pub fn push_sta_flags(mut self, value: &[u8]) -> Self {
16415 push_header(self.as_rec_mut(), 17u16, value.len() as u16);
16416 self.as_rec_mut().extend(value);
16417 self
16418 }
16419 pub fn push_sta_listen_interval(mut self, value: u16) -> Self {
16420 push_header(self.as_rec_mut(), 18u16, 2 as u16);
16421 self.as_rec_mut().extend(value.to_ne_bytes());
16422 self
16423 }
16424 pub fn push_sta_supported_rates(mut self, value: &[u8]) -> Self {
16425 push_header(self.as_rec_mut(), 19u16, value.len() as u16);
16426 self.as_rec_mut().extend(value);
16427 self
16428 }
16429 pub fn push_sta_vlan(mut self, value: u32) -> Self {
16430 push_header(self.as_rec_mut(), 20u16, 4 as u16);
16431 self.as_rec_mut().extend(value.to_ne_bytes());
16432 self
16433 }
16434 pub fn push_sta_info(mut self, value: &[u8]) -> Self {
16435 push_header(self.as_rec_mut(), 21u16, value.len() as u16);
16436 self.as_rec_mut().extend(value);
16437 self
16438 }
16439 pub fn nested_wiphy_bands(mut self) -> PushWiphyBands<Self> {
16440 let header_offset = push_nested_header(self.as_rec_mut(), 22u16);
16441 PushWiphyBands {
16442 prev: Some(self),
16443 header_offset: Some(header_offset),
16444 }
16445 }
16446 pub fn push_mntr_flags(mut self, value: &[u8]) -> Self {
16447 push_header(self.as_rec_mut(), 23u16, value.len() as u16);
16448 self.as_rec_mut().extend(value);
16449 self
16450 }
16451 pub fn push_mesh_id(mut self, value: &[u8]) -> Self {
16452 push_header(self.as_rec_mut(), 24u16, value.len() as u16);
16453 self.as_rec_mut().extend(value);
16454 self
16455 }
16456 pub fn push_sta_plink_action(mut self, value: u8) -> Self {
16457 push_header(self.as_rec_mut(), 25u16, 1 as u16);
16458 self.as_rec_mut().extend(value.to_ne_bytes());
16459 self
16460 }
16461 pub fn push_mpath_next_hop(mut self, value: &[u8]) -> Self {
16462 push_header(self.as_rec_mut(), 26u16, value.len() as u16);
16463 self.as_rec_mut().extend(value);
16464 self
16465 }
16466 pub fn push_mpath_info(mut self, value: &[u8]) -> Self {
16467 push_header(self.as_rec_mut(), 27u16, value.len() as u16);
16468 self.as_rec_mut().extend(value);
16469 self
16470 }
16471 pub fn push_bss_cts_prot(mut self, value: u8) -> Self {
16472 push_header(self.as_rec_mut(), 28u16, 1 as u16);
16473 self.as_rec_mut().extend(value.to_ne_bytes());
16474 self
16475 }
16476 pub fn push_bss_short_preamble(mut self, value: u8) -> Self {
16477 push_header(self.as_rec_mut(), 29u16, 1 as u16);
16478 self.as_rec_mut().extend(value.to_ne_bytes());
16479 self
16480 }
16481 pub fn push_bss_short_slot_time(mut self, value: u8) -> Self {
16482 push_header(self.as_rec_mut(), 30u16, 1 as u16);
16483 self.as_rec_mut().extend(value.to_ne_bytes());
16484 self
16485 }
16486 pub fn push_ht_capability(mut self, value: &[u8]) -> Self {
16487 push_header(self.as_rec_mut(), 31u16, value.len() as u16);
16488 self.as_rec_mut().extend(value);
16489 self
16490 }
16491 pub fn nested_supported_iftypes(mut self) -> PushSupportedIftypes<Self> {
16492 let header_offset = push_nested_header(self.as_rec_mut(), 32u16);
16493 PushSupportedIftypes {
16494 prev: Some(self),
16495 header_offset: Some(header_offset),
16496 }
16497 }
16498 pub fn push_reg_alpha2(mut self, value: &[u8]) -> Self {
16499 push_header(self.as_rec_mut(), 33u16, value.len() as u16);
16500 self.as_rec_mut().extend(value);
16501 self
16502 }
16503 pub fn push_reg_rules(mut self, value: &[u8]) -> Self {
16504 push_header(self.as_rec_mut(), 34u16, value.len() as u16);
16505 self.as_rec_mut().extend(value);
16506 self
16507 }
16508 pub fn push_mesh_config(mut self, value: &[u8]) -> Self {
16509 push_header(self.as_rec_mut(), 35u16, value.len() as u16);
16510 self.as_rec_mut().extend(value);
16511 self
16512 }
16513 pub fn push_bss_basic_rates(mut self, value: &[u8]) -> Self {
16514 push_header(self.as_rec_mut(), 36u16, value.len() as u16);
16515 self.as_rec_mut().extend(value);
16516 self
16517 }
16518 pub fn push_wiphy_txq_params(mut self, value: &[u8]) -> Self {
16519 push_header(self.as_rec_mut(), 37u16, value.len() as u16);
16520 self.as_rec_mut().extend(value);
16521 self
16522 }
16523 pub fn push_wiphy_freq(mut self, value: u32) -> Self {
16524 push_header(self.as_rec_mut(), 38u16, 4 as u16);
16525 self.as_rec_mut().extend(value.to_ne_bytes());
16526 self
16527 }
16528 #[doc = "Associated type: \"ChannelType\" (enum)"]
16529 pub fn push_wiphy_channel_type(mut self, value: u32) -> Self {
16530 push_header(self.as_rec_mut(), 39u16, 4 as u16);
16531 self.as_rec_mut().extend(value.to_ne_bytes());
16532 self
16533 }
16534 pub fn push_key_default_mgmt(mut self, value: ()) -> Self {
16535 push_header(self.as_rec_mut(), 40u16, 0 as u16);
16536 self
16537 }
16538 pub fn push_mgmt_subtype(mut self, value: u8) -> Self {
16539 push_header(self.as_rec_mut(), 41u16, 1 as u16);
16540 self.as_rec_mut().extend(value.to_ne_bytes());
16541 self
16542 }
16543 pub fn push_ie(mut self, value: &[u8]) -> Self {
16544 push_header(self.as_rec_mut(), 42u16, value.len() as u16);
16545 self.as_rec_mut().extend(value);
16546 self
16547 }
16548 pub fn push_max_num_scan_ssids(mut self, value: u8) -> Self {
16549 push_header(self.as_rec_mut(), 43u16, 1 as u16);
16550 self.as_rec_mut().extend(value.to_ne_bytes());
16551 self
16552 }
16553 pub fn push_scan_frequencies(mut self, value: &[u8]) -> Self {
16554 push_header(self.as_rec_mut(), 44u16, value.len() as u16);
16555 self.as_rec_mut().extend(value);
16556 self
16557 }
16558 pub fn push_scan_ssids(mut self, value: &[u8]) -> Self {
16559 push_header(self.as_rec_mut(), 45u16, value.len() as u16);
16560 self.as_rec_mut().extend(value);
16561 self
16562 }
16563 pub fn push_generation(mut self, value: u32) -> Self {
16564 push_header(self.as_rec_mut(), 46u16, 4 as u16);
16565 self.as_rec_mut().extend(value.to_ne_bytes());
16566 self
16567 }
16568 pub fn push_bss(mut self, value: &[u8]) -> Self {
16569 push_header(self.as_rec_mut(), 47u16, value.len() as u16);
16570 self.as_rec_mut().extend(value);
16571 self
16572 }
16573 pub fn push_reg_initiator(mut self, value: u8) -> Self {
16574 push_header(self.as_rec_mut(), 48u16, 1 as u16);
16575 self.as_rec_mut().extend(value.to_ne_bytes());
16576 self
16577 }
16578 pub fn push_reg_type(mut self, value: u8) -> Self {
16579 push_header(self.as_rec_mut(), 49u16, 1 as u16);
16580 self.as_rec_mut().extend(value.to_ne_bytes());
16581 self
16582 }
16583 #[doc = "Associated type: \"Commands\" (enum)"]
16584 pub fn array_supported_commands(mut self) -> PushArrayU32<Self> {
16585 let header_offset = push_nested_header(self.as_rec_mut(), 50u16);
16586 PushArrayU32 {
16587 prev: Some(self),
16588 header_offset: Some(header_offset),
16589 counter: 0,
16590 }
16591 }
16592 pub fn push_frame(mut self, value: &[u8]) -> Self {
16593 push_header(self.as_rec_mut(), 51u16, value.len() as u16);
16594 self.as_rec_mut().extend(value);
16595 self
16596 }
16597 pub fn push_ssid(mut self, value: &[u8]) -> Self {
16598 push_header(self.as_rec_mut(), 52u16, value.len() as u16);
16599 self.as_rec_mut().extend(value);
16600 self
16601 }
16602 pub fn push_auth_type(mut self, value: u32) -> Self {
16603 push_header(self.as_rec_mut(), 53u16, 4 as u16);
16604 self.as_rec_mut().extend(value.to_ne_bytes());
16605 self
16606 }
16607 pub fn push_reason_code(mut self, value: u16) -> Self {
16608 push_header(self.as_rec_mut(), 54u16, 2 as u16);
16609 self.as_rec_mut().extend(value.to_ne_bytes());
16610 self
16611 }
16612 pub fn push_key_type(mut self, value: u32) -> Self {
16613 push_header(self.as_rec_mut(), 55u16, 4 as u16);
16614 self.as_rec_mut().extend(value.to_ne_bytes());
16615 self
16616 }
16617 pub fn push_max_scan_ie_len(mut self, value: u16) -> Self {
16618 push_header(self.as_rec_mut(), 56u16, 2 as u16);
16619 self.as_rec_mut().extend(value.to_ne_bytes());
16620 self
16621 }
16622 pub fn push_cipher_suites(mut self, value: &[u8]) -> Self {
16623 push_header(self.as_rec_mut(), 57u16, value.len() as u16);
16624 self.as_rec_mut().extend(value);
16625 self
16626 }
16627 pub fn push_freq_before(mut self, value: &[u8]) -> Self {
16628 push_header(self.as_rec_mut(), 58u16, value.len() as u16);
16629 self.as_rec_mut().extend(value);
16630 self
16631 }
16632 pub fn push_freq_after(mut self, value: &[u8]) -> Self {
16633 push_header(self.as_rec_mut(), 59u16, value.len() as u16);
16634 self.as_rec_mut().extend(value);
16635 self
16636 }
16637 pub fn push_freq_fixed(mut self, value: ()) -> Self {
16638 push_header(self.as_rec_mut(), 60u16, 0 as u16);
16639 self
16640 }
16641 pub fn push_wiphy_retry_short(mut self, value: u8) -> Self {
16642 push_header(self.as_rec_mut(), 61u16, 1 as u16);
16643 self.as_rec_mut().extend(value.to_ne_bytes());
16644 self
16645 }
16646 pub fn push_wiphy_retry_long(mut self, value: u8) -> Self {
16647 push_header(self.as_rec_mut(), 62u16, 1 as u16);
16648 self.as_rec_mut().extend(value.to_ne_bytes());
16649 self
16650 }
16651 pub fn push_wiphy_frag_threshold(mut self, value: u32) -> Self {
16652 push_header(self.as_rec_mut(), 63u16, 4 as u16);
16653 self.as_rec_mut().extend(value.to_ne_bytes());
16654 self
16655 }
16656 pub fn push_wiphy_rts_threshold(mut self, value: u32) -> Self {
16657 push_header(self.as_rec_mut(), 64u16, 4 as u16);
16658 self.as_rec_mut().extend(value.to_ne_bytes());
16659 self
16660 }
16661 pub fn push_timed_out(mut self, value: ()) -> Self {
16662 push_header(self.as_rec_mut(), 65u16, 0 as u16);
16663 self
16664 }
16665 pub fn push_use_mfp(mut self, value: u32) -> Self {
16666 push_header(self.as_rec_mut(), 66u16, 4 as u16);
16667 self.as_rec_mut().extend(value.to_ne_bytes());
16668 self
16669 }
16670 pub fn push_sta_flags2(mut self, value: PushStaFlagUpdate) -> Self {
16671 push_header(self.as_rec_mut(), 67u16, value.as_slice().len() as u16);
16672 self.as_rec_mut().extend(value.as_slice());
16673 self
16674 }
16675 pub fn push_control_port(mut self, value: ()) -> Self {
16676 push_header(self.as_rec_mut(), 68u16, 0 as u16);
16677 self
16678 }
16679 pub fn push_testdata(mut self, value: &[u8]) -> Self {
16680 push_header(self.as_rec_mut(), 69u16, value.len() as u16);
16681 self.as_rec_mut().extend(value);
16682 self
16683 }
16684 pub fn push_privacy(mut self, value: ()) -> Self {
16685 push_header(self.as_rec_mut(), 70u16, 0 as u16);
16686 self
16687 }
16688 pub fn push_disconnected_by_ap(mut self, value: ()) -> Self {
16689 push_header(self.as_rec_mut(), 71u16, 0 as u16);
16690 self
16691 }
16692 pub fn push_status_code(mut self, value: u16) -> Self {
16693 push_header(self.as_rec_mut(), 72u16, 2 as u16);
16694 self.as_rec_mut().extend(value.to_ne_bytes());
16695 self
16696 }
16697 pub fn push_cipher_suites_pairwise(mut self, value: &[u8]) -> Self {
16698 push_header(self.as_rec_mut(), 73u16, value.len() as u16);
16699 self.as_rec_mut().extend(value);
16700 self
16701 }
16702 pub fn push_cipher_suite_group(mut self, value: u32) -> Self {
16703 push_header(self.as_rec_mut(), 74u16, 4 as u16);
16704 self.as_rec_mut().extend(value.to_ne_bytes());
16705 self
16706 }
16707 pub fn push_wpa_versions(mut self, value: u32) -> Self {
16708 push_header(self.as_rec_mut(), 75u16, 4 as u16);
16709 self.as_rec_mut().extend(value.to_ne_bytes());
16710 self
16711 }
16712 pub fn push_akm_suites(mut self, value: &[u8]) -> Self {
16713 push_header(self.as_rec_mut(), 76u16, value.len() as u16);
16714 self.as_rec_mut().extend(value);
16715 self
16716 }
16717 pub fn push_req_ie(mut self, value: &[u8]) -> Self {
16718 push_header(self.as_rec_mut(), 77u16, value.len() as u16);
16719 self.as_rec_mut().extend(value);
16720 self
16721 }
16722 pub fn push_resp_ie(mut self, value: &[u8]) -> Self {
16723 push_header(self.as_rec_mut(), 78u16, value.len() as u16);
16724 self.as_rec_mut().extend(value);
16725 self
16726 }
16727 pub fn push_prev_bssid(mut self, value: &[u8]) -> Self {
16728 push_header(self.as_rec_mut(), 79u16, value.len() as u16);
16729 self.as_rec_mut().extend(value);
16730 self
16731 }
16732 pub fn push_key(mut self, value: &[u8]) -> Self {
16733 push_header(self.as_rec_mut(), 80u16, value.len() as u16);
16734 self.as_rec_mut().extend(value);
16735 self
16736 }
16737 pub fn push_keys(mut self, value: &[u8]) -> Self {
16738 push_header(self.as_rec_mut(), 81u16, value.len() as u16);
16739 self.as_rec_mut().extend(value);
16740 self
16741 }
16742 pub fn push_pid(mut self, value: u32) -> Self {
16743 push_header(self.as_rec_mut(), 82u16, 4 as u16);
16744 self.as_rec_mut().extend(value.to_ne_bytes());
16745 self
16746 }
16747 pub fn push_4addr(mut self, value: u8) -> Self {
16748 push_header(self.as_rec_mut(), 83u16, 1 as u16);
16749 self.as_rec_mut().extend(value.to_ne_bytes());
16750 self
16751 }
16752 pub fn push_survey_info(mut self, value: &[u8]) -> Self {
16753 push_header(self.as_rec_mut(), 84u16, value.len() as u16);
16754 self.as_rec_mut().extend(value);
16755 self
16756 }
16757 pub fn push_pmkid(mut self, value: &[u8]) -> Self {
16758 push_header(self.as_rec_mut(), 85u16, value.len() as u16);
16759 self.as_rec_mut().extend(value);
16760 self
16761 }
16762 pub fn push_max_num_pmkids(mut self, value: u8) -> Self {
16763 push_header(self.as_rec_mut(), 86u16, 1 as u16);
16764 self.as_rec_mut().extend(value.to_ne_bytes());
16765 self
16766 }
16767 pub fn push_duration(mut self, value: u32) -> Self {
16768 push_header(self.as_rec_mut(), 87u16, 4 as u16);
16769 self.as_rec_mut().extend(value.to_ne_bytes());
16770 self
16771 }
16772 pub fn push_cookie(mut self, value: u64) -> Self {
16773 push_header(self.as_rec_mut(), 88u16, 8 as u16);
16774 self.as_rec_mut().extend(value.to_ne_bytes());
16775 self
16776 }
16777 pub fn push_wiphy_coverage_class(mut self, value: u8) -> Self {
16778 push_header(self.as_rec_mut(), 89u16, 1 as u16);
16779 self.as_rec_mut().extend(value.to_ne_bytes());
16780 self
16781 }
16782 pub fn push_tx_rates(mut self, value: &[u8]) -> Self {
16783 push_header(self.as_rec_mut(), 90u16, value.len() as u16);
16784 self.as_rec_mut().extend(value);
16785 self
16786 }
16787 pub fn push_frame_match(mut self, value: &[u8]) -> Self {
16788 push_header(self.as_rec_mut(), 91u16, value.len() as u16);
16789 self.as_rec_mut().extend(value);
16790 self
16791 }
16792 pub fn push_ack(mut self, value: ()) -> Self {
16793 push_header(self.as_rec_mut(), 92u16, 0 as u16);
16794 self
16795 }
16796 pub fn push_ps_state(mut self, value: u32) -> Self {
16797 push_header(self.as_rec_mut(), 93u16, 4 as u16);
16798 self.as_rec_mut().extend(value.to_ne_bytes());
16799 self
16800 }
16801 pub fn push_cqm(mut self, value: &[u8]) -> Self {
16802 push_header(self.as_rec_mut(), 94u16, value.len() as u16);
16803 self.as_rec_mut().extend(value);
16804 self
16805 }
16806 pub fn push_local_state_change(mut self, value: ()) -> Self {
16807 push_header(self.as_rec_mut(), 95u16, 0 as u16);
16808 self
16809 }
16810 pub fn push_ap_isolate(mut self, value: u8) -> Self {
16811 push_header(self.as_rec_mut(), 96u16, 1 as u16);
16812 self.as_rec_mut().extend(value.to_ne_bytes());
16813 self
16814 }
16815 pub fn push_wiphy_tx_power_setting(mut self, value: u32) -> Self {
16816 push_header(self.as_rec_mut(), 97u16, 4 as u16);
16817 self.as_rec_mut().extend(value.to_ne_bytes());
16818 self
16819 }
16820 pub fn push_wiphy_tx_power_level(mut self, value: u32) -> Self {
16821 push_header(self.as_rec_mut(), 98u16, 4 as u16);
16822 self.as_rec_mut().extend(value.to_ne_bytes());
16823 self
16824 }
16825 pub fn nested_tx_frame_types(mut self) -> PushIftypeAttrs<Self> {
16826 let header_offset = push_nested_header(self.as_rec_mut(), 99u16);
16827 PushIftypeAttrs {
16828 prev: Some(self),
16829 header_offset: Some(header_offset),
16830 }
16831 }
16832 pub fn nested_rx_frame_types(mut self) -> PushIftypeAttrs<Self> {
16833 let header_offset = push_nested_header(self.as_rec_mut(), 100u16);
16834 PushIftypeAttrs {
16835 prev: Some(self),
16836 header_offset: Some(header_offset),
16837 }
16838 }
16839 pub fn push_frame_type(mut self, value: u16) -> Self {
16840 push_header(self.as_rec_mut(), 101u16, 2 as u16);
16841 self.as_rec_mut().extend(value.to_ne_bytes());
16842 self
16843 }
16844 pub fn push_control_port_ethertype(mut self, value: ()) -> Self {
16845 push_header(self.as_rec_mut(), 102u16, 0 as u16);
16846 self
16847 }
16848 pub fn push_control_port_no_encrypt(mut self, value: ()) -> Self {
16849 push_header(self.as_rec_mut(), 103u16, 0 as u16);
16850 self
16851 }
16852 pub fn push_support_ibss_rsn(mut self, value: ()) -> Self {
16853 push_header(self.as_rec_mut(), 104u16, 0 as u16);
16854 self
16855 }
16856 pub fn push_wiphy_antenna_tx(mut self, value: u32) -> Self {
16857 push_header(self.as_rec_mut(), 105u16, 4 as u16);
16858 self.as_rec_mut().extend(value.to_ne_bytes());
16859 self
16860 }
16861 pub fn push_wiphy_antenna_rx(mut self, value: u32) -> Self {
16862 push_header(self.as_rec_mut(), 106u16, 4 as u16);
16863 self.as_rec_mut().extend(value.to_ne_bytes());
16864 self
16865 }
16866 pub fn push_mcast_rate(mut self, value: u32) -> Self {
16867 push_header(self.as_rec_mut(), 107u16, 4 as u16);
16868 self.as_rec_mut().extend(value.to_ne_bytes());
16869 self
16870 }
16871 pub fn push_offchannel_tx_ok(mut self, value: ()) -> Self {
16872 push_header(self.as_rec_mut(), 108u16, 0 as u16);
16873 self
16874 }
16875 pub fn push_bss_ht_opmode(mut self, value: u16) -> Self {
16876 push_header(self.as_rec_mut(), 109u16, 2 as u16);
16877 self.as_rec_mut().extend(value.to_ne_bytes());
16878 self
16879 }
16880 pub fn push_key_default_types(mut self, value: &[u8]) -> Self {
16881 push_header(self.as_rec_mut(), 110u16, value.len() as u16);
16882 self.as_rec_mut().extend(value);
16883 self
16884 }
16885 pub fn push_max_remain_on_channel_duration(mut self, value: u32) -> Self {
16886 push_header(self.as_rec_mut(), 111u16, 4 as u16);
16887 self.as_rec_mut().extend(value.to_ne_bytes());
16888 self
16889 }
16890 pub fn push_mesh_setup(mut self, value: &[u8]) -> Self {
16891 push_header(self.as_rec_mut(), 112u16, value.len() as u16);
16892 self.as_rec_mut().extend(value);
16893 self
16894 }
16895 pub fn push_wiphy_antenna_avail_tx(mut self, value: u32) -> Self {
16896 push_header(self.as_rec_mut(), 113u16, 4 as u16);
16897 self.as_rec_mut().extend(value.to_ne_bytes());
16898 self
16899 }
16900 pub fn push_wiphy_antenna_avail_rx(mut self, value: u32) -> Self {
16901 push_header(self.as_rec_mut(), 114u16, 4 as u16);
16902 self.as_rec_mut().extend(value.to_ne_bytes());
16903 self
16904 }
16905 pub fn push_support_mesh_auth(mut self, value: ()) -> Self {
16906 push_header(self.as_rec_mut(), 115u16, 0 as u16);
16907 self
16908 }
16909 pub fn push_sta_plink_state(mut self, value: u8) -> Self {
16910 push_header(self.as_rec_mut(), 116u16, 1 as u16);
16911 self.as_rec_mut().extend(value.to_ne_bytes());
16912 self
16913 }
16914 pub fn push_wowlan_triggers(mut self, value: &[u8]) -> Self {
16915 push_header(self.as_rec_mut(), 117u16, value.len() as u16);
16916 self.as_rec_mut().extend(value);
16917 self
16918 }
16919 pub fn nested_wowlan_triggers_supported(mut self) -> PushWowlanTriggersAttrs<Self> {
16920 let header_offset = push_nested_header(self.as_rec_mut(), 118u16);
16921 PushWowlanTriggersAttrs {
16922 prev: Some(self),
16923 header_offset: Some(header_offset),
16924 }
16925 }
16926 pub fn push_sched_scan_interval(mut self, value: u32) -> Self {
16927 push_header(self.as_rec_mut(), 119u16, 4 as u16);
16928 self.as_rec_mut().extend(value.to_ne_bytes());
16929 self
16930 }
16931 pub fn array_interface_combinations(mut self) -> PushArrayIfCombinationAttributes<Self> {
16932 let header_offset = push_nested_header(self.as_rec_mut(), 120u16);
16933 PushArrayIfCombinationAttributes {
16934 prev: Some(self),
16935 header_offset: Some(header_offset),
16936 counter: 0,
16937 }
16938 }
16939 pub fn nested_software_iftypes(mut self) -> PushSupportedIftypes<Self> {
16940 let header_offset = push_nested_header(self.as_rec_mut(), 121u16);
16941 PushSupportedIftypes {
16942 prev: Some(self),
16943 header_offset: Some(header_offset),
16944 }
16945 }
16946 pub fn push_rekey_data(mut self, value: &[u8]) -> Self {
16947 push_header(self.as_rec_mut(), 122u16, value.len() as u16);
16948 self.as_rec_mut().extend(value);
16949 self
16950 }
16951 pub fn push_max_num_sched_scan_ssids(mut self, value: u8) -> Self {
16952 push_header(self.as_rec_mut(), 123u16, 1 as u16);
16953 self.as_rec_mut().extend(value.to_ne_bytes());
16954 self
16955 }
16956 pub fn push_max_sched_scan_ie_len(mut self, value: u16) -> Self {
16957 push_header(self.as_rec_mut(), 124u16, 2 as u16);
16958 self.as_rec_mut().extend(value.to_ne_bytes());
16959 self
16960 }
16961 pub fn push_scan_supp_rates(mut self, value: &[u8]) -> Self {
16962 push_header(self.as_rec_mut(), 125u16, value.len() as u16);
16963 self.as_rec_mut().extend(value);
16964 self
16965 }
16966 pub fn push_hidden_ssid(mut self, value: u32) -> Self {
16967 push_header(self.as_rec_mut(), 126u16, 4 as u16);
16968 self.as_rec_mut().extend(value.to_ne_bytes());
16969 self
16970 }
16971 pub fn push_ie_probe_resp(mut self, value: &[u8]) -> Self {
16972 push_header(self.as_rec_mut(), 127u16, value.len() as u16);
16973 self.as_rec_mut().extend(value);
16974 self
16975 }
16976 pub fn push_ie_assoc_resp(mut self, value: &[u8]) -> Self {
16977 push_header(self.as_rec_mut(), 128u16, value.len() as u16);
16978 self.as_rec_mut().extend(value);
16979 self
16980 }
16981 pub fn push_sta_wme(mut self, value: &[u8]) -> Self {
16982 push_header(self.as_rec_mut(), 129u16, value.len() as u16);
16983 self.as_rec_mut().extend(value);
16984 self
16985 }
16986 pub fn push_support_ap_uapsd(mut self, value: ()) -> Self {
16987 push_header(self.as_rec_mut(), 130u16, 0 as u16);
16988 self
16989 }
16990 pub fn push_roam_support(mut self, value: ()) -> Self {
16991 push_header(self.as_rec_mut(), 131u16, 0 as u16);
16992 self
16993 }
16994 pub fn push_sched_scan_match(mut self, value: &[u8]) -> Self {
16995 push_header(self.as_rec_mut(), 132u16, value.len() as u16);
16996 self.as_rec_mut().extend(value);
16997 self
16998 }
16999 pub fn push_max_match_sets(mut self, value: u8) -> Self {
17000 push_header(self.as_rec_mut(), 133u16, 1 as u16);
17001 self.as_rec_mut().extend(value.to_ne_bytes());
17002 self
17003 }
17004 pub fn push_pmksa_candidate(mut self, value: &[u8]) -> Self {
17005 push_header(self.as_rec_mut(), 134u16, value.len() as u16);
17006 self.as_rec_mut().extend(value);
17007 self
17008 }
17009 pub fn push_tx_no_cck_rate(mut self, value: ()) -> Self {
17010 push_header(self.as_rec_mut(), 135u16, 0 as u16);
17011 self
17012 }
17013 pub fn push_tdls_action(mut self, value: u8) -> Self {
17014 push_header(self.as_rec_mut(), 136u16, 1 as u16);
17015 self.as_rec_mut().extend(value.to_ne_bytes());
17016 self
17017 }
17018 pub fn push_tdls_dialog_token(mut self, value: u8) -> Self {
17019 push_header(self.as_rec_mut(), 137u16, 1 as u16);
17020 self.as_rec_mut().extend(value.to_ne_bytes());
17021 self
17022 }
17023 pub fn push_tdls_operation(mut self, value: u8) -> Self {
17024 push_header(self.as_rec_mut(), 138u16, 1 as u16);
17025 self.as_rec_mut().extend(value.to_ne_bytes());
17026 self
17027 }
17028 pub fn push_tdls_support(mut self, value: ()) -> Self {
17029 push_header(self.as_rec_mut(), 139u16, 0 as u16);
17030 self
17031 }
17032 pub fn push_tdls_external_setup(mut self, value: ()) -> Self {
17033 push_header(self.as_rec_mut(), 140u16, 0 as u16);
17034 self
17035 }
17036 pub fn push_device_ap_sme(mut self, value: u32) -> Self {
17037 push_header(self.as_rec_mut(), 141u16, 4 as u16);
17038 self.as_rec_mut().extend(value.to_ne_bytes());
17039 self
17040 }
17041 pub fn push_dont_wait_for_ack(mut self, value: ()) -> Self {
17042 push_header(self.as_rec_mut(), 142u16, 0 as u16);
17043 self
17044 }
17045 #[doc = "Associated type: \"FeatureFlags\" (1 bit per enumeration)"]
17046 pub fn push_feature_flags(mut self, value: u32) -> Self {
17047 push_header(self.as_rec_mut(), 143u16, 4 as u16);
17048 self.as_rec_mut().extend(value.to_ne_bytes());
17049 self
17050 }
17051 pub fn push_probe_resp_offload(mut self, value: u32) -> Self {
17052 push_header(self.as_rec_mut(), 144u16, 4 as u16);
17053 self.as_rec_mut().extend(value.to_ne_bytes());
17054 self
17055 }
17056 pub fn push_probe_resp(mut self, value: &[u8]) -> Self {
17057 push_header(self.as_rec_mut(), 145u16, value.len() as u16);
17058 self.as_rec_mut().extend(value);
17059 self
17060 }
17061 pub fn push_dfs_region(mut self, value: u8) -> Self {
17062 push_header(self.as_rec_mut(), 146u16, 1 as u16);
17063 self.as_rec_mut().extend(value.to_ne_bytes());
17064 self
17065 }
17066 pub fn push_disable_ht(mut self, value: ()) -> Self {
17067 push_header(self.as_rec_mut(), 147u16, 0 as u16);
17068 self
17069 }
17070 pub fn push_ht_capability_mask(mut self, value: &[u8]) -> Self {
17071 push_header(self.as_rec_mut(), 148u16, value.len() as u16);
17072 self.as_rec_mut().extend(value);
17073 self
17074 }
17075 pub fn push_noack_map(mut self, value: u16) -> Self {
17076 push_header(self.as_rec_mut(), 149u16, 2 as u16);
17077 self.as_rec_mut().extend(value.to_ne_bytes());
17078 self
17079 }
17080 pub fn push_inactivity_timeout(mut self, value: u16) -> Self {
17081 push_header(self.as_rec_mut(), 150u16, 2 as u16);
17082 self.as_rec_mut().extend(value.to_ne_bytes());
17083 self
17084 }
17085 pub fn push_rx_signal_dbm(mut self, value: u32) -> Self {
17086 push_header(self.as_rec_mut(), 151u16, 4 as u16);
17087 self.as_rec_mut().extend(value.to_ne_bytes());
17088 self
17089 }
17090 pub fn push_bg_scan_period(mut self, value: u16) -> Self {
17091 push_header(self.as_rec_mut(), 152u16, 2 as u16);
17092 self.as_rec_mut().extend(value.to_ne_bytes());
17093 self
17094 }
17095 pub fn push_wdev(mut self, value: u64) -> Self {
17096 push_header(self.as_rec_mut(), 153u16, 8 as u16);
17097 self.as_rec_mut().extend(value.to_ne_bytes());
17098 self
17099 }
17100 pub fn push_user_reg_hint_type(mut self, value: u32) -> Self {
17101 push_header(self.as_rec_mut(), 154u16, 4 as u16);
17102 self.as_rec_mut().extend(value.to_ne_bytes());
17103 self
17104 }
17105 pub fn push_conn_failed_reason(mut self, value: u32) -> Self {
17106 push_header(self.as_rec_mut(), 155u16, 4 as u16);
17107 self.as_rec_mut().extend(value.to_ne_bytes());
17108 self
17109 }
17110 pub fn push_auth_data(mut self, value: &[u8]) -> Self {
17111 push_header(self.as_rec_mut(), 156u16, value.len() as u16);
17112 self.as_rec_mut().extend(value);
17113 self
17114 }
17115 pub fn push_vht_capability(mut self, value: &[u8]) -> Self {
17116 push_header(self.as_rec_mut(), 157u16, value.len() as u16);
17117 self.as_rec_mut().extend(value);
17118 self
17119 }
17120 pub fn push_scan_flags(mut self, value: u32) -> Self {
17121 push_header(self.as_rec_mut(), 158u16, 4 as u16);
17122 self.as_rec_mut().extend(value.to_ne_bytes());
17123 self
17124 }
17125 pub fn push_channel_width(mut self, value: u32) -> Self {
17126 push_header(self.as_rec_mut(), 159u16, 4 as u16);
17127 self.as_rec_mut().extend(value.to_ne_bytes());
17128 self
17129 }
17130 pub fn push_center_freq1(mut self, value: u32) -> Self {
17131 push_header(self.as_rec_mut(), 160u16, 4 as u16);
17132 self.as_rec_mut().extend(value.to_ne_bytes());
17133 self
17134 }
17135 pub fn push_center_freq2(mut self, value: u32) -> Self {
17136 push_header(self.as_rec_mut(), 161u16, 4 as u16);
17137 self.as_rec_mut().extend(value.to_ne_bytes());
17138 self
17139 }
17140 pub fn push_p2p_ctwindow(mut self, value: u8) -> Self {
17141 push_header(self.as_rec_mut(), 162u16, 1 as u16);
17142 self.as_rec_mut().extend(value.to_ne_bytes());
17143 self
17144 }
17145 pub fn push_p2p_oppps(mut self, value: u8) -> Self {
17146 push_header(self.as_rec_mut(), 163u16, 1 as u16);
17147 self.as_rec_mut().extend(value.to_ne_bytes());
17148 self
17149 }
17150 pub fn push_local_mesh_power_mode(mut self, value: u32) -> Self {
17151 push_header(self.as_rec_mut(), 164u16, 4 as u16);
17152 self.as_rec_mut().extend(value.to_ne_bytes());
17153 self
17154 }
17155 pub fn push_acl_policy(mut self, value: u32) -> Self {
17156 push_header(self.as_rec_mut(), 165u16, 4 as u16);
17157 self.as_rec_mut().extend(value.to_ne_bytes());
17158 self
17159 }
17160 pub fn push_mac_addrs(mut self, value: &[u8]) -> Self {
17161 push_header(self.as_rec_mut(), 166u16, value.len() as u16);
17162 self.as_rec_mut().extend(value);
17163 self
17164 }
17165 pub fn push_mac_acl_max(mut self, value: u32) -> Self {
17166 push_header(self.as_rec_mut(), 167u16, 4 as u16);
17167 self.as_rec_mut().extend(value.to_ne_bytes());
17168 self
17169 }
17170 pub fn push_radar_event(mut self, value: u32) -> Self {
17171 push_header(self.as_rec_mut(), 168u16, 4 as u16);
17172 self.as_rec_mut().extend(value.to_ne_bytes());
17173 self
17174 }
17175 pub fn push_ext_capa(mut self, value: &[u8]) -> Self {
17176 push_header(self.as_rec_mut(), 169u16, value.len() as u16);
17177 self.as_rec_mut().extend(value);
17178 self
17179 }
17180 pub fn push_ext_capa_mask(mut self, value: &[u8]) -> Self {
17181 push_header(self.as_rec_mut(), 170u16, value.len() as u16);
17182 self.as_rec_mut().extend(value);
17183 self
17184 }
17185 pub fn push_sta_capability(mut self, value: u16) -> Self {
17186 push_header(self.as_rec_mut(), 171u16, 2 as u16);
17187 self.as_rec_mut().extend(value.to_ne_bytes());
17188 self
17189 }
17190 pub fn push_sta_ext_capability(mut self, value: &[u8]) -> Self {
17191 push_header(self.as_rec_mut(), 172u16, value.len() as u16);
17192 self.as_rec_mut().extend(value);
17193 self
17194 }
17195 #[doc = "Associated type: \"ProtocolFeatures\" (enum)"]
17196 pub fn push_protocol_features(mut self, value: u32) -> Self {
17197 push_header(self.as_rec_mut(), 173u16, 4 as u16);
17198 self.as_rec_mut().extend(value.to_ne_bytes());
17199 self
17200 }
17201 pub fn push_split_wiphy_dump(mut self, value: ()) -> Self {
17202 push_header(self.as_rec_mut(), 174u16, 0 as u16);
17203 self
17204 }
17205 pub fn push_disable_vht(mut self, value: ()) -> Self {
17206 push_header(self.as_rec_mut(), 175u16, 0 as u16);
17207 self
17208 }
17209 pub fn push_vht_capability_mask(mut self, value: &[u8]) -> Self {
17210 push_header(self.as_rec_mut(), 176u16, value.len() as u16);
17211 self.as_rec_mut().extend(value);
17212 self
17213 }
17214 pub fn push_mdid(mut self, value: u16) -> Self {
17215 push_header(self.as_rec_mut(), 177u16, 2 as u16);
17216 self.as_rec_mut().extend(value.to_ne_bytes());
17217 self
17218 }
17219 pub fn push_ie_ric(mut self, value: &[u8]) -> Self {
17220 push_header(self.as_rec_mut(), 178u16, value.len() as u16);
17221 self.as_rec_mut().extend(value);
17222 self
17223 }
17224 pub fn push_crit_prot_id(mut self, value: u16) -> Self {
17225 push_header(self.as_rec_mut(), 179u16, 2 as u16);
17226 self.as_rec_mut().extend(value.to_ne_bytes());
17227 self
17228 }
17229 pub fn push_max_crit_prot_duration(mut self, value: u16) -> Self {
17230 push_header(self.as_rec_mut(), 180u16, 2 as u16);
17231 self.as_rec_mut().extend(value.to_ne_bytes());
17232 self
17233 }
17234 pub fn push_peer_aid(mut self, value: u16) -> Self {
17235 push_header(self.as_rec_mut(), 181u16, 2 as u16);
17236 self.as_rec_mut().extend(value.to_ne_bytes());
17237 self
17238 }
17239 pub fn push_coalesce_rule(mut self, value: &[u8]) -> Self {
17240 push_header(self.as_rec_mut(), 182u16, value.len() as u16);
17241 self.as_rec_mut().extend(value);
17242 self
17243 }
17244 pub fn push_ch_switch_count(mut self, value: u32) -> Self {
17245 push_header(self.as_rec_mut(), 183u16, 4 as u16);
17246 self.as_rec_mut().extend(value.to_ne_bytes());
17247 self
17248 }
17249 pub fn push_ch_switch_block_tx(mut self, value: ()) -> Self {
17250 push_header(self.as_rec_mut(), 184u16, 0 as u16);
17251 self
17252 }
17253 pub fn push_csa_ies(mut self, value: &[u8]) -> Self {
17254 push_header(self.as_rec_mut(), 185u16, value.len() as u16);
17255 self.as_rec_mut().extend(value);
17256 self
17257 }
17258 pub fn push_cntdwn_offs_beacon(mut self, value: &[u8]) -> Self {
17259 push_header(self.as_rec_mut(), 186u16, value.len() as u16);
17260 self.as_rec_mut().extend(value);
17261 self
17262 }
17263 pub fn push_cntdwn_offs_presp(mut self, value: &[u8]) -> Self {
17264 push_header(self.as_rec_mut(), 187u16, value.len() as u16);
17265 self.as_rec_mut().extend(value);
17266 self
17267 }
17268 pub fn push_rxmgmt_flags(mut self, value: &[u8]) -> Self {
17269 push_header(self.as_rec_mut(), 188u16, value.len() as u16);
17270 self.as_rec_mut().extend(value);
17271 self
17272 }
17273 pub fn push_sta_supported_channels(mut self, value: &[u8]) -> Self {
17274 push_header(self.as_rec_mut(), 189u16, value.len() as u16);
17275 self.as_rec_mut().extend(value);
17276 self
17277 }
17278 pub fn push_sta_supported_oper_classes(mut self, value: &[u8]) -> Self {
17279 push_header(self.as_rec_mut(), 190u16, value.len() as u16);
17280 self.as_rec_mut().extend(value);
17281 self
17282 }
17283 pub fn push_handle_dfs(mut self, value: ()) -> Self {
17284 push_header(self.as_rec_mut(), 191u16, 0 as u16);
17285 self
17286 }
17287 pub fn push_support_5_mhz(mut self, value: ()) -> Self {
17288 push_header(self.as_rec_mut(), 192u16, 0 as u16);
17289 self
17290 }
17291 pub fn push_support_10_mhz(mut self, value: ()) -> Self {
17292 push_header(self.as_rec_mut(), 193u16, 0 as u16);
17293 self
17294 }
17295 pub fn push_opmode_notif(mut self, value: u8) -> Self {
17296 push_header(self.as_rec_mut(), 194u16, 1 as u16);
17297 self.as_rec_mut().extend(value.to_ne_bytes());
17298 self
17299 }
17300 pub fn push_vendor_id(mut self, value: u32) -> Self {
17301 push_header(self.as_rec_mut(), 195u16, 4 as u16);
17302 self.as_rec_mut().extend(value.to_ne_bytes());
17303 self
17304 }
17305 pub fn push_vendor_subcmd(mut self, value: u32) -> Self {
17306 push_header(self.as_rec_mut(), 196u16, 4 as u16);
17307 self.as_rec_mut().extend(value.to_ne_bytes());
17308 self
17309 }
17310 pub fn push_vendor_data(mut self, value: &[u8]) -> Self {
17311 push_header(self.as_rec_mut(), 197u16, value.len() as u16);
17312 self.as_rec_mut().extend(value);
17313 self
17314 }
17315 pub fn push_vendor_events(mut self, value: &[u8]) -> Self {
17316 push_header(self.as_rec_mut(), 198u16, value.len() as u16);
17317 self.as_rec_mut().extend(value);
17318 self
17319 }
17320 pub fn push_qos_map(mut self, value: &[u8]) -> Self {
17321 push_header(self.as_rec_mut(), 199u16, value.len() as u16);
17322 self.as_rec_mut().extend(value);
17323 self
17324 }
17325 pub fn push_mac_hint(mut self, value: &[u8]) -> Self {
17326 push_header(self.as_rec_mut(), 200u16, value.len() as u16);
17327 self.as_rec_mut().extend(value);
17328 self
17329 }
17330 pub fn push_wiphy_freq_hint(mut self, value: u32) -> Self {
17331 push_header(self.as_rec_mut(), 201u16, 4 as u16);
17332 self.as_rec_mut().extend(value.to_ne_bytes());
17333 self
17334 }
17335 pub fn push_max_ap_assoc_sta(mut self, value: u32) -> Self {
17336 push_header(self.as_rec_mut(), 202u16, 4 as u16);
17337 self.as_rec_mut().extend(value.to_ne_bytes());
17338 self
17339 }
17340 pub fn push_tdls_peer_capability(mut self, value: u32) -> Self {
17341 push_header(self.as_rec_mut(), 203u16, 4 as u16);
17342 self.as_rec_mut().extend(value.to_ne_bytes());
17343 self
17344 }
17345 pub fn push_socket_owner(mut self, value: ()) -> Self {
17346 push_header(self.as_rec_mut(), 204u16, 0 as u16);
17347 self
17348 }
17349 pub fn push_csa_c_offsets_tx(mut self, value: &[u8]) -> Self {
17350 push_header(self.as_rec_mut(), 205u16, value.len() as u16);
17351 self.as_rec_mut().extend(value);
17352 self
17353 }
17354 pub fn push_max_csa_counters(mut self, value: u8) -> Self {
17355 push_header(self.as_rec_mut(), 206u16, 1 as u16);
17356 self.as_rec_mut().extend(value.to_ne_bytes());
17357 self
17358 }
17359 pub fn push_tdls_initiator(mut self, value: ()) -> Self {
17360 push_header(self.as_rec_mut(), 207u16, 0 as u16);
17361 self
17362 }
17363 pub fn push_use_rrm(mut self, value: ()) -> Self {
17364 push_header(self.as_rec_mut(), 208u16, 0 as u16);
17365 self
17366 }
17367 pub fn push_wiphy_dyn_ack(mut self, value: ()) -> Self {
17368 push_header(self.as_rec_mut(), 209u16, 0 as u16);
17369 self
17370 }
17371 pub fn push_tsid(mut self, value: u8) -> Self {
17372 push_header(self.as_rec_mut(), 210u16, 1 as u16);
17373 self.as_rec_mut().extend(value.to_ne_bytes());
17374 self
17375 }
17376 pub fn push_user_prio(mut self, value: u8) -> Self {
17377 push_header(self.as_rec_mut(), 211u16, 1 as u16);
17378 self.as_rec_mut().extend(value.to_ne_bytes());
17379 self
17380 }
17381 pub fn push_admitted_time(mut self, value: u16) -> Self {
17382 push_header(self.as_rec_mut(), 212u16, 2 as u16);
17383 self.as_rec_mut().extend(value.to_ne_bytes());
17384 self
17385 }
17386 pub fn push_smps_mode(mut self, value: u8) -> Self {
17387 push_header(self.as_rec_mut(), 213u16, 1 as u16);
17388 self.as_rec_mut().extend(value.to_ne_bytes());
17389 self
17390 }
17391 pub fn push_oper_class(mut self, value: u8) -> Self {
17392 push_header(self.as_rec_mut(), 214u16, 1 as u16);
17393 self.as_rec_mut().extend(value.to_ne_bytes());
17394 self
17395 }
17396 pub fn push_mac_mask(mut self, value: &[u8]) -> Self {
17397 push_header(self.as_rec_mut(), 215u16, value.len() as u16);
17398 self.as_rec_mut().extend(value);
17399 self
17400 }
17401 pub fn push_wiphy_self_managed_reg(mut self, value: ()) -> Self {
17402 push_header(self.as_rec_mut(), 216u16, 0 as u16);
17403 self
17404 }
17405 pub fn push_ext_features(mut self, value: &[u8]) -> Self {
17406 push_header(self.as_rec_mut(), 217u16, value.len() as u16);
17407 self.as_rec_mut().extend(value);
17408 self
17409 }
17410 pub fn push_survey_radio_stats(mut self, value: &[u8]) -> Self {
17411 push_header(self.as_rec_mut(), 218u16, value.len() as u16);
17412 self.as_rec_mut().extend(value);
17413 self
17414 }
17415 pub fn push_netns_fd(mut self, value: u32) -> Self {
17416 push_header(self.as_rec_mut(), 219u16, 4 as u16);
17417 self.as_rec_mut().extend(value.to_ne_bytes());
17418 self
17419 }
17420 pub fn push_sched_scan_delay(mut self, value: u32) -> Self {
17421 push_header(self.as_rec_mut(), 220u16, 4 as u16);
17422 self.as_rec_mut().extend(value.to_ne_bytes());
17423 self
17424 }
17425 pub fn push_reg_indoor(mut self, value: ()) -> Self {
17426 push_header(self.as_rec_mut(), 221u16, 0 as u16);
17427 self
17428 }
17429 pub fn push_max_num_sched_scan_plans(mut self, value: u32) -> Self {
17430 push_header(self.as_rec_mut(), 222u16, 4 as u16);
17431 self.as_rec_mut().extend(value.to_ne_bytes());
17432 self
17433 }
17434 pub fn push_max_scan_plan_interval(mut self, value: u32) -> Self {
17435 push_header(self.as_rec_mut(), 223u16, 4 as u16);
17436 self.as_rec_mut().extend(value.to_ne_bytes());
17437 self
17438 }
17439 pub fn push_max_scan_plan_iterations(mut self, value: u32) -> Self {
17440 push_header(self.as_rec_mut(), 224u16, 4 as u16);
17441 self.as_rec_mut().extend(value.to_ne_bytes());
17442 self
17443 }
17444 pub fn push_sched_scan_plans(mut self, value: &[u8]) -> Self {
17445 push_header(self.as_rec_mut(), 225u16, value.len() as u16);
17446 self.as_rec_mut().extend(value);
17447 self
17448 }
17449 pub fn push_pbss(mut self, value: ()) -> Self {
17450 push_header(self.as_rec_mut(), 226u16, 0 as u16);
17451 self
17452 }
17453 pub fn push_bss_select(mut self, value: &[u8]) -> Self {
17454 push_header(self.as_rec_mut(), 227u16, value.len() as u16);
17455 self.as_rec_mut().extend(value);
17456 self
17457 }
17458 pub fn push_sta_support_p2p_ps(mut self, value: u8) -> Self {
17459 push_header(self.as_rec_mut(), 228u16, 1 as u16);
17460 self.as_rec_mut().extend(value.to_ne_bytes());
17461 self
17462 }
17463 pub fn push_pad(mut self, value: &[u8]) -> Self {
17464 push_header(self.as_rec_mut(), 229u16, value.len() as u16);
17465 self.as_rec_mut().extend(value);
17466 self
17467 }
17468 pub fn push_iftype_ext_capa(mut self, value: &[u8]) -> Self {
17469 push_header(self.as_rec_mut(), 230u16, value.len() as u16);
17470 self.as_rec_mut().extend(value);
17471 self
17472 }
17473 pub fn push_mu_mimo_group_data(mut self, value: &[u8]) -> Self {
17474 push_header(self.as_rec_mut(), 231u16, value.len() as u16);
17475 self.as_rec_mut().extend(value);
17476 self
17477 }
17478 pub fn push_mu_mimo_follow_mac_addr(mut self, value: &[u8]) -> Self {
17479 push_header(self.as_rec_mut(), 232u16, value.len() as u16);
17480 self.as_rec_mut().extend(value);
17481 self
17482 }
17483 pub fn push_scan_start_time_tsf(mut self, value: u64) -> Self {
17484 push_header(self.as_rec_mut(), 233u16, 8 as u16);
17485 self.as_rec_mut().extend(value.to_ne_bytes());
17486 self
17487 }
17488 pub fn push_scan_start_time_tsf_bssid(mut self, value: &[u8]) -> Self {
17489 push_header(self.as_rec_mut(), 234u16, value.len() as u16);
17490 self.as_rec_mut().extend(value);
17491 self
17492 }
17493 pub fn push_measurement_duration(mut self, value: u16) -> Self {
17494 push_header(self.as_rec_mut(), 235u16, 2 as u16);
17495 self.as_rec_mut().extend(value.to_ne_bytes());
17496 self
17497 }
17498 pub fn push_measurement_duration_mandatory(mut self, value: ()) -> Self {
17499 push_header(self.as_rec_mut(), 236u16, 0 as u16);
17500 self
17501 }
17502 pub fn push_mesh_peer_aid(mut self, value: u16) -> Self {
17503 push_header(self.as_rec_mut(), 237u16, 2 as u16);
17504 self.as_rec_mut().extend(value.to_ne_bytes());
17505 self
17506 }
17507 pub fn push_nan_master_pref(mut self, value: u8) -> Self {
17508 push_header(self.as_rec_mut(), 238u16, 1 as u16);
17509 self.as_rec_mut().extend(value.to_ne_bytes());
17510 self
17511 }
17512 pub fn push_bands(mut self, value: u32) -> Self {
17513 push_header(self.as_rec_mut(), 239u16, 4 as u16);
17514 self.as_rec_mut().extend(value.to_ne_bytes());
17515 self
17516 }
17517 pub fn push_nan_func(mut self, value: &[u8]) -> Self {
17518 push_header(self.as_rec_mut(), 240u16, value.len() as u16);
17519 self.as_rec_mut().extend(value);
17520 self
17521 }
17522 pub fn push_nan_match(mut self, value: &[u8]) -> Self {
17523 push_header(self.as_rec_mut(), 241u16, value.len() as u16);
17524 self.as_rec_mut().extend(value);
17525 self
17526 }
17527 pub fn push_fils_kek(mut self, value: &[u8]) -> Self {
17528 push_header(self.as_rec_mut(), 242u16, value.len() as u16);
17529 self.as_rec_mut().extend(value);
17530 self
17531 }
17532 pub fn push_fils_nonces(mut self, value: &[u8]) -> Self {
17533 push_header(self.as_rec_mut(), 243u16, value.len() as u16);
17534 self.as_rec_mut().extend(value);
17535 self
17536 }
17537 pub fn push_multicast_to_unicast_enabled(mut self, value: ()) -> Self {
17538 push_header(self.as_rec_mut(), 244u16, 0 as u16);
17539 self
17540 }
17541 pub fn push_bssid(mut self, value: &[u8]) -> Self {
17542 push_header(self.as_rec_mut(), 245u16, value.len() as u16);
17543 self.as_rec_mut().extend(value);
17544 self
17545 }
17546 pub fn push_sched_scan_relative_rssi(mut self, value: i8) -> Self {
17547 push_header(self.as_rec_mut(), 246u16, 1 as u16);
17548 self.as_rec_mut().extend(value.to_ne_bytes());
17549 self
17550 }
17551 pub fn push_sched_scan_rssi_adjust(mut self, value: &[u8]) -> Self {
17552 push_header(self.as_rec_mut(), 247u16, value.len() as u16);
17553 self.as_rec_mut().extend(value);
17554 self
17555 }
17556 pub fn push_timeout_reason(mut self, value: u32) -> Self {
17557 push_header(self.as_rec_mut(), 248u16, 4 as u16);
17558 self.as_rec_mut().extend(value.to_ne_bytes());
17559 self
17560 }
17561 pub fn push_fils_erp_username(mut self, value: &[u8]) -> Self {
17562 push_header(self.as_rec_mut(), 249u16, value.len() as u16);
17563 self.as_rec_mut().extend(value);
17564 self
17565 }
17566 pub fn push_fils_erp_realm(mut self, value: &[u8]) -> Self {
17567 push_header(self.as_rec_mut(), 250u16, value.len() as u16);
17568 self.as_rec_mut().extend(value);
17569 self
17570 }
17571 pub fn push_fils_erp_next_seq_num(mut self, value: u16) -> Self {
17572 push_header(self.as_rec_mut(), 251u16, 2 as u16);
17573 self.as_rec_mut().extend(value.to_ne_bytes());
17574 self
17575 }
17576 pub fn push_fils_erp_rrk(mut self, value: &[u8]) -> Self {
17577 push_header(self.as_rec_mut(), 252u16, value.len() as u16);
17578 self.as_rec_mut().extend(value);
17579 self
17580 }
17581 pub fn push_fils_cache_id(mut self, value: &[u8]) -> Self {
17582 push_header(self.as_rec_mut(), 253u16, value.len() as u16);
17583 self.as_rec_mut().extend(value);
17584 self
17585 }
17586 pub fn push_pmk(mut self, value: &[u8]) -> Self {
17587 push_header(self.as_rec_mut(), 254u16, value.len() as u16);
17588 self.as_rec_mut().extend(value);
17589 self
17590 }
17591 pub fn push_sched_scan_multi(mut self, value: ()) -> Self {
17592 push_header(self.as_rec_mut(), 255u16, 0 as u16);
17593 self
17594 }
17595 pub fn push_sched_scan_max_reqs(mut self, value: u32) -> Self {
17596 push_header(self.as_rec_mut(), 256u16, 4 as u16);
17597 self.as_rec_mut().extend(value.to_ne_bytes());
17598 self
17599 }
17600 pub fn push_want_1x_4way_hs(mut self, value: ()) -> Self {
17601 push_header(self.as_rec_mut(), 257u16, 0 as u16);
17602 self
17603 }
17604 pub fn push_pmkr0_name(mut self, value: &[u8]) -> Self {
17605 push_header(self.as_rec_mut(), 258u16, value.len() as u16);
17606 self.as_rec_mut().extend(value);
17607 self
17608 }
17609 pub fn push_port_authorized(mut self, value: &[u8]) -> Self {
17610 push_header(self.as_rec_mut(), 259u16, value.len() as u16);
17611 self.as_rec_mut().extend(value);
17612 self
17613 }
17614 pub fn push_external_auth_action(mut self, value: u32) -> Self {
17615 push_header(self.as_rec_mut(), 260u16, 4 as u16);
17616 self.as_rec_mut().extend(value.to_ne_bytes());
17617 self
17618 }
17619 pub fn push_external_auth_support(mut self, value: ()) -> Self {
17620 push_header(self.as_rec_mut(), 261u16, 0 as u16);
17621 self
17622 }
17623 pub fn push_nss(mut self, value: u8) -> Self {
17624 push_header(self.as_rec_mut(), 262u16, 1 as u16);
17625 self.as_rec_mut().extend(value.to_ne_bytes());
17626 self
17627 }
17628 pub fn push_ack_signal(mut self, value: i32) -> Self {
17629 push_header(self.as_rec_mut(), 263u16, 4 as u16);
17630 self.as_rec_mut().extend(value.to_ne_bytes());
17631 self
17632 }
17633 pub fn push_control_port_over_nl80211(mut self, value: ()) -> Self {
17634 push_header(self.as_rec_mut(), 264u16, 0 as u16);
17635 self
17636 }
17637 pub fn nested_txq_stats(mut self) -> PushTxqStatsAttrs<Self> {
17638 let header_offset = push_nested_header(self.as_rec_mut(), 265u16);
17639 PushTxqStatsAttrs {
17640 prev: Some(self),
17641 header_offset: Some(header_offset),
17642 }
17643 }
17644 pub fn push_txq_limit(mut self, value: u32) -> Self {
17645 push_header(self.as_rec_mut(), 266u16, 4 as u16);
17646 self.as_rec_mut().extend(value.to_ne_bytes());
17647 self
17648 }
17649 pub fn push_txq_memory_limit(mut self, value: u32) -> Self {
17650 push_header(self.as_rec_mut(), 267u16, 4 as u16);
17651 self.as_rec_mut().extend(value.to_ne_bytes());
17652 self
17653 }
17654 pub fn push_txq_quantum(mut self, value: u32) -> Self {
17655 push_header(self.as_rec_mut(), 268u16, 4 as u16);
17656 self.as_rec_mut().extend(value.to_ne_bytes());
17657 self
17658 }
17659 pub fn push_he_capability(mut self, value: &[u8]) -> Self {
17660 push_header(self.as_rec_mut(), 269u16, value.len() as u16);
17661 self.as_rec_mut().extend(value);
17662 self
17663 }
17664 pub fn push_ftm_responder(mut self, value: &[u8]) -> Self {
17665 push_header(self.as_rec_mut(), 270u16, value.len() as u16);
17666 self.as_rec_mut().extend(value);
17667 self
17668 }
17669 pub fn push_ftm_responder_stats(mut self, value: &[u8]) -> Self {
17670 push_header(self.as_rec_mut(), 271u16, value.len() as u16);
17671 self.as_rec_mut().extend(value);
17672 self
17673 }
17674 pub fn push_timeout(mut self, value: u32) -> Self {
17675 push_header(self.as_rec_mut(), 272u16, 4 as u16);
17676 self.as_rec_mut().extend(value.to_ne_bytes());
17677 self
17678 }
17679 pub fn push_peer_measurements(mut self, value: &[u8]) -> Self {
17680 push_header(self.as_rec_mut(), 273u16, value.len() as u16);
17681 self.as_rec_mut().extend(value);
17682 self
17683 }
17684 pub fn push_airtime_weight(mut self, value: u16) -> Self {
17685 push_header(self.as_rec_mut(), 274u16, 2 as u16);
17686 self.as_rec_mut().extend(value.to_ne_bytes());
17687 self
17688 }
17689 pub fn push_sta_tx_power_setting(mut self, value: u8) -> Self {
17690 push_header(self.as_rec_mut(), 275u16, 1 as u16);
17691 self.as_rec_mut().extend(value.to_ne_bytes());
17692 self
17693 }
17694 pub fn push_sta_tx_power(mut self, value: i16) -> Self {
17695 push_header(self.as_rec_mut(), 276u16, 2 as u16);
17696 self.as_rec_mut().extend(value.to_ne_bytes());
17697 self
17698 }
17699 pub fn push_sae_password(mut self, value: &[u8]) -> Self {
17700 push_header(self.as_rec_mut(), 277u16, value.len() as u16);
17701 self.as_rec_mut().extend(value);
17702 self
17703 }
17704 pub fn push_twt_responder(mut self, value: ()) -> Self {
17705 push_header(self.as_rec_mut(), 278u16, 0 as u16);
17706 self
17707 }
17708 pub fn push_he_obss_pd(mut self, value: &[u8]) -> Self {
17709 push_header(self.as_rec_mut(), 279u16, value.len() as u16);
17710 self.as_rec_mut().extend(value);
17711 self
17712 }
17713 pub fn push_wiphy_edmg_channels(mut self, value: u8) -> Self {
17714 push_header(self.as_rec_mut(), 280u16, 1 as u16);
17715 self.as_rec_mut().extend(value.to_ne_bytes());
17716 self
17717 }
17718 pub fn push_wiphy_edmg_bw_config(mut self, value: u8) -> Self {
17719 push_header(self.as_rec_mut(), 281u16, 1 as u16);
17720 self.as_rec_mut().extend(value.to_ne_bytes());
17721 self
17722 }
17723 pub fn push_vlan_id(mut self, value: u16) -> Self {
17724 push_header(self.as_rec_mut(), 282u16, 2 as u16);
17725 self.as_rec_mut().extend(value.to_ne_bytes());
17726 self
17727 }
17728 pub fn push_he_bss_color(mut self, value: &[u8]) -> Self {
17729 push_header(self.as_rec_mut(), 283u16, value.len() as u16);
17730 self.as_rec_mut().extend(value);
17731 self
17732 }
17733 pub fn push_iftype_akm_suites(mut self, value: &[u8]) -> Self {
17734 push_header(self.as_rec_mut(), 284u16, value.len() as u16);
17735 self.as_rec_mut().extend(value);
17736 self
17737 }
17738 pub fn push_tid_config(mut self, value: &[u8]) -> Self {
17739 push_header(self.as_rec_mut(), 285u16, value.len() as u16);
17740 self.as_rec_mut().extend(value);
17741 self
17742 }
17743 pub fn push_control_port_no_preauth(mut self, value: ()) -> Self {
17744 push_header(self.as_rec_mut(), 286u16, 0 as u16);
17745 self
17746 }
17747 pub fn push_pmk_lifetime(mut self, value: u32) -> Self {
17748 push_header(self.as_rec_mut(), 287u16, 4 as u16);
17749 self.as_rec_mut().extend(value.to_ne_bytes());
17750 self
17751 }
17752 pub fn push_pmk_reauth_threshold(mut self, value: u8) -> Self {
17753 push_header(self.as_rec_mut(), 288u16, 1 as u16);
17754 self.as_rec_mut().extend(value.to_ne_bytes());
17755 self
17756 }
17757 pub fn push_receive_multicast(mut self, value: ()) -> Self {
17758 push_header(self.as_rec_mut(), 289u16, 0 as u16);
17759 self
17760 }
17761 pub fn push_wiphy_freq_offset(mut self, value: u32) -> Self {
17762 push_header(self.as_rec_mut(), 290u16, 4 as u16);
17763 self.as_rec_mut().extend(value.to_ne_bytes());
17764 self
17765 }
17766 pub fn push_center_freq1_offset(mut self, value: u32) -> Self {
17767 push_header(self.as_rec_mut(), 291u16, 4 as u16);
17768 self.as_rec_mut().extend(value.to_ne_bytes());
17769 self
17770 }
17771 pub fn push_scan_freq_khz(mut self, value: &[u8]) -> Self {
17772 push_header(self.as_rec_mut(), 292u16, value.len() as u16);
17773 self.as_rec_mut().extend(value);
17774 self
17775 }
17776 pub fn push_he_6ghz_capability(mut self, value: &[u8]) -> Self {
17777 push_header(self.as_rec_mut(), 293u16, value.len() as u16);
17778 self.as_rec_mut().extend(value);
17779 self
17780 }
17781 pub fn push_fils_discovery(mut self, value: &[u8]) -> Self {
17782 push_header(self.as_rec_mut(), 294u16, value.len() as u16);
17783 self.as_rec_mut().extend(value);
17784 self
17785 }
17786 pub fn push_unsol_bcast_probe_resp(mut self, value: &[u8]) -> Self {
17787 push_header(self.as_rec_mut(), 295u16, value.len() as u16);
17788 self.as_rec_mut().extend(value);
17789 self
17790 }
17791 pub fn push_s1g_capability(mut self, value: &[u8]) -> Self {
17792 push_header(self.as_rec_mut(), 296u16, value.len() as u16);
17793 self.as_rec_mut().extend(value);
17794 self
17795 }
17796 pub fn push_s1g_capability_mask(mut self, value: &[u8]) -> Self {
17797 push_header(self.as_rec_mut(), 297u16, value.len() as u16);
17798 self.as_rec_mut().extend(value);
17799 self
17800 }
17801 pub fn push_sae_pwe(mut self, value: u8) -> Self {
17802 push_header(self.as_rec_mut(), 298u16, 1 as u16);
17803 self.as_rec_mut().extend(value.to_ne_bytes());
17804 self
17805 }
17806 pub fn push_reconnect_requested(mut self, value: &[u8]) -> Self {
17807 push_header(self.as_rec_mut(), 299u16, value.len() as u16);
17808 self.as_rec_mut().extend(value);
17809 self
17810 }
17811 pub fn nested_sar_spec(mut self) -> PushSarAttributes<Self> {
17812 let header_offset = push_nested_header(self.as_rec_mut(), 300u16);
17813 PushSarAttributes {
17814 prev: Some(self),
17815 header_offset: Some(header_offset),
17816 }
17817 }
17818 pub fn push_disable_he(mut self, value: ()) -> Self {
17819 push_header(self.as_rec_mut(), 301u16, 0 as u16);
17820 self
17821 }
17822 pub fn push_obss_color_bitmap(mut self, value: u64) -> Self {
17823 push_header(self.as_rec_mut(), 302u16, 8 as u16);
17824 self.as_rec_mut().extend(value.to_ne_bytes());
17825 self
17826 }
17827 pub fn push_color_change_count(mut self, value: u8) -> Self {
17828 push_header(self.as_rec_mut(), 303u16, 1 as u16);
17829 self.as_rec_mut().extend(value.to_ne_bytes());
17830 self
17831 }
17832 pub fn push_color_change_color(mut self, value: u8) -> Self {
17833 push_header(self.as_rec_mut(), 304u16, 1 as u16);
17834 self.as_rec_mut().extend(value.to_ne_bytes());
17835 self
17836 }
17837 pub fn push_color_change_elems(mut self, value: &[u8]) -> Self {
17838 push_header(self.as_rec_mut(), 305u16, value.len() as u16);
17839 self.as_rec_mut().extend(value);
17840 self
17841 }
17842 pub fn push_mbssid_config(mut self, value: &[u8]) -> Self {
17843 push_header(self.as_rec_mut(), 306u16, value.len() as u16);
17844 self.as_rec_mut().extend(value);
17845 self
17846 }
17847 pub fn push_mbssid_elems(mut self, value: &[u8]) -> Self {
17848 push_header(self.as_rec_mut(), 307u16, value.len() as u16);
17849 self.as_rec_mut().extend(value);
17850 self
17851 }
17852 pub fn push_radar_background(mut self, value: ()) -> Self {
17853 push_header(self.as_rec_mut(), 308u16, 0 as u16);
17854 self
17855 }
17856 pub fn push_ap_settings_flags(mut self, value: u32) -> Self {
17857 push_header(self.as_rec_mut(), 309u16, 4 as u16);
17858 self.as_rec_mut().extend(value.to_ne_bytes());
17859 self
17860 }
17861 pub fn push_eht_capability(mut self, value: &[u8]) -> Self {
17862 push_header(self.as_rec_mut(), 310u16, value.len() as u16);
17863 self.as_rec_mut().extend(value);
17864 self
17865 }
17866 pub fn push_disable_eht(mut self, value: ()) -> Self {
17867 push_header(self.as_rec_mut(), 311u16, 0 as u16);
17868 self
17869 }
17870 pub fn push_mlo_links(mut self, value: &[u8]) -> Self {
17871 push_header(self.as_rec_mut(), 312u16, value.len() as u16);
17872 self.as_rec_mut().extend(value);
17873 self
17874 }
17875 pub fn push_mlo_link_id(mut self, value: u8) -> Self {
17876 push_header(self.as_rec_mut(), 313u16, 1 as u16);
17877 self.as_rec_mut().extend(value.to_ne_bytes());
17878 self
17879 }
17880 pub fn push_mld_addr(mut self, value: &[u8]) -> Self {
17881 push_header(self.as_rec_mut(), 314u16, value.len() as u16);
17882 self.as_rec_mut().extend(value);
17883 self
17884 }
17885 pub fn push_mlo_support(mut self, value: ()) -> Self {
17886 push_header(self.as_rec_mut(), 315u16, 0 as u16);
17887 self
17888 }
17889 pub fn push_max_num_akm_suites(mut self, value: &[u8]) -> Self {
17890 push_header(self.as_rec_mut(), 316u16, value.len() as u16);
17891 self.as_rec_mut().extend(value);
17892 self
17893 }
17894 pub fn push_eml_capability(mut self, value: u16) -> Self {
17895 push_header(self.as_rec_mut(), 317u16, 2 as u16);
17896 self.as_rec_mut().extend(value.to_ne_bytes());
17897 self
17898 }
17899 pub fn push_mld_capa_and_ops(mut self, value: u16) -> Self {
17900 push_header(self.as_rec_mut(), 318u16, 2 as u16);
17901 self.as_rec_mut().extend(value.to_ne_bytes());
17902 self
17903 }
17904 pub fn push_tx_hw_timestamp(mut self, value: u64) -> Self {
17905 push_header(self.as_rec_mut(), 319u16, 8 as u16);
17906 self.as_rec_mut().extend(value.to_ne_bytes());
17907 self
17908 }
17909 pub fn push_rx_hw_timestamp(mut self, value: u64) -> Self {
17910 push_header(self.as_rec_mut(), 320u16, 8 as u16);
17911 self.as_rec_mut().extend(value.to_ne_bytes());
17912 self
17913 }
17914 pub fn push_td_bitmap(mut self, value: &[u8]) -> Self {
17915 push_header(self.as_rec_mut(), 321u16, value.len() as u16);
17916 self.as_rec_mut().extend(value);
17917 self
17918 }
17919 pub fn push_punct_bitmap(mut self, value: u32) -> Self {
17920 push_header(self.as_rec_mut(), 322u16, 4 as u16);
17921 self.as_rec_mut().extend(value.to_ne_bytes());
17922 self
17923 }
17924 pub fn push_max_hw_timestamp_peers(mut self, value: u16) -> Self {
17925 push_header(self.as_rec_mut(), 323u16, 2 as u16);
17926 self.as_rec_mut().extend(value.to_ne_bytes());
17927 self
17928 }
17929 pub fn push_hw_timestamp_enabled(mut self, value: ()) -> Self {
17930 push_header(self.as_rec_mut(), 324u16, 0 as u16);
17931 self
17932 }
17933 pub fn push_ema_rnr_elems(mut self, value: &[u8]) -> Self {
17934 push_header(self.as_rec_mut(), 325u16, value.len() as u16);
17935 self.as_rec_mut().extend(value);
17936 self
17937 }
17938 pub fn push_mlo_link_disabled(mut self, value: ()) -> Self {
17939 push_header(self.as_rec_mut(), 326u16, 0 as u16);
17940 self
17941 }
17942 pub fn push_bss_dump_include_use_data(mut self, value: ()) -> Self {
17943 push_header(self.as_rec_mut(), 327u16, 0 as u16);
17944 self
17945 }
17946 pub fn push_mlo_ttlm_dlink(mut self, value: u16) -> Self {
17947 push_header(self.as_rec_mut(), 328u16, 2 as u16);
17948 self.as_rec_mut().extend(value.to_ne_bytes());
17949 self
17950 }
17951 pub fn push_mlo_ttlm_ulink(mut self, value: u16) -> Self {
17952 push_header(self.as_rec_mut(), 329u16, 2 as u16);
17953 self.as_rec_mut().extend(value.to_ne_bytes());
17954 self
17955 }
17956 pub fn push_assoc_spp_amsdu(mut self, value: ()) -> Self {
17957 push_header(self.as_rec_mut(), 330u16, 0 as u16);
17958 self
17959 }
17960 pub fn push_wiphy_radios(mut self, value: &[u8]) -> Self {
17961 push_header(self.as_rec_mut(), 331u16, value.len() as u16);
17962 self.as_rec_mut().extend(value);
17963 self
17964 }
17965 pub fn push_wiphy_interface_combinations(mut self, value: &[u8]) -> Self {
17966 push_header(self.as_rec_mut(), 332u16, value.len() as u16);
17967 self.as_rec_mut().extend(value);
17968 self
17969 }
17970 pub fn push_vif_radio_mask(mut self, value: u32) -> Self {
17971 push_header(self.as_rec_mut(), 333u16, 4 as u16);
17972 self.as_rec_mut().extend(value.to_ne_bytes());
17973 self
17974 }
17975}
17976impl<Prev: Rec> Drop for PushNl80211Attrs<Prev> {
17977 fn drop(&mut self) {
17978 if let Some(prev) = &mut self.prev {
17979 if let Some(header_offset) = &self.header_offset {
17980 finalize_nested_header(prev.as_rec_mut(), *header_offset);
17981 }
17982 }
17983 }
17984}
17985pub struct PushFrameTypeAttrs<Prev: Rec> {
17986 pub(crate) prev: Option<Prev>,
17987 pub(crate) header_offset: Option<usize>,
17988}
17989impl<Prev: Rec> Rec for PushFrameTypeAttrs<Prev> {
17990 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
17991 self.prev.as_mut().unwrap().as_rec_mut()
17992 }
17993}
17994impl<Prev: Rec> PushFrameTypeAttrs<Prev> {
17995 pub fn new(prev: Prev) -> Self {
17996 Self {
17997 prev: Some(prev),
17998 header_offset: None,
17999 }
18000 }
18001 pub fn end_nested(mut self) -> Prev {
18002 let mut prev = self.prev.take().unwrap();
18003 if let Some(header_offset) = &self.header_offset {
18004 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18005 }
18006 prev
18007 }
18008 pub fn push_frame_type(mut self, value: u16) -> Self {
18009 push_header(self.as_rec_mut(), 101u16, 2 as u16);
18010 self.as_rec_mut().extend(value.to_ne_bytes());
18011 self
18012 }
18013}
18014impl<Prev: Rec> Drop for PushFrameTypeAttrs<Prev> {
18015 fn drop(&mut self) {
18016 if let Some(prev) = &mut self.prev {
18017 if let Some(header_offset) = &self.header_offset {
18018 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18019 }
18020 }
18021 }
18022}
18023pub struct PushWiphyBands<Prev: Rec> {
18024 pub(crate) prev: Option<Prev>,
18025 pub(crate) header_offset: Option<usize>,
18026}
18027impl<Prev: Rec> Rec for PushWiphyBands<Prev> {
18028 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
18029 self.prev.as_mut().unwrap().as_rec_mut()
18030 }
18031}
18032impl<Prev: Rec> PushWiphyBands<Prev> {
18033 pub fn new(prev: Prev) -> Self {
18034 Self {
18035 prev: Some(prev),
18036 header_offset: None,
18037 }
18038 }
18039 pub fn end_nested(mut self) -> Prev {
18040 let mut prev = self.prev.take().unwrap();
18041 if let Some(header_offset) = &self.header_offset {
18042 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18043 }
18044 prev
18045 }
18046 #[doc = "2.4 GHz ISM band"]
18047 pub fn nested_2ghz(mut self) -> PushBandAttrs<Self> {
18048 let header_offset = push_nested_header(self.as_rec_mut(), 0u16);
18049 PushBandAttrs {
18050 prev: Some(self),
18051 header_offset: Some(header_offset),
18052 }
18053 }
18054 #[doc = "around 5 GHz band (4.9 - 5.7 GHz)"]
18055 pub fn nested_5ghz(mut self) -> PushBandAttrs<Self> {
18056 let header_offset = push_nested_header(self.as_rec_mut(), 1u16);
18057 PushBandAttrs {
18058 prev: Some(self),
18059 header_offset: Some(header_offset),
18060 }
18061 }
18062 #[doc = "around 60 GHz band (58.32 - 69.12 GHz)"]
18063 pub fn nested_60ghz(mut self) -> PushBandAttrs<Self> {
18064 let header_offset = push_nested_header(self.as_rec_mut(), 2u16);
18065 PushBandAttrs {
18066 prev: Some(self),
18067 header_offset: Some(header_offset),
18068 }
18069 }
18070 pub fn nested_6ghz(mut self) -> PushBandAttrs<Self> {
18071 let header_offset = push_nested_header(self.as_rec_mut(), 3u16);
18072 PushBandAttrs {
18073 prev: Some(self),
18074 header_offset: Some(header_offset),
18075 }
18076 }
18077 pub fn nested_s1ghz(mut self) -> PushBandAttrs<Self> {
18078 let header_offset = push_nested_header(self.as_rec_mut(), 4u16);
18079 PushBandAttrs {
18080 prev: Some(self),
18081 header_offset: Some(header_offset),
18082 }
18083 }
18084 pub fn nested_lc(mut self) -> PushBandAttrs<Self> {
18085 let header_offset = push_nested_header(self.as_rec_mut(), 5u16);
18086 PushBandAttrs {
18087 prev: Some(self),
18088 header_offset: Some(header_offset),
18089 }
18090 }
18091}
18092impl<Prev: Rec> Drop for PushWiphyBands<Prev> {
18093 fn drop(&mut self) {
18094 if let Some(prev) = &mut self.prev {
18095 if let Some(header_offset) = &self.header_offset {
18096 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18097 }
18098 }
18099 }
18100}
18101pub struct PushBandAttrs<Prev: Rec> {
18102 pub(crate) prev: Option<Prev>,
18103 pub(crate) header_offset: Option<usize>,
18104}
18105impl<Prev: Rec> Rec for PushBandAttrs<Prev> {
18106 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
18107 self.prev.as_mut().unwrap().as_rec_mut()
18108 }
18109}
18110pub struct PushArrayFrequencyAttrs<Prev: Rec> {
18111 pub(crate) prev: Option<Prev>,
18112 pub(crate) header_offset: Option<usize>,
18113 pub(crate) counter: u16,
18114}
18115impl<Prev: Rec> Rec for PushArrayFrequencyAttrs<Prev> {
18116 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
18117 self.prev.as_mut().unwrap().as_rec_mut()
18118 }
18119}
18120impl<Prev: Rec> PushArrayFrequencyAttrs<Prev> {
18121 pub fn new(prev: Prev) -> Self {
18122 Self {
18123 prev: Some(prev),
18124 header_offset: None,
18125 counter: 0,
18126 }
18127 }
18128 pub fn end_array(mut self) -> Prev {
18129 let mut prev = self.prev.take().unwrap();
18130 if let Some(header_offset) = &self.header_offset {
18131 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18132 }
18133 prev
18134 }
18135 pub fn entry_nested(mut self) -> PushFrequencyAttrs<Self> {
18136 let index = self.counter;
18137 self.counter += 1;
18138 let header_offset = push_nested_header(self.as_rec_mut(), index);
18139 PushFrequencyAttrs {
18140 prev: Some(self),
18141 header_offset: Some(header_offset),
18142 }
18143 }
18144}
18145impl<Prev: Rec> Drop for PushArrayFrequencyAttrs<Prev> {
18146 fn drop(&mut self) {
18147 if let Some(prev) = &mut self.prev {
18148 if let Some(header_offset) = &self.header_offset {
18149 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18150 }
18151 }
18152 }
18153}
18154pub struct PushArrayBitrateAttrs<Prev: Rec> {
18155 pub(crate) prev: Option<Prev>,
18156 pub(crate) header_offset: Option<usize>,
18157 pub(crate) counter: u16,
18158}
18159impl<Prev: Rec> Rec for PushArrayBitrateAttrs<Prev> {
18160 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
18161 self.prev.as_mut().unwrap().as_rec_mut()
18162 }
18163}
18164impl<Prev: Rec> PushArrayBitrateAttrs<Prev> {
18165 pub fn new(prev: Prev) -> Self {
18166 Self {
18167 prev: Some(prev),
18168 header_offset: None,
18169 counter: 0,
18170 }
18171 }
18172 pub fn end_array(mut self) -> Prev {
18173 let mut prev = self.prev.take().unwrap();
18174 if let Some(header_offset) = &self.header_offset {
18175 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18176 }
18177 prev
18178 }
18179 pub fn entry_nested(mut self) -> PushBitrateAttrs<Self> {
18180 let index = self.counter;
18181 self.counter += 1;
18182 let header_offset = push_nested_header(self.as_rec_mut(), index);
18183 PushBitrateAttrs {
18184 prev: Some(self),
18185 header_offset: Some(header_offset),
18186 }
18187 }
18188}
18189impl<Prev: Rec> Drop for PushArrayBitrateAttrs<Prev> {
18190 fn drop(&mut self) {
18191 if let Some(prev) = &mut self.prev {
18192 if let Some(header_offset) = &self.header_offset {
18193 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18194 }
18195 }
18196 }
18197}
18198pub struct PushArrayIftypeDataAttrs<Prev: Rec> {
18199 pub(crate) prev: Option<Prev>,
18200 pub(crate) header_offset: Option<usize>,
18201 pub(crate) counter: u16,
18202}
18203impl<Prev: Rec> Rec for PushArrayIftypeDataAttrs<Prev> {
18204 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
18205 self.prev.as_mut().unwrap().as_rec_mut()
18206 }
18207}
18208impl<Prev: Rec> PushArrayIftypeDataAttrs<Prev> {
18209 pub fn new(prev: Prev) -> Self {
18210 Self {
18211 prev: Some(prev),
18212 header_offset: None,
18213 counter: 0,
18214 }
18215 }
18216 pub fn end_array(mut self) -> Prev {
18217 let mut prev = self.prev.take().unwrap();
18218 if let Some(header_offset) = &self.header_offset {
18219 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18220 }
18221 prev
18222 }
18223 pub fn entry_nested(mut self) -> PushIftypeDataAttrs<Self> {
18224 let index = self.counter;
18225 self.counter += 1;
18226 let header_offset = push_nested_header(self.as_rec_mut(), index);
18227 PushIftypeDataAttrs {
18228 prev: Some(self),
18229 header_offset: Some(header_offset),
18230 }
18231 }
18232}
18233impl<Prev: Rec> Drop for PushArrayIftypeDataAttrs<Prev> {
18234 fn drop(&mut self) {
18235 if let Some(prev) = &mut self.prev {
18236 if let Some(header_offset) = &self.header_offset {
18237 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18238 }
18239 }
18240 }
18241}
18242impl<Prev: Rec> PushBandAttrs<Prev> {
18243 pub fn new(prev: Prev) -> Self {
18244 Self {
18245 prev: Some(prev),
18246 header_offset: None,
18247 }
18248 }
18249 pub fn end_nested(mut self) -> Prev {
18250 let mut prev = self.prev.take().unwrap();
18251 if let Some(header_offset) = &self.header_offset {
18252 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18253 }
18254 prev
18255 }
18256 pub fn array_freqs(mut self) -> PushArrayFrequencyAttrs<Self> {
18257 let header_offset = push_nested_header(self.as_rec_mut(), 1u16);
18258 PushArrayFrequencyAttrs {
18259 prev: Some(self),
18260 header_offset: Some(header_offset),
18261 counter: 0,
18262 }
18263 }
18264 pub fn array_rates(mut self) -> PushArrayBitrateAttrs<Self> {
18265 let header_offset = push_nested_header(self.as_rec_mut(), 2u16);
18266 PushArrayBitrateAttrs {
18267 prev: Some(self),
18268 header_offset: Some(header_offset),
18269 counter: 0,
18270 }
18271 }
18272 pub fn push_ht_mcs_set(mut self, value: &[u8]) -> Self {
18273 push_header(self.as_rec_mut(), 3u16, value.len() as u16);
18274 self.as_rec_mut().extend(value);
18275 self
18276 }
18277 pub fn push_ht_capa(mut self, value: u16) -> Self {
18278 push_header(self.as_rec_mut(), 4u16, 2 as u16);
18279 self.as_rec_mut().extend(value.to_ne_bytes());
18280 self
18281 }
18282 pub fn push_ht_ampdu_factor(mut self, value: u8) -> Self {
18283 push_header(self.as_rec_mut(), 5u16, 1 as u16);
18284 self.as_rec_mut().extend(value.to_ne_bytes());
18285 self
18286 }
18287 pub fn push_ht_ampdu_density(mut self, value: u8) -> Self {
18288 push_header(self.as_rec_mut(), 6u16, 1 as u16);
18289 self.as_rec_mut().extend(value.to_ne_bytes());
18290 self
18291 }
18292 pub fn push_vht_mcs_set(mut self, value: &[u8]) -> Self {
18293 push_header(self.as_rec_mut(), 7u16, value.len() as u16);
18294 self.as_rec_mut().extend(value);
18295 self
18296 }
18297 pub fn push_vht_capa(mut self, value: u32) -> Self {
18298 push_header(self.as_rec_mut(), 8u16, 4 as u16);
18299 self.as_rec_mut().extend(value.to_ne_bytes());
18300 self
18301 }
18302 pub fn array_iftype_data(mut self) -> PushArrayIftypeDataAttrs<Self> {
18303 let header_offset = push_nested_header(self.as_rec_mut(), 9u16);
18304 PushArrayIftypeDataAttrs {
18305 prev: Some(self),
18306 header_offset: Some(header_offset),
18307 counter: 0,
18308 }
18309 }
18310 pub fn push_edmg_channels(mut self, value: &[u8]) -> Self {
18311 push_header(self.as_rec_mut(), 10u16, value.len() as u16);
18312 self.as_rec_mut().extend(value);
18313 self
18314 }
18315 pub fn push_edmg_bw_config(mut self, value: &[u8]) -> Self {
18316 push_header(self.as_rec_mut(), 11u16, value.len() as u16);
18317 self.as_rec_mut().extend(value);
18318 self
18319 }
18320 pub fn push_s1g_mcs_nss_set(mut self, value: &[u8]) -> Self {
18321 push_header(self.as_rec_mut(), 12u16, value.len() as u16);
18322 self.as_rec_mut().extend(value);
18323 self
18324 }
18325 pub fn push_s1g_capa(mut self, value: &[u8]) -> Self {
18326 push_header(self.as_rec_mut(), 13u16, value.len() as u16);
18327 self.as_rec_mut().extend(value);
18328 self
18329 }
18330}
18331impl<Prev: Rec> Drop for PushBandAttrs<Prev> {
18332 fn drop(&mut self) {
18333 if let Some(prev) = &mut self.prev {
18334 if let Some(header_offset) = &self.header_offset {
18335 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18336 }
18337 }
18338 }
18339}
18340pub struct PushBitrateAttrs<Prev: Rec> {
18341 pub(crate) prev: Option<Prev>,
18342 pub(crate) header_offset: Option<usize>,
18343}
18344impl<Prev: Rec> Rec for PushBitrateAttrs<Prev> {
18345 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
18346 self.prev.as_mut().unwrap().as_rec_mut()
18347 }
18348}
18349impl<Prev: Rec> PushBitrateAttrs<Prev> {
18350 pub fn new(prev: Prev) -> Self {
18351 Self {
18352 prev: Some(prev),
18353 header_offset: None,
18354 }
18355 }
18356 pub fn end_nested(mut self) -> Prev {
18357 let mut prev = self.prev.take().unwrap();
18358 if let Some(header_offset) = &self.header_offset {
18359 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18360 }
18361 prev
18362 }
18363 pub fn push_rate(mut self, value: u32) -> Self {
18364 push_header(self.as_rec_mut(), 1u16, 4 as u16);
18365 self.as_rec_mut().extend(value.to_ne_bytes());
18366 self
18367 }
18368 pub fn push_2ghz_shortpreamble(mut self, value: ()) -> Self {
18369 push_header(self.as_rec_mut(), 2u16, 0 as u16);
18370 self
18371 }
18372}
18373impl<Prev: Rec> Drop for PushBitrateAttrs<Prev> {
18374 fn drop(&mut self) {
18375 if let Some(prev) = &mut self.prev {
18376 if let Some(header_offset) = &self.header_offset {
18377 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18378 }
18379 }
18380 }
18381}
18382pub struct PushFrequencyAttrs<Prev: Rec> {
18383 pub(crate) prev: Option<Prev>,
18384 pub(crate) header_offset: Option<usize>,
18385}
18386impl<Prev: Rec> Rec for PushFrequencyAttrs<Prev> {
18387 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
18388 self.prev.as_mut().unwrap().as_rec_mut()
18389 }
18390}
18391pub struct PushArrayWmmAttrs<Prev: Rec> {
18392 pub(crate) prev: Option<Prev>,
18393 pub(crate) header_offset: Option<usize>,
18394 pub(crate) counter: u16,
18395}
18396impl<Prev: Rec> Rec for PushArrayWmmAttrs<Prev> {
18397 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
18398 self.prev.as_mut().unwrap().as_rec_mut()
18399 }
18400}
18401impl<Prev: Rec> PushArrayWmmAttrs<Prev> {
18402 pub fn new(prev: Prev) -> Self {
18403 Self {
18404 prev: Some(prev),
18405 header_offset: None,
18406 counter: 0,
18407 }
18408 }
18409 pub fn end_array(mut self) -> Prev {
18410 let mut prev = self.prev.take().unwrap();
18411 if let Some(header_offset) = &self.header_offset {
18412 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18413 }
18414 prev
18415 }
18416 pub fn entry_nested(mut self) -> PushWmmAttrs<Self> {
18417 let index = self.counter;
18418 self.counter += 1;
18419 let header_offset = push_nested_header(self.as_rec_mut(), index);
18420 PushWmmAttrs {
18421 prev: Some(self),
18422 header_offset: Some(header_offset),
18423 }
18424 }
18425}
18426impl<Prev: Rec> Drop for PushArrayWmmAttrs<Prev> {
18427 fn drop(&mut self) {
18428 if let Some(prev) = &mut self.prev {
18429 if let Some(header_offset) = &self.header_offset {
18430 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18431 }
18432 }
18433 }
18434}
18435impl<Prev: Rec> PushFrequencyAttrs<Prev> {
18436 pub fn new(prev: Prev) -> Self {
18437 Self {
18438 prev: Some(prev),
18439 header_offset: None,
18440 }
18441 }
18442 pub fn end_nested(mut self) -> Prev {
18443 let mut prev = self.prev.take().unwrap();
18444 if let Some(header_offset) = &self.header_offset {
18445 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18446 }
18447 prev
18448 }
18449 pub fn push_freq(mut self, value: u32) -> Self {
18450 push_header(self.as_rec_mut(), 1u16, 4 as u16);
18451 self.as_rec_mut().extend(value.to_ne_bytes());
18452 self
18453 }
18454 pub fn push_disabled(mut self, value: ()) -> Self {
18455 push_header(self.as_rec_mut(), 2u16, 0 as u16);
18456 self
18457 }
18458 pub fn push_no_ir(mut self, value: ()) -> Self {
18459 push_header(self.as_rec_mut(), 3u16, 0 as u16);
18460 self
18461 }
18462 pub fn push_no_ibss(mut self, value: ()) -> Self {
18463 push_header(self.as_rec_mut(), 4u16, 0 as u16);
18464 self
18465 }
18466 pub fn push_radar(mut self, value: ()) -> Self {
18467 push_header(self.as_rec_mut(), 5u16, 0 as u16);
18468 self
18469 }
18470 pub fn push_max_tx_power(mut self, value: u32) -> Self {
18471 push_header(self.as_rec_mut(), 6u16, 4 as u16);
18472 self.as_rec_mut().extend(value.to_ne_bytes());
18473 self
18474 }
18475 pub fn push_dfs_state(mut self, value: u32) -> Self {
18476 push_header(self.as_rec_mut(), 7u16, 4 as u16);
18477 self.as_rec_mut().extend(value.to_ne_bytes());
18478 self
18479 }
18480 pub fn push_dfs_time(mut self, value: &[u8]) -> Self {
18481 push_header(self.as_rec_mut(), 8u16, value.len() as u16);
18482 self.as_rec_mut().extend(value);
18483 self
18484 }
18485 pub fn push_no_ht40_minus(mut self, value: &[u8]) -> Self {
18486 push_header(self.as_rec_mut(), 9u16, value.len() as u16);
18487 self.as_rec_mut().extend(value);
18488 self
18489 }
18490 pub fn push_no_ht40_plus(mut self, value: &[u8]) -> Self {
18491 push_header(self.as_rec_mut(), 10u16, value.len() as u16);
18492 self.as_rec_mut().extend(value);
18493 self
18494 }
18495 pub fn push_no_80mhz(mut self, value: &[u8]) -> Self {
18496 push_header(self.as_rec_mut(), 11u16, value.len() as u16);
18497 self.as_rec_mut().extend(value);
18498 self
18499 }
18500 pub fn push_no_160mhz(mut self, value: &[u8]) -> Self {
18501 push_header(self.as_rec_mut(), 12u16, value.len() as u16);
18502 self.as_rec_mut().extend(value);
18503 self
18504 }
18505 pub fn push_dfs_cac_time(mut self, value: &[u8]) -> Self {
18506 push_header(self.as_rec_mut(), 13u16, value.len() as u16);
18507 self.as_rec_mut().extend(value);
18508 self
18509 }
18510 pub fn push_indoor_only(mut self, value: &[u8]) -> Self {
18511 push_header(self.as_rec_mut(), 14u16, value.len() as u16);
18512 self.as_rec_mut().extend(value);
18513 self
18514 }
18515 pub fn push_ir_concurrent(mut self, value: &[u8]) -> Self {
18516 push_header(self.as_rec_mut(), 15u16, value.len() as u16);
18517 self.as_rec_mut().extend(value);
18518 self
18519 }
18520 pub fn push_no_20mhz(mut self, value: &[u8]) -> Self {
18521 push_header(self.as_rec_mut(), 16u16, value.len() as u16);
18522 self.as_rec_mut().extend(value);
18523 self
18524 }
18525 pub fn push_no_10mhz(mut self, value: &[u8]) -> Self {
18526 push_header(self.as_rec_mut(), 17u16, value.len() as u16);
18527 self.as_rec_mut().extend(value);
18528 self
18529 }
18530 pub fn array_wmm(mut self) -> PushArrayWmmAttrs<Self> {
18531 let header_offset = push_nested_header(self.as_rec_mut(), 18u16);
18532 PushArrayWmmAttrs {
18533 prev: Some(self),
18534 header_offset: Some(header_offset),
18535 counter: 0,
18536 }
18537 }
18538 pub fn push_no_he(mut self, value: &[u8]) -> Self {
18539 push_header(self.as_rec_mut(), 19u16, value.len() as u16);
18540 self.as_rec_mut().extend(value);
18541 self
18542 }
18543 pub fn push_offset(mut self, value: u32) -> Self {
18544 push_header(self.as_rec_mut(), 20u16, 4 as u16);
18545 self.as_rec_mut().extend(value.to_ne_bytes());
18546 self
18547 }
18548 pub fn push_1mhz(mut self, value: &[u8]) -> Self {
18549 push_header(self.as_rec_mut(), 21u16, value.len() as u16);
18550 self.as_rec_mut().extend(value);
18551 self
18552 }
18553 pub fn push_2mhz(mut self, value: &[u8]) -> Self {
18554 push_header(self.as_rec_mut(), 22u16, value.len() as u16);
18555 self.as_rec_mut().extend(value);
18556 self
18557 }
18558 pub fn push_4mhz(mut self, value: &[u8]) -> Self {
18559 push_header(self.as_rec_mut(), 23u16, value.len() as u16);
18560 self.as_rec_mut().extend(value);
18561 self
18562 }
18563 pub fn push_8mhz(mut self, value: &[u8]) -> Self {
18564 push_header(self.as_rec_mut(), 24u16, value.len() as u16);
18565 self.as_rec_mut().extend(value);
18566 self
18567 }
18568 pub fn push_16mhz(mut self, value: &[u8]) -> Self {
18569 push_header(self.as_rec_mut(), 25u16, value.len() as u16);
18570 self.as_rec_mut().extend(value);
18571 self
18572 }
18573 pub fn push_no_320mhz(mut self, value: &[u8]) -> Self {
18574 push_header(self.as_rec_mut(), 26u16, value.len() as u16);
18575 self.as_rec_mut().extend(value);
18576 self
18577 }
18578 pub fn push_no_eht(mut self, value: &[u8]) -> Self {
18579 push_header(self.as_rec_mut(), 27u16, value.len() as u16);
18580 self.as_rec_mut().extend(value);
18581 self
18582 }
18583 pub fn push_psd(mut self, value: &[u8]) -> Self {
18584 push_header(self.as_rec_mut(), 28u16, value.len() as u16);
18585 self.as_rec_mut().extend(value);
18586 self
18587 }
18588 pub fn push_dfs_concurrent(mut self, value: &[u8]) -> Self {
18589 push_header(self.as_rec_mut(), 29u16, value.len() as u16);
18590 self.as_rec_mut().extend(value);
18591 self
18592 }
18593 pub fn push_no_6ghz_vlp_client(mut self, value: &[u8]) -> Self {
18594 push_header(self.as_rec_mut(), 30u16, value.len() as u16);
18595 self.as_rec_mut().extend(value);
18596 self
18597 }
18598 pub fn push_no_6ghz_afc_client(mut self, value: &[u8]) -> Self {
18599 push_header(self.as_rec_mut(), 31u16, value.len() as u16);
18600 self.as_rec_mut().extend(value);
18601 self
18602 }
18603 pub fn push_can_monitor(mut self, value: &[u8]) -> Self {
18604 push_header(self.as_rec_mut(), 32u16, value.len() as u16);
18605 self.as_rec_mut().extend(value);
18606 self
18607 }
18608 pub fn push_allow_6ghz_vlp_ap(mut self, value: &[u8]) -> Self {
18609 push_header(self.as_rec_mut(), 33u16, value.len() as u16);
18610 self.as_rec_mut().extend(value);
18611 self
18612 }
18613}
18614impl<Prev: Rec> Drop for PushFrequencyAttrs<Prev> {
18615 fn drop(&mut self) {
18616 if let Some(prev) = &mut self.prev {
18617 if let Some(header_offset) = &self.header_offset {
18618 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18619 }
18620 }
18621 }
18622}
18623pub struct PushIfCombinationAttributes<Prev: Rec> {
18624 pub(crate) prev: Option<Prev>,
18625 pub(crate) header_offset: Option<usize>,
18626}
18627impl<Prev: Rec> Rec for PushIfCombinationAttributes<Prev> {
18628 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
18629 self.prev.as_mut().unwrap().as_rec_mut()
18630 }
18631}
18632pub struct PushArrayIfaceLimitAttributes<Prev: Rec> {
18633 pub(crate) prev: Option<Prev>,
18634 pub(crate) header_offset: Option<usize>,
18635 pub(crate) counter: u16,
18636}
18637impl<Prev: Rec> Rec for PushArrayIfaceLimitAttributes<Prev> {
18638 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
18639 self.prev.as_mut().unwrap().as_rec_mut()
18640 }
18641}
18642impl<Prev: Rec> PushArrayIfaceLimitAttributes<Prev> {
18643 pub fn new(prev: Prev) -> Self {
18644 Self {
18645 prev: Some(prev),
18646 header_offset: None,
18647 counter: 0,
18648 }
18649 }
18650 pub fn end_array(mut self) -> Prev {
18651 let mut prev = self.prev.take().unwrap();
18652 if let Some(header_offset) = &self.header_offset {
18653 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18654 }
18655 prev
18656 }
18657 pub fn entry_nested(mut self) -> PushIfaceLimitAttributes<Self> {
18658 let index = self.counter;
18659 self.counter += 1;
18660 let header_offset = push_nested_header(self.as_rec_mut(), index);
18661 PushIfaceLimitAttributes {
18662 prev: Some(self),
18663 header_offset: Some(header_offset),
18664 }
18665 }
18666}
18667impl<Prev: Rec> Drop for PushArrayIfaceLimitAttributes<Prev> {
18668 fn drop(&mut self) {
18669 if let Some(prev) = &mut self.prev {
18670 if let Some(header_offset) = &self.header_offset {
18671 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18672 }
18673 }
18674 }
18675}
18676impl<Prev: Rec> PushIfCombinationAttributes<Prev> {
18677 pub fn new(prev: Prev) -> Self {
18678 Self {
18679 prev: Some(prev),
18680 header_offset: None,
18681 }
18682 }
18683 pub fn end_nested(mut self) -> Prev {
18684 let mut prev = self.prev.take().unwrap();
18685 if let Some(header_offset) = &self.header_offset {
18686 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18687 }
18688 prev
18689 }
18690 pub fn array_limits(mut self) -> PushArrayIfaceLimitAttributes<Self> {
18691 let header_offset = push_nested_header(self.as_rec_mut(), 1u16);
18692 PushArrayIfaceLimitAttributes {
18693 prev: Some(self),
18694 header_offset: Some(header_offset),
18695 counter: 0,
18696 }
18697 }
18698 pub fn push_maxnum(mut self, value: u32) -> Self {
18699 push_header(self.as_rec_mut(), 2u16, 4 as u16);
18700 self.as_rec_mut().extend(value.to_ne_bytes());
18701 self
18702 }
18703 pub fn push_sta_ap_bi_match(mut self, value: ()) -> Self {
18704 push_header(self.as_rec_mut(), 3u16, 0 as u16);
18705 self
18706 }
18707 pub fn push_num_channels(mut self, value: u32) -> Self {
18708 push_header(self.as_rec_mut(), 4u16, 4 as u16);
18709 self.as_rec_mut().extend(value.to_ne_bytes());
18710 self
18711 }
18712 pub fn push_radar_detect_widths(mut self, value: u32) -> Self {
18713 push_header(self.as_rec_mut(), 5u16, 4 as u16);
18714 self.as_rec_mut().extend(value.to_ne_bytes());
18715 self
18716 }
18717 pub fn push_radar_detect_regions(mut self, value: u32) -> Self {
18718 push_header(self.as_rec_mut(), 6u16, 4 as u16);
18719 self.as_rec_mut().extend(value.to_ne_bytes());
18720 self
18721 }
18722 pub fn push_bi_min_gcd(mut self, value: u32) -> Self {
18723 push_header(self.as_rec_mut(), 7u16, 4 as u16);
18724 self.as_rec_mut().extend(value.to_ne_bytes());
18725 self
18726 }
18727}
18728impl<Prev: Rec> Drop for PushIfCombinationAttributes<Prev> {
18729 fn drop(&mut self) {
18730 if let Some(prev) = &mut self.prev {
18731 if let Some(header_offset) = &self.header_offset {
18732 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18733 }
18734 }
18735 }
18736}
18737pub struct PushIfaceLimitAttributes<Prev: Rec> {
18738 pub(crate) prev: Option<Prev>,
18739 pub(crate) header_offset: Option<usize>,
18740}
18741impl<Prev: Rec> Rec for PushIfaceLimitAttributes<Prev> {
18742 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
18743 self.prev.as_mut().unwrap().as_rec_mut()
18744 }
18745}
18746impl<Prev: Rec> PushIfaceLimitAttributes<Prev> {
18747 pub fn new(prev: Prev) -> Self {
18748 Self {
18749 prev: Some(prev),
18750 header_offset: None,
18751 }
18752 }
18753 pub fn end_nested(mut self) -> Prev {
18754 let mut prev = self.prev.take().unwrap();
18755 if let Some(header_offset) = &self.header_offset {
18756 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18757 }
18758 prev
18759 }
18760 pub fn push_max(mut self, value: u32) -> Self {
18761 push_header(self.as_rec_mut(), 1u16, 4 as u16);
18762 self.as_rec_mut().extend(value.to_ne_bytes());
18763 self
18764 }
18765 pub fn nested_types(mut self) -> PushSupportedIftypes<Self> {
18766 let header_offset = push_nested_header(self.as_rec_mut(), 2u16);
18767 PushSupportedIftypes {
18768 prev: Some(self),
18769 header_offset: Some(header_offset),
18770 }
18771 }
18772}
18773impl<Prev: Rec> Drop for PushIfaceLimitAttributes<Prev> {
18774 fn drop(&mut self) {
18775 if let Some(prev) = &mut self.prev {
18776 if let Some(header_offset) = &self.header_offset {
18777 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18778 }
18779 }
18780 }
18781}
18782pub struct PushIftypeDataAttrs<Prev: Rec> {
18783 pub(crate) prev: Option<Prev>,
18784 pub(crate) header_offset: Option<usize>,
18785}
18786impl<Prev: Rec> Rec for PushIftypeDataAttrs<Prev> {
18787 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
18788 self.prev.as_mut().unwrap().as_rec_mut()
18789 }
18790}
18791impl<Prev: Rec> PushIftypeDataAttrs<Prev> {
18792 pub fn new(prev: Prev) -> Self {
18793 Self {
18794 prev: Some(prev),
18795 header_offset: None,
18796 }
18797 }
18798 pub fn end_nested(mut self) -> Prev {
18799 let mut prev = self.prev.take().unwrap();
18800 if let Some(header_offset) = &self.header_offset {
18801 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18802 }
18803 prev
18804 }
18805 pub fn push_iftypes(mut self, value: &[u8]) -> Self {
18806 push_header(self.as_rec_mut(), 1u16, value.len() as u16);
18807 self.as_rec_mut().extend(value);
18808 self
18809 }
18810 pub fn push_he_cap_mac(mut self, value: &[u8]) -> Self {
18811 push_header(self.as_rec_mut(), 2u16, value.len() as u16);
18812 self.as_rec_mut().extend(value);
18813 self
18814 }
18815 pub fn push_he_cap_phy(mut self, value: &[u8]) -> Self {
18816 push_header(self.as_rec_mut(), 3u16, value.len() as u16);
18817 self.as_rec_mut().extend(value);
18818 self
18819 }
18820 pub fn push_he_cap_mcs_set(mut self, value: &[u8]) -> Self {
18821 push_header(self.as_rec_mut(), 4u16, value.len() as u16);
18822 self.as_rec_mut().extend(value);
18823 self
18824 }
18825 pub fn push_he_cap_ppe(mut self, value: &[u8]) -> Self {
18826 push_header(self.as_rec_mut(), 5u16, value.len() as u16);
18827 self.as_rec_mut().extend(value);
18828 self
18829 }
18830 pub fn push_he_6ghz_capa(mut self, value: &[u8]) -> Self {
18831 push_header(self.as_rec_mut(), 6u16, value.len() as u16);
18832 self.as_rec_mut().extend(value);
18833 self
18834 }
18835 pub fn push_vendor_elems(mut self, value: &[u8]) -> Self {
18836 push_header(self.as_rec_mut(), 7u16, value.len() as u16);
18837 self.as_rec_mut().extend(value);
18838 self
18839 }
18840 pub fn push_eht_cap_mac(mut self, value: &[u8]) -> Self {
18841 push_header(self.as_rec_mut(), 8u16, value.len() as u16);
18842 self.as_rec_mut().extend(value);
18843 self
18844 }
18845 pub fn push_eht_cap_phy(mut self, value: &[u8]) -> Self {
18846 push_header(self.as_rec_mut(), 9u16, value.len() as u16);
18847 self.as_rec_mut().extend(value);
18848 self
18849 }
18850 pub fn push_eht_cap_mcs_set(mut self, value: &[u8]) -> Self {
18851 push_header(self.as_rec_mut(), 10u16, value.len() as u16);
18852 self.as_rec_mut().extend(value);
18853 self
18854 }
18855 pub fn push_eht_cap_ppe(mut self, value: &[u8]) -> Self {
18856 push_header(self.as_rec_mut(), 11u16, value.len() as u16);
18857 self.as_rec_mut().extend(value);
18858 self
18859 }
18860}
18861impl<Prev: Rec> Drop for PushIftypeDataAttrs<Prev> {
18862 fn drop(&mut self) {
18863 if let Some(prev) = &mut self.prev {
18864 if let Some(header_offset) = &self.header_offset {
18865 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18866 }
18867 }
18868 }
18869}
18870pub struct PushIftypeAttrs<Prev: Rec> {
18871 pub(crate) prev: Option<Prev>,
18872 pub(crate) header_offset: Option<usize>,
18873}
18874impl<Prev: Rec> Rec for PushIftypeAttrs<Prev> {
18875 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
18876 self.prev.as_mut().unwrap().as_rec_mut()
18877 }
18878}
18879impl<Prev: Rec> PushIftypeAttrs<Prev> {
18880 pub fn new(prev: Prev) -> Self {
18881 Self {
18882 prev: Some(prev),
18883 header_offset: None,
18884 }
18885 }
18886 pub fn end_nested(mut self) -> Prev {
18887 let mut prev = self.prev.take().unwrap();
18888 if let Some(header_offset) = &self.header_offset {
18889 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18890 }
18891 prev
18892 }
18893 pub fn nested_unspecified(mut self) -> PushFrameTypeAttrs<Self> {
18894 let header_offset = push_nested_header(self.as_rec_mut(), 0u16);
18895 PushFrameTypeAttrs {
18896 prev: Some(self),
18897 header_offset: Some(header_offset),
18898 }
18899 }
18900 pub fn nested_adhoc(mut self) -> PushFrameTypeAttrs<Self> {
18901 let header_offset = push_nested_header(self.as_rec_mut(), 1u16);
18902 PushFrameTypeAttrs {
18903 prev: Some(self),
18904 header_offset: Some(header_offset),
18905 }
18906 }
18907 pub fn nested_station(mut self) -> PushFrameTypeAttrs<Self> {
18908 let header_offset = push_nested_header(self.as_rec_mut(), 2u16);
18909 PushFrameTypeAttrs {
18910 prev: Some(self),
18911 header_offset: Some(header_offset),
18912 }
18913 }
18914 pub fn nested_ap(mut self) -> PushFrameTypeAttrs<Self> {
18915 let header_offset = push_nested_header(self.as_rec_mut(), 3u16);
18916 PushFrameTypeAttrs {
18917 prev: Some(self),
18918 header_offset: Some(header_offset),
18919 }
18920 }
18921 pub fn nested_ap_vlan(mut self) -> PushFrameTypeAttrs<Self> {
18922 let header_offset = push_nested_header(self.as_rec_mut(), 4u16);
18923 PushFrameTypeAttrs {
18924 prev: Some(self),
18925 header_offset: Some(header_offset),
18926 }
18927 }
18928 pub fn nested_wds(mut self) -> PushFrameTypeAttrs<Self> {
18929 let header_offset = push_nested_header(self.as_rec_mut(), 5u16);
18930 PushFrameTypeAttrs {
18931 prev: Some(self),
18932 header_offset: Some(header_offset),
18933 }
18934 }
18935 pub fn nested_monitor(mut self) -> PushFrameTypeAttrs<Self> {
18936 let header_offset = push_nested_header(self.as_rec_mut(), 6u16);
18937 PushFrameTypeAttrs {
18938 prev: Some(self),
18939 header_offset: Some(header_offset),
18940 }
18941 }
18942 pub fn nested_mesh_point(mut self) -> PushFrameTypeAttrs<Self> {
18943 let header_offset = push_nested_header(self.as_rec_mut(), 7u16);
18944 PushFrameTypeAttrs {
18945 prev: Some(self),
18946 header_offset: Some(header_offset),
18947 }
18948 }
18949 pub fn nested_p2p_client(mut self) -> PushFrameTypeAttrs<Self> {
18950 let header_offset = push_nested_header(self.as_rec_mut(), 8u16);
18951 PushFrameTypeAttrs {
18952 prev: Some(self),
18953 header_offset: Some(header_offset),
18954 }
18955 }
18956 pub fn nested_p2p_go(mut self) -> PushFrameTypeAttrs<Self> {
18957 let header_offset = push_nested_header(self.as_rec_mut(), 9u16);
18958 PushFrameTypeAttrs {
18959 prev: Some(self),
18960 header_offset: Some(header_offset),
18961 }
18962 }
18963 pub fn nested_p2p_device(mut self) -> PushFrameTypeAttrs<Self> {
18964 let header_offset = push_nested_header(self.as_rec_mut(), 10u16);
18965 PushFrameTypeAttrs {
18966 prev: Some(self),
18967 header_offset: Some(header_offset),
18968 }
18969 }
18970 pub fn nested_ocb(mut self) -> PushFrameTypeAttrs<Self> {
18971 let header_offset = push_nested_header(self.as_rec_mut(), 11u16);
18972 PushFrameTypeAttrs {
18973 prev: Some(self),
18974 header_offset: Some(header_offset),
18975 }
18976 }
18977 pub fn nested_nan(mut self) -> PushFrameTypeAttrs<Self> {
18978 let header_offset = push_nested_header(self.as_rec_mut(), 12u16);
18979 PushFrameTypeAttrs {
18980 prev: Some(self),
18981 header_offset: Some(header_offset),
18982 }
18983 }
18984}
18985impl<Prev: Rec> Drop for PushIftypeAttrs<Prev> {
18986 fn drop(&mut self) {
18987 if let Some(prev) = &mut self.prev {
18988 if let Some(header_offset) = &self.header_offset {
18989 finalize_nested_header(prev.as_rec_mut(), *header_offset);
18990 }
18991 }
18992 }
18993}
18994pub struct PushSarAttributes<Prev: Rec> {
18995 pub(crate) prev: Option<Prev>,
18996 pub(crate) header_offset: Option<usize>,
18997}
18998impl<Prev: Rec> Rec for PushSarAttributes<Prev> {
18999 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
19000 self.prev.as_mut().unwrap().as_rec_mut()
19001 }
19002}
19003pub struct PushArraySarSpecs<Prev: Rec> {
19004 pub(crate) prev: Option<Prev>,
19005 pub(crate) header_offset: Option<usize>,
19006 pub(crate) counter: u16,
19007}
19008impl<Prev: Rec> Rec for PushArraySarSpecs<Prev> {
19009 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
19010 self.prev.as_mut().unwrap().as_rec_mut()
19011 }
19012}
19013impl<Prev: Rec> PushArraySarSpecs<Prev> {
19014 pub fn new(prev: Prev) -> Self {
19015 Self {
19016 prev: Some(prev),
19017 header_offset: None,
19018 counter: 0,
19019 }
19020 }
19021 pub fn end_array(mut self) -> Prev {
19022 let mut prev = self.prev.take().unwrap();
19023 if let Some(header_offset) = &self.header_offset {
19024 finalize_nested_header(prev.as_rec_mut(), *header_offset);
19025 }
19026 prev
19027 }
19028 pub fn entry_nested(mut self) -> PushSarSpecs<Self> {
19029 let index = self.counter;
19030 self.counter += 1;
19031 let header_offset = push_nested_header(self.as_rec_mut(), index);
19032 PushSarSpecs {
19033 prev: Some(self),
19034 header_offset: Some(header_offset),
19035 }
19036 }
19037}
19038impl<Prev: Rec> Drop for PushArraySarSpecs<Prev> {
19039 fn drop(&mut self) {
19040 if let Some(prev) = &mut self.prev {
19041 if let Some(header_offset) = &self.header_offset {
19042 finalize_nested_header(prev.as_rec_mut(), *header_offset);
19043 }
19044 }
19045 }
19046}
19047impl<Prev: Rec> PushSarAttributes<Prev> {
19048 pub fn new(prev: Prev) -> Self {
19049 Self {
19050 prev: Some(prev),
19051 header_offset: None,
19052 }
19053 }
19054 pub fn end_nested(mut self) -> Prev {
19055 let mut prev = self.prev.take().unwrap();
19056 if let Some(header_offset) = &self.header_offset {
19057 finalize_nested_header(prev.as_rec_mut(), *header_offset);
19058 }
19059 prev
19060 }
19061 pub fn push_type(mut self, value: u32) -> Self {
19062 push_header(self.as_rec_mut(), 1u16, 4 as u16);
19063 self.as_rec_mut().extend(value.to_ne_bytes());
19064 self
19065 }
19066 pub fn array_specs(mut self) -> PushArraySarSpecs<Self> {
19067 let header_offset = push_nested_header(self.as_rec_mut(), 2u16);
19068 PushArraySarSpecs {
19069 prev: Some(self),
19070 header_offset: Some(header_offset),
19071 counter: 0,
19072 }
19073 }
19074}
19075impl<Prev: Rec> Drop for PushSarAttributes<Prev> {
19076 fn drop(&mut self) {
19077 if let Some(prev) = &mut self.prev {
19078 if let Some(header_offset) = &self.header_offset {
19079 finalize_nested_header(prev.as_rec_mut(), *header_offset);
19080 }
19081 }
19082 }
19083}
19084pub struct PushSarSpecs<Prev: Rec> {
19085 pub(crate) prev: Option<Prev>,
19086 pub(crate) header_offset: Option<usize>,
19087}
19088impl<Prev: Rec> Rec for PushSarSpecs<Prev> {
19089 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
19090 self.prev.as_mut().unwrap().as_rec_mut()
19091 }
19092}
19093impl<Prev: Rec> PushSarSpecs<Prev> {
19094 pub fn new(prev: Prev) -> Self {
19095 Self {
19096 prev: Some(prev),
19097 header_offset: None,
19098 }
19099 }
19100 pub fn end_nested(mut self) -> Prev {
19101 let mut prev = self.prev.take().unwrap();
19102 if let Some(header_offset) = &self.header_offset {
19103 finalize_nested_header(prev.as_rec_mut(), *header_offset);
19104 }
19105 prev
19106 }
19107 pub fn push_power(mut self, value: i32) -> Self {
19108 push_header(self.as_rec_mut(), 1u16, 4 as u16);
19109 self.as_rec_mut().extend(value.to_ne_bytes());
19110 self
19111 }
19112 pub fn push_range_index(mut self, value: u32) -> Self {
19113 push_header(self.as_rec_mut(), 2u16, 4 as u16);
19114 self.as_rec_mut().extend(value.to_ne_bytes());
19115 self
19116 }
19117 pub fn push_start_freq(mut self, value: u32) -> Self {
19118 push_header(self.as_rec_mut(), 3u16, 4 as u16);
19119 self.as_rec_mut().extend(value.to_ne_bytes());
19120 self
19121 }
19122 pub fn push_end_freq(mut self, value: u32) -> Self {
19123 push_header(self.as_rec_mut(), 4u16, 4 as u16);
19124 self.as_rec_mut().extend(value.to_ne_bytes());
19125 self
19126 }
19127}
19128impl<Prev: Rec> Drop for PushSarSpecs<Prev> {
19129 fn drop(&mut self) {
19130 if let Some(prev) = &mut self.prev {
19131 if let Some(header_offset) = &self.header_offset {
19132 finalize_nested_header(prev.as_rec_mut(), *header_offset);
19133 }
19134 }
19135 }
19136}
19137pub struct PushSupportedIftypes<Prev: Rec> {
19138 pub(crate) prev: Option<Prev>,
19139 pub(crate) header_offset: Option<usize>,
19140}
19141impl<Prev: Rec> Rec for PushSupportedIftypes<Prev> {
19142 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
19143 self.prev.as_mut().unwrap().as_rec_mut()
19144 }
19145}
19146impl<Prev: Rec> PushSupportedIftypes<Prev> {
19147 pub fn new(prev: Prev) -> Self {
19148 Self {
19149 prev: Some(prev),
19150 header_offset: None,
19151 }
19152 }
19153 pub fn end_nested(mut self) -> Prev {
19154 let mut prev = self.prev.take().unwrap();
19155 if let Some(header_offset) = &self.header_offset {
19156 finalize_nested_header(prev.as_rec_mut(), *header_offset);
19157 }
19158 prev
19159 }
19160 pub fn push_adhoc(mut self, value: ()) -> Self {
19161 push_header(self.as_rec_mut(), 1u16, 0 as u16);
19162 self
19163 }
19164 pub fn push_station(mut self, value: ()) -> Self {
19165 push_header(self.as_rec_mut(), 2u16, 0 as u16);
19166 self
19167 }
19168 pub fn push_ap(mut self, value: ()) -> Self {
19169 push_header(self.as_rec_mut(), 3u16, 0 as u16);
19170 self
19171 }
19172 pub fn push_ap_vlan(mut self, value: ()) -> Self {
19173 push_header(self.as_rec_mut(), 4u16, 0 as u16);
19174 self
19175 }
19176 pub fn push_wds(mut self, value: ()) -> Self {
19177 push_header(self.as_rec_mut(), 5u16, 0 as u16);
19178 self
19179 }
19180 pub fn push_monitor(mut self, value: ()) -> Self {
19181 push_header(self.as_rec_mut(), 6u16, 0 as u16);
19182 self
19183 }
19184 pub fn push_mesh_point(mut self, value: ()) -> Self {
19185 push_header(self.as_rec_mut(), 7u16, 0 as u16);
19186 self
19187 }
19188 pub fn push_p2p_client(mut self, value: ()) -> Self {
19189 push_header(self.as_rec_mut(), 8u16, 0 as u16);
19190 self
19191 }
19192 pub fn push_p2p_go(mut self, value: ()) -> Self {
19193 push_header(self.as_rec_mut(), 9u16, 0 as u16);
19194 self
19195 }
19196 pub fn push_p2p_device(mut self, value: ()) -> Self {
19197 push_header(self.as_rec_mut(), 10u16, 0 as u16);
19198 self
19199 }
19200 pub fn push_ocb(mut self, value: ()) -> Self {
19201 push_header(self.as_rec_mut(), 11u16, 0 as u16);
19202 self
19203 }
19204 pub fn push_nan(mut self, value: ()) -> Self {
19205 push_header(self.as_rec_mut(), 12u16, 0 as u16);
19206 self
19207 }
19208}
19209impl<Prev: Rec> Drop for PushSupportedIftypes<Prev> {
19210 fn drop(&mut self) {
19211 if let Some(prev) = &mut self.prev {
19212 if let Some(header_offset) = &self.header_offset {
19213 finalize_nested_header(prev.as_rec_mut(), *header_offset);
19214 }
19215 }
19216 }
19217}
19218pub struct PushTxqStatsAttrs<Prev: Rec> {
19219 pub(crate) prev: Option<Prev>,
19220 pub(crate) header_offset: Option<usize>,
19221}
19222impl<Prev: Rec> Rec for PushTxqStatsAttrs<Prev> {
19223 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
19224 self.prev.as_mut().unwrap().as_rec_mut()
19225 }
19226}
19227impl<Prev: Rec> PushTxqStatsAttrs<Prev> {
19228 pub fn new(prev: Prev) -> Self {
19229 Self {
19230 prev: Some(prev),
19231 header_offset: None,
19232 }
19233 }
19234 pub fn end_nested(mut self) -> Prev {
19235 let mut prev = self.prev.take().unwrap();
19236 if let Some(header_offset) = &self.header_offset {
19237 finalize_nested_header(prev.as_rec_mut(), *header_offset);
19238 }
19239 prev
19240 }
19241 pub fn push_backlog_bytes(mut self, value: u32) -> Self {
19242 push_header(self.as_rec_mut(), 1u16, 4 as u16);
19243 self.as_rec_mut().extend(value.to_ne_bytes());
19244 self
19245 }
19246 pub fn push_backlog_packets(mut self, value: u32) -> Self {
19247 push_header(self.as_rec_mut(), 2u16, 4 as u16);
19248 self.as_rec_mut().extend(value.to_ne_bytes());
19249 self
19250 }
19251 pub fn push_flows(mut self, value: u32) -> Self {
19252 push_header(self.as_rec_mut(), 3u16, 4 as u16);
19253 self.as_rec_mut().extend(value.to_ne_bytes());
19254 self
19255 }
19256 pub fn push_drops(mut self, value: u32) -> Self {
19257 push_header(self.as_rec_mut(), 4u16, 4 as u16);
19258 self.as_rec_mut().extend(value.to_ne_bytes());
19259 self
19260 }
19261 pub fn push_ecn_marks(mut self, value: u32) -> Self {
19262 push_header(self.as_rec_mut(), 5u16, 4 as u16);
19263 self.as_rec_mut().extend(value.to_ne_bytes());
19264 self
19265 }
19266 pub fn push_overlimit(mut self, value: u32) -> Self {
19267 push_header(self.as_rec_mut(), 6u16, 4 as u16);
19268 self.as_rec_mut().extend(value.to_ne_bytes());
19269 self
19270 }
19271 pub fn push_overmemory(mut self, value: u32) -> Self {
19272 push_header(self.as_rec_mut(), 7u16, 4 as u16);
19273 self.as_rec_mut().extend(value.to_ne_bytes());
19274 self
19275 }
19276 pub fn push_collisions(mut self, value: u32) -> Self {
19277 push_header(self.as_rec_mut(), 8u16, 4 as u16);
19278 self.as_rec_mut().extend(value.to_ne_bytes());
19279 self
19280 }
19281 pub fn push_tx_bytes(mut self, value: u32) -> Self {
19282 push_header(self.as_rec_mut(), 9u16, 4 as u16);
19283 self.as_rec_mut().extend(value.to_ne_bytes());
19284 self
19285 }
19286 pub fn push_tx_packets(mut self, value: u32) -> Self {
19287 push_header(self.as_rec_mut(), 10u16, 4 as u16);
19288 self.as_rec_mut().extend(value.to_ne_bytes());
19289 self
19290 }
19291 pub fn push_max_flows(mut self, value: u32) -> Self {
19292 push_header(self.as_rec_mut(), 11u16, 4 as u16);
19293 self.as_rec_mut().extend(value.to_ne_bytes());
19294 self
19295 }
19296}
19297impl<Prev: Rec> Drop for PushTxqStatsAttrs<Prev> {
19298 fn drop(&mut self) {
19299 if let Some(prev) = &mut self.prev {
19300 if let Some(header_offset) = &self.header_offset {
19301 finalize_nested_header(prev.as_rec_mut(), *header_offset);
19302 }
19303 }
19304 }
19305}
19306pub struct PushWmmAttrs<Prev: Rec> {
19307 pub(crate) prev: Option<Prev>,
19308 pub(crate) header_offset: Option<usize>,
19309}
19310impl<Prev: Rec> Rec for PushWmmAttrs<Prev> {
19311 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
19312 self.prev.as_mut().unwrap().as_rec_mut()
19313 }
19314}
19315impl<Prev: Rec> PushWmmAttrs<Prev> {
19316 pub fn new(prev: Prev) -> Self {
19317 Self {
19318 prev: Some(prev),
19319 header_offset: None,
19320 }
19321 }
19322 pub fn end_nested(mut self) -> Prev {
19323 let mut prev = self.prev.take().unwrap();
19324 if let Some(header_offset) = &self.header_offset {
19325 finalize_nested_header(prev.as_rec_mut(), *header_offset);
19326 }
19327 prev
19328 }
19329 pub fn push_cw_min(mut self, value: u16) -> Self {
19330 push_header(self.as_rec_mut(), 1u16, 2 as u16);
19331 self.as_rec_mut().extend(value.to_ne_bytes());
19332 self
19333 }
19334 pub fn push_cw_max(mut self, value: u16) -> Self {
19335 push_header(self.as_rec_mut(), 2u16, 2 as u16);
19336 self.as_rec_mut().extend(value.to_ne_bytes());
19337 self
19338 }
19339 pub fn push_aifsn(mut self, value: u8) -> Self {
19340 push_header(self.as_rec_mut(), 3u16, 1 as u16);
19341 self.as_rec_mut().extend(value.to_ne_bytes());
19342 self
19343 }
19344 pub fn push_txop(mut self, value: u16) -> Self {
19345 push_header(self.as_rec_mut(), 4u16, 2 as u16);
19346 self.as_rec_mut().extend(value.to_ne_bytes());
19347 self
19348 }
19349}
19350impl<Prev: Rec> Drop for PushWmmAttrs<Prev> {
19351 fn drop(&mut self) {
19352 if let Some(prev) = &mut self.prev {
19353 if let Some(header_offset) = &self.header_offset {
19354 finalize_nested_header(prev.as_rec_mut(), *header_offset);
19355 }
19356 }
19357 }
19358}
19359pub struct PushWowlanTriggersAttrs<Prev: Rec> {
19360 pub(crate) prev: Option<Prev>,
19361 pub(crate) header_offset: Option<usize>,
19362}
19363impl<Prev: Rec> Rec for PushWowlanTriggersAttrs<Prev> {
19364 fn as_rec_mut(&mut self) -> &mut Vec<u8> {
19365 self.prev.as_mut().unwrap().as_rec_mut()
19366 }
19367}
19368impl<Prev: Rec> PushWowlanTriggersAttrs<Prev> {
19369 pub fn new(prev: Prev) -> Self {
19370 Self {
19371 prev: Some(prev),
19372 header_offset: None,
19373 }
19374 }
19375 pub fn end_nested(mut self) -> Prev {
19376 let mut prev = self.prev.take().unwrap();
19377 if let Some(header_offset) = &self.header_offset {
19378 finalize_nested_header(prev.as_rec_mut(), *header_offset);
19379 }
19380 prev
19381 }
19382 pub fn push_any(mut self, value: ()) -> Self {
19383 push_header(self.as_rec_mut(), 1u16, 0 as u16);
19384 self
19385 }
19386 pub fn push_disconnect(mut self, value: ()) -> Self {
19387 push_header(self.as_rec_mut(), 2u16, 0 as u16);
19388 self
19389 }
19390 pub fn push_magic_pkt(mut self, value: ()) -> Self {
19391 push_header(self.as_rec_mut(), 3u16, 0 as u16);
19392 self
19393 }
19394 pub fn push_pkt_pattern(mut self, value: ()) -> Self {
19395 push_header(self.as_rec_mut(), 4u16, 0 as u16);
19396 self
19397 }
19398 pub fn push_gtk_rekey_supported(mut self, value: ()) -> Self {
19399 push_header(self.as_rec_mut(), 5u16, 0 as u16);
19400 self
19401 }
19402 pub fn push_gtk_rekey_failure(mut self, value: ()) -> Self {
19403 push_header(self.as_rec_mut(), 6u16, 0 as u16);
19404 self
19405 }
19406 pub fn push_eap_ident_request(mut self, value: ()) -> Self {
19407 push_header(self.as_rec_mut(), 7u16, 0 as u16);
19408 self
19409 }
19410 pub fn push_4way_handshake(mut self, value: ()) -> Self {
19411 push_header(self.as_rec_mut(), 8u16, 0 as u16);
19412 self
19413 }
19414 pub fn push_rfkill_release(mut self, value: ()) -> Self {
19415 push_header(self.as_rec_mut(), 9u16, 0 as u16);
19416 self
19417 }
19418 pub fn push_wakeup_pkt_80211(mut self, value: ()) -> Self {
19419 push_header(self.as_rec_mut(), 10u16, 0 as u16);
19420 self
19421 }
19422 pub fn push_wakeup_pkt_80211_len(mut self, value: ()) -> Self {
19423 push_header(self.as_rec_mut(), 11u16, 0 as u16);
19424 self
19425 }
19426 pub fn push_wakeup_pkt_8023(mut self, value: ()) -> Self {
19427 push_header(self.as_rec_mut(), 12u16, 0 as u16);
19428 self
19429 }
19430 pub fn push_wakeup_pkt_8023_len(mut self, value: ()) -> Self {
19431 push_header(self.as_rec_mut(), 13u16, 0 as u16);
19432 self
19433 }
19434 pub fn push_tcp_connection(mut self, value: ()) -> Self {
19435 push_header(self.as_rec_mut(), 14u16, 0 as u16);
19436 self
19437 }
19438 pub fn push_wakeup_tcp_match(mut self, value: ()) -> Self {
19439 push_header(self.as_rec_mut(), 15u16, 0 as u16);
19440 self
19441 }
19442 pub fn push_wakeup_tcp_connlost(mut self, value: ()) -> Self {
19443 push_header(self.as_rec_mut(), 16u16, 0 as u16);
19444 self
19445 }
19446 pub fn push_wakeup_tcp_nomoretokens(mut self, value: ()) -> Self {
19447 push_header(self.as_rec_mut(), 17u16, 0 as u16);
19448 self
19449 }
19450 pub fn push_net_detect(mut self, value: ()) -> Self {
19451 push_header(self.as_rec_mut(), 18u16, 0 as u16);
19452 self
19453 }
19454 pub fn push_net_detect_results(mut self, value: ()) -> Self {
19455 push_header(self.as_rec_mut(), 19u16, 0 as u16);
19456 self
19457 }
19458 pub fn push_unprotected_deauth_disassoc(mut self, value: ()) -> Self {
19459 push_header(self.as_rec_mut(), 20u16, 0 as u16);
19460 self
19461 }
19462}
19463impl<Prev: Rec> Drop for PushWowlanTriggersAttrs<Prev> {
19464 fn drop(&mut self) {
19465 if let Some(prev) = &mut self.prev {
19466 if let Some(header_offset) = &self.header_offset {
19467 finalize_nested_header(prev.as_rec_mut(), *header_offset);
19468 }
19469 }
19470 }
19471}
19472#[derive(Clone)]
19473pub struct PushStaFlagUpdate {
19474 pub(crate) buf: [u8; 8usize],
19475}
19476#[doc = "Create zero-initialized struct"]
19477impl Default for PushStaFlagUpdate {
19478 fn default() -> Self {
19479 Self { buf: [0u8; 8usize] }
19480 }
19481}
19482impl PushStaFlagUpdate {
19483 #[doc = "Create zero-initialized struct"]
19484 pub fn new() -> Self {
19485 Default::default()
19486 }
19487 #[doc = "Copy from contents from other slice"]
19488 pub fn new_from_slice(other: &[u8]) -> Option<Self> {
19489 if other.len() != Self::len() {
19490 return None;
19491 }
19492 let mut buf = [0u8; Self::len()];
19493 buf.clone_from_slice(other);
19494 Some(Self { buf })
19495 }
19496 pub fn as_slice(&self) -> &[u8] {
19497 &self.buf
19498 }
19499 pub fn as_mut_slice(&mut self) -> &mut [u8] {
19500 &mut self.buf
19501 }
19502 pub const fn len() -> usize {
19503 8usize
19504 }
19505 pub fn mask(&self) -> u32 {
19506 parse_u32(&self.buf[0usize..4usize]).unwrap()
19507 }
19508 pub fn set_mask(&mut self, value: u32) {
19509 self.buf[0usize..4usize].copy_from_slice(&value.to_ne_bytes())
19510 }
19511 pub fn set(&self) -> u32 {
19512 parse_u32(&self.buf[4usize..8usize]).unwrap()
19513 }
19514 pub fn set_set(&mut self, value: u32) {
19515 self.buf[4usize..8usize].copy_from_slice(&value.to_ne_bytes())
19516 }
19517}
19518impl std::fmt::Debug for PushStaFlagUpdate {
19519 fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19520 fmt.debug_struct("StaFlagUpdate")
19521 .field("mask", &self.mask())
19522 .field("set", &self.set())
19523 .finish()
19524 }
19525}
19526#[derive(Debug)]
19527pub struct RequestOpGetWiphyDumpRequest<'r> {
19528 request: Request<'r>,
19529}
19530impl<'r> RequestOpGetWiphyDumpRequest<'r> {
19531 pub fn new(mut request: Request<'r>) -> Self {
19532 Self::write_header(&mut request.buf_mut());
19533 Self {
19534 request: request.set_dump(),
19535 }
19536 }
19537 pub fn encode(&mut self) -> PushNl80211Attrs<&mut Vec<u8>> {
19538 PushNl80211Attrs::new(self.request.buf_mut())
19539 }
19540 pub fn into_encoder(self) -> PushNl80211Attrs<RequestBuf<'r>> {
19541 PushNl80211Attrs::new(self.request.buf)
19542 }
19543 fn write_header<Prev: Rec>(prev: &mut Prev) {
19544 let mut header = PushBuiltinNfgenmsg::new();
19545 header.set_cmd(1u8);
19546 header.set_version(1u8);
19547 prev.as_rec_mut().extend(header.as_slice());
19548 }
19549 fn decode<'a>(buf: &'a [u8]) -> IterableNl80211Attrs<'a> {
19550 let (_header, attrs) = buf.split_at(buf.len().min(PushBuiltinNfgenmsg::len()));
19551 IterableNl80211Attrs::with_loc(attrs, buf.as_ptr() as usize)
19552 }
19553}
19554impl NetlinkRequest for RequestOpGetWiphyDumpRequest<'_> {
19555 type ReplyType<'buf> = IterableNl80211Attrs<'buf>;
19556 fn protocol(&self) -> Protocol {
19557 Protocol::Generic("nl80211".as_bytes())
19558 }
19559 fn flags(&self) -> u16 {
19560 self.request.flags
19561 }
19562 fn payload(&self) -> &[u8] {
19563 self.request.buf()
19564 }
19565 fn decode_reply<'buf>(buf: &'buf [u8]) -> Self::ReplyType<'buf> {
19566 Self::decode(buf)
19567 }
19568 fn lookup(
19569 buf: &[u8],
19570 offset: usize,
19571 missing_type: Option<u16>,
19572 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
19573 Self::decode(buf).lookup_attr(offset, missing_type)
19574 }
19575}
19576#[derive(Debug)]
19577pub struct RequestOpGetWiphyDoRequest<'r> {
19578 request: Request<'r>,
19579}
19580impl<'r> RequestOpGetWiphyDoRequest<'r> {
19581 pub fn new(mut request: Request<'r>) -> Self {
19582 Self::write_header(&mut request.buf_mut());
19583 Self { request: request }
19584 }
19585 pub fn encode(&mut self) -> PushNl80211Attrs<&mut Vec<u8>> {
19586 PushNl80211Attrs::new(self.request.buf_mut())
19587 }
19588 pub fn into_encoder(self) -> PushNl80211Attrs<RequestBuf<'r>> {
19589 PushNl80211Attrs::new(self.request.buf)
19590 }
19591 fn write_header<Prev: Rec>(prev: &mut Prev) {
19592 let mut header = PushBuiltinNfgenmsg::new();
19593 header.set_cmd(1u8);
19594 header.set_version(1u8);
19595 prev.as_rec_mut().extend(header.as_slice());
19596 }
19597 fn decode<'a>(buf: &'a [u8]) -> IterableNl80211Attrs<'a> {
19598 let (_header, attrs) = buf.split_at(buf.len().min(PushBuiltinNfgenmsg::len()));
19599 IterableNl80211Attrs::with_loc(attrs, buf.as_ptr() as usize)
19600 }
19601}
19602impl NetlinkRequest for RequestOpGetWiphyDoRequest<'_> {
19603 type ReplyType<'buf> = IterableNl80211Attrs<'buf>;
19604 fn protocol(&self) -> Protocol {
19605 Protocol::Generic("nl80211".as_bytes())
19606 }
19607 fn flags(&self) -> u16 {
19608 self.request.flags
19609 }
19610 fn payload(&self) -> &[u8] {
19611 self.request.buf()
19612 }
19613 fn decode_reply<'buf>(buf: &'buf [u8]) -> Self::ReplyType<'buf> {
19614 Self::decode(buf)
19615 }
19616 fn lookup(
19617 buf: &[u8],
19618 offset: usize,
19619 missing_type: Option<u16>,
19620 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
19621 Self::decode(buf).lookup_attr(offset, missing_type)
19622 }
19623}
19624#[derive(Debug)]
19625pub struct RequestOpGetInterfaceDumpRequest<'r> {
19626 request: Request<'r>,
19627}
19628impl<'r> RequestOpGetInterfaceDumpRequest<'r> {
19629 pub fn new(mut request: Request<'r>) -> Self {
19630 Self::write_header(&mut request.buf_mut());
19631 Self {
19632 request: request.set_dump(),
19633 }
19634 }
19635 pub fn encode(&mut self) -> PushNl80211Attrs<&mut Vec<u8>> {
19636 PushNl80211Attrs::new(self.request.buf_mut())
19637 }
19638 pub fn into_encoder(self) -> PushNl80211Attrs<RequestBuf<'r>> {
19639 PushNl80211Attrs::new(self.request.buf)
19640 }
19641 fn write_header<Prev: Rec>(prev: &mut Prev) {
19642 let mut header = PushBuiltinNfgenmsg::new();
19643 header.set_cmd(5u8);
19644 header.set_version(1u8);
19645 prev.as_rec_mut().extend(header.as_slice());
19646 }
19647 fn decode<'a>(buf: &'a [u8]) -> IterableNl80211Attrs<'a> {
19648 let (_header, attrs) = buf.split_at(buf.len().min(PushBuiltinNfgenmsg::len()));
19649 IterableNl80211Attrs::with_loc(attrs, buf.as_ptr() as usize)
19650 }
19651}
19652impl NetlinkRequest for RequestOpGetInterfaceDumpRequest<'_> {
19653 type ReplyType<'buf> = IterableNl80211Attrs<'buf>;
19654 fn protocol(&self) -> Protocol {
19655 Protocol::Generic("nl80211".as_bytes())
19656 }
19657 fn flags(&self) -> u16 {
19658 self.request.flags
19659 }
19660 fn payload(&self) -> &[u8] {
19661 self.request.buf()
19662 }
19663 fn decode_reply<'buf>(buf: &'buf [u8]) -> Self::ReplyType<'buf> {
19664 Self::decode(buf)
19665 }
19666 fn lookup(
19667 buf: &[u8],
19668 offset: usize,
19669 missing_type: Option<u16>,
19670 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
19671 Self::decode(buf).lookup_attr(offset, missing_type)
19672 }
19673}
19674#[derive(Debug)]
19675pub struct RequestOpGetInterfaceDoRequest<'r> {
19676 request: Request<'r>,
19677}
19678impl<'r> RequestOpGetInterfaceDoRequest<'r> {
19679 pub fn new(mut request: Request<'r>) -> Self {
19680 Self::write_header(&mut request.buf_mut());
19681 Self { request: request }
19682 }
19683 pub fn encode(&mut self) -> PushNl80211Attrs<&mut Vec<u8>> {
19684 PushNl80211Attrs::new(self.request.buf_mut())
19685 }
19686 pub fn into_encoder(self) -> PushNl80211Attrs<RequestBuf<'r>> {
19687 PushNl80211Attrs::new(self.request.buf)
19688 }
19689 fn write_header<Prev: Rec>(prev: &mut Prev) {
19690 let mut header = PushBuiltinNfgenmsg::new();
19691 header.set_cmd(5u8);
19692 header.set_version(1u8);
19693 prev.as_rec_mut().extend(header.as_slice());
19694 }
19695 fn decode<'a>(buf: &'a [u8]) -> IterableNl80211Attrs<'a> {
19696 let (_header, attrs) = buf.split_at(buf.len().min(PushBuiltinNfgenmsg::len()));
19697 IterableNl80211Attrs::with_loc(attrs, buf.as_ptr() as usize)
19698 }
19699}
19700impl NetlinkRequest for RequestOpGetInterfaceDoRequest<'_> {
19701 type ReplyType<'buf> = IterableNl80211Attrs<'buf>;
19702 fn protocol(&self) -> Protocol {
19703 Protocol::Generic("nl80211".as_bytes())
19704 }
19705 fn flags(&self) -> u16 {
19706 self.request.flags
19707 }
19708 fn payload(&self) -> &[u8] {
19709 self.request.buf()
19710 }
19711 fn decode_reply<'buf>(buf: &'buf [u8]) -> Self::ReplyType<'buf> {
19712 Self::decode(buf)
19713 }
19714 fn lookup(
19715 buf: &[u8],
19716 offset: usize,
19717 missing_type: Option<u16>,
19718 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
19719 Self::decode(buf).lookup_attr(offset, missing_type)
19720 }
19721}
19722#[derive(Debug)]
19723pub struct RequestOpGetProtocolFeaturesDoRequest<'r> {
19724 request: Request<'r>,
19725}
19726impl<'r> RequestOpGetProtocolFeaturesDoRequest<'r> {
19727 pub fn new(mut request: Request<'r>) -> Self {
19728 Self::write_header(&mut request.buf_mut());
19729 Self { request: request }
19730 }
19731 pub fn encode(&mut self) -> PushNl80211Attrs<&mut Vec<u8>> {
19732 PushNl80211Attrs::new(self.request.buf_mut())
19733 }
19734 pub fn into_encoder(self) -> PushNl80211Attrs<RequestBuf<'r>> {
19735 PushNl80211Attrs::new(self.request.buf)
19736 }
19737 fn write_header<Prev: Rec>(prev: &mut Prev) {
19738 let mut header = PushBuiltinNfgenmsg::new();
19739 header.set_cmd(95u8);
19740 header.set_version(1u8);
19741 prev.as_rec_mut().extend(header.as_slice());
19742 }
19743 fn decode<'a>(buf: &'a [u8]) -> IterableNl80211Attrs<'a> {
19744 let (_header, attrs) = buf.split_at(buf.len().min(PushBuiltinNfgenmsg::len()));
19745 IterableNl80211Attrs::with_loc(attrs, buf.as_ptr() as usize)
19746 }
19747}
19748impl NetlinkRequest for RequestOpGetProtocolFeaturesDoRequest<'_> {
19749 type ReplyType<'buf> = IterableNl80211Attrs<'buf>;
19750 fn protocol(&self) -> Protocol {
19751 Protocol::Generic("nl80211".as_bytes())
19752 }
19753 fn flags(&self) -> u16 {
19754 self.request.flags
19755 }
19756 fn payload(&self) -> &[u8] {
19757 self.request.buf()
19758 }
19759 fn decode_reply<'buf>(buf: &'buf [u8]) -> Self::ReplyType<'buf> {
19760 Self::decode(buf)
19761 }
19762 fn lookup(
19763 buf: &[u8],
19764 offset: usize,
19765 missing_type: Option<u16>,
19766 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
19767 Self::decode(buf).lookup_attr(offset, missing_type)
19768 }
19769}
19770#[derive(Debug)]
19771pub struct RequestOpDumpRequest<'r> {
19772 request: Request<'r>,
19773}
19774impl<'r> RequestOpDumpRequest<'r> {
19775 pub fn new(mut request: Request<'r>, request_type: u8) -> Self {
19776 Self::write_header(&mut request.buf_mut(), request_type);
19777 Self {
19778 request: request.set_dump(),
19779 }
19780 }
19781 pub fn encode(&mut self) -> PushNl80211Attrs<&mut Vec<u8>> {
19782 PushNl80211Attrs::new(self.request.buf_mut())
19783 }
19784 pub fn into_encoder(self) -> PushNl80211Attrs<RequestBuf<'r>> {
19785 PushNl80211Attrs::new(self.request.buf)
19786 }
19787 fn write_header<Prev: Rec>(prev: &mut Prev, request_type: u8) {
19788 let mut header = PushBuiltinNfgenmsg::new();
19789 header.set_cmd(request_type);
19790 header.set_version(1u8);
19791 prev.as_rec_mut().extend(header.as_slice());
19792 }
19793 fn decode<'a>(buf: &'a [u8]) -> IterableNl80211Attrs<'a> {
19794 let (_header, attrs) = buf.split_at(buf.len().min(PushBuiltinNfgenmsg::len()));
19795 IterableNl80211Attrs::with_loc(attrs, buf.as_ptr() as usize)
19796 }
19797}
19798impl NetlinkRequest for RequestOpDumpRequest<'_> {
19799 type ReplyType<'buf> = IterableNl80211Attrs<'buf>;
19800 fn protocol(&self) -> Protocol {
19801 Protocol::Generic("nl80211".as_bytes())
19802 }
19803 fn flags(&self) -> u16 {
19804 self.request.flags
19805 }
19806 fn payload(&self) -> &[u8] {
19807 self.request.buf()
19808 }
19809 fn decode_reply<'buf>(buf: &'buf [u8]) -> Self::ReplyType<'buf> {
19810 Self::decode(buf)
19811 }
19812 fn lookup(
19813 buf: &[u8],
19814 offset: usize,
19815 missing_type: Option<u16>,
19816 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
19817 Self::decode(buf).lookup_attr(offset, missing_type)
19818 }
19819}
19820#[derive(Debug)]
19821pub struct RequestOpDoRequest<'r> {
19822 request: Request<'r>,
19823}
19824impl<'r> RequestOpDoRequest<'r> {
19825 pub fn new(mut request: Request<'r>, request_type: u8) -> Self {
19826 Self::write_header(&mut request.buf_mut(), request_type);
19827 Self { request: request }
19828 }
19829 pub fn encode(&mut self) -> PushNl80211Attrs<&mut Vec<u8>> {
19830 PushNl80211Attrs::new(self.request.buf_mut())
19831 }
19832 pub fn into_encoder(self) -> PushNl80211Attrs<RequestBuf<'r>> {
19833 PushNl80211Attrs::new(self.request.buf)
19834 }
19835 fn write_header<Prev: Rec>(prev: &mut Prev, request_type: u8) {
19836 let mut header = PushBuiltinNfgenmsg::new();
19837 header.set_cmd(request_type);
19838 header.set_version(1u8);
19839 prev.as_rec_mut().extend(header.as_slice());
19840 }
19841 fn decode<'a>(buf: &'a [u8]) -> IterableNl80211Attrs<'a> {
19842 let (_header, attrs) = buf.split_at(buf.len().min(PushBuiltinNfgenmsg::len()));
19843 IterableNl80211Attrs::with_loc(attrs, buf.as_ptr() as usize)
19844 }
19845}
19846impl NetlinkRequest for RequestOpDoRequest<'_> {
19847 type ReplyType<'buf> = IterableNl80211Attrs<'buf>;
19848 fn protocol(&self) -> Protocol {
19849 Protocol::Generic("nl80211".as_bytes())
19850 }
19851 fn flags(&self) -> u16 {
19852 self.request.flags
19853 }
19854 fn payload(&self) -> &[u8] {
19855 self.request.buf()
19856 }
19857 fn decode_reply<'buf>(buf: &'buf [u8]) -> Self::ReplyType<'buf> {
19858 Self::decode(buf)
19859 }
19860 fn lookup(
19861 buf: &[u8],
19862 offset: usize,
19863 missing_type: Option<u16>,
19864 ) -> (Vec<(&'static str, usize)>, Option<&'static str>) {
19865 Self::decode(buf).lookup_attr(offset, missing_type)
19866 }
19867}
19868use crate::traits::LookupFn;
19869use crate::utils::RequestBuf;
19870#[derive(Debug)]
19871pub struct Request<'buf> {
19872 buf: RequestBuf<'buf>,
19873 flags: u16,
19874 writeback: Option<&'buf mut Option<RequestInfo>>,
19875}
19876#[allow(unused)]
19877#[derive(Debug, Clone)]
19878pub struct RequestInfo {
19879 protocol: Protocol,
19880 flags: u16,
19881 name: &'static str,
19882 lookup: LookupFn,
19883}
19884impl Request<'static> {
19885 pub fn new() -> Self {
19886 Self::new_from_buf(Vec::new())
19887 }
19888 pub fn new_from_buf(buf: Vec<u8>) -> Self {
19889 Self {
19890 flags: 0,
19891 buf: RequestBuf::Own(buf),
19892 writeback: None,
19893 }
19894 }
19895 pub fn into_buf(self) -> Vec<u8> {
19896 match self.buf {
19897 RequestBuf::Own(buf) => buf,
19898 _ => unreachable!(),
19899 }
19900 }
19901}
19902impl<'buf> Request<'buf> {
19903 pub fn new_with_buf(buf: &'buf mut Vec<u8>) -> Self {
19904 buf.clear();
19905 Self::new_extend(buf)
19906 }
19907 pub fn new_extend(buf: &'buf mut Vec<u8>) -> Self {
19908 Self {
19909 flags: 0,
19910 buf: RequestBuf::Ref(buf),
19911 writeback: None,
19912 }
19913 }
19914 fn do_writeback(&mut self, protocol: Protocol, name: &'static str, lookup: LookupFn) {
19915 let Some(writeback) = &mut self.writeback else {
19916 return;
19917 };
19918 **writeback = Some(RequestInfo {
19919 protocol,
19920 flags: self.flags,
19921 name,
19922 lookup,
19923 })
19924 }
19925 pub fn buf(&self) -> &Vec<u8> {
19926 self.buf.buf()
19927 }
19928 pub fn buf_mut(&mut self) -> &mut Vec<u8> {
19929 self.buf.buf_mut()
19930 }
19931 #[doc = "Set `NLM_F_CREATE` flag"]
19932 pub fn set_create(mut self) -> Self {
19933 self.flags |= consts::NLM_F_CREATE as u16;
19934 self
19935 }
19936 #[doc = "Set `NLM_F_EXCL` flag"]
19937 pub fn set_excl(mut self) -> Self {
19938 self.flags |= consts::NLM_F_EXCL as u16;
19939 self
19940 }
19941 #[doc = "Set `NLM_F_REPLACE` flag"]
19942 pub fn set_replace(mut self) -> Self {
19943 self.flags |= consts::NLM_F_REPLACE as u16;
19944 self
19945 }
19946 #[doc = "Set `NLM_F_CREATE` and `NLM_F_REPLACE` flag"]
19947 pub fn set_change(self) -> Self {
19948 self.set_create().set_replace()
19949 }
19950 #[doc = "Set `NLM_F_APPEND` flag"]
19951 pub fn set_append(mut self) -> Self {
19952 self.flags |= consts::NLM_F_APPEND as u16;
19953 self
19954 }
19955 #[doc = "Set `NLM_F_DUMP` flag"]
19956 fn set_dump(mut self) -> Self {
19957 self.flags |= consts::NLM_F_DUMP as u16;
19958 self
19959 }
19960 pub fn op_get_wiphy_dump_request(self) -> RequestOpGetWiphyDumpRequest<'buf> {
19961 let mut res = RequestOpGetWiphyDumpRequest::new(self);
19962 res.request.do_writeback(
19963 res.protocol(),
19964 "op-get-wiphy-dump-request",
19965 RequestOpGetWiphyDumpRequest::lookup,
19966 );
19967 res
19968 }
19969 pub fn op_get_wiphy_do_request(self) -> RequestOpGetWiphyDoRequest<'buf> {
19970 let mut res = RequestOpGetWiphyDoRequest::new(self);
19971 res.request.do_writeback(
19972 res.protocol(),
19973 "op-get-wiphy-do-request",
19974 RequestOpGetWiphyDoRequest::lookup,
19975 );
19976 res
19977 }
19978 pub fn op_get_interface_dump_request(self) -> RequestOpGetInterfaceDumpRequest<'buf> {
19979 let mut res = RequestOpGetInterfaceDumpRequest::new(self);
19980 res.request.do_writeback(
19981 res.protocol(),
19982 "op-get-interface-dump-request",
19983 RequestOpGetInterfaceDumpRequest::lookup,
19984 );
19985 res
19986 }
19987 pub fn op_get_interface_do_request(self) -> RequestOpGetInterfaceDoRequest<'buf> {
19988 let mut res = RequestOpGetInterfaceDoRequest::new(self);
19989 res.request.do_writeback(
19990 res.protocol(),
19991 "op-get-interface-do-request",
19992 RequestOpGetInterfaceDoRequest::lookup,
19993 );
19994 res
19995 }
19996 pub fn op_get_protocol_features_do_request(
19997 self,
19998 ) -> RequestOpGetProtocolFeaturesDoRequest<'buf> {
19999 let mut res = RequestOpGetProtocolFeaturesDoRequest::new(self);
20000 res.request.do_writeback(
20001 res.protocol(),
20002 "op-get-protocol-features-do-request",
20003 RequestOpGetProtocolFeaturesDoRequest::lookup,
20004 );
20005 res
20006 }
20007 pub fn op_dump_request(self, request_type: u8) -> RequestOpDumpRequest<'buf> {
20008 let mut res = RequestOpDumpRequest::new(self, request_type);
20009 res.request.do_writeback(
20010 res.protocol(),
20011 "op-dump-request",
20012 RequestOpDumpRequest::lookup,
20013 );
20014 res
20015 }
20016 pub fn op_do_request(self, request_type: u8) -> RequestOpDoRequest<'buf> {
20017 let mut res = RequestOpDoRequest::new(self, request_type);
20018 res.request
20019 .do_writeback(res.protocol(), "op-do-request", RequestOpDoRequest::lookup);
20020 res
20021 }
20022}