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    /// No 802.11 MAC-level acknowledgment received from peer.
917    NoAckFromPeer,
918    /// Timed out waiting for management response frame from peer.
919    ResponseTimeout,
920    /// Received an unexpected or out-of-sequence response from peer.
921    UnexpectedResponse,
922    /// Connect attempt failed due to an unspecified client, driver, or firmware error.
923    InternalFailure,
924    #[doc(hidden)]
925    __SourceBreaking {
926        unknown_ordinal: u16,
927    },
928}
929
930/// Pattern that matches an unknown `StatusCode` member.
931#[macro_export]
932macro_rules! StatusCodeUnknown {
933    () => {
934        _
935    };
936}
937
938impl StatusCode {
939    #[inline]
940    pub fn from_primitive(prim: u16) -> Option<Self> {
941        match prim {
942            0 => Some(Self::Success),
943            1 => Some(Self::RefusedReasonUnspecified),
944            2 => Some(Self::TdlsRejectedAlternativeProvided),
945            3 => Some(Self::TdlsRejected),
946            5 => Some(Self::SecurityDisabled),
947            6 => Some(Self::UnacceptableLifetime),
948            7 => Some(Self::NotInSameBss),
949            10 => Some(Self::RefusedCapabilitiesMismatch),
950            11 => Some(Self::DeniedNoAssociationExists),
951            12 => Some(Self::DeniedOtherReason),
952            13 => Some(Self::UnsupportedAuthAlgorithm),
953            14 => Some(Self::TransactionSequenceError),
954            15 => Some(Self::ChallengeFailure),
955            16 => Some(Self::RejectedSequenceTimeout),
956            17 => Some(Self::DeniedNoMoreStas),
957            18 => Some(Self::RefusedBasicRatesMismatch),
958            19 => Some(Self::DeniedNoShortPreambleSupport),
959            22 => Some(Self::RejectedSpectrumManagementRequired),
960            23 => Some(Self::RejectedBadPowerCapability),
961            24 => Some(Self::RejectedBadSupportedChannels),
962            25 => Some(Self::DeniedNoShortSlotTimeSupport),
963            27 => Some(Self::DeniedNoHtSupport),
964            28 => Some(Self::R0KhUnreachable),
965            29 => Some(Self::DeniedPcoTimeNotSupported),
966            30 => Some(Self::RefusedTemporarily),
967            31 => Some(Self::RobustManagementPolicyViolation),
968            32 => Some(Self::UnspecifiedQosFailure),
969            33 => Some(Self::DeniedInsufficientBandwidth),
970            34 => Some(Self::DeniedPoorChannelConditions),
971            35 => Some(Self::DeniedQosNotSupported),
972            37 => Some(Self::RequestDeclined),
973            38 => Some(Self::InvalidParameters),
974            39 => Some(Self::RejectedWithSuggestedChanges),
975            40 => Some(Self::StatusInvalidElement),
976            41 => Some(Self::StatusInvalidGroupCipher),
977            42 => Some(Self::StatusInvalidPairwiseCipher),
978            43 => Some(Self::StatusInvalidAkmp),
979            44 => Some(Self::UnsupportedRsneVersion),
980            45 => Some(Self::InvalidRsneCapabilities),
981            46 => Some(Self::StatusCipherOutOfPolicy),
982            47 => Some(Self::RejectedForDelayPeriod),
983            48 => Some(Self::DlsNotAllowed),
984            49 => Some(Self::NotPresent),
985            50 => Some(Self::NotQosSta),
986            51 => Some(Self::DeniedListenIntervalTooLarge),
987            52 => Some(Self::StatusInvalidFtActionFrameCount),
988            53 => Some(Self::StatusInvalidPmkid),
989            54 => Some(Self::StatusInvalidMde),
990            55 => Some(Self::StatusInvalidFte),
991            56 => Some(Self::RequestedTclasNotSupportedByAp),
992            57 => Some(Self::InsufficientTclasProcessingResources),
993            58 => Some(Self::TryAnotherBss),
994            59 => Some(Self::GasAdvertisementProtocolNotSupported),
995            60 => Some(Self::NoOutstandingGasRequest),
996            61 => Some(Self::GasResponseNotReceivedFromServer),
997            62 => Some(Self::GasQueryTimeout),
998            63 => Some(Self::GasQueryResponseTooLarge),
999            64 => Some(Self::RejectedHomeWithSuggestedChanges),
1000            65 => Some(Self::ServerUnreachable),
1001            67 => Some(Self::RejectedForSspPermissions),
1002            68 => Some(Self::RefusedUnauthenticatedAccessNotSupported),
1003            72 => Some(Self::InvalidRsne),
1004            73 => Some(Self::UApsdCoexistanceNotSupported),
1005            74 => Some(Self::UApsdCoexModeNotSupported),
1006            75 => Some(Self::BadIntervalWithUApsdCoex),
1007            76 => Some(Self::AntiCloggingTokenRequired),
1008            77 => Some(Self::UnsupportedFiniteCyclicGroup),
1009            78 => Some(Self::CannotFindAlternativeTbtt),
1010            79 => Some(Self::TransmissionFailure),
1011            80 => Some(Self::RequestedTclasNotSupported),
1012            81 => Some(Self::TclasResourcesExhausted),
1013            82 => Some(Self::RejectedWithSuggestedBssTransition),
1014            83 => Some(Self::RejectWithSchedule),
1015            84 => Some(Self::RejectNoWakeupSpecified),
1016            85 => Some(Self::SuccessPowerSaveMode),
1017            86 => Some(Self::PendingAdmittingFstSession),
1018            87 => Some(Self::PerformingFstNow),
1019            88 => Some(Self::PendingGapInBaWindow),
1020            89 => Some(Self::RejectUPidSetting),
1021            92 => Some(Self::RefusedExternalReason),
1022            93 => Some(Self::RefusedApOutOfMemory),
1023            94 => Some(Self::RejectedEmergencyServicesNotSupported),
1024            95 => Some(Self::QueryResponseOutstanding),
1025            96 => Some(Self::RejectDseBand),
1026            97 => Some(Self::TclasProcessingTerminated),
1027            98 => Some(Self::TsScheduleConflict),
1028            99 => Some(Self::DeniedWithSuggestedBandAndChannel),
1029            100 => Some(Self::MccaopReservationConflict),
1030            101 => Some(Self::MafLimitExceeded),
1031            102 => Some(Self::MccaTrackLimitExceeded),
1032            103 => Some(Self::DeniedDueToSpectrumManagement),
1033            104 => Some(Self::DeniedVhtNotSupported),
1034            105 => Some(Self::EnablementDenied),
1035            106 => Some(Self::RestrictionFromAuthorizedGdb),
1036            107 => Some(Self::AuthorizationDeenabled),
1037            108 => Some(Self::EnergyLimitedOperationNotSupported),
1038            109 => Some(Self::RejectedNdpBlockAckSuggested),
1039            110 => Some(Self::RejectedMaxAwayDurationUnacceptable),
1040            111 => Some(Self::FlowControlOperationSupported),
1041            112 => Some(Self::FilsAuthenticationFailure),
1042            113 => Some(Self::UnknownAuthenticationServer),
1043            116 => Some(Self::DeniedNotificationPeriodAllocation),
1044            117 => Some(Self::DeniedChannelSplitting),
1045            118 => Some(Self::DeniedAllocation),
1046            119 => Some(Self::CmmgFeaturesNotSupported),
1047            120 => Some(Self::GasFragmentNotAvailable),
1048            121 => Some(Self::SuccessCagVersionsMatch),
1049            122 => Some(Self::GlkNotAuthorized),
1050            123 => Some(Self::UnknownPasswordIdentifier),
1051            125 => Some(Self::DeniedLocalMacAddressPolicyViolation),
1052            126 => Some(Self::SaeHashToElement),
1053            128 => Some(Self::TclasProcessingTerminatedInsufficientQos),
1054            129 => Some(Self::TclasProcessingTerminatedPolicyConflict),
1055            256 => Some(Self::JoinFailure),
1056            257 => Some(Self::SpuriousDeauthOrDisassoc),
1057            258 => Some(Self::Canceled),
1058            259 => Some(Self::EstablishRsnaFailure),
1059            260 => Some(Self::OweHandshakeFailure),
1060            261 => Some(Self::NoAckFromPeer),
1061            262 => Some(Self::ResponseTimeout),
1062            263 => Some(Self::UnexpectedResponse),
1063            264 => Some(Self::InternalFailure),
1064            _ => None,
1065        }
1066    }
1067
1068    #[inline]
1069    pub fn from_primitive_allow_unknown(prim: u16) -> Self {
1070        match prim {
1071            0 => Self::Success,
1072            1 => Self::RefusedReasonUnspecified,
1073            2 => Self::TdlsRejectedAlternativeProvided,
1074            3 => Self::TdlsRejected,
1075            5 => Self::SecurityDisabled,
1076            6 => Self::UnacceptableLifetime,
1077            7 => Self::NotInSameBss,
1078            10 => Self::RefusedCapabilitiesMismatch,
1079            11 => Self::DeniedNoAssociationExists,
1080            12 => Self::DeniedOtherReason,
1081            13 => Self::UnsupportedAuthAlgorithm,
1082            14 => Self::TransactionSequenceError,
1083            15 => Self::ChallengeFailure,
1084            16 => Self::RejectedSequenceTimeout,
1085            17 => Self::DeniedNoMoreStas,
1086            18 => Self::RefusedBasicRatesMismatch,
1087            19 => Self::DeniedNoShortPreambleSupport,
1088            22 => Self::RejectedSpectrumManagementRequired,
1089            23 => Self::RejectedBadPowerCapability,
1090            24 => Self::RejectedBadSupportedChannels,
1091            25 => Self::DeniedNoShortSlotTimeSupport,
1092            27 => Self::DeniedNoHtSupport,
1093            28 => Self::R0KhUnreachable,
1094            29 => Self::DeniedPcoTimeNotSupported,
1095            30 => Self::RefusedTemporarily,
1096            31 => Self::RobustManagementPolicyViolation,
1097            32 => Self::UnspecifiedQosFailure,
1098            33 => Self::DeniedInsufficientBandwidth,
1099            34 => Self::DeniedPoorChannelConditions,
1100            35 => Self::DeniedQosNotSupported,
1101            37 => Self::RequestDeclined,
1102            38 => Self::InvalidParameters,
1103            39 => Self::RejectedWithSuggestedChanges,
1104            40 => Self::StatusInvalidElement,
1105            41 => Self::StatusInvalidGroupCipher,
1106            42 => Self::StatusInvalidPairwiseCipher,
1107            43 => Self::StatusInvalidAkmp,
1108            44 => Self::UnsupportedRsneVersion,
1109            45 => Self::InvalidRsneCapabilities,
1110            46 => Self::StatusCipherOutOfPolicy,
1111            47 => Self::RejectedForDelayPeriod,
1112            48 => Self::DlsNotAllowed,
1113            49 => Self::NotPresent,
1114            50 => Self::NotQosSta,
1115            51 => Self::DeniedListenIntervalTooLarge,
1116            52 => Self::StatusInvalidFtActionFrameCount,
1117            53 => Self::StatusInvalidPmkid,
1118            54 => Self::StatusInvalidMde,
1119            55 => Self::StatusInvalidFte,
1120            56 => Self::RequestedTclasNotSupportedByAp,
1121            57 => Self::InsufficientTclasProcessingResources,
1122            58 => Self::TryAnotherBss,
1123            59 => Self::GasAdvertisementProtocolNotSupported,
1124            60 => Self::NoOutstandingGasRequest,
1125            61 => Self::GasResponseNotReceivedFromServer,
1126            62 => Self::GasQueryTimeout,
1127            63 => Self::GasQueryResponseTooLarge,
1128            64 => Self::RejectedHomeWithSuggestedChanges,
1129            65 => Self::ServerUnreachable,
1130            67 => Self::RejectedForSspPermissions,
1131            68 => Self::RefusedUnauthenticatedAccessNotSupported,
1132            72 => Self::InvalidRsne,
1133            73 => Self::UApsdCoexistanceNotSupported,
1134            74 => Self::UApsdCoexModeNotSupported,
1135            75 => Self::BadIntervalWithUApsdCoex,
1136            76 => Self::AntiCloggingTokenRequired,
1137            77 => Self::UnsupportedFiniteCyclicGroup,
1138            78 => Self::CannotFindAlternativeTbtt,
1139            79 => Self::TransmissionFailure,
1140            80 => Self::RequestedTclasNotSupported,
1141            81 => Self::TclasResourcesExhausted,
1142            82 => Self::RejectedWithSuggestedBssTransition,
1143            83 => Self::RejectWithSchedule,
1144            84 => Self::RejectNoWakeupSpecified,
1145            85 => Self::SuccessPowerSaveMode,
1146            86 => Self::PendingAdmittingFstSession,
1147            87 => Self::PerformingFstNow,
1148            88 => Self::PendingGapInBaWindow,
1149            89 => Self::RejectUPidSetting,
1150            92 => Self::RefusedExternalReason,
1151            93 => Self::RefusedApOutOfMemory,
1152            94 => Self::RejectedEmergencyServicesNotSupported,
1153            95 => Self::QueryResponseOutstanding,
1154            96 => Self::RejectDseBand,
1155            97 => Self::TclasProcessingTerminated,
1156            98 => Self::TsScheduleConflict,
1157            99 => Self::DeniedWithSuggestedBandAndChannel,
1158            100 => Self::MccaopReservationConflict,
1159            101 => Self::MafLimitExceeded,
1160            102 => Self::MccaTrackLimitExceeded,
1161            103 => Self::DeniedDueToSpectrumManagement,
1162            104 => Self::DeniedVhtNotSupported,
1163            105 => Self::EnablementDenied,
1164            106 => Self::RestrictionFromAuthorizedGdb,
1165            107 => Self::AuthorizationDeenabled,
1166            108 => Self::EnergyLimitedOperationNotSupported,
1167            109 => Self::RejectedNdpBlockAckSuggested,
1168            110 => Self::RejectedMaxAwayDurationUnacceptable,
1169            111 => Self::FlowControlOperationSupported,
1170            112 => Self::FilsAuthenticationFailure,
1171            113 => Self::UnknownAuthenticationServer,
1172            116 => Self::DeniedNotificationPeriodAllocation,
1173            117 => Self::DeniedChannelSplitting,
1174            118 => Self::DeniedAllocation,
1175            119 => Self::CmmgFeaturesNotSupported,
1176            120 => Self::GasFragmentNotAvailable,
1177            121 => Self::SuccessCagVersionsMatch,
1178            122 => Self::GlkNotAuthorized,
1179            123 => Self::UnknownPasswordIdentifier,
1180            125 => Self::DeniedLocalMacAddressPolicyViolation,
1181            126 => Self::SaeHashToElement,
1182            128 => Self::TclasProcessingTerminatedInsufficientQos,
1183            129 => Self::TclasProcessingTerminatedPolicyConflict,
1184            256 => Self::JoinFailure,
1185            257 => Self::SpuriousDeauthOrDisassoc,
1186            258 => Self::Canceled,
1187            259 => Self::EstablishRsnaFailure,
1188            260 => Self::OweHandshakeFailure,
1189            261 => Self::NoAckFromPeer,
1190            262 => Self::ResponseTimeout,
1191            263 => Self::UnexpectedResponse,
1192            264 => Self::InternalFailure,
1193            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1194        }
1195    }
1196
1197    #[inline]
1198    pub fn unknown() -> Self {
1199        Self::__SourceBreaking { unknown_ordinal: 0xffff }
1200    }
1201
1202    #[inline]
1203    pub const fn into_primitive(self) -> u16 {
1204        match self {
1205            Self::Success => 0,
1206            Self::RefusedReasonUnspecified => 1,
1207            Self::TdlsRejectedAlternativeProvided => 2,
1208            Self::TdlsRejected => 3,
1209            Self::SecurityDisabled => 5,
1210            Self::UnacceptableLifetime => 6,
1211            Self::NotInSameBss => 7,
1212            Self::RefusedCapabilitiesMismatch => 10,
1213            Self::DeniedNoAssociationExists => 11,
1214            Self::DeniedOtherReason => 12,
1215            Self::UnsupportedAuthAlgorithm => 13,
1216            Self::TransactionSequenceError => 14,
1217            Self::ChallengeFailure => 15,
1218            Self::RejectedSequenceTimeout => 16,
1219            Self::DeniedNoMoreStas => 17,
1220            Self::RefusedBasicRatesMismatch => 18,
1221            Self::DeniedNoShortPreambleSupport => 19,
1222            Self::RejectedSpectrumManagementRequired => 22,
1223            Self::RejectedBadPowerCapability => 23,
1224            Self::RejectedBadSupportedChannels => 24,
1225            Self::DeniedNoShortSlotTimeSupport => 25,
1226            Self::DeniedNoHtSupport => 27,
1227            Self::R0KhUnreachable => 28,
1228            Self::DeniedPcoTimeNotSupported => 29,
1229            Self::RefusedTemporarily => 30,
1230            Self::RobustManagementPolicyViolation => 31,
1231            Self::UnspecifiedQosFailure => 32,
1232            Self::DeniedInsufficientBandwidth => 33,
1233            Self::DeniedPoorChannelConditions => 34,
1234            Self::DeniedQosNotSupported => 35,
1235            Self::RequestDeclined => 37,
1236            Self::InvalidParameters => 38,
1237            Self::RejectedWithSuggestedChanges => 39,
1238            Self::StatusInvalidElement => 40,
1239            Self::StatusInvalidGroupCipher => 41,
1240            Self::StatusInvalidPairwiseCipher => 42,
1241            Self::StatusInvalidAkmp => 43,
1242            Self::UnsupportedRsneVersion => 44,
1243            Self::InvalidRsneCapabilities => 45,
1244            Self::StatusCipherOutOfPolicy => 46,
1245            Self::RejectedForDelayPeriod => 47,
1246            Self::DlsNotAllowed => 48,
1247            Self::NotPresent => 49,
1248            Self::NotQosSta => 50,
1249            Self::DeniedListenIntervalTooLarge => 51,
1250            Self::StatusInvalidFtActionFrameCount => 52,
1251            Self::StatusInvalidPmkid => 53,
1252            Self::StatusInvalidMde => 54,
1253            Self::StatusInvalidFte => 55,
1254            Self::RequestedTclasNotSupportedByAp => 56,
1255            Self::InsufficientTclasProcessingResources => 57,
1256            Self::TryAnotherBss => 58,
1257            Self::GasAdvertisementProtocolNotSupported => 59,
1258            Self::NoOutstandingGasRequest => 60,
1259            Self::GasResponseNotReceivedFromServer => 61,
1260            Self::GasQueryTimeout => 62,
1261            Self::GasQueryResponseTooLarge => 63,
1262            Self::RejectedHomeWithSuggestedChanges => 64,
1263            Self::ServerUnreachable => 65,
1264            Self::RejectedForSspPermissions => 67,
1265            Self::RefusedUnauthenticatedAccessNotSupported => 68,
1266            Self::InvalidRsne => 72,
1267            Self::UApsdCoexistanceNotSupported => 73,
1268            Self::UApsdCoexModeNotSupported => 74,
1269            Self::BadIntervalWithUApsdCoex => 75,
1270            Self::AntiCloggingTokenRequired => 76,
1271            Self::UnsupportedFiniteCyclicGroup => 77,
1272            Self::CannotFindAlternativeTbtt => 78,
1273            Self::TransmissionFailure => 79,
1274            Self::RequestedTclasNotSupported => 80,
1275            Self::TclasResourcesExhausted => 81,
1276            Self::RejectedWithSuggestedBssTransition => 82,
1277            Self::RejectWithSchedule => 83,
1278            Self::RejectNoWakeupSpecified => 84,
1279            Self::SuccessPowerSaveMode => 85,
1280            Self::PendingAdmittingFstSession => 86,
1281            Self::PerformingFstNow => 87,
1282            Self::PendingGapInBaWindow => 88,
1283            Self::RejectUPidSetting => 89,
1284            Self::RefusedExternalReason => 92,
1285            Self::RefusedApOutOfMemory => 93,
1286            Self::RejectedEmergencyServicesNotSupported => 94,
1287            Self::QueryResponseOutstanding => 95,
1288            Self::RejectDseBand => 96,
1289            Self::TclasProcessingTerminated => 97,
1290            Self::TsScheduleConflict => 98,
1291            Self::DeniedWithSuggestedBandAndChannel => 99,
1292            Self::MccaopReservationConflict => 100,
1293            Self::MafLimitExceeded => 101,
1294            Self::MccaTrackLimitExceeded => 102,
1295            Self::DeniedDueToSpectrumManagement => 103,
1296            Self::DeniedVhtNotSupported => 104,
1297            Self::EnablementDenied => 105,
1298            Self::RestrictionFromAuthorizedGdb => 106,
1299            Self::AuthorizationDeenabled => 107,
1300            Self::EnergyLimitedOperationNotSupported => 108,
1301            Self::RejectedNdpBlockAckSuggested => 109,
1302            Self::RejectedMaxAwayDurationUnacceptable => 110,
1303            Self::FlowControlOperationSupported => 111,
1304            Self::FilsAuthenticationFailure => 112,
1305            Self::UnknownAuthenticationServer => 113,
1306            Self::DeniedNotificationPeriodAllocation => 116,
1307            Self::DeniedChannelSplitting => 117,
1308            Self::DeniedAllocation => 118,
1309            Self::CmmgFeaturesNotSupported => 119,
1310            Self::GasFragmentNotAvailable => 120,
1311            Self::SuccessCagVersionsMatch => 121,
1312            Self::GlkNotAuthorized => 122,
1313            Self::UnknownPasswordIdentifier => 123,
1314            Self::DeniedLocalMacAddressPolicyViolation => 125,
1315            Self::SaeHashToElement => 126,
1316            Self::TclasProcessingTerminatedInsufficientQos => 128,
1317            Self::TclasProcessingTerminatedPolicyConflict => 129,
1318            Self::JoinFailure => 256,
1319            Self::SpuriousDeauthOrDisassoc => 257,
1320            Self::Canceled => 258,
1321            Self::EstablishRsnaFailure => 259,
1322            Self::OweHandshakeFailure => 260,
1323            Self::NoAckFromPeer => 261,
1324            Self::ResponseTimeout => 262,
1325            Self::UnexpectedResponse => 263,
1326            Self::InternalFailure => 264,
1327            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1328        }
1329    }
1330
1331    #[inline]
1332    pub fn is_unknown(&self) -> bool {
1333        match self {
1334            Self::__SourceBreaking { unknown_ordinal: _ } => true,
1335            _ => false,
1336        }
1337    }
1338}
1339
1340/// IEEE Std 802.11-2020 9.4.2.173
1341#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1342#[repr(u32)]
1343pub enum WlanAccessCategory {
1344    Background = 1,
1345    BestEffort = 2,
1346    Video = 3,
1347    Voice = 4,
1348}
1349
1350impl WlanAccessCategory {
1351    #[inline]
1352    pub fn from_primitive(prim: u32) -> Option<Self> {
1353        match prim {
1354            1 => Some(Self::Background),
1355            2 => Some(Self::BestEffort),
1356            3 => Some(Self::Video),
1357            4 => Some(Self::Voice),
1358            _ => None,
1359        }
1360    }
1361
1362    #[inline]
1363    pub const fn into_primitive(self) -> u32 {
1364        self as u32
1365    }
1366}
1367
1368/// Identifies a frequency band in metadata of various operations.
1369///
1370/// Examples of this enum in use are labeling scan results or reporting
1371/// a driver capabilities from various frequency bands.
1372///
1373/// NOTE: This enum is similar to the Band ID field defined in
1374/// IEEE Std 802.11-2016 9.4.1.46, but its values are not the same.
1375///
1376/// TODO(https://fxbug.dev/376442944): Create a spec-compliant Band ID type
1377/// and migrate the platform to use it.
1378#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1379pub enum WlanBand {
1380    TwoGhz,
1381    FiveGhz,
1382    #[doc(hidden)]
1383    __SourceBreaking {
1384        unknown_ordinal: u8,
1385    },
1386}
1387
1388/// Pattern that matches an unknown `WlanBand` member.
1389#[macro_export]
1390macro_rules! WlanBandUnknown {
1391    () => {
1392        _
1393    };
1394}
1395
1396impl WlanBand {
1397    #[inline]
1398    pub fn from_primitive(prim: u8) -> Option<Self> {
1399        match prim {
1400            0 => Some(Self::TwoGhz),
1401            1 => Some(Self::FiveGhz),
1402            _ => None,
1403        }
1404    }
1405
1406    #[inline]
1407    pub fn from_primitive_allow_unknown(prim: u8) -> Self {
1408        match prim {
1409            0 => Self::TwoGhz,
1410            1 => Self::FiveGhz,
1411            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1412        }
1413    }
1414
1415    #[inline]
1416    pub fn unknown() -> Self {
1417        Self::__SourceBreaking { unknown_ordinal: 0xff }
1418    }
1419
1420    #[inline]
1421    pub const fn into_primitive(self) -> u8 {
1422        match self {
1423            Self::TwoGhz => 0,
1424            Self::FiveGhz => 1,
1425            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1426        }
1427    }
1428
1429    #[inline]
1430    pub fn is_unknown(&self) -> bool {
1431        match self {
1432            Self::__SourceBreaking { unknown_ordinal: _ } => true,
1433            _ => false,
1434        }
1435    }
1436}
1437
1438#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
1439pub enum WlanPhyType {
1440    /// IEEE 802.11-2016 Clause 15:
1441    ///     Direct Sequence Spread Spectrum
1442    /// Supports 1, 2 Mbps.
1443    Dsss,
1444    /// IEEE 802.11-2016 Clause 16:
1445    ///     High Rate DSSS
1446    /// Supports 5.5, 11 Mbps.
1447    /// Also referred to as ERP-CCK
1448    Hr,
1449    /// IEEE 802.11a/g or IEEE 802.11-2016 Clause 17:
1450    ///     Orthogonal Frequency Division Multiplexing
1451    /// Supports 6, 9, 12, 18, 24, 36, 48, and 54 Mbps.
1452    Ofdm,
1453    /// IEEE 802.11g or IEEE 802.11-2016 Clause 18:
1454    ///     Extended Rate PHY
1455    /// Supports 1, 2, 5.5, 11, 12, 24 Mbps + optionally 6, 54 Mbps.
1456    /// Encompasses DSSS/HR/OFDM rates and modulation.
1457    Erp,
1458    /// IEEE 802.11n or IEEE 802.11-2016 Clause 19:
1459    ///     High Throughput PHY
1460    /// Supports rates up to 495 Mbps.
1461    Ht,
1462    /// 802.11ad or IEEE 802.11-2016 Clause 20:
1463    ///     Directional Multi-Gigabit PHY
1464    Dmg,
1465    /// IEEE 802.11ac or IEEE 802.11-2016 Clause 21:
1466    ///     Very High Throughput PHY
1467    /// Supports rates up to 6.9 Gbps.
1468    Vht,
1469    /// IEEE 802.11af or IEEE 802.11-2016 Clause 22:
1470    ///     Television Very High Throughput PHY
1471    /// Supports rates of up to 568.9 Mbps in TV spectrum
1472    Tvht,
1473    /// IEEE 802.11ah or IEEE 802.11-2020 Clause 23:
1474    ///     Sub 1-GHz PHY
1475    S1G,
1476    /// IEEE 802.11aj or IEEE 802.11-2020 Clause 24:
1477    ///     China Directional Multi-Gigabit PHY
1478    Cdmg,
1479    /// IEEE 802.11aj or IEEE 802.11-2020 Clause 25:
1480    ///     China Millimeter-wave Multi-Gigabit PHY
1481    Cmmg,
1482    /// IEEE 802.11ax: High Efficiency PHY
1483    /// Supports rates of up to 9.6 Gbps (whew!)
1484    He,
1485    #[doc(hidden)]
1486    __SourceBreaking { unknown_ordinal: u32 },
1487}
1488
1489/// Pattern that matches an unknown `WlanPhyType` member.
1490#[macro_export]
1491macro_rules! WlanPhyTypeUnknown {
1492    () => {
1493        _
1494    };
1495}
1496
1497impl WlanPhyType {
1498    #[inline]
1499    pub fn from_primitive(prim: u32) -> Option<Self> {
1500        match prim {
1501            1 => Some(Self::Dsss),
1502            2 => Some(Self::Hr),
1503            3 => Some(Self::Ofdm),
1504            4 => Some(Self::Erp),
1505            5 => Some(Self::Ht),
1506            6 => Some(Self::Dmg),
1507            7 => Some(Self::Vht),
1508            8 => Some(Self::Tvht),
1509            9 => Some(Self::S1G),
1510            10 => Some(Self::Cdmg),
1511            11 => Some(Self::Cmmg),
1512            12 => Some(Self::He),
1513            _ => None,
1514        }
1515    }
1516
1517    #[inline]
1518    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
1519        match prim {
1520            1 => Self::Dsss,
1521            2 => Self::Hr,
1522            3 => Self::Ofdm,
1523            4 => Self::Erp,
1524            5 => Self::Ht,
1525            6 => Self::Dmg,
1526            7 => Self::Vht,
1527            8 => Self::Tvht,
1528            9 => Self::S1G,
1529            10 => Self::Cdmg,
1530            11 => Self::Cmmg,
1531            12 => Self::He,
1532            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
1533        }
1534    }
1535
1536    #[inline]
1537    pub fn unknown() -> Self {
1538        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
1539    }
1540
1541    #[inline]
1542    pub const fn into_primitive(self) -> u32 {
1543        match self {
1544            Self::Dsss => 1,
1545            Self::Hr => 2,
1546            Self::Ofdm => 3,
1547            Self::Erp => 4,
1548            Self::Ht => 5,
1549            Self::Dmg => 6,
1550            Self::Vht => 7,
1551            Self::Tvht => 8,
1552            Self::S1G => 9,
1553            Self::Cdmg => 10,
1554            Self::Cmmg => 11,
1555            Self::He => 12,
1556            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
1557        }
1558    }
1559
1560    #[inline]
1561    pub fn is_unknown(&self) -> bool {
1562        match self {
1563            Self::__SourceBreaking { unknown_ordinal: _ } => true,
1564            _ => false,
1565        }
1566    }
1567}
1568
1569/// Type corresponding to a BSSDescription defined by IEEE Std 802.11-2020 6.3.3.3.2
1570///
1571/// This type only includes explicit fields for information frequently required
1572/// from a BSSDescription. All other fields are left in a raw buffer of IEs as
1573/// received in an advertisement from the AP, e.g., from a Beacon or Probe
1574/// Response frame.
1575///
1576/// The inclusion of a raw buffer of IEs ensures this type always includes all
1577/// the information an AP advertises, no matter the version of Fuchsia the
1578/// advertisement was received in.
1579#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1580pub struct BssDescription {
1581    pub bssid: [u8; 6],
1582    pub bss_type: BssType,
1583    pub beacon_period: u16,
1584    pub capability_info: u16,
1585    /// Buffer of IEs as received in an advertisement. E.g., from a Beacon
1586    /// or Probe Response frame.
1587    pub ies: Vec<u8>,
1588    /// Channel information for this BSS.
1589    pub primary: ChannelNumber,
1590    pub bandwidth: ChannelBandwidth,
1591    pub vht_secondary_80_channel: ChannelNumber,
1592    /// The running average of received signal strength indicator in units of dBm.
1593    pub rssi_dbm: i8,
1594    /// The running average of snr in units of dB.
1595    pub snr_db: i8,
1596}
1597
1598impl fidl::Persistable for BssDescription {}
1599
1600#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1601#[repr(C)]
1602pub struct CSsid {
1603    pub len: u8,
1604    pub data: [u8; 32],
1605}
1606
1607impl fidl::Persistable for CSsid {}
1608
1609/// Channel information consisting of the frequency band and the channel number.
1610#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1611pub struct ChannelNumber {
1612    pub band: WlanBand,
1613    pub number: u8,
1614}
1615
1616impl fidl::Persistable for ChannelNumber {}
1617
1618#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1619#[repr(C)]
1620pub struct HtCapabilities {
1621    pub bytes: [u8; 26],
1622}
1623
1624impl fidl::Persistable for HtCapabilities {}
1625
1626#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1627#[repr(C)]
1628pub struct HtOperation {
1629    pub bytes: [u8; 22],
1630}
1631
1632impl fidl::Persistable for HtOperation {}
1633
1634#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1635#[repr(C)]
1636pub struct VhtCapabilities {
1637    pub bytes: [u8; 12],
1638}
1639
1640impl fidl::Persistable for VhtCapabilities {}
1641
1642#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1643#[repr(C)]
1644pub struct VhtOperation {
1645    pub bytes: [u8; 5],
1646}
1647
1648impl fidl::Persistable for VhtOperation {}
1649
1650/// Channel information derived from the DSSS parameter set, HT operation,
1651/// and VHT operation IEs, as well as the primary channel on which a frame
1652/// is received.
1653///
1654/// IEEE Std 802.11-2016, 9.4.2.4 - DSSS Parameter Set element
1655/// IEEE Std 802.11-2016, 9.4.2.57 - HT Operation element
1656/// IEEE Std 802.11-2016, 9.4.2.159 - VHT Operation element
1657#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
1658pub struct WlanChannel {
1659    pub primary: u8,
1660    pub cbw: ChannelBandwidth,
1661    pub secondary80: u8,
1662}
1663
1664impl fidl::Persistable for WlanChannel {}
1665
1666/// IEEE Std 802.11-2020 6.3.19.1.2
1667#[derive(Clone, Debug, Default, PartialEq)]
1668pub struct SetKeyDescriptor {
1669    /// The key value as bytes.
1670    /// 802.11 specifies a bit string for this field, but we represent it as a byte array for
1671    /// convenience.
1672    /// Required.
1673    pub key: Option<Vec<u8>>,
1674    /// Index for rotating keys, e.g. group keys.
1675    /// This value is always 0 for key types which aren't rotating, e.g. pairwise keys.
1676    /// Required.
1677    pub key_id: Option<u16>,
1678    /// Whether this key is a pairwise, group or peer key.
1679    /// Required.
1680    pub key_type: Option<KeyType>,
1681    /// The peer MAC address for pairwise and peer keys.
1682    /// For group keys this value is always the broadcast address.
1683    /// Required.
1684    pub peer_addr: Option<[u8; 6]>,
1685    /// Receive Sequence Counter for group keys only.
1686    /// In all other cases the RSC will be 0.
1687    /// Optional.
1688    pub rsc: Option<u64>,
1689    /// IEEE Cipher suite selector. See IEEE Std 802.11-2016, 9.4.2.25.2, Table 9-131
1690    /// Required.
1691    pub cipher_oui: Option<[u8; 3]>,
1692    /// The cipher type.
1693    /// Required.
1694    pub cipher_type: Option<CipherSuiteType>,
1695    #[doc(hidden)]
1696    pub __source_breaking: fidl::marker::SourceBreaking,
1697}
1698
1699impl fidl::Persistable for SetKeyDescriptor {}
1700
1701mod internal {
1702    use super::*;
1703    unsafe impl fidl::encoding::TypeMarker for BssType {
1704        type Owned = Self;
1705
1706        #[inline(always)]
1707        fn inline_align(_context: fidl::encoding::Context) -> usize {
1708            std::mem::align_of::<u32>()
1709        }
1710
1711        #[inline(always)]
1712        fn inline_size(_context: fidl::encoding::Context) -> usize {
1713            std::mem::size_of::<u32>()
1714        }
1715
1716        #[inline(always)]
1717        fn encode_is_copy() -> bool {
1718            false
1719        }
1720
1721        #[inline(always)]
1722        fn decode_is_copy() -> bool {
1723            false
1724        }
1725    }
1726
1727    impl fidl::encoding::ValueTypeMarker for BssType {
1728        type Borrowed<'a> = Self;
1729        #[inline(always)]
1730        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1731            *value
1732        }
1733    }
1734
1735    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for BssType {
1736        #[inline]
1737        unsafe fn encode(
1738            self,
1739            encoder: &mut fidl::encoding::Encoder<'_, D>,
1740            offset: usize,
1741            _depth: fidl::encoding::Depth,
1742        ) -> fidl::Result<()> {
1743            encoder.debug_check_bounds::<Self>(offset);
1744            encoder.write_num(self.into_primitive(), offset);
1745            Ok(())
1746        }
1747    }
1748
1749    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BssType {
1750        #[inline(always)]
1751        fn new_empty() -> Self {
1752            Self::unknown()
1753        }
1754
1755        #[inline]
1756        unsafe fn decode(
1757            &mut self,
1758            decoder: &mut fidl::encoding::Decoder<'_, D>,
1759            offset: usize,
1760            _depth: fidl::encoding::Depth,
1761        ) -> fidl::Result<()> {
1762            decoder.debug_check_bounds::<Self>(offset);
1763            let prim = decoder.read_num::<u32>(offset);
1764
1765            *self = Self::from_primitive_allow_unknown(prim);
1766            Ok(())
1767        }
1768    }
1769    unsafe impl fidl::encoding::TypeMarker for ChannelBandwidth {
1770        type Owned = Self;
1771
1772        #[inline(always)]
1773        fn inline_align(_context: fidl::encoding::Context) -> usize {
1774            std::mem::align_of::<u32>()
1775        }
1776
1777        #[inline(always)]
1778        fn inline_size(_context: fidl::encoding::Context) -> usize {
1779            std::mem::size_of::<u32>()
1780        }
1781
1782        #[inline(always)]
1783        fn encode_is_copy() -> bool {
1784            false
1785        }
1786
1787        #[inline(always)]
1788        fn decode_is_copy() -> bool {
1789            false
1790        }
1791    }
1792
1793    impl fidl::encoding::ValueTypeMarker for ChannelBandwidth {
1794        type Borrowed<'a> = Self;
1795        #[inline(always)]
1796        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1797            *value
1798        }
1799    }
1800
1801    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1802        for ChannelBandwidth
1803    {
1804        #[inline]
1805        unsafe fn encode(
1806            self,
1807            encoder: &mut fidl::encoding::Encoder<'_, D>,
1808            offset: usize,
1809            _depth: fidl::encoding::Depth,
1810        ) -> fidl::Result<()> {
1811            encoder.debug_check_bounds::<Self>(offset);
1812            encoder.write_num(self.into_primitive(), offset);
1813            Ok(())
1814        }
1815    }
1816
1817    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelBandwidth {
1818        #[inline(always)]
1819        fn new_empty() -> Self {
1820            Self::unknown()
1821        }
1822
1823        #[inline]
1824        unsafe fn decode(
1825            &mut self,
1826            decoder: &mut fidl::encoding::Decoder<'_, D>,
1827            offset: usize,
1828            _depth: fidl::encoding::Depth,
1829        ) -> fidl::Result<()> {
1830            decoder.debug_check_bounds::<Self>(offset);
1831            let prim = decoder.read_num::<u32>(offset);
1832
1833            *self = Self::from_primitive_allow_unknown(prim);
1834            Ok(())
1835        }
1836    }
1837    unsafe impl fidl::encoding::TypeMarker for CipherSuiteType {
1838        type Owned = Self;
1839
1840        #[inline(always)]
1841        fn inline_align(_context: fidl::encoding::Context) -> usize {
1842            std::mem::align_of::<u32>()
1843        }
1844
1845        #[inline(always)]
1846        fn inline_size(_context: fidl::encoding::Context) -> usize {
1847            std::mem::size_of::<u32>()
1848        }
1849
1850        #[inline(always)]
1851        fn encode_is_copy() -> bool {
1852            false
1853        }
1854
1855        #[inline(always)]
1856        fn decode_is_copy() -> bool {
1857            false
1858        }
1859    }
1860
1861    impl fidl::encoding::ValueTypeMarker for CipherSuiteType {
1862        type Borrowed<'a> = Self;
1863        #[inline(always)]
1864        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1865            *value
1866        }
1867    }
1868
1869    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1870        for CipherSuiteType
1871    {
1872        #[inline]
1873        unsafe fn encode(
1874            self,
1875            encoder: &mut fidl::encoding::Encoder<'_, D>,
1876            offset: usize,
1877            _depth: fidl::encoding::Depth,
1878        ) -> fidl::Result<()> {
1879            encoder.debug_check_bounds::<Self>(offset);
1880            encoder.write_num(self.into_primitive(), offset);
1881            Ok(())
1882        }
1883    }
1884
1885    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CipherSuiteType {
1886        #[inline(always)]
1887        fn new_empty() -> Self {
1888            Self::unknown()
1889        }
1890
1891        #[inline]
1892        unsafe fn decode(
1893            &mut self,
1894            decoder: &mut fidl::encoding::Decoder<'_, D>,
1895            offset: usize,
1896            _depth: fidl::encoding::Depth,
1897        ) -> fidl::Result<()> {
1898            decoder.debug_check_bounds::<Self>(offset);
1899            let prim = decoder.read_num::<u32>(offset);
1900
1901            *self = Self::from_primitive_allow_unknown(prim);
1902            Ok(())
1903        }
1904    }
1905    unsafe impl fidl::encoding::TypeMarker for GuardInterval {
1906        type Owned = Self;
1907
1908        #[inline(always)]
1909        fn inline_align(_context: fidl::encoding::Context) -> usize {
1910            std::mem::align_of::<u8>()
1911        }
1912
1913        #[inline(always)]
1914        fn inline_size(_context: fidl::encoding::Context) -> usize {
1915            std::mem::size_of::<u8>()
1916        }
1917
1918        #[inline(always)]
1919        fn encode_is_copy() -> bool {
1920            true
1921        }
1922
1923        #[inline(always)]
1924        fn decode_is_copy() -> bool {
1925            false
1926        }
1927    }
1928
1929    impl fidl::encoding::ValueTypeMarker for GuardInterval {
1930        type Borrowed<'a> = Self;
1931        #[inline(always)]
1932        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1933            *value
1934        }
1935    }
1936
1937    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for GuardInterval {
1938        #[inline]
1939        unsafe fn encode(
1940            self,
1941            encoder: &mut fidl::encoding::Encoder<'_, D>,
1942            offset: usize,
1943            _depth: fidl::encoding::Depth,
1944        ) -> fidl::Result<()> {
1945            encoder.debug_check_bounds::<Self>(offset);
1946            encoder.write_num(self.into_primitive(), offset);
1947            Ok(())
1948        }
1949    }
1950
1951    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for GuardInterval {
1952        #[inline(always)]
1953        fn new_empty() -> Self {
1954            Self::LongGi
1955        }
1956
1957        #[inline]
1958        unsafe fn decode(
1959            &mut self,
1960            decoder: &mut fidl::encoding::Decoder<'_, D>,
1961            offset: usize,
1962            _depth: fidl::encoding::Depth,
1963        ) -> fidl::Result<()> {
1964            decoder.debug_check_bounds::<Self>(offset);
1965            let prim = decoder.read_num::<u8>(offset);
1966
1967            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1968            Ok(())
1969        }
1970    }
1971    unsafe impl fidl::encoding::TypeMarker for KeyType {
1972        type Owned = Self;
1973
1974        #[inline(always)]
1975        fn inline_align(_context: fidl::encoding::Context) -> usize {
1976            std::mem::align_of::<u8>()
1977        }
1978
1979        #[inline(always)]
1980        fn inline_size(_context: fidl::encoding::Context) -> usize {
1981            std::mem::size_of::<u8>()
1982        }
1983
1984        #[inline(always)]
1985        fn encode_is_copy() -> bool {
1986            false
1987        }
1988
1989        #[inline(always)]
1990        fn decode_is_copy() -> bool {
1991            false
1992        }
1993    }
1994
1995    impl fidl::encoding::ValueTypeMarker for KeyType {
1996        type Borrowed<'a> = Self;
1997        #[inline(always)]
1998        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1999            *value
2000        }
2001    }
2002
2003    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for KeyType {
2004        #[inline]
2005        unsafe fn encode(
2006            self,
2007            encoder: &mut fidl::encoding::Encoder<'_, D>,
2008            offset: usize,
2009            _depth: fidl::encoding::Depth,
2010        ) -> fidl::Result<()> {
2011            encoder.debug_check_bounds::<Self>(offset);
2012            encoder.write_num(self.into_primitive(), offset);
2013            Ok(())
2014        }
2015    }
2016
2017    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyType {
2018        #[inline(always)]
2019        fn new_empty() -> Self {
2020            Self::unknown()
2021        }
2022
2023        #[inline]
2024        unsafe fn decode(
2025            &mut self,
2026            decoder: &mut fidl::encoding::Decoder<'_, D>,
2027            offset: usize,
2028            _depth: fidl::encoding::Depth,
2029        ) -> fidl::Result<()> {
2030            decoder.debug_check_bounds::<Self>(offset);
2031            let prim = decoder.read_num::<u8>(offset);
2032
2033            *self = Self::from_primitive_allow_unknown(prim);
2034            Ok(())
2035        }
2036    }
2037    unsafe impl fidl::encoding::TypeMarker for ReasonCode {
2038        type Owned = Self;
2039
2040        #[inline(always)]
2041        fn inline_align(_context: fidl::encoding::Context) -> usize {
2042            std::mem::align_of::<u16>()
2043        }
2044
2045        #[inline(always)]
2046        fn inline_size(_context: fidl::encoding::Context) -> usize {
2047            std::mem::size_of::<u16>()
2048        }
2049
2050        #[inline(always)]
2051        fn encode_is_copy() -> bool {
2052            false
2053        }
2054
2055        #[inline(always)]
2056        fn decode_is_copy() -> bool {
2057            false
2058        }
2059    }
2060
2061    impl fidl::encoding::ValueTypeMarker for ReasonCode {
2062        type Borrowed<'a> = Self;
2063        #[inline(always)]
2064        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2065            *value
2066        }
2067    }
2068
2069    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ReasonCode {
2070        #[inline]
2071        unsafe fn encode(
2072            self,
2073            encoder: &mut fidl::encoding::Encoder<'_, D>,
2074            offset: usize,
2075            _depth: fidl::encoding::Depth,
2076        ) -> fidl::Result<()> {
2077            encoder.debug_check_bounds::<Self>(offset);
2078            encoder.write_num(self.into_primitive(), offset);
2079            Ok(())
2080        }
2081    }
2082
2083    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReasonCode {
2084        #[inline(always)]
2085        fn new_empty() -> Self {
2086            Self::unknown()
2087        }
2088
2089        #[inline]
2090        unsafe fn decode(
2091            &mut self,
2092            decoder: &mut fidl::encoding::Decoder<'_, D>,
2093            offset: usize,
2094            _depth: fidl::encoding::Depth,
2095        ) -> fidl::Result<()> {
2096            decoder.debug_check_bounds::<Self>(offset);
2097            let prim = decoder.read_num::<u16>(offset);
2098
2099            *self = Self::from_primitive_allow_unknown(prim);
2100            Ok(())
2101        }
2102    }
2103    unsafe impl fidl::encoding::TypeMarker for StatusCode {
2104        type Owned = Self;
2105
2106        #[inline(always)]
2107        fn inline_align(_context: fidl::encoding::Context) -> usize {
2108            std::mem::align_of::<u16>()
2109        }
2110
2111        #[inline(always)]
2112        fn inline_size(_context: fidl::encoding::Context) -> usize {
2113            std::mem::size_of::<u16>()
2114        }
2115
2116        #[inline(always)]
2117        fn encode_is_copy() -> bool {
2118            false
2119        }
2120
2121        #[inline(always)]
2122        fn decode_is_copy() -> bool {
2123            false
2124        }
2125    }
2126
2127    impl fidl::encoding::ValueTypeMarker for StatusCode {
2128        type Borrowed<'a> = Self;
2129        #[inline(always)]
2130        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2131            *value
2132        }
2133    }
2134
2135    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for StatusCode {
2136        #[inline]
2137        unsafe fn encode(
2138            self,
2139            encoder: &mut fidl::encoding::Encoder<'_, D>,
2140            offset: usize,
2141            _depth: fidl::encoding::Depth,
2142        ) -> fidl::Result<()> {
2143            encoder.debug_check_bounds::<Self>(offset);
2144            encoder.write_num(self.into_primitive(), offset);
2145            Ok(())
2146        }
2147    }
2148
2149    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StatusCode {
2150        #[inline(always)]
2151        fn new_empty() -> Self {
2152            Self::unknown()
2153        }
2154
2155        #[inline]
2156        unsafe fn decode(
2157            &mut self,
2158            decoder: &mut fidl::encoding::Decoder<'_, D>,
2159            offset: usize,
2160            _depth: fidl::encoding::Depth,
2161        ) -> fidl::Result<()> {
2162            decoder.debug_check_bounds::<Self>(offset);
2163            let prim = decoder.read_num::<u16>(offset);
2164
2165            *self = Self::from_primitive_allow_unknown(prim);
2166            Ok(())
2167        }
2168    }
2169    unsafe impl fidl::encoding::TypeMarker for WlanAccessCategory {
2170        type Owned = Self;
2171
2172        #[inline(always)]
2173        fn inline_align(_context: fidl::encoding::Context) -> usize {
2174            std::mem::align_of::<u32>()
2175        }
2176
2177        #[inline(always)]
2178        fn inline_size(_context: fidl::encoding::Context) -> usize {
2179            std::mem::size_of::<u32>()
2180        }
2181
2182        #[inline(always)]
2183        fn encode_is_copy() -> bool {
2184            true
2185        }
2186
2187        #[inline(always)]
2188        fn decode_is_copy() -> bool {
2189            false
2190        }
2191    }
2192
2193    impl fidl::encoding::ValueTypeMarker for WlanAccessCategory {
2194        type Borrowed<'a> = Self;
2195        #[inline(always)]
2196        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2197            *value
2198        }
2199    }
2200
2201    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2202        for WlanAccessCategory
2203    {
2204        #[inline]
2205        unsafe fn encode(
2206            self,
2207            encoder: &mut fidl::encoding::Encoder<'_, D>,
2208            offset: usize,
2209            _depth: fidl::encoding::Depth,
2210        ) -> fidl::Result<()> {
2211            encoder.debug_check_bounds::<Self>(offset);
2212            encoder.write_num(self.into_primitive(), offset);
2213            Ok(())
2214        }
2215    }
2216
2217    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanAccessCategory {
2218        #[inline(always)]
2219        fn new_empty() -> Self {
2220            Self::Background
2221        }
2222
2223        #[inline]
2224        unsafe fn decode(
2225            &mut self,
2226            decoder: &mut fidl::encoding::Decoder<'_, D>,
2227            offset: usize,
2228            _depth: fidl::encoding::Depth,
2229        ) -> fidl::Result<()> {
2230            decoder.debug_check_bounds::<Self>(offset);
2231            let prim = decoder.read_num::<u32>(offset);
2232
2233            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
2234            Ok(())
2235        }
2236    }
2237    unsafe impl fidl::encoding::TypeMarker for WlanBand {
2238        type Owned = Self;
2239
2240        #[inline(always)]
2241        fn inline_align(_context: fidl::encoding::Context) -> usize {
2242            std::mem::align_of::<u8>()
2243        }
2244
2245        #[inline(always)]
2246        fn inline_size(_context: fidl::encoding::Context) -> usize {
2247            std::mem::size_of::<u8>()
2248        }
2249
2250        #[inline(always)]
2251        fn encode_is_copy() -> bool {
2252            false
2253        }
2254
2255        #[inline(always)]
2256        fn decode_is_copy() -> bool {
2257            false
2258        }
2259    }
2260
2261    impl fidl::encoding::ValueTypeMarker for WlanBand {
2262        type Borrowed<'a> = Self;
2263        #[inline(always)]
2264        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2265            *value
2266        }
2267    }
2268
2269    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for WlanBand {
2270        #[inline]
2271        unsafe fn encode(
2272            self,
2273            encoder: &mut fidl::encoding::Encoder<'_, D>,
2274            offset: usize,
2275            _depth: fidl::encoding::Depth,
2276        ) -> fidl::Result<()> {
2277            encoder.debug_check_bounds::<Self>(offset);
2278            encoder.write_num(self.into_primitive(), offset);
2279            Ok(())
2280        }
2281    }
2282
2283    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanBand {
2284        #[inline(always)]
2285        fn new_empty() -> Self {
2286            Self::unknown()
2287        }
2288
2289        #[inline]
2290        unsafe fn decode(
2291            &mut self,
2292            decoder: &mut fidl::encoding::Decoder<'_, D>,
2293            offset: usize,
2294            _depth: fidl::encoding::Depth,
2295        ) -> fidl::Result<()> {
2296            decoder.debug_check_bounds::<Self>(offset);
2297            let prim = decoder.read_num::<u8>(offset);
2298
2299            *self = Self::from_primitive_allow_unknown(prim);
2300            Ok(())
2301        }
2302    }
2303    unsafe impl fidl::encoding::TypeMarker for WlanPhyType {
2304        type Owned = Self;
2305
2306        #[inline(always)]
2307        fn inline_align(_context: fidl::encoding::Context) -> usize {
2308            std::mem::align_of::<u32>()
2309        }
2310
2311        #[inline(always)]
2312        fn inline_size(_context: fidl::encoding::Context) -> usize {
2313            std::mem::size_of::<u32>()
2314        }
2315
2316        #[inline(always)]
2317        fn encode_is_copy() -> bool {
2318            false
2319        }
2320
2321        #[inline(always)]
2322        fn decode_is_copy() -> bool {
2323            false
2324        }
2325    }
2326
2327    impl fidl::encoding::ValueTypeMarker for WlanPhyType {
2328        type Borrowed<'a> = Self;
2329        #[inline(always)]
2330        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2331            *value
2332        }
2333    }
2334
2335    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for WlanPhyType {
2336        #[inline]
2337        unsafe fn encode(
2338            self,
2339            encoder: &mut fidl::encoding::Encoder<'_, D>,
2340            offset: usize,
2341            _depth: fidl::encoding::Depth,
2342        ) -> fidl::Result<()> {
2343            encoder.debug_check_bounds::<Self>(offset);
2344            encoder.write_num(self.into_primitive(), offset);
2345            Ok(())
2346        }
2347    }
2348
2349    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanPhyType {
2350        #[inline(always)]
2351        fn new_empty() -> Self {
2352            Self::unknown()
2353        }
2354
2355        #[inline]
2356        unsafe fn decode(
2357            &mut self,
2358            decoder: &mut fidl::encoding::Decoder<'_, D>,
2359            offset: usize,
2360            _depth: fidl::encoding::Depth,
2361        ) -> fidl::Result<()> {
2362            decoder.debug_check_bounds::<Self>(offset);
2363            let prim = decoder.read_num::<u32>(offset);
2364
2365            *self = Self::from_primitive_allow_unknown(prim);
2366            Ok(())
2367        }
2368    }
2369
2370    impl fidl::encoding::ValueTypeMarker for BssDescription {
2371        type Borrowed<'a> = &'a Self;
2372        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2373            value
2374        }
2375    }
2376
2377    unsafe impl fidl::encoding::TypeMarker for BssDescription {
2378        type Owned = Self;
2379
2380        #[inline(always)]
2381        fn inline_align(_context: fidl::encoding::Context) -> usize {
2382            8
2383        }
2384
2385        #[inline(always)]
2386        fn inline_size(_context: fidl::encoding::Context) -> usize {
2387            48
2388        }
2389    }
2390
2391    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<BssDescription, D>
2392        for &BssDescription
2393    {
2394        #[inline]
2395        unsafe fn encode(
2396            self,
2397            encoder: &mut fidl::encoding::Encoder<'_, D>,
2398            offset: usize,
2399            _depth: fidl::encoding::Depth,
2400        ) -> fidl::Result<()> {
2401            encoder.debug_check_bounds::<BssDescription>(offset);
2402            // Delegate to tuple encoding.
2403            fidl::encoding::Encode::<BssDescription, D>::encode(
2404                (
2405                    <fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow(&self.bssid),
2406                    <BssType as fidl::encoding::ValueTypeMarker>::borrow(&self.bss_type),
2407                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.beacon_period),
2408                    <u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.capability_info),
2409                    <fidl::encoding::UnboundedVector<u8> as fidl::encoding::ValueTypeMarker>::borrow(&self.ies),
2410                    <ChannelNumber as fidl::encoding::ValueTypeMarker>::borrow(&self.primary),
2411                    <ChannelBandwidth as fidl::encoding::ValueTypeMarker>::borrow(&self.bandwidth),
2412                    <ChannelNumber as fidl::encoding::ValueTypeMarker>::borrow(&self.vht_secondary_80_channel),
2413                    <i8 as fidl::encoding::ValueTypeMarker>::borrow(&self.rssi_dbm),
2414                    <i8 as fidl::encoding::ValueTypeMarker>::borrow(&self.snr_db),
2415                ),
2416                encoder, offset, _depth
2417            )
2418        }
2419    }
2420    unsafe impl<
2421        D: fidl::encoding::ResourceDialect,
2422        T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 6>, D>,
2423        T1: fidl::encoding::Encode<BssType, D>,
2424        T2: fidl::encoding::Encode<u16, D>,
2425        T3: fidl::encoding::Encode<u16, D>,
2426        T4: fidl::encoding::Encode<fidl::encoding::UnboundedVector<u8>, D>,
2427        T5: fidl::encoding::Encode<ChannelNumber, D>,
2428        T6: fidl::encoding::Encode<ChannelBandwidth, D>,
2429        T7: fidl::encoding::Encode<ChannelNumber, D>,
2430        T8: fidl::encoding::Encode<i8, D>,
2431        T9: fidl::encoding::Encode<i8, D>,
2432    > fidl::encoding::Encode<BssDescription, D> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9)
2433    {
2434        #[inline]
2435        unsafe fn encode(
2436            self,
2437            encoder: &mut fidl::encoding::Encoder<'_, D>,
2438            offset: usize,
2439            depth: fidl::encoding::Depth,
2440        ) -> fidl::Result<()> {
2441            encoder.debug_check_bounds::<BssDescription>(offset);
2442            // Zero out padding regions. There's no need to apply masks
2443            // because the unmasked parts will be overwritten by fields.
2444            unsafe {
2445                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
2446                (ptr as *mut u64).write_unaligned(0);
2447            }
2448            unsafe {
2449                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(32);
2450                (ptr as *mut u64).write_unaligned(0);
2451            }
2452            unsafe {
2453                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
2454                (ptr as *mut u64).write_unaligned(0);
2455            }
2456            // Write the fields.
2457            self.0.encode(encoder, offset + 0, depth)?;
2458            self.1.encode(encoder, offset + 8, depth)?;
2459            self.2.encode(encoder, offset + 12, depth)?;
2460            self.3.encode(encoder, offset + 14, depth)?;
2461            self.4.encode(encoder, offset + 16, depth)?;
2462            self.5.encode(encoder, offset + 32, depth)?;
2463            self.6.encode(encoder, offset + 36, depth)?;
2464            self.7.encode(encoder, offset + 40, depth)?;
2465            self.8.encode(encoder, offset + 42, depth)?;
2466            self.9.encode(encoder, offset + 43, depth)?;
2467            Ok(())
2468        }
2469    }
2470
2471    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for BssDescription {
2472        #[inline(always)]
2473        fn new_empty() -> Self {
2474            Self {
2475                bssid: fidl::new_empty!(fidl::encoding::Array<u8, 6>, D),
2476                bss_type: fidl::new_empty!(BssType, D),
2477                beacon_period: fidl::new_empty!(u16, D),
2478                capability_info: fidl::new_empty!(u16, D),
2479                ies: fidl::new_empty!(fidl::encoding::UnboundedVector<u8>, D),
2480                primary: fidl::new_empty!(ChannelNumber, D),
2481                bandwidth: fidl::new_empty!(ChannelBandwidth, D),
2482                vht_secondary_80_channel: fidl::new_empty!(ChannelNumber, D),
2483                rssi_dbm: fidl::new_empty!(i8, D),
2484                snr_db: fidl::new_empty!(i8, D),
2485            }
2486        }
2487
2488        #[inline]
2489        unsafe fn decode(
2490            &mut self,
2491            decoder: &mut fidl::encoding::Decoder<'_, D>,
2492            offset: usize,
2493            _depth: fidl::encoding::Depth,
2494        ) -> fidl::Result<()> {
2495            decoder.debug_check_bounds::<Self>(offset);
2496            // Verify that padding bytes are zero.
2497            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
2498            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2499            let mask = 0xffff000000000000u64;
2500            let maskedval = padval & mask;
2501            if maskedval != 0 {
2502                return Err(fidl::Error::NonZeroPadding {
2503                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
2504                });
2505            }
2506            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(32) };
2507            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2508            let mask = 0xffff0000u64;
2509            let maskedval = padval & mask;
2510            if maskedval != 0 {
2511                return Err(fidl::Error::NonZeroPadding {
2512                    padding_start: offset + 32 + ((mask as u64).trailing_zeros() / 8) as usize,
2513                });
2514            }
2515            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
2516            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2517            let mask = 0xffffffff00000000u64;
2518            let maskedval = padval & mask;
2519            if maskedval != 0 {
2520                return Err(fidl::Error::NonZeroPadding {
2521                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
2522                });
2523            }
2524            fidl::decode!(fidl::encoding::Array<u8, 6>, D, &mut self.bssid, decoder, offset + 0, _depth)?;
2525            fidl::decode!(BssType, D, &mut self.bss_type, decoder, offset + 8, _depth)?;
2526            fidl::decode!(u16, D, &mut self.beacon_period, decoder, offset + 12, _depth)?;
2527            fidl::decode!(u16, D, &mut self.capability_info, decoder, offset + 14, _depth)?;
2528            fidl::decode!(
2529                fidl::encoding::UnboundedVector<u8>,
2530                D,
2531                &mut self.ies,
2532                decoder,
2533                offset + 16,
2534                _depth
2535            )?;
2536            fidl::decode!(ChannelNumber, D, &mut self.primary, decoder, offset + 32, _depth)?;
2537            fidl::decode!(ChannelBandwidth, D, &mut self.bandwidth, decoder, offset + 36, _depth)?;
2538            fidl::decode!(
2539                ChannelNumber,
2540                D,
2541                &mut self.vht_secondary_80_channel,
2542                decoder,
2543                offset + 40,
2544                _depth
2545            )?;
2546            fidl::decode!(i8, D, &mut self.rssi_dbm, decoder, offset + 42, _depth)?;
2547            fidl::decode!(i8, D, &mut self.snr_db, decoder, offset + 43, _depth)?;
2548            Ok(())
2549        }
2550    }
2551
2552    impl fidl::encoding::ValueTypeMarker for CSsid {
2553        type Borrowed<'a> = &'a Self;
2554        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2555            value
2556        }
2557    }
2558
2559    unsafe impl fidl::encoding::TypeMarker for CSsid {
2560        type Owned = Self;
2561
2562        #[inline(always)]
2563        fn inline_align(_context: fidl::encoding::Context) -> usize {
2564            1
2565        }
2566
2567        #[inline(always)]
2568        fn inline_size(_context: fidl::encoding::Context) -> usize {
2569            33
2570        }
2571        #[inline(always)]
2572        fn encode_is_copy() -> bool {
2573            true
2574        }
2575
2576        #[inline(always)]
2577        fn decode_is_copy() -> bool {
2578            true
2579        }
2580    }
2581
2582    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CSsid, D> for &CSsid {
2583        #[inline]
2584        unsafe fn encode(
2585            self,
2586            encoder: &mut fidl::encoding::Encoder<'_, D>,
2587            offset: usize,
2588            _depth: fidl::encoding::Depth,
2589        ) -> fidl::Result<()> {
2590            encoder.debug_check_bounds::<CSsid>(offset);
2591            unsafe {
2592                // Copy the object into the buffer.
2593                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2594                (buf_ptr as *mut CSsid).write_unaligned((self as *const CSsid).read());
2595                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2596                // done second because the memcpy will write garbage to these bytes.
2597            }
2598            Ok(())
2599        }
2600    }
2601    unsafe impl<
2602        D: fidl::encoding::ResourceDialect,
2603        T0: fidl::encoding::Encode<u8, D>,
2604        T1: fidl::encoding::Encode<fidl::encoding::Array<u8, 32>, D>,
2605    > fidl::encoding::Encode<CSsid, D> for (T0, T1)
2606    {
2607        #[inline]
2608        unsafe fn encode(
2609            self,
2610            encoder: &mut fidl::encoding::Encoder<'_, D>,
2611            offset: usize,
2612            depth: fidl::encoding::Depth,
2613        ) -> fidl::Result<()> {
2614            encoder.debug_check_bounds::<CSsid>(offset);
2615            // Zero out padding regions. There's no need to apply masks
2616            // because the unmasked parts will be overwritten by fields.
2617            // Write the fields.
2618            self.0.encode(encoder, offset + 0, depth)?;
2619            self.1.encode(encoder, offset + 1, depth)?;
2620            Ok(())
2621        }
2622    }
2623
2624    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CSsid {
2625        #[inline(always)]
2626        fn new_empty() -> Self {
2627            Self {
2628                len: fidl::new_empty!(u8, D),
2629                data: fidl::new_empty!(fidl::encoding::Array<u8, 32>, D),
2630            }
2631        }
2632
2633        #[inline]
2634        unsafe fn decode(
2635            &mut self,
2636            decoder: &mut fidl::encoding::Decoder<'_, D>,
2637            offset: usize,
2638            _depth: fidl::encoding::Depth,
2639        ) -> fidl::Result<()> {
2640            decoder.debug_check_bounds::<Self>(offset);
2641            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2642            // Verify that padding bytes are zero.
2643            // Copy from the buffer into the object.
2644            unsafe {
2645                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 33);
2646            }
2647            Ok(())
2648        }
2649    }
2650
2651    impl fidl::encoding::ValueTypeMarker for ChannelNumber {
2652        type Borrowed<'a> = &'a Self;
2653        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2654            value
2655        }
2656    }
2657
2658    unsafe impl fidl::encoding::TypeMarker for ChannelNumber {
2659        type Owned = Self;
2660
2661        #[inline(always)]
2662        fn inline_align(_context: fidl::encoding::Context) -> usize {
2663            1
2664        }
2665
2666        #[inline(always)]
2667        fn inline_size(_context: fidl::encoding::Context) -> usize {
2668            2
2669        }
2670    }
2671
2672    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ChannelNumber, D>
2673        for &ChannelNumber
2674    {
2675        #[inline]
2676        unsafe fn encode(
2677            self,
2678            encoder: &mut fidl::encoding::Encoder<'_, D>,
2679            offset: usize,
2680            _depth: fidl::encoding::Depth,
2681        ) -> fidl::Result<()> {
2682            encoder.debug_check_bounds::<ChannelNumber>(offset);
2683            // Delegate to tuple encoding.
2684            fidl::encoding::Encode::<ChannelNumber, D>::encode(
2685                (
2686                    <WlanBand as fidl::encoding::ValueTypeMarker>::borrow(&self.band),
2687                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.number),
2688                ),
2689                encoder,
2690                offset,
2691                _depth,
2692            )
2693        }
2694    }
2695    unsafe impl<
2696        D: fidl::encoding::ResourceDialect,
2697        T0: fidl::encoding::Encode<WlanBand, D>,
2698        T1: fidl::encoding::Encode<u8, D>,
2699    > fidl::encoding::Encode<ChannelNumber, D> for (T0, T1)
2700    {
2701        #[inline]
2702        unsafe fn encode(
2703            self,
2704            encoder: &mut fidl::encoding::Encoder<'_, D>,
2705            offset: usize,
2706            depth: fidl::encoding::Depth,
2707        ) -> fidl::Result<()> {
2708            encoder.debug_check_bounds::<ChannelNumber>(offset);
2709            // Zero out padding regions. There's no need to apply masks
2710            // because the unmasked parts will be overwritten by fields.
2711            // Write the fields.
2712            self.0.encode(encoder, offset + 0, depth)?;
2713            self.1.encode(encoder, offset + 1, depth)?;
2714            Ok(())
2715        }
2716    }
2717
2718    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ChannelNumber {
2719        #[inline(always)]
2720        fn new_empty() -> Self {
2721            Self { band: fidl::new_empty!(WlanBand, D), number: fidl::new_empty!(u8, D) }
2722        }
2723
2724        #[inline]
2725        unsafe fn decode(
2726            &mut self,
2727            decoder: &mut fidl::encoding::Decoder<'_, D>,
2728            offset: usize,
2729            _depth: fidl::encoding::Depth,
2730        ) -> fidl::Result<()> {
2731            decoder.debug_check_bounds::<Self>(offset);
2732            // Verify that padding bytes are zero.
2733            fidl::decode!(WlanBand, D, &mut self.band, decoder, offset + 0, _depth)?;
2734            fidl::decode!(u8, D, &mut self.number, decoder, offset + 1, _depth)?;
2735            Ok(())
2736        }
2737    }
2738
2739    impl fidl::encoding::ValueTypeMarker for HtCapabilities {
2740        type Borrowed<'a> = &'a Self;
2741        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2742            value
2743        }
2744    }
2745
2746    unsafe impl fidl::encoding::TypeMarker for HtCapabilities {
2747        type Owned = Self;
2748
2749        #[inline(always)]
2750        fn inline_align(_context: fidl::encoding::Context) -> usize {
2751            1
2752        }
2753
2754        #[inline(always)]
2755        fn inline_size(_context: fidl::encoding::Context) -> usize {
2756            26
2757        }
2758        #[inline(always)]
2759        fn encode_is_copy() -> bool {
2760            true
2761        }
2762
2763        #[inline(always)]
2764        fn decode_is_copy() -> bool {
2765            true
2766        }
2767    }
2768
2769    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HtCapabilities, D>
2770        for &HtCapabilities
2771    {
2772        #[inline]
2773        unsafe fn encode(
2774            self,
2775            encoder: &mut fidl::encoding::Encoder<'_, D>,
2776            offset: usize,
2777            _depth: fidl::encoding::Depth,
2778        ) -> fidl::Result<()> {
2779            encoder.debug_check_bounds::<HtCapabilities>(offset);
2780            unsafe {
2781                // Copy the object into the buffer.
2782                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2783                (buf_ptr as *mut HtCapabilities)
2784                    .write_unaligned((self as *const HtCapabilities).read());
2785                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2786                // done second because the memcpy will write garbage to these bytes.
2787            }
2788            Ok(())
2789        }
2790    }
2791    unsafe impl<
2792        D: fidl::encoding::ResourceDialect,
2793        T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 26>, D>,
2794    > fidl::encoding::Encode<HtCapabilities, D> for (T0,)
2795    {
2796        #[inline]
2797        unsafe fn encode(
2798            self,
2799            encoder: &mut fidl::encoding::Encoder<'_, D>,
2800            offset: usize,
2801            depth: fidl::encoding::Depth,
2802        ) -> fidl::Result<()> {
2803            encoder.debug_check_bounds::<HtCapabilities>(offset);
2804            // Zero out padding regions. There's no need to apply masks
2805            // because the unmasked parts will be overwritten by fields.
2806            // Write the fields.
2807            self.0.encode(encoder, offset + 0, depth)?;
2808            Ok(())
2809        }
2810    }
2811
2812    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HtCapabilities {
2813        #[inline(always)]
2814        fn new_empty() -> Self {
2815            Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 26>, D) }
2816        }
2817
2818        #[inline]
2819        unsafe fn decode(
2820            &mut self,
2821            decoder: &mut fidl::encoding::Decoder<'_, D>,
2822            offset: usize,
2823            _depth: fidl::encoding::Depth,
2824        ) -> fidl::Result<()> {
2825            decoder.debug_check_bounds::<Self>(offset);
2826            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2827            // Verify that padding bytes are zero.
2828            // Copy from the buffer into the object.
2829            unsafe {
2830                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 26);
2831            }
2832            Ok(())
2833        }
2834    }
2835
2836    impl fidl::encoding::ValueTypeMarker for HtOperation {
2837        type Borrowed<'a> = &'a Self;
2838        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2839            value
2840        }
2841    }
2842
2843    unsafe impl fidl::encoding::TypeMarker for HtOperation {
2844        type Owned = Self;
2845
2846        #[inline(always)]
2847        fn inline_align(_context: fidl::encoding::Context) -> usize {
2848            1
2849        }
2850
2851        #[inline(always)]
2852        fn inline_size(_context: fidl::encoding::Context) -> usize {
2853            22
2854        }
2855        #[inline(always)]
2856        fn encode_is_copy() -> bool {
2857            true
2858        }
2859
2860        #[inline(always)]
2861        fn decode_is_copy() -> bool {
2862            true
2863        }
2864    }
2865
2866    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HtOperation, D>
2867        for &HtOperation
2868    {
2869        #[inline]
2870        unsafe fn encode(
2871            self,
2872            encoder: &mut fidl::encoding::Encoder<'_, D>,
2873            offset: usize,
2874            _depth: fidl::encoding::Depth,
2875        ) -> fidl::Result<()> {
2876            encoder.debug_check_bounds::<HtOperation>(offset);
2877            unsafe {
2878                // Copy the object into the buffer.
2879                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2880                (buf_ptr as *mut HtOperation).write_unaligned((self as *const HtOperation).read());
2881                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2882                // done second because the memcpy will write garbage to these bytes.
2883            }
2884            Ok(())
2885        }
2886    }
2887    unsafe impl<
2888        D: fidl::encoding::ResourceDialect,
2889        T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 22>, D>,
2890    > fidl::encoding::Encode<HtOperation, D> for (T0,)
2891    {
2892        #[inline]
2893        unsafe fn encode(
2894            self,
2895            encoder: &mut fidl::encoding::Encoder<'_, D>,
2896            offset: usize,
2897            depth: fidl::encoding::Depth,
2898        ) -> fidl::Result<()> {
2899            encoder.debug_check_bounds::<HtOperation>(offset);
2900            // Zero out padding regions. There's no need to apply masks
2901            // because the unmasked parts will be overwritten by fields.
2902            // Write the fields.
2903            self.0.encode(encoder, offset + 0, depth)?;
2904            Ok(())
2905        }
2906    }
2907
2908    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HtOperation {
2909        #[inline(always)]
2910        fn new_empty() -> Self {
2911            Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 22>, D) }
2912        }
2913
2914        #[inline]
2915        unsafe fn decode(
2916            &mut self,
2917            decoder: &mut fidl::encoding::Decoder<'_, D>,
2918            offset: usize,
2919            _depth: fidl::encoding::Depth,
2920        ) -> fidl::Result<()> {
2921            decoder.debug_check_bounds::<Self>(offset);
2922            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
2923            // Verify that padding bytes are zero.
2924            // Copy from the buffer into the object.
2925            unsafe {
2926                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 22);
2927            }
2928            Ok(())
2929        }
2930    }
2931
2932    impl fidl::encoding::ValueTypeMarker for VhtCapabilities {
2933        type Borrowed<'a> = &'a Self;
2934        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2935            value
2936        }
2937    }
2938
2939    unsafe impl fidl::encoding::TypeMarker for VhtCapabilities {
2940        type Owned = Self;
2941
2942        #[inline(always)]
2943        fn inline_align(_context: fidl::encoding::Context) -> usize {
2944            1
2945        }
2946
2947        #[inline(always)]
2948        fn inline_size(_context: fidl::encoding::Context) -> usize {
2949            12
2950        }
2951        #[inline(always)]
2952        fn encode_is_copy() -> bool {
2953            true
2954        }
2955
2956        #[inline(always)]
2957        fn decode_is_copy() -> bool {
2958            true
2959        }
2960    }
2961
2962    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VhtCapabilities, D>
2963        for &VhtCapabilities
2964    {
2965        #[inline]
2966        unsafe fn encode(
2967            self,
2968            encoder: &mut fidl::encoding::Encoder<'_, D>,
2969            offset: usize,
2970            _depth: fidl::encoding::Depth,
2971        ) -> fidl::Result<()> {
2972            encoder.debug_check_bounds::<VhtCapabilities>(offset);
2973            unsafe {
2974                // Copy the object into the buffer.
2975                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
2976                (buf_ptr as *mut VhtCapabilities)
2977                    .write_unaligned((self as *const VhtCapabilities).read());
2978                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
2979                // done second because the memcpy will write garbage to these bytes.
2980            }
2981            Ok(())
2982        }
2983    }
2984    unsafe impl<
2985        D: fidl::encoding::ResourceDialect,
2986        T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 12>, D>,
2987    > fidl::encoding::Encode<VhtCapabilities, D> for (T0,)
2988    {
2989        #[inline]
2990        unsafe fn encode(
2991            self,
2992            encoder: &mut fidl::encoding::Encoder<'_, D>,
2993            offset: usize,
2994            depth: fidl::encoding::Depth,
2995        ) -> fidl::Result<()> {
2996            encoder.debug_check_bounds::<VhtCapabilities>(offset);
2997            // Zero out padding regions. There's no need to apply masks
2998            // because the unmasked parts will be overwritten by fields.
2999            // Write the fields.
3000            self.0.encode(encoder, offset + 0, depth)?;
3001            Ok(())
3002        }
3003    }
3004
3005    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VhtCapabilities {
3006        #[inline(always)]
3007        fn new_empty() -> Self {
3008            Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 12>, D) }
3009        }
3010
3011        #[inline]
3012        unsafe fn decode(
3013            &mut self,
3014            decoder: &mut fidl::encoding::Decoder<'_, D>,
3015            offset: usize,
3016            _depth: fidl::encoding::Depth,
3017        ) -> fidl::Result<()> {
3018            decoder.debug_check_bounds::<Self>(offset);
3019            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3020            // Verify that padding bytes are zero.
3021            // Copy from the buffer into the object.
3022            unsafe {
3023                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
3024            }
3025            Ok(())
3026        }
3027    }
3028
3029    impl fidl::encoding::ValueTypeMarker for VhtOperation {
3030        type Borrowed<'a> = &'a Self;
3031        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3032            value
3033        }
3034    }
3035
3036    unsafe impl fidl::encoding::TypeMarker for VhtOperation {
3037        type Owned = Self;
3038
3039        #[inline(always)]
3040        fn inline_align(_context: fidl::encoding::Context) -> usize {
3041            1
3042        }
3043
3044        #[inline(always)]
3045        fn inline_size(_context: fidl::encoding::Context) -> usize {
3046            5
3047        }
3048        #[inline(always)]
3049        fn encode_is_copy() -> bool {
3050            true
3051        }
3052
3053        #[inline(always)]
3054        fn decode_is_copy() -> bool {
3055            true
3056        }
3057    }
3058
3059    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VhtOperation, D>
3060        for &VhtOperation
3061    {
3062        #[inline]
3063        unsafe fn encode(
3064            self,
3065            encoder: &mut fidl::encoding::Encoder<'_, D>,
3066            offset: usize,
3067            _depth: fidl::encoding::Depth,
3068        ) -> fidl::Result<()> {
3069            encoder.debug_check_bounds::<VhtOperation>(offset);
3070            unsafe {
3071                // Copy the object into the buffer.
3072                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
3073                (buf_ptr as *mut VhtOperation)
3074                    .write_unaligned((self as *const VhtOperation).read());
3075                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
3076                // done second because the memcpy will write garbage to these bytes.
3077            }
3078            Ok(())
3079        }
3080    }
3081    unsafe impl<
3082        D: fidl::encoding::ResourceDialect,
3083        T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 5>, D>,
3084    > fidl::encoding::Encode<VhtOperation, D> for (T0,)
3085    {
3086        #[inline]
3087        unsafe fn encode(
3088            self,
3089            encoder: &mut fidl::encoding::Encoder<'_, D>,
3090            offset: usize,
3091            depth: fidl::encoding::Depth,
3092        ) -> fidl::Result<()> {
3093            encoder.debug_check_bounds::<VhtOperation>(offset);
3094            // Zero out padding regions. There's no need to apply masks
3095            // because the unmasked parts will be overwritten by fields.
3096            // Write the fields.
3097            self.0.encode(encoder, offset + 0, depth)?;
3098            Ok(())
3099        }
3100    }
3101
3102    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VhtOperation {
3103        #[inline(always)]
3104        fn new_empty() -> Self {
3105            Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 5>, D) }
3106        }
3107
3108        #[inline]
3109        unsafe fn decode(
3110            &mut self,
3111            decoder: &mut fidl::encoding::Decoder<'_, D>,
3112            offset: usize,
3113            _depth: fidl::encoding::Depth,
3114        ) -> fidl::Result<()> {
3115            decoder.debug_check_bounds::<Self>(offset);
3116            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
3117            // Verify that padding bytes are zero.
3118            // Copy from the buffer into the object.
3119            unsafe {
3120                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 5);
3121            }
3122            Ok(())
3123        }
3124    }
3125
3126    impl fidl::encoding::ValueTypeMarker for WlanChannel {
3127        type Borrowed<'a> = &'a Self;
3128        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3129            value
3130        }
3131    }
3132
3133    unsafe impl fidl::encoding::TypeMarker for WlanChannel {
3134        type Owned = Self;
3135
3136        #[inline(always)]
3137        fn inline_align(_context: fidl::encoding::Context) -> usize {
3138            4
3139        }
3140
3141        #[inline(always)]
3142        fn inline_size(_context: fidl::encoding::Context) -> usize {
3143            12
3144        }
3145    }
3146
3147    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WlanChannel, D>
3148        for &WlanChannel
3149    {
3150        #[inline]
3151        unsafe fn encode(
3152            self,
3153            encoder: &mut fidl::encoding::Encoder<'_, D>,
3154            offset: usize,
3155            _depth: fidl::encoding::Depth,
3156        ) -> fidl::Result<()> {
3157            encoder.debug_check_bounds::<WlanChannel>(offset);
3158            // Delegate to tuple encoding.
3159            fidl::encoding::Encode::<WlanChannel, D>::encode(
3160                (
3161                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.primary),
3162                    <ChannelBandwidth as fidl::encoding::ValueTypeMarker>::borrow(&self.cbw),
3163                    <u8 as fidl::encoding::ValueTypeMarker>::borrow(&self.secondary80),
3164                ),
3165                encoder,
3166                offset,
3167                _depth,
3168            )
3169        }
3170    }
3171    unsafe impl<
3172        D: fidl::encoding::ResourceDialect,
3173        T0: fidl::encoding::Encode<u8, D>,
3174        T1: fidl::encoding::Encode<ChannelBandwidth, D>,
3175        T2: fidl::encoding::Encode<u8, D>,
3176    > fidl::encoding::Encode<WlanChannel, D> for (T0, T1, T2)
3177    {
3178        #[inline]
3179        unsafe fn encode(
3180            self,
3181            encoder: &mut fidl::encoding::Encoder<'_, D>,
3182            offset: usize,
3183            depth: fidl::encoding::Depth,
3184        ) -> fidl::Result<()> {
3185            encoder.debug_check_bounds::<WlanChannel>(offset);
3186            // Zero out padding regions. There's no need to apply masks
3187            // because the unmasked parts will be overwritten by fields.
3188            unsafe {
3189                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
3190                (ptr as *mut u32).write_unaligned(0);
3191            }
3192            unsafe {
3193                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
3194                (ptr as *mut u32).write_unaligned(0);
3195            }
3196            // Write the fields.
3197            self.0.encode(encoder, offset + 0, depth)?;
3198            self.1.encode(encoder, offset + 4, depth)?;
3199            self.2.encode(encoder, offset + 8, depth)?;
3200            Ok(())
3201        }
3202    }
3203
3204    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanChannel {
3205        #[inline(always)]
3206        fn new_empty() -> Self {
3207            Self {
3208                primary: fidl::new_empty!(u8, D),
3209                cbw: fidl::new_empty!(ChannelBandwidth, D),
3210                secondary80: fidl::new_empty!(u8, D),
3211            }
3212        }
3213
3214        #[inline]
3215        unsafe fn decode(
3216            &mut self,
3217            decoder: &mut fidl::encoding::Decoder<'_, D>,
3218            offset: usize,
3219            _depth: fidl::encoding::Depth,
3220        ) -> fidl::Result<()> {
3221            decoder.debug_check_bounds::<Self>(offset);
3222            // Verify that padding bytes are zero.
3223            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
3224            let padval = unsafe { (ptr as *const u32).read_unaligned() };
3225            let mask = 0xffffff00u32;
3226            let maskedval = padval & mask;
3227            if maskedval != 0 {
3228                return Err(fidl::Error::NonZeroPadding {
3229                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
3230                });
3231            }
3232            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
3233            let padval = unsafe { (ptr as *const u32).read_unaligned() };
3234            let mask = 0xffffff00u32;
3235            let maskedval = padval & mask;
3236            if maskedval != 0 {
3237                return Err(fidl::Error::NonZeroPadding {
3238                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
3239                });
3240            }
3241            fidl::decode!(u8, D, &mut self.primary, decoder, offset + 0, _depth)?;
3242            fidl::decode!(ChannelBandwidth, D, &mut self.cbw, decoder, offset + 4, _depth)?;
3243            fidl::decode!(u8, D, &mut self.secondary80, decoder, offset + 8, _depth)?;
3244            Ok(())
3245        }
3246    }
3247
3248    impl SetKeyDescriptor {
3249        #[inline(always)]
3250        fn max_ordinal_present(&self) -> u64 {
3251            if let Some(_) = self.cipher_type {
3252                return 7;
3253            }
3254            if let Some(_) = self.cipher_oui {
3255                return 6;
3256            }
3257            if let Some(_) = self.rsc {
3258                return 5;
3259            }
3260            if let Some(_) = self.peer_addr {
3261                return 4;
3262            }
3263            if let Some(_) = self.key_type {
3264                return 3;
3265            }
3266            if let Some(_) = self.key_id {
3267                return 2;
3268            }
3269            if let Some(_) = self.key {
3270                return 1;
3271            }
3272            0
3273        }
3274    }
3275
3276    impl fidl::encoding::ValueTypeMarker for SetKeyDescriptor {
3277        type Borrowed<'a> = &'a Self;
3278        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3279            value
3280        }
3281    }
3282
3283    unsafe impl fidl::encoding::TypeMarker for SetKeyDescriptor {
3284        type Owned = Self;
3285
3286        #[inline(always)]
3287        fn inline_align(_context: fidl::encoding::Context) -> usize {
3288            8
3289        }
3290
3291        #[inline(always)]
3292        fn inline_size(_context: fidl::encoding::Context) -> usize {
3293            16
3294        }
3295    }
3296
3297    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SetKeyDescriptor, D>
3298        for &SetKeyDescriptor
3299    {
3300        unsafe fn encode(
3301            self,
3302            encoder: &mut fidl::encoding::Encoder<'_, D>,
3303            offset: usize,
3304            mut depth: fidl::encoding::Depth,
3305        ) -> fidl::Result<()> {
3306            encoder.debug_check_bounds::<SetKeyDescriptor>(offset);
3307            // Vector header
3308            let max_ordinal: u64 = self.max_ordinal_present();
3309            encoder.write_num(max_ordinal, offset);
3310            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3311            // Calling encoder.out_of_line_offset(0) is not allowed.
3312            if max_ordinal == 0 {
3313                return Ok(());
3314            }
3315            depth.increment()?;
3316            let envelope_size = 8;
3317            let bytes_len = max_ordinal as usize * envelope_size;
3318            #[allow(unused_variables)]
3319            let offset = encoder.out_of_line_offset(bytes_len);
3320            let mut _prev_end_offset: usize = 0;
3321            if 1 > max_ordinal {
3322                return Ok(());
3323            }
3324
3325            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3326            // are envelope_size bytes.
3327            let cur_offset: usize = (1 - 1) * envelope_size;
3328
3329            // Zero reserved fields.
3330            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3331
3332            // Safety:
3333            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3334            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3335            //   envelope_size bytes, there is always sufficient room.
3336            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32>, D>(
3337                self.key.as_ref().map(
3338                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
3339                ),
3340                encoder,
3341                offset + cur_offset,
3342                depth,
3343            )?;
3344
3345            _prev_end_offset = cur_offset + envelope_size;
3346            if 2 > max_ordinal {
3347                return Ok(());
3348            }
3349
3350            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3351            // are envelope_size bytes.
3352            let cur_offset: usize = (2 - 1) * envelope_size;
3353
3354            // Zero reserved fields.
3355            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3356
3357            // Safety:
3358            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3359            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3360            //   envelope_size bytes, there is always sufficient room.
3361            fidl::encoding::encode_in_envelope_optional::<u16, D>(
3362                self.key_id.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
3363                encoder,
3364                offset + cur_offset,
3365                depth,
3366            )?;
3367
3368            _prev_end_offset = cur_offset + envelope_size;
3369            if 3 > max_ordinal {
3370                return Ok(());
3371            }
3372
3373            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3374            // are envelope_size bytes.
3375            let cur_offset: usize = (3 - 1) * envelope_size;
3376
3377            // Zero reserved fields.
3378            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3379
3380            // Safety:
3381            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3382            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3383            //   envelope_size bytes, there is always sufficient room.
3384            fidl::encoding::encode_in_envelope_optional::<KeyType, D>(
3385                self.key_type.as_ref().map(<KeyType as fidl::encoding::ValueTypeMarker>::borrow),
3386                encoder,
3387                offset + cur_offset,
3388                depth,
3389            )?;
3390
3391            _prev_end_offset = cur_offset + envelope_size;
3392            if 4 > max_ordinal {
3393                return Ok(());
3394            }
3395
3396            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3397            // are envelope_size bytes.
3398            let cur_offset: usize = (4 - 1) * envelope_size;
3399
3400            // Zero reserved fields.
3401            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3402
3403            // Safety:
3404            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3405            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3406            //   envelope_size bytes, there is always sufficient room.
3407            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 6>, D>(
3408                self.peer_addr
3409                    .as_ref()
3410                    .map(<fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow),
3411                encoder,
3412                offset + cur_offset,
3413                depth,
3414            )?;
3415
3416            _prev_end_offset = cur_offset + envelope_size;
3417            if 5 > max_ordinal {
3418                return Ok(());
3419            }
3420
3421            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3422            // are envelope_size bytes.
3423            let cur_offset: usize = (5 - 1) * envelope_size;
3424
3425            // Zero reserved fields.
3426            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3427
3428            // Safety:
3429            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3430            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3431            //   envelope_size bytes, there is always sufficient room.
3432            fidl::encoding::encode_in_envelope_optional::<u64, D>(
3433                self.rsc.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
3434                encoder,
3435                offset + cur_offset,
3436                depth,
3437            )?;
3438
3439            _prev_end_offset = cur_offset + envelope_size;
3440            if 6 > max_ordinal {
3441                return Ok(());
3442            }
3443
3444            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3445            // are envelope_size bytes.
3446            let cur_offset: usize = (6 - 1) * envelope_size;
3447
3448            // Zero reserved fields.
3449            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3450
3451            // Safety:
3452            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3453            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3454            //   envelope_size bytes, there is always sufficient room.
3455            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 3>, D>(
3456                self.cipher_oui
3457                    .as_ref()
3458                    .map(<fidl::encoding::Array<u8, 3> as fidl::encoding::ValueTypeMarker>::borrow),
3459                encoder,
3460                offset + cur_offset,
3461                depth,
3462            )?;
3463
3464            _prev_end_offset = cur_offset + envelope_size;
3465            if 7 > max_ordinal {
3466                return Ok(());
3467            }
3468
3469            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3470            // are envelope_size bytes.
3471            let cur_offset: usize = (7 - 1) * envelope_size;
3472
3473            // Zero reserved fields.
3474            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3475
3476            // Safety:
3477            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3478            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3479            //   envelope_size bytes, there is always sufficient room.
3480            fidl::encoding::encode_in_envelope_optional::<CipherSuiteType, D>(
3481                self.cipher_type
3482                    .as_ref()
3483                    .map(<CipherSuiteType as fidl::encoding::ValueTypeMarker>::borrow),
3484                encoder,
3485                offset + cur_offset,
3486                depth,
3487            )?;
3488
3489            _prev_end_offset = cur_offset + envelope_size;
3490
3491            Ok(())
3492        }
3493    }
3494
3495    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SetKeyDescriptor {
3496        #[inline(always)]
3497        fn new_empty() -> Self {
3498            Self::default()
3499        }
3500
3501        unsafe fn decode(
3502            &mut self,
3503            decoder: &mut fidl::encoding::Decoder<'_, D>,
3504            offset: usize,
3505            mut depth: fidl::encoding::Depth,
3506        ) -> fidl::Result<()> {
3507            decoder.debug_check_bounds::<Self>(offset);
3508            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3509                None => return Err(fidl::Error::NotNullable),
3510                Some(len) => len,
3511            };
3512            // Calling decoder.out_of_line_offset(0) is not allowed.
3513            if len == 0 {
3514                return Ok(());
3515            };
3516            depth.increment()?;
3517            let envelope_size = 8;
3518            let bytes_len = len * envelope_size;
3519            let offset = decoder.out_of_line_offset(bytes_len)?;
3520            // Decode the envelope for each type.
3521            let mut _next_ordinal_to_read = 0;
3522            let mut next_offset = offset;
3523            let end_offset = offset + bytes_len;
3524            _next_ordinal_to_read += 1;
3525            if next_offset >= end_offset {
3526                return Ok(());
3527            }
3528
3529            // Decode unknown envelopes for gaps in ordinals.
3530            while _next_ordinal_to_read < 1 {
3531                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3532                _next_ordinal_to_read += 1;
3533                next_offset += envelope_size;
3534            }
3535
3536            let next_out_of_line = decoder.next_out_of_line();
3537            let handles_before = decoder.remaining_handles();
3538            if let Some((inlined, num_bytes, num_handles)) =
3539                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3540            {
3541                let member_inline_size =
3542                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
3543                        decoder.context,
3544                    );
3545                if inlined != (member_inline_size <= 4) {
3546                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3547                }
3548                let inner_offset;
3549                let mut inner_depth = depth.clone();
3550                if inlined {
3551                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3552                    inner_offset = next_offset;
3553                } else {
3554                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3555                    inner_depth.increment()?;
3556                }
3557                let val_ref = self
3558                    .key
3559                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D));
3560                fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
3561                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3562                {
3563                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3564                }
3565                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3566                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3567                }
3568            }
3569
3570            next_offset += envelope_size;
3571            _next_ordinal_to_read += 1;
3572            if next_offset >= end_offset {
3573                return Ok(());
3574            }
3575
3576            // Decode unknown envelopes for gaps in ordinals.
3577            while _next_ordinal_to_read < 2 {
3578                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3579                _next_ordinal_to_read += 1;
3580                next_offset += envelope_size;
3581            }
3582
3583            let next_out_of_line = decoder.next_out_of_line();
3584            let handles_before = decoder.remaining_handles();
3585            if let Some((inlined, num_bytes, num_handles)) =
3586                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3587            {
3588                let member_inline_size =
3589                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3590                if inlined != (member_inline_size <= 4) {
3591                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3592                }
3593                let inner_offset;
3594                let mut inner_depth = depth.clone();
3595                if inlined {
3596                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3597                    inner_offset = next_offset;
3598                } else {
3599                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3600                    inner_depth.increment()?;
3601                }
3602                let val_ref = self.key_id.get_or_insert_with(|| fidl::new_empty!(u16, D));
3603                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
3604                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3605                {
3606                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3607                }
3608                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3609                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3610                }
3611            }
3612
3613            next_offset += envelope_size;
3614            _next_ordinal_to_read += 1;
3615            if next_offset >= end_offset {
3616                return Ok(());
3617            }
3618
3619            // Decode unknown envelopes for gaps in ordinals.
3620            while _next_ordinal_to_read < 3 {
3621                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3622                _next_ordinal_to_read += 1;
3623                next_offset += envelope_size;
3624            }
3625
3626            let next_out_of_line = decoder.next_out_of_line();
3627            let handles_before = decoder.remaining_handles();
3628            if let Some((inlined, num_bytes, num_handles)) =
3629                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3630            {
3631                let member_inline_size =
3632                    <KeyType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3633                if inlined != (member_inline_size <= 4) {
3634                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3635                }
3636                let inner_offset;
3637                let mut inner_depth = depth.clone();
3638                if inlined {
3639                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3640                    inner_offset = next_offset;
3641                } else {
3642                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3643                    inner_depth.increment()?;
3644                }
3645                let val_ref = self.key_type.get_or_insert_with(|| fidl::new_empty!(KeyType, D));
3646                fidl::decode!(KeyType, D, val_ref, decoder, inner_offset, inner_depth)?;
3647                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3648                {
3649                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3650                }
3651                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3652                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3653                }
3654            }
3655
3656            next_offset += envelope_size;
3657            _next_ordinal_to_read += 1;
3658            if next_offset >= end_offset {
3659                return Ok(());
3660            }
3661
3662            // Decode unknown envelopes for gaps in ordinals.
3663            while _next_ordinal_to_read < 4 {
3664                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3665                _next_ordinal_to_read += 1;
3666                next_offset += envelope_size;
3667            }
3668
3669            let next_out_of_line = decoder.next_out_of_line();
3670            let handles_before = decoder.remaining_handles();
3671            if let Some((inlined, num_bytes, num_handles)) =
3672                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3673            {
3674                let member_inline_size =
3675                    <fidl::encoding::Array<u8, 6> as fidl::encoding::TypeMarker>::inline_size(
3676                        decoder.context,
3677                    );
3678                if inlined != (member_inline_size <= 4) {
3679                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3680                }
3681                let inner_offset;
3682                let mut inner_depth = depth.clone();
3683                if inlined {
3684                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3685                    inner_offset = next_offset;
3686                } else {
3687                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3688                    inner_depth.increment()?;
3689                }
3690                let val_ref = self
3691                    .peer_addr
3692                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 6>, D));
3693                fidl::decode!(fidl::encoding::Array<u8, 6>, D, val_ref, decoder, inner_offset, inner_depth)?;
3694                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3695                {
3696                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3697                }
3698                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3699                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3700                }
3701            }
3702
3703            next_offset += envelope_size;
3704            _next_ordinal_to_read += 1;
3705            if next_offset >= end_offset {
3706                return Ok(());
3707            }
3708
3709            // Decode unknown envelopes for gaps in ordinals.
3710            while _next_ordinal_to_read < 5 {
3711                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3712                _next_ordinal_to_read += 1;
3713                next_offset += envelope_size;
3714            }
3715
3716            let next_out_of_line = decoder.next_out_of_line();
3717            let handles_before = decoder.remaining_handles();
3718            if let Some((inlined, num_bytes, num_handles)) =
3719                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3720            {
3721                let member_inline_size =
3722                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3723                if inlined != (member_inline_size <= 4) {
3724                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3725                }
3726                let inner_offset;
3727                let mut inner_depth = depth.clone();
3728                if inlined {
3729                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3730                    inner_offset = next_offset;
3731                } else {
3732                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3733                    inner_depth.increment()?;
3734                }
3735                let val_ref = self.rsc.get_or_insert_with(|| fidl::new_empty!(u64, D));
3736                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
3737                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3738                {
3739                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3740                }
3741                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3742                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3743                }
3744            }
3745
3746            next_offset += envelope_size;
3747            _next_ordinal_to_read += 1;
3748            if next_offset >= end_offset {
3749                return Ok(());
3750            }
3751
3752            // Decode unknown envelopes for gaps in ordinals.
3753            while _next_ordinal_to_read < 6 {
3754                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3755                _next_ordinal_to_read += 1;
3756                next_offset += envelope_size;
3757            }
3758
3759            let next_out_of_line = decoder.next_out_of_line();
3760            let handles_before = decoder.remaining_handles();
3761            if let Some((inlined, num_bytes, num_handles)) =
3762                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3763            {
3764                let member_inline_size =
3765                    <fidl::encoding::Array<u8, 3> as fidl::encoding::TypeMarker>::inline_size(
3766                        decoder.context,
3767                    );
3768                if inlined != (member_inline_size <= 4) {
3769                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3770                }
3771                let inner_offset;
3772                let mut inner_depth = depth.clone();
3773                if inlined {
3774                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3775                    inner_offset = next_offset;
3776                } else {
3777                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3778                    inner_depth.increment()?;
3779                }
3780                let val_ref = self
3781                    .cipher_oui
3782                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 3>, D));
3783                fidl::decode!(fidl::encoding::Array<u8, 3>, D, val_ref, decoder, inner_offset, inner_depth)?;
3784                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3785                {
3786                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3787                }
3788                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3789                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3790                }
3791            }
3792
3793            next_offset += envelope_size;
3794            _next_ordinal_to_read += 1;
3795            if next_offset >= end_offset {
3796                return Ok(());
3797            }
3798
3799            // Decode unknown envelopes for gaps in ordinals.
3800            while _next_ordinal_to_read < 7 {
3801                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3802                _next_ordinal_to_read += 1;
3803                next_offset += envelope_size;
3804            }
3805
3806            let next_out_of_line = decoder.next_out_of_line();
3807            let handles_before = decoder.remaining_handles();
3808            if let Some((inlined, num_bytes, num_handles)) =
3809                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3810            {
3811                let member_inline_size =
3812                    <CipherSuiteType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3813                if inlined != (member_inline_size <= 4) {
3814                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3815                }
3816                let inner_offset;
3817                let mut inner_depth = depth.clone();
3818                if inlined {
3819                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3820                    inner_offset = next_offset;
3821                } else {
3822                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3823                    inner_depth.increment()?;
3824                }
3825                let val_ref =
3826                    self.cipher_type.get_or_insert_with(|| fidl::new_empty!(CipherSuiteType, D));
3827                fidl::decode!(CipherSuiteType, D, val_ref, decoder, inner_offset, inner_depth)?;
3828                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3829                {
3830                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3831                }
3832                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3833                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3834                }
3835            }
3836
3837            next_offset += envelope_size;
3838
3839            // Decode the remaining unknown envelopes.
3840            while next_offset < end_offset {
3841                _next_ordinal_to_read += 1;
3842                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3843                next_offset += envelope_size;
3844            }
3845
3846            Ok(())
3847        }
3848    }
3849}