fidl_fuchsia_wlan_ieee80211__common/
fidl_fuchsia_wlan_ieee80211__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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
19/// IEEE Std 802.11-2016 12.5.3.2
20pub 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
32/// IEEE Std 802.11-2016, 9.4.2.99
33pub const MAX_MESH_ID_BYTE_LEN: u8 = 32;
34
35/// IEEE Std 802.11-2016, 9.3.3.2
36pub const MAX_MGMT_FRAME_MAC_HEADER_BYTE_LEN: u8 = 28;
37
38/// IEEE Std 802.11-2016, 9.2.4.7
39pub const MAX_MMPDU_BYTE_LEN: u16 = 2304;
40
41/// IEEE Std 802.11-2016, 9.4.2.2
42/// The maximum length of an SSID is 32 bytes, even when the SSID should be
43/// interpreted using UTF-8 encoding (see Table 9-135). While every length in
44/// the 802.11 standard is byte oriented, the word BYTE is included in the
45/// name of this constant to emphasize the importance that it not be applied
46/// to the length of a UTF-8 encoded string.
47pub const MAX_SSID_BYTE_LEN: u8 = 32;
48
49pub const MAX_SUPPORTED_BASIC_RATES: u8 = 12;
50
51/// The limit on the number of channels in a list of unique channel numbers is 256
52/// since a channel number in IEEE 802.11-2016 cannot exceed one octet. See
53/// IEEE 802.11-2016 9.4.2.18 Supported Channels element for an example element
54/// that assumes a channel number does not exceed one octet.
55pub 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
65/// The limit on the number of SSIDs is 84 because an SSID List IE can contain no
66/// more than 84 one byte SSIDs. (Specifying a zero byte SSID in an SSID List with
67/// more than one SSID is valid but unnecessary since it is the wildcard SSID.)
68pub const SSID_LIST_MAX: u8 = 84;
69
70/// IEEE Std 802.11-2016, 9.2.4.5
71pub 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
79/// IEEE Std 802.11-2016, 9.4.2.25.1
80/// IEEE mentions that an element body maximum length is 255 octets in the RSN element
81/// section, but not in a dedicated section.
82/// Since the IE header is two octets, the whole IE max length is 257 octets.
83pub const WLAN_IE_MAX_LEN: u32 = 257;
84
85/// IEEE Std 802.11-2016, Table 9-19
86pub const WLAN_MSDU_MAX_LEN: u32 = 2304;
87
88/// Channel width is derived from the HT operation and VHT operation IEs,
89/// or defaults to 20 MHz if not specified explicitly
90///
91/// IEEE Std 802.11-2016, Table 9-153 - HT/VHT Operation Information subfields
92#[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/// Pattern that matches an unknown `ChannelBandwidth` member.
107#[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/// IEEE Std 802.11-2016, 9.4.2.25.2
169#[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/// Pattern that matches an unknown `CipherSuiteType` member.
193#[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/// Pattern that matches an unknown `KeyType` member.
294#[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/// 802.11 reason codes.  These values are common throughout the standard.
350/// IEEE Std 802.11-2016, 9.4.1.7, Table 9-45
351#[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    /// 15 is named "4WAY_HANDSHAKE_TIMEOUT" in 802.11-2016.
368    FourwayHandshakeTimeout,
369    GkHandshakeTimeout,
370    HandshakeElementMismatch,
371    ReasonInvalidGroupCipher,
372    ReasonInvalidPairwiseCipher,
373    ReasonInvalidAkmp,
374    UnsupportedRsneVersion,
375    InvalidRsneCapabilities,
376    /// 23 is named "802_1_X_AUTH_FAILED" in 802.11-2016.
377    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    /// 37 is assigned to multiple names "END_TS", "END_BA", and "END_DLS" in 802.11-2016.
392    EndTsBaDls,
393    /// 38 is assigned to multiple names "UNKNOWN_TS" and "UNKNOWN_BA" in 802.11-2016.
394    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    /// -----
419    /// Values 67 to 127 are reserved by the IEEE protocol, and
420    /// values 128 to 65535 are reserved for platform use.
421    /// -----
422    /// MLME lost the link, usually caused by loss of signal with the AP.
423    MlmeLinkFailed,
424    /// Driver detected a stalled Rx path in FW.
425    FwRxStalled,
426    /// Driver detected high wme rx error rate in FW.
427    FwHighWmeRxErrRate,
428    #[doc(hidden)]
429    __SourceBreaking {
430        unknown_ordinal: u16,
431    },
432}
433
434/// Pattern that matches an unknown `ReasonCode` member.
435#[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/// 802.11 status codes.  These values are common throughout the standard.
671/// IEEE Std 802.11-2016, 9.4.1.9, Table 9-46
672#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
673pub enum StatusCode {
674    Success,
675    RefusedReasonUnspecified,
676    TdlsRejectedAlternativeProvided,
677    TdlsRejected,
678    /// 4 reserved.
679    SecurityDisabled,
680    UnacceptableLifetime,
681    NotInSameBss,
682    /// 8-9 reserved.
683    RefusedCapabilitiesMismatch,
684    DeniedNoAssociationExists,
685    DeniedOtherReason,
686    UnsupportedAuthAlgorithm,
687    TransactionSequenceError,
688    ChallengeFailure,
689    RejectedSequenceTimeout,
690    DeniedNoMoreStas,
691    RefusedBasicRatesMismatch,
692    DeniedNoShortPreambleSupport,
693    /// 20-21 reserved.
694    RejectedSpectrumManagementRequired,
695    RejectedBadPowerCapability,
696    RejectedBadSupportedChannels,
697    DeniedNoShortSlotTimeSupport,
698    /// 26 reserved.
699    DeniedNoHtSupport,
700    R0KhUnreachable,
701    DeniedPcoTimeNotSupported,
702    RefusedTemporarily,
703    RobustManagementPolicyViolation,
704    UnspecifiedQosFailure,
705    DeniedInsufficientBandwidth,
706    DeniedPoorChannelConditions,
707    DeniedQosNotSupported,
708    /// 36 reserved.
709    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    /// 56 is assigned to "REQUESTED_TCLAS_NOT_SUPPORTED_BY_AP" in 802.11-2016, duplicate with 80.
729    /// Name below is as listed in the 802.11 Assigned Numbers Authority database.
730    RequestedTclasNotSupportedByAp,
731    InsufficientTclasProcessingResources,
732    TryAnotherBss,
733    GasAdvertisementProtocolNotSupported,
734    NoOutstandingGasRequest,
735    GasResponseNotReceivedFromServer,
736    GasQueryTimeout,
737    GasQueryResponseTooLarge,
738    RejectedHomeWithSuggestedChanges,
739    ServerUnreachable,
740    /// 66 reserved.
741    RejectedForSspPermissions,
742    RefusedUnauthenticatedAccessNotSupported,
743    /// 69-71 reserved.
744    InvalidRsne,
745    UApsdCoexistanceNotSupported,
746    UApsdCoexModeNotSupported,
747    BadIntervalWithUApsdCoex,
748    AntiCloggingTokenRequired,
749    UnsupportedFiniteCyclicGroup,
750    CannotFindAlternativeTbtt,
751    TransmissionFailure,
752    /// See assignment for 56.
753    RequestedTclasNotSupported,
754    TclasResourcesExhausted,
755    RejectedWithSuggestedBssTransition,
756    RejectWithSchedule,
757    RejectNoWakeupSpecified,
758    SuccessPowerSaveMode,
759    PendingAdmittingFstSession,
760    PerformingFstNow,
761    PendingGapInBaWindow,
762    RejectUPidSetting,
763    /// 90-91 reserved.
764    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    /// 114-115 reserved.
787    DeniedNotificationPeriodAllocation,
788    DeniedChannelSplitting,
789    DeniedAllocation,
790    CmmgFeaturesNotSupported,
791    GasFragmentNotAvailable,
792    SuccessCagVersionsMatch,
793    GlkNotAuthorized,
794    UnknownPasswordIdentifier,
795    /// 124 reserved.
796    DeniedLocalMacAddressPolicyViolation,
797    SaeHashToElement,
798    /// 127 reserved.
799    TclasProcessingTerminatedInsufficientQos,
800    TclasProcessingTerminatedPolicyConflict,
801    /// Reserved values we will use for our own purposes.
802    /// -----
803    /// Failure when joining the BSS.
804    JoinFailure,
805    /// Authenticate or associate fails due to spurious deauth or diassoc.
806    SpuriousDeauthOrDisassoc,
807    /// Connect attempt is canceled
808    Canceled,
809    /// Failure establishing security association
810    EstablishRsnaFailure,
811    /// Failure initiating OWE handshake or receiving public key from peer
812    OweHandshakeFailure,
813    #[doc(hidden)]
814    __SourceBreaking {
815        unknown_ordinal: u16,
816    },
817}
818
819/// Pattern that matches an unknown `StatusCode` member.
820#[macro_export]
821macro_rules! StatusCodeUnknown {
822    () => {
823        _
824    };
825}
826
827impl StatusCode {
828    #[inline]
829    pub fn from_primitive(prim: u16) -> Option<Self> {
830        match prim {
831            0 => Some(Self::Success),
832            1 => Some(Self::RefusedReasonUnspecified),
833            2 => Some(Self::TdlsRejectedAlternativeProvided),
834            3 => Some(Self::TdlsRejected),
835            5 => Some(Self::SecurityDisabled),
836            6 => Some(Self::UnacceptableLifetime),
837            7 => Some(Self::NotInSameBss),
838            10 => Some(Self::RefusedCapabilitiesMismatch),
839            11 => Some(Self::DeniedNoAssociationExists),
840            12 => Some(Self::DeniedOtherReason),
841            13 => Some(Self::UnsupportedAuthAlgorithm),
842            14 => Some(Self::TransactionSequenceError),
843            15 => Some(Self::ChallengeFailure),
844            16 => Some(Self::RejectedSequenceTimeout),
845            17 => Some(Self::DeniedNoMoreStas),
846            18 => Some(Self::RefusedBasicRatesMismatch),
847            19 => Some(Self::DeniedNoShortPreambleSupport),
848            22 => Some(Self::RejectedSpectrumManagementRequired),
849            23 => Some(Self::RejectedBadPowerCapability),
850            24 => Some(Self::RejectedBadSupportedChannels),
851            25 => Some(Self::DeniedNoShortSlotTimeSupport),
852            27 => Some(Self::DeniedNoHtSupport),
853            28 => Some(Self::R0KhUnreachable),
854            29 => Some(Self::DeniedPcoTimeNotSupported),
855            30 => Some(Self::RefusedTemporarily),
856            31 => Some(Self::RobustManagementPolicyViolation),
857            32 => Some(Self::UnspecifiedQosFailure),
858            33 => Some(Self::DeniedInsufficientBandwidth),
859            34 => Some(Self::DeniedPoorChannelConditions),
860            35 => Some(Self::DeniedQosNotSupported),
861            37 => Some(Self::RequestDeclined),
862            38 => Some(Self::InvalidParameters),
863            39 => Some(Self::RejectedWithSuggestedChanges),
864            40 => Some(Self::StatusInvalidElement),
865            41 => Some(Self::StatusInvalidGroupCipher),
866            42 => Some(Self::StatusInvalidPairwiseCipher),
867            43 => Some(Self::StatusInvalidAkmp),
868            44 => Some(Self::UnsupportedRsneVersion),
869            45 => Some(Self::InvalidRsneCapabilities),
870            46 => Some(Self::StatusCipherOutOfPolicy),
871            47 => Some(Self::RejectedForDelayPeriod),
872            48 => Some(Self::DlsNotAllowed),
873            49 => Some(Self::NotPresent),
874            50 => Some(Self::NotQosSta),
875            51 => Some(Self::DeniedListenIntervalTooLarge),
876            52 => Some(Self::StatusInvalidFtActionFrameCount),
877            53 => Some(Self::StatusInvalidPmkid),
878            54 => Some(Self::StatusInvalidMde),
879            55 => Some(Self::StatusInvalidFte),
880            56 => Some(Self::RequestedTclasNotSupportedByAp),
881            57 => Some(Self::InsufficientTclasProcessingResources),
882            58 => Some(Self::TryAnotherBss),
883            59 => Some(Self::GasAdvertisementProtocolNotSupported),
884            60 => Some(Self::NoOutstandingGasRequest),
885            61 => Some(Self::GasResponseNotReceivedFromServer),
886            62 => Some(Self::GasQueryTimeout),
887            63 => Some(Self::GasQueryResponseTooLarge),
888            64 => Some(Self::RejectedHomeWithSuggestedChanges),
889            65 => Some(Self::ServerUnreachable),
890            67 => Some(Self::RejectedForSspPermissions),
891            68 => Some(Self::RefusedUnauthenticatedAccessNotSupported),
892            72 => Some(Self::InvalidRsne),
893            73 => Some(Self::UApsdCoexistanceNotSupported),
894            74 => Some(Self::UApsdCoexModeNotSupported),
895            75 => Some(Self::BadIntervalWithUApsdCoex),
896            76 => Some(Self::AntiCloggingTokenRequired),
897            77 => Some(Self::UnsupportedFiniteCyclicGroup),
898            78 => Some(Self::CannotFindAlternativeTbtt),
899            79 => Some(Self::TransmissionFailure),
900            80 => Some(Self::RequestedTclasNotSupported),
901            81 => Some(Self::TclasResourcesExhausted),
902            82 => Some(Self::RejectedWithSuggestedBssTransition),
903            83 => Some(Self::RejectWithSchedule),
904            84 => Some(Self::RejectNoWakeupSpecified),
905            85 => Some(Self::SuccessPowerSaveMode),
906            86 => Some(Self::PendingAdmittingFstSession),
907            87 => Some(Self::PerformingFstNow),
908            88 => Some(Self::PendingGapInBaWindow),
909            89 => Some(Self::RejectUPidSetting),
910            92 => Some(Self::RefusedExternalReason),
911            93 => Some(Self::RefusedApOutOfMemory),
912            94 => Some(Self::RejectedEmergencyServicesNotSupported),
913            95 => Some(Self::QueryResponseOutstanding),
914            96 => Some(Self::RejectDseBand),
915            97 => Some(Self::TclasProcessingTerminated),
916            98 => Some(Self::TsScheduleConflict),
917            99 => Some(Self::DeniedWithSuggestedBandAndChannel),
918            100 => Some(Self::MccaopReservationConflict),
919            101 => Some(Self::MafLimitExceeded),
920            102 => Some(Self::MccaTrackLimitExceeded),
921            103 => Some(Self::DeniedDueToSpectrumManagement),
922            104 => Some(Self::DeniedVhtNotSupported),
923            105 => Some(Self::EnablementDenied),
924            106 => Some(Self::RestrictionFromAuthorizedGdb),
925            107 => Some(Self::AuthorizationDeenabled),
926            108 => Some(Self::EnergyLimitedOperationNotSupported),
927            109 => Some(Self::RejectedNdpBlockAckSuggested),
928            110 => Some(Self::RejectedMaxAwayDurationUnacceptable),
929            111 => Some(Self::FlowControlOperationSupported),
930            112 => Some(Self::FilsAuthenticationFailure),
931            113 => Some(Self::UnknownAuthenticationServer),
932            116 => Some(Self::DeniedNotificationPeriodAllocation),
933            117 => Some(Self::DeniedChannelSplitting),
934            118 => Some(Self::DeniedAllocation),
935            119 => Some(Self::CmmgFeaturesNotSupported),
936            120 => Some(Self::GasFragmentNotAvailable),
937            121 => Some(Self::SuccessCagVersionsMatch),
938            122 => Some(Self::GlkNotAuthorized),
939            123 => Some(Self::UnknownPasswordIdentifier),
940            125 => Some(Self::DeniedLocalMacAddressPolicyViolation),
941            126 => Some(Self::SaeHashToElement),
942            128 => Some(Self::TclasProcessingTerminatedInsufficientQos),
943            129 => Some(Self::TclasProcessingTerminatedPolicyConflict),
944            256 => Some(Self::JoinFailure),
945            257 => Some(Self::SpuriousDeauthOrDisassoc),
946            258 => Some(Self::Canceled),
947            259 => Some(Self::EstablishRsnaFailure),
948            260 => Some(Self::OweHandshakeFailure),
949            _ => None,
950        }
951    }
952
953    #[inline]
954    pub fn from_primitive_allow_unknown(prim: u16) -> Self {
955        match prim {
956            0 => Self::Success,
957            1 => Self::RefusedReasonUnspecified,
958            2 => Self::TdlsRejectedAlternativeProvided,
959            3 => Self::TdlsRejected,
960            5 => Self::SecurityDisabled,
961            6 => Self::UnacceptableLifetime,
962            7 => Self::NotInSameBss,
963            10 => Self::RefusedCapabilitiesMismatch,
964            11 => Self::DeniedNoAssociationExists,
965            12 => Self::DeniedOtherReason,
966            13 => Self::UnsupportedAuthAlgorithm,
967            14 => Self::TransactionSequenceError,
968            15 => Self::ChallengeFailure,
969            16 => Self::RejectedSequenceTimeout,
970            17 => Self::DeniedNoMoreStas,
971            18 => Self::RefusedBasicRatesMismatch,
972            19 => Self::DeniedNoShortPreambleSupport,
973            22 => Self::RejectedSpectrumManagementRequired,
974            23 => Self::RejectedBadPowerCapability,
975            24 => Self::RejectedBadSupportedChannels,
976            25 => Self::DeniedNoShortSlotTimeSupport,
977            27 => Self::DeniedNoHtSupport,
978            28 => Self::R0KhUnreachable,
979            29 => Self::DeniedPcoTimeNotSupported,
980            30 => Self::RefusedTemporarily,
981            31 => Self::RobustManagementPolicyViolation,
982            32 => Self::UnspecifiedQosFailure,
983            33 => Self::DeniedInsufficientBandwidth,
984            34 => Self::DeniedPoorChannelConditions,
985            35 => Self::DeniedQosNotSupported,
986            37 => Self::RequestDeclined,
987            38 => Self::InvalidParameters,
988            39 => Self::RejectedWithSuggestedChanges,
989            40 => Self::StatusInvalidElement,
990            41 => Self::StatusInvalidGroupCipher,
991            42 => Self::StatusInvalidPairwiseCipher,
992            43 => Self::StatusInvalidAkmp,
993            44 => Self::UnsupportedRsneVersion,
994            45 => Self::InvalidRsneCapabilities,
995            46 => Self::StatusCipherOutOfPolicy,
996            47 => Self::RejectedForDelayPeriod,
997            48 => Self::DlsNotAllowed,
998            49 => Self::NotPresent,
999            50 => Self::NotQosSta,
1000            51 => Self::DeniedListenIntervalTooLarge,
1001            52 => Self::StatusInvalidFtActionFrameCount,
1002            53 => Self::StatusInvalidPmkid,
1003            54 => Self::StatusInvalidMde,
1004            55 => Self::StatusInvalidFte,
1005            56 => Self::RequestedTclasNotSupportedByAp,
1006            57 => Self::InsufficientTclasProcessingResources,
1007            58 => Self::TryAnotherBss,
1008            59 => Self::GasAdvertisementProtocolNotSupported,
1009            60 => Self::NoOutstandingGasRequest,
1010            61 => Self::GasResponseNotReceivedFromServer,
1011            62 => Self::GasQueryTimeout,
1012            63 => Self::GasQueryResponseTooLarge,
1013            64 => Self::RejectedHomeWithSuggestedChanges,
1014            65 => Self::ServerUnreachable,
1015            67 => Self::RejectedForSspPermissions,
1016            68 => Self::RefusedUnauthenticatedAccessNotSupported,
1017            72 => Self::InvalidRsne,
1018            73 => Self::UApsdCoexistanceNotSupported,
1019            74 => Self::UApsdCoexModeNotSupported,
1020            75 => Self::BadIntervalWithUApsdCoex,
1021            76 => Self::AntiCloggingTokenRequired,
1022            77 => Self::UnsupportedFiniteCyclicGroup,
1023            78 => Self::CannotFindAlternativeTbtt,
1024            79 => Self::TransmissionFailure,
1025            80 => Self::RequestedTclasNotSupported,
1026            81 => Self::TclasResourcesExhausted,
1027            82 => Self::RejectedWithSuggestedBssTransition,
1028            83 => Self::RejectWithSchedule,
1029            84 => Self::RejectNoWakeupSpecified,
1030            85 => Self::SuccessPowerSaveMode,
1031            86 => Self::PendingAdmittingFstSession,
1032            87 => Self::PerformingFstNow,
1033            88 => Self::PendingGapInBaWindow,
1034            89 => Self::RejectUPidSetting,
1035            92 => Self::RefusedExternalReason,
1036            93 => Self::RefusedApOutOfMemory,
1037            94 => Self::RejectedEmergencyServicesNotSupported,
1038            95 => Self::QueryResponseOutstanding,
1039            96 => Self::RejectDseBand,
1040            97 => Self::TclasProcessingTerminated,
1041            98 => Self::TsScheduleConflict,
1042            99 => Self::DeniedWithSuggestedBandAndChannel,
1043            100 => Self::MccaopReservationConflict,
1044            101 => Self::MafLimitExceeded,
1045            102 => Self::MccaTrackLimitExceeded,
1046            103 => Self::DeniedDueToSpectrumManagement,
1047            104 => Self::DeniedVhtNotSupported,
1048            105 => Self::EnablementDenied,
1049            106 => Self::RestrictionFromAuthorizedGdb,
1050            107 => Self::AuthorizationDeenabled,
1051            108 => Self::EnergyLimitedOperationNotSupported,
1052            109 => Self::RejectedNdpBlockAckSuggested,
1053            110 => Self::RejectedMaxAwayDurationUnacceptable,
1054            111 => Self::FlowControlOperationSupported,
1055            112 => Self::FilsAuthenticationFailure,
1056            113 => Self::UnknownAuthenticationServer,
1057            116 => Self::DeniedNotificationPeriodAllocation,
1058            117 => Self::DeniedChannelSplitting,
1059            118 => Self::DeniedAllocation,
1060            119 => Self::CmmgFeaturesNotSupported,
1061            120 => Self::GasFragmentNotAvailable,
1062            121 => Self::SuccessCagVersionsMatch,
1063            122 => Self::GlkNotAuthorized,
1064            123 => Self::UnknownPasswordIdentifier,
1065            125 => Self::DeniedLocalMacAddressPolicyViolation,
1066            126 => Self::SaeHashToElement,
1067            128 => Self::TclasProcessingTerminatedInsufficientQos,
1068            129 => Self::TclasProcessingTerminatedPolicyConflict,
1069            256 => Self::JoinFailure,
1070            257 => Self::SpuriousDeauthOrDisassoc,
1071            258 => Self::Canceled,
1072            259 => Self::EstablishRsnaFailure,
1073            260 => Self::OweHandshakeFailure,
1074            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1075        }
1076    }
1077
1078    #[inline]
1079    pub fn unknown() -> Self {
1080        Self::__SourceBreaking { unknown_ordinal: 0xffff }
1081    }
1082
1083    #[inline]
1084    pub const fn into_primitive(self) -> u16 {
1085        match self {
1086            Self::Success => 0,
1087            Self::RefusedReasonUnspecified => 1,
1088            Self::TdlsRejectedAlternativeProvided => 2,
1089            Self::TdlsRejected => 3,
1090            Self::SecurityDisabled => 5,
1091            Self::UnacceptableLifetime => 6,
1092            Self::NotInSameBss => 7,
1093            Self::RefusedCapabilitiesMismatch => 10,
1094            Self::DeniedNoAssociationExists => 11,
1095            Self::DeniedOtherReason => 12,
1096            Self::UnsupportedAuthAlgorithm => 13,
1097            Self::TransactionSequenceError => 14,
1098            Self::ChallengeFailure => 15,
1099            Self::RejectedSequenceTimeout => 16,
1100            Self::DeniedNoMoreStas => 17,
1101            Self::RefusedBasicRatesMismatch => 18,
1102            Self::DeniedNoShortPreambleSupport => 19,
1103            Self::RejectedSpectrumManagementRequired => 22,
1104            Self::RejectedBadPowerCapability => 23,
1105            Self::RejectedBadSupportedChannels => 24,
1106            Self::DeniedNoShortSlotTimeSupport => 25,
1107            Self::DeniedNoHtSupport => 27,
1108            Self::R0KhUnreachable => 28,
1109            Self::DeniedPcoTimeNotSupported => 29,
1110            Self::RefusedTemporarily => 30,
1111            Self::RobustManagementPolicyViolation => 31,
1112            Self::UnspecifiedQosFailure => 32,
1113            Self::DeniedInsufficientBandwidth => 33,
1114            Self::DeniedPoorChannelConditions => 34,
1115            Self::DeniedQosNotSupported => 35,
1116            Self::RequestDeclined => 37,
1117            Self::InvalidParameters => 38,
1118            Self::RejectedWithSuggestedChanges => 39,
1119            Self::StatusInvalidElement => 40,
1120            Self::StatusInvalidGroupCipher => 41,
1121            Self::StatusInvalidPairwiseCipher => 42,
1122            Self::StatusInvalidAkmp => 43,
1123            Self::UnsupportedRsneVersion => 44,
1124            Self::InvalidRsneCapabilities => 45,
1125            Self::StatusCipherOutOfPolicy => 46,
1126            Self::RejectedForDelayPeriod => 47,
1127            Self::DlsNotAllowed => 48,
1128            Self::NotPresent => 49,
1129            Self::NotQosSta => 50,
1130            Self::DeniedListenIntervalTooLarge => 51,
1131            Self::StatusInvalidFtActionFrameCount => 52,
1132            Self::StatusInvalidPmkid => 53,
1133            Self::StatusInvalidMde => 54,
1134            Self::StatusInvalidFte => 55,
1135            Self::RequestedTclasNotSupportedByAp => 56,
1136            Self::InsufficientTclasProcessingResources => 57,
1137            Self::TryAnotherBss => 58,
1138            Self::GasAdvertisementProtocolNotSupported => 59,
1139            Self::NoOutstandingGasRequest => 60,
1140            Self::GasResponseNotReceivedFromServer => 61,
1141            Self::GasQueryTimeout => 62,
1142            Self::GasQueryResponseTooLarge => 63,
1143            Self::RejectedHomeWithSuggestedChanges => 64,
1144            Self::ServerUnreachable => 65,
1145            Self::RejectedForSspPermissions => 67,
1146            Self::RefusedUnauthenticatedAccessNotSupported => 68,
1147            Self::InvalidRsne => 72,
1148            Self::UApsdCoexistanceNotSupported => 73,
1149            Self::UApsdCoexModeNotSupported => 74,
1150            Self::BadIntervalWithUApsdCoex => 75,
1151            Self::AntiCloggingTokenRequired => 76,
1152            Self::UnsupportedFiniteCyclicGroup => 77,
1153            Self::CannotFindAlternativeTbtt => 78,
1154            Self::TransmissionFailure => 79,
1155            Self::RequestedTclasNotSupported => 80,
1156            Self::TclasResourcesExhausted => 81,
1157            Self::RejectedWithSuggestedBssTransition => 82,
1158            Self::RejectWithSchedule => 83,
1159            Self::RejectNoWakeupSpecified => 84,
1160            Self::SuccessPowerSaveMode => 85,
1161            Self::PendingAdmittingFstSession => 86,
1162            Self::PerformingFstNow => 87,
1163            Self::PendingGapInBaWindow => 88,
1164            Self::RejectUPidSetting => 89,
1165            Self::RefusedExternalReason => 92,
1166            Self::RefusedApOutOfMemory => 93,
1167            Self::RejectedEmergencyServicesNotSupported => 94,
1168            Self::QueryResponseOutstanding => 95,
1169            Self::RejectDseBand => 96,
1170            Self::TclasProcessingTerminated => 97,
1171            Self::TsScheduleConflict => 98,
1172            Self::DeniedWithSuggestedBandAndChannel => 99,
1173            Self::MccaopReservationConflict => 100,
1174            Self::MafLimitExceeded => 101,
1175            Self::MccaTrackLimitExceeded => 102,
1176            Self::DeniedDueToSpectrumManagement => 103,
1177            Self::DeniedVhtNotSupported => 104,
1178            Self::EnablementDenied => 105,
1179            Self::RestrictionFromAuthorizedGdb => 106,
1180            Self::AuthorizationDeenabled => 107,
1181            Self::EnergyLimitedOperationNotSupported => 108,
1182            Self::RejectedNdpBlockAckSuggested => 109,
1183            Self::RejectedMaxAwayDurationUnacceptable => 110,
1184            Self::FlowControlOperationSupported => 111,
1185            Self::FilsAuthenticationFailure => 112,
1186            Self::UnknownAuthenticationServer => 113,
1187            Self::DeniedNotificationPeriodAllocation => 116,
1188            Self::DeniedChannelSplitting => 117,
1189            Self::DeniedAllocation => 118,
1190            Self::CmmgFeaturesNotSupported => 119,
1191            Self::GasFragmentNotAvailable => 120,
1192            Self::SuccessCagVersionsMatch => 121,
1193            Self::GlkNotAuthorized => 122,
1194            Self::UnknownPasswordIdentifier => 123,
1195            Self::DeniedLocalMacAddressPolicyViolation => 125,
1196            Self::SaeHashToElement => 126,
1197            Self::TclasProcessingTerminatedInsufficientQos => 128,
1198            Self::TclasProcessingTerminatedPolicyConflict => 129,
1199            Self::JoinFailure => 256,
1200            Self::SpuriousDeauthOrDisassoc => 257,
1201            Self::Canceled => 258,
1202            Self::EstablishRsnaFailure => 259,
1203            Self::OweHandshakeFailure => 260,
1204            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1205        }
1206    }
1207
1208    #[inline]
1209    pub fn is_unknown(&self) -> bool {
1210        match self {
1211            Self::__SourceBreaking { unknown_ordinal: _ } => true,
1212            _ => false,
1213        }
1214    }
1215}
1216
1217/// IEEE Std 802.11-2020 9.4.2.173
1218#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1219#[repr(u32)]
1220pub enum WlanAccessCategory {
1221    Background = 1,
1222    BestEffort = 2,
1223    Video = 3,
1224    Voice = 4,
1225}
1226
1227impl WlanAccessCategory {
1228    #[inline]
1229    pub fn from_primitive(prim: u32) -> Option<Self> {
1230        match prim {
1231            1 => Some(Self::Background),
1232            2 => Some(Self::BestEffort),
1233            3 => Some(Self::Video),
1234            4 => Some(Self::Voice),
1235            _ => None,
1236        }
1237    }
1238
1239    #[inline]
1240    pub const fn into_primitive(self) -> u32 {
1241        self as u32
1242    }
1243}
1244
1245/// Identifies a frequency band in metadata of various operations.
1246///
1247/// Examples of this enum in use are labeling scan results or reporting
1248/// a driver capabilities from various frequency bands.
1249///
1250/// NOTE: This enum is similar to the Band ID field defined in
1251/// IEEE Std 802.11-2016 9.4.1.46, but its values are not the same.
1252///
1253/// TODO(https://fxbug.dev/376442944): Create a spec-compliant Band ID type
1254/// and migrate the platform to use it.
1255#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1256pub enum WlanBand {
1257    TwoGhz,
1258    FiveGhz,
1259    #[doc(hidden)]
1260    __SourceBreaking {
1261        unknown_ordinal: u8,
1262    },
1263}
1264
1265/// Pattern that matches an unknown `WlanBand` member.
1266#[macro_export]
1267macro_rules! WlanBandUnknown {
1268    () => {
1269        _
1270    };
1271}
1272
1273impl WlanBand {
1274    #[inline]
1275    pub fn from_primitive(prim: u8) -> Option<Self> {
1276        match prim {
1277            0 => Some(Self::TwoGhz),
1278            1 => Some(Self::FiveGhz),
1279            _ => None,
1280        }
1281    }
1282
1283    #[inline]
1284    pub fn from_primitive_allow_unknown(prim: u8) -> Self {
1285        match prim {
1286            0 => Self::TwoGhz,
1287            1 => Self::FiveGhz,
1288            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1289        }
1290    }
1291
1292    #[inline]
1293    pub fn unknown() -> Self {
1294        Self::__SourceBreaking { unknown_ordinal: 0xff }
1295    }
1296
1297    #[inline]
1298    pub const fn into_primitive(self) -> u8 {
1299        match self {
1300            Self::TwoGhz => 0,
1301            Self::FiveGhz => 1,
1302            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1303        }
1304    }
1305
1306    #[inline]
1307    pub fn is_unknown(&self) -> bool {
1308        match self {
1309            Self::__SourceBreaking { unknown_ordinal: _ } => true,
1310            _ => false,
1311        }
1312    }
1313}
1314
1315#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1316#[repr(C)]
1317pub struct CSsid {
1318    pub len: u8,
1319    pub data: [u8; 32],
1320}
1321
1322impl fidl::Persistable for CSsid {}
1323
1324#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1325#[repr(C)]
1326pub struct HtCapabilities {
1327    pub bytes: [u8; 26],
1328}
1329
1330impl fidl::Persistable for HtCapabilities {}
1331
1332#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1333#[repr(C)]
1334pub struct HtOperation {
1335    pub bytes: [u8; 22],
1336}
1337
1338impl fidl::Persistable for HtOperation {}
1339
1340#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1341#[repr(C)]
1342pub struct VhtCapabilities {
1343    pub bytes: [u8; 12],
1344}
1345
1346impl fidl::Persistable for VhtCapabilities {}
1347
1348#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1349#[repr(C)]
1350pub struct VhtOperation {
1351    pub bytes: [u8; 5],
1352}
1353
1354impl fidl::Persistable for VhtOperation {}
1355
1356/// Channel information derived from the DSSS parameter set, HT operation,
1357/// and VHT operation IEs, as well as the primary channel on which a frame
1358/// is received.
1359///
1360/// IEEE Std 802.11-2016, 9.4.2.4 - DSSS Parameter Set element
1361/// IEEE Std 802.11-2016, 9.4.2.57 - HT Operation element
1362/// IEEE Std 802.11-2016, 9.4.2.159 - VHT Operation element
1363#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1364pub struct WlanChannel {
1365    pub primary: u8,
1366    pub cbw: ChannelBandwidth,
1367    pub secondary80: u8,
1368}
1369
1370impl fidl::Persistable for WlanChannel {}
1371
1372/// IEEE Std 802.11-2020 6.3.19.1.2
1373#[derive(Clone, Debug, Default, PartialEq)]
1374pub struct SetKeyDescriptor {
1375    /// The key value as bytes.
1376    /// 802.11 specifies a bit string for this field, but we represent it as a byte array for
1377    /// convenience.
1378    /// Required.
1379    pub key: Option<Vec<u8>>,
1380    /// Index for rotating keys, e.g. group keys.
1381    /// This value is always 0 for key types which aren't rotating, e.g. pairwise keys.
1382    /// Required.
1383    pub key_id: Option<u16>,
1384    /// Whether this key is a pairwise, group or peer key.
1385    /// Required.
1386    pub key_type: Option<KeyType>,
1387    /// The peer MAC address for pairwise and peer keys.
1388    /// For group keys this value is always the broadcast address.
1389    /// Required.
1390    pub peer_addr: Option<[u8; 6]>,
1391    /// Receive Sequence Counter for group keys only.
1392    /// In all other cases the RSC will be 0.
1393    /// Optional.
1394    pub rsc: Option<u64>,
1395    /// IEEE Cipher suite selector. See IEEE Std 802.11-2016, 9.4.2.25.2, Table 9-131
1396    /// Required.
1397    pub cipher_oui: Option<[u8; 3]>,
1398    /// The cipher type.
1399    /// Required.
1400    pub cipher_type: Option<CipherSuiteType>,
1401    #[doc(hidden)]
1402    pub __source_breaking: fidl::marker::SourceBreaking,
1403}
1404
1405impl fidl::Persistable for SetKeyDescriptor {}
1406
1407mod internal {
1408    use super::*;
1409    unsafe impl fidl::encoding::TypeMarker for ChannelBandwidth {
1410        type Owned = Self;
1411
1412        #[inline(always)]
1413        fn inline_align(_context: fidl::encoding::Context) -> usize {
1414            std::mem::align_of::<u32>()
1415        }
1416
1417        #[inline(always)]
1418        fn inline_size(_context: fidl::encoding::Context) -> usize {
1419            std::mem::size_of::<u32>()
1420        }
1421
1422        #[inline(always)]
1423        fn encode_is_copy() -> bool {
1424            false
1425        }
1426
1427        #[inline(always)]
1428        fn decode_is_copy() -> bool {
1429            false
1430        }
1431    }
1432
1433    impl fidl::encoding::ValueTypeMarker for ChannelBandwidth {
1434        type Borrowed<'a> = Self;
1435        #[inline(always)]
1436        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1437            *value
1438        }
1439    }
1440
1441    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1442        for ChannelBandwidth
1443    {
1444        #[inline]
1445        unsafe fn encode(
1446            self,
1447            encoder: &mut fidl::encoding::Encoder<'_, D>,
1448            offset: usize,
1449            _depth: fidl::encoding::Depth,
1450        ) -> fidl::Result<()> {
1451            encoder.debug_check_bounds::<Self>(offset);
1452            encoder.write_num(self.into_primitive(), offset);
1453            Ok(())
1454        }
1455    }
1456
1457    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelBandwidth {
1458        #[inline(always)]
1459        fn new_empty() -> Self {
1460            Self::unknown()
1461        }
1462
1463        #[inline]
1464        unsafe fn decode(
1465            &mut self,
1466            decoder: &mut fidl::encoding::Decoder<'_, D>,
1467            offset: usize,
1468            _depth: fidl::encoding::Depth,
1469        ) -> fidl::Result<()> {
1470            decoder.debug_check_bounds::<Self>(offset);
1471            let prim = decoder.read_num::<u32>(offset);
1472
1473            *self = Self::from_primitive_allow_unknown(prim);
1474            Ok(())
1475        }
1476    }
1477    unsafe impl fidl::encoding::TypeMarker for CipherSuiteType {
1478        type Owned = Self;
1479
1480        #[inline(always)]
1481        fn inline_align(_context: fidl::encoding::Context) -> usize {
1482            std::mem::align_of::<u32>()
1483        }
1484
1485        #[inline(always)]
1486        fn inline_size(_context: fidl::encoding::Context) -> usize {
1487            std::mem::size_of::<u32>()
1488        }
1489
1490        #[inline(always)]
1491        fn encode_is_copy() -> bool {
1492            false
1493        }
1494
1495        #[inline(always)]
1496        fn decode_is_copy() -> bool {
1497            false
1498        }
1499    }
1500
1501    impl fidl::encoding::ValueTypeMarker for CipherSuiteType {
1502        type Borrowed<'a> = Self;
1503        #[inline(always)]
1504        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1505            *value
1506        }
1507    }
1508
1509    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1510        for CipherSuiteType
1511    {
1512        #[inline]
1513        unsafe fn encode(
1514            self,
1515            encoder: &mut fidl::encoding::Encoder<'_, D>,
1516            offset: usize,
1517            _depth: fidl::encoding::Depth,
1518        ) -> fidl::Result<()> {
1519            encoder.debug_check_bounds::<Self>(offset);
1520            encoder.write_num(self.into_primitive(), offset);
1521            Ok(())
1522        }
1523    }
1524
1525    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CipherSuiteType {
1526        #[inline(always)]
1527        fn new_empty() -> Self {
1528            Self::unknown()
1529        }
1530
1531        #[inline]
1532        unsafe fn decode(
1533            &mut self,
1534            decoder: &mut fidl::encoding::Decoder<'_, D>,
1535            offset: usize,
1536            _depth: fidl::encoding::Depth,
1537        ) -> fidl::Result<()> {
1538            decoder.debug_check_bounds::<Self>(offset);
1539            let prim = decoder.read_num::<u32>(offset);
1540
1541            *self = Self::from_primitive_allow_unknown(prim);
1542            Ok(())
1543        }
1544    }
1545    unsafe impl fidl::encoding::TypeMarker for KeyType {
1546        type Owned = Self;
1547
1548        #[inline(always)]
1549        fn inline_align(_context: fidl::encoding::Context) -> usize {
1550            std::mem::align_of::<u8>()
1551        }
1552
1553        #[inline(always)]
1554        fn inline_size(_context: fidl::encoding::Context) -> usize {
1555            std::mem::size_of::<u8>()
1556        }
1557
1558        #[inline(always)]
1559        fn encode_is_copy() -> bool {
1560            false
1561        }
1562
1563        #[inline(always)]
1564        fn decode_is_copy() -> bool {
1565            false
1566        }
1567    }
1568
1569    impl fidl::encoding::ValueTypeMarker for KeyType {
1570        type Borrowed<'a> = Self;
1571        #[inline(always)]
1572        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1573            *value
1574        }
1575    }
1576
1577    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for KeyType {
1578        #[inline]
1579        unsafe fn encode(
1580            self,
1581            encoder: &mut fidl::encoding::Encoder<'_, D>,
1582            offset: usize,
1583            _depth: fidl::encoding::Depth,
1584        ) -> fidl::Result<()> {
1585            encoder.debug_check_bounds::<Self>(offset);
1586            encoder.write_num(self.into_primitive(), offset);
1587            Ok(())
1588        }
1589    }
1590
1591    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyType {
1592        #[inline(always)]
1593        fn new_empty() -> Self {
1594            Self::unknown()
1595        }
1596
1597        #[inline]
1598        unsafe fn decode(
1599            &mut self,
1600            decoder: &mut fidl::encoding::Decoder<'_, D>,
1601            offset: usize,
1602            _depth: fidl::encoding::Depth,
1603        ) -> fidl::Result<()> {
1604            decoder.debug_check_bounds::<Self>(offset);
1605            let prim = decoder.read_num::<u8>(offset);
1606
1607            *self = Self::from_primitive_allow_unknown(prim);
1608            Ok(())
1609        }
1610    }
1611    unsafe impl fidl::encoding::TypeMarker for ReasonCode {
1612        type Owned = Self;
1613
1614        #[inline(always)]
1615        fn inline_align(_context: fidl::encoding::Context) -> usize {
1616            std::mem::align_of::<u16>()
1617        }
1618
1619        #[inline(always)]
1620        fn inline_size(_context: fidl::encoding::Context) -> usize {
1621            std::mem::size_of::<u16>()
1622        }
1623
1624        #[inline(always)]
1625        fn encode_is_copy() -> bool {
1626            false
1627        }
1628
1629        #[inline(always)]
1630        fn decode_is_copy() -> bool {
1631            false
1632        }
1633    }
1634
1635    impl fidl::encoding::ValueTypeMarker for ReasonCode {
1636        type Borrowed<'a> = Self;
1637        #[inline(always)]
1638        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1639            *value
1640        }
1641    }
1642
1643    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ReasonCode {
1644        #[inline]
1645        unsafe fn encode(
1646            self,
1647            encoder: &mut fidl::encoding::Encoder<'_, D>,
1648            offset: usize,
1649            _depth: fidl::encoding::Depth,
1650        ) -> fidl::Result<()> {
1651            encoder.debug_check_bounds::<Self>(offset);
1652            encoder.write_num(self.into_primitive(), offset);
1653            Ok(())
1654        }
1655    }
1656
1657    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReasonCode {
1658        #[inline(always)]
1659        fn new_empty() -> Self {
1660            Self::unknown()
1661        }
1662
1663        #[inline]
1664        unsafe fn decode(
1665            &mut self,
1666            decoder: &mut fidl::encoding::Decoder<'_, D>,
1667            offset: usize,
1668            _depth: fidl::encoding::Depth,
1669        ) -> fidl::Result<()> {
1670            decoder.debug_check_bounds::<Self>(offset);
1671            let prim = decoder.read_num::<u16>(offset);
1672
1673            *self = Self::from_primitive_allow_unknown(prim);
1674            Ok(())
1675        }
1676    }
1677    unsafe impl fidl::encoding::TypeMarker for StatusCode {
1678        type Owned = Self;
1679
1680        #[inline(always)]
1681        fn inline_align(_context: fidl::encoding::Context) -> usize {
1682            std::mem::align_of::<u16>()
1683        }
1684
1685        #[inline(always)]
1686        fn inline_size(_context: fidl::encoding::Context) -> usize {
1687            std::mem::size_of::<u16>()
1688        }
1689
1690        #[inline(always)]
1691        fn encode_is_copy() -> bool {
1692            false
1693        }
1694
1695        #[inline(always)]
1696        fn decode_is_copy() -> bool {
1697            false
1698        }
1699    }
1700
1701    impl fidl::encoding::ValueTypeMarker for StatusCode {
1702        type Borrowed<'a> = Self;
1703        #[inline(always)]
1704        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1705            *value
1706        }
1707    }
1708
1709    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for StatusCode {
1710        #[inline]
1711        unsafe fn encode(
1712            self,
1713            encoder: &mut fidl::encoding::Encoder<'_, D>,
1714            offset: usize,
1715            _depth: fidl::encoding::Depth,
1716        ) -> fidl::Result<()> {
1717            encoder.debug_check_bounds::<Self>(offset);
1718            encoder.write_num(self.into_primitive(), offset);
1719            Ok(())
1720        }
1721    }
1722
1723    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StatusCode {
1724        #[inline(always)]
1725        fn new_empty() -> Self {
1726            Self::unknown()
1727        }
1728
1729        #[inline]
1730        unsafe fn decode(
1731            &mut self,
1732            decoder: &mut fidl::encoding::Decoder<'_, D>,
1733            offset: usize,
1734            _depth: fidl::encoding::Depth,
1735        ) -> fidl::Result<()> {
1736            decoder.debug_check_bounds::<Self>(offset);
1737            let prim = decoder.read_num::<u16>(offset);
1738
1739            *self = Self::from_primitive_allow_unknown(prim);
1740            Ok(())
1741        }
1742    }
1743    unsafe impl fidl::encoding::TypeMarker for WlanAccessCategory {
1744        type Owned = Self;
1745
1746        #[inline(always)]
1747        fn inline_align(_context: fidl::encoding::Context) -> usize {
1748            std::mem::align_of::<u32>()
1749        }
1750
1751        #[inline(always)]
1752        fn inline_size(_context: fidl::encoding::Context) -> usize {
1753            std::mem::size_of::<u32>()
1754        }
1755
1756        #[inline(always)]
1757        fn encode_is_copy() -> bool {
1758            true
1759        }
1760
1761        #[inline(always)]
1762        fn decode_is_copy() -> bool {
1763            false
1764        }
1765    }
1766
1767    impl fidl::encoding::ValueTypeMarker for WlanAccessCategory {
1768        type Borrowed<'a> = Self;
1769        #[inline(always)]
1770        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1771            *value
1772        }
1773    }
1774
1775    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1776        for WlanAccessCategory
1777    {
1778        #[inline]
1779        unsafe fn encode(
1780            self,
1781            encoder: &mut fidl::encoding::Encoder<'_, D>,
1782            offset: usize,
1783            _depth: fidl::encoding::Depth,
1784        ) -> fidl::Result<()> {
1785            encoder.debug_check_bounds::<Self>(offset);
1786            encoder.write_num(self.into_primitive(), offset);
1787            Ok(())
1788        }
1789    }
1790
1791    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanAccessCategory {
1792        #[inline(always)]
1793        fn new_empty() -> Self {
1794            Self::Background
1795        }
1796
1797        #[inline]
1798        unsafe fn decode(
1799            &mut self,
1800            decoder: &mut fidl::encoding::Decoder<'_, D>,
1801            offset: usize,
1802            _depth: fidl::encoding::Depth,
1803        ) -> fidl::Result<()> {
1804            decoder.debug_check_bounds::<Self>(offset);
1805            let prim = decoder.read_num::<u32>(offset);
1806
1807            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1808            Ok(())
1809        }
1810    }
1811    unsafe impl fidl::encoding::TypeMarker for WlanBand {
1812        type Owned = Self;
1813
1814        #[inline(always)]
1815        fn inline_align(_context: fidl::encoding::Context) -> usize {
1816            std::mem::align_of::<u8>()
1817        }
1818
1819        #[inline(always)]
1820        fn inline_size(_context: fidl::encoding::Context) -> usize {
1821            std::mem::size_of::<u8>()
1822        }
1823
1824        #[inline(always)]
1825        fn encode_is_copy() -> bool {
1826            false
1827        }
1828
1829        #[inline(always)]
1830        fn decode_is_copy() -> bool {
1831            false
1832        }
1833    }
1834
1835    impl fidl::encoding::ValueTypeMarker for WlanBand {
1836        type Borrowed<'a> = Self;
1837        #[inline(always)]
1838        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1839            *value
1840        }
1841    }
1842
1843    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for WlanBand {
1844        #[inline]
1845        unsafe fn encode(
1846            self,
1847            encoder: &mut fidl::encoding::Encoder<'_, D>,
1848            offset: usize,
1849            _depth: fidl::encoding::Depth,
1850        ) -> fidl::Result<()> {
1851            encoder.debug_check_bounds::<Self>(offset);
1852            encoder.write_num(self.into_primitive(), offset);
1853            Ok(())
1854        }
1855    }
1856
1857    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanBand {
1858        #[inline(always)]
1859        fn new_empty() -> Self {
1860            Self::unknown()
1861        }
1862
1863        #[inline]
1864        unsafe fn decode(
1865            &mut self,
1866            decoder: &mut fidl::encoding::Decoder<'_, D>,
1867            offset: usize,
1868            _depth: fidl::encoding::Depth,
1869        ) -> fidl::Result<()> {
1870            decoder.debug_check_bounds::<Self>(offset);
1871            let prim = decoder.read_num::<u8>(offset);
1872
1873            *self = Self::from_primitive_allow_unknown(prim);
1874            Ok(())
1875        }
1876    }
1877
1878    impl fidl::encoding::ValueTypeMarker for CSsid {
1879        type Borrowed<'a> = &'a Self;
1880        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1881            value
1882        }
1883    }
1884
1885    unsafe impl fidl::encoding::TypeMarker for CSsid {
1886        type Owned = Self;
1887
1888        #[inline(always)]
1889        fn inline_align(_context: fidl::encoding::Context) -> usize {
1890            1
1891        }
1892
1893        #[inline(always)]
1894        fn inline_size(_context: fidl::encoding::Context) -> usize {
1895            33
1896        }
1897        #[inline(always)]
1898        fn encode_is_copy() -> bool {
1899            true
1900        }
1901
1902        #[inline(always)]
1903        fn decode_is_copy() -> bool {
1904            true
1905        }
1906    }
1907
1908    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CSsid, D> for &CSsid {
1909        #[inline]
1910        unsafe fn encode(
1911            self,
1912            encoder: &mut fidl::encoding::Encoder<'_, D>,
1913            offset: usize,
1914            _depth: fidl::encoding::Depth,
1915        ) -> fidl::Result<()> {
1916            encoder.debug_check_bounds::<CSsid>(offset);
1917            unsafe {
1918                // Copy the object into the buffer.
1919                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1920                (buf_ptr as *mut CSsid).write_unaligned((self as *const CSsid).read());
1921                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1922                // done second because the memcpy will write garbage to these bytes.
1923            }
1924            Ok(())
1925        }
1926    }
1927    unsafe impl<
1928        D: fidl::encoding::ResourceDialect,
1929        T0: fidl::encoding::Encode<u8, D>,
1930        T1: fidl::encoding::Encode<fidl::encoding::Array<u8, 32>, D>,
1931    > fidl::encoding::Encode<CSsid, D> for (T0, T1)
1932    {
1933        #[inline]
1934        unsafe fn encode(
1935            self,
1936            encoder: &mut fidl::encoding::Encoder<'_, D>,
1937            offset: usize,
1938            depth: fidl::encoding::Depth,
1939        ) -> fidl::Result<()> {
1940            encoder.debug_check_bounds::<CSsid>(offset);
1941            // Zero out padding regions. There's no need to apply masks
1942            // because the unmasked parts will be overwritten by fields.
1943            // Write the fields.
1944            self.0.encode(encoder, offset + 0, depth)?;
1945            self.1.encode(encoder, offset + 1, depth)?;
1946            Ok(())
1947        }
1948    }
1949
1950    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CSsid {
1951        #[inline(always)]
1952        fn new_empty() -> Self {
1953            Self {
1954                len: fidl::new_empty!(u8, D),
1955                data: fidl::new_empty!(fidl::encoding::Array<u8, 32>, D),
1956            }
1957        }
1958
1959        #[inline]
1960        unsafe fn decode(
1961            &mut self,
1962            decoder: &mut fidl::encoding::Decoder<'_, D>,
1963            offset: usize,
1964            _depth: fidl::encoding::Depth,
1965        ) -> fidl::Result<()> {
1966            decoder.debug_check_bounds::<Self>(offset);
1967            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1968            // Verify that padding bytes are zero.
1969            // Copy from the buffer into the object.
1970            unsafe {
1971                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 33);
1972            }
1973            Ok(())
1974        }
1975    }
1976
1977    impl fidl::encoding::ValueTypeMarker for HtCapabilities {
1978        type Borrowed<'a> = &'a Self;
1979        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1980            value
1981        }
1982    }
1983
1984    unsafe impl fidl::encoding::TypeMarker for HtCapabilities {
1985        type Owned = Self;
1986
1987        #[inline(always)]
1988        fn inline_align(_context: fidl::encoding::Context) -> usize {
1989            1
1990        }
1991
1992        #[inline(always)]
1993        fn inline_size(_context: fidl::encoding::Context) -> usize {
1994            26
1995        }
1996        #[inline(always)]
1997        fn encode_is_copy() -> bool {
1998            true
1999        }
2000
2001        #[inline(always)]
2002        fn decode_is_copy() -> bool {
2003            true
2004        }
2005    }
2006
2007    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HtCapabilities, D>
2008        for &HtCapabilities
2009    {
2010        #[inline]
2011        unsafe fn encode(
2012            self,
2013            encoder: &mut fidl::encoding::Encoder<'_, D>,
2014            offset: usize,
2015            _depth: fidl::encoding::Depth,
2016        ) -> fidl::Result<()> {
2017            encoder.debug_check_bounds::<HtCapabilities>(offset);
2018            unsafe {
2019                // Copy the object into the buffer.
2020                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2021                (buf_ptr as *mut HtCapabilities)
2022                    .write_unaligned((self as *const HtCapabilities).read());
2023                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2024                // done second because the memcpy will write garbage to these bytes.
2025            }
2026            Ok(())
2027        }
2028    }
2029    unsafe impl<
2030        D: fidl::encoding::ResourceDialect,
2031        T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 26>, D>,
2032    > fidl::encoding::Encode<HtCapabilities, D> for (T0,)
2033    {
2034        #[inline]
2035        unsafe fn encode(
2036            self,
2037            encoder: &mut fidl::encoding::Encoder<'_, D>,
2038            offset: usize,
2039            depth: fidl::encoding::Depth,
2040        ) -> fidl::Result<()> {
2041            encoder.debug_check_bounds::<HtCapabilities>(offset);
2042            // Zero out padding regions. There's no need to apply masks
2043            // because the unmasked parts will be overwritten by fields.
2044            // Write the fields.
2045            self.0.encode(encoder, offset + 0, depth)?;
2046            Ok(())
2047        }
2048    }
2049
2050    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HtCapabilities {
2051        #[inline(always)]
2052        fn new_empty() -> Self {
2053            Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 26>, D) }
2054        }
2055
2056        #[inline]
2057        unsafe fn decode(
2058            &mut self,
2059            decoder: &mut fidl::encoding::Decoder<'_, D>,
2060            offset: usize,
2061            _depth: fidl::encoding::Depth,
2062        ) -> fidl::Result<()> {
2063            decoder.debug_check_bounds::<Self>(offset);
2064            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2065            // Verify that padding bytes are zero.
2066            // Copy from the buffer into the object.
2067            unsafe {
2068                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 26);
2069            }
2070            Ok(())
2071        }
2072    }
2073
2074    impl fidl::encoding::ValueTypeMarker for HtOperation {
2075        type Borrowed<'a> = &'a Self;
2076        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2077            value
2078        }
2079    }
2080
2081    unsafe impl fidl::encoding::TypeMarker for HtOperation {
2082        type Owned = Self;
2083
2084        #[inline(always)]
2085        fn inline_align(_context: fidl::encoding::Context) -> usize {
2086            1
2087        }
2088
2089        #[inline(always)]
2090        fn inline_size(_context: fidl::encoding::Context) -> usize {
2091            22
2092        }
2093        #[inline(always)]
2094        fn encode_is_copy() -> bool {
2095            true
2096        }
2097
2098        #[inline(always)]
2099        fn decode_is_copy() -> bool {
2100            true
2101        }
2102    }
2103
2104    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HtOperation, D>
2105        for &HtOperation
2106    {
2107        #[inline]
2108        unsafe fn encode(
2109            self,
2110            encoder: &mut fidl::encoding::Encoder<'_, D>,
2111            offset: usize,
2112            _depth: fidl::encoding::Depth,
2113        ) -> fidl::Result<()> {
2114            encoder.debug_check_bounds::<HtOperation>(offset);
2115            unsafe {
2116                // Copy the object into the buffer.
2117                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2118                (buf_ptr as *mut HtOperation).write_unaligned((self as *const HtOperation).read());
2119                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2120                // done second because the memcpy will write garbage to these bytes.
2121            }
2122            Ok(())
2123        }
2124    }
2125    unsafe impl<
2126        D: fidl::encoding::ResourceDialect,
2127        T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 22>, D>,
2128    > fidl::encoding::Encode<HtOperation, D> for (T0,)
2129    {
2130        #[inline]
2131        unsafe fn encode(
2132            self,
2133            encoder: &mut fidl::encoding::Encoder<'_, D>,
2134            offset: usize,
2135            depth: fidl::encoding::Depth,
2136        ) -> fidl::Result<()> {
2137            encoder.debug_check_bounds::<HtOperation>(offset);
2138            // Zero out padding regions. There's no need to apply masks
2139            // because the unmasked parts will be overwritten by fields.
2140            // Write the fields.
2141            self.0.encode(encoder, offset + 0, depth)?;
2142            Ok(())
2143        }
2144    }
2145
2146    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HtOperation {
2147        #[inline(always)]
2148        fn new_empty() -> Self {
2149            Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 22>, D) }
2150        }
2151
2152        #[inline]
2153        unsafe fn decode(
2154            &mut self,
2155            decoder: &mut fidl::encoding::Decoder<'_, D>,
2156            offset: usize,
2157            _depth: fidl::encoding::Depth,
2158        ) -> fidl::Result<()> {
2159            decoder.debug_check_bounds::<Self>(offset);
2160            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2161            // Verify that padding bytes are zero.
2162            // Copy from the buffer into the object.
2163            unsafe {
2164                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 22);
2165            }
2166            Ok(())
2167        }
2168    }
2169
2170    impl fidl::encoding::ValueTypeMarker for VhtCapabilities {
2171        type Borrowed<'a> = &'a Self;
2172        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2173            value
2174        }
2175    }
2176
2177    unsafe impl fidl::encoding::TypeMarker for VhtCapabilities {
2178        type Owned = Self;
2179
2180        #[inline(always)]
2181        fn inline_align(_context: fidl::encoding::Context) -> usize {
2182            1
2183        }
2184
2185        #[inline(always)]
2186        fn inline_size(_context: fidl::encoding::Context) -> usize {
2187            12
2188        }
2189        #[inline(always)]
2190        fn encode_is_copy() -> bool {
2191            true
2192        }
2193
2194        #[inline(always)]
2195        fn decode_is_copy() -> bool {
2196            true
2197        }
2198    }
2199
2200    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VhtCapabilities, D>
2201        for &VhtCapabilities
2202    {
2203        #[inline]
2204        unsafe fn encode(
2205            self,
2206            encoder: &mut fidl::encoding::Encoder<'_, D>,
2207            offset: usize,
2208            _depth: fidl::encoding::Depth,
2209        ) -> fidl::Result<()> {
2210            encoder.debug_check_bounds::<VhtCapabilities>(offset);
2211            unsafe {
2212                // Copy the object into the buffer.
2213                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2214                (buf_ptr as *mut VhtCapabilities)
2215                    .write_unaligned((self as *const VhtCapabilities).read());
2216                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2217                // done second because the memcpy will write garbage to these bytes.
2218            }
2219            Ok(())
2220        }
2221    }
2222    unsafe impl<
2223        D: fidl::encoding::ResourceDialect,
2224        T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 12>, D>,
2225    > fidl::encoding::Encode<VhtCapabilities, D> for (T0,)
2226    {
2227        #[inline]
2228        unsafe fn encode(
2229            self,
2230            encoder: &mut fidl::encoding::Encoder<'_, D>,
2231            offset: usize,
2232            depth: fidl::encoding::Depth,
2233        ) -> fidl::Result<()> {
2234            encoder.debug_check_bounds::<VhtCapabilities>(offset);
2235            // Zero out padding regions. There's no need to apply masks
2236            // because the unmasked parts will be overwritten by fields.
2237            // Write the fields.
2238            self.0.encode(encoder, offset + 0, depth)?;
2239            Ok(())
2240        }
2241    }
2242
2243    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VhtCapabilities {
2244        #[inline(always)]
2245        fn new_empty() -> Self {
2246            Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 12>, D) }
2247        }
2248
2249        #[inline]
2250        unsafe fn decode(
2251            &mut self,
2252            decoder: &mut fidl::encoding::Decoder<'_, D>,
2253            offset: usize,
2254            _depth: fidl::encoding::Depth,
2255        ) -> fidl::Result<()> {
2256            decoder.debug_check_bounds::<Self>(offset);
2257            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2258            // Verify that padding bytes are zero.
2259            // Copy from the buffer into the object.
2260            unsafe {
2261                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
2262            }
2263            Ok(())
2264        }
2265    }
2266
2267    impl fidl::encoding::ValueTypeMarker for VhtOperation {
2268        type Borrowed<'a> = &'a Self;
2269        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2270            value
2271        }
2272    }
2273
2274    unsafe impl fidl::encoding::TypeMarker for VhtOperation {
2275        type Owned = Self;
2276
2277        #[inline(always)]
2278        fn inline_align(_context: fidl::encoding::Context) -> usize {
2279            1
2280        }
2281
2282        #[inline(always)]
2283        fn inline_size(_context: fidl::encoding::Context) -> usize {
2284            5
2285        }
2286        #[inline(always)]
2287        fn encode_is_copy() -> bool {
2288            true
2289        }
2290
2291        #[inline(always)]
2292        fn decode_is_copy() -> bool {
2293            true
2294        }
2295    }
2296
2297    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VhtOperation, D>
2298        for &VhtOperation
2299    {
2300        #[inline]
2301        unsafe fn encode(
2302            self,
2303            encoder: &mut fidl::encoding::Encoder<'_, D>,
2304            offset: usize,
2305            _depth: fidl::encoding::Depth,
2306        ) -> fidl::Result<()> {
2307            encoder.debug_check_bounds::<VhtOperation>(offset);
2308            unsafe {
2309                // Copy the object into the buffer.
2310                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2311                (buf_ptr as *mut VhtOperation)
2312                    .write_unaligned((self as *const VhtOperation).read());
2313                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2314                // done second because the memcpy will write garbage to these bytes.
2315            }
2316            Ok(())
2317        }
2318    }
2319    unsafe impl<
2320        D: fidl::encoding::ResourceDialect,
2321        T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 5>, D>,
2322    > fidl::encoding::Encode<VhtOperation, D> for (T0,)
2323    {
2324        #[inline]
2325        unsafe fn encode(
2326            self,
2327            encoder: &mut fidl::encoding::Encoder<'_, D>,
2328            offset: usize,
2329            depth: fidl::encoding::Depth,
2330        ) -> fidl::Result<()> {
2331            encoder.debug_check_bounds::<VhtOperation>(offset);
2332            // Zero out padding regions. There's no need to apply masks
2333            // because the unmasked parts will be overwritten by fields.
2334            // Write the fields.
2335            self.0.encode(encoder, offset + 0, depth)?;
2336            Ok(())
2337        }
2338    }
2339
2340    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VhtOperation {
2341        #[inline(always)]
2342        fn new_empty() -> Self {
2343            Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 5>, D) }
2344        }
2345
2346        #[inline]
2347        unsafe fn decode(
2348            &mut self,
2349            decoder: &mut fidl::encoding::Decoder<'_, D>,
2350            offset: usize,
2351            _depth: fidl::encoding::Depth,
2352        ) -> fidl::Result<()> {
2353            decoder.debug_check_bounds::<Self>(offset);
2354            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2355            // Verify that padding bytes are zero.
2356            // Copy from the buffer into the object.
2357            unsafe {
2358                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 5);
2359            }
2360            Ok(())
2361        }
2362    }
2363
2364    impl fidl::encoding::ValueTypeMarker for WlanChannel {
2365        type Borrowed<'a> = &'a Self;
2366        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2367            value
2368        }
2369    }
2370
2371    unsafe impl fidl::encoding::TypeMarker for WlanChannel {
2372        type Owned = Self;
2373
2374        #[inline(always)]
2375        fn inline_align(_context: fidl::encoding::Context) -> usize {
2376            4
2377        }
2378
2379        #[inline(always)]
2380        fn inline_size(_context: fidl::encoding::Context) -> usize {
2381            12
2382        }
2383    }
2384
2385    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WlanChannel, D>
2386        for &WlanChannel
2387    {
2388        #[inline]
2389        unsafe fn encode(
2390            self,
2391            encoder: &mut fidl::encoding::Encoder<'_, D>,
2392            offset: usize,
2393            _depth: fidl::encoding::Depth,
2394        ) -> fidl::Result<()> {
2395            encoder.debug_check_bounds::<WlanChannel>(offset);
2396            // Delegate to tuple encoding.
2397            fidl::encoding::Encode::<WlanChannel, D>::encode(
2398                (
2399                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.primary),
2400                    <ChannelBandwidth as fidl::encoding::ValueTypeMarker>::borrow(&self.cbw),
2401                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.secondary80),
2402                ),
2403                encoder,
2404                offset,
2405                _depth,
2406            )
2407        }
2408    }
2409    unsafe impl<
2410        D: fidl::encoding::ResourceDialect,
2411        T0: fidl::encoding::Encode<u8, D>,
2412        T1: fidl::encoding::Encode<ChannelBandwidth, D>,
2413        T2: fidl::encoding::Encode<u8, D>,
2414    > fidl::encoding::Encode<WlanChannel, D> for (T0, T1, T2)
2415    {
2416        #[inline]
2417        unsafe fn encode(
2418            self,
2419            encoder: &mut fidl::encoding::Encoder<'_, D>,
2420            offset: usize,
2421            depth: fidl::encoding::Depth,
2422        ) -> fidl::Result<()> {
2423            encoder.debug_check_bounds::<WlanChannel>(offset);
2424            // Zero out padding regions. There's no need to apply masks
2425            // because the unmasked parts will be overwritten by fields.
2426            unsafe {
2427                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2428                (ptr as *mut u32).write_unaligned(0);
2429            }
2430            unsafe {
2431                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2432                (ptr as *mut u32).write_unaligned(0);
2433            }
2434            // Write the fields.
2435            self.0.encode(encoder, offset + 0, depth)?;
2436            self.1.encode(encoder, offset + 4, depth)?;
2437            self.2.encode(encoder, offset + 8, depth)?;
2438            Ok(())
2439        }
2440    }
2441
2442    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanChannel {
2443        #[inline(always)]
2444        fn new_empty() -> Self {
2445            Self {
2446                primary: fidl::new_empty!(u8, D),
2447                cbw: fidl::new_empty!(ChannelBandwidth, D),
2448                secondary80: fidl::new_empty!(u8, D),
2449            }
2450        }
2451
2452        #[inline]
2453        unsafe fn decode(
2454            &mut self,
2455            decoder: &mut fidl::encoding::Decoder<'_, D>,
2456            offset: usize,
2457            _depth: fidl::encoding::Depth,
2458        ) -> fidl::Result<()> {
2459            decoder.debug_check_bounds::<Self>(offset);
2460            // Verify that padding bytes are zero.
2461            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2462            let padval = unsafe { (ptr as *const u32).read_unaligned() };
2463            let mask = 0xffffff00u32;
2464            let maskedval = padval & mask;
2465            if maskedval != 0 {
2466                return Err(fidl::Error::NonZeroPadding {
2467                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2468                });
2469            }
2470            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2471            let padval = unsafe { (ptr as *const u32).read_unaligned() };
2472            let mask = 0xffffff00u32;
2473            let maskedval = padval & mask;
2474            if maskedval != 0 {
2475                return Err(fidl::Error::NonZeroPadding {
2476                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2477                });
2478            }
2479            fidl::decode!(u8, D, &mut self.primary, decoder, offset + 0, _depth)?;
2480            fidl::decode!(ChannelBandwidth, D, &mut self.cbw, decoder, offset + 4, _depth)?;
2481            fidl::decode!(u8, D, &mut self.secondary80, decoder, offset + 8, _depth)?;
2482            Ok(())
2483        }
2484    }
2485
2486    impl SetKeyDescriptor {
2487        #[inline(always)]
2488        fn max_ordinal_present(&self) -> u64 {
2489            if let Some(_) = self.cipher_type {
2490                return 7;
2491            }
2492            if let Some(_) = self.cipher_oui {
2493                return 6;
2494            }
2495            if let Some(_) = self.rsc {
2496                return 5;
2497            }
2498            if let Some(_) = self.peer_addr {
2499                return 4;
2500            }
2501            if let Some(_) = self.key_type {
2502                return 3;
2503            }
2504            if let Some(_) = self.key_id {
2505                return 2;
2506            }
2507            if let Some(_) = self.key {
2508                return 1;
2509            }
2510            0
2511        }
2512    }
2513
2514    impl fidl::encoding::ValueTypeMarker for SetKeyDescriptor {
2515        type Borrowed<'a> = &'a Self;
2516        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2517            value
2518        }
2519    }
2520
2521    unsafe impl fidl::encoding::TypeMarker for SetKeyDescriptor {
2522        type Owned = Self;
2523
2524        #[inline(always)]
2525        fn inline_align(_context: fidl::encoding::Context) -> usize {
2526            8
2527        }
2528
2529        #[inline(always)]
2530        fn inline_size(_context: fidl::encoding::Context) -> usize {
2531            16
2532        }
2533    }
2534
2535    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SetKeyDescriptor, D>
2536        for &SetKeyDescriptor
2537    {
2538        unsafe fn encode(
2539            self,
2540            encoder: &mut fidl::encoding::Encoder<'_, D>,
2541            offset: usize,
2542            mut depth: fidl::encoding::Depth,
2543        ) -> fidl::Result<()> {
2544            encoder.debug_check_bounds::<SetKeyDescriptor>(offset);
2545            // Vector header
2546            let max_ordinal: u64 = self.max_ordinal_present();
2547            encoder.write_num(max_ordinal, offset);
2548            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2549            // Calling encoder.out_of_line_offset(0) is not allowed.
2550            if max_ordinal == 0 {
2551                return Ok(());
2552            }
2553            depth.increment()?;
2554            let envelope_size = 8;
2555            let bytes_len = max_ordinal as usize * envelope_size;
2556            #[allow(unused_variables)]
2557            let offset = encoder.out_of_line_offset(bytes_len);
2558            let mut _prev_end_offset: usize = 0;
2559            if 1 > max_ordinal {
2560                return Ok(());
2561            }
2562
2563            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2564            // are envelope_size bytes.
2565            let cur_offset: usize = (1 - 1) * envelope_size;
2566
2567            // Zero reserved fields.
2568            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2569
2570            // Safety:
2571            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2572            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2573            //   envelope_size bytes, there is always sufficient room.
2574            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32>, D>(
2575                self.key.as_ref().map(
2576                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
2577                ),
2578                encoder,
2579                offset + cur_offset,
2580                depth,
2581            )?;
2582
2583            _prev_end_offset = cur_offset + envelope_size;
2584            if 2 > max_ordinal {
2585                return Ok(());
2586            }
2587
2588            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2589            // are envelope_size bytes.
2590            let cur_offset: usize = (2 - 1) * envelope_size;
2591
2592            // Zero reserved fields.
2593            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2594
2595            // Safety:
2596            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2597            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2598            //   envelope_size bytes, there is always sufficient room.
2599            fidl::encoding::encode_in_envelope_optional::<u16, D>(
2600                self.key_id.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
2601                encoder,
2602                offset + cur_offset,
2603                depth,
2604            )?;
2605
2606            _prev_end_offset = cur_offset + envelope_size;
2607            if 3 > max_ordinal {
2608                return Ok(());
2609            }
2610
2611            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2612            // are envelope_size bytes.
2613            let cur_offset: usize = (3 - 1) * envelope_size;
2614
2615            // Zero reserved fields.
2616            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2617
2618            // Safety:
2619            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2620            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2621            //   envelope_size bytes, there is always sufficient room.
2622            fidl::encoding::encode_in_envelope_optional::<KeyType, D>(
2623                self.key_type.as_ref().map(<KeyType as fidl::encoding::ValueTypeMarker>::borrow),
2624                encoder,
2625                offset + cur_offset,
2626                depth,
2627            )?;
2628
2629            _prev_end_offset = cur_offset + envelope_size;
2630            if 4 > max_ordinal {
2631                return Ok(());
2632            }
2633
2634            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2635            // are envelope_size bytes.
2636            let cur_offset: usize = (4 - 1) * envelope_size;
2637
2638            // Zero reserved fields.
2639            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2640
2641            // Safety:
2642            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2643            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2644            //   envelope_size bytes, there is always sufficient room.
2645            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 6>, D>(
2646                self.peer_addr
2647                    .as_ref()
2648                    .map(<fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow),
2649                encoder,
2650                offset + cur_offset,
2651                depth,
2652            )?;
2653
2654            _prev_end_offset = cur_offset + envelope_size;
2655            if 5 > max_ordinal {
2656                return Ok(());
2657            }
2658
2659            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2660            // are envelope_size bytes.
2661            let cur_offset: usize = (5 - 1) * envelope_size;
2662
2663            // Zero reserved fields.
2664            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2665
2666            // Safety:
2667            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2668            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2669            //   envelope_size bytes, there is always sufficient room.
2670            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2671                self.rsc.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2672                encoder,
2673                offset + cur_offset,
2674                depth,
2675            )?;
2676
2677            _prev_end_offset = cur_offset + envelope_size;
2678            if 6 > max_ordinal {
2679                return Ok(());
2680            }
2681
2682            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2683            // are envelope_size bytes.
2684            let cur_offset: usize = (6 - 1) * envelope_size;
2685
2686            // Zero reserved fields.
2687            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2688
2689            // Safety:
2690            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2691            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2692            //   envelope_size bytes, there is always sufficient room.
2693            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 3>, D>(
2694                self.cipher_oui
2695                    .as_ref()
2696                    .map(<fidl::encoding::Array<u8, 3> as fidl::encoding::ValueTypeMarker>::borrow),
2697                encoder,
2698                offset + cur_offset,
2699                depth,
2700            )?;
2701
2702            _prev_end_offset = cur_offset + envelope_size;
2703            if 7 > max_ordinal {
2704                return Ok(());
2705            }
2706
2707            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2708            // are envelope_size bytes.
2709            let cur_offset: usize = (7 - 1) * envelope_size;
2710
2711            // Zero reserved fields.
2712            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2713
2714            // Safety:
2715            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2716            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2717            //   envelope_size bytes, there is always sufficient room.
2718            fidl::encoding::encode_in_envelope_optional::<CipherSuiteType, D>(
2719                self.cipher_type
2720                    .as_ref()
2721                    .map(<CipherSuiteType as fidl::encoding::ValueTypeMarker>::borrow),
2722                encoder,
2723                offset + cur_offset,
2724                depth,
2725            )?;
2726
2727            _prev_end_offset = cur_offset + envelope_size;
2728
2729            Ok(())
2730        }
2731    }
2732
2733    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SetKeyDescriptor {
2734        #[inline(always)]
2735        fn new_empty() -> Self {
2736            Self::default()
2737        }
2738
2739        unsafe fn decode(
2740            &mut self,
2741            decoder: &mut fidl::encoding::Decoder<'_, D>,
2742            offset: usize,
2743            mut depth: fidl::encoding::Depth,
2744        ) -> fidl::Result<()> {
2745            decoder.debug_check_bounds::<Self>(offset);
2746            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2747                None => return Err(fidl::Error::NotNullable),
2748                Some(len) => len,
2749            };
2750            // Calling decoder.out_of_line_offset(0) is not allowed.
2751            if len == 0 {
2752                return Ok(());
2753            };
2754            depth.increment()?;
2755            let envelope_size = 8;
2756            let bytes_len = len * envelope_size;
2757            let offset = decoder.out_of_line_offset(bytes_len)?;
2758            // Decode the envelope for each type.
2759            let mut _next_ordinal_to_read = 0;
2760            let mut next_offset = offset;
2761            let end_offset = offset + bytes_len;
2762            _next_ordinal_to_read += 1;
2763            if next_offset >= end_offset {
2764                return Ok(());
2765            }
2766
2767            // Decode unknown envelopes for gaps in ordinals.
2768            while _next_ordinal_to_read < 1 {
2769                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2770                _next_ordinal_to_read += 1;
2771                next_offset += envelope_size;
2772            }
2773
2774            let next_out_of_line = decoder.next_out_of_line();
2775            let handles_before = decoder.remaining_handles();
2776            if let Some((inlined, num_bytes, num_handles)) =
2777                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2778            {
2779                let member_inline_size =
2780                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
2781                        decoder.context,
2782                    );
2783                if inlined != (member_inline_size <= 4) {
2784                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2785                }
2786                let inner_offset;
2787                let mut inner_depth = depth.clone();
2788                if inlined {
2789                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2790                    inner_offset = next_offset;
2791                } else {
2792                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2793                    inner_depth.increment()?;
2794                }
2795                let val_ref = self
2796                    .key
2797                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D));
2798                fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
2799                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2800                {
2801                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2802                }
2803                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2804                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2805                }
2806            }
2807
2808            next_offset += envelope_size;
2809            _next_ordinal_to_read += 1;
2810            if next_offset >= end_offset {
2811                return Ok(());
2812            }
2813
2814            // Decode unknown envelopes for gaps in ordinals.
2815            while _next_ordinal_to_read < 2 {
2816                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2817                _next_ordinal_to_read += 1;
2818                next_offset += envelope_size;
2819            }
2820
2821            let next_out_of_line = decoder.next_out_of_line();
2822            let handles_before = decoder.remaining_handles();
2823            if let Some((inlined, num_bytes, num_handles)) =
2824                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2825            {
2826                let member_inline_size =
2827                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2828                if inlined != (member_inline_size <= 4) {
2829                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2830                }
2831                let inner_offset;
2832                let mut inner_depth = depth.clone();
2833                if inlined {
2834                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2835                    inner_offset = next_offset;
2836                } else {
2837                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2838                    inner_depth.increment()?;
2839                }
2840                let val_ref = self.key_id.get_or_insert_with(|| fidl::new_empty!(u16, D));
2841                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
2842                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2843                {
2844                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2845                }
2846                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2847                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2848                }
2849            }
2850
2851            next_offset += envelope_size;
2852            _next_ordinal_to_read += 1;
2853            if next_offset >= end_offset {
2854                return Ok(());
2855            }
2856
2857            // Decode unknown envelopes for gaps in ordinals.
2858            while _next_ordinal_to_read < 3 {
2859                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2860                _next_ordinal_to_read += 1;
2861                next_offset += envelope_size;
2862            }
2863
2864            let next_out_of_line = decoder.next_out_of_line();
2865            let handles_before = decoder.remaining_handles();
2866            if let Some((inlined, num_bytes, num_handles)) =
2867                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2868            {
2869                let member_inline_size =
2870                    <KeyType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2871                if inlined != (member_inline_size <= 4) {
2872                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2873                }
2874                let inner_offset;
2875                let mut inner_depth = depth.clone();
2876                if inlined {
2877                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2878                    inner_offset = next_offset;
2879                } else {
2880                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2881                    inner_depth.increment()?;
2882                }
2883                let val_ref = self.key_type.get_or_insert_with(|| fidl::new_empty!(KeyType, D));
2884                fidl::decode!(KeyType, D, val_ref, decoder, inner_offset, inner_depth)?;
2885                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2886                {
2887                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2888                }
2889                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2890                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2891                }
2892            }
2893
2894            next_offset += envelope_size;
2895            _next_ordinal_to_read += 1;
2896            if next_offset >= end_offset {
2897                return Ok(());
2898            }
2899
2900            // Decode unknown envelopes for gaps in ordinals.
2901            while _next_ordinal_to_read < 4 {
2902                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2903                _next_ordinal_to_read += 1;
2904                next_offset += envelope_size;
2905            }
2906
2907            let next_out_of_line = decoder.next_out_of_line();
2908            let handles_before = decoder.remaining_handles();
2909            if let Some((inlined, num_bytes, num_handles)) =
2910                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2911            {
2912                let member_inline_size =
2913                    <fidl::encoding::Array<u8, 6> as fidl::encoding::TypeMarker>::inline_size(
2914                        decoder.context,
2915                    );
2916                if inlined != (member_inline_size <= 4) {
2917                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2918                }
2919                let inner_offset;
2920                let mut inner_depth = depth.clone();
2921                if inlined {
2922                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2923                    inner_offset = next_offset;
2924                } else {
2925                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2926                    inner_depth.increment()?;
2927                }
2928                let val_ref = self
2929                    .peer_addr
2930                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 6>, D));
2931                fidl::decode!(fidl::encoding::Array<u8, 6>, D, val_ref, decoder, inner_offset, inner_depth)?;
2932                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2933                {
2934                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2935                }
2936                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2937                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2938                }
2939            }
2940
2941            next_offset += envelope_size;
2942            _next_ordinal_to_read += 1;
2943            if next_offset >= end_offset {
2944                return Ok(());
2945            }
2946
2947            // Decode unknown envelopes for gaps in ordinals.
2948            while _next_ordinal_to_read < 5 {
2949                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2950                _next_ordinal_to_read += 1;
2951                next_offset += envelope_size;
2952            }
2953
2954            let next_out_of_line = decoder.next_out_of_line();
2955            let handles_before = decoder.remaining_handles();
2956            if let Some((inlined, num_bytes, num_handles)) =
2957                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2958            {
2959                let member_inline_size =
2960                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2961                if inlined != (member_inline_size <= 4) {
2962                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2963                }
2964                let inner_offset;
2965                let mut inner_depth = depth.clone();
2966                if inlined {
2967                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2968                    inner_offset = next_offset;
2969                } else {
2970                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2971                    inner_depth.increment()?;
2972                }
2973                let val_ref = self.rsc.get_or_insert_with(|| fidl::new_empty!(u64, D));
2974                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2975                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2976                {
2977                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2978                }
2979                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2980                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2981                }
2982            }
2983
2984            next_offset += envelope_size;
2985            _next_ordinal_to_read += 1;
2986            if next_offset >= end_offset {
2987                return Ok(());
2988            }
2989
2990            // Decode unknown envelopes for gaps in ordinals.
2991            while _next_ordinal_to_read < 6 {
2992                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2993                _next_ordinal_to_read += 1;
2994                next_offset += envelope_size;
2995            }
2996
2997            let next_out_of_line = decoder.next_out_of_line();
2998            let handles_before = decoder.remaining_handles();
2999            if let Some((inlined, num_bytes, num_handles)) =
3000                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3001            {
3002                let member_inline_size =
3003                    <fidl::encoding::Array<u8, 3> as fidl::encoding::TypeMarker>::inline_size(
3004                        decoder.context,
3005                    );
3006                if inlined != (member_inline_size <= 4) {
3007                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3008                }
3009                let inner_offset;
3010                let mut inner_depth = depth.clone();
3011                if inlined {
3012                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3013                    inner_offset = next_offset;
3014                } else {
3015                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3016                    inner_depth.increment()?;
3017                }
3018                let val_ref = self
3019                    .cipher_oui
3020                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 3>, D));
3021                fidl::decode!(fidl::encoding::Array<u8, 3>, D, val_ref, decoder, inner_offset, inner_depth)?;
3022                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3023                {
3024                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3025                }
3026                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3027                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3028                }
3029            }
3030
3031            next_offset += envelope_size;
3032            _next_ordinal_to_read += 1;
3033            if next_offset >= end_offset {
3034                return Ok(());
3035            }
3036
3037            // Decode unknown envelopes for gaps in ordinals.
3038            while _next_ordinal_to_read < 7 {
3039                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3040                _next_ordinal_to_read += 1;
3041                next_offset += envelope_size;
3042            }
3043
3044            let next_out_of_line = decoder.next_out_of_line();
3045            let handles_before = decoder.remaining_handles();
3046            if let Some((inlined, num_bytes, num_handles)) =
3047                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3048            {
3049                let member_inline_size =
3050                    <CipherSuiteType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3051                if inlined != (member_inline_size <= 4) {
3052                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3053                }
3054                let inner_offset;
3055                let mut inner_depth = depth.clone();
3056                if inlined {
3057                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3058                    inner_offset = next_offset;
3059                } else {
3060                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3061                    inner_depth.increment()?;
3062                }
3063                let val_ref =
3064                    self.cipher_type.get_or_insert_with(|| fidl::new_empty!(CipherSuiteType, D));
3065                fidl::decode!(CipherSuiteType, D, val_ref, decoder, inner_offset, inner_depth)?;
3066                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3067                {
3068                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3069                }
3070                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3071                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3072                }
3073            }
3074
3075            next_offset += envelope_size;
3076
3077            // Decode the remaining unknown envelopes.
3078            while next_offset < end_offset {
3079                _next_ordinal_to_read += 1;
3080                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3081                next_offset += envelope_size;
3082            }
3083
3084            Ok(())
3085        }
3086    }
3087}