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