1#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub type MacAddr = [u8; 6];
12
13pub type Ssid = Vec<u8>;
14
15pub const CCMP_128_MIC_LEN: u32 = 8;
16
17pub const CCMP_256_MIC_LEN: u32 = 16;
18
19pub const CCMP_HDR_LEN: u32 = 8;
21
22pub const CCMP_PN_LEN: u32 = 6;
23
24pub const HT_CAP_LEN: u8 = 26;
25
26pub const HT_OP_LEN: u8 = 22;
27
28pub const MAC_ADDR_LEN: u8 = 6;
29
30pub const MAX_KEY_LEN: u8 = 32;
31
32pub const MAX_MESH_ID_BYTE_LEN: u8 = 32;
34
35pub const MAX_MGMT_FRAME_MAC_HEADER_BYTE_LEN: u8 = 28;
37
38pub const MAX_MMPDU_BYTE_LEN: u16 = 2304;
40
41pub const MAX_SSID_BYTE_LEN: u8 = 32;
48
49pub const MAX_SUPPORTED_BASIC_RATES: u8 = 12;
50
51pub const MAX_UNIQUE_CHANNEL_NUMBERS: u16 = 256;
56
57pub const MAX_VHT_MPDU_BYTE_LEN_0: u16 = 3895;
58
59pub const MAX_VHT_MPDU_BYTE_LEN_1: u16 = 7991;
60
61pub const MAX_VHT_MPDU_BYTE_LEN_2: u16 = 11454;
62
63pub const OUI_LEN: u8 = 3;
64
65pub const SSID_LIST_MAX: u8 = 84;
69
70pub const TIDS_MAX: u32 = 16;
72
73pub const VHT_CAP_LEN: u8 = 12;
74
75pub const VHT_OP_LEN: u8 = 5;
76
77pub const WLAN_IE_BODY_MAX_LEN: u32 = 255;
78
79pub const WLAN_IE_MAX_LEN: u32 = 257;
84
85pub const WLAN_MSDU_MAX_LEN: u32 = 2304;
87
88#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
93pub enum ChannelBandwidth {
94 Cbw20,
95 Cbw40,
96 Cbw40Below,
97 Cbw80,
98 Cbw160,
99 Cbw80P80,
100 #[doc(hidden)]
101 __SourceBreaking {
102 unknown_ordinal: u32,
103 },
104}
105
106#[macro_export]
108macro_rules! ChannelBandwidthUnknown {
109 () => {
110 _
111 };
112}
113
114impl ChannelBandwidth {
115 #[inline]
116 pub fn from_primitive(prim: u32) -> Option<Self> {
117 match prim {
118 1 => Some(Self::Cbw20),
119 2 => Some(Self::Cbw40),
120 3 => Some(Self::Cbw40Below),
121 4 => Some(Self::Cbw80),
122 5 => Some(Self::Cbw160),
123 6 => Some(Self::Cbw80P80),
124 _ => None,
125 }
126 }
127
128 #[inline]
129 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
130 match prim {
131 1 => Self::Cbw20,
132 2 => Self::Cbw40,
133 3 => Self::Cbw40Below,
134 4 => Self::Cbw80,
135 5 => Self::Cbw160,
136 6 => Self::Cbw80P80,
137 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
138 }
139 }
140
141 #[inline]
142 pub fn unknown() -> Self {
143 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
144 }
145
146 #[inline]
147 pub const fn into_primitive(self) -> u32 {
148 match self {
149 Self::Cbw20 => 1,
150 Self::Cbw40 => 2,
151 Self::Cbw40Below => 3,
152 Self::Cbw80 => 4,
153 Self::Cbw160 => 5,
154 Self::Cbw80P80 => 6,
155 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
156 }
157 }
158
159 #[inline]
160 pub fn is_unknown(&self) -> bool {
161 match self {
162 Self::__SourceBreaking { unknown_ordinal: _ } => true,
163 _ => false,
164 }
165 }
166}
167
168#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
170pub enum CipherSuiteType {
171 UseGroup,
172 Wep40,
173 Tkip,
174 Reserved3,
175 Ccmp128,
176 Wep104,
177 BipCmac128,
178 GroupAddressedNotAllowed,
179 Gcmp128,
180 Gcmp256,
181 Ccmp256,
182 BipGmac128,
183 BipGmac256,
184 BipCmac256,
185 Reserved14To255,
186 #[doc(hidden)]
187 __SourceBreaking {
188 unknown_ordinal: u32,
189 },
190}
191
192#[macro_export]
194macro_rules! CipherSuiteTypeUnknown {
195 () => {
196 _
197 };
198}
199
200impl CipherSuiteType {
201 #[inline]
202 pub fn from_primitive(prim: u32) -> Option<Self> {
203 match prim {
204 0 => Some(Self::UseGroup),
205 1 => Some(Self::Wep40),
206 2 => Some(Self::Tkip),
207 3 => Some(Self::Reserved3),
208 4 => Some(Self::Ccmp128),
209 5 => Some(Self::Wep104),
210 6 => Some(Self::BipCmac128),
211 7 => Some(Self::GroupAddressedNotAllowed),
212 8 => Some(Self::Gcmp128),
213 9 => Some(Self::Gcmp256),
214 10 => Some(Self::Ccmp256),
215 11 => Some(Self::BipGmac128),
216 12 => Some(Self::BipGmac256),
217 13 => Some(Self::BipCmac256),
218 14 => Some(Self::Reserved14To255),
219 _ => None,
220 }
221 }
222
223 #[inline]
224 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
225 match prim {
226 0 => Self::UseGroup,
227 1 => Self::Wep40,
228 2 => Self::Tkip,
229 3 => Self::Reserved3,
230 4 => Self::Ccmp128,
231 5 => Self::Wep104,
232 6 => Self::BipCmac128,
233 7 => Self::GroupAddressedNotAllowed,
234 8 => Self::Gcmp128,
235 9 => Self::Gcmp256,
236 10 => Self::Ccmp256,
237 11 => Self::BipGmac128,
238 12 => Self::BipGmac256,
239 13 => Self::BipCmac256,
240 14 => Self::Reserved14To255,
241 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
242 }
243 }
244
245 #[inline]
246 pub fn unknown() -> Self {
247 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
248 }
249
250 #[inline]
251 pub const fn into_primitive(self) -> u32 {
252 match self {
253 Self::UseGroup => 0,
254 Self::Wep40 => 1,
255 Self::Tkip => 2,
256 Self::Reserved3 => 3,
257 Self::Ccmp128 => 4,
258 Self::Wep104 => 5,
259 Self::BipCmac128 => 6,
260 Self::GroupAddressedNotAllowed => 7,
261 Self::Gcmp128 => 8,
262 Self::Gcmp256 => 9,
263 Self::Ccmp256 => 10,
264 Self::BipGmac128 => 11,
265 Self::BipGmac256 => 12,
266 Self::BipCmac256 => 13,
267 Self::Reserved14To255 => 14,
268 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
269 }
270 }
271
272 #[inline]
273 pub fn is_unknown(&self) -> bool {
274 match self {
275 Self::__SourceBreaking { unknown_ordinal: _ } => true,
276 _ => false,
277 }
278 }
279}
280
281#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
282pub enum KeyType {
283 Pairwise,
284 Group,
285 Igtk,
286 Peer,
287 #[doc(hidden)]
288 __SourceBreaking {
289 unknown_ordinal: u8,
290 },
291}
292
293#[macro_export]
295macro_rules! KeyTypeUnknown {
296 () => {
297 _
298 };
299}
300
301impl KeyType {
302 #[inline]
303 pub fn from_primitive(prim: u8) -> Option<Self> {
304 match prim {
305 1 => Some(Self::Pairwise),
306 2 => Some(Self::Group),
307 3 => Some(Self::Igtk),
308 4 => Some(Self::Peer),
309 _ => None,
310 }
311 }
312
313 #[inline]
314 pub fn from_primitive_allow_unknown(prim: u8) -> Self {
315 match prim {
316 1 => Self::Pairwise,
317 2 => Self::Group,
318 3 => Self::Igtk,
319 4 => Self::Peer,
320 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
321 }
322 }
323
324 #[inline]
325 pub fn unknown() -> Self {
326 Self::__SourceBreaking { unknown_ordinal: 0xff }
327 }
328
329 #[inline]
330 pub const fn into_primitive(self) -> u8 {
331 match self {
332 Self::Pairwise => 1,
333 Self::Group => 2,
334 Self::Igtk => 3,
335 Self::Peer => 4,
336 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
337 }
338 }
339
340 #[inline]
341 pub fn is_unknown(&self) -> bool {
342 match self {
343 Self::__SourceBreaking { unknown_ordinal: _ } => true,
344 _ => false,
345 }
346 }
347}
348
349#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
352pub enum ReasonCode {
353 UnspecifiedReason,
354 InvalidAuthentication,
355 LeavingNetworkDeauth,
356 ReasonInactivity,
357 NoMoreStas,
358 InvalidClass2Frame,
359 InvalidClass3Frame,
360 LeavingNetworkDisassoc,
361 NotAuthenticated,
362 UnacceptablePowerCapability,
363 UnacceptableSupportedChannels,
364 BssTransitionDisassoc,
365 ReasonInvalidElement,
366 MicFailure,
367 FourwayHandshakeTimeout,
369 GkHandshakeTimeout,
370 HandshakeElementMismatch,
371 ReasonInvalidGroupCipher,
372 ReasonInvalidPairwiseCipher,
373 ReasonInvalidAkmp,
374 UnsupportedRsneVersion,
375 InvalidRsneCapabilities,
376 Ieee8021XAuthFailed,
378 ReasonCipherOutOfPolicy,
379 TdlsPeerUnreachable,
380 TdlsUnspecifiedReason,
381 SspRequestedDisassoc,
382 NoSspRoamingAgreement,
383 BadCipherOrAkm,
384 NotAuthorizedThisLocation,
385 ServiceChangePrecludesTs,
386 UnspecifiedQosReason,
387 NotEnoughBandwidth,
388 MissingAcks,
389 ExceededTxop,
390 StaLeaving,
391 EndTsBaDls,
393 UnknownTsBa,
395 Timeout,
396 PeerkeyMismatch,
397 PeerInitiated,
398 ApInitiated,
399 ReasonInvalidFtActionFrameCount,
400 ReasonInvalidPmkid,
401 ReasonInvalidMde,
402 ReasonInvalidFte,
403 MeshPeeringCanceled,
404 MeshMaxPeers,
405 MeshConfigurationPolicyViolation,
406 MeshCloseRcvd,
407 MeshMaxRetries,
408 MeshConfirmTimeout,
409 MeshInvalidGtk,
410 MeshInconsistentParameters,
411 MeshInvalidSecurityCapability,
412 MeshPathErrorNoProxyInformation,
413 MeshPathErrorNoForwardingInformation,
414 MeshPathErrorDestinationUnreachable,
415 MacAddressAlreadyExistsInMbss,
416 MeshChannelSwitchRegulatoryRequirements,
417 MeshChannelSwitchUnspecified,
418 MlmeLinkFailed,
424 FwRxStalled,
426 FwHighWmeRxErrRate,
428 #[doc(hidden)]
429 __SourceBreaking {
430 unknown_ordinal: u16,
431 },
432}
433
434#[macro_export]
436macro_rules! ReasonCodeUnknown {
437 () => {
438 _
439 };
440}
441
442impl ReasonCode {
443 #[inline]
444 pub fn from_primitive(prim: u16) -> Option<Self> {
445 match prim {
446 1 => Some(Self::UnspecifiedReason),
447 2 => Some(Self::InvalidAuthentication),
448 3 => Some(Self::LeavingNetworkDeauth),
449 4 => Some(Self::ReasonInactivity),
450 5 => Some(Self::NoMoreStas),
451 6 => Some(Self::InvalidClass2Frame),
452 7 => Some(Self::InvalidClass3Frame),
453 8 => Some(Self::LeavingNetworkDisassoc),
454 9 => Some(Self::NotAuthenticated),
455 10 => Some(Self::UnacceptablePowerCapability),
456 11 => Some(Self::UnacceptableSupportedChannels),
457 12 => Some(Self::BssTransitionDisassoc),
458 13 => Some(Self::ReasonInvalidElement),
459 14 => Some(Self::MicFailure),
460 15 => Some(Self::FourwayHandshakeTimeout),
461 16 => Some(Self::GkHandshakeTimeout),
462 17 => Some(Self::HandshakeElementMismatch),
463 18 => Some(Self::ReasonInvalidGroupCipher),
464 19 => Some(Self::ReasonInvalidPairwiseCipher),
465 20 => Some(Self::ReasonInvalidAkmp),
466 21 => Some(Self::UnsupportedRsneVersion),
467 22 => Some(Self::InvalidRsneCapabilities),
468 23 => Some(Self::Ieee8021XAuthFailed),
469 24 => Some(Self::ReasonCipherOutOfPolicy),
470 25 => Some(Self::TdlsPeerUnreachable),
471 26 => Some(Self::TdlsUnspecifiedReason),
472 27 => Some(Self::SspRequestedDisassoc),
473 28 => Some(Self::NoSspRoamingAgreement),
474 29 => Some(Self::BadCipherOrAkm),
475 30 => Some(Self::NotAuthorizedThisLocation),
476 31 => Some(Self::ServiceChangePrecludesTs),
477 32 => Some(Self::UnspecifiedQosReason),
478 33 => Some(Self::NotEnoughBandwidth),
479 34 => Some(Self::MissingAcks),
480 35 => Some(Self::ExceededTxop),
481 36 => Some(Self::StaLeaving),
482 37 => Some(Self::EndTsBaDls),
483 38 => Some(Self::UnknownTsBa),
484 39 => Some(Self::Timeout),
485 45 => Some(Self::PeerkeyMismatch),
486 46 => Some(Self::PeerInitiated),
487 47 => Some(Self::ApInitiated),
488 48 => Some(Self::ReasonInvalidFtActionFrameCount),
489 49 => Some(Self::ReasonInvalidPmkid),
490 50 => Some(Self::ReasonInvalidMde),
491 51 => Some(Self::ReasonInvalidFte),
492 52 => Some(Self::MeshPeeringCanceled),
493 53 => Some(Self::MeshMaxPeers),
494 54 => Some(Self::MeshConfigurationPolicyViolation),
495 55 => Some(Self::MeshCloseRcvd),
496 56 => Some(Self::MeshMaxRetries),
497 57 => Some(Self::MeshConfirmTimeout),
498 58 => Some(Self::MeshInvalidGtk),
499 59 => Some(Self::MeshInconsistentParameters),
500 60 => Some(Self::MeshInvalidSecurityCapability),
501 61 => Some(Self::MeshPathErrorNoProxyInformation),
502 62 => Some(Self::MeshPathErrorNoForwardingInformation),
503 63 => Some(Self::MeshPathErrorDestinationUnreachable),
504 64 => Some(Self::MacAddressAlreadyExistsInMbss),
505 65 => Some(Self::MeshChannelSwitchRegulatoryRequirements),
506 66 => Some(Self::MeshChannelSwitchUnspecified),
507 128 => Some(Self::MlmeLinkFailed),
508 129 => Some(Self::FwRxStalled),
509 130 => Some(Self::FwHighWmeRxErrRate),
510 _ => None,
511 }
512 }
513
514 #[inline]
515 pub fn from_primitive_allow_unknown(prim: u16) -> Self {
516 match prim {
517 1 => Self::UnspecifiedReason,
518 2 => Self::InvalidAuthentication,
519 3 => Self::LeavingNetworkDeauth,
520 4 => Self::ReasonInactivity,
521 5 => Self::NoMoreStas,
522 6 => Self::InvalidClass2Frame,
523 7 => Self::InvalidClass3Frame,
524 8 => Self::LeavingNetworkDisassoc,
525 9 => Self::NotAuthenticated,
526 10 => Self::UnacceptablePowerCapability,
527 11 => Self::UnacceptableSupportedChannels,
528 12 => Self::BssTransitionDisassoc,
529 13 => Self::ReasonInvalidElement,
530 14 => Self::MicFailure,
531 15 => Self::FourwayHandshakeTimeout,
532 16 => Self::GkHandshakeTimeout,
533 17 => Self::HandshakeElementMismatch,
534 18 => Self::ReasonInvalidGroupCipher,
535 19 => Self::ReasonInvalidPairwiseCipher,
536 20 => Self::ReasonInvalidAkmp,
537 21 => Self::UnsupportedRsneVersion,
538 22 => Self::InvalidRsneCapabilities,
539 23 => Self::Ieee8021XAuthFailed,
540 24 => Self::ReasonCipherOutOfPolicy,
541 25 => Self::TdlsPeerUnreachable,
542 26 => Self::TdlsUnspecifiedReason,
543 27 => Self::SspRequestedDisassoc,
544 28 => Self::NoSspRoamingAgreement,
545 29 => Self::BadCipherOrAkm,
546 30 => Self::NotAuthorizedThisLocation,
547 31 => Self::ServiceChangePrecludesTs,
548 32 => Self::UnspecifiedQosReason,
549 33 => Self::NotEnoughBandwidth,
550 34 => Self::MissingAcks,
551 35 => Self::ExceededTxop,
552 36 => Self::StaLeaving,
553 37 => Self::EndTsBaDls,
554 38 => Self::UnknownTsBa,
555 39 => Self::Timeout,
556 45 => Self::PeerkeyMismatch,
557 46 => Self::PeerInitiated,
558 47 => Self::ApInitiated,
559 48 => Self::ReasonInvalidFtActionFrameCount,
560 49 => Self::ReasonInvalidPmkid,
561 50 => Self::ReasonInvalidMde,
562 51 => Self::ReasonInvalidFte,
563 52 => Self::MeshPeeringCanceled,
564 53 => Self::MeshMaxPeers,
565 54 => Self::MeshConfigurationPolicyViolation,
566 55 => Self::MeshCloseRcvd,
567 56 => Self::MeshMaxRetries,
568 57 => Self::MeshConfirmTimeout,
569 58 => Self::MeshInvalidGtk,
570 59 => Self::MeshInconsistentParameters,
571 60 => Self::MeshInvalidSecurityCapability,
572 61 => Self::MeshPathErrorNoProxyInformation,
573 62 => Self::MeshPathErrorNoForwardingInformation,
574 63 => Self::MeshPathErrorDestinationUnreachable,
575 64 => Self::MacAddressAlreadyExistsInMbss,
576 65 => Self::MeshChannelSwitchRegulatoryRequirements,
577 66 => Self::MeshChannelSwitchUnspecified,
578 128 => Self::MlmeLinkFailed,
579 129 => Self::FwRxStalled,
580 130 => Self::FwHighWmeRxErrRate,
581 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
582 }
583 }
584
585 #[inline]
586 pub fn unknown() -> Self {
587 Self::__SourceBreaking { unknown_ordinal: 0xffff }
588 }
589
590 #[inline]
591 pub const fn into_primitive(self) -> u16 {
592 match self {
593 Self::UnspecifiedReason => 1,
594 Self::InvalidAuthentication => 2,
595 Self::LeavingNetworkDeauth => 3,
596 Self::ReasonInactivity => 4,
597 Self::NoMoreStas => 5,
598 Self::InvalidClass2Frame => 6,
599 Self::InvalidClass3Frame => 7,
600 Self::LeavingNetworkDisassoc => 8,
601 Self::NotAuthenticated => 9,
602 Self::UnacceptablePowerCapability => 10,
603 Self::UnacceptableSupportedChannels => 11,
604 Self::BssTransitionDisassoc => 12,
605 Self::ReasonInvalidElement => 13,
606 Self::MicFailure => 14,
607 Self::FourwayHandshakeTimeout => 15,
608 Self::GkHandshakeTimeout => 16,
609 Self::HandshakeElementMismatch => 17,
610 Self::ReasonInvalidGroupCipher => 18,
611 Self::ReasonInvalidPairwiseCipher => 19,
612 Self::ReasonInvalidAkmp => 20,
613 Self::UnsupportedRsneVersion => 21,
614 Self::InvalidRsneCapabilities => 22,
615 Self::Ieee8021XAuthFailed => 23,
616 Self::ReasonCipherOutOfPolicy => 24,
617 Self::TdlsPeerUnreachable => 25,
618 Self::TdlsUnspecifiedReason => 26,
619 Self::SspRequestedDisassoc => 27,
620 Self::NoSspRoamingAgreement => 28,
621 Self::BadCipherOrAkm => 29,
622 Self::NotAuthorizedThisLocation => 30,
623 Self::ServiceChangePrecludesTs => 31,
624 Self::UnspecifiedQosReason => 32,
625 Self::NotEnoughBandwidth => 33,
626 Self::MissingAcks => 34,
627 Self::ExceededTxop => 35,
628 Self::StaLeaving => 36,
629 Self::EndTsBaDls => 37,
630 Self::UnknownTsBa => 38,
631 Self::Timeout => 39,
632 Self::PeerkeyMismatch => 45,
633 Self::PeerInitiated => 46,
634 Self::ApInitiated => 47,
635 Self::ReasonInvalidFtActionFrameCount => 48,
636 Self::ReasonInvalidPmkid => 49,
637 Self::ReasonInvalidMde => 50,
638 Self::ReasonInvalidFte => 51,
639 Self::MeshPeeringCanceled => 52,
640 Self::MeshMaxPeers => 53,
641 Self::MeshConfigurationPolicyViolation => 54,
642 Self::MeshCloseRcvd => 55,
643 Self::MeshMaxRetries => 56,
644 Self::MeshConfirmTimeout => 57,
645 Self::MeshInvalidGtk => 58,
646 Self::MeshInconsistentParameters => 59,
647 Self::MeshInvalidSecurityCapability => 60,
648 Self::MeshPathErrorNoProxyInformation => 61,
649 Self::MeshPathErrorNoForwardingInformation => 62,
650 Self::MeshPathErrorDestinationUnreachable => 63,
651 Self::MacAddressAlreadyExistsInMbss => 64,
652 Self::MeshChannelSwitchRegulatoryRequirements => 65,
653 Self::MeshChannelSwitchUnspecified => 66,
654 Self::MlmeLinkFailed => 128,
655 Self::FwRxStalled => 129,
656 Self::FwHighWmeRxErrRate => 130,
657 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
658 }
659 }
660
661 #[inline]
662 pub fn is_unknown(&self) -> bool {
663 match self {
664 Self::__SourceBreaking { unknown_ordinal: _ } => true,
665 _ => false,
666 }
667 }
668}
669
670#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
673pub enum StatusCode {
674 Success,
675 RefusedReasonUnspecified,
676 TdlsRejectedAlternativeProvided,
677 TdlsRejected,
678 SecurityDisabled,
680 UnacceptableLifetime,
681 NotInSameBss,
682 RefusedCapabilitiesMismatch,
684 DeniedNoAssociationExists,
685 DeniedOtherReason,
686 UnsupportedAuthAlgorithm,
687 TransactionSequenceError,
688 ChallengeFailure,
689 RejectedSequenceTimeout,
690 DeniedNoMoreStas,
691 RefusedBasicRatesMismatch,
692 DeniedNoShortPreambleSupport,
693 RejectedSpectrumManagementRequired,
695 RejectedBadPowerCapability,
696 RejectedBadSupportedChannels,
697 DeniedNoShortSlotTimeSupport,
698 DeniedNoHtSupport,
700 R0KhUnreachable,
701 DeniedPcoTimeNotSupported,
702 RefusedTemporarily,
703 RobustManagementPolicyViolation,
704 UnspecifiedQosFailure,
705 DeniedInsufficientBandwidth,
706 DeniedPoorChannelConditions,
707 DeniedQosNotSupported,
708 RequestDeclined,
710 InvalidParameters,
711 RejectedWithSuggestedChanges,
712 StatusInvalidElement,
713 StatusInvalidGroupCipher,
714 StatusInvalidPairwiseCipher,
715 StatusInvalidAkmp,
716 UnsupportedRsneVersion,
717 InvalidRsneCapabilities,
718 StatusCipherOutOfPolicy,
719 RejectedForDelayPeriod,
720 DlsNotAllowed,
721 NotPresent,
722 NotQosSta,
723 DeniedListenIntervalTooLarge,
724 StatusInvalidFtActionFrameCount,
725 StatusInvalidPmkid,
726 StatusInvalidMde,
727 StatusInvalidFte,
728 RequestedTclasNotSupportedByAp,
731 InsufficientTclasProcessingResources,
732 TryAnotherBss,
733 GasAdvertisementProtocolNotSupported,
734 NoOutstandingGasRequest,
735 GasResponseNotReceivedFromServer,
736 GasQueryTimeout,
737 GasQueryResponseTooLarge,
738 RejectedHomeWithSuggestedChanges,
739 ServerUnreachable,
740 RejectedForSspPermissions,
742 RefusedUnauthenticatedAccessNotSupported,
743 InvalidRsne,
745 UApsdCoexistanceNotSupported,
746 UApsdCoexModeNotSupported,
747 BadIntervalWithUApsdCoex,
748 AntiCloggingTokenRequired,
749 UnsupportedFiniteCyclicGroup,
750 CannotFindAlternativeTbtt,
751 TransmissionFailure,
752 RequestedTclasNotSupported,
754 TclasResourcesExhausted,
755 RejectedWithSuggestedBssTransition,
756 RejectWithSchedule,
757 RejectNoWakeupSpecified,
758 SuccessPowerSaveMode,
759 PendingAdmittingFstSession,
760 PerformingFstNow,
761 PendingGapInBaWindow,
762 RejectUPidSetting,
763 RefusedExternalReason,
765 RefusedApOutOfMemory,
766 RejectedEmergencyServicesNotSupported,
767 QueryResponseOutstanding,
768 RejectDseBand,
769 TclasProcessingTerminated,
770 TsScheduleConflict,
771 DeniedWithSuggestedBandAndChannel,
772 MccaopReservationConflict,
773 MafLimitExceeded,
774 MccaTrackLimitExceeded,
775 DeniedDueToSpectrumManagement,
776 DeniedVhtNotSupported,
777 EnablementDenied,
778 RestrictionFromAuthorizedGdb,
779 AuthorizationDeenabled,
780 EnergyLimitedOperationNotSupported,
781 RejectedNdpBlockAckSuggested,
782 RejectedMaxAwayDurationUnacceptable,
783 FlowControlOperationSupported,
784 FilsAuthenticationFailure,
785 UnknownAuthenticationServer,
786 DeniedNotificationPeriodAllocation,
788 DeniedChannelSplitting,
789 DeniedAllocation,
790 CmmgFeaturesNotSupported,
791 GasFragmentNotAvailable,
792 SuccessCagVersionsMatch,
793 GlkNotAuthorized,
794 UnknownPasswordIdentifier,
795 DeniedLocalMacAddressPolicyViolation,
797 SaeHashToElement,
798 TclasProcessingTerminatedInsufficientQos,
800 TclasProcessingTerminatedPolicyConflict,
801 JoinFailure,
805 SpuriousDeauthOrDisassoc,
807 Canceled,
809 EstablishRsnaFailure,
811 #[doc(hidden)]
812 __SourceBreaking {
813 unknown_ordinal: u16,
814 },
815}
816
817#[macro_export]
819macro_rules! StatusCodeUnknown {
820 () => {
821 _
822 };
823}
824
825impl StatusCode {
826 #[inline]
827 pub fn from_primitive(prim: u16) -> Option<Self> {
828 match prim {
829 0 => Some(Self::Success),
830 1 => Some(Self::RefusedReasonUnspecified),
831 2 => Some(Self::TdlsRejectedAlternativeProvided),
832 3 => Some(Self::TdlsRejected),
833 5 => Some(Self::SecurityDisabled),
834 6 => Some(Self::UnacceptableLifetime),
835 7 => Some(Self::NotInSameBss),
836 10 => Some(Self::RefusedCapabilitiesMismatch),
837 11 => Some(Self::DeniedNoAssociationExists),
838 12 => Some(Self::DeniedOtherReason),
839 13 => Some(Self::UnsupportedAuthAlgorithm),
840 14 => Some(Self::TransactionSequenceError),
841 15 => Some(Self::ChallengeFailure),
842 16 => Some(Self::RejectedSequenceTimeout),
843 17 => Some(Self::DeniedNoMoreStas),
844 18 => Some(Self::RefusedBasicRatesMismatch),
845 19 => Some(Self::DeniedNoShortPreambleSupport),
846 22 => Some(Self::RejectedSpectrumManagementRequired),
847 23 => Some(Self::RejectedBadPowerCapability),
848 24 => Some(Self::RejectedBadSupportedChannels),
849 25 => Some(Self::DeniedNoShortSlotTimeSupport),
850 27 => Some(Self::DeniedNoHtSupport),
851 28 => Some(Self::R0KhUnreachable),
852 29 => Some(Self::DeniedPcoTimeNotSupported),
853 30 => Some(Self::RefusedTemporarily),
854 31 => Some(Self::RobustManagementPolicyViolation),
855 32 => Some(Self::UnspecifiedQosFailure),
856 33 => Some(Self::DeniedInsufficientBandwidth),
857 34 => Some(Self::DeniedPoorChannelConditions),
858 35 => Some(Self::DeniedQosNotSupported),
859 37 => Some(Self::RequestDeclined),
860 38 => Some(Self::InvalidParameters),
861 39 => Some(Self::RejectedWithSuggestedChanges),
862 40 => Some(Self::StatusInvalidElement),
863 41 => Some(Self::StatusInvalidGroupCipher),
864 42 => Some(Self::StatusInvalidPairwiseCipher),
865 43 => Some(Self::StatusInvalidAkmp),
866 44 => Some(Self::UnsupportedRsneVersion),
867 45 => Some(Self::InvalidRsneCapabilities),
868 46 => Some(Self::StatusCipherOutOfPolicy),
869 47 => Some(Self::RejectedForDelayPeriod),
870 48 => Some(Self::DlsNotAllowed),
871 49 => Some(Self::NotPresent),
872 50 => Some(Self::NotQosSta),
873 51 => Some(Self::DeniedListenIntervalTooLarge),
874 52 => Some(Self::StatusInvalidFtActionFrameCount),
875 53 => Some(Self::StatusInvalidPmkid),
876 54 => Some(Self::StatusInvalidMde),
877 55 => Some(Self::StatusInvalidFte),
878 56 => Some(Self::RequestedTclasNotSupportedByAp),
879 57 => Some(Self::InsufficientTclasProcessingResources),
880 58 => Some(Self::TryAnotherBss),
881 59 => Some(Self::GasAdvertisementProtocolNotSupported),
882 60 => Some(Self::NoOutstandingGasRequest),
883 61 => Some(Self::GasResponseNotReceivedFromServer),
884 62 => Some(Self::GasQueryTimeout),
885 63 => Some(Self::GasQueryResponseTooLarge),
886 64 => Some(Self::RejectedHomeWithSuggestedChanges),
887 65 => Some(Self::ServerUnreachable),
888 67 => Some(Self::RejectedForSspPermissions),
889 68 => Some(Self::RefusedUnauthenticatedAccessNotSupported),
890 72 => Some(Self::InvalidRsne),
891 73 => Some(Self::UApsdCoexistanceNotSupported),
892 74 => Some(Self::UApsdCoexModeNotSupported),
893 75 => Some(Self::BadIntervalWithUApsdCoex),
894 76 => Some(Self::AntiCloggingTokenRequired),
895 77 => Some(Self::UnsupportedFiniteCyclicGroup),
896 78 => Some(Self::CannotFindAlternativeTbtt),
897 79 => Some(Self::TransmissionFailure),
898 80 => Some(Self::RequestedTclasNotSupported),
899 81 => Some(Self::TclasResourcesExhausted),
900 82 => Some(Self::RejectedWithSuggestedBssTransition),
901 83 => Some(Self::RejectWithSchedule),
902 84 => Some(Self::RejectNoWakeupSpecified),
903 85 => Some(Self::SuccessPowerSaveMode),
904 86 => Some(Self::PendingAdmittingFstSession),
905 87 => Some(Self::PerformingFstNow),
906 88 => Some(Self::PendingGapInBaWindow),
907 89 => Some(Self::RejectUPidSetting),
908 92 => Some(Self::RefusedExternalReason),
909 93 => Some(Self::RefusedApOutOfMemory),
910 94 => Some(Self::RejectedEmergencyServicesNotSupported),
911 95 => Some(Self::QueryResponseOutstanding),
912 96 => Some(Self::RejectDseBand),
913 97 => Some(Self::TclasProcessingTerminated),
914 98 => Some(Self::TsScheduleConflict),
915 99 => Some(Self::DeniedWithSuggestedBandAndChannel),
916 100 => Some(Self::MccaopReservationConflict),
917 101 => Some(Self::MafLimitExceeded),
918 102 => Some(Self::MccaTrackLimitExceeded),
919 103 => Some(Self::DeniedDueToSpectrumManagement),
920 104 => Some(Self::DeniedVhtNotSupported),
921 105 => Some(Self::EnablementDenied),
922 106 => Some(Self::RestrictionFromAuthorizedGdb),
923 107 => Some(Self::AuthorizationDeenabled),
924 108 => Some(Self::EnergyLimitedOperationNotSupported),
925 109 => Some(Self::RejectedNdpBlockAckSuggested),
926 110 => Some(Self::RejectedMaxAwayDurationUnacceptable),
927 111 => Some(Self::FlowControlOperationSupported),
928 112 => Some(Self::FilsAuthenticationFailure),
929 113 => Some(Self::UnknownAuthenticationServer),
930 116 => Some(Self::DeniedNotificationPeriodAllocation),
931 117 => Some(Self::DeniedChannelSplitting),
932 118 => Some(Self::DeniedAllocation),
933 119 => Some(Self::CmmgFeaturesNotSupported),
934 120 => Some(Self::GasFragmentNotAvailable),
935 121 => Some(Self::SuccessCagVersionsMatch),
936 122 => Some(Self::GlkNotAuthorized),
937 123 => Some(Self::UnknownPasswordIdentifier),
938 125 => Some(Self::DeniedLocalMacAddressPolicyViolation),
939 126 => Some(Self::SaeHashToElement),
940 128 => Some(Self::TclasProcessingTerminatedInsufficientQos),
941 129 => Some(Self::TclasProcessingTerminatedPolicyConflict),
942 256 => Some(Self::JoinFailure),
943 257 => Some(Self::SpuriousDeauthOrDisassoc),
944 258 => Some(Self::Canceled),
945 259 => Some(Self::EstablishRsnaFailure),
946 _ => None,
947 }
948 }
949
950 #[inline]
951 pub fn from_primitive_allow_unknown(prim: u16) -> Self {
952 match prim {
953 0 => Self::Success,
954 1 => Self::RefusedReasonUnspecified,
955 2 => Self::TdlsRejectedAlternativeProvided,
956 3 => Self::TdlsRejected,
957 5 => Self::SecurityDisabled,
958 6 => Self::UnacceptableLifetime,
959 7 => Self::NotInSameBss,
960 10 => Self::RefusedCapabilitiesMismatch,
961 11 => Self::DeniedNoAssociationExists,
962 12 => Self::DeniedOtherReason,
963 13 => Self::UnsupportedAuthAlgorithm,
964 14 => Self::TransactionSequenceError,
965 15 => Self::ChallengeFailure,
966 16 => Self::RejectedSequenceTimeout,
967 17 => Self::DeniedNoMoreStas,
968 18 => Self::RefusedBasicRatesMismatch,
969 19 => Self::DeniedNoShortPreambleSupport,
970 22 => Self::RejectedSpectrumManagementRequired,
971 23 => Self::RejectedBadPowerCapability,
972 24 => Self::RejectedBadSupportedChannels,
973 25 => Self::DeniedNoShortSlotTimeSupport,
974 27 => Self::DeniedNoHtSupport,
975 28 => Self::R0KhUnreachable,
976 29 => Self::DeniedPcoTimeNotSupported,
977 30 => Self::RefusedTemporarily,
978 31 => Self::RobustManagementPolicyViolation,
979 32 => Self::UnspecifiedQosFailure,
980 33 => Self::DeniedInsufficientBandwidth,
981 34 => Self::DeniedPoorChannelConditions,
982 35 => Self::DeniedQosNotSupported,
983 37 => Self::RequestDeclined,
984 38 => Self::InvalidParameters,
985 39 => Self::RejectedWithSuggestedChanges,
986 40 => Self::StatusInvalidElement,
987 41 => Self::StatusInvalidGroupCipher,
988 42 => Self::StatusInvalidPairwiseCipher,
989 43 => Self::StatusInvalidAkmp,
990 44 => Self::UnsupportedRsneVersion,
991 45 => Self::InvalidRsneCapabilities,
992 46 => Self::StatusCipherOutOfPolicy,
993 47 => Self::RejectedForDelayPeriod,
994 48 => Self::DlsNotAllowed,
995 49 => Self::NotPresent,
996 50 => Self::NotQosSta,
997 51 => Self::DeniedListenIntervalTooLarge,
998 52 => Self::StatusInvalidFtActionFrameCount,
999 53 => Self::StatusInvalidPmkid,
1000 54 => Self::StatusInvalidMde,
1001 55 => Self::StatusInvalidFte,
1002 56 => Self::RequestedTclasNotSupportedByAp,
1003 57 => Self::InsufficientTclasProcessingResources,
1004 58 => Self::TryAnotherBss,
1005 59 => Self::GasAdvertisementProtocolNotSupported,
1006 60 => Self::NoOutstandingGasRequest,
1007 61 => Self::GasResponseNotReceivedFromServer,
1008 62 => Self::GasQueryTimeout,
1009 63 => Self::GasQueryResponseTooLarge,
1010 64 => Self::RejectedHomeWithSuggestedChanges,
1011 65 => Self::ServerUnreachable,
1012 67 => Self::RejectedForSspPermissions,
1013 68 => Self::RefusedUnauthenticatedAccessNotSupported,
1014 72 => Self::InvalidRsne,
1015 73 => Self::UApsdCoexistanceNotSupported,
1016 74 => Self::UApsdCoexModeNotSupported,
1017 75 => Self::BadIntervalWithUApsdCoex,
1018 76 => Self::AntiCloggingTokenRequired,
1019 77 => Self::UnsupportedFiniteCyclicGroup,
1020 78 => Self::CannotFindAlternativeTbtt,
1021 79 => Self::TransmissionFailure,
1022 80 => Self::RequestedTclasNotSupported,
1023 81 => Self::TclasResourcesExhausted,
1024 82 => Self::RejectedWithSuggestedBssTransition,
1025 83 => Self::RejectWithSchedule,
1026 84 => Self::RejectNoWakeupSpecified,
1027 85 => Self::SuccessPowerSaveMode,
1028 86 => Self::PendingAdmittingFstSession,
1029 87 => Self::PerformingFstNow,
1030 88 => Self::PendingGapInBaWindow,
1031 89 => Self::RejectUPidSetting,
1032 92 => Self::RefusedExternalReason,
1033 93 => Self::RefusedApOutOfMemory,
1034 94 => Self::RejectedEmergencyServicesNotSupported,
1035 95 => Self::QueryResponseOutstanding,
1036 96 => Self::RejectDseBand,
1037 97 => Self::TclasProcessingTerminated,
1038 98 => Self::TsScheduleConflict,
1039 99 => Self::DeniedWithSuggestedBandAndChannel,
1040 100 => Self::MccaopReservationConflict,
1041 101 => Self::MafLimitExceeded,
1042 102 => Self::MccaTrackLimitExceeded,
1043 103 => Self::DeniedDueToSpectrumManagement,
1044 104 => Self::DeniedVhtNotSupported,
1045 105 => Self::EnablementDenied,
1046 106 => Self::RestrictionFromAuthorizedGdb,
1047 107 => Self::AuthorizationDeenabled,
1048 108 => Self::EnergyLimitedOperationNotSupported,
1049 109 => Self::RejectedNdpBlockAckSuggested,
1050 110 => Self::RejectedMaxAwayDurationUnacceptable,
1051 111 => Self::FlowControlOperationSupported,
1052 112 => Self::FilsAuthenticationFailure,
1053 113 => Self::UnknownAuthenticationServer,
1054 116 => Self::DeniedNotificationPeriodAllocation,
1055 117 => Self::DeniedChannelSplitting,
1056 118 => Self::DeniedAllocation,
1057 119 => Self::CmmgFeaturesNotSupported,
1058 120 => Self::GasFragmentNotAvailable,
1059 121 => Self::SuccessCagVersionsMatch,
1060 122 => Self::GlkNotAuthorized,
1061 123 => Self::UnknownPasswordIdentifier,
1062 125 => Self::DeniedLocalMacAddressPolicyViolation,
1063 126 => Self::SaeHashToElement,
1064 128 => Self::TclasProcessingTerminatedInsufficientQos,
1065 129 => Self::TclasProcessingTerminatedPolicyConflict,
1066 256 => Self::JoinFailure,
1067 257 => Self::SpuriousDeauthOrDisassoc,
1068 258 => Self::Canceled,
1069 259 => Self::EstablishRsnaFailure,
1070 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1071 }
1072 }
1073
1074 #[inline]
1075 pub fn unknown() -> Self {
1076 Self::__SourceBreaking { unknown_ordinal: 0xffff }
1077 }
1078
1079 #[inline]
1080 pub const fn into_primitive(self) -> u16 {
1081 match self {
1082 Self::Success => 0,
1083 Self::RefusedReasonUnspecified => 1,
1084 Self::TdlsRejectedAlternativeProvided => 2,
1085 Self::TdlsRejected => 3,
1086 Self::SecurityDisabled => 5,
1087 Self::UnacceptableLifetime => 6,
1088 Self::NotInSameBss => 7,
1089 Self::RefusedCapabilitiesMismatch => 10,
1090 Self::DeniedNoAssociationExists => 11,
1091 Self::DeniedOtherReason => 12,
1092 Self::UnsupportedAuthAlgorithm => 13,
1093 Self::TransactionSequenceError => 14,
1094 Self::ChallengeFailure => 15,
1095 Self::RejectedSequenceTimeout => 16,
1096 Self::DeniedNoMoreStas => 17,
1097 Self::RefusedBasicRatesMismatch => 18,
1098 Self::DeniedNoShortPreambleSupport => 19,
1099 Self::RejectedSpectrumManagementRequired => 22,
1100 Self::RejectedBadPowerCapability => 23,
1101 Self::RejectedBadSupportedChannels => 24,
1102 Self::DeniedNoShortSlotTimeSupport => 25,
1103 Self::DeniedNoHtSupport => 27,
1104 Self::R0KhUnreachable => 28,
1105 Self::DeniedPcoTimeNotSupported => 29,
1106 Self::RefusedTemporarily => 30,
1107 Self::RobustManagementPolicyViolation => 31,
1108 Self::UnspecifiedQosFailure => 32,
1109 Self::DeniedInsufficientBandwidth => 33,
1110 Self::DeniedPoorChannelConditions => 34,
1111 Self::DeniedQosNotSupported => 35,
1112 Self::RequestDeclined => 37,
1113 Self::InvalidParameters => 38,
1114 Self::RejectedWithSuggestedChanges => 39,
1115 Self::StatusInvalidElement => 40,
1116 Self::StatusInvalidGroupCipher => 41,
1117 Self::StatusInvalidPairwiseCipher => 42,
1118 Self::StatusInvalidAkmp => 43,
1119 Self::UnsupportedRsneVersion => 44,
1120 Self::InvalidRsneCapabilities => 45,
1121 Self::StatusCipherOutOfPolicy => 46,
1122 Self::RejectedForDelayPeriod => 47,
1123 Self::DlsNotAllowed => 48,
1124 Self::NotPresent => 49,
1125 Self::NotQosSta => 50,
1126 Self::DeniedListenIntervalTooLarge => 51,
1127 Self::StatusInvalidFtActionFrameCount => 52,
1128 Self::StatusInvalidPmkid => 53,
1129 Self::StatusInvalidMde => 54,
1130 Self::StatusInvalidFte => 55,
1131 Self::RequestedTclasNotSupportedByAp => 56,
1132 Self::InsufficientTclasProcessingResources => 57,
1133 Self::TryAnotherBss => 58,
1134 Self::GasAdvertisementProtocolNotSupported => 59,
1135 Self::NoOutstandingGasRequest => 60,
1136 Self::GasResponseNotReceivedFromServer => 61,
1137 Self::GasQueryTimeout => 62,
1138 Self::GasQueryResponseTooLarge => 63,
1139 Self::RejectedHomeWithSuggestedChanges => 64,
1140 Self::ServerUnreachable => 65,
1141 Self::RejectedForSspPermissions => 67,
1142 Self::RefusedUnauthenticatedAccessNotSupported => 68,
1143 Self::InvalidRsne => 72,
1144 Self::UApsdCoexistanceNotSupported => 73,
1145 Self::UApsdCoexModeNotSupported => 74,
1146 Self::BadIntervalWithUApsdCoex => 75,
1147 Self::AntiCloggingTokenRequired => 76,
1148 Self::UnsupportedFiniteCyclicGroup => 77,
1149 Self::CannotFindAlternativeTbtt => 78,
1150 Self::TransmissionFailure => 79,
1151 Self::RequestedTclasNotSupported => 80,
1152 Self::TclasResourcesExhausted => 81,
1153 Self::RejectedWithSuggestedBssTransition => 82,
1154 Self::RejectWithSchedule => 83,
1155 Self::RejectNoWakeupSpecified => 84,
1156 Self::SuccessPowerSaveMode => 85,
1157 Self::PendingAdmittingFstSession => 86,
1158 Self::PerformingFstNow => 87,
1159 Self::PendingGapInBaWindow => 88,
1160 Self::RejectUPidSetting => 89,
1161 Self::RefusedExternalReason => 92,
1162 Self::RefusedApOutOfMemory => 93,
1163 Self::RejectedEmergencyServicesNotSupported => 94,
1164 Self::QueryResponseOutstanding => 95,
1165 Self::RejectDseBand => 96,
1166 Self::TclasProcessingTerminated => 97,
1167 Self::TsScheduleConflict => 98,
1168 Self::DeniedWithSuggestedBandAndChannel => 99,
1169 Self::MccaopReservationConflict => 100,
1170 Self::MafLimitExceeded => 101,
1171 Self::MccaTrackLimitExceeded => 102,
1172 Self::DeniedDueToSpectrumManagement => 103,
1173 Self::DeniedVhtNotSupported => 104,
1174 Self::EnablementDenied => 105,
1175 Self::RestrictionFromAuthorizedGdb => 106,
1176 Self::AuthorizationDeenabled => 107,
1177 Self::EnergyLimitedOperationNotSupported => 108,
1178 Self::RejectedNdpBlockAckSuggested => 109,
1179 Self::RejectedMaxAwayDurationUnacceptable => 110,
1180 Self::FlowControlOperationSupported => 111,
1181 Self::FilsAuthenticationFailure => 112,
1182 Self::UnknownAuthenticationServer => 113,
1183 Self::DeniedNotificationPeriodAllocation => 116,
1184 Self::DeniedChannelSplitting => 117,
1185 Self::DeniedAllocation => 118,
1186 Self::CmmgFeaturesNotSupported => 119,
1187 Self::GasFragmentNotAvailable => 120,
1188 Self::SuccessCagVersionsMatch => 121,
1189 Self::GlkNotAuthorized => 122,
1190 Self::UnknownPasswordIdentifier => 123,
1191 Self::DeniedLocalMacAddressPolicyViolation => 125,
1192 Self::SaeHashToElement => 126,
1193 Self::TclasProcessingTerminatedInsufficientQos => 128,
1194 Self::TclasProcessingTerminatedPolicyConflict => 129,
1195 Self::JoinFailure => 256,
1196 Self::SpuriousDeauthOrDisassoc => 257,
1197 Self::Canceled => 258,
1198 Self::EstablishRsnaFailure => 259,
1199 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1200 }
1201 }
1202
1203 #[inline]
1204 pub fn is_unknown(&self) -> bool {
1205 match self {
1206 Self::__SourceBreaking { unknown_ordinal: _ } => true,
1207 _ => false,
1208 }
1209 }
1210}
1211
1212#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1214#[repr(u32)]
1215pub enum WlanAccessCategory {
1216 Background = 1,
1217 BestEffort = 2,
1218 Video = 3,
1219 Voice = 4,
1220}
1221
1222impl WlanAccessCategory {
1223 #[inline]
1224 pub fn from_primitive(prim: u32) -> Option<Self> {
1225 match prim {
1226 1 => Some(Self::Background),
1227 2 => Some(Self::BestEffort),
1228 3 => Some(Self::Video),
1229 4 => Some(Self::Voice),
1230 _ => None,
1231 }
1232 }
1233
1234 #[inline]
1235 pub const fn into_primitive(self) -> u32 {
1236 self as u32
1237 }
1238}
1239
1240#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1251pub enum WlanBand {
1252 TwoGhz,
1253 FiveGhz,
1254 #[doc(hidden)]
1255 __SourceBreaking {
1256 unknown_ordinal: u8,
1257 },
1258}
1259
1260#[macro_export]
1262macro_rules! WlanBandUnknown {
1263 () => {
1264 _
1265 };
1266}
1267
1268impl WlanBand {
1269 #[inline]
1270 pub fn from_primitive(prim: u8) -> Option<Self> {
1271 match prim {
1272 0 => Some(Self::TwoGhz),
1273 1 => Some(Self::FiveGhz),
1274 _ => None,
1275 }
1276 }
1277
1278 #[inline]
1279 pub fn from_primitive_allow_unknown(prim: u8) -> Self {
1280 match prim {
1281 0 => Self::TwoGhz,
1282 1 => Self::FiveGhz,
1283 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1284 }
1285 }
1286
1287 #[inline]
1288 pub fn unknown() -> Self {
1289 Self::__SourceBreaking { unknown_ordinal: 0xff }
1290 }
1291
1292 #[inline]
1293 pub const fn into_primitive(self) -> u8 {
1294 match self {
1295 Self::TwoGhz => 0,
1296 Self::FiveGhz => 1,
1297 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1298 }
1299 }
1300
1301 #[inline]
1302 pub fn is_unknown(&self) -> bool {
1303 match self {
1304 Self::__SourceBreaking { unknown_ordinal: _ } => true,
1305 _ => false,
1306 }
1307 }
1308}
1309
1310#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1311#[repr(C)]
1312pub struct CSsid {
1313 pub len: u8,
1314 pub data: [u8; 32],
1315}
1316
1317impl fidl::Persistable for CSsid {}
1318
1319#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1320#[repr(C)]
1321pub struct HtCapabilities {
1322 pub bytes: [u8; 26],
1323}
1324
1325impl fidl::Persistable for HtCapabilities {}
1326
1327#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1328#[repr(C)]
1329pub struct HtOperation {
1330 pub bytes: [u8; 22],
1331}
1332
1333impl fidl::Persistable for HtOperation {}
1334
1335#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1336#[repr(C)]
1337pub struct VhtCapabilities {
1338 pub bytes: [u8; 12],
1339}
1340
1341impl fidl::Persistable for VhtCapabilities {}
1342
1343#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1344#[repr(C)]
1345pub struct VhtOperation {
1346 pub bytes: [u8; 5],
1347}
1348
1349impl fidl::Persistable for VhtOperation {}
1350
1351#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1359pub struct WlanChannel {
1360 pub primary: u8,
1361 pub cbw: ChannelBandwidth,
1362 pub secondary80: u8,
1363}
1364
1365impl fidl::Persistable for WlanChannel {}
1366
1367#[derive(Clone, Debug, Default, PartialEq)]
1369pub struct SetKeyDescriptor {
1370 pub key: Option<Vec<u8>>,
1375 pub key_id: Option<u16>,
1379 pub key_type: Option<KeyType>,
1382 pub peer_addr: Option<[u8; 6]>,
1386 pub rsc: Option<u64>,
1390 pub cipher_oui: Option<[u8; 3]>,
1393 pub cipher_type: Option<CipherSuiteType>,
1396 #[doc(hidden)]
1397 pub __source_breaking: fidl::marker::SourceBreaking,
1398}
1399
1400impl fidl::Persistable for SetKeyDescriptor {}
1401
1402mod internal {
1403 use super::*;
1404 unsafe impl fidl::encoding::TypeMarker for ChannelBandwidth {
1405 type Owned = Self;
1406
1407 #[inline(always)]
1408 fn inline_align(_context: fidl::encoding::Context) -> usize {
1409 std::mem::align_of::<u32>()
1410 }
1411
1412 #[inline(always)]
1413 fn inline_size(_context: fidl::encoding::Context) -> usize {
1414 std::mem::size_of::<u32>()
1415 }
1416
1417 #[inline(always)]
1418 fn encode_is_copy() -> bool {
1419 false
1420 }
1421
1422 #[inline(always)]
1423 fn decode_is_copy() -> bool {
1424 false
1425 }
1426 }
1427
1428 impl fidl::encoding::ValueTypeMarker for ChannelBandwidth {
1429 type Borrowed<'a> = Self;
1430 #[inline(always)]
1431 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1432 *value
1433 }
1434 }
1435
1436 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1437 for ChannelBandwidth
1438 {
1439 #[inline]
1440 unsafe fn encode(
1441 self,
1442 encoder: &mut fidl::encoding::Encoder<'_, D>,
1443 offset: usize,
1444 _depth: fidl::encoding::Depth,
1445 ) -> fidl::Result<()> {
1446 encoder.debug_check_bounds::<Self>(offset);
1447 encoder.write_num(self.into_primitive(), offset);
1448 Ok(())
1449 }
1450 }
1451
1452 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelBandwidth {
1453 #[inline(always)]
1454 fn new_empty() -> Self {
1455 Self::unknown()
1456 }
1457
1458 #[inline]
1459 unsafe fn decode(
1460 &mut self,
1461 decoder: &mut fidl::encoding::Decoder<'_, D>,
1462 offset: usize,
1463 _depth: fidl::encoding::Depth,
1464 ) -> fidl::Result<()> {
1465 decoder.debug_check_bounds::<Self>(offset);
1466 let prim = decoder.read_num::<u32>(offset);
1467
1468 *self = Self::from_primitive_allow_unknown(prim);
1469 Ok(())
1470 }
1471 }
1472 unsafe impl fidl::encoding::TypeMarker for CipherSuiteType {
1473 type Owned = Self;
1474
1475 #[inline(always)]
1476 fn inline_align(_context: fidl::encoding::Context) -> usize {
1477 std::mem::align_of::<u32>()
1478 }
1479
1480 #[inline(always)]
1481 fn inline_size(_context: fidl::encoding::Context) -> usize {
1482 std::mem::size_of::<u32>()
1483 }
1484
1485 #[inline(always)]
1486 fn encode_is_copy() -> bool {
1487 false
1488 }
1489
1490 #[inline(always)]
1491 fn decode_is_copy() -> bool {
1492 false
1493 }
1494 }
1495
1496 impl fidl::encoding::ValueTypeMarker for CipherSuiteType {
1497 type Borrowed<'a> = Self;
1498 #[inline(always)]
1499 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1500 *value
1501 }
1502 }
1503
1504 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1505 for CipherSuiteType
1506 {
1507 #[inline]
1508 unsafe fn encode(
1509 self,
1510 encoder: &mut fidl::encoding::Encoder<'_, D>,
1511 offset: usize,
1512 _depth: fidl::encoding::Depth,
1513 ) -> fidl::Result<()> {
1514 encoder.debug_check_bounds::<Self>(offset);
1515 encoder.write_num(self.into_primitive(), offset);
1516 Ok(())
1517 }
1518 }
1519
1520 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CipherSuiteType {
1521 #[inline(always)]
1522 fn new_empty() -> Self {
1523 Self::unknown()
1524 }
1525
1526 #[inline]
1527 unsafe fn decode(
1528 &mut self,
1529 decoder: &mut fidl::encoding::Decoder<'_, D>,
1530 offset: usize,
1531 _depth: fidl::encoding::Depth,
1532 ) -> fidl::Result<()> {
1533 decoder.debug_check_bounds::<Self>(offset);
1534 let prim = decoder.read_num::<u32>(offset);
1535
1536 *self = Self::from_primitive_allow_unknown(prim);
1537 Ok(())
1538 }
1539 }
1540 unsafe impl fidl::encoding::TypeMarker for KeyType {
1541 type Owned = Self;
1542
1543 #[inline(always)]
1544 fn inline_align(_context: fidl::encoding::Context) -> usize {
1545 std::mem::align_of::<u8>()
1546 }
1547
1548 #[inline(always)]
1549 fn inline_size(_context: fidl::encoding::Context) -> usize {
1550 std::mem::size_of::<u8>()
1551 }
1552
1553 #[inline(always)]
1554 fn encode_is_copy() -> bool {
1555 false
1556 }
1557
1558 #[inline(always)]
1559 fn decode_is_copy() -> bool {
1560 false
1561 }
1562 }
1563
1564 impl fidl::encoding::ValueTypeMarker for KeyType {
1565 type Borrowed<'a> = Self;
1566 #[inline(always)]
1567 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1568 *value
1569 }
1570 }
1571
1572 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for KeyType {
1573 #[inline]
1574 unsafe fn encode(
1575 self,
1576 encoder: &mut fidl::encoding::Encoder<'_, D>,
1577 offset: usize,
1578 _depth: fidl::encoding::Depth,
1579 ) -> fidl::Result<()> {
1580 encoder.debug_check_bounds::<Self>(offset);
1581 encoder.write_num(self.into_primitive(), offset);
1582 Ok(())
1583 }
1584 }
1585
1586 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyType {
1587 #[inline(always)]
1588 fn new_empty() -> Self {
1589 Self::unknown()
1590 }
1591
1592 #[inline]
1593 unsafe fn decode(
1594 &mut self,
1595 decoder: &mut fidl::encoding::Decoder<'_, D>,
1596 offset: usize,
1597 _depth: fidl::encoding::Depth,
1598 ) -> fidl::Result<()> {
1599 decoder.debug_check_bounds::<Self>(offset);
1600 let prim = decoder.read_num::<u8>(offset);
1601
1602 *self = Self::from_primitive_allow_unknown(prim);
1603 Ok(())
1604 }
1605 }
1606 unsafe impl fidl::encoding::TypeMarker for ReasonCode {
1607 type Owned = Self;
1608
1609 #[inline(always)]
1610 fn inline_align(_context: fidl::encoding::Context) -> usize {
1611 std::mem::align_of::<u16>()
1612 }
1613
1614 #[inline(always)]
1615 fn inline_size(_context: fidl::encoding::Context) -> usize {
1616 std::mem::size_of::<u16>()
1617 }
1618
1619 #[inline(always)]
1620 fn encode_is_copy() -> bool {
1621 false
1622 }
1623
1624 #[inline(always)]
1625 fn decode_is_copy() -> bool {
1626 false
1627 }
1628 }
1629
1630 impl fidl::encoding::ValueTypeMarker for ReasonCode {
1631 type Borrowed<'a> = Self;
1632 #[inline(always)]
1633 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1634 *value
1635 }
1636 }
1637
1638 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ReasonCode {
1639 #[inline]
1640 unsafe fn encode(
1641 self,
1642 encoder: &mut fidl::encoding::Encoder<'_, D>,
1643 offset: usize,
1644 _depth: fidl::encoding::Depth,
1645 ) -> fidl::Result<()> {
1646 encoder.debug_check_bounds::<Self>(offset);
1647 encoder.write_num(self.into_primitive(), offset);
1648 Ok(())
1649 }
1650 }
1651
1652 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReasonCode {
1653 #[inline(always)]
1654 fn new_empty() -> Self {
1655 Self::unknown()
1656 }
1657
1658 #[inline]
1659 unsafe fn decode(
1660 &mut self,
1661 decoder: &mut fidl::encoding::Decoder<'_, D>,
1662 offset: usize,
1663 _depth: fidl::encoding::Depth,
1664 ) -> fidl::Result<()> {
1665 decoder.debug_check_bounds::<Self>(offset);
1666 let prim = decoder.read_num::<u16>(offset);
1667
1668 *self = Self::from_primitive_allow_unknown(prim);
1669 Ok(())
1670 }
1671 }
1672 unsafe impl fidl::encoding::TypeMarker for StatusCode {
1673 type Owned = Self;
1674
1675 #[inline(always)]
1676 fn inline_align(_context: fidl::encoding::Context) -> usize {
1677 std::mem::align_of::<u16>()
1678 }
1679
1680 #[inline(always)]
1681 fn inline_size(_context: fidl::encoding::Context) -> usize {
1682 std::mem::size_of::<u16>()
1683 }
1684
1685 #[inline(always)]
1686 fn encode_is_copy() -> bool {
1687 false
1688 }
1689
1690 #[inline(always)]
1691 fn decode_is_copy() -> bool {
1692 false
1693 }
1694 }
1695
1696 impl fidl::encoding::ValueTypeMarker for StatusCode {
1697 type Borrowed<'a> = Self;
1698 #[inline(always)]
1699 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1700 *value
1701 }
1702 }
1703
1704 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for StatusCode {
1705 #[inline]
1706 unsafe fn encode(
1707 self,
1708 encoder: &mut fidl::encoding::Encoder<'_, D>,
1709 offset: usize,
1710 _depth: fidl::encoding::Depth,
1711 ) -> fidl::Result<()> {
1712 encoder.debug_check_bounds::<Self>(offset);
1713 encoder.write_num(self.into_primitive(), offset);
1714 Ok(())
1715 }
1716 }
1717
1718 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StatusCode {
1719 #[inline(always)]
1720 fn new_empty() -> Self {
1721 Self::unknown()
1722 }
1723
1724 #[inline]
1725 unsafe fn decode(
1726 &mut self,
1727 decoder: &mut fidl::encoding::Decoder<'_, D>,
1728 offset: usize,
1729 _depth: fidl::encoding::Depth,
1730 ) -> fidl::Result<()> {
1731 decoder.debug_check_bounds::<Self>(offset);
1732 let prim = decoder.read_num::<u16>(offset);
1733
1734 *self = Self::from_primitive_allow_unknown(prim);
1735 Ok(())
1736 }
1737 }
1738 unsafe impl fidl::encoding::TypeMarker for WlanAccessCategory {
1739 type Owned = Self;
1740
1741 #[inline(always)]
1742 fn inline_align(_context: fidl::encoding::Context) -> usize {
1743 std::mem::align_of::<u32>()
1744 }
1745
1746 #[inline(always)]
1747 fn inline_size(_context: fidl::encoding::Context) -> usize {
1748 std::mem::size_of::<u32>()
1749 }
1750
1751 #[inline(always)]
1752 fn encode_is_copy() -> bool {
1753 true
1754 }
1755
1756 #[inline(always)]
1757 fn decode_is_copy() -> bool {
1758 false
1759 }
1760 }
1761
1762 impl fidl::encoding::ValueTypeMarker for WlanAccessCategory {
1763 type Borrowed<'a> = Self;
1764 #[inline(always)]
1765 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1766 *value
1767 }
1768 }
1769
1770 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1771 for WlanAccessCategory
1772 {
1773 #[inline]
1774 unsafe fn encode(
1775 self,
1776 encoder: &mut fidl::encoding::Encoder<'_, D>,
1777 offset: usize,
1778 _depth: fidl::encoding::Depth,
1779 ) -> fidl::Result<()> {
1780 encoder.debug_check_bounds::<Self>(offset);
1781 encoder.write_num(self.into_primitive(), offset);
1782 Ok(())
1783 }
1784 }
1785
1786 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanAccessCategory {
1787 #[inline(always)]
1788 fn new_empty() -> Self {
1789 Self::Background
1790 }
1791
1792 #[inline]
1793 unsafe fn decode(
1794 &mut self,
1795 decoder: &mut fidl::encoding::Decoder<'_, D>,
1796 offset: usize,
1797 _depth: fidl::encoding::Depth,
1798 ) -> fidl::Result<()> {
1799 decoder.debug_check_bounds::<Self>(offset);
1800 let prim = decoder.read_num::<u32>(offset);
1801
1802 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1803 Ok(())
1804 }
1805 }
1806 unsafe impl fidl::encoding::TypeMarker for WlanBand {
1807 type Owned = Self;
1808
1809 #[inline(always)]
1810 fn inline_align(_context: fidl::encoding::Context) -> usize {
1811 std::mem::align_of::<u8>()
1812 }
1813
1814 #[inline(always)]
1815 fn inline_size(_context: fidl::encoding::Context) -> usize {
1816 std::mem::size_of::<u8>()
1817 }
1818
1819 #[inline(always)]
1820 fn encode_is_copy() -> bool {
1821 false
1822 }
1823
1824 #[inline(always)]
1825 fn decode_is_copy() -> bool {
1826 false
1827 }
1828 }
1829
1830 impl fidl::encoding::ValueTypeMarker for WlanBand {
1831 type Borrowed<'a> = Self;
1832 #[inline(always)]
1833 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1834 *value
1835 }
1836 }
1837
1838 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for WlanBand {
1839 #[inline]
1840 unsafe fn encode(
1841 self,
1842 encoder: &mut fidl::encoding::Encoder<'_, D>,
1843 offset: usize,
1844 _depth: fidl::encoding::Depth,
1845 ) -> fidl::Result<()> {
1846 encoder.debug_check_bounds::<Self>(offset);
1847 encoder.write_num(self.into_primitive(), offset);
1848 Ok(())
1849 }
1850 }
1851
1852 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanBand {
1853 #[inline(always)]
1854 fn new_empty() -> Self {
1855 Self::unknown()
1856 }
1857
1858 #[inline]
1859 unsafe fn decode(
1860 &mut self,
1861 decoder: &mut fidl::encoding::Decoder<'_, D>,
1862 offset: usize,
1863 _depth: fidl::encoding::Depth,
1864 ) -> fidl::Result<()> {
1865 decoder.debug_check_bounds::<Self>(offset);
1866 let prim = decoder.read_num::<u8>(offset);
1867
1868 *self = Self::from_primitive_allow_unknown(prim);
1869 Ok(())
1870 }
1871 }
1872
1873 impl fidl::encoding::ValueTypeMarker for CSsid {
1874 type Borrowed<'a> = &'a Self;
1875 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1876 value
1877 }
1878 }
1879
1880 unsafe impl fidl::encoding::TypeMarker for CSsid {
1881 type Owned = Self;
1882
1883 #[inline(always)]
1884 fn inline_align(_context: fidl::encoding::Context) -> usize {
1885 1
1886 }
1887
1888 #[inline(always)]
1889 fn inline_size(_context: fidl::encoding::Context) -> usize {
1890 33
1891 }
1892 #[inline(always)]
1893 fn encode_is_copy() -> bool {
1894 true
1895 }
1896
1897 #[inline(always)]
1898 fn decode_is_copy() -> bool {
1899 true
1900 }
1901 }
1902
1903 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CSsid, D> for &CSsid {
1904 #[inline]
1905 unsafe fn encode(
1906 self,
1907 encoder: &mut fidl::encoding::Encoder<'_, D>,
1908 offset: usize,
1909 _depth: fidl::encoding::Depth,
1910 ) -> fidl::Result<()> {
1911 encoder.debug_check_bounds::<CSsid>(offset);
1912 unsafe {
1913 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1915 (buf_ptr as *mut CSsid).write_unaligned((self as *const CSsid).read());
1916 }
1919 Ok(())
1920 }
1921 }
1922 unsafe impl<
1923 D: fidl::encoding::ResourceDialect,
1924 T0: fidl::encoding::Encode<u8, D>,
1925 T1: fidl::encoding::Encode<fidl::encoding::Array<u8, 32>, D>,
1926 > fidl::encoding::Encode<CSsid, D> for (T0, T1)
1927 {
1928 #[inline]
1929 unsafe fn encode(
1930 self,
1931 encoder: &mut fidl::encoding::Encoder<'_, D>,
1932 offset: usize,
1933 depth: fidl::encoding::Depth,
1934 ) -> fidl::Result<()> {
1935 encoder.debug_check_bounds::<CSsid>(offset);
1936 self.0.encode(encoder, offset + 0, depth)?;
1940 self.1.encode(encoder, offset + 1, depth)?;
1941 Ok(())
1942 }
1943 }
1944
1945 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CSsid {
1946 #[inline(always)]
1947 fn new_empty() -> Self {
1948 Self {
1949 len: fidl::new_empty!(u8, D),
1950 data: fidl::new_empty!(fidl::encoding::Array<u8, 32>, D),
1951 }
1952 }
1953
1954 #[inline]
1955 unsafe fn decode(
1956 &mut self,
1957 decoder: &mut fidl::encoding::Decoder<'_, D>,
1958 offset: usize,
1959 _depth: fidl::encoding::Depth,
1960 ) -> fidl::Result<()> {
1961 decoder.debug_check_bounds::<Self>(offset);
1962 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1963 unsafe {
1966 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 33);
1967 }
1968 Ok(())
1969 }
1970 }
1971
1972 impl fidl::encoding::ValueTypeMarker for HtCapabilities {
1973 type Borrowed<'a> = &'a Self;
1974 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1975 value
1976 }
1977 }
1978
1979 unsafe impl fidl::encoding::TypeMarker for HtCapabilities {
1980 type Owned = Self;
1981
1982 #[inline(always)]
1983 fn inline_align(_context: fidl::encoding::Context) -> usize {
1984 1
1985 }
1986
1987 #[inline(always)]
1988 fn inline_size(_context: fidl::encoding::Context) -> usize {
1989 26
1990 }
1991 #[inline(always)]
1992 fn encode_is_copy() -> bool {
1993 true
1994 }
1995
1996 #[inline(always)]
1997 fn decode_is_copy() -> bool {
1998 true
1999 }
2000 }
2001
2002 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HtCapabilities, D>
2003 for &HtCapabilities
2004 {
2005 #[inline]
2006 unsafe fn encode(
2007 self,
2008 encoder: &mut fidl::encoding::Encoder<'_, D>,
2009 offset: usize,
2010 _depth: fidl::encoding::Depth,
2011 ) -> fidl::Result<()> {
2012 encoder.debug_check_bounds::<HtCapabilities>(offset);
2013 unsafe {
2014 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2016 (buf_ptr as *mut HtCapabilities)
2017 .write_unaligned((self as *const HtCapabilities).read());
2018 }
2021 Ok(())
2022 }
2023 }
2024 unsafe impl<
2025 D: fidl::encoding::ResourceDialect,
2026 T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 26>, D>,
2027 > fidl::encoding::Encode<HtCapabilities, D> for (T0,)
2028 {
2029 #[inline]
2030 unsafe fn encode(
2031 self,
2032 encoder: &mut fidl::encoding::Encoder<'_, D>,
2033 offset: usize,
2034 depth: fidl::encoding::Depth,
2035 ) -> fidl::Result<()> {
2036 encoder.debug_check_bounds::<HtCapabilities>(offset);
2037 self.0.encode(encoder, offset + 0, depth)?;
2041 Ok(())
2042 }
2043 }
2044
2045 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HtCapabilities {
2046 #[inline(always)]
2047 fn new_empty() -> Self {
2048 Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 26>, D) }
2049 }
2050
2051 #[inline]
2052 unsafe fn decode(
2053 &mut self,
2054 decoder: &mut fidl::encoding::Decoder<'_, D>,
2055 offset: usize,
2056 _depth: fidl::encoding::Depth,
2057 ) -> fidl::Result<()> {
2058 decoder.debug_check_bounds::<Self>(offset);
2059 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2060 unsafe {
2063 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 26);
2064 }
2065 Ok(())
2066 }
2067 }
2068
2069 impl fidl::encoding::ValueTypeMarker for HtOperation {
2070 type Borrowed<'a> = &'a Self;
2071 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2072 value
2073 }
2074 }
2075
2076 unsafe impl fidl::encoding::TypeMarker for HtOperation {
2077 type Owned = Self;
2078
2079 #[inline(always)]
2080 fn inline_align(_context: fidl::encoding::Context) -> usize {
2081 1
2082 }
2083
2084 #[inline(always)]
2085 fn inline_size(_context: fidl::encoding::Context) -> usize {
2086 22
2087 }
2088 #[inline(always)]
2089 fn encode_is_copy() -> bool {
2090 true
2091 }
2092
2093 #[inline(always)]
2094 fn decode_is_copy() -> bool {
2095 true
2096 }
2097 }
2098
2099 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HtOperation, D>
2100 for &HtOperation
2101 {
2102 #[inline]
2103 unsafe fn encode(
2104 self,
2105 encoder: &mut fidl::encoding::Encoder<'_, D>,
2106 offset: usize,
2107 _depth: fidl::encoding::Depth,
2108 ) -> fidl::Result<()> {
2109 encoder.debug_check_bounds::<HtOperation>(offset);
2110 unsafe {
2111 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2113 (buf_ptr as *mut HtOperation).write_unaligned((self as *const HtOperation).read());
2114 }
2117 Ok(())
2118 }
2119 }
2120 unsafe impl<
2121 D: fidl::encoding::ResourceDialect,
2122 T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 22>, D>,
2123 > fidl::encoding::Encode<HtOperation, D> for (T0,)
2124 {
2125 #[inline]
2126 unsafe fn encode(
2127 self,
2128 encoder: &mut fidl::encoding::Encoder<'_, D>,
2129 offset: usize,
2130 depth: fidl::encoding::Depth,
2131 ) -> fidl::Result<()> {
2132 encoder.debug_check_bounds::<HtOperation>(offset);
2133 self.0.encode(encoder, offset + 0, depth)?;
2137 Ok(())
2138 }
2139 }
2140
2141 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HtOperation {
2142 #[inline(always)]
2143 fn new_empty() -> Self {
2144 Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 22>, D) }
2145 }
2146
2147 #[inline]
2148 unsafe fn decode(
2149 &mut self,
2150 decoder: &mut fidl::encoding::Decoder<'_, D>,
2151 offset: usize,
2152 _depth: fidl::encoding::Depth,
2153 ) -> fidl::Result<()> {
2154 decoder.debug_check_bounds::<Self>(offset);
2155 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2156 unsafe {
2159 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 22);
2160 }
2161 Ok(())
2162 }
2163 }
2164
2165 impl fidl::encoding::ValueTypeMarker for VhtCapabilities {
2166 type Borrowed<'a> = &'a Self;
2167 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2168 value
2169 }
2170 }
2171
2172 unsafe impl fidl::encoding::TypeMarker for VhtCapabilities {
2173 type Owned = Self;
2174
2175 #[inline(always)]
2176 fn inline_align(_context: fidl::encoding::Context) -> usize {
2177 1
2178 }
2179
2180 #[inline(always)]
2181 fn inline_size(_context: fidl::encoding::Context) -> usize {
2182 12
2183 }
2184 #[inline(always)]
2185 fn encode_is_copy() -> bool {
2186 true
2187 }
2188
2189 #[inline(always)]
2190 fn decode_is_copy() -> bool {
2191 true
2192 }
2193 }
2194
2195 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VhtCapabilities, D>
2196 for &VhtCapabilities
2197 {
2198 #[inline]
2199 unsafe fn encode(
2200 self,
2201 encoder: &mut fidl::encoding::Encoder<'_, D>,
2202 offset: usize,
2203 _depth: fidl::encoding::Depth,
2204 ) -> fidl::Result<()> {
2205 encoder.debug_check_bounds::<VhtCapabilities>(offset);
2206 unsafe {
2207 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2209 (buf_ptr as *mut VhtCapabilities)
2210 .write_unaligned((self as *const VhtCapabilities).read());
2211 }
2214 Ok(())
2215 }
2216 }
2217 unsafe impl<
2218 D: fidl::encoding::ResourceDialect,
2219 T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 12>, D>,
2220 > fidl::encoding::Encode<VhtCapabilities, D> for (T0,)
2221 {
2222 #[inline]
2223 unsafe fn encode(
2224 self,
2225 encoder: &mut fidl::encoding::Encoder<'_, D>,
2226 offset: usize,
2227 depth: fidl::encoding::Depth,
2228 ) -> fidl::Result<()> {
2229 encoder.debug_check_bounds::<VhtCapabilities>(offset);
2230 self.0.encode(encoder, offset + 0, depth)?;
2234 Ok(())
2235 }
2236 }
2237
2238 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VhtCapabilities {
2239 #[inline(always)]
2240 fn new_empty() -> Self {
2241 Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 12>, D) }
2242 }
2243
2244 #[inline]
2245 unsafe fn decode(
2246 &mut self,
2247 decoder: &mut fidl::encoding::Decoder<'_, D>,
2248 offset: usize,
2249 _depth: fidl::encoding::Depth,
2250 ) -> fidl::Result<()> {
2251 decoder.debug_check_bounds::<Self>(offset);
2252 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2253 unsafe {
2256 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
2257 }
2258 Ok(())
2259 }
2260 }
2261
2262 impl fidl::encoding::ValueTypeMarker for VhtOperation {
2263 type Borrowed<'a> = &'a Self;
2264 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2265 value
2266 }
2267 }
2268
2269 unsafe impl fidl::encoding::TypeMarker for VhtOperation {
2270 type Owned = Self;
2271
2272 #[inline(always)]
2273 fn inline_align(_context: fidl::encoding::Context) -> usize {
2274 1
2275 }
2276
2277 #[inline(always)]
2278 fn inline_size(_context: fidl::encoding::Context) -> usize {
2279 5
2280 }
2281 #[inline(always)]
2282 fn encode_is_copy() -> bool {
2283 true
2284 }
2285
2286 #[inline(always)]
2287 fn decode_is_copy() -> bool {
2288 true
2289 }
2290 }
2291
2292 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VhtOperation, D>
2293 for &VhtOperation
2294 {
2295 #[inline]
2296 unsafe fn encode(
2297 self,
2298 encoder: &mut fidl::encoding::Encoder<'_, D>,
2299 offset: usize,
2300 _depth: fidl::encoding::Depth,
2301 ) -> fidl::Result<()> {
2302 encoder.debug_check_bounds::<VhtOperation>(offset);
2303 unsafe {
2304 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2306 (buf_ptr as *mut VhtOperation)
2307 .write_unaligned((self as *const VhtOperation).read());
2308 }
2311 Ok(())
2312 }
2313 }
2314 unsafe impl<
2315 D: fidl::encoding::ResourceDialect,
2316 T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 5>, D>,
2317 > fidl::encoding::Encode<VhtOperation, D> for (T0,)
2318 {
2319 #[inline]
2320 unsafe fn encode(
2321 self,
2322 encoder: &mut fidl::encoding::Encoder<'_, D>,
2323 offset: usize,
2324 depth: fidl::encoding::Depth,
2325 ) -> fidl::Result<()> {
2326 encoder.debug_check_bounds::<VhtOperation>(offset);
2327 self.0.encode(encoder, offset + 0, depth)?;
2331 Ok(())
2332 }
2333 }
2334
2335 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VhtOperation {
2336 #[inline(always)]
2337 fn new_empty() -> Self {
2338 Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 5>, D) }
2339 }
2340
2341 #[inline]
2342 unsafe fn decode(
2343 &mut self,
2344 decoder: &mut fidl::encoding::Decoder<'_, D>,
2345 offset: usize,
2346 _depth: fidl::encoding::Depth,
2347 ) -> fidl::Result<()> {
2348 decoder.debug_check_bounds::<Self>(offset);
2349 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2350 unsafe {
2353 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 5);
2354 }
2355 Ok(())
2356 }
2357 }
2358
2359 impl fidl::encoding::ValueTypeMarker for WlanChannel {
2360 type Borrowed<'a> = &'a Self;
2361 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2362 value
2363 }
2364 }
2365
2366 unsafe impl fidl::encoding::TypeMarker for WlanChannel {
2367 type Owned = Self;
2368
2369 #[inline(always)]
2370 fn inline_align(_context: fidl::encoding::Context) -> usize {
2371 4
2372 }
2373
2374 #[inline(always)]
2375 fn inline_size(_context: fidl::encoding::Context) -> usize {
2376 12
2377 }
2378 }
2379
2380 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WlanChannel, D>
2381 for &WlanChannel
2382 {
2383 #[inline]
2384 unsafe fn encode(
2385 self,
2386 encoder: &mut fidl::encoding::Encoder<'_, D>,
2387 offset: usize,
2388 _depth: fidl::encoding::Depth,
2389 ) -> fidl::Result<()> {
2390 encoder.debug_check_bounds::<WlanChannel>(offset);
2391 fidl::encoding::Encode::<WlanChannel, D>::encode(
2393 (
2394 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.primary),
2395 <ChannelBandwidth as fidl::encoding::ValueTypeMarker>::borrow(&self.cbw),
2396 <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.secondary80),
2397 ),
2398 encoder,
2399 offset,
2400 _depth,
2401 )
2402 }
2403 }
2404 unsafe impl<
2405 D: fidl::encoding::ResourceDialect,
2406 T0: fidl::encoding::Encode<u8, D>,
2407 T1: fidl::encoding::Encode<ChannelBandwidth, D>,
2408 T2: fidl::encoding::Encode<u8, D>,
2409 > fidl::encoding::Encode<WlanChannel, D> for (T0, T1, T2)
2410 {
2411 #[inline]
2412 unsafe fn encode(
2413 self,
2414 encoder: &mut fidl::encoding::Encoder<'_, D>,
2415 offset: usize,
2416 depth: fidl::encoding::Depth,
2417 ) -> fidl::Result<()> {
2418 encoder.debug_check_bounds::<WlanChannel>(offset);
2419 unsafe {
2422 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2423 (ptr as *mut u32).write_unaligned(0);
2424 }
2425 unsafe {
2426 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2427 (ptr as *mut u32).write_unaligned(0);
2428 }
2429 self.0.encode(encoder, offset + 0, depth)?;
2431 self.1.encode(encoder, offset + 4, depth)?;
2432 self.2.encode(encoder, offset + 8, depth)?;
2433 Ok(())
2434 }
2435 }
2436
2437 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanChannel {
2438 #[inline(always)]
2439 fn new_empty() -> Self {
2440 Self {
2441 primary: fidl::new_empty!(u8, D),
2442 cbw: fidl::new_empty!(ChannelBandwidth, D),
2443 secondary80: fidl::new_empty!(u8, D),
2444 }
2445 }
2446
2447 #[inline]
2448 unsafe fn decode(
2449 &mut self,
2450 decoder: &mut fidl::encoding::Decoder<'_, D>,
2451 offset: usize,
2452 _depth: fidl::encoding::Depth,
2453 ) -> fidl::Result<()> {
2454 decoder.debug_check_bounds::<Self>(offset);
2455 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2457 let padval = unsafe { (ptr as *const u32).read_unaligned() };
2458 let mask = 0xffffff00u32;
2459 let maskedval = padval & mask;
2460 if maskedval != 0 {
2461 return Err(fidl::Error::NonZeroPadding {
2462 padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2463 });
2464 }
2465 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2466 let padval = unsafe { (ptr as *const u32).read_unaligned() };
2467 let mask = 0xffffff00u32;
2468 let maskedval = padval & mask;
2469 if maskedval != 0 {
2470 return Err(fidl::Error::NonZeroPadding {
2471 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2472 });
2473 }
2474 fidl::decode!(u8, D, &mut self.primary, decoder, offset + 0, _depth)?;
2475 fidl::decode!(ChannelBandwidth, D, &mut self.cbw, decoder, offset + 4, _depth)?;
2476 fidl::decode!(u8, D, &mut self.secondary80, decoder, offset + 8, _depth)?;
2477 Ok(())
2478 }
2479 }
2480
2481 impl SetKeyDescriptor {
2482 #[inline(always)]
2483 fn max_ordinal_present(&self) -> u64 {
2484 if let Some(_) = self.cipher_type {
2485 return 7;
2486 }
2487 if let Some(_) = self.cipher_oui {
2488 return 6;
2489 }
2490 if let Some(_) = self.rsc {
2491 return 5;
2492 }
2493 if let Some(_) = self.peer_addr {
2494 return 4;
2495 }
2496 if let Some(_) = self.key_type {
2497 return 3;
2498 }
2499 if let Some(_) = self.key_id {
2500 return 2;
2501 }
2502 if let Some(_) = self.key {
2503 return 1;
2504 }
2505 0
2506 }
2507 }
2508
2509 impl fidl::encoding::ValueTypeMarker for SetKeyDescriptor {
2510 type Borrowed<'a> = &'a Self;
2511 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2512 value
2513 }
2514 }
2515
2516 unsafe impl fidl::encoding::TypeMarker for SetKeyDescriptor {
2517 type Owned = Self;
2518
2519 #[inline(always)]
2520 fn inline_align(_context: fidl::encoding::Context) -> usize {
2521 8
2522 }
2523
2524 #[inline(always)]
2525 fn inline_size(_context: fidl::encoding::Context) -> usize {
2526 16
2527 }
2528 }
2529
2530 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SetKeyDescriptor, D>
2531 for &SetKeyDescriptor
2532 {
2533 unsafe fn encode(
2534 self,
2535 encoder: &mut fidl::encoding::Encoder<'_, D>,
2536 offset: usize,
2537 mut depth: fidl::encoding::Depth,
2538 ) -> fidl::Result<()> {
2539 encoder.debug_check_bounds::<SetKeyDescriptor>(offset);
2540 let max_ordinal: u64 = self.max_ordinal_present();
2542 encoder.write_num(max_ordinal, offset);
2543 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2544 if max_ordinal == 0 {
2546 return Ok(());
2547 }
2548 depth.increment()?;
2549 let envelope_size = 8;
2550 let bytes_len = max_ordinal as usize * envelope_size;
2551 #[allow(unused_variables)]
2552 let offset = encoder.out_of_line_offset(bytes_len);
2553 let mut _prev_end_offset: usize = 0;
2554 if 1 > max_ordinal {
2555 return Ok(());
2556 }
2557
2558 let cur_offset: usize = (1 - 1) * envelope_size;
2561
2562 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2564
2565 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32>, D>(
2570 self.key.as_ref().map(
2571 <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
2572 ),
2573 encoder,
2574 offset + cur_offset,
2575 depth,
2576 )?;
2577
2578 _prev_end_offset = cur_offset + envelope_size;
2579 if 2 > max_ordinal {
2580 return Ok(());
2581 }
2582
2583 let cur_offset: usize = (2 - 1) * envelope_size;
2586
2587 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2589
2590 fidl::encoding::encode_in_envelope_optional::<u16, D>(
2595 self.key_id.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
2596 encoder,
2597 offset + cur_offset,
2598 depth,
2599 )?;
2600
2601 _prev_end_offset = cur_offset + envelope_size;
2602 if 3 > max_ordinal {
2603 return Ok(());
2604 }
2605
2606 let cur_offset: usize = (3 - 1) * envelope_size;
2609
2610 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2612
2613 fidl::encoding::encode_in_envelope_optional::<KeyType, D>(
2618 self.key_type.as_ref().map(<KeyType as fidl::encoding::ValueTypeMarker>::borrow),
2619 encoder,
2620 offset + cur_offset,
2621 depth,
2622 )?;
2623
2624 _prev_end_offset = cur_offset + envelope_size;
2625 if 4 > max_ordinal {
2626 return Ok(());
2627 }
2628
2629 let cur_offset: usize = (4 - 1) * envelope_size;
2632
2633 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2635
2636 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 6>, D>(
2641 self.peer_addr
2642 .as_ref()
2643 .map(<fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow),
2644 encoder,
2645 offset + cur_offset,
2646 depth,
2647 )?;
2648
2649 _prev_end_offset = cur_offset + envelope_size;
2650 if 5 > max_ordinal {
2651 return Ok(());
2652 }
2653
2654 let cur_offset: usize = (5 - 1) * envelope_size;
2657
2658 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2660
2661 fidl::encoding::encode_in_envelope_optional::<u64, D>(
2666 self.rsc.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2667 encoder,
2668 offset + cur_offset,
2669 depth,
2670 )?;
2671
2672 _prev_end_offset = cur_offset + envelope_size;
2673 if 6 > max_ordinal {
2674 return Ok(());
2675 }
2676
2677 let cur_offset: usize = (6 - 1) * envelope_size;
2680
2681 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2683
2684 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 3>, D>(
2689 self.cipher_oui
2690 .as_ref()
2691 .map(<fidl::encoding::Array<u8, 3> as fidl::encoding::ValueTypeMarker>::borrow),
2692 encoder,
2693 offset + cur_offset,
2694 depth,
2695 )?;
2696
2697 _prev_end_offset = cur_offset + envelope_size;
2698 if 7 > max_ordinal {
2699 return Ok(());
2700 }
2701
2702 let cur_offset: usize = (7 - 1) * envelope_size;
2705
2706 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2708
2709 fidl::encoding::encode_in_envelope_optional::<CipherSuiteType, D>(
2714 self.cipher_type
2715 .as_ref()
2716 .map(<CipherSuiteType as fidl::encoding::ValueTypeMarker>::borrow),
2717 encoder,
2718 offset + cur_offset,
2719 depth,
2720 )?;
2721
2722 _prev_end_offset = cur_offset + envelope_size;
2723
2724 Ok(())
2725 }
2726 }
2727
2728 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SetKeyDescriptor {
2729 #[inline(always)]
2730 fn new_empty() -> Self {
2731 Self::default()
2732 }
2733
2734 unsafe fn decode(
2735 &mut self,
2736 decoder: &mut fidl::encoding::Decoder<'_, D>,
2737 offset: usize,
2738 mut depth: fidl::encoding::Depth,
2739 ) -> fidl::Result<()> {
2740 decoder.debug_check_bounds::<Self>(offset);
2741 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2742 None => return Err(fidl::Error::NotNullable),
2743 Some(len) => len,
2744 };
2745 if len == 0 {
2747 return Ok(());
2748 };
2749 depth.increment()?;
2750 let envelope_size = 8;
2751 let bytes_len = len * envelope_size;
2752 let offset = decoder.out_of_line_offset(bytes_len)?;
2753 let mut _next_ordinal_to_read = 0;
2755 let mut next_offset = offset;
2756 let end_offset = offset + bytes_len;
2757 _next_ordinal_to_read += 1;
2758 if next_offset >= end_offset {
2759 return Ok(());
2760 }
2761
2762 while _next_ordinal_to_read < 1 {
2764 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2765 _next_ordinal_to_read += 1;
2766 next_offset += envelope_size;
2767 }
2768
2769 let next_out_of_line = decoder.next_out_of_line();
2770 let handles_before = decoder.remaining_handles();
2771 if let Some((inlined, num_bytes, num_handles)) =
2772 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2773 {
2774 let member_inline_size =
2775 <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
2776 decoder.context,
2777 );
2778 if inlined != (member_inline_size <= 4) {
2779 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2780 }
2781 let inner_offset;
2782 let mut inner_depth = depth.clone();
2783 if inlined {
2784 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2785 inner_offset = next_offset;
2786 } else {
2787 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2788 inner_depth.increment()?;
2789 }
2790 let val_ref = self
2791 .key
2792 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D));
2793 fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
2794 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2795 {
2796 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2797 }
2798 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2799 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2800 }
2801 }
2802
2803 next_offset += envelope_size;
2804 _next_ordinal_to_read += 1;
2805 if next_offset >= end_offset {
2806 return Ok(());
2807 }
2808
2809 while _next_ordinal_to_read < 2 {
2811 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2812 _next_ordinal_to_read += 1;
2813 next_offset += envelope_size;
2814 }
2815
2816 let next_out_of_line = decoder.next_out_of_line();
2817 let handles_before = decoder.remaining_handles();
2818 if let Some((inlined, num_bytes, num_handles)) =
2819 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2820 {
2821 let member_inline_size =
2822 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2823 if inlined != (member_inline_size <= 4) {
2824 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2825 }
2826 let inner_offset;
2827 let mut inner_depth = depth.clone();
2828 if inlined {
2829 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2830 inner_offset = next_offset;
2831 } else {
2832 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2833 inner_depth.increment()?;
2834 }
2835 let val_ref = self.key_id.get_or_insert_with(|| fidl::new_empty!(u16, D));
2836 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
2837 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2838 {
2839 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2840 }
2841 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2842 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2843 }
2844 }
2845
2846 next_offset += envelope_size;
2847 _next_ordinal_to_read += 1;
2848 if next_offset >= end_offset {
2849 return Ok(());
2850 }
2851
2852 while _next_ordinal_to_read < 3 {
2854 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2855 _next_ordinal_to_read += 1;
2856 next_offset += envelope_size;
2857 }
2858
2859 let next_out_of_line = decoder.next_out_of_line();
2860 let handles_before = decoder.remaining_handles();
2861 if let Some((inlined, num_bytes, num_handles)) =
2862 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2863 {
2864 let member_inline_size =
2865 <KeyType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2866 if inlined != (member_inline_size <= 4) {
2867 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2868 }
2869 let inner_offset;
2870 let mut inner_depth = depth.clone();
2871 if inlined {
2872 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2873 inner_offset = next_offset;
2874 } else {
2875 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2876 inner_depth.increment()?;
2877 }
2878 let val_ref = self.key_type.get_or_insert_with(|| fidl::new_empty!(KeyType, D));
2879 fidl::decode!(KeyType, D, val_ref, decoder, inner_offset, inner_depth)?;
2880 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2881 {
2882 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2883 }
2884 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2885 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2886 }
2887 }
2888
2889 next_offset += envelope_size;
2890 _next_ordinal_to_read += 1;
2891 if next_offset >= end_offset {
2892 return Ok(());
2893 }
2894
2895 while _next_ordinal_to_read < 4 {
2897 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2898 _next_ordinal_to_read += 1;
2899 next_offset += envelope_size;
2900 }
2901
2902 let next_out_of_line = decoder.next_out_of_line();
2903 let handles_before = decoder.remaining_handles();
2904 if let Some((inlined, num_bytes, num_handles)) =
2905 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2906 {
2907 let member_inline_size =
2908 <fidl::encoding::Array<u8, 6> as fidl::encoding::TypeMarker>::inline_size(
2909 decoder.context,
2910 );
2911 if inlined != (member_inline_size <= 4) {
2912 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2913 }
2914 let inner_offset;
2915 let mut inner_depth = depth.clone();
2916 if inlined {
2917 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2918 inner_offset = next_offset;
2919 } else {
2920 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2921 inner_depth.increment()?;
2922 }
2923 let val_ref = self
2924 .peer_addr
2925 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 6>, D));
2926 fidl::decode!(fidl::encoding::Array<u8, 6>, D, val_ref, decoder, inner_offset, inner_depth)?;
2927 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2928 {
2929 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2930 }
2931 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2932 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2933 }
2934 }
2935
2936 next_offset += envelope_size;
2937 _next_ordinal_to_read += 1;
2938 if next_offset >= end_offset {
2939 return Ok(());
2940 }
2941
2942 while _next_ordinal_to_read < 5 {
2944 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2945 _next_ordinal_to_read += 1;
2946 next_offset += envelope_size;
2947 }
2948
2949 let next_out_of_line = decoder.next_out_of_line();
2950 let handles_before = decoder.remaining_handles();
2951 if let Some((inlined, num_bytes, num_handles)) =
2952 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2953 {
2954 let member_inline_size =
2955 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2956 if inlined != (member_inline_size <= 4) {
2957 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2958 }
2959 let inner_offset;
2960 let mut inner_depth = depth.clone();
2961 if inlined {
2962 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2963 inner_offset = next_offset;
2964 } else {
2965 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2966 inner_depth.increment()?;
2967 }
2968 let val_ref = self.rsc.get_or_insert_with(|| fidl::new_empty!(u64, D));
2969 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2970 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2971 {
2972 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2973 }
2974 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2975 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2976 }
2977 }
2978
2979 next_offset += envelope_size;
2980 _next_ordinal_to_read += 1;
2981 if next_offset >= end_offset {
2982 return Ok(());
2983 }
2984
2985 while _next_ordinal_to_read < 6 {
2987 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2988 _next_ordinal_to_read += 1;
2989 next_offset += envelope_size;
2990 }
2991
2992 let next_out_of_line = decoder.next_out_of_line();
2993 let handles_before = decoder.remaining_handles();
2994 if let Some((inlined, num_bytes, num_handles)) =
2995 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2996 {
2997 let member_inline_size =
2998 <fidl::encoding::Array<u8, 3> as fidl::encoding::TypeMarker>::inline_size(
2999 decoder.context,
3000 );
3001 if inlined != (member_inline_size <= 4) {
3002 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3003 }
3004 let inner_offset;
3005 let mut inner_depth = depth.clone();
3006 if inlined {
3007 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3008 inner_offset = next_offset;
3009 } else {
3010 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3011 inner_depth.increment()?;
3012 }
3013 let val_ref = self
3014 .cipher_oui
3015 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 3>, D));
3016 fidl::decode!(fidl::encoding::Array<u8, 3>, D, val_ref, decoder, inner_offset, inner_depth)?;
3017 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3018 {
3019 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3020 }
3021 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3022 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3023 }
3024 }
3025
3026 next_offset += envelope_size;
3027 _next_ordinal_to_read += 1;
3028 if next_offset >= end_offset {
3029 return Ok(());
3030 }
3031
3032 while _next_ordinal_to_read < 7 {
3034 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3035 _next_ordinal_to_read += 1;
3036 next_offset += envelope_size;
3037 }
3038
3039 let next_out_of_line = decoder.next_out_of_line();
3040 let handles_before = decoder.remaining_handles();
3041 if let Some((inlined, num_bytes, num_handles)) =
3042 fidl::encoding::decode_envelope_header(decoder, next_offset)?
3043 {
3044 let member_inline_size =
3045 <CipherSuiteType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3046 if inlined != (member_inline_size <= 4) {
3047 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3048 }
3049 let inner_offset;
3050 let mut inner_depth = depth.clone();
3051 if inlined {
3052 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3053 inner_offset = next_offset;
3054 } else {
3055 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3056 inner_depth.increment()?;
3057 }
3058 let val_ref =
3059 self.cipher_type.get_or_insert_with(|| fidl::new_empty!(CipherSuiteType, D));
3060 fidl::decode!(CipherSuiteType, D, val_ref, decoder, inner_offset, inner_depth)?;
3061 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3062 {
3063 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3064 }
3065 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3066 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3067 }
3068 }
3069
3070 next_offset += envelope_size;
3071
3072 while next_offset < end_offset {
3074 _next_ordinal_to_read += 1;
3075 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3076 next_offset += envelope_size;
3077 }
3078
3079 Ok(())
3080 }
3081 }
3082}