Skip to main content

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
11/// Corresponds to the Capability Information field defined by IEEE Std 802.11-2020, 9.4.1.4.
12/// This contains subfields that indicate support for requested or optional capabilities.
13///
14/// TODO(https://fxbug.dev/367315525) Consider making this a bitfield.
15pub type CapabilityInfo = u16;
16
17pub type MacAddr = [u8; 6];
18
19pub type Ssid = Vec<u8>;
20
21pub const CCMP_128_MIC_LEN: u32 = 8;
22
23pub const CCMP_256_MIC_LEN: u32 = 16;
24
25/// IEEE Std 802.11-2016 12.5.3.2
26pub const CCMP_HDR_LEN: u32 = 8;
27
28pub const CCMP_PN_LEN: u32 = 6;
29
30pub const HT_CAP_LEN: u8 = 26;
31
32pub const HT_OP_LEN: u8 = 22;
33
34pub const MAC_ADDR_LEN: u8 = 6;
35
36pub const MAX_KEY_LEN: u8 = 32;
37
38/// IEEE Std 802.11-2016, 9.4.2.99
39pub const MAX_MESH_ID_BYTE_LEN: u8 = 32;
40
41/// IEEE Std 802.11-2016, 9.3.3.2
42pub const MAX_MGMT_FRAME_MAC_HEADER_BYTE_LEN: u8 = 28;
43
44/// IEEE Std 802.11-2016, 9.2.4.7
45pub const MAX_MMPDU_BYTE_LEN: u16 = 2304;
46
47/// IEEE Std 802.11-2016, 9.4.2.2
48/// The maximum length of an SSID is 32 bytes, even when the SSID should be
49/// interpreted using UTF-8 encoding (see Table 9-135). While every length in
50/// the 802.11 standard is byte oriented, the word BYTE is included in the
51/// name of this constant to emphasize the importance that it not be applied
52/// to the length of a UTF-8 encoded string.
53pub const MAX_SSID_BYTE_LEN: u8 = 32;
54
55pub const MAX_SUPPORTED_BASIC_RATES: u8 = 12;
56
57/// The limit on the number of channels in a list of unique channel numbers is 256
58/// since a channel number in IEEE 802.11-2016 cannot exceed one octet. See
59/// IEEE 802.11-2016 9.4.2.18 Supported Channels element for an example element
60/// that assumes a channel number does not exceed one octet.
61pub const MAX_UNIQUE_CHANNEL_NUMBERS: u16 = 256;
62
63pub const MAX_VHT_MPDU_BYTE_LEN_0: u16 = 3895;
64
65pub const MAX_VHT_MPDU_BYTE_LEN_1: u16 = 7991;
66
67pub const MAX_VHT_MPDU_BYTE_LEN_2: u16 = 11454;
68
69pub const OUI_LEN: u8 = 3;
70
71/// The limit on the number of SSIDs is 84 because an SSID List IE can contain no
72/// more than 84 one byte SSIDs. (Specifying a zero byte SSID in an SSID List with
73/// more than one SSID is valid but unnecessary since it is the wildcard SSID.)
74pub const SSID_LIST_MAX: u8 = 84;
75
76/// IEEE Std 802.11-2016, 9.2.4.5
77pub const TIDS_MAX: u32 = 16;
78
79pub const VHT_CAP_LEN: u8 = 12;
80
81pub const VHT_OP_LEN: u8 = 5;
82
83pub const WLAN_IE_BODY_MAX_LEN: u32 = 255;
84
85/// IEEE Std 802.11-2016, 9.4.2.25.1
86/// IEEE mentions that an element body maximum length is 255 octets in the RSN element
87/// section, but not in a dedicated section.
88/// Since the IE header is two octets, the whole IE max length is 257 octets.
89pub const WLAN_IE_MAX_LEN: u32 = 257;
90
91/// IEEE Std 802.11-2016, Table 9-19
92pub const WLAN_MSDU_MAX_LEN: u32 = 2304;
93
94#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
95pub enum BssType {
96    Unknown,
97    Infrastructure,
98    Independent,
99    Mesh,
100    Personal,
101    #[doc(hidden)]
102    __SourceBreaking {
103        unknown_ordinal: u32,
104    },
105}
106
107/// Pattern that matches an unknown `BssType` member.
108#[macro_export]
109macro_rules! BssTypeUnknown {
110    () => {
111        _
112    };
113}
114
115impl BssType {
116    #[inline]
117    pub fn from_primitive(prim: u32) -> Option<Self> {
118        match prim {
119            0 => Some(Self::Unknown),
120            1 => Some(Self::Infrastructure),
121            2 => Some(Self::Independent),
122            3 => Some(Self::Mesh),
123            4 => Some(Self::Personal),
124            _ => None,
125        }
126    }
127
128    #[inline]
129    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
130        match prim {
131            0 => Self::Unknown,
132            1 => Self::Infrastructure,
133            2 => Self::Independent,
134            3 => Self::Mesh,
135            4 => Self::Personal,
136            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
137        }
138    }
139
140    #[inline]
141    pub fn unknown() -> Self {
142        Self::__SourceBreaking { unknown_ordinal: 0x0 }
143    }
144
145    #[inline]
146    pub const fn into_primitive(self) -> u32 {
147        match self {
148            Self::Unknown => 0,
149            Self::Infrastructure => 1,
150            Self::Independent => 2,
151            Self::Mesh => 3,
152            Self::Personal => 4,
153            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
154        }
155    }
156
157    #[inline]
158    pub fn is_unknown(&self) -> bool {
159        match self {
160            Self::__SourceBreaking { unknown_ordinal: _ } => true,
161            _ => false,
162        }
163    }
164}
165
166/// Channel width is derived from the HT operation and VHT operation IEs,
167/// or defaults to 20 MHz if not specified explicitly
168///
169/// IEEE Std 802.11-2016, Table 9-153 - HT/VHT Operation Information subfields
170#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
171pub enum ChannelBandwidth {
172    Cbw20,
173    Cbw40,
174    Cbw40Below,
175    Cbw80,
176    Cbw160,
177    Cbw80P80,
178    #[doc(hidden)]
179    __SourceBreaking {
180        unknown_ordinal: u32,
181    },
182}
183
184/// Pattern that matches an unknown `ChannelBandwidth` member.
185#[macro_export]
186macro_rules! ChannelBandwidthUnknown {
187    () => {
188        _
189    };
190}
191
192impl ChannelBandwidth {
193    #[inline]
194    pub fn from_primitive(prim: u32) -> Option<Self> {
195        match prim {
196            1 => Some(Self::Cbw20),
197            2 => Some(Self::Cbw40),
198            3 => Some(Self::Cbw40Below),
199            4 => Some(Self::Cbw80),
200            5 => Some(Self::Cbw160),
201            6 => Some(Self::Cbw80P80),
202            _ => None,
203        }
204    }
205
206    #[inline]
207    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
208        match prim {
209            1 => Self::Cbw20,
210            2 => Self::Cbw40,
211            3 => Self::Cbw40Below,
212            4 => Self::Cbw80,
213            5 => Self::Cbw160,
214            6 => Self::Cbw80P80,
215            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
216        }
217    }
218
219    #[inline]
220    pub fn unknown() -> Self {
221        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
222    }
223
224    #[inline]
225    pub const fn into_primitive(self) -> u32 {
226        match self {
227            Self::Cbw20 => 1,
228            Self::Cbw40 => 2,
229            Self::Cbw40Below => 3,
230            Self::Cbw80 => 4,
231            Self::Cbw160 => 5,
232            Self::Cbw80P80 => 6,
233            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
234        }
235    }
236
237    #[inline]
238    pub fn is_unknown(&self) -> bool {
239        match self {
240            Self::__SourceBreaking { unknown_ordinal: _ } => true,
241            _ => false,
242        }
243    }
244}
245
246/// IEEE Std 802.11-2016, 9.4.2.25.2
247#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
248pub enum CipherSuiteType {
249    UseGroup,
250    Wep40,
251    Tkip,
252    Reserved3,
253    Ccmp128,
254    Wep104,
255    BipCmac128,
256    GroupAddressedNotAllowed,
257    Gcmp128,
258    Gcmp256,
259    Ccmp256,
260    BipGmac128,
261    BipGmac256,
262    BipCmac256,
263    Reserved14To255,
264    #[doc(hidden)]
265    __SourceBreaking {
266        unknown_ordinal: u32,
267    },
268}
269
270/// Pattern that matches an unknown `CipherSuiteType` member.
271#[macro_export]
272macro_rules! CipherSuiteTypeUnknown {
273    () => {
274        _
275    };
276}
277
278impl CipherSuiteType {
279    #[inline]
280    pub fn from_primitive(prim: u32) -> Option<Self> {
281        match prim {
282            0 => Some(Self::UseGroup),
283            1 => Some(Self::Wep40),
284            2 => Some(Self::Tkip),
285            3 => Some(Self::Reserved3),
286            4 => Some(Self::Ccmp128),
287            5 => Some(Self::Wep104),
288            6 => Some(Self::BipCmac128),
289            7 => Some(Self::GroupAddressedNotAllowed),
290            8 => Some(Self::Gcmp128),
291            9 => Some(Self::Gcmp256),
292            10 => Some(Self::Ccmp256),
293            11 => Some(Self::BipGmac128),
294            12 => Some(Self::BipGmac256),
295            13 => Some(Self::BipCmac256),
296            14 => Some(Self::Reserved14To255),
297            _ => None,
298        }
299    }
300
301    #[inline]
302    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
303        match prim {
304            0 => Self::UseGroup,
305            1 => Self::Wep40,
306            2 => Self::Tkip,
307            3 => Self::Reserved3,
308            4 => Self::Ccmp128,
309            5 => Self::Wep104,
310            6 => Self::BipCmac128,
311            7 => Self::GroupAddressedNotAllowed,
312            8 => Self::Gcmp128,
313            9 => Self::Gcmp256,
314            10 => Self::Ccmp256,
315            11 => Self::BipGmac128,
316            12 => Self::BipGmac256,
317            13 => Self::BipCmac256,
318            14 => Self::Reserved14To255,
319            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
320        }
321    }
322
323    #[inline]
324    pub fn unknown() -> Self {
325        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
326    }
327
328    #[inline]
329    pub const fn into_primitive(self) -> u32 {
330        match self {
331            Self::UseGroup => 0,
332            Self::Wep40 => 1,
333            Self::Tkip => 2,
334            Self::Reserved3 => 3,
335            Self::Ccmp128 => 4,
336            Self::Wep104 => 5,
337            Self::BipCmac128 => 6,
338            Self::GroupAddressedNotAllowed => 7,
339            Self::Gcmp128 => 8,
340            Self::Gcmp256 => 9,
341            Self::Ccmp256 => 10,
342            Self::BipGmac128 => 11,
343            Self::BipGmac256 => 12,
344            Self::BipCmac256 => 13,
345            Self::Reserved14To255 => 14,
346            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
347        }
348    }
349
350    #[inline]
351    pub fn is_unknown(&self) -> bool {
352        match self {
353            Self::__SourceBreaking { unknown_ordinal: _ } => true,
354            _ => false,
355        }
356    }
357}
358
359/// HT and VHT guard interval.
360/// See IEEE 802.11-2016 Table 19-1 and Table 21-1.
361#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
362#[repr(u8)]
363pub enum GuardInterval {
364    LongGi = 1,
365    ShortGi = 2,
366}
367
368impl GuardInterval {
369    #[inline]
370    pub fn from_primitive(prim: u8) -> Option<Self> {
371        match prim {
372            1 => Some(Self::LongGi),
373            2 => Some(Self::ShortGi),
374            _ => None,
375        }
376    }
377
378    #[inline]
379    pub const fn into_primitive(self) -> u8 {
380        self as u8
381    }
382}
383
384#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
385pub enum KeyType {
386    Pairwise,
387    Group,
388    Igtk,
389    Peer,
390    #[doc(hidden)]
391    __SourceBreaking {
392        unknown_ordinal: u8,
393    },
394}
395
396/// Pattern that matches an unknown `KeyType` member.
397#[macro_export]
398macro_rules! KeyTypeUnknown {
399    () => {
400        _
401    };
402}
403
404impl KeyType {
405    #[inline]
406    pub fn from_primitive(prim: u8) -> Option<Self> {
407        match prim {
408            1 => Some(Self::Pairwise),
409            2 => Some(Self::Group),
410            3 => Some(Self::Igtk),
411            4 => Some(Self::Peer),
412            _ => None,
413        }
414    }
415
416    #[inline]
417    pub fn from_primitive_allow_unknown(prim: u8) -> Self {
418        match prim {
419            1 => Self::Pairwise,
420            2 => Self::Group,
421            3 => Self::Igtk,
422            4 => Self::Peer,
423            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
424        }
425    }
426
427    #[inline]
428    pub fn unknown() -> Self {
429        Self::__SourceBreaking { unknown_ordinal: 0xff }
430    }
431
432    #[inline]
433    pub const fn into_primitive(self) -> u8 {
434        match self {
435            Self::Pairwise => 1,
436            Self::Group => 2,
437            Self::Igtk => 3,
438            Self::Peer => 4,
439            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
440        }
441    }
442
443    #[inline]
444    pub fn is_unknown(&self) -> bool {
445        match self {
446            Self::__SourceBreaking { unknown_ordinal: _ } => true,
447            _ => false,
448        }
449    }
450}
451
452/// 802.11 reason codes.  These values are common throughout the standard.
453/// IEEE Std 802.11-2016, 9.4.1.7, Table 9-45
454#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
455pub enum ReasonCode {
456    UnspecifiedReason,
457    InvalidAuthentication,
458    LeavingNetworkDeauth,
459    ReasonInactivity,
460    NoMoreStas,
461    InvalidClass2Frame,
462    InvalidClass3Frame,
463    LeavingNetworkDisassoc,
464    NotAuthenticated,
465    UnacceptablePowerCapability,
466    UnacceptableSupportedChannels,
467    BssTransitionDisassoc,
468    ReasonInvalidElement,
469    MicFailure,
470    /// 15 is named "4WAY_HANDSHAKE_TIMEOUT" in 802.11-2016.
471    FourwayHandshakeTimeout,
472    GkHandshakeTimeout,
473    HandshakeElementMismatch,
474    ReasonInvalidGroupCipher,
475    ReasonInvalidPairwiseCipher,
476    ReasonInvalidAkmp,
477    UnsupportedRsneVersion,
478    InvalidRsneCapabilities,
479    /// 23 is named "802_1_X_AUTH_FAILED" in 802.11-2016.
480    Ieee8021XAuthFailed,
481    ReasonCipherOutOfPolicy,
482    TdlsPeerUnreachable,
483    TdlsUnspecifiedReason,
484    SspRequestedDisassoc,
485    NoSspRoamingAgreement,
486    BadCipherOrAkm,
487    NotAuthorizedThisLocation,
488    ServiceChangePrecludesTs,
489    UnspecifiedQosReason,
490    NotEnoughBandwidth,
491    MissingAcks,
492    ExceededTxop,
493    StaLeaving,
494    /// 37 is assigned to multiple names "END_TS", "END_BA", and "END_DLS" in 802.11-2016.
495    EndTsBaDls,
496    /// 38 is assigned to multiple names "UNKNOWN_TS" and "UNKNOWN_BA" in 802.11-2016.
497    UnknownTsBa,
498    Timeout,
499    PeerkeyMismatch,
500    PeerInitiated,
501    ApInitiated,
502    ReasonInvalidFtActionFrameCount,
503    ReasonInvalidPmkid,
504    ReasonInvalidMde,
505    ReasonInvalidFte,
506    MeshPeeringCanceled,
507    MeshMaxPeers,
508    MeshConfigurationPolicyViolation,
509    MeshCloseRcvd,
510    MeshMaxRetries,
511    MeshConfirmTimeout,
512    MeshInvalidGtk,
513    MeshInconsistentParameters,
514    MeshInvalidSecurityCapability,
515    MeshPathErrorNoProxyInformation,
516    MeshPathErrorNoForwardingInformation,
517    MeshPathErrorDestinationUnreachable,
518    MacAddressAlreadyExistsInMbss,
519    MeshChannelSwitchRegulatoryRequirements,
520    MeshChannelSwitchUnspecified,
521    /// -----
522    /// Values 67 to 127 are reserved by the IEEE protocol, and
523    /// values 128 to 65535 are reserved for platform use.
524    /// -----
525    /// MLME lost the link, usually caused by loss of signal with the AP.
526    MlmeLinkFailed,
527    /// Driver detected a stalled Rx path in FW.
528    FwRxStalled,
529    /// Driver detected high wme rx error rate in FW.
530    FwHighWmeRxErrRate,
531    #[doc(hidden)]
532    __SourceBreaking {
533        unknown_ordinal: u16,
534    },
535}
536
537/// Pattern that matches an unknown `ReasonCode` member.
538#[macro_export]
539macro_rules! ReasonCodeUnknown {
540    () => {
541        _
542    };
543}
544
545impl ReasonCode {
546    #[inline]
547    pub fn from_primitive(prim: u16) -> Option<Self> {
548        match prim {
549            1 => Some(Self::UnspecifiedReason),
550            2 => Some(Self::InvalidAuthentication),
551            3 => Some(Self::LeavingNetworkDeauth),
552            4 => Some(Self::ReasonInactivity),
553            5 => Some(Self::NoMoreStas),
554            6 => Some(Self::InvalidClass2Frame),
555            7 => Some(Self::InvalidClass3Frame),
556            8 => Some(Self::LeavingNetworkDisassoc),
557            9 => Some(Self::NotAuthenticated),
558            10 => Some(Self::UnacceptablePowerCapability),
559            11 => Some(Self::UnacceptableSupportedChannels),
560            12 => Some(Self::BssTransitionDisassoc),
561            13 => Some(Self::ReasonInvalidElement),
562            14 => Some(Self::MicFailure),
563            15 => Some(Self::FourwayHandshakeTimeout),
564            16 => Some(Self::GkHandshakeTimeout),
565            17 => Some(Self::HandshakeElementMismatch),
566            18 => Some(Self::ReasonInvalidGroupCipher),
567            19 => Some(Self::ReasonInvalidPairwiseCipher),
568            20 => Some(Self::ReasonInvalidAkmp),
569            21 => Some(Self::UnsupportedRsneVersion),
570            22 => Some(Self::InvalidRsneCapabilities),
571            23 => Some(Self::Ieee8021XAuthFailed),
572            24 => Some(Self::ReasonCipherOutOfPolicy),
573            25 => Some(Self::TdlsPeerUnreachable),
574            26 => Some(Self::TdlsUnspecifiedReason),
575            27 => Some(Self::SspRequestedDisassoc),
576            28 => Some(Self::NoSspRoamingAgreement),
577            29 => Some(Self::BadCipherOrAkm),
578            30 => Some(Self::NotAuthorizedThisLocation),
579            31 => Some(Self::ServiceChangePrecludesTs),
580            32 => Some(Self::UnspecifiedQosReason),
581            33 => Some(Self::NotEnoughBandwidth),
582            34 => Some(Self::MissingAcks),
583            35 => Some(Self::ExceededTxop),
584            36 => Some(Self::StaLeaving),
585            37 => Some(Self::EndTsBaDls),
586            38 => Some(Self::UnknownTsBa),
587            39 => Some(Self::Timeout),
588            45 => Some(Self::PeerkeyMismatch),
589            46 => Some(Self::PeerInitiated),
590            47 => Some(Self::ApInitiated),
591            48 => Some(Self::ReasonInvalidFtActionFrameCount),
592            49 => Some(Self::ReasonInvalidPmkid),
593            50 => Some(Self::ReasonInvalidMde),
594            51 => Some(Self::ReasonInvalidFte),
595            52 => Some(Self::MeshPeeringCanceled),
596            53 => Some(Self::MeshMaxPeers),
597            54 => Some(Self::MeshConfigurationPolicyViolation),
598            55 => Some(Self::MeshCloseRcvd),
599            56 => Some(Self::MeshMaxRetries),
600            57 => Some(Self::MeshConfirmTimeout),
601            58 => Some(Self::MeshInvalidGtk),
602            59 => Some(Self::MeshInconsistentParameters),
603            60 => Some(Self::MeshInvalidSecurityCapability),
604            61 => Some(Self::MeshPathErrorNoProxyInformation),
605            62 => Some(Self::MeshPathErrorNoForwardingInformation),
606            63 => Some(Self::MeshPathErrorDestinationUnreachable),
607            64 => Some(Self::MacAddressAlreadyExistsInMbss),
608            65 => Some(Self::MeshChannelSwitchRegulatoryRequirements),
609            66 => Some(Self::MeshChannelSwitchUnspecified),
610            128 => Some(Self::MlmeLinkFailed),
611            129 => Some(Self::FwRxStalled),
612            130 => Some(Self::FwHighWmeRxErrRate),
613            _ => None,
614        }
615    }
616
617    #[inline]
618    pub fn from_primitive_allow_unknown(prim: u16) -> Self {
619        match prim {
620            1 => Self::UnspecifiedReason,
621            2 => Self::InvalidAuthentication,
622            3 => Self::LeavingNetworkDeauth,
623            4 => Self::ReasonInactivity,
624            5 => Self::NoMoreStas,
625            6 => Self::InvalidClass2Frame,
626            7 => Self::InvalidClass3Frame,
627            8 => Self::LeavingNetworkDisassoc,
628            9 => Self::NotAuthenticated,
629            10 => Self::UnacceptablePowerCapability,
630            11 => Self::UnacceptableSupportedChannels,
631            12 => Self::BssTransitionDisassoc,
632            13 => Self::ReasonInvalidElement,
633            14 => Self::MicFailure,
634            15 => Self::FourwayHandshakeTimeout,
635            16 => Self::GkHandshakeTimeout,
636            17 => Self::HandshakeElementMismatch,
637            18 => Self::ReasonInvalidGroupCipher,
638            19 => Self::ReasonInvalidPairwiseCipher,
639            20 => Self::ReasonInvalidAkmp,
640            21 => Self::UnsupportedRsneVersion,
641            22 => Self::InvalidRsneCapabilities,
642            23 => Self::Ieee8021XAuthFailed,
643            24 => Self::ReasonCipherOutOfPolicy,
644            25 => Self::TdlsPeerUnreachable,
645            26 => Self::TdlsUnspecifiedReason,
646            27 => Self::SspRequestedDisassoc,
647            28 => Self::NoSspRoamingAgreement,
648            29 => Self::BadCipherOrAkm,
649            30 => Self::NotAuthorizedThisLocation,
650            31 => Self::ServiceChangePrecludesTs,
651            32 => Self::UnspecifiedQosReason,
652            33 => Self::NotEnoughBandwidth,
653            34 => Self::MissingAcks,
654            35 => Self::ExceededTxop,
655            36 => Self::StaLeaving,
656            37 => Self::EndTsBaDls,
657            38 => Self::UnknownTsBa,
658            39 => Self::Timeout,
659            45 => Self::PeerkeyMismatch,
660            46 => Self::PeerInitiated,
661            47 => Self::ApInitiated,
662            48 => Self::ReasonInvalidFtActionFrameCount,
663            49 => Self::ReasonInvalidPmkid,
664            50 => Self::ReasonInvalidMde,
665            51 => Self::ReasonInvalidFte,
666            52 => Self::MeshPeeringCanceled,
667            53 => Self::MeshMaxPeers,
668            54 => Self::MeshConfigurationPolicyViolation,
669            55 => Self::MeshCloseRcvd,
670            56 => Self::MeshMaxRetries,
671            57 => Self::MeshConfirmTimeout,
672            58 => Self::MeshInvalidGtk,
673            59 => Self::MeshInconsistentParameters,
674            60 => Self::MeshInvalidSecurityCapability,
675            61 => Self::MeshPathErrorNoProxyInformation,
676            62 => Self::MeshPathErrorNoForwardingInformation,
677            63 => Self::MeshPathErrorDestinationUnreachable,
678            64 => Self::MacAddressAlreadyExistsInMbss,
679            65 => Self::MeshChannelSwitchRegulatoryRequirements,
680            66 => Self::MeshChannelSwitchUnspecified,
681            128 => Self::MlmeLinkFailed,
682            129 => Self::FwRxStalled,
683            130 => Self::FwHighWmeRxErrRate,
684            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
685        }
686    }
687
688    #[inline]
689    pub fn unknown() -> Self {
690        Self::__SourceBreaking { unknown_ordinal: 0xffff }
691    }
692
693    #[inline]
694    pub const fn into_primitive(self) -> u16 {
695        match self {
696            Self::UnspecifiedReason => 1,
697            Self::InvalidAuthentication => 2,
698            Self::LeavingNetworkDeauth => 3,
699            Self::ReasonInactivity => 4,
700            Self::NoMoreStas => 5,
701            Self::InvalidClass2Frame => 6,
702            Self::InvalidClass3Frame => 7,
703            Self::LeavingNetworkDisassoc => 8,
704            Self::NotAuthenticated => 9,
705            Self::UnacceptablePowerCapability => 10,
706            Self::UnacceptableSupportedChannels => 11,
707            Self::BssTransitionDisassoc => 12,
708            Self::ReasonInvalidElement => 13,
709            Self::MicFailure => 14,
710            Self::FourwayHandshakeTimeout => 15,
711            Self::GkHandshakeTimeout => 16,
712            Self::HandshakeElementMismatch => 17,
713            Self::ReasonInvalidGroupCipher => 18,
714            Self::ReasonInvalidPairwiseCipher => 19,
715            Self::ReasonInvalidAkmp => 20,
716            Self::UnsupportedRsneVersion => 21,
717            Self::InvalidRsneCapabilities => 22,
718            Self::Ieee8021XAuthFailed => 23,
719            Self::ReasonCipherOutOfPolicy => 24,
720            Self::TdlsPeerUnreachable => 25,
721            Self::TdlsUnspecifiedReason => 26,
722            Self::SspRequestedDisassoc => 27,
723            Self::NoSspRoamingAgreement => 28,
724            Self::BadCipherOrAkm => 29,
725            Self::NotAuthorizedThisLocation => 30,
726            Self::ServiceChangePrecludesTs => 31,
727            Self::UnspecifiedQosReason => 32,
728            Self::NotEnoughBandwidth => 33,
729            Self::MissingAcks => 34,
730            Self::ExceededTxop => 35,
731            Self::StaLeaving => 36,
732            Self::EndTsBaDls => 37,
733            Self::UnknownTsBa => 38,
734            Self::Timeout => 39,
735            Self::PeerkeyMismatch => 45,
736            Self::PeerInitiated => 46,
737            Self::ApInitiated => 47,
738            Self::ReasonInvalidFtActionFrameCount => 48,
739            Self::ReasonInvalidPmkid => 49,
740            Self::ReasonInvalidMde => 50,
741            Self::ReasonInvalidFte => 51,
742            Self::MeshPeeringCanceled => 52,
743            Self::MeshMaxPeers => 53,
744            Self::MeshConfigurationPolicyViolation => 54,
745            Self::MeshCloseRcvd => 55,
746            Self::MeshMaxRetries => 56,
747            Self::MeshConfirmTimeout => 57,
748            Self::MeshInvalidGtk => 58,
749            Self::MeshInconsistentParameters => 59,
750            Self::MeshInvalidSecurityCapability => 60,
751            Self::MeshPathErrorNoProxyInformation => 61,
752            Self::MeshPathErrorNoForwardingInformation => 62,
753            Self::MeshPathErrorDestinationUnreachable => 63,
754            Self::MacAddressAlreadyExistsInMbss => 64,
755            Self::MeshChannelSwitchRegulatoryRequirements => 65,
756            Self::MeshChannelSwitchUnspecified => 66,
757            Self::MlmeLinkFailed => 128,
758            Self::FwRxStalled => 129,
759            Self::FwHighWmeRxErrRate => 130,
760            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
761        }
762    }
763
764    #[inline]
765    pub fn is_unknown(&self) -> bool {
766        match self {
767            Self::__SourceBreaking { unknown_ordinal: _ } => true,
768            _ => false,
769        }
770    }
771}
772
773/// 802.11 status codes.  These values are common throughout the standard.
774/// IEEE Std 802.11-2016, 9.4.1.9, Table 9-46
775#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
776pub enum StatusCode {
777    Success,
778    RefusedReasonUnspecified,
779    TdlsRejectedAlternativeProvided,
780    TdlsRejected,
781    /// 4 reserved.
782    SecurityDisabled,
783    UnacceptableLifetime,
784    NotInSameBss,
785    /// 8-9 reserved.
786    RefusedCapabilitiesMismatch,
787    DeniedNoAssociationExists,
788    DeniedOtherReason,
789    UnsupportedAuthAlgorithm,
790    TransactionSequenceError,
791    ChallengeFailure,
792    RejectedSequenceTimeout,
793    DeniedNoMoreStas,
794    RefusedBasicRatesMismatch,
795    DeniedNoShortPreambleSupport,
796    /// 20-21 reserved.
797    RejectedSpectrumManagementRequired,
798    RejectedBadPowerCapability,
799    RejectedBadSupportedChannels,
800    DeniedNoShortSlotTimeSupport,
801    /// 26 reserved.
802    DeniedNoHtSupport,
803    R0KhUnreachable,
804    DeniedPcoTimeNotSupported,
805    RefusedTemporarily,
806    RobustManagementPolicyViolation,
807    UnspecifiedQosFailure,
808    DeniedInsufficientBandwidth,
809    DeniedPoorChannelConditions,
810    DeniedQosNotSupported,
811    /// 36 reserved.
812    RequestDeclined,
813    InvalidParameters,
814    RejectedWithSuggestedChanges,
815    StatusInvalidElement,
816    StatusInvalidGroupCipher,
817    StatusInvalidPairwiseCipher,
818    StatusInvalidAkmp,
819    UnsupportedRsneVersion,
820    InvalidRsneCapabilities,
821    StatusCipherOutOfPolicy,
822    RejectedForDelayPeriod,
823    DlsNotAllowed,
824    NotPresent,
825    NotQosSta,
826    DeniedListenIntervalTooLarge,
827    StatusInvalidFtActionFrameCount,
828    StatusInvalidPmkid,
829    StatusInvalidMde,
830    StatusInvalidFte,
831    /// 56 is assigned to "REQUESTED_TCLAS_NOT_SUPPORTED_BY_AP" in 802.11-2016, duplicate with 80.
832    /// Name below is as listed in the 802.11 Assigned Numbers Authority database.
833    RequestedTclasNotSupportedByAp,
834    InsufficientTclasProcessingResources,
835    TryAnotherBss,
836    GasAdvertisementProtocolNotSupported,
837    NoOutstandingGasRequest,
838    GasResponseNotReceivedFromServer,
839    GasQueryTimeout,
840    GasQueryResponseTooLarge,
841    RejectedHomeWithSuggestedChanges,
842    ServerUnreachable,
843    /// 66 reserved.
844    RejectedForSspPermissions,
845    RefusedUnauthenticatedAccessNotSupported,
846    /// 69-71 reserved.
847    InvalidRsne,
848    UApsdCoexistanceNotSupported,
849    UApsdCoexModeNotSupported,
850    BadIntervalWithUApsdCoex,
851    AntiCloggingTokenRequired,
852    UnsupportedFiniteCyclicGroup,
853    CannotFindAlternativeTbtt,
854    TransmissionFailure,
855    /// See assignment for 56.
856    RequestedTclasNotSupported,
857    TclasResourcesExhausted,
858    RejectedWithSuggestedBssTransition,
859    RejectWithSchedule,
860    RejectNoWakeupSpecified,
861    SuccessPowerSaveMode,
862    PendingAdmittingFstSession,
863    PerformingFstNow,
864    PendingGapInBaWindow,
865    RejectUPidSetting,
866    /// 90-91 reserved.
867    RefusedExternalReason,
868    RefusedApOutOfMemory,
869    RejectedEmergencyServicesNotSupported,
870    QueryResponseOutstanding,
871    RejectDseBand,
872    TclasProcessingTerminated,
873    TsScheduleConflict,
874    DeniedWithSuggestedBandAndChannel,
875    MccaopReservationConflict,
876    MafLimitExceeded,
877    MccaTrackLimitExceeded,
878    DeniedDueToSpectrumManagement,
879    DeniedVhtNotSupported,
880    EnablementDenied,
881    RestrictionFromAuthorizedGdb,
882    AuthorizationDeenabled,
883    EnergyLimitedOperationNotSupported,
884    RejectedNdpBlockAckSuggested,
885    RejectedMaxAwayDurationUnacceptable,
886    FlowControlOperationSupported,
887    FilsAuthenticationFailure,
888    UnknownAuthenticationServer,
889    /// 114-115 reserved.
890    DeniedNotificationPeriodAllocation,
891    DeniedChannelSplitting,
892    DeniedAllocation,
893    CmmgFeaturesNotSupported,
894    GasFragmentNotAvailable,
895    SuccessCagVersionsMatch,
896    GlkNotAuthorized,
897    UnknownPasswordIdentifier,
898    /// 124 reserved.
899    DeniedLocalMacAddressPolicyViolation,
900    SaeHashToElement,
901    /// 127 reserved.
902    TclasProcessingTerminatedInsufficientQos,
903    TclasProcessingTerminatedPolicyConflict,
904    /// Reserved values we will use for our own purposes.
905    /// -----
906    /// Failure when joining the BSS.
907    JoinFailure,
908    /// Authenticate or associate fails due to spurious deauth or diassoc.
909    SpuriousDeauthOrDisassoc,
910    /// Connect attempt is canceled
911    Canceled,
912    /// Failure establishing security association
913    EstablishRsnaFailure,
914    /// Failure initiating OWE handshake or receiving public key from peer
915    OweHandshakeFailure,
916    #[doc(hidden)]
917    __SourceBreaking {
918        unknown_ordinal: u16,
919    },
920}
921
922/// Pattern that matches an unknown `StatusCode` member.
923#[macro_export]
924macro_rules! StatusCodeUnknown {
925    () => {
926        _
927    };
928}
929
930impl StatusCode {
931    #[inline]
932    pub fn from_primitive(prim: u16) -> Option<Self> {
933        match prim {
934            0 => Some(Self::Success),
935            1 => Some(Self::RefusedReasonUnspecified),
936            2 => Some(Self::TdlsRejectedAlternativeProvided),
937            3 => Some(Self::TdlsRejected),
938            5 => Some(Self::SecurityDisabled),
939            6 => Some(Self::UnacceptableLifetime),
940            7 => Some(Self::NotInSameBss),
941            10 => Some(Self::RefusedCapabilitiesMismatch),
942            11 => Some(Self::DeniedNoAssociationExists),
943            12 => Some(Self::DeniedOtherReason),
944            13 => Some(Self::UnsupportedAuthAlgorithm),
945            14 => Some(Self::TransactionSequenceError),
946            15 => Some(Self::ChallengeFailure),
947            16 => Some(Self::RejectedSequenceTimeout),
948            17 => Some(Self::DeniedNoMoreStas),
949            18 => Some(Self::RefusedBasicRatesMismatch),
950            19 => Some(Self::DeniedNoShortPreambleSupport),
951            22 => Some(Self::RejectedSpectrumManagementRequired),
952            23 => Some(Self::RejectedBadPowerCapability),
953            24 => Some(Self::RejectedBadSupportedChannels),
954            25 => Some(Self::DeniedNoShortSlotTimeSupport),
955            27 => Some(Self::DeniedNoHtSupport),
956            28 => Some(Self::R0KhUnreachable),
957            29 => Some(Self::DeniedPcoTimeNotSupported),
958            30 => Some(Self::RefusedTemporarily),
959            31 => Some(Self::RobustManagementPolicyViolation),
960            32 => Some(Self::UnspecifiedQosFailure),
961            33 => Some(Self::DeniedInsufficientBandwidth),
962            34 => Some(Self::DeniedPoorChannelConditions),
963            35 => Some(Self::DeniedQosNotSupported),
964            37 => Some(Self::RequestDeclined),
965            38 => Some(Self::InvalidParameters),
966            39 => Some(Self::RejectedWithSuggestedChanges),
967            40 => Some(Self::StatusInvalidElement),
968            41 => Some(Self::StatusInvalidGroupCipher),
969            42 => Some(Self::StatusInvalidPairwiseCipher),
970            43 => Some(Self::StatusInvalidAkmp),
971            44 => Some(Self::UnsupportedRsneVersion),
972            45 => Some(Self::InvalidRsneCapabilities),
973            46 => Some(Self::StatusCipherOutOfPolicy),
974            47 => Some(Self::RejectedForDelayPeriod),
975            48 => Some(Self::DlsNotAllowed),
976            49 => Some(Self::NotPresent),
977            50 => Some(Self::NotQosSta),
978            51 => Some(Self::DeniedListenIntervalTooLarge),
979            52 => Some(Self::StatusInvalidFtActionFrameCount),
980            53 => Some(Self::StatusInvalidPmkid),
981            54 => Some(Self::StatusInvalidMde),
982            55 => Some(Self::StatusInvalidFte),
983            56 => Some(Self::RequestedTclasNotSupportedByAp),
984            57 => Some(Self::InsufficientTclasProcessingResources),
985            58 => Some(Self::TryAnotherBss),
986            59 => Some(Self::GasAdvertisementProtocolNotSupported),
987            60 => Some(Self::NoOutstandingGasRequest),
988            61 => Some(Self::GasResponseNotReceivedFromServer),
989            62 => Some(Self::GasQueryTimeout),
990            63 => Some(Self::GasQueryResponseTooLarge),
991            64 => Some(Self::RejectedHomeWithSuggestedChanges),
992            65 => Some(Self::ServerUnreachable),
993            67 => Some(Self::RejectedForSspPermissions),
994            68 => Some(Self::RefusedUnauthenticatedAccessNotSupported),
995            72 => Some(Self::InvalidRsne),
996            73 => Some(Self::UApsdCoexistanceNotSupported),
997            74 => Some(Self::UApsdCoexModeNotSupported),
998            75 => Some(Self::BadIntervalWithUApsdCoex),
999            76 => Some(Self::AntiCloggingTokenRequired),
1000            77 => Some(Self::UnsupportedFiniteCyclicGroup),
1001            78 => Some(Self::CannotFindAlternativeTbtt),
1002            79 => Some(Self::TransmissionFailure),
1003            80 => Some(Self::RequestedTclasNotSupported),
1004            81 => Some(Self::TclasResourcesExhausted),
1005            82 => Some(Self::RejectedWithSuggestedBssTransition),
1006            83 => Some(Self::RejectWithSchedule),
1007            84 => Some(Self::RejectNoWakeupSpecified),
1008            85 => Some(Self::SuccessPowerSaveMode),
1009            86 => Some(Self::PendingAdmittingFstSession),
1010            87 => Some(Self::PerformingFstNow),
1011            88 => Some(Self::PendingGapInBaWindow),
1012            89 => Some(Self::RejectUPidSetting),
1013            92 => Some(Self::RefusedExternalReason),
1014            93 => Some(Self::RefusedApOutOfMemory),
1015            94 => Some(Self::RejectedEmergencyServicesNotSupported),
1016            95 => Some(Self::QueryResponseOutstanding),
1017            96 => Some(Self::RejectDseBand),
1018            97 => Some(Self::TclasProcessingTerminated),
1019            98 => Some(Self::TsScheduleConflict),
1020            99 => Some(Self::DeniedWithSuggestedBandAndChannel),
1021            100 => Some(Self::MccaopReservationConflict),
1022            101 => Some(Self::MafLimitExceeded),
1023            102 => Some(Self::MccaTrackLimitExceeded),
1024            103 => Some(Self::DeniedDueToSpectrumManagement),
1025            104 => Some(Self::DeniedVhtNotSupported),
1026            105 => Some(Self::EnablementDenied),
1027            106 => Some(Self::RestrictionFromAuthorizedGdb),
1028            107 => Some(Self::AuthorizationDeenabled),
1029            108 => Some(Self::EnergyLimitedOperationNotSupported),
1030            109 => Some(Self::RejectedNdpBlockAckSuggested),
1031            110 => Some(Self::RejectedMaxAwayDurationUnacceptable),
1032            111 => Some(Self::FlowControlOperationSupported),
1033            112 => Some(Self::FilsAuthenticationFailure),
1034            113 => Some(Self::UnknownAuthenticationServer),
1035            116 => Some(Self::DeniedNotificationPeriodAllocation),
1036            117 => Some(Self::DeniedChannelSplitting),
1037            118 => Some(Self::DeniedAllocation),
1038            119 => Some(Self::CmmgFeaturesNotSupported),
1039            120 => Some(Self::GasFragmentNotAvailable),
1040            121 => Some(Self::SuccessCagVersionsMatch),
1041            122 => Some(Self::GlkNotAuthorized),
1042            123 => Some(Self::UnknownPasswordIdentifier),
1043            125 => Some(Self::DeniedLocalMacAddressPolicyViolation),
1044            126 => Some(Self::SaeHashToElement),
1045            128 => Some(Self::TclasProcessingTerminatedInsufficientQos),
1046            129 => Some(Self::TclasProcessingTerminatedPolicyConflict),
1047            256 => Some(Self::JoinFailure),
1048            257 => Some(Self::SpuriousDeauthOrDisassoc),
1049            258 => Some(Self::Canceled),
1050            259 => Some(Self::EstablishRsnaFailure),
1051            260 => Some(Self::OweHandshakeFailure),
1052            _ => None,
1053        }
1054    }
1055
1056    #[inline]
1057    pub fn from_primitive_allow_unknown(prim: u16) -> Self {
1058        match prim {
1059            0 => Self::Success,
1060            1 => Self::RefusedReasonUnspecified,
1061            2 => Self::TdlsRejectedAlternativeProvided,
1062            3 => Self::TdlsRejected,
1063            5 => Self::SecurityDisabled,
1064            6 => Self::UnacceptableLifetime,
1065            7 => Self::NotInSameBss,
1066            10 => Self::RefusedCapabilitiesMismatch,
1067            11 => Self::DeniedNoAssociationExists,
1068            12 => Self::DeniedOtherReason,
1069            13 => Self::UnsupportedAuthAlgorithm,
1070            14 => Self::TransactionSequenceError,
1071            15 => Self::ChallengeFailure,
1072            16 => Self::RejectedSequenceTimeout,
1073            17 => Self::DeniedNoMoreStas,
1074            18 => Self::RefusedBasicRatesMismatch,
1075            19 => Self::DeniedNoShortPreambleSupport,
1076            22 => Self::RejectedSpectrumManagementRequired,
1077            23 => Self::RejectedBadPowerCapability,
1078            24 => Self::RejectedBadSupportedChannels,
1079            25 => Self::DeniedNoShortSlotTimeSupport,
1080            27 => Self::DeniedNoHtSupport,
1081            28 => Self::R0KhUnreachable,
1082            29 => Self::DeniedPcoTimeNotSupported,
1083            30 => Self::RefusedTemporarily,
1084            31 => Self::RobustManagementPolicyViolation,
1085            32 => Self::UnspecifiedQosFailure,
1086            33 => Self::DeniedInsufficientBandwidth,
1087            34 => Self::DeniedPoorChannelConditions,
1088            35 => Self::DeniedQosNotSupported,
1089            37 => Self::RequestDeclined,
1090            38 => Self::InvalidParameters,
1091            39 => Self::RejectedWithSuggestedChanges,
1092            40 => Self::StatusInvalidElement,
1093            41 => Self::StatusInvalidGroupCipher,
1094            42 => Self::StatusInvalidPairwiseCipher,
1095            43 => Self::StatusInvalidAkmp,
1096            44 => Self::UnsupportedRsneVersion,
1097            45 => Self::InvalidRsneCapabilities,
1098            46 => Self::StatusCipherOutOfPolicy,
1099            47 => Self::RejectedForDelayPeriod,
1100            48 => Self::DlsNotAllowed,
1101            49 => Self::NotPresent,
1102            50 => Self::NotQosSta,
1103            51 => Self::DeniedListenIntervalTooLarge,
1104            52 => Self::StatusInvalidFtActionFrameCount,
1105            53 => Self::StatusInvalidPmkid,
1106            54 => Self::StatusInvalidMde,
1107            55 => Self::StatusInvalidFte,
1108            56 => Self::RequestedTclasNotSupportedByAp,
1109            57 => Self::InsufficientTclasProcessingResources,
1110            58 => Self::TryAnotherBss,
1111            59 => Self::GasAdvertisementProtocolNotSupported,
1112            60 => Self::NoOutstandingGasRequest,
1113            61 => Self::GasResponseNotReceivedFromServer,
1114            62 => Self::GasQueryTimeout,
1115            63 => Self::GasQueryResponseTooLarge,
1116            64 => Self::RejectedHomeWithSuggestedChanges,
1117            65 => Self::ServerUnreachable,
1118            67 => Self::RejectedForSspPermissions,
1119            68 => Self::RefusedUnauthenticatedAccessNotSupported,
1120            72 => Self::InvalidRsne,
1121            73 => Self::UApsdCoexistanceNotSupported,
1122            74 => Self::UApsdCoexModeNotSupported,
1123            75 => Self::BadIntervalWithUApsdCoex,
1124            76 => Self::AntiCloggingTokenRequired,
1125            77 => Self::UnsupportedFiniteCyclicGroup,
1126            78 => Self::CannotFindAlternativeTbtt,
1127            79 => Self::TransmissionFailure,
1128            80 => Self::RequestedTclasNotSupported,
1129            81 => Self::TclasResourcesExhausted,
1130            82 => Self::RejectedWithSuggestedBssTransition,
1131            83 => Self::RejectWithSchedule,
1132            84 => Self::RejectNoWakeupSpecified,
1133            85 => Self::SuccessPowerSaveMode,
1134            86 => Self::PendingAdmittingFstSession,
1135            87 => Self::PerformingFstNow,
1136            88 => Self::PendingGapInBaWindow,
1137            89 => Self::RejectUPidSetting,
1138            92 => Self::RefusedExternalReason,
1139            93 => Self::RefusedApOutOfMemory,
1140            94 => Self::RejectedEmergencyServicesNotSupported,
1141            95 => Self::QueryResponseOutstanding,
1142            96 => Self::RejectDseBand,
1143            97 => Self::TclasProcessingTerminated,
1144            98 => Self::TsScheduleConflict,
1145            99 => Self::DeniedWithSuggestedBandAndChannel,
1146            100 => Self::MccaopReservationConflict,
1147            101 => Self::MafLimitExceeded,
1148            102 => Self::MccaTrackLimitExceeded,
1149            103 => Self::DeniedDueToSpectrumManagement,
1150            104 => Self::DeniedVhtNotSupported,
1151            105 => Self::EnablementDenied,
1152            106 => Self::RestrictionFromAuthorizedGdb,
1153            107 => Self::AuthorizationDeenabled,
1154            108 => Self::EnergyLimitedOperationNotSupported,
1155            109 => Self::RejectedNdpBlockAckSuggested,
1156            110 => Self::RejectedMaxAwayDurationUnacceptable,
1157            111 => Self::FlowControlOperationSupported,
1158            112 => Self::FilsAuthenticationFailure,
1159            113 => Self::UnknownAuthenticationServer,
1160            116 => Self::DeniedNotificationPeriodAllocation,
1161            117 => Self::DeniedChannelSplitting,
1162            118 => Self::DeniedAllocation,
1163            119 => Self::CmmgFeaturesNotSupported,
1164            120 => Self::GasFragmentNotAvailable,
1165            121 => Self::SuccessCagVersionsMatch,
1166            122 => Self::GlkNotAuthorized,
1167            123 => Self::UnknownPasswordIdentifier,
1168            125 => Self::DeniedLocalMacAddressPolicyViolation,
1169            126 => Self::SaeHashToElement,
1170            128 => Self::TclasProcessingTerminatedInsufficientQos,
1171            129 => Self::TclasProcessingTerminatedPolicyConflict,
1172            256 => Self::JoinFailure,
1173            257 => Self::SpuriousDeauthOrDisassoc,
1174            258 => Self::Canceled,
1175            259 => Self::EstablishRsnaFailure,
1176            260 => Self::OweHandshakeFailure,
1177            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1178        }
1179    }
1180
1181    #[inline]
1182    pub fn unknown() -> Self {
1183        Self::__SourceBreaking { unknown_ordinal: 0xffff }
1184    }
1185
1186    #[inline]
1187    pub const fn into_primitive(self) -> u16 {
1188        match self {
1189            Self::Success => 0,
1190            Self::RefusedReasonUnspecified => 1,
1191            Self::TdlsRejectedAlternativeProvided => 2,
1192            Self::TdlsRejected => 3,
1193            Self::SecurityDisabled => 5,
1194            Self::UnacceptableLifetime => 6,
1195            Self::NotInSameBss => 7,
1196            Self::RefusedCapabilitiesMismatch => 10,
1197            Self::DeniedNoAssociationExists => 11,
1198            Self::DeniedOtherReason => 12,
1199            Self::UnsupportedAuthAlgorithm => 13,
1200            Self::TransactionSequenceError => 14,
1201            Self::ChallengeFailure => 15,
1202            Self::RejectedSequenceTimeout => 16,
1203            Self::DeniedNoMoreStas => 17,
1204            Self::RefusedBasicRatesMismatch => 18,
1205            Self::DeniedNoShortPreambleSupport => 19,
1206            Self::RejectedSpectrumManagementRequired => 22,
1207            Self::RejectedBadPowerCapability => 23,
1208            Self::RejectedBadSupportedChannels => 24,
1209            Self::DeniedNoShortSlotTimeSupport => 25,
1210            Self::DeniedNoHtSupport => 27,
1211            Self::R0KhUnreachable => 28,
1212            Self::DeniedPcoTimeNotSupported => 29,
1213            Self::RefusedTemporarily => 30,
1214            Self::RobustManagementPolicyViolation => 31,
1215            Self::UnspecifiedQosFailure => 32,
1216            Self::DeniedInsufficientBandwidth => 33,
1217            Self::DeniedPoorChannelConditions => 34,
1218            Self::DeniedQosNotSupported => 35,
1219            Self::RequestDeclined => 37,
1220            Self::InvalidParameters => 38,
1221            Self::RejectedWithSuggestedChanges => 39,
1222            Self::StatusInvalidElement => 40,
1223            Self::StatusInvalidGroupCipher => 41,
1224            Self::StatusInvalidPairwiseCipher => 42,
1225            Self::StatusInvalidAkmp => 43,
1226            Self::UnsupportedRsneVersion => 44,
1227            Self::InvalidRsneCapabilities => 45,
1228            Self::StatusCipherOutOfPolicy => 46,
1229            Self::RejectedForDelayPeriod => 47,
1230            Self::DlsNotAllowed => 48,
1231            Self::NotPresent => 49,
1232            Self::NotQosSta => 50,
1233            Self::DeniedListenIntervalTooLarge => 51,
1234            Self::StatusInvalidFtActionFrameCount => 52,
1235            Self::StatusInvalidPmkid => 53,
1236            Self::StatusInvalidMde => 54,
1237            Self::StatusInvalidFte => 55,
1238            Self::RequestedTclasNotSupportedByAp => 56,
1239            Self::InsufficientTclasProcessingResources => 57,
1240            Self::TryAnotherBss => 58,
1241            Self::GasAdvertisementProtocolNotSupported => 59,
1242            Self::NoOutstandingGasRequest => 60,
1243            Self::GasResponseNotReceivedFromServer => 61,
1244            Self::GasQueryTimeout => 62,
1245            Self::GasQueryResponseTooLarge => 63,
1246            Self::RejectedHomeWithSuggestedChanges => 64,
1247            Self::ServerUnreachable => 65,
1248            Self::RejectedForSspPermissions => 67,
1249            Self::RefusedUnauthenticatedAccessNotSupported => 68,
1250            Self::InvalidRsne => 72,
1251            Self::UApsdCoexistanceNotSupported => 73,
1252            Self::UApsdCoexModeNotSupported => 74,
1253            Self::BadIntervalWithUApsdCoex => 75,
1254            Self::AntiCloggingTokenRequired => 76,
1255            Self::UnsupportedFiniteCyclicGroup => 77,
1256            Self::CannotFindAlternativeTbtt => 78,
1257            Self::TransmissionFailure => 79,
1258            Self::RequestedTclasNotSupported => 80,
1259            Self::TclasResourcesExhausted => 81,
1260            Self::RejectedWithSuggestedBssTransition => 82,
1261            Self::RejectWithSchedule => 83,
1262            Self::RejectNoWakeupSpecified => 84,
1263            Self::SuccessPowerSaveMode => 85,
1264            Self::PendingAdmittingFstSession => 86,
1265            Self::PerformingFstNow => 87,
1266            Self::PendingGapInBaWindow => 88,
1267            Self::RejectUPidSetting => 89,
1268            Self::RefusedExternalReason => 92,
1269            Self::RefusedApOutOfMemory => 93,
1270            Self::RejectedEmergencyServicesNotSupported => 94,
1271            Self::QueryResponseOutstanding => 95,
1272            Self::RejectDseBand => 96,
1273            Self::TclasProcessingTerminated => 97,
1274            Self::TsScheduleConflict => 98,
1275            Self::DeniedWithSuggestedBandAndChannel => 99,
1276            Self::MccaopReservationConflict => 100,
1277            Self::MafLimitExceeded => 101,
1278            Self::MccaTrackLimitExceeded => 102,
1279            Self::DeniedDueToSpectrumManagement => 103,
1280            Self::DeniedVhtNotSupported => 104,
1281            Self::EnablementDenied => 105,
1282            Self::RestrictionFromAuthorizedGdb => 106,
1283            Self::AuthorizationDeenabled => 107,
1284            Self::EnergyLimitedOperationNotSupported => 108,
1285            Self::RejectedNdpBlockAckSuggested => 109,
1286            Self::RejectedMaxAwayDurationUnacceptable => 110,
1287            Self::FlowControlOperationSupported => 111,
1288            Self::FilsAuthenticationFailure => 112,
1289            Self::UnknownAuthenticationServer => 113,
1290            Self::DeniedNotificationPeriodAllocation => 116,
1291            Self::DeniedChannelSplitting => 117,
1292            Self::DeniedAllocation => 118,
1293            Self::CmmgFeaturesNotSupported => 119,
1294            Self::GasFragmentNotAvailable => 120,
1295            Self::SuccessCagVersionsMatch => 121,
1296            Self::GlkNotAuthorized => 122,
1297            Self::UnknownPasswordIdentifier => 123,
1298            Self::DeniedLocalMacAddressPolicyViolation => 125,
1299            Self::SaeHashToElement => 126,
1300            Self::TclasProcessingTerminatedInsufficientQos => 128,
1301            Self::TclasProcessingTerminatedPolicyConflict => 129,
1302            Self::JoinFailure => 256,
1303            Self::SpuriousDeauthOrDisassoc => 257,
1304            Self::Canceled => 258,
1305            Self::EstablishRsnaFailure => 259,
1306            Self::OweHandshakeFailure => 260,
1307            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1308        }
1309    }
1310
1311    #[inline]
1312    pub fn is_unknown(&self) -> bool {
1313        match self {
1314            Self::__SourceBreaking { unknown_ordinal: _ } => true,
1315            _ => false,
1316        }
1317    }
1318}
1319
1320/// IEEE Std 802.11-2020 9.4.2.173
1321#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1322#[repr(u32)]
1323pub enum WlanAccessCategory {
1324    Background = 1,
1325    BestEffort = 2,
1326    Video = 3,
1327    Voice = 4,
1328}
1329
1330impl WlanAccessCategory {
1331    #[inline]
1332    pub fn from_primitive(prim: u32) -> Option<Self> {
1333        match prim {
1334            1 => Some(Self::Background),
1335            2 => Some(Self::BestEffort),
1336            3 => Some(Self::Video),
1337            4 => Some(Self::Voice),
1338            _ => None,
1339        }
1340    }
1341
1342    #[inline]
1343    pub const fn into_primitive(self) -> u32 {
1344        self as u32
1345    }
1346}
1347
1348/// Identifies a frequency band in metadata of various operations.
1349///
1350/// Examples of this enum in use are labeling scan results or reporting
1351/// a driver capabilities from various frequency bands.
1352///
1353/// NOTE: This enum is similar to the Band ID field defined in
1354/// IEEE Std 802.11-2016 9.4.1.46, but its values are not the same.
1355///
1356/// TODO(https://fxbug.dev/376442944): Create a spec-compliant Band ID type
1357/// and migrate the platform to use it.
1358#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1359pub enum WlanBand {
1360    TwoGhz,
1361    FiveGhz,
1362    #[doc(hidden)]
1363    __SourceBreaking {
1364        unknown_ordinal: u8,
1365    },
1366}
1367
1368/// Pattern that matches an unknown `WlanBand` member.
1369#[macro_export]
1370macro_rules! WlanBandUnknown {
1371    () => {
1372        _
1373    };
1374}
1375
1376impl WlanBand {
1377    #[inline]
1378    pub fn from_primitive(prim: u8) -> Option<Self> {
1379        match prim {
1380            0 => Some(Self::TwoGhz),
1381            1 => Some(Self::FiveGhz),
1382            _ => None,
1383        }
1384    }
1385
1386    #[inline]
1387    pub fn from_primitive_allow_unknown(prim: u8) -> Self {
1388        match prim {
1389            0 => Self::TwoGhz,
1390            1 => Self::FiveGhz,
1391            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1392        }
1393    }
1394
1395    #[inline]
1396    pub fn unknown() -> Self {
1397        Self::__SourceBreaking { unknown_ordinal: 0xff }
1398    }
1399
1400    #[inline]
1401    pub const fn into_primitive(self) -> u8 {
1402        match self {
1403            Self::TwoGhz => 0,
1404            Self::FiveGhz => 1,
1405            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1406        }
1407    }
1408
1409    #[inline]
1410    pub fn is_unknown(&self) -> bool {
1411        match self {
1412            Self::__SourceBreaking { unknown_ordinal: _ } => true,
1413            _ => false,
1414        }
1415    }
1416}
1417
1418#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1419pub enum WlanPhyType {
1420    /// IEEE 802.11-2016 Clause 15:
1421    ///     Direct Sequence Spread Spectrum
1422    /// Supports 1, 2 Mbps.
1423    Dsss,
1424    /// IEEE 802.11-2016 Clause 16:
1425    ///     High Rate DSSS
1426    /// Supports 5.5, 11 Mbps.
1427    /// Also referred to as ERP-CCK
1428    Hr,
1429    /// IEEE 802.11a/g or IEEE 802.11-2016 Clause 17:
1430    ///     Orthogonal Frequency Division Multiplexing
1431    /// Supports 6, 9, 12, 18, 24, 36, 48, and 54 Mbps.
1432    Ofdm,
1433    /// IEEE 802.11g or IEEE 802.11-2016 Clause 18:
1434    ///     Extended Rate PHY
1435    /// Supports 1, 2, 5.5, 11, 12, 24 Mbps + optionally 6, 54 Mbps.
1436    /// Encompasses DSSS/HR/OFDM rates and modulation.
1437    Erp,
1438    /// IEEE 802.11n or IEEE 802.11-2016 Clause 19:
1439    ///     High Throughput PHY
1440    /// Supports rates up to 495 Mbps.
1441    Ht,
1442    /// 802.11ad or IEEE 802.11-2016 Clause 20:
1443    ///     Directional Multi-Gigabit PHY
1444    Dmg,
1445    /// IEEE 802.11ac or IEEE 802.11-2016 Clause 21:
1446    ///     Very High Throughput PHY
1447    /// Supports rates up to 6.9 Gbps.
1448    Vht,
1449    /// IEEE 802.11af or IEEE 802.11-2016 Clause 22:
1450    ///     Television Very High Throughput PHY
1451    /// Supports rates of up to 568.9 Mbps in TV spectrum
1452    Tvht,
1453    /// IEEE 802.11ah or IEEE 802.11-2020 Clause 23:
1454    ///     Sub 1-GHz PHY
1455    S1G,
1456    /// IEEE 802.11aj or IEEE 802.11-2020 Clause 24:
1457    ///     China Directional Multi-Gigabit PHY
1458    Cdmg,
1459    /// IEEE 802.11aj or IEEE 802.11-2020 Clause 25:
1460    ///     China Millimeter-wave Multi-Gigabit PHY
1461    Cmmg,
1462    /// IEEE 802.11ax: High Efficiency PHY
1463    /// Supports rates of up to 9.6 Gbps (whew!)
1464    He,
1465    #[doc(hidden)]
1466    __SourceBreaking { unknown_ordinal: u32 },
1467}
1468
1469/// Pattern that matches an unknown `WlanPhyType` member.
1470#[macro_export]
1471macro_rules! WlanPhyTypeUnknown {
1472    () => {
1473        _
1474    };
1475}
1476
1477impl WlanPhyType {
1478    #[inline]
1479    pub fn from_primitive(prim: u32) -> Option<Self> {
1480        match prim {
1481            1 => Some(Self::Dsss),
1482            2 => Some(Self::Hr),
1483            3 => Some(Self::Ofdm),
1484            4 => Some(Self::Erp),
1485            5 => Some(Self::Ht),
1486            6 => Some(Self::Dmg),
1487            7 => Some(Self::Vht),
1488            8 => Some(Self::Tvht),
1489            9 => Some(Self::S1G),
1490            10 => Some(Self::Cdmg),
1491            11 => Some(Self::Cmmg),
1492            12 => Some(Self::He),
1493            _ => None,
1494        }
1495    }
1496
1497    #[inline]
1498    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
1499        match prim {
1500            1 => Self::Dsss,
1501            2 => Self::Hr,
1502            3 => Self::Ofdm,
1503            4 => Self::Erp,
1504            5 => Self::Ht,
1505            6 => Self::Dmg,
1506            7 => Self::Vht,
1507            8 => Self::Tvht,
1508            9 => Self::S1G,
1509            10 => Self::Cdmg,
1510            11 => Self::Cmmg,
1511            12 => Self::He,
1512            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1513        }
1514    }
1515
1516    #[inline]
1517    pub fn unknown() -> Self {
1518        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
1519    }
1520
1521    #[inline]
1522    pub const fn into_primitive(self) -> u32 {
1523        match self {
1524            Self::Dsss => 1,
1525            Self::Hr => 2,
1526            Self::Ofdm => 3,
1527            Self::Erp => 4,
1528            Self::Ht => 5,
1529            Self::Dmg => 6,
1530            Self::Vht => 7,
1531            Self::Tvht => 8,
1532            Self::S1G => 9,
1533            Self::Cdmg => 10,
1534            Self::Cmmg => 11,
1535            Self::He => 12,
1536            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1537        }
1538    }
1539
1540    #[inline]
1541    pub fn is_unknown(&self) -> bool {
1542        match self {
1543            Self::__SourceBreaking { unknown_ordinal: _ } => true,
1544            _ => false,
1545        }
1546    }
1547}
1548
1549/// Type corresponding to a BSSDescription defined by IEEE Std 802.11-2020 6.3.3.3.2
1550///
1551/// This type only includes explicit fields for information frequently required
1552/// from a BSSDescription. All other fields are left in a raw buffer of IEs as
1553/// received in an advertisement from the AP, e.g., from a Beacon or Probe
1554/// Response frame.
1555///
1556/// The inclusion of a raw buffer of IEs ensures this type always includes all
1557/// the information an AP advertises, no matter the version of Fuchsia the
1558/// advertisement was received in.
1559#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1560pub struct BssDescription {
1561    pub bssid: [u8; 6],
1562    pub bss_type: BssType,
1563    pub beacon_period: u16,
1564    pub capability_info: u16,
1565    /// Buffer of IEs as received in an advertisement. E.g., from a Beacon
1566    /// or Probe Response frame.
1567    pub ies: Vec<u8>,
1568    /// Channel information for this BSS.
1569    pub primary: ChannelNumber,
1570    pub bandwidth: ChannelBandwidth,
1571    pub vht_secondary_80_channel: ChannelNumber,
1572    /// The running average of received signal strength indicator in units of dBm.
1573    pub rssi_dbm: i8,
1574    /// The running average of snr in units of dB.
1575    pub snr_db: i8,
1576}
1577
1578impl fidl::Persistable for BssDescription {}
1579
1580#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1581#[repr(C)]
1582pub struct CSsid {
1583    pub len: u8,
1584    pub data: [u8; 32],
1585}
1586
1587impl fidl::Persistable for CSsid {}
1588
1589/// Channel information consisting of the frequency band and the channel number.
1590#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1591pub struct ChannelNumber {
1592    pub band: WlanBand,
1593    pub number: u8,
1594}
1595
1596impl fidl::Persistable for ChannelNumber {}
1597
1598#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1599#[repr(C)]
1600pub struct HtCapabilities {
1601    pub bytes: [u8; 26],
1602}
1603
1604impl fidl::Persistable for HtCapabilities {}
1605
1606#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1607#[repr(C)]
1608pub struct HtOperation {
1609    pub bytes: [u8; 22],
1610}
1611
1612impl fidl::Persistable for HtOperation {}
1613
1614#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1615#[repr(C)]
1616pub struct VhtCapabilities {
1617    pub bytes: [u8; 12],
1618}
1619
1620impl fidl::Persistable for VhtCapabilities {}
1621
1622#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1623#[repr(C)]
1624pub struct VhtOperation {
1625    pub bytes: [u8; 5],
1626}
1627
1628impl fidl::Persistable for VhtOperation {}
1629
1630/// Channel information derived from the DSSS parameter set, HT operation,
1631/// and VHT operation IEs, as well as the primary channel on which a frame
1632/// is received.
1633///
1634/// IEEE Std 802.11-2016, 9.4.2.4 - DSSS Parameter Set element
1635/// IEEE Std 802.11-2016, 9.4.2.57 - HT Operation element
1636/// IEEE Std 802.11-2016, 9.4.2.159 - VHT Operation element
1637#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1638pub struct WlanChannel {
1639    pub primary: u8,
1640    pub cbw: ChannelBandwidth,
1641    pub secondary80: u8,
1642}
1643
1644impl fidl::Persistable for WlanChannel {}
1645
1646/// IEEE Std 802.11-2020 6.3.19.1.2
1647#[derive(Clone, Debug, Default, PartialEq)]
1648pub struct SetKeyDescriptor {
1649    /// The key value as bytes.
1650    /// 802.11 specifies a bit string for this field, but we represent it as a byte array for
1651    /// convenience.
1652    /// Required.
1653    pub key: Option<Vec<u8>>,
1654    /// Index for rotating keys, e.g. group keys.
1655    /// This value is always 0 for key types which aren't rotating, e.g. pairwise keys.
1656    /// Required.
1657    pub key_id: Option<u16>,
1658    /// Whether this key is a pairwise, group or peer key.
1659    /// Required.
1660    pub key_type: Option<KeyType>,
1661    /// The peer MAC address for pairwise and peer keys.
1662    /// For group keys this value is always the broadcast address.
1663    /// Required.
1664    pub peer_addr: Option<[u8; 6]>,
1665    /// Receive Sequence Counter for group keys only.
1666    /// In all other cases the RSC will be 0.
1667    /// Optional.
1668    pub rsc: Option<u64>,
1669    /// IEEE Cipher suite selector. See IEEE Std 802.11-2016, 9.4.2.25.2, Table 9-131
1670    /// Required.
1671    pub cipher_oui: Option<[u8; 3]>,
1672    /// The cipher type.
1673    /// Required.
1674    pub cipher_type: Option<CipherSuiteType>,
1675    #[doc(hidden)]
1676    pub __source_breaking: fidl::marker::SourceBreaking,
1677}
1678
1679impl fidl::Persistable for SetKeyDescriptor {}
1680
1681mod internal {
1682    use super::*;
1683    unsafe impl fidl::encoding::TypeMarker for BssType {
1684        type Owned = Self;
1685
1686        #[inline(always)]
1687        fn inline_align(_context: fidl::encoding::Context) -> usize {
1688            std::mem::align_of::<u32>()
1689        }
1690
1691        #[inline(always)]
1692        fn inline_size(_context: fidl::encoding::Context) -> usize {
1693            std::mem::size_of::<u32>()
1694        }
1695
1696        #[inline(always)]
1697        fn encode_is_copy() -> bool {
1698            false
1699        }
1700
1701        #[inline(always)]
1702        fn decode_is_copy() -> bool {
1703            false
1704        }
1705    }
1706
1707    impl fidl::encoding::ValueTypeMarker for BssType {
1708        type Borrowed<'a> = Self;
1709        #[inline(always)]
1710        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1711            *value
1712        }
1713    }
1714
1715    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for BssType {
1716        #[inline]
1717        unsafe fn encode(
1718            self,
1719            encoder: &mut fidl::encoding::Encoder<'_, D>,
1720            offset: usize,
1721            _depth: fidl::encoding::Depth,
1722        ) -> fidl::Result<()> {
1723            encoder.debug_check_bounds::<Self>(offset);
1724            encoder.write_num(self.into_primitive(), offset);
1725            Ok(())
1726        }
1727    }
1728
1729    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BssType {
1730        #[inline(always)]
1731        fn new_empty() -> Self {
1732            Self::unknown()
1733        }
1734
1735        #[inline]
1736        unsafe fn decode(
1737            &mut self,
1738            decoder: &mut fidl::encoding::Decoder<'_, D>,
1739            offset: usize,
1740            _depth: fidl::encoding::Depth,
1741        ) -> fidl::Result<()> {
1742            decoder.debug_check_bounds::<Self>(offset);
1743            let prim = decoder.read_num::<u32>(offset);
1744
1745            *self = Self::from_primitive_allow_unknown(prim);
1746            Ok(())
1747        }
1748    }
1749    unsafe impl fidl::encoding::TypeMarker for ChannelBandwidth {
1750        type Owned = Self;
1751
1752        #[inline(always)]
1753        fn inline_align(_context: fidl::encoding::Context) -> usize {
1754            std::mem::align_of::<u32>()
1755        }
1756
1757        #[inline(always)]
1758        fn inline_size(_context: fidl::encoding::Context) -> usize {
1759            std::mem::size_of::<u32>()
1760        }
1761
1762        #[inline(always)]
1763        fn encode_is_copy() -> bool {
1764            false
1765        }
1766
1767        #[inline(always)]
1768        fn decode_is_copy() -> bool {
1769            false
1770        }
1771    }
1772
1773    impl fidl::encoding::ValueTypeMarker for ChannelBandwidth {
1774        type Borrowed<'a> = Self;
1775        #[inline(always)]
1776        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1777            *value
1778        }
1779    }
1780
1781    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1782        for ChannelBandwidth
1783    {
1784        #[inline]
1785        unsafe fn encode(
1786            self,
1787            encoder: &mut fidl::encoding::Encoder<'_, D>,
1788            offset: usize,
1789            _depth: fidl::encoding::Depth,
1790        ) -> fidl::Result<()> {
1791            encoder.debug_check_bounds::<Self>(offset);
1792            encoder.write_num(self.into_primitive(), offset);
1793            Ok(())
1794        }
1795    }
1796
1797    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelBandwidth {
1798        #[inline(always)]
1799        fn new_empty() -> Self {
1800            Self::unknown()
1801        }
1802
1803        #[inline]
1804        unsafe fn decode(
1805            &mut self,
1806            decoder: &mut fidl::encoding::Decoder<'_, D>,
1807            offset: usize,
1808            _depth: fidl::encoding::Depth,
1809        ) -> fidl::Result<()> {
1810            decoder.debug_check_bounds::<Self>(offset);
1811            let prim = decoder.read_num::<u32>(offset);
1812
1813            *self = Self::from_primitive_allow_unknown(prim);
1814            Ok(())
1815        }
1816    }
1817    unsafe impl fidl::encoding::TypeMarker for CipherSuiteType {
1818        type Owned = Self;
1819
1820        #[inline(always)]
1821        fn inline_align(_context: fidl::encoding::Context) -> usize {
1822            std::mem::align_of::<u32>()
1823        }
1824
1825        #[inline(always)]
1826        fn inline_size(_context: fidl::encoding::Context) -> usize {
1827            std::mem::size_of::<u32>()
1828        }
1829
1830        #[inline(always)]
1831        fn encode_is_copy() -> bool {
1832            false
1833        }
1834
1835        #[inline(always)]
1836        fn decode_is_copy() -> bool {
1837            false
1838        }
1839    }
1840
1841    impl fidl::encoding::ValueTypeMarker for CipherSuiteType {
1842        type Borrowed<'a> = Self;
1843        #[inline(always)]
1844        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1845            *value
1846        }
1847    }
1848
1849    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1850        for CipherSuiteType
1851    {
1852        #[inline]
1853        unsafe fn encode(
1854            self,
1855            encoder: &mut fidl::encoding::Encoder<'_, D>,
1856            offset: usize,
1857            _depth: fidl::encoding::Depth,
1858        ) -> fidl::Result<()> {
1859            encoder.debug_check_bounds::<Self>(offset);
1860            encoder.write_num(self.into_primitive(), offset);
1861            Ok(())
1862        }
1863    }
1864
1865    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CipherSuiteType {
1866        #[inline(always)]
1867        fn new_empty() -> Self {
1868            Self::unknown()
1869        }
1870
1871        #[inline]
1872        unsafe fn decode(
1873            &mut self,
1874            decoder: &mut fidl::encoding::Decoder<'_, D>,
1875            offset: usize,
1876            _depth: fidl::encoding::Depth,
1877        ) -> fidl::Result<()> {
1878            decoder.debug_check_bounds::<Self>(offset);
1879            let prim = decoder.read_num::<u32>(offset);
1880
1881            *self = Self::from_primitive_allow_unknown(prim);
1882            Ok(())
1883        }
1884    }
1885    unsafe impl fidl::encoding::TypeMarker for GuardInterval {
1886        type Owned = Self;
1887
1888        #[inline(always)]
1889        fn inline_align(_context: fidl::encoding::Context) -> usize {
1890            std::mem::align_of::<u8>()
1891        }
1892
1893        #[inline(always)]
1894        fn inline_size(_context: fidl::encoding::Context) -> usize {
1895            std::mem::size_of::<u8>()
1896        }
1897
1898        #[inline(always)]
1899        fn encode_is_copy() -> bool {
1900            true
1901        }
1902
1903        #[inline(always)]
1904        fn decode_is_copy() -> bool {
1905            false
1906        }
1907    }
1908
1909    impl fidl::encoding::ValueTypeMarker for GuardInterval {
1910        type Borrowed<'a> = Self;
1911        #[inline(always)]
1912        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1913            *value
1914        }
1915    }
1916
1917    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for GuardInterval {
1918        #[inline]
1919        unsafe fn encode(
1920            self,
1921            encoder: &mut fidl::encoding::Encoder<'_, D>,
1922            offset: usize,
1923            _depth: fidl::encoding::Depth,
1924        ) -> fidl::Result<()> {
1925            encoder.debug_check_bounds::<Self>(offset);
1926            encoder.write_num(self.into_primitive(), offset);
1927            Ok(())
1928        }
1929    }
1930
1931    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GuardInterval {
1932        #[inline(always)]
1933        fn new_empty() -> Self {
1934            Self::LongGi
1935        }
1936
1937        #[inline]
1938        unsafe fn decode(
1939            &mut self,
1940            decoder: &mut fidl::encoding::Decoder<'_, D>,
1941            offset: usize,
1942            _depth: fidl::encoding::Depth,
1943        ) -> fidl::Result<()> {
1944            decoder.debug_check_bounds::<Self>(offset);
1945            let prim = decoder.read_num::<u8>(offset);
1946
1947            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1948            Ok(())
1949        }
1950    }
1951    unsafe impl fidl::encoding::TypeMarker for KeyType {
1952        type Owned = Self;
1953
1954        #[inline(always)]
1955        fn inline_align(_context: fidl::encoding::Context) -> usize {
1956            std::mem::align_of::<u8>()
1957        }
1958
1959        #[inline(always)]
1960        fn inline_size(_context: fidl::encoding::Context) -> usize {
1961            std::mem::size_of::<u8>()
1962        }
1963
1964        #[inline(always)]
1965        fn encode_is_copy() -> bool {
1966            false
1967        }
1968
1969        #[inline(always)]
1970        fn decode_is_copy() -> bool {
1971            false
1972        }
1973    }
1974
1975    impl fidl::encoding::ValueTypeMarker for KeyType {
1976        type Borrowed<'a> = Self;
1977        #[inline(always)]
1978        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1979            *value
1980        }
1981    }
1982
1983    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for KeyType {
1984        #[inline]
1985        unsafe fn encode(
1986            self,
1987            encoder: &mut fidl::encoding::Encoder<'_, D>,
1988            offset: usize,
1989            _depth: fidl::encoding::Depth,
1990        ) -> fidl::Result<()> {
1991            encoder.debug_check_bounds::<Self>(offset);
1992            encoder.write_num(self.into_primitive(), offset);
1993            Ok(())
1994        }
1995    }
1996
1997    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyType {
1998        #[inline(always)]
1999        fn new_empty() -> Self {
2000            Self::unknown()
2001        }
2002
2003        #[inline]
2004        unsafe fn decode(
2005            &mut self,
2006            decoder: &mut fidl::encoding::Decoder<'_, D>,
2007            offset: usize,
2008            _depth: fidl::encoding::Depth,
2009        ) -> fidl::Result<()> {
2010            decoder.debug_check_bounds::<Self>(offset);
2011            let prim = decoder.read_num::<u8>(offset);
2012
2013            *self = Self::from_primitive_allow_unknown(prim);
2014            Ok(())
2015        }
2016    }
2017    unsafe impl fidl::encoding::TypeMarker for ReasonCode {
2018        type Owned = Self;
2019
2020        #[inline(always)]
2021        fn inline_align(_context: fidl::encoding::Context) -> usize {
2022            std::mem::align_of::<u16>()
2023        }
2024
2025        #[inline(always)]
2026        fn inline_size(_context: fidl::encoding::Context) -> usize {
2027            std::mem::size_of::<u16>()
2028        }
2029
2030        #[inline(always)]
2031        fn encode_is_copy() -> bool {
2032            false
2033        }
2034
2035        #[inline(always)]
2036        fn decode_is_copy() -> bool {
2037            false
2038        }
2039    }
2040
2041    impl fidl::encoding::ValueTypeMarker for ReasonCode {
2042        type Borrowed<'a> = Self;
2043        #[inline(always)]
2044        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2045            *value
2046        }
2047    }
2048
2049    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ReasonCode {
2050        #[inline]
2051        unsafe fn encode(
2052            self,
2053            encoder: &mut fidl::encoding::Encoder<'_, D>,
2054            offset: usize,
2055            _depth: fidl::encoding::Depth,
2056        ) -> fidl::Result<()> {
2057            encoder.debug_check_bounds::<Self>(offset);
2058            encoder.write_num(self.into_primitive(), offset);
2059            Ok(())
2060        }
2061    }
2062
2063    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReasonCode {
2064        #[inline(always)]
2065        fn new_empty() -> Self {
2066            Self::unknown()
2067        }
2068
2069        #[inline]
2070        unsafe fn decode(
2071            &mut self,
2072            decoder: &mut fidl::encoding::Decoder<'_, D>,
2073            offset: usize,
2074            _depth: fidl::encoding::Depth,
2075        ) -> fidl::Result<()> {
2076            decoder.debug_check_bounds::<Self>(offset);
2077            let prim = decoder.read_num::<u16>(offset);
2078
2079            *self = Self::from_primitive_allow_unknown(prim);
2080            Ok(())
2081        }
2082    }
2083    unsafe impl fidl::encoding::TypeMarker for StatusCode {
2084        type Owned = Self;
2085
2086        #[inline(always)]
2087        fn inline_align(_context: fidl::encoding::Context) -> usize {
2088            std::mem::align_of::<u16>()
2089        }
2090
2091        #[inline(always)]
2092        fn inline_size(_context: fidl::encoding::Context) -> usize {
2093            std::mem::size_of::<u16>()
2094        }
2095
2096        #[inline(always)]
2097        fn encode_is_copy() -> bool {
2098            false
2099        }
2100
2101        #[inline(always)]
2102        fn decode_is_copy() -> bool {
2103            false
2104        }
2105    }
2106
2107    impl fidl::encoding::ValueTypeMarker for StatusCode {
2108        type Borrowed<'a> = Self;
2109        #[inline(always)]
2110        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2111            *value
2112        }
2113    }
2114
2115    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for StatusCode {
2116        #[inline]
2117        unsafe fn encode(
2118            self,
2119            encoder: &mut fidl::encoding::Encoder<'_, D>,
2120            offset: usize,
2121            _depth: fidl::encoding::Depth,
2122        ) -> fidl::Result<()> {
2123            encoder.debug_check_bounds::<Self>(offset);
2124            encoder.write_num(self.into_primitive(), offset);
2125            Ok(())
2126        }
2127    }
2128
2129    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StatusCode {
2130        #[inline(always)]
2131        fn new_empty() -> Self {
2132            Self::unknown()
2133        }
2134
2135        #[inline]
2136        unsafe fn decode(
2137            &mut self,
2138            decoder: &mut fidl::encoding::Decoder<'_, D>,
2139            offset: usize,
2140            _depth: fidl::encoding::Depth,
2141        ) -> fidl::Result<()> {
2142            decoder.debug_check_bounds::<Self>(offset);
2143            let prim = decoder.read_num::<u16>(offset);
2144
2145            *self = Self::from_primitive_allow_unknown(prim);
2146            Ok(())
2147        }
2148    }
2149    unsafe impl fidl::encoding::TypeMarker for WlanAccessCategory {
2150        type Owned = Self;
2151
2152        #[inline(always)]
2153        fn inline_align(_context: fidl::encoding::Context) -> usize {
2154            std::mem::align_of::<u32>()
2155        }
2156
2157        #[inline(always)]
2158        fn inline_size(_context: fidl::encoding::Context) -> usize {
2159            std::mem::size_of::<u32>()
2160        }
2161
2162        #[inline(always)]
2163        fn encode_is_copy() -> bool {
2164            true
2165        }
2166
2167        #[inline(always)]
2168        fn decode_is_copy() -> bool {
2169            false
2170        }
2171    }
2172
2173    impl fidl::encoding::ValueTypeMarker for WlanAccessCategory {
2174        type Borrowed<'a> = Self;
2175        #[inline(always)]
2176        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2177            *value
2178        }
2179    }
2180
2181    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2182        for WlanAccessCategory
2183    {
2184        #[inline]
2185        unsafe fn encode(
2186            self,
2187            encoder: &mut fidl::encoding::Encoder<'_, D>,
2188            offset: usize,
2189            _depth: fidl::encoding::Depth,
2190        ) -> fidl::Result<()> {
2191            encoder.debug_check_bounds::<Self>(offset);
2192            encoder.write_num(self.into_primitive(), offset);
2193            Ok(())
2194        }
2195    }
2196
2197    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanAccessCategory {
2198        #[inline(always)]
2199        fn new_empty() -> Self {
2200            Self::Background
2201        }
2202
2203        #[inline]
2204        unsafe fn decode(
2205            &mut self,
2206            decoder: &mut fidl::encoding::Decoder<'_, D>,
2207            offset: usize,
2208            _depth: fidl::encoding::Depth,
2209        ) -> fidl::Result<()> {
2210            decoder.debug_check_bounds::<Self>(offset);
2211            let prim = decoder.read_num::<u32>(offset);
2212
2213            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
2214            Ok(())
2215        }
2216    }
2217    unsafe impl fidl::encoding::TypeMarker for WlanBand {
2218        type Owned = Self;
2219
2220        #[inline(always)]
2221        fn inline_align(_context: fidl::encoding::Context) -> usize {
2222            std::mem::align_of::<u8>()
2223        }
2224
2225        #[inline(always)]
2226        fn inline_size(_context: fidl::encoding::Context) -> usize {
2227            std::mem::size_of::<u8>()
2228        }
2229
2230        #[inline(always)]
2231        fn encode_is_copy() -> bool {
2232            false
2233        }
2234
2235        #[inline(always)]
2236        fn decode_is_copy() -> bool {
2237            false
2238        }
2239    }
2240
2241    impl fidl::encoding::ValueTypeMarker for WlanBand {
2242        type Borrowed<'a> = Self;
2243        #[inline(always)]
2244        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2245            *value
2246        }
2247    }
2248
2249    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for WlanBand {
2250        #[inline]
2251        unsafe fn encode(
2252            self,
2253            encoder: &mut fidl::encoding::Encoder<'_, D>,
2254            offset: usize,
2255            _depth: fidl::encoding::Depth,
2256        ) -> fidl::Result<()> {
2257            encoder.debug_check_bounds::<Self>(offset);
2258            encoder.write_num(self.into_primitive(), offset);
2259            Ok(())
2260        }
2261    }
2262
2263    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanBand {
2264        #[inline(always)]
2265        fn new_empty() -> Self {
2266            Self::unknown()
2267        }
2268
2269        #[inline]
2270        unsafe fn decode(
2271            &mut self,
2272            decoder: &mut fidl::encoding::Decoder<'_, D>,
2273            offset: usize,
2274            _depth: fidl::encoding::Depth,
2275        ) -> fidl::Result<()> {
2276            decoder.debug_check_bounds::<Self>(offset);
2277            let prim = decoder.read_num::<u8>(offset);
2278
2279            *self = Self::from_primitive_allow_unknown(prim);
2280            Ok(())
2281        }
2282    }
2283    unsafe impl fidl::encoding::TypeMarker for WlanPhyType {
2284        type Owned = Self;
2285
2286        #[inline(always)]
2287        fn inline_align(_context: fidl::encoding::Context) -> usize {
2288            std::mem::align_of::<u32>()
2289        }
2290
2291        #[inline(always)]
2292        fn inline_size(_context: fidl::encoding::Context) -> usize {
2293            std::mem::size_of::<u32>()
2294        }
2295
2296        #[inline(always)]
2297        fn encode_is_copy() -> bool {
2298            false
2299        }
2300
2301        #[inline(always)]
2302        fn decode_is_copy() -> bool {
2303            false
2304        }
2305    }
2306
2307    impl fidl::encoding::ValueTypeMarker for WlanPhyType {
2308        type Borrowed<'a> = Self;
2309        #[inline(always)]
2310        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2311            *value
2312        }
2313    }
2314
2315    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for WlanPhyType {
2316        #[inline]
2317        unsafe fn encode(
2318            self,
2319            encoder: &mut fidl::encoding::Encoder<'_, D>,
2320            offset: usize,
2321            _depth: fidl::encoding::Depth,
2322        ) -> fidl::Result<()> {
2323            encoder.debug_check_bounds::<Self>(offset);
2324            encoder.write_num(self.into_primitive(), offset);
2325            Ok(())
2326        }
2327    }
2328
2329    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanPhyType {
2330        #[inline(always)]
2331        fn new_empty() -> Self {
2332            Self::unknown()
2333        }
2334
2335        #[inline]
2336        unsafe fn decode(
2337            &mut self,
2338            decoder: &mut fidl::encoding::Decoder<'_, D>,
2339            offset: usize,
2340            _depth: fidl::encoding::Depth,
2341        ) -> fidl::Result<()> {
2342            decoder.debug_check_bounds::<Self>(offset);
2343            let prim = decoder.read_num::<u32>(offset);
2344
2345            *self = Self::from_primitive_allow_unknown(prim);
2346            Ok(())
2347        }
2348    }
2349
2350    impl fidl::encoding::ValueTypeMarker for BssDescription {
2351        type Borrowed<'a> = &'a Self;
2352        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2353            value
2354        }
2355    }
2356
2357    unsafe impl fidl::encoding::TypeMarker for BssDescription {
2358        type Owned = Self;
2359
2360        #[inline(always)]
2361        fn inline_align(_context: fidl::encoding::Context) -> usize {
2362            8
2363        }
2364
2365        #[inline(always)]
2366        fn inline_size(_context: fidl::encoding::Context) -> usize {
2367            48
2368        }
2369    }
2370
2371    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BssDescription, D>
2372        for &BssDescription
2373    {
2374        #[inline]
2375        unsafe fn encode(
2376            self,
2377            encoder: &mut fidl::encoding::Encoder<'_, D>,
2378            offset: usize,
2379            _depth: fidl::encoding::Depth,
2380        ) -> fidl::Result<()> {
2381            encoder.debug_check_bounds::<BssDescription>(offset);
2382            // Delegate to tuple encoding.
2383            fidl::encoding::Encode::<BssDescription, D>::encode(
2384                (
2385                    <fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow(&self.bssid),
2386                    <BssType as fidl::encoding::ValueTypeMarker>::borrow(&self.bss_type),
2387                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.beacon_period),
2388                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.capability_info),
2389                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.ies),
2390                    <ChannelNumber as fidl::encoding::ValueTypeMarker>::borrow(&self.primary),
2391                    <ChannelBandwidth as fidl::encoding::ValueTypeMarker>::borrow(&self.bandwidth),
2392                    <ChannelNumber as fidl::encoding::ValueTypeMarker>::borrow(&self.vht_secondary_80_channel),
2393                    <i8 as fidl::encoding::ValueTypeMarker>::borrow(&self.rssi_dbm),
2394                    <i8 as fidl::encoding::ValueTypeMarker>::borrow(&self.snr_db),
2395                ),
2396                encoder, offset, _depth
2397            )
2398        }
2399    }
2400    unsafe impl<
2401        D: fidl::encoding::ResourceDialect,
2402        T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 6>, D>,
2403        T1: fidl::encoding::Encode<BssType, D>,
2404        T2: fidl::encoding::Encode<u16, D>,
2405        T3: fidl::encoding::Encode<u16, D>,
2406        T4: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
2407        T5: fidl::encoding::Encode<ChannelNumber, D>,
2408        T6: fidl::encoding::Encode<ChannelBandwidth, D>,
2409        T7: fidl::encoding::Encode<ChannelNumber, D>,
2410        T8: fidl::encoding::Encode<i8, D>,
2411        T9: fidl::encoding::Encode<i8, D>,
2412    > fidl::encoding::Encode<BssDescription, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
2413    {
2414        #[inline]
2415        unsafe fn encode(
2416            self,
2417            encoder: &mut fidl::encoding::Encoder<'_, D>,
2418            offset: usize,
2419            depth: fidl::encoding::Depth,
2420        ) -> fidl::Result<()> {
2421            encoder.debug_check_bounds::<BssDescription>(offset);
2422            // Zero out padding regions. There's no need to apply masks
2423            // because the unmasked parts will be overwritten by fields.
2424            unsafe {
2425                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2426                (ptr as *mut u64).write_unaligned(0);
2427            }
2428            unsafe {
2429                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
2430                (ptr as *mut u64).write_unaligned(0);
2431            }
2432            unsafe {
2433                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
2434                (ptr as *mut u64).write_unaligned(0);
2435            }
2436            // Write the fields.
2437            self.0.encode(encoder, offset + 0, depth)?;
2438            self.1.encode(encoder, offset + 8, depth)?;
2439            self.2.encode(encoder, offset + 12, depth)?;
2440            self.3.encode(encoder, offset + 14, depth)?;
2441            self.4.encode(encoder, offset + 16, depth)?;
2442            self.5.encode(encoder, offset + 32, depth)?;
2443            self.6.encode(encoder, offset + 36, depth)?;
2444            self.7.encode(encoder, offset + 40, depth)?;
2445            self.8.encode(encoder, offset + 42, depth)?;
2446            self.9.encode(encoder, offset + 43, depth)?;
2447            Ok(())
2448        }
2449    }
2450
2451    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BssDescription {
2452        #[inline(always)]
2453        fn new_empty() -> Self {
2454            Self {
2455                bssid: fidl::new_empty!(fidl::encoding::Array<u8, 6>, D),
2456                bss_type: fidl::new_empty!(BssType, D),
2457                beacon_period: fidl::new_empty!(u16, D),
2458                capability_info: fidl::new_empty!(u16, D),
2459                ies: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
2460                primary: fidl::new_empty!(ChannelNumber, D),
2461                bandwidth: fidl::new_empty!(ChannelBandwidth, D),
2462                vht_secondary_80_channel: fidl::new_empty!(ChannelNumber, D),
2463                rssi_dbm: fidl::new_empty!(i8, D),
2464                snr_db: fidl::new_empty!(i8, D),
2465            }
2466        }
2467
2468        #[inline]
2469        unsafe fn decode(
2470            &mut self,
2471            decoder: &mut fidl::encoding::Decoder<'_, D>,
2472            offset: usize,
2473            _depth: fidl::encoding::Depth,
2474        ) -> fidl::Result<()> {
2475            decoder.debug_check_bounds::<Self>(offset);
2476            // Verify that padding bytes are zero.
2477            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2478            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2479            let mask = 0xffff000000000000u64;
2480            let maskedval = padval & mask;
2481            if maskedval != 0 {
2482                return Err(fidl::Error::NonZeroPadding {
2483                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2484                });
2485            }
2486            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
2487            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2488            let mask = 0xffff0000u64;
2489            let maskedval = padval & mask;
2490            if maskedval != 0 {
2491                return Err(fidl::Error::NonZeroPadding {
2492                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
2493                });
2494            }
2495            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
2496            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2497            let mask = 0xffffffff00000000u64;
2498            let maskedval = padval & mask;
2499            if maskedval != 0 {
2500                return Err(fidl::Error::NonZeroPadding {
2501                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
2502                });
2503            }
2504            fidl::decode!(fidl::encoding::Array<u8, 6>, D, &mut self.bssid, decoder, offset + 0, _depth)?;
2505            fidl::decode!(BssType, D, &mut self.bss_type, decoder, offset + 8, _depth)?;
2506            fidl::decode!(u16, D, &mut self.beacon_period, decoder, offset + 12, _depth)?;
2507            fidl::decode!(u16, D, &mut self.capability_info, decoder, offset + 14, _depth)?;
2508            fidl::decode!(
2509                fidl::encoding::UnboundedVector<u8>,
2510                D,
2511                &mut self.ies,
2512                decoder,
2513                offset + 16,
2514                _depth
2515            )?;
2516            fidl::decode!(ChannelNumber, D, &mut self.primary, decoder, offset + 32, _depth)?;
2517            fidl::decode!(ChannelBandwidth, D, &mut self.bandwidth, decoder, offset + 36, _depth)?;
2518            fidl::decode!(
2519                ChannelNumber,
2520                D,
2521                &mut self.vht_secondary_80_channel,
2522                decoder,
2523                offset + 40,
2524                _depth
2525            )?;
2526            fidl::decode!(i8, D, &mut self.rssi_dbm, decoder, offset + 42, _depth)?;
2527            fidl::decode!(i8, D, &mut self.snr_db, decoder, offset + 43, _depth)?;
2528            Ok(())
2529        }
2530    }
2531
2532    impl fidl::encoding::ValueTypeMarker for CSsid {
2533        type Borrowed<'a> = &'a Self;
2534        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2535            value
2536        }
2537    }
2538
2539    unsafe impl fidl::encoding::TypeMarker for CSsid {
2540        type Owned = Self;
2541
2542        #[inline(always)]
2543        fn inline_align(_context: fidl::encoding::Context) -> usize {
2544            1
2545        }
2546
2547        #[inline(always)]
2548        fn inline_size(_context: fidl::encoding::Context) -> usize {
2549            33
2550        }
2551        #[inline(always)]
2552        fn encode_is_copy() -> bool {
2553            true
2554        }
2555
2556        #[inline(always)]
2557        fn decode_is_copy() -> bool {
2558            true
2559        }
2560    }
2561
2562    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CSsid, D> for &CSsid {
2563        #[inline]
2564        unsafe fn encode(
2565            self,
2566            encoder: &mut fidl::encoding::Encoder<'_, D>,
2567            offset: usize,
2568            _depth: fidl::encoding::Depth,
2569        ) -> fidl::Result<()> {
2570            encoder.debug_check_bounds::<CSsid>(offset);
2571            unsafe {
2572                // Copy the object into the buffer.
2573                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2574                (buf_ptr as *mut CSsid).write_unaligned((self as *const CSsid).read());
2575                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2576                // done second because the memcpy will write garbage to these bytes.
2577            }
2578            Ok(())
2579        }
2580    }
2581    unsafe impl<
2582        D: fidl::encoding::ResourceDialect,
2583        T0: fidl::encoding::Encode<u8, D>,
2584        T1: fidl::encoding::Encode<fidl::encoding::Array<u8, 32>, D>,
2585    > fidl::encoding::Encode<CSsid, D> for (T0, T1)
2586    {
2587        #[inline]
2588        unsafe fn encode(
2589            self,
2590            encoder: &mut fidl::encoding::Encoder<'_, D>,
2591            offset: usize,
2592            depth: fidl::encoding::Depth,
2593        ) -> fidl::Result<()> {
2594            encoder.debug_check_bounds::<CSsid>(offset);
2595            // Zero out padding regions. There's no need to apply masks
2596            // because the unmasked parts will be overwritten by fields.
2597            // Write the fields.
2598            self.0.encode(encoder, offset + 0, depth)?;
2599            self.1.encode(encoder, offset + 1, depth)?;
2600            Ok(())
2601        }
2602    }
2603
2604    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CSsid {
2605        #[inline(always)]
2606        fn new_empty() -> Self {
2607            Self {
2608                len: fidl::new_empty!(u8, D),
2609                data: fidl::new_empty!(fidl::encoding::Array<u8, 32>, D),
2610            }
2611        }
2612
2613        #[inline]
2614        unsafe fn decode(
2615            &mut self,
2616            decoder: &mut fidl::encoding::Decoder<'_, D>,
2617            offset: usize,
2618            _depth: fidl::encoding::Depth,
2619        ) -> fidl::Result<()> {
2620            decoder.debug_check_bounds::<Self>(offset);
2621            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2622            // Verify that padding bytes are zero.
2623            // Copy from the buffer into the object.
2624            unsafe {
2625                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 33);
2626            }
2627            Ok(())
2628        }
2629    }
2630
2631    impl fidl::encoding::ValueTypeMarker for ChannelNumber {
2632        type Borrowed<'a> = &'a Self;
2633        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2634            value
2635        }
2636    }
2637
2638    unsafe impl fidl::encoding::TypeMarker for ChannelNumber {
2639        type Owned = Self;
2640
2641        #[inline(always)]
2642        fn inline_align(_context: fidl::encoding::Context) -> usize {
2643            1
2644        }
2645
2646        #[inline(always)]
2647        fn inline_size(_context: fidl::encoding::Context) -> usize {
2648            2
2649        }
2650    }
2651
2652    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChannelNumber, D>
2653        for &ChannelNumber
2654    {
2655        #[inline]
2656        unsafe fn encode(
2657            self,
2658            encoder: &mut fidl::encoding::Encoder<'_, D>,
2659            offset: usize,
2660            _depth: fidl::encoding::Depth,
2661        ) -> fidl::Result<()> {
2662            encoder.debug_check_bounds::<ChannelNumber>(offset);
2663            // Delegate to tuple encoding.
2664            fidl::encoding::Encode::<ChannelNumber, D>::encode(
2665                (
2666                    <WlanBand as fidl::encoding::ValueTypeMarker>::borrow(&self.band),
2667                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.number),
2668                ),
2669                encoder,
2670                offset,
2671                _depth,
2672            )
2673        }
2674    }
2675    unsafe impl<
2676        D: fidl::encoding::ResourceDialect,
2677        T0: fidl::encoding::Encode<WlanBand, D>,
2678        T1: fidl::encoding::Encode<u8, D>,
2679    > fidl::encoding::Encode<ChannelNumber, D> for (T0, T1)
2680    {
2681        #[inline]
2682        unsafe fn encode(
2683            self,
2684            encoder: &mut fidl::encoding::Encoder<'_, D>,
2685            offset: usize,
2686            depth: fidl::encoding::Depth,
2687        ) -> fidl::Result<()> {
2688            encoder.debug_check_bounds::<ChannelNumber>(offset);
2689            // Zero out padding regions. There's no need to apply masks
2690            // because the unmasked parts will be overwritten by fields.
2691            // Write the fields.
2692            self.0.encode(encoder, offset + 0, depth)?;
2693            self.1.encode(encoder, offset + 1, depth)?;
2694            Ok(())
2695        }
2696    }
2697
2698    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelNumber {
2699        #[inline(always)]
2700        fn new_empty() -> Self {
2701            Self { band: fidl::new_empty!(WlanBand, D), number: fidl::new_empty!(u8, D) }
2702        }
2703
2704        #[inline]
2705        unsafe fn decode(
2706            &mut self,
2707            decoder: &mut fidl::encoding::Decoder<'_, D>,
2708            offset: usize,
2709            _depth: fidl::encoding::Depth,
2710        ) -> fidl::Result<()> {
2711            decoder.debug_check_bounds::<Self>(offset);
2712            // Verify that padding bytes are zero.
2713            fidl::decode!(WlanBand, D, &mut self.band, decoder, offset + 0, _depth)?;
2714            fidl::decode!(u8, D, &mut self.number, decoder, offset + 1, _depth)?;
2715            Ok(())
2716        }
2717    }
2718
2719    impl fidl::encoding::ValueTypeMarker for HtCapabilities {
2720        type Borrowed<'a> = &'a Self;
2721        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2722            value
2723        }
2724    }
2725
2726    unsafe impl fidl::encoding::TypeMarker for HtCapabilities {
2727        type Owned = Self;
2728
2729        #[inline(always)]
2730        fn inline_align(_context: fidl::encoding::Context) -> usize {
2731            1
2732        }
2733
2734        #[inline(always)]
2735        fn inline_size(_context: fidl::encoding::Context) -> usize {
2736            26
2737        }
2738        #[inline(always)]
2739        fn encode_is_copy() -> bool {
2740            true
2741        }
2742
2743        #[inline(always)]
2744        fn decode_is_copy() -> bool {
2745            true
2746        }
2747    }
2748
2749    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HtCapabilities, D>
2750        for &HtCapabilities
2751    {
2752        #[inline]
2753        unsafe fn encode(
2754            self,
2755            encoder: &mut fidl::encoding::Encoder<'_, D>,
2756            offset: usize,
2757            _depth: fidl::encoding::Depth,
2758        ) -> fidl::Result<()> {
2759            encoder.debug_check_bounds::<HtCapabilities>(offset);
2760            unsafe {
2761                // Copy the object into the buffer.
2762                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2763                (buf_ptr as *mut HtCapabilities)
2764                    .write_unaligned((self as *const HtCapabilities).read());
2765                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2766                // done second because the memcpy will write garbage to these bytes.
2767            }
2768            Ok(())
2769        }
2770    }
2771    unsafe impl<
2772        D: fidl::encoding::ResourceDialect,
2773        T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 26>, D>,
2774    > fidl::encoding::Encode<HtCapabilities, D> for (T0,)
2775    {
2776        #[inline]
2777        unsafe fn encode(
2778            self,
2779            encoder: &mut fidl::encoding::Encoder<'_, D>,
2780            offset: usize,
2781            depth: fidl::encoding::Depth,
2782        ) -> fidl::Result<()> {
2783            encoder.debug_check_bounds::<HtCapabilities>(offset);
2784            // Zero out padding regions. There's no need to apply masks
2785            // because the unmasked parts will be overwritten by fields.
2786            // Write the fields.
2787            self.0.encode(encoder, offset + 0, depth)?;
2788            Ok(())
2789        }
2790    }
2791
2792    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HtCapabilities {
2793        #[inline(always)]
2794        fn new_empty() -> Self {
2795            Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 26>, D) }
2796        }
2797
2798        #[inline]
2799        unsafe fn decode(
2800            &mut self,
2801            decoder: &mut fidl::encoding::Decoder<'_, D>,
2802            offset: usize,
2803            _depth: fidl::encoding::Depth,
2804        ) -> fidl::Result<()> {
2805            decoder.debug_check_bounds::<Self>(offset);
2806            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2807            // Verify that padding bytes are zero.
2808            // Copy from the buffer into the object.
2809            unsafe {
2810                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 26);
2811            }
2812            Ok(())
2813        }
2814    }
2815
2816    impl fidl::encoding::ValueTypeMarker for HtOperation {
2817        type Borrowed<'a> = &'a Self;
2818        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2819            value
2820        }
2821    }
2822
2823    unsafe impl fidl::encoding::TypeMarker for HtOperation {
2824        type Owned = Self;
2825
2826        #[inline(always)]
2827        fn inline_align(_context: fidl::encoding::Context) -> usize {
2828            1
2829        }
2830
2831        #[inline(always)]
2832        fn inline_size(_context: fidl::encoding::Context) -> usize {
2833            22
2834        }
2835        #[inline(always)]
2836        fn encode_is_copy() -> bool {
2837            true
2838        }
2839
2840        #[inline(always)]
2841        fn decode_is_copy() -> bool {
2842            true
2843        }
2844    }
2845
2846    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HtOperation, D>
2847        for &HtOperation
2848    {
2849        #[inline]
2850        unsafe fn encode(
2851            self,
2852            encoder: &mut fidl::encoding::Encoder<'_, D>,
2853            offset: usize,
2854            _depth: fidl::encoding::Depth,
2855        ) -> fidl::Result<()> {
2856            encoder.debug_check_bounds::<HtOperation>(offset);
2857            unsafe {
2858                // Copy the object into the buffer.
2859                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2860                (buf_ptr as *mut HtOperation).write_unaligned((self as *const HtOperation).read());
2861                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2862                // done second because the memcpy will write garbage to these bytes.
2863            }
2864            Ok(())
2865        }
2866    }
2867    unsafe impl<
2868        D: fidl::encoding::ResourceDialect,
2869        T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 22>, D>,
2870    > fidl::encoding::Encode<HtOperation, D> for (T0,)
2871    {
2872        #[inline]
2873        unsafe fn encode(
2874            self,
2875            encoder: &mut fidl::encoding::Encoder<'_, D>,
2876            offset: usize,
2877            depth: fidl::encoding::Depth,
2878        ) -> fidl::Result<()> {
2879            encoder.debug_check_bounds::<HtOperation>(offset);
2880            // Zero out padding regions. There's no need to apply masks
2881            // because the unmasked parts will be overwritten by fields.
2882            // Write the fields.
2883            self.0.encode(encoder, offset + 0, depth)?;
2884            Ok(())
2885        }
2886    }
2887
2888    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HtOperation {
2889        #[inline(always)]
2890        fn new_empty() -> Self {
2891            Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 22>, D) }
2892        }
2893
2894        #[inline]
2895        unsafe fn decode(
2896            &mut self,
2897            decoder: &mut fidl::encoding::Decoder<'_, D>,
2898            offset: usize,
2899            _depth: fidl::encoding::Depth,
2900        ) -> fidl::Result<()> {
2901            decoder.debug_check_bounds::<Self>(offset);
2902            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2903            // Verify that padding bytes are zero.
2904            // Copy from the buffer into the object.
2905            unsafe {
2906                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 22);
2907            }
2908            Ok(())
2909        }
2910    }
2911
2912    impl fidl::encoding::ValueTypeMarker for VhtCapabilities {
2913        type Borrowed<'a> = &'a Self;
2914        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2915            value
2916        }
2917    }
2918
2919    unsafe impl fidl::encoding::TypeMarker for VhtCapabilities {
2920        type Owned = Self;
2921
2922        #[inline(always)]
2923        fn inline_align(_context: fidl::encoding::Context) -> usize {
2924            1
2925        }
2926
2927        #[inline(always)]
2928        fn inline_size(_context: fidl::encoding::Context) -> usize {
2929            12
2930        }
2931        #[inline(always)]
2932        fn encode_is_copy() -> bool {
2933            true
2934        }
2935
2936        #[inline(always)]
2937        fn decode_is_copy() -> bool {
2938            true
2939        }
2940    }
2941
2942    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VhtCapabilities, D>
2943        for &VhtCapabilities
2944    {
2945        #[inline]
2946        unsafe fn encode(
2947            self,
2948            encoder: &mut fidl::encoding::Encoder<'_, D>,
2949            offset: usize,
2950            _depth: fidl::encoding::Depth,
2951        ) -> fidl::Result<()> {
2952            encoder.debug_check_bounds::<VhtCapabilities>(offset);
2953            unsafe {
2954                // Copy the object into the buffer.
2955                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2956                (buf_ptr as *mut VhtCapabilities)
2957                    .write_unaligned((self as *const VhtCapabilities).read());
2958                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2959                // done second because the memcpy will write garbage to these bytes.
2960            }
2961            Ok(())
2962        }
2963    }
2964    unsafe impl<
2965        D: fidl::encoding::ResourceDialect,
2966        T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 12>, D>,
2967    > fidl::encoding::Encode<VhtCapabilities, D> for (T0,)
2968    {
2969        #[inline]
2970        unsafe fn encode(
2971            self,
2972            encoder: &mut fidl::encoding::Encoder<'_, D>,
2973            offset: usize,
2974            depth: fidl::encoding::Depth,
2975        ) -> fidl::Result<()> {
2976            encoder.debug_check_bounds::<VhtCapabilities>(offset);
2977            // Zero out padding regions. There's no need to apply masks
2978            // because the unmasked parts will be overwritten by fields.
2979            // Write the fields.
2980            self.0.encode(encoder, offset + 0, depth)?;
2981            Ok(())
2982        }
2983    }
2984
2985    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VhtCapabilities {
2986        #[inline(always)]
2987        fn new_empty() -> Self {
2988            Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 12>, D) }
2989        }
2990
2991        #[inline]
2992        unsafe fn decode(
2993            &mut self,
2994            decoder: &mut fidl::encoding::Decoder<'_, D>,
2995            offset: usize,
2996            _depth: fidl::encoding::Depth,
2997        ) -> fidl::Result<()> {
2998            decoder.debug_check_bounds::<Self>(offset);
2999            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3000            // Verify that padding bytes are zero.
3001            // Copy from the buffer into the object.
3002            unsafe {
3003                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
3004            }
3005            Ok(())
3006        }
3007    }
3008
3009    impl fidl::encoding::ValueTypeMarker for VhtOperation {
3010        type Borrowed<'a> = &'a Self;
3011        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3012            value
3013        }
3014    }
3015
3016    unsafe impl fidl::encoding::TypeMarker for VhtOperation {
3017        type Owned = Self;
3018
3019        #[inline(always)]
3020        fn inline_align(_context: fidl::encoding::Context) -> usize {
3021            1
3022        }
3023
3024        #[inline(always)]
3025        fn inline_size(_context: fidl::encoding::Context) -> usize {
3026            5
3027        }
3028        #[inline(always)]
3029        fn encode_is_copy() -> bool {
3030            true
3031        }
3032
3033        #[inline(always)]
3034        fn decode_is_copy() -> bool {
3035            true
3036        }
3037    }
3038
3039    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VhtOperation, D>
3040        for &VhtOperation
3041    {
3042        #[inline]
3043        unsafe fn encode(
3044            self,
3045            encoder: &mut fidl::encoding::Encoder<'_, D>,
3046            offset: usize,
3047            _depth: fidl::encoding::Depth,
3048        ) -> fidl::Result<()> {
3049            encoder.debug_check_bounds::<VhtOperation>(offset);
3050            unsafe {
3051                // Copy the object into the buffer.
3052                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3053                (buf_ptr as *mut VhtOperation)
3054                    .write_unaligned((self as *const VhtOperation).read());
3055                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3056                // done second because the memcpy will write garbage to these bytes.
3057            }
3058            Ok(())
3059        }
3060    }
3061    unsafe impl<
3062        D: fidl::encoding::ResourceDialect,
3063        T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 5>, D>,
3064    > fidl::encoding::Encode<VhtOperation, D> for (T0,)
3065    {
3066        #[inline]
3067        unsafe fn encode(
3068            self,
3069            encoder: &mut fidl::encoding::Encoder<'_, D>,
3070            offset: usize,
3071            depth: fidl::encoding::Depth,
3072        ) -> fidl::Result<()> {
3073            encoder.debug_check_bounds::<VhtOperation>(offset);
3074            // Zero out padding regions. There's no need to apply masks
3075            // because the unmasked parts will be overwritten by fields.
3076            // Write the fields.
3077            self.0.encode(encoder, offset + 0, depth)?;
3078            Ok(())
3079        }
3080    }
3081
3082    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VhtOperation {
3083        #[inline(always)]
3084        fn new_empty() -> Self {
3085            Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 5>, D) }
3086        }
3087
3088        #[inline]
3089        unsafe fn decode(
3090            &mut self,
3091            decoder: &mut fidl::encoding::Decoder<'_, D>,
3092            offset: usize,
3093            _depth: fidl::encoding::Depth,
3094        ) -> fidl::Result<()> {
3095            decoder.debug_check_bounds::<Self>(offset);
3096            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3097            // Verify that padding bytes are zero.
3098            // Copy from the buffer into the object.
3099            unsafe {
3100                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 5);
3101            }
3102            Ok(())
3103        }
3104    }
3105
3106    impl fidl::encoding::ValueTypeMarker for WlanChannel {
3107        type Borrowed<'a> = &'a Self;
3108        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3109            value
3110        }
3111    }
3112
3113    unsafe impl fidl::encoding::TypeMarker for WlanChannel {
3114        type Owned = Self;
3115
3116        #[inline(always)]
3117        fn inline_align(_context: fidl::encoding::Context) -> usize {
3118            4
3119        }
3120
3121        #[inline(always)]
3122        fn inline_size(_context: fidl::encoding::Context) -> usize {
3123            12
3124        }
3125    }
3126
3127    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WlanChannel, D>
3128        for &WlanChannel
3129    {
3130        #[inline]
3131        unsafe fn encode(
3132            self,
3133            encoder: &mut fidl::encoding::Encoder<'_, D>,
3134            offset: usize,
3135            _depth: fidl::encoding::Depth,
3136        ) -> fidl::Result<()> {
3137            encoder.debug_check_bounds::<WlanChannel>(offset);
3138            // Delegate to tuple encoding.
3139            fidl::encoding::Encode::<WlanChannel, D>::encode(
3140                (
3141                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.primary),
3142                    <ChannelBandwidth as fidl::encoding::ValueTypeMarker>::borrow(&self.cbw),
3143                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.secondary80),
3144                ),
3145                encoder,
3146                offset,
3147                _depth,
3148            )
3149        }
3150    }
3151    unsafe impl<
3152        D: fidl::encoding::ResourceDialect,
3153        T0: fidl::encoding::Encode<u8, D>,
3154        T1: fidl::encoding::Encode<ChannelBandwidth, D>,
3155        T2: fidl::encoding::Encode<u8, D>,
3156    > fidl::encoding::Encode<WlanChannel, D> for (T0, T1, T2)
3157    {
3158        #[inline]
3159        unsafe fn encode(
3160            self,
3161            encoder: &mut fidl::encoding::Encoder<'_, D>,
3162            offset: usize,
3163            depth: fidl::encoding::Depth,
3164        ) -> fidl::Result<()> {
3165            encoder.debug_check_bounds::<WlanChannel>(offset);
3166            // Zero out padding regions. There's no need to apply masks
3167            // because the unmasked parts will be overwritten by fields.
3168            unsafe {
3169                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3170                (ptr as *mut u32).write_unaligned(0);
3171            }
3172            unsafe {
3173                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3174                (ptr as *mut u32).write_unaligned(0);
3175            }
3176            // Write the fields.
3177            self.0.encode(encoder, offset + 0, depth)?;
3178            self.1.encode(encoder, offset + 4, depth)?;
3179            self.2.encode(encoder, offset + 8, depth)?;
3180            Ok(())
3181        }
3182    }
3183
3184    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanChannel {
3185        #[inline(always)]
3186        fn new_empty() -> Self {
3187            Self {
3188                primary: fidl::new_empty!(u8, D),
3189                cbw: fidl::new_empty!(ChannelBandwidth, D),
3190                secondary80: fidl::new_empty!(u8, D),
3191            }
3192        }
3193
3194        #[inline]
3195        unsafe fn decode(
3196            &mut self,
3197            decoder: &mut fidl::encoding::Decoder<'_, D>,
3198            offset: usize,
3199            _depth: fidl::encoding::Depth,
3200        ) -> fidl::Result<()> {
3201            decoder.debug_check_bounds::<Self>(offset);
3202            // Verify that padding bytes are zero.
3203            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3204            let padval = unsafe { (ptr as *const u32).read_unaligned() };
3205            let mask = 0xffffff00u32;
3206            let maskedval = padval & mask;
3207            if maskedval != 0 {
3208                return Err(fidl::Error::NonZeroPadding {
3209                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3210                });
3211            }
3212            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
3213            let padval = unsafe { (ptr as *const u32).read_unaligned() };
3214            let mask = 0xffffff00u32;
3215            let maskedval = padval & mask;
3216            if maskedval != 0 {
3217                return Err(fidl::Error::NonZeroPadding {
3218                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3219                });
3220            }
3221            fidl::decode!(u8, D, &mut self.primary, decoder, offset + 0, _depth)?;
3222            fidl::decode!(ChannelBandwidth, D, &mut self.cbw, decoder, offset + 4, _depth)?;
3223            fidl::decode!(u8, D, &mut self.secondary80, decoder, offset + 8, _depth)?;
3224            Ok(())
3225        }
3226    }
3227
3228    impl SetKeyDescriptor {
3229        #[inline(always)]
3230        fn max_ordinal_present(&self) -> u64 {
3231            if let Some(_) = self.cipher_type {
3232                return 7;
3233            }
3234            if let Some(_) = self.cipher_oui {
3235                return 6;
3236            }
3237            if let Some(_) = self.rsc {
3238                return 5;
3239            }
3240            if let Some(_) = self.peer_addr {
3241                return 4;
3242            }
3243            if let Some(_) = self.key_type {
3244                return 3;
3245            }
3246            if let Some(_) = self.key_id {
3247                return 2;
3248            }
3249            if let Some(_) = self.key {
3250                return 1;
3251            }
3252            0
3253        }
3254    }
3255
3256    impl fidl::encoding::ValueTypeMarker for SetKeyDescriptor {
3257        type Borrowed<'a> = &'a Self;
3258        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3259            value
3260        }
3261    }
3262
3263    unsafe impl fidl::encoding::TypeMarker for SetKeyDescriptor {
3264        type Owned = Self;
3265
3266        #[inline(always)]
3267        fn inline_align(_context: fidl::encoding::Context) -> usize {
3268            8
3269        }
3270
3271        #[inline(always)]
3272        fn inline_size(_context: fidl::encoding::Context) -> usize {
3273            16
3274        }
3275    }
3276
3277    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SetKeyDescriptor, D>
3278        for &SetKeyDescriptor
3279    {
3280        unsafe fn encode(
3281            self,
3282            encoder: &mut fidl::encoding::Encoder<'_, D>,
3283            offset: usize,
3284            mut depth: fidl::encoding::Depth,
3285        ) -> fidl::Result<()> {
3286            encoder.debug_check_bounds::<SetKeyDescriptor>(offset);
3287            // Vector header
3288            let max_ordinal: u64 = self.max_ordinal_present();
3289            encoder.write_num(max_ordinal, offset);
3290            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3291            // Calling encoder.out_of_line_offset(0) is not allowed.
3292            if max_ordinal == 0 {
3293                return Ok(());
3294            }
3295            depth.increment()?;
3296            let envelope_size = 8;
3297            let bytes_len = max_ordinal as usize * envelope_size;
3298            #[allow(unused_variables)]
3299            let offset = encoder.out_of_line_offset(bytes_len);
3300            let mut _prev_end_offset: usize = 0;
3301            if 1 > max_ordinal {
3302                return Ok(());
3303            }
3304
3305            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3306            // are envelope_size bytes.
3307            let cur_offset: usize = (1 - 1) * envelope_size;
3308
3309            // Zero reserved fields.
3310            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3311
3312            // Safety:
3313            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3314            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3315            //   envelope_size bytes, there is always sufficient room.
3316            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32>, D>(
3317                self.key.as_ref().map(
3318                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
3319                ),
3320                encoder,
3321                offset + cur_offset,
3322                depth,
3323            )?;
3324
3325            _prev_end_offset = cur_offset + envelope_size;
3326            if 2 > max_ordinal {
3327                return Ok(());
3328            }
3329
3330            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3331            // are envelope_size bytes.
3332            let cur_offset: usize = (2 - 1) * envelope_size;
3333
3334            // Zero reserved fields.
3335            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3336
3337            // Safety:
3338            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3339            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3340            //   envelope_size bytes, there is always sufficient room.
3341            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3342                self.key_id.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3343                encoder,
3344                offset + cur_offset,
3345                depth,
3346            )?;
3347
3348            _prev_end_offset = cur_offset + envelope_size;
3349            if 3 > max_ordinal {
3350                return Ok(());
3351            }
3352
3353            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3354            // are envelope_size bytes.
3355            let cur_offset: usize = (3 - 1) * envelope_size;
3356
3357            // Zero reserved fields.
3358            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3359
3360            // Safety:
3361            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3362            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3363            //   envelope_size bytes, there is always sufficient room.
3364            fidl::encoding::encode_in_envelope_optional::<KeyType, D>(
3365                self.key_type.as_ref().map(<KeyType as fidl::encoding::ValueTypeMarker>::borrow),
3366                encoder,
3367                offset + cur_offset,
3368                depth,
3369            )?;
3370
3371            _prev_end_offset = cur_offset + envelope_size;
3372            if 4 > max_ordinal {
3373                return Ok(());
3374            }
3375
3376            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3377            // are envelope_size bytes.
3378            let cur_offset: usize = (4 - 1) * envelope_size;
3379
3380            // Zero reserved fields.
3381            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3382
3383            // Safety:
3384            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3385            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3386            //   envelope_size bytes, there is always sufficient room.
3387            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 6>, D>(
3388                self.peer_addr
3389                    .as_ref()
3390                    .map(<fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow),
3391                encoder,
3392                offset + cur_offset,
3393                depth,
3394            )?;
3395
3396            _prev_end_offset = cur_offset + envelope_size;
3397            if 5 > max_ordinal {
3398                return Ok(());
3399            }
3400
3401            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3402            // are envelope_size bytes.
3403            let cur_offset: usize = (5 - 1) * envelope_size;
3404
3405            // Zero reserved fields.
3406            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3407
3408            // Safety:
3409            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3410            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3411            //   envelope_size bytes, there is always sufficient room.
3412            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3413                self.rsc.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3414                encoder,
3415                offset + cur_offset,
3416                depth,
3417            )?;
3418
3419            _prev_end_offset = cur_offset + envelope_size;
3420            if 6 > max_ordinal {
3421                return Ok(());
3422            }
3423
3424            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3425            // are envelope_size bytes.
3426            let cur_offset: usize = (6 - 1) * envelope_size;
3427
3428            // Zero reserved fields.
3429            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3430
3431            // Safety:
3432            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3433            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3434            //   envelope_size bytes, there is always sufficient room.
3435            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 3>, D>(
3436                self.cipher_oui
3437                    .as_ref()
3438                    .map(<fidl::encoding::Array<u8, 3> as fidl::encoding::ValueTypeMarker>::borrow),
3439                encoder,
3440                offset + cur_offset,
3441                depth,
3442            )?;
3443
3444            _prev_end_offset = cur_offset + envelope_size;
3445            if 7 > max_ordinal {
3446                return Ok(());
3447            }
3448
3449            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3450            // are envelope_size bytes.
3451            let cur_offset: usize = (7 - 1) * envelope_size;
3452
3453            // Zero reserved fields.
3454            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3455
3456            // Safety:
3457            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3458            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3459            //   envelope_size bytes, there is always sufficient room.
3460            fidl::encoding::encode_in_envelope_optional::<CipherSuiteType, D>(
3461                self.cipher_type
3462                    .as_ref()
3463                    .map(<CipherSuiteType as fidl::encoding::ValueTypeMarker>::borrow),
3464                encoder,
3465                offset + cur_offset,
3466                depth,
3467            )?;
3468
3469            _prev_end_offset = cur_offset + envelope_size;
3470
3471            Ok(())
3472        }
3473    }
3474
3475    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SetKeyDescriptor {
3476        #[inline(always)]
3477        fn new_empty() -> Self {
3478            Self::default()
3479        }
3480
3481        unsafe fn decode(
3482            &mut self,
3483            decoder: &mut fidl::encoding::Decoder<'_, D>,
3484            offset: usize,
3485            mut depth: fidl::encoding::Depth,
3486        ) -> fidl::Result<()> {
3487            decoder.debug_check_bounds::<Self>(offset);
3488            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3489                None => return Err(fidl::Error::NotNullable),
3490                Some(len) => len,
3491            };
3492            // Calling decoder.out_of_line_offset(0) is not allowed.
3493            if len == 0 {
3494                return Ok(());
3495            };
3496            depth.increment()?;
3497            let envelope_size = 8;
3498            let bytes_len = len * envelope_size;
3499            let offset = decoder.out_of_line_offset(bytes_len)?;
3500            // Decode the envelope for each type.
3501            let mut _next_ordinal_to_read = 0;
3502            let mut next_offset = offset;
3503            let end_offset = offset + bytes_len;
3504            _next_ordinal_to_read += 1;
3505            if next_offset >= end_offset {
3506                return Ok(());
3507            }
3508
3509            // Decode unknown envelopes for gaps in ordinals.
3510            while _next_ordinal_to_read < 1 {
3511                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3512                _next_ordinal_to_read += 1;
3513                next_offset += envelope_size;
3514            }
3515
3516            let next_out_of_line = decoder.next_out_of_line();
3517            let handles_before = decoder.remaining_handles();
3518            if let Some((inlined, num_bytes, num_handles)) =
3519                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3520            {
3521                let member_inline_size =
3522                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
3523                        decoder.context,
3524                    );
3525                if inlined != (member_inline_size <= 4) {
3526                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3527                }
3528                let inner_offset;
3529                let mut inner_depth = depth.clone();
3530                if inlined {
3531                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3532                    inner_offset = next_offset;
3533                } else {
3534                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3535                    inner_depth.increment()?;
3536                }
3537                let val_ref = self
3538                    .key
3539                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D));
3540                fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
3541                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3542                {
3543                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3544                }
3545                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3546                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3547                }
3548            }
3549
3550            next_offset += envelope_size;
3551            _next_ordinal_to_read += 1;
3552            if next_offset >= end_offset {
3553                return Ok(());
3554            }
3555
3556            // Decode unknown envelopes for gaps in ordinals.
3557            while _next_ordinal_to_read < 2 {
3558                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3559                _next_ordinal_to_read += 1;
3560                next_offset += envelope_size;
3561            }
3562
3563            let next_out_of_line = decoder.next_out_of_line();
3564            let handles_before = decoder.remaining_handles();
3565            if let Some((inlined, num_bytes, num_handles)) =
3566                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3567            {
3568                let member_inline_size =
3569                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3570                if inlined != (member_inline_size <= 4) {
3571                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3572                }
3573                let inner_offset;
3574                let mut inner_depth = depth.clone();
3575                if inlined {
3576                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3577                    inner_offset = next_offset;
3578                } else {
3579                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3580                    inner_depth.increment()?;
3581                }
3582                let val_ref = self.key_id.get_or_insert_with(|| fidl::new_empty!(u16, D));
3583                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3584                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3585                {
3586                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3587                }
3588                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3589                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3590                }
3591            }
3592
3593            next_offset += envelope_size;
3594            _next_ordinal_to_read += 1;
3595            if next_offset >= end_offset {
3596                return Ok(());
3597            }
3598
3599            // Decode unknown envelopes for gaps in ordinals.
3600            while _next_ordinal_to_read < 3 {
3601                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3602                _next_ordinal_to_read += 1;
3603                next_offset += envelope_size;
3604            }
3605
3606            let next_out_of_line = decoder.next_out_of_line();
3607            let handles_before = decoder.remaining_handles();
3608            if let Some((inlined, num_bytes, num_handles)) =
3609                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3610            {
3611                let member_inline_size =
3612                    <KeyType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3613                if inlined != (member_inline_size <= 4) {
3614                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3615                }
3616                let inner_offset;
3617                let mut inner_depth = depth.clone();
3618                if inlined {
3619                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3620                    inner_offset = next_offset;
3621                } else {
3622                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3623                    inner_depth.increment()?;
3624                }
3625                let val_ref = self.key_type.get_or_insert_with(|| fidl::new_empty!(KeyType, D));
3626                fidl::decode!(KeyType, D, val_ref, decoder, inner_offset, inner_depth)?;
3627                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3628                {
3629                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3630                }
3631                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3632                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3633                }
3634            }
3635
3636            next_offset += envelope_size;
3637            _next_ordinal_to_read += 1;
3638            if next_offset >= end_offset {
3639                return Ok(());
3640            }
3641
3642            // Decode unknown envelopes for gaps in ordinals.
3643            while _next_ordinal_to_read < 4 {
3644                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3645                _next_ordinal_to_read += 1;
3646                next_offset += envelope_size;
3647            }
3648
3649            let next_out_of_line = decoder.next_out_of_line();
3650            let handles_before = decoder.remaining_handles();
3651            if let Some((inlined, num_bytes, num_handles)) =
3652                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3653            {
3654                let member_inline_size =
3655                    <fidl::encoding::Array<u8, 6> as fidl::encoding::TypeMarker>::inline_size(
3656                        decoder.context,
3657                    );
3658                if inlined != (member_inline_size <= 4) {
3659                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3660                }
3661                let inner_offset;
3662                let mut inner_depth = depth.clone();
3663                if inlined {
3664                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3665                    inner_offset = next_offset;
3666                } else {
3667                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3668                    inner_depth.increment()?;
3669                }
3670                let val_ref = self
3671                    .peer_addr
3672                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 6>, D));
3673                fidl::decode!(fidl::encoding::Array<u8, 6>, D, val_ref, decoder, inner_offset, inner_depth)?;
3674                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3675                {
3676                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3677                }
3678                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3679                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3680                }
3681            }
3682
3683            next_offset += envelope_size;
3684            _next_ordinal_to_read += 1;
3685            if next_offset >= end_offset {
3686                return Ok(());
3687            }
3688
3689            // Decode unknown envelopes for gaps in ordinals.
3690            while _next_ordinal_to_read < 5 {
3691                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3692                _next_ordinal_to_read += 1;
3693                next_offset += envelope_size;
3694            }
3695
3696            let next_out_of_line = decoder.next_out_of_line();
3697            let handles_before = decoder.remaining_handles();
3698            if let Some((inlined, num_bytes, num_handles)) =
3699                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3700            {
3701                let member_inline_size =
3702                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3703                if inlined != (member_inline_size <= 4) {
3704                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3705                }
3706                let inner_offset;
3707                let mut inner_depth = depth.clone();
3708                if inlined {
3709                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3710                    inner_offset = next_offset;
3711                } else {
3712                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3713                    inner_depth.increment()?;
3714                }
3715                let val_ref = self.rsc.get_or_insert_with(|| fidl::new_empty!(u64, D));
3716                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
3717                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3718                {
3719                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3720                }
3721                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3722                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3723                }
3724            }
3725
3726            next_offset += envelope_size;
3727            _next_ordinal_to_read += 1;
3728            if next_offset >= end_offset {
3729                return Ok(());
3730            }
3731
3732            // Decode unknown envelopes for gaps in ordinals.
3733            while _next_ordinal_to_read < 6 {
3734                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3735                _next_ordinal_to_read += 1;
3736                next_offset += envelope_size;
3737            }
3738
3739            let next_out_of_line = decoder.next_out_of_line();
3740            let handles_before = decoder.remaining_handles();
3741            if let Some((inlined, num_bytes, num_handles)) =
3742                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3743            {
3744                let member_inline_size =
3745                    <fidl::encoding::Array<u8, 3> as fidl::encoding::TypeMarker>::inline_size(
3746                        decoder.context,
3747                    );
3748                if inlined != (member_inline_size <= 4) {
3749                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3750                }
3751                let inner_offset;
3752                let mut inner_depth = depth.clone();
3753                if inlined {
3754                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3755                    inner_offset = next_offset;
3756                } else {
3757                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3758                    inner_depth.increment()?;
3759                }
3760                let val_ref = self
3761                    .cipher_oui
3762                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 3>, D));
3763                fidl::decode!(fidl::encoding::Array<u8, 3>, D, val_ref, decoder, inner_offset, inner_depth)?;
3764                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3765                {
3766                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3767                }
3768                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3769                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3770                }
3771            }
3772
3773            next_offset += envelope_size;
3774            _next_ordinal_to_read += 1;
3775            if next_offset >= end_offset {
3776                return Ok(());
3777            }
3778
3779            // Decode unknown envelopes for gaps in ordinals.
3780            while _next_ordinal_to_read < 7 {
3781                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3782                _next_ordinal_to_read += 1;
3783                next_offset += envelope_size;
3784            }
3785
3786            let next_out_of_line = decoder.next_out_of_line();
3787            let handles_before = decoder.remaining_handles();
3788            if let Some((inlined, num_bytes, num_handles)) =
3789                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3790            {
3791                let member_inline_size =
3792                    <CipherSuiteType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3793                if inlined != (member_inline_size <= 4) {
3794                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3795                }
3796                let inner_offset;
3797                let mut inner_depth = depth.clone();
3798                if inlined {
3799                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3800                    inner_offset = next_offset;
3801                } else {
3802                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3803                    inner_depth.increment()?;
3804                }
3805                let val_ref =
3806                    self.cipher_type.get_or_insert_with(|| fidl::new_empty!(CipherSuiteType, D));
3807                fidl::decode!(CipherSuiteType, D, val_ref, decoder, inner_offset, inner_depth)?;
3808                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3809                {
3810                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3811                }
3812                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3813                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3814                }
3815            }
3816
3817            next_offset += envelope_size;
3818
3819            // Decode the remaining unknown envelopes.
3820            while next_offset < end_offset {
3821                _next_ordinal_to_read += 1;
3822                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3823                next_offset += envelope_size;
3824            }
3825
3826            Ok(())
3827        }
3828    }
3829}