fidl_fuchsia_wlan_ieee80211__common/
fidl_fuchsia_wlan_ieee80211__common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
8use futures::future::{self, MaybeDone, TryFutureExt};
9use zx_status;
10
11pub type MacAddr = [u8; 6];
12
13pub type Ssid = Vec<u8>;
14
15pub const CCMP_128_MIC_LEN: u32 = 8;
16
17pub const CCMP_256_MIC_LEN: u32 = 16;
18
19/// IEEE Std 802.11-2016 12.5.3.2
20pub const CCMP_HDR_LEN: u32 = 8;
21
22pub const CCMP_PN_LEN: u32 = 6;
23
24pub const HT_CAP_LEN: u8 = 26;
25
26pub const HT_OP_LEN: u8 = 22;
27
28pub const MAC_ADDR_LEN: u8 = 6;
29
30pub const MAX_KEY_LEN: u8 = 32;
31
32/// IEEE Std 802.11-2016, 9.4.2.99
33pub const MAX_MESH_ID_BYTE_LEN: u8 = 32;
34
35/// IEEE Std 802.11-2016, 9.3.3.2
36pub const MAX_MGMT_FRAME_MAC_HEADER_BYTE_LEN: u8 = 28;
37
38/// IEEE Std 802.11-2016, 9.2.4.7
39pub const MAX_MMPDU_BYTE_LEN: u16 = 2304;
40
41/// IEEE Std 802.11-2016, 9.4.2.2
42/// The maximum length of an SSID is 32 bytes, even when the SSID should be
43/// interpreted using UTF-8 encoding (see Table 9-135). While every length in
44/// the 802.11 standard is byte oriented, the word BYTE is included in the
45/// name of this constant to emphasize the importance that it not be applied
46/// to the length of a UTF-8 encoded string.
47pub const MAX_SSID_BYTE_LEN: u8 = 32;
48
49pub const MAX_SUPPORTED_BASIC_RATES: u8 = 12;
50
51/// The limit on the number of channels in a list of unique channel numbers is 256
52/// since a channel number in IEEE 802.11-2016 cannot exceed one octet. See
53/// IEEE 802.11-2016 9.4.2.18 Supported Channels element for an example element
54/// that assumes a channel number does not exceed one octet.
55pub const MAX_UNIQUE_CHANNEL_NUMBERS: u16 = 256;
56
57pub const MAX_VHT_MPDU_BYTE_LEN_0: u16 = 3895;
58
59pub const MAX_VHT_MPDU_BYTE_LEN_1: u16 = 7991;
60
61pub const MAX_VHT_MPDU_BYTE_LEN_2: u16 = 11454;
62
63pub const OUI_LEN: u8 = 3;
64
65/// The limit on the number of SSIDs is 84 because an SSID List IE can contain no
66/// more than 84 one byte SSIDs. (Specifying a zero byte SSID in an SSID List with
67/// more than one SSID is valid but unnecessary since it is the wildcard SSID.)
68pub const SSID_LIST_MAX: u8 = 84;
69
70/// IEEE Std 802.11-2016, 9.2.4.5
71pub const TIDS_MAX: u32 = 16;
72
73pub const VHT_CAP_LEN: u8 = 12;
74
75pub const VHT_OP_LEN: u8 = 5;
76
77pub const WLAN_IE_BODY_MAX_LEN: u32 = 255;
78
79/// IEEE Std 802.11-2016, 9.4.2.25.1
80/// IEEE mentions that an element body maximum length is 255 octets in the RSN element
81/// section, but not in a dedicated section.
82/// Since the IE header is two octets, the whole IE max length is 257 octets.
83pub const WLAN_IE_MAX_LEN: u32 = 257;
84
85/// IEEE Std 802.11-2016, Table 9-19
86pub const WLAN_MSDU_MAX_LEN: u32 = 2304;
87
88/// IEEE Std 802.11-2016, 9.4.2.25.2
89#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
90pub enum CipherSuiteType {
91    UseGroup,
92    Wep40,
93    Tkip,
94    Reserved3,
95    Ccmp128,
96    Wep104,
97    BipCmac128,
98    GroupAddressedNotAllowed,
99    Gcmp128,
100    Gcmp256,
101    Ccmp256,
102    BipGmac128,
103    BipGmac256,
104    BipCmac256,
105    Reserved14To255,
106    #[doc(hidden)]
107    __SourceBreaking {
108        unknown_ordinal: u32,
109    },
110}
111
112/// Pattern that matches an unknown `CipherSuiteType` member.
113#[macro_export]
114macro_rules! CipherSuiteTypeUnknown {
115    () => {
116        _
117    };
118}
119
120impl CipherSuiteType {
121    #[inline]
122    pub fn from_primitive(prim: u32) -> Option<Self> {
123        match prim {
124            0 => Some(Self::UseGroup),
125            1 => Some(Self::Wep40),
126            2 => Some(Self::Tkip),
127            3 => Some(Self::Reserved3),
128            4 => Some(Self::Ccmp128),
129            5 => Some(Self::Wep104),
130            6 => Some(Self::BipCmac128),
131            7 => Some(Self::GroupAddressedNotAllowed),
132            8 => Some(Self::Gcmp128),
133            9 => Some(Self::Gcmp256),
134            10 => Some(Self::Ccmp256),
135            11 => Some(Self::BipGmac128),
136            12 => Some(Self::BipGmac256),
137            13 => Some(Self::BipCmac256),
138            14 => Some(Self::Reserved14To255),
139            _ => None,
140        }
141    }
142
143    #[inline]
144    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
145        match prim {
146            0 => Self::UseGroup,
147            1 => Self::Wep40,
148            2 => Self::Tkip,
149            3 => Self::Reserved3,
150            4 => Self::Ccmp128,
151            5 => Self::Wep104,
152            6 => Self::BipCmac128,
153            7 => Self::GroupAddressedNotAllowed,
154            8 => Self::Gcmp128,
155            9 => Self::Gcmp256,
156            10 => Self::Ccmp256,
157            11 => Self::BipGmac128,
158            12 => Self::BipGmac256,
159            13 => Self::BipCmac256,
160            14 => Self::Reserved14To255,
161            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
162        }
163    }
164
165    #[inline]
166    pub fn unknown() -> Self {
167        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
168    }
169
170    #[inline]
171    pub const fn into_primitive(self) -> u32 {
172        match self {
173            Self::UseGroup => 0,
174            Self::Wep40 => 1,
175            Self::Tkip => 2,
176            Self::Reserved3 => 3,
177            Self::Ccmp128 => 4,
178            Self::Wep104 => 5,
179            Self::BipCmac128 => 6,
180            Self::GroupAddressedNotAllowed => 7,
181            Self::Gcmp128 => 8,
182            Self::Gcmp256 => 9,
183            Self::Ccmp256 => 10,
184            Self::BipGmac128 => 11,
185            Self::BipGmac256 => 12,
186            Self::BipCmac256 => 13,
187            Self::Reserved14To255 => 14,
188            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
189        }
190    }
191
192    #[inline]
193    pub fn is_unknown(&self) -> bool {
194        match self {
195            Self::__SourceBreaking { unknown_ordinal: _ } => true,
196            _ => false,
197        }
198    }
199}
200
201#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
202pub enum KeyType {
203    Pairwise,
204    Group,
205    Igtk,
206    Peer,
207    #[doc(hidden)]
208    __SourceBreaking {
209        unknown_ordinal: u8,
210    },
211}
212
213/// Pattern that matches an unknown `KeyType` member.
214#[macro_export]
215macro_rules! KeyTypeUnknown {
216    () => {
217        _
218    };
219}
220
221impl KeyType {
222    #[inline]
223    pub fn from_primitive(prim: u8) -> Option<Self> {
224        match prim {
225            1 => Some(Self::Pairwise),
226            2 => Some(Self::Group),
227            3 => Some(Self::Igtk),
228            4 => Some(Self::Peer),
229            _ => None,
230        }
231    }
232
233    #[inline]
234    pub fn from_primitive_allow_unknown(prim: u8) -> Self {
235        match prim {
236            1 => Self::Pairwise,
237            2 => Self::Group,
238            3 => Self::Igtk,
239            4 => Self::Peer,
240            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
241        }
242    }
243
244    #[inline]
245    pub fn unknown() -> Self {
246        Self::__SourceBreaking { unknown_ordinal: 0xff }
247    }
248
249    #[inline]
250    pub const fn into_primitive(self) -> u8 {
251        match self {
252            Self::Pairwise => 1,
253            Self::Group => 2,
254            Self::Igtk => 3,
255            Self::Peer => 4,
256            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
257        }
258    }
259
260    #[inline]
261    pub fn is_unknown(&self) -> bool {
262        match self {
263            Self::__SourceBreaking { unknown_ordinal: _ } => true,
264            _ => false,
265        }
266    }
267}
268
269/// 802.11 reason codes.  These values are common throughout the standard.
270/// IEEE Std 802.11-2016, 9.4.1.7, Table 9-45
271#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
272pub enum ReasonCode {
273    UnspecifiedReason,
274    InvalidAuthentication,
275    LeavingNetworkDeauth,
276    ReasonInactivity,
277    NoMoreStas,
278    InvalidClass2Frame,
279    InvalidClass3Frame,
280    LeavingNetworkDisassoc,
281    NotAuthenticated,
282    UnacceptablePowerCapability,
283    UnacceptableSupportedChannels,
284    BssTransitionDisassoc,
285    ReasonInvalidElement,
286    MicFailure,
287    /// 15 is named "4WAY_HANDSHAKE_TIMEOUT" in 802.11-2016.
288    FourwayHandshakeTimeout,
289    GkHandshakeTimeout,
290    HandshakeElementMismatch,
291    ReasonInvalidGroupCipher,
292    ReasonInvalidPairwiseCipher,
293    ReasonInvalidAkmp,
294    UnsupportedRsneVersion,
295    InvalidRsneCapabilities,
296    /// 23 is named "802_1_X_AUTH_FAILED" in 802.11-2016.
297    Ieee8021XAuthFailed,
298    ReasonCipherOutOfPolicy,
299    TdlsPeerUnreachable,
300    TdlsUnspecifiedReason,
301    SspRequestedDisassoc,
302    NoSspRoamingAgreement,
303    BadCipherOrAkm,
304    NotAuthorizedThisLocation,
305    ServiceChangePrecludesTs,
306    UnspecifiedQosReason,
307    NotEnoughBandwidth,
308    MissingAcks,
309    ExceededTxop,
310    StaLeaving,
311    /// 37 is assigned to multiple names "END_TS", "END_BA", and "END_DLS" in 802.11-2016.
312    EndTsBaDls,
313    /// 38 is assigned to multiple names "UNKNOWN_TS" and "UNKNOWN_BA" in 802.11-2016.
314    UnknownTsBa,
315    Timeout,
316    PeerkeyMismatch,
317    PeerInitiated,
318    ApInitiated,
319    ReasonInvalidFtActionFrameCount,
320    ReasonInvalidPmkid,
321    ReasonInvalidMde,
322    ReasonInvalidFte,
323    MeshPeeringCanceled,
324    MeshMaxPeers,
325    MeshConfigurationPolicyViolation,
326    MeshCloseRcvd,
327    MeshMaxRetries,
328    MeshConfirmTimeout,
329    MeshInvalidGtk,
330    MeshInconsistentParameters,
331    MeshInvalidSecurityCapability,
332    MeshPathErrorNoProxyInformation,
333    MeshPathErrorNoForwardingInformation,
334    MeshPathErrorDestinationUnreachable,
335    MacAddressAlreadyExistsInMbss,
336    MeshChannelSwitchRegulatoryRequirements,
337    MeshChannelSwitchUnspecified,
338    /// -----
339    /// Values 67 to 127 are reserved by the IEEE protocol, and
340    /// values 128 to 65535 are reserved for platform use.
341    /// -----
342    /// MLME lost the link, usually caused by loss of signal with the AP.
343    MlmeLinkFailed,
344    /// Driver detected a stalled Rx path in FW.
345    FwRxStalled,
346    /// Driver detected high wme rx error rate in FW.
347    FwHighWmeRxErrRate,
348    #[doc(hidden)]
349    __SourceBreaking {
350        unknown_ordinal: u16,
351    },
352}
353
354/// Pattern that matches an unknown `ReasonCode` member.
355#[macro_export]
356macro_rules! ReasonCodeUnknown {
357    () => {
358        _
359    };
360}
361
362impl ReasonCode {
363    #[inline]
364    pub fn from_primitive(prim: u16) -> Option<Self> {
365        match prim {
366            1 => Some(Self::UnspecifiedReason),
367            2 => Some(Self::InvalidAuthentication),
368            3 => Some(Self::LeavingNetworkDeauth),
369            4 => Some(Self::ReasonInactivity),
370            5 => Some(Self::NoMoreStas),
371            6 => Some(Self::InvalidClass2Frame),
372            7 => Some(Self::InvalidClass3Frame),
373            8 => Some(Self::LeavingNetworkDisassoc),
374            9 => Some(Self::NotAuthenticated),
375            10 => Some(Self::UnacceptablePowerCapability),
376            11 => Some(Self::UnacceptableSupportedChannels),
377            12 => Some(Self::BssTransitionDisassoc),
378            13 => Some(Self::ReasonInvalidElement),
379            14 => Some(Self::MicFailure),
380            15 => Some(Self::FourwayHandshakeTimeout),
381            16 => Some(Self::GkHandshakeTimeout),
382            17 => Some(Self::HandshakeElementMismatch),
383            18 => Some(Self::ReasonInvalidGroupCipher),
384            19 => Some(Self::ReasonInvalidPairwiseCipher),
385            20 => Some(Self::ReasonInvalidAkmp),
386            21 => Some(Self::UnsupportedRsneVersion),
387            22 => Some(Self::InvalidRsneCapabilities),
388            23 => Some(Self::Ieee8021XAuthFailed),
389            24 => Some(Self::ReasonCipherOutOfPolicy),
390            25 => Some(Self::TdlsPeerUnreachable),
391            26 => Some(Self::TdlsUnspecifiedReason),
392            27 => Some(Self::SspRequestedDisassoc),
393            28 => Some(Self::NoSspRoamingAgreement),
394            29 => Some(Self::BadCipherOrAkm),
395            30 => Some(Self::NotAuthorizedThisLocation),
396            31 => Some(Self::ServiceChangePrecludesTs),
397            32 => Some(Self::UnspecifiedQosReason),
398            33 => Some(Self::NotEnoughBandwidth),
399            34 => Some(Self::MissingAcks),
400            35 => Some(Self::ExceededTxop),
401            36 => Some(Self::StaLeaving),
402            37 => Some(Self::EndTsBaDls),
403            38 => Some(Self::UnknownTsBa),
404            39 => Some(Self::Timeout),
405            45 => Some(Self::PeerkeyMismatch),
406            46 => Some(Self::PeerInitiated),
407            47 => Some(Self::ApInitiated),
408            48 => Some(Self::ReasonInvalidFtActionFrameCount),
409            49 => Some(Self::ReasonInvalidPmkid),
410            50 => Some(Self::ReasonInvalidMde),
411            51 => Some(Self::ReasonInvalidFte),
412            52 => Some(Self::MeshPeeringCanceled),
413            53 => Some(Self::MeshMaxPeers),
414            54 => Some(Self::MeshConfigurationPolicyViolation),
415            55 => Some(Self::MeshCloseRcvd),
416            56 => Some(Self::MeshMaxRetries),
417            57 => Some(Self::MeshConfirmTimeout),
418            58 => Some(Self::MeshInvalidGtk),
419            59 => Some(Self::MeshInconsistentParameters),
420            60 => Some(Self::MeshInvalidSecurityCapability),
421            61 => Some(Self::MeshPathErrorNoProxyInformation),
422            62 => Some(Self::MeshPathErrorNoForwardingInformation),
423            63 => Some(Self::MeshPathErrorDestinationUnreachable),
424            64 => Some(Self::MacAddressAlreadyExistsInMbss),
425            65 => Some(Self::MeshChannelSwitchRegulatoryRequirements),
426            66 => Some(Self::MeshChannelSwitchUnspecified),
427            128 => Some(Self::MlmeLinkFailed),
428            129 => Some(Self::FwRxStalled),
429            130 => Some(Self::FwHighWmeRxErrRate),
430            _ => None,
431        }
432    }
433
434    #[inline]
435    pub fn from_primitive_allow_unknown(prim: u16) -> Self {
436        match prim {
437            1 => Self::UnspecifiedReason,
438            2 => Self::InvalidAuthentication,
439            3 => Self::LeavingNetworkDeauth,
440            4 => Self::ReasonInactivity,
441            5 => Self::NoMoreStas,
442            6 => Self::InvalidClass2Frame,
443            7 => Self::InvalidClass3Frame,
444            8 => Self::LeavingNetworkDisassoc,
445            9 => Self::NotAuthenticated,
446            10 => Self::UnacceptablePowerCapability,
447            11 => Self::UnacceptableSupportedChannels,
448            12 => Self::BssTransitionDisassoc,
449            13 => Self::ReasonInvalidElement,
450            14 => Self::MicFailure,
451            15 => Self::FourwayHandshakeTimeout,
452            16 => Self::GkHandshakeTimeout,
453            17 => Self::HandshakeElementMismatch,
454            18 => Self::ReasonInvalidGroupCipher,
455            19 => Self::ReasonInvalidPairwiseCipher,
456            20 => Self::ReasonInvalidAkmp,
457            21 => Self::UnsupportedRsneVersion,
458            22 => Self::InvalidRsneCapabilities,
459            23 => Self::Ieee8021XAuthFailed,
460            24 => Self::ReasonCipherOutOfPolicy,
461            25 => Self::TdlsPeerUnreachable,
462            26 => Self::TdlsUnspecifiedReason,
463            27 => Self::SspRequestedDisassoc,
464            28 => Self::NoSspRoamingAgreement,
465            29 => Self::BadCipherOrAkm,
466            30 => Self::NotAuthorizedThisLocation,
467            31 => Self::ServiceChangePrecludesTs,
468            32 => Self::UnspecifiedQosReason,
469            33 => Self::NotEnoughBandwidth,
470            34 => Self::MissingAcks,
471            35 => Self::ExceededTxop,
472            36 => Self::StaLeaving,
473            37 => Self::EndTsBaDls,
474            38 => Self::UnknownTsBa,
475            39 => Self::Timeout,
476            45 => Self::PeerkeyMismatch,
477            46 => Self::PeerInitiated,
478            47 => Self::ApInitiated,
479            48 => Self::ReasonInvalidFtActionFrameCount,
480            49 => Self::ReasonInvalidPmkid,
481            50 => Self::ReasonInvalidMde,
482            51 => Self::ReasonInvalidFte,
483            52 => Self::MeshPeeringCanceled,
484            53 => Self::MeshMaxPeers,
485            54 => Self::MeshConfigurationPolicyViolation,
486            55 => Self::MeshCloseRcvd,
487            56 => Self::MeshMaxRetries,
488            57 => Self::MeshConfirmTimeout,
489            58 => Self::MeshInvalidGtk,
490            59 => Self::MeshInconsistentParameters,
491            60 => Self::MeshInvalidSecurityCapability,
492            61 => Self::MeshPathErrorNoProxyInformation,
493            62 => Self::MeshPathErrorNoForwardingInformation,
494            63 => Self::MeshPathErrorDestinationUnreachable,
495            64 => Self::MacAddressAlreadyExistsInMbss,
496            65 => Self::MeshChannelSwitchRegulatoryRequirements,
497            66 => Self::MeshChannelSwitchUnspecified,
498            128 => Self::MlmeLinkFailed,
499            129 => Self::FwRxStalled,
500            130 => Self::FwHighWmeRxErrRate,
501            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
502        }
503    }
504
505    #[inline]
506    pub fn unknown() -> Self {
507        Self::__SourceBreaking { unknown_ordinal: 0xffff }
508    }
509
510    #[inline]
511    pub const fn into_primitive(self) -> u16 {
512        match self {
513            Self::UnspecifiedReason => 1,
514            Self::InvalidAuthentication => 2,
515            Self::LeavingNetworkDeauth => 3,
516            Self::ReasonInactivity => 4,
517            Self::NoMoreStas => 5,
518            Self::InvalidClass2Frame => 6,
519            Self::InvalidClass3Frame => 7,
520            Self::LeavingNetworkDisassoc => 8,
521            Self::NotAuthenticated => 9,
522            Self::UnacceptablePowerCapability => 10,
523            Self::UnacceptableSupportedChannels => 11,
524            Self::BssTransitionDisassoc => 12,
525            Self::ReasonInvalidElement => 13,
526            Self::MicFailure => 14,
527            Self::FourwayHandshakeTimeout => 15,
528            Self::GkHandshakeTimeout => 16,
529            Self::HandshakeElementMismatch => 17,
530            Self::ReasonInvalidGroupCipher => 18,
531            Self::ReasonInvalidPairwiseCipher => 19,
532            Self::ReasonInvalidAkmp => 20,
533            Self::UnsupportedRsneVersion => 21,
534            Self::InvalidRsneCapabilities => 22,
535            Self::Ieee8021XAuthFailed => 23,
536            Self::ReasonCipherOutOfPolicy => 24,
537            Self::TdlsPeerUnreachable => 25,
538            Self::TdlsUnspecifiedReason => 26,
539            Self::SspRequestedDisassoc => 27,
540            Self::NoSspRoamingAgreement => 28,
541            Self::BadCipherOrAkm => 29,
542            Self::NotAuthorizedThisLocation => 30,
543            Self::ServiceChangePrecludesTs => 31,
544            Self::UnspecifiedQosReason => 32,
545            Self::NotEnoughBandwidth => 33,
546            Self::MissingAcks => 34,
547            Self::ExceededTxop => 35,
548            Self::StaLeaving => 36,
549            Self::EndTsBaDls => 37,
550            Self::UnknownTsBa => 38,
551            Self::Timeout => 39,
552            Self::PeerkeyMismatch => 45,
553            Self::PeerInitiated => 46,
554            Self::ApInitiated => 47,
555            Self::ReasonInvalidFtActionFrameCount => 48,
556            Self::ReasonInvalidPmkid => 49,
557            Self::ReasonInvalidMde => 50,
558            Self::ReasonInvalidFte => 51,
559            Self::MeshPeeringCanceled => 52,
560            Self::MeshMaxPeers => 53,
561            Self::MeshConfigurationPolicyViolation => 54,
562            Self::MeshCloseRcvd => 55,
563            Self::MeshMaxRetries => 56,
564            Self::MeshConfirmTimeout => 57,
565            Self::MeshInvalidGtk => 58,
566            Self::MeshInconsistentParameters => 59,
567            Self::MeshInvalidSecurityCapability => 60,
568            Self::MeshPathErrorNoProxyInformation => 61,
569            Self::MeshPathErrorNoForwardingInformation => 62,
570            Self::MeshPathErrorDestinationUnreachable => 63,
571            Self::MacAddressAlreadyExistsInMbss => 64,
572            Self::MeshChannelSwitchRegulatoryRequirements => 65,
573            Self::MeshChannelSwitchUnspecified => 66,
574            Self::MlmeLinkFailed => 128,
575            Self::FwRxStalled => 129,
576            Self::FwHighWmeRxErrRate => 130,
577            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
578        }
579    }
580
581    #[inline]
582    pub fn is_unknown(&self) -> bool {
583        match self {
584            Self::__SourceBreaking { unknown_ordinal: _ } => true,
585            _ => false,
586        }
587    }
588}
589
590/// 802.11 status codes.  These values are common throughout the standard.
591/// IEEE Std 802.11-2016, 9.4.1.9, Table 9-46
592#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
593#[repr(u16)]
594pub enum StatusCode {
595    Success = 0,
596    RefusedReasonUnspecified = 1,
597    TdlsRejectedAlternativeProvided = 2,
598    TdlsRejected = 3,
599    /// 4 reserved.
600    SecurityDisabled = 5,
601    UnacceptableLifetime = 6,
602    NotInSameBss = 7,
603    /// 8-9 reserved.
604    RefusedCapabilitiesMismatch = 10,
605    DeniedNoAssociationExists = 11,
606    DeniedOtherReason = 12,
607    UnsupportedAuthAlgorithm = 13,
608    TransactionSequenceError = 14,
609    ChallengeFailure = 15,
610    RejectedSequenceTimeout = 16,
611    DeniedNoMoreStas = 17,
612    RefusedBasicRatesMismatch = 18,
613    DeniedNoShortPreambleSupport = 19,
614    /// 20-21 reserved.
615    RejectedSpectrumManagementRequired = 22,
616    RejectedBadPowerCapability = 23,
617    RejectedBadSupportedChannels = 24,
618    DeniedNoShortSlotTimeSupport = 25,
619    /// 26 reserved.
620    DeniedNoHtSupport = 27,
621    R0KhUnreachable = 28,
622    DeniedPcoTimeNotSupported = 29,
623    RefusedTemporarily = 30,
624    RobustManagementPolicyViolation = 31,
625    UnspecifiedQosFailure = 32,
626    DeniedInsufficientBandwidth = 33,
627    DeniedPoorChannelConditions = 34,
628    DeniedQosNotSupported = 35,
629    RequestDeclined = 37,
630    InvalidParameters = 38,
631    RejectedWithSuggestedChanges = 39,
632    StatusInvalidElement = 40,
633    StatusInvalidGroupCipher = 41,
634    StatusInvalidPairwiseCipher = 42,
635    StatusInvalidAkmp = 43,
636    UnsupportedRsneVersion = 44,
637    InvalidRsneCapabilities = 45,
638    StatusCipherOutOfPolicy = 46,
639    RejectedForDelayPeriod = 47,
640    DlsNotAllowed = 48,
641    NotPresent = 49,
642    NotQosSta = 50,
643    DeniedListenIntervalTooLarge = 51,
644    StatusInvalidFtActionFrameCount = 52,
645    StatusInvalidPmkid = 53,
646    StatusInvalidMde = 54,
647    StatusInvalidFte = 55,
648    /// 56 is assigned to "REQUESTED_TCLAS_NOT_SUPPORTED_BY_AP" in 802.11-2016, duplicate with 80.
649    /// Name below is as listed in the 802.11 Assigned Numbers Authority database.
650    RequestedTclasNotSupportedByAp = 56,
651    InsufficientTclasProcessingResources = 57,
652    TryAnotherBss = 58,
653    GasAdvertisementProtocolNotSupported = 59,
654    NoOutstandingGasRequest = 60,
655    GasResponseNotReceivedFromServer = 61,
656    GasQueryTimeout = 62,
657    GasQueryResponseTooLarge = 63,
658    RejectedHomeWithSuggestedChanges = 64,
659    ServerUnreachable = 65,
660    /// 66 reserved.
661    RejectedForSspPermissions = 67,
662    RefusedUnauthenticatedAccessNotSupported = 68,
663    /// 69-71 reserved.
664    InvalidRsne = 72,
665    UApsdCoexistanceNotSupported = 73,
666    UApsdCoexModeNotSupported = 74,
667    BadIntervalWithUApsdCoex = 75,
668    AntiCloggingTokenRequired = 76,
669    UnsupportedFiniteCyclicGroup = 77,
670    CannotFindAlternativeTbtt = 78,
671    TransmissionFailure = 79,
672    /// See assignment for 56.
673    RequestedTclasNotSupported = 80,
674    TclasResourcesExhausted = 81,
675    RejectedWithSuggestedBssTransition = 82,
676    RejectWithSchedule = 83,
677    RejectNoWakeupSpecified = 84,
678    SuccessPowerSaveMode = 85,
679    PendingAdmittingFstSession = 86,
680    PerformingFstNow = 87,
681    PendingGapInBaWindow = 88,
682    RejectUPidSetting = 89,
683    RefusedExternalReason = 92,
684    RefusedApOutOfMemory = 93,
685    RejectedEmergencyServicesNotSupported = 94,
686    QueryResponseOutstanding = 95,
687    RejectDseBand = 96,
688    TclasProcessingTerminated = 97,
689    TsScheduleConflict = 98,
690    DeniedWithSuggestedBandAndChannel = 99,
691    MccaopReservationConflict = 100,
692    MafLimitExceeded = 101,
693    MccaTrackLimitExceeded = 102,
694    DeniedDueToSpectrumManagement = 103,
695    DeniedVhtNotSupported = 104,
696    EnablementDenied = 105,
697    RestrictionFromAuthorizedGdb = 106,
698    AuthorizationDeenabled = 107,
699    /// Reserved values we will use for our own purposes.
700    /// -----
701    /// Failure when joining the BSS.
702    JoinFailure = 256,
703    /// Authenticate or associate fails due to spurious deauth or diassoc.
704    SpuriousDeauthOrDisassoc = 257,
705    /// Connect attempt is canceled
706    Canceled = 258,
707    /// Failure establishing security association
708    EstablishRsnaFailure = 259,
709}
710
711impl StatusCode {
712    #[inline]
713    pub fn from_primitive(prim: u16) -> Option<Self> {
714        match prim {
715            0 => Some(Self::Success),
716            1 => Some(Self::RefusedReasonUnspecified),
717            2 => Some(Self::TdlsRejectedAlternativeProvided),
718            3 => Some(Self::TdlsRejected),
719            5 => Some(Self::SecurityDisabled),
720            6 => Some(Self::UnacceptableLifetime),
721            7 => Some(Self::NotInSameBss),
722            10 => Some(Self::RefusedCapabilitiesMismatch),
723            11 => Some(Self::DeniedNoAssociationExists),
724            12 => Some(Self::DeniedOtherReason),
725            13 => Some(Self::UnsupportedAuthAlgorithm),
726            14 => Some(Self::TransactionSequenceError),
727            15 => Some(Self::ChallengeFailure),
728            16 => Some(Self::RejectedSequenceTimeout),
729            17 => Some(Self::DeniedNoMoreStas),
730            18 => Some(Self::RefusedBasicRatesMismatch),
731            19 => Some(Self::DeniedNoShortPreambleSupport),
732            22 => Some(Self::RejectedSpectrumManagementRequired),
733            23 => Some(Self::RejectedBadPowerCapability),
734            24 => Some(Self::RejectedBadSupportedChannels),
735            25 => Some(Self::DeniedNoShortSlotTimeSupport),
736            27 => Some(Self::DeniedNoHtSupport),
737            28 => Some(Self::R0KhUnreachable),
738            29 => Some(Self::DeniedPcoTimeNotSupported),
739            30 => Some(Self::RefusedTemporarily),
740            31 => Some(Self::RobustManagementPolicyViolation),
741            32 => Some(Self::UnspecifiedQosFailure),
742            33 => Some(Self::DeniedInsufficientBandwidth),
743            34 => Some(Self::DeniedPoorChannelConditions),
744            35 => Some(Self::DeniedQosNotSupported),
745            37 => Some(Self::RequestDeclined),
746            38 => Some(Self::InvalidParameters),
747            39 => Some(Self::RejectedWithSuggestedChanges),
748            40 => Some(Self::StatusInvalidElement),
749            41 => Some(Self::StatusInvalidGroupCipher),
750            42 => Some(Self::StatusInvalidPairwiseCipher),
751            43 => Some(Self::StatusInvalidAkmp),
752            44 => Some(Self::UnsupportedRsneVersion),
753            45 => Some(Self::InvalidRsneCapabilities),
754            46 => Some(Self::StatusCipherOutOfPolicy),
755            47 => Some(Self::RejectedForDelayPeriod),
756            48 => Some(Self::DlsNotAllowed),
757            49 => Some(Self::NotPresent),
758            50 => Some(Self::NotQosSta),
759            51 => Some(Self::DeniedListenIntervalTooLarge),
760            52 => Some(Self::StatusInvalidFtActionFrameCount),
761            53 => Some(Self::StatusInvalidPmkid),
762            54 => Some(Self::StatusInvalidMde),
763            55 => Some(Self::StatusInvalidFte),
764            56 => Some(Self::RequestedTclasNotSupportedByAp),
765            57 => Some(Self::InsufficientTclasProcessingResources),
766            58 => Some(Self::TryAnotherBss),
767            59 => Some(Self::GasAdvertisementProtocolNotSupported),
768            60 => Some(Self::NoOutstandingGasRequest),
769            61 => Some(Self::GasResponseNotReceivedFromServer),
770            62 => Some(Self::GasQueryTimeout),
771            63 => Some(Self::GasQueryResponseTooLarge),
772            64 => Some(Self::RejectedHomeWithSuggestedChanges),
773            65 => Some(Self::ServerUnreachable),
774            67 => Some(Self::RejectedForSspPermissions),
775            68 => Some(Self::RefusedUnauthenticatedAccessNotSupported),
776            72 => Some(Self::InvalidRsne),
777            73 => Some(Self::UApsdCoexistanceNotSupported),
778            74 => Some(Self::UApsdCoexModeNotSupported),
779            75 => Some(Self::BadIntervalWithUApsdCoex),
780            76 => Some(Self::AntiCloggingTokenRequired),
781            77 => Some(Self::UnsupportedFiniteCyclicGroup),
782            78 => Some(Self::CannotFindAlternativeTbtt),
783            79 => Some(Self::TransmissionFailure),
784            80 => Some(Self::RequestedTclasNotSupported),
785            81 => Some(Self::TclasResourcesExhausted),
786            82 => Some(Self::RejectedWithSuggestedBssTransition),
787            83 => Some(Self::RejectWithSchedule),
788            84 => Some(Self::RejectNoWakeupSpecified),
789            85 => Some(Self::SuccessPowerSaveMode),
790            86 => Some(Self::PendingAdmittingFstSession),
791            87 => Some(Self::PerformingFstNow),
792            88 => Some(Self::PendingGapInBaWindow),
793            89 => Some(Self::RejectUPidSetting),
794            92 => Some(Self::RefusedExternalReason),
795            93 => Some(Self::RefusedApOutOfMemory),
796            94 => Some(Self::RejectedEmergencyServicesNotSupported),
797            95 => Some(Self::QueryResponseOutstanding),
798            96 => Some(Self::RejectDseBand),
799            97 => Some(Self::TclasProcessingTerminated),
800            98 => Some(Self::TsScheduleConflict),
801            99 => Some(Self::DeniedWithSuggestedBandAndChannel),
802            100 => Some(Self::MccaopReservationConflict),
803            101 => Some(Self::MafLimitExceeded),
804            102 => Some(Self::MccaTrackLimitExceeded),
805            103 => Some(Self::DeniedDueToSpectrumManagement),
806            104 => Some(Self::DeniedVhtNotSupported),
807            105 => Some(Self::EnablementDenied),
808            106 => Some(Self::RestrictionFromAuthorizedGdb),
809            107 => Some(Self::AuthorizationDeenabled),
810            256 => Some(Self::JoinFailure),
811            257 => Some(Self::SpuriousDeauthOrDisassoc),
812            258 => Some(Self::Canceled),
813            259 => Some(Self::EstablishRsnaFailure),
814            _ => None,
815        }
816    }
817
818    #[inline]
819    pub const fn into_primitive(self) -> u16 {
820        self as u16
821    }
822}
823
824/// IEEE Std 802.11-2020 9.4.2.173
825#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
826#[repr(u32)]
827pub enum WlanAccessCategory {
828    Background = 1,
829    BestEffort = 2,
830    Video = 3,
831    Voice = 4,
832}
833
834impl WlanAccessCategory {
835    #[inline]
836    pub fn from_primitive(prim: u32) -> Option<Self> {
837        match prim {
838            1 => Some(Self::Background),
839            2 => Some(Self::BestEffort),
840            3 => Some(Self::Video),
841            4 => Some(Self::Voice),
842            _ => None,
843        }
844    }
845
846    #[inline]
847    pub const fn into_primitive(self) -> u32 {
848        self as u32
849    }
850}
851
852/// Identifies a frequency band in metadata of various operations.
853///
854/// Examples of this enum in use are labeling scan results or reporting
855/// a driver capabilities from various frequency bands.
856///
857/// NOTE: This enum is similar to the Band ID field defined in
858/// IEEE Std 802.11-2016 9.4.1.46, but its values are not the same.
859///
860/// TODO(https://fxbug.dev/376442944): Create a spec-compliant Band ID type
861/// and migrate the platform to use it.
862#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
863pub enum WlanBand {
864    TwoGhz,
865    FiveGhz,
866    #[doc(hidden)]
867    __SourceBreaking {
868        unknown_ordinal: u8,
869    },
870}
871
872/// Pattern that matches an unknown `WlanBand` member.
873#[macro_export]
874macro_rules! WlanBandUnknown {
875    () => {
876        _
877    };
878}
879
880impl WlanBand {
881    #[inline]
882    pub fn from_primitive(prim: u8) -> Option<Self> {
883        match prim {
884            0 => Some(Self::TwoGhz),
885            1 => Some(Self::FiveGhz),
886            _ => None,
887        }
888    }
889
890    #[inline]
891    pub fn from_primitive_allow_unknown(prim: u8) -> Self {
892        match prim {
893            0 => Self::TwoGhz,
894            1 => Self::FiveGhz,
895            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
896        }
897    }
898
899    #[inline]
900    pub fn unknown() -> Self {
901        Self::__SourceBreaking { unknown_ordinal: 0xff }
902    }
903
904    #[inline]
905    pub const fn into_primitive(self) -> u8 {
906        match self {
907            Self::TwoGhz => 0,
908            Self::FiveGhz => 1,
909            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
910        }
911    }
912
913    #[inline]
914    pub fn is_unknown(&self) -> bool {
915        match self {
916            Self::__SourceBreaking { unknown_ordinal: _ } => true,
917            _ => false,
918        }
919    }
920}
921
922#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
923#[repr(C)]
924pub struct CSsid {
925    pub len: u8,
926    pub data: [u8; 32],
927}
928
929impl fidl::Persistable for CSsid {}
930
931#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
932#[repr(C)]
933pub struct HtCapabilities {
934    pub bytes: [u8; 26],
935}
936
937impl fidl::Persistable for HtCapabilities {}
938
939#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
940#[repr(C)]
941pub struct HtOperation {
942    pub bytes: [u8; 22],
943}
944
945impl fidl::Persistable for HtOperation {}
946
947#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
948#[repr(C)]
949pub struct VhtCapabilities {
950    pub bytes: [u8; 12],
951}
952
953impl fidl::Persistable for VhtCapabilities {}
954
955#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
956#[repr(C)]
957pub struct VhtOperation {
958    pub bytes: [u8; 5],
959}
960
961impl fidl::Persistable for VhtOperation {}
962
963/// IEEE Std 802.11-2020 6.3.19.1.2
964#[derive(Clone, Debug, Default, PartialEq)]
965pub struct SetKeyDescriptor {
966    /// The key value as bytes.
967    /// 802.11 specifies a bit string for this field, but we represent it as a byte array for
968    /// convenience.
969    /// Required.
970    pub key: Option<Vec<u8>>,
971    /// Index for rotating keys, e.g. group keys.
972    /// This value is always 0 for key types which aren't rotating, e.g. pairwise keys.
973    /// Required.
974    pub key_id: Option<u16>,
975    /// Whether this key is a pairwise, group or peer key.
976    /// Required.
977    pub key_type: Option<KeyType>,
978    /// The peer MAC address for pairwise and peer keys.
979    /// For group keys this value is always the broadcast address.
980    /// Required.
981    pub peer_addr: Option<[u8; 6]>,
982    /// Receive Sequence Counter for group keys only.
983    /// In all other cases the RSC will be 0.
984    /// Optional.
985    pub rsc: Option<u64>,
986    /// IEEE Cipher suite selector. See IEEE Std 802.11-2016, 9.4.2.25.2, Table 9-131
987    /// Required.
988    pub cipher_oui: Option<[u8; 3]>,
989    /// The cipher type.
990    /// Required.
991    pub cipher_type: Option<CipherSuiteType>,
992    #[doc(hidden)]
993    pub __source_breaking: fidl::marker::SourceBreaking,
994}
995
996impl fidl::Persistable for SetKeyDescriptor {}
997
998mod internal {
999    use super::*;
1000    unsafe impl fidl::encoding::TypeMarker for CipherSuiteType {
1001        type Owned = Self;
1002
1003        #[inline(always)]
1004        fn inline_align(_context: fidl::encoding::Context) -> usize {
1005            std::mem::align_of::<u32>()
1006        }
1007
1008        #[inline(always)]
1009        fn inline_size(_context: fidl::encoding::Context) -> usize {
1010            std::mem::size_of::<u32>()
1011        }
1012
1013        #[inline(always)]
1014        fn encode_is_copy() -> bool {
1015            false
1016        }
1017
1018        #[inline(always)]
1019        fn decode_is_copy() -> bool {
1020            false
1021        }
1022    }
1023
1024    impl fidl::encoding::ValueTypeMarker for CipherSuiteType {
1025        type Borrowed<'a> = Self;
1026        #[inline(always)]
1027        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1028            *value
1029        }
1030    }
1031
1032    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1033        for CipherSuiteType
1034    {
1035        #[inline]
1036        unsafe fn encode(
1037            self,
1038            encoder: &mut fidl::encoding::Encoder<'_, D>,
1039            offset: usize,
1040            _depth: fidl::encoding::Depth,
1041        ) -> fidl::Result<()> {
1042            encoder.debug_check_bounds::<Self>(offset);
1043            encoder.write_num(self.into_primitive(), offset);
1044            Ok(())
1045        }
1046    }
1047
1048    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CipherSuiteType {
1049        #[inline(always)]
1050        fn new_empty() -> Self {
1051            Self::unknown()
1052        }
1053
1054        #[inline]
1055        unsafe fn decode(
1056            &mut self,
1057            decoder: &mut fidl::encoding::Decoder<'_, D>,
1058            offset: usize,
1059            _depth: fidl::encoding::Depth,
1060        ) -> fidl::Result<()> {
1061            decoder.debug_check_bounds::<Self>(offset);
1062            let prim = decoder.read_num::<u32>(offset);
1063
1064            *self = Self::from_primitive_allow_unknown(prim);
1065            Ok(())
1066        }
1067    }
1068    unsafe impl fidl::encoding::TypeMarker for KeyType {
1069        type Owned = Self;
1070
1071        #[inline(always)]
1072        fn inline_align(_context: fidl::encoding::Context) -> usize {
1073            std::mem::align_of::<u8>()
1074        }
1075
1076        #[inline(always)]
1077        fn inline_size(_context: fidl::encoding::Context) -> usize {
1078            std::mem::size_of::<u8>()
1079        }
1080
1081        #[inline(always)]
1082        fn encode_is_copy() -> bool {
1083            false
1084        }
1085
1086        #[inline(always)]
1087        fn decode_is_copy() -> bool {
1088            false
1089        }
1090    }
1091
1092    impl fidl::encoding::ValueTypeMarker for KeyType {
1093        type Borrowed<'a> = Self;
1094        #[inline(always)]
1095        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1096            *value
1097        }
1098    }
1099
1100    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for KeyType {
1101        #[inline]
1102        unsafe fn encode(
1103            self,
1104            encoder: &mut fidl::encoding::Encoder<'_, D>,
1105            offset: usize,
1106            _depth: fidl::encoding::Depth,
1107        ) -> fidl::Result<()> {
1108            encoder.debug_check_bounds::<Self>(offset);
1109            encoder.write_num(self.into_primitive(), offset);
1110            Ok(())
1111        }
1112    }
1113
1114    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyType {
1115        #[inline(always)]
1116        fn new_empty() -> Self {
1117            Self::unknown()
1118        }
1119
1120        #[inline]
1121        unsafe fn decode(
1122            &mut self,
1123            decoder: &mut fidl::encoding::Decoder<'_, D>,
1124            offset: usize,
1125            _depth: fidl::encoding::Depth,
1126        ) -> fidl::Result<()> {
1127            decoder.debug_check_bounds::<Self>(offset);
1128            let prim = decoder.read_num::<u8>(offset);
1129
1130            *self = Self::from_primitive_allow_unknown(prim);
1131            Ok(())
1132        }
1133    }
1134    unsafe impl fidl::encoding::TypeMarker for ReasonCode {
1135        type Owned = Self;
1136
1137        #[inline(always)]
1138        fn inline_align(_context: fidl::encoding::Context) -> usize {
1139            std::mem::align_of::<u16>()
1140        }
1141
1142        #[inline(always)]
1143        fn inline_size(_context: fidl::encoding::Context) -> usize {
1144            std::mem::size_of::<u16>()
1145        }
1146
1147        #[inline(always)]
1148        fn encode_is_copy() -> bool {
1149            false
1150        }
1151
1152        #[inline(always)]
1153        fn decode_is_copy() -> bool {
1154            false
1155        }
1156    }
1157
1158    impl fidl::encoding::ValueTypeMarker for ReasonCode {
1159        type Borrowed<'a> = Self;
1160        #[inline(always)]
1161        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1162            *value
1163        }
1164    }
1165
1166    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ReasonCode {
1167        #[inline]
1168        unsafe fn encode(
1169            self,
1170            encoder: &mut fidl::encoding::Encoder<'_, D>,
1171            offset: usize,
1172            _depth: fidl::encoding::Depth,
1173        ) -> fidl::Result<()> {
1174            encoder.debug_check_bounds::<Self>(offset);
1175            encoder.write_num(self.into_primitive(), offset);
1176            Ok(())
1177        }
1178    }
1179
1180    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReasonCode {
1181        #[inline(always)]
1182        fn new_empty() -> Self {
1183            Self::unknown()
1184        }
1185
1186        #[inline]
1187        unsafe fn decode(
1188            &mut self,
1189            decoder: &mut fidl::encoding::Decoder<'_, D>,
1190            offset: usize,
1191            _depth: fidl::encoding::Depth,
1192        ) -> fidl::Result<()> {
1193            decoder.debug_check_bounds::<Self>(offset);
1194            let prim = decoder.read_num::<u16>(offset);
1195
1196            *self = Self::from_primitive_allow_unknown(prim);
1197            Ok(())
1198        }
1199    }
1200    unsafe impl fidl::encoding::TypeMarker for StatusCode {
1201        type Owned = Self;
1202
1203        #[inline(always)]
1204        fn inline_align(_context: fidl::encoding::Context) -> usize {
1205            std::mem::align_of::<u16>()
1206        }
1207
1208        #[inline(always)]
1209        fn inline_size(_context: fidl::encoding::Context) -> usize {
1210            std::mem::size_of::<u16>()
1211        }
1212
1213        #[inline(always)]
1214        fn encode_is_copy() -> bool {
1215            true
1216        }
1217
1218        #[inline(always)]
1219        fn decode_is_copy() -> bool {
1220            false
1221        }
1222    }
1223
1224    impl fidl::encoding::ValueTypeMarker for StatusCode {
1225        type Borrowed<'a> = Self;
1226        #[inline(always)]
1227        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1228            *value
1229        }
1230    }
1231
1232    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for StatusCode {
1233        #[inline]
1234        unsafe fn encode(
1235            self,
1236            encoder: &mut fidl::encoding::Encoder<'_, D>,
1237            offset: usize,
1238            _depth: fidl::encoding::Depth,
1239        ) -> fidl::Result<()> {
1240            encoder.debug_check_bounds::<Self>(offset);
1241            encoder.write_num(self.into_primitive(), offset);
1242            Ok(())
1243        }
1244    }
1245
1246    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StatusCode {
1247        #[inline(always)]
1248        fn new_empty() -> Self {
1249            Self::Success
1250        }
1251
1252        #[inline]
1253        unsafe fn decode(
1254            &mut self,
1255            decoder: &mut fidl::encoding::Decoder<'_, D>,
1256            offset: usize,
1257            _depth: fidl::encoding::Depth,
1258        ) -> fidl::Result<()> {
1259            decoder.debug_check_bounds::<Self>(offset);
1260            let prim = decoder.read_num::<u16>(offset);
1261
1262            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1263            Ok(())
1264        }
1265    }
1266    unsafe impl fidl::encoding::TypeMarker for WlanAccessCategory {
1267        type Owned = Self;
1268
1269        #[inline(always)]
1270        fn inline_align(_context: fidl::encoding::Context) -> usize {
1271            std::mem::align_of::<u32>()
1272        }
1273
1274        #[inline(always)]
1275        fn inline_size(_context: fidl::encoding::Context) -> usize {
1276            std::mem::size_of::<u32>()
1277        }
1278
1279        #[inline(always)]
1280        fn encode_is_copy() -> bool {
1281            true
1282        }
1283
1284        #[inline(always)]
1285        fn decode_is_copy() -> bool {
1286            false
1287        }
1288    }
1289
1290    impl fidl::encoding::ValueTypeMarker for WlanAccessCategory {
1291        type Borrowed<'a> = Self;
1292        #[inline(always)]
1293        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1294            *value
1295        }
1296    }
1297
1298    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1299        for WlanAccessCategory
1300    {
1301        #[inline]
1302        unsafe fn encode(
1303            self,
1304            encoder: &mut fidl::encoding::Encoder<'_, D>,
1305            offset: usize,
1306            _depth: fidl::encoding::Depth,
1307        ) -> fidl::Result<()> {
1308            encoder.debug_check_bounds::<Self>(offset);
1309            encoder.write_num(self.into_primitive(), offset);
1310            Ok(())
1311        }
1312    }
1313
1314    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanAccessCategory {
1315        #[inline(always)]
1316        fn new_empty() -> Self {
1317            Self::Background
1318        }
1319
1320        #[inline]
1321        unsafe fn decode(
1322            &mut self,
1323            decoder: &mut fidl::encoding::Decoder<'_, D>,
1324            offset: usize,
1325            _depth: fidl::encoding::Depth,
1326        ) -> fidl::Result<()> {
1327            decoder.debug_check_bounds::<Self>(offset);
1328            let prim = decoder.read_num::<u32>(offset);
1329
1330            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1331            Ok(())
1332        }
1333    }
1334    unsafe impl fidl::encoding::TypeMarker for WlanBand {
1335        type Owned = Self;
1336
1337        #[inline(always)]
1338        fn inline_align(_context: fidl::encoding::Context) -> usize {
1339            std::mem::align_of::<u8>()
1340        }
1341
1342        #[inline(always)]
1343        fn inline_size(_context: fidl::encoding::Context) -> usize {
1344            std::mem::size_of::<u8>()
1345        }
1346
1347        #[inline(always)]
1348        fn encode_is_copy() -> bool {
1349            false
1350        }
1351
1352        #[inline(always)]
1353        fn decode_is_copy() -> bool {
1354            false
1355        }
1356    }
1357
1358    impl fidl::encoding::ValueTypeMarker for WlanBand {
1359        type Borrowed<'a> = Self;
1360        #[inline(always)]
1361        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1362            *value
1363        }
1364    }
1365
1366    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for WlanBand {
1367        #[inline]
1368        unsafe fn encode(
1369            self,
1370            encoder: &mut fidl::encoding::Encoder<'_, D>,
1371            offset: usize,
1372            _depth: fidl::encoding::Depth,
1373        ) -> fidl::Result<()> {
1374            encoder.debug_check_bounds::<Self>(offset);
1375            encoder.write_num(self.into_primitive(), offset);
1376            Ok(())
1377        }
1378    }
1379
1380    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanBand {
1381        #[inline(always)]
1382        fn new_empty() -> Self {
1383            Self::unknown()
1384        }
1385
1386        #[inline]
1387        unsafe fn decode(
1388            &mut self,
1389            decoder: &mut fidl::encoding::Decoder<'_, D>,
1390            offset: usize,
1391            _depth: fidl::encoding::Depth,
1392        ) -> fidl::Result<()> {
1393            decoder.debug_check_bounds::<Self>(offset);
1394            let prim = decoder.read_num::<u8>(offset);
1395
1396            *self = Self::from_primitive_allow_unknown(prim);
1397            Ok(())
1398        }
1399    }
1400
1401    impl fidl::encoding::ValueTypeMarker for CSsid {
1402        type Borrowed<'a> = &'a Self;
1403        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1404            value
1405        }
1406    }
1407
1408    unsafe impl fidl::encoding::TypeMarker for CSsid {
1409        type Owned = Self;
1410
1411        #[inline(always)]
1412        fn inline_align(_context: fidl::encoding::Context) -> usize {
1413            1
1414        }
1415
1416        #[inline(always)]
1417        fn inline_size(_context: fidl::encoding::Context) -> usize {
1418            33
1419        }
1420        #[inline(always)]
1421        fn encode_is_copy() -> bool {
1422            true
1423        }
1424
1425        #[inline(always)]
1426        fn decode_is_copy() -> bool {
1427            true
1428        }
1429    }
1430
1431    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CSsid, D> for &CSsid {
1432        #[inline]
1433        unsafe fn encode(
1434            self,
1435            encoder: &mut fidl::encoding::Encoder<'_, D>,
1436            offset: usize,
1437            _depth: fidl::encoding::Depth,
1438        ) -> fidl::Result<()> {
1439            encoder.debug_check_bounds::<CSsid>(offset);
1440            unsafe {
1441                // Copy the object into the buffer.
1442                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1443                (buf_ptr as *mut CSsid).write_unaligned((self as *const CSsid).read());
1444                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1445                // done second because the memcpy will write garbage to these bytes.
1446            }
1447            Ok(())
1448        }
1449    }
1450    unsafe impl<
1451            D: fidl::encoding::ResourceDialect,
1452            T0: fidl::encoding::Encode<u8, D>,
1453            T1: fidl::encoding::Encode<fidl::encoding::Array<u8, 32>, D>,
1454        > fidl::encoding::Encode<CSsid, D> for (T0, T1)
1455    {
1456        #[inline]
1457        unsafe fn encode(
1458            self,
1459            encoder: &mut fidl::encoding::Encoder<'_, D>,
1460            offset: usize,
1461            depth: fidl::encoding::Depth,
1462        ) -> fidl::Result<()> {
1463            encoder.debug_check_bounds::<CSsid>(offset);
1464            // Zero out padding regions. There's no need to apply masks
1465            // because the unmasked parts will be overwritten by fields.
1466            // Write the fields.
1467            self.0.encode(encoder, offset + 0, depth)?;
1468            self.1.encode(encoder, offset + 1, depth)?;
1469            Ok(())
1470        }
1471    }
1472
1473    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CSsid {
1474        #[inline(always)]
1475        fn new_empty() -> Self {
1476            Self {
1477                len: fidl::new_empty!(u8, D),
1478                data: fidl::new_empty!(fidl::encoding::Array<u8, 32>, D),
1479            }
1480        }
1481
1482        #[inline]
1483        unsafe fn decode(
1484            &mut self,
1485            decoder: &mut fidl::encoding::Decoder<'_, D>,
1486            offset: usize,
1487            _depth: fidl::encoding::Depth,
1488        ) -> fidl::Result<()> {
1489            decoder.debug_check_bounds::<Self>(offset);
1490            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1491            // Verify that padding bytes are zero.
1492            // Copy from the buffer into the object.
1493            unsafe {
1494                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 33);
1495            }
1496            Ok(())
1497        }
1498    }
1499
1500    impl fidl::encoding::ValueTypeMarker for HtCapabilities {
1501        type Borrowed<'a> = &'a Self;
1502        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1503            value
1504        }
1505    }
1506
1507    unsafe impl fidl::encoding::TypeMarker for HtCapabilities {
1508        type Owned = Self;
1509
1510        #[inline(always)]
1511        fn inline_align(_context: fidl::encoding::Context) -> usize {
1512            1
1513        }
1514
1515        #[inline(always)]
1516        fn inline_size(_context: fidl::encoding::Context) -> usize {
1517            26
1518        }
1519        #[inline(always)]
1520        fn encode_is_copy() -> bool {
1521            true
1522        }
1523
1524        #[inline(always)]
1525        fn decode_is_copy() -> bool {
1526            true
1527        }
1528    }
1529
1530    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HtCapabilities, D>
1531        for &HtCapabilities
1532    {
1533        #[inline]
1534        unsafe fn encode(
1535            self,
1536            encoder: &mut fidl::encoding::Encoder<'_, D>,
1537            offset: usize,
1538            _depth: fidl::encoding::Depth,
1539        ) -> fidl::Result<()> {
1540            encoder.debug_check_bounds::<HtCapabilities>(offset);
1541            unsafe {
1542                // Copy the object into the buffer.
1543                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1544                (buf_ptr as *mut HtCapabilities)
1545                    .write_unaligned((self as *const HtCapabilities).read());
1546                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1547                // done second because the memcpy will write garbage to these bytes.
1548            }
1549            Ok(())
1550        }
1551    }
1552    unsafe impl<
1553            D: fidl::encoding::ResourceDialect,
1554            T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 26>, D>,
1555        > fidl::encoding::Encode<HtCapabilities, D> for (T0,)
1556    {
1557        #[inline]
1558        unsafe fn encode(
1559            self,
1560            encoder: &mut fidl::encoding::Encoder<'_, D>,
1561            offset: usize,
1562            depth: fidl::encoding::Depth,
1563        ) -> fidl::Result<()> {
1564            encoder.debug_check_bounds::<HtCapabilities>(offset);
1565            // Zero out padding regions. There's no need to apply masks
1566            // because the unmasked parts will be overwritten by fields.
1567            // Write the fields.
1568            self.0.encode(encoder, offset + 0, depth)?;
1569            Ok(())
1570        }
1571    }
1572
1573    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HtCapabilities {
1574        #[inline(always)]
1575        fn new_empty() -> Self {
1576            Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 26>, D) }
1577        }
1578
1579        #[inline]
1580        unsafe fn decode(
1581            &mut self,
1582            decoder: &mut fidl::encoding::Decoder<'_, D>,
1583            offset: usize,
1584            _depth: fidl::encoding::Depth,
1585        ) -> fidl::Result<()> {
1586            decoder.debug_check_bounds::<Self>(offset);
1587            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1588            // Verify that padding bytes are zero.
1589            // Copy from the buffer into the object.
1590            unsafe {
1591                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 26);
1592            }
1593            Ok(())
1594        }
1595    }
1596
1597    impl fidl::encoding::ValueTypeMarker for HtOperation {
1598        type Borrowed<'a> = &'a Self;
1599        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1600            value
1601        }
1602    }
1603
1604    unsafe impl fidl::encoding::TypeMarker for HtOperation {
1605        type Owned = Self;
1606
1607        #[inline(always)]
1608        fn inline_align(_context: fidl::encoding::Context) -> usize {
1609            1
1610        }
1611
1612        #[inline(always)]
1613        fn inline_size(_context: fidl::encoding::Context) -> usize {
1614            22
1615        }
1616        #[inline(always)]
1617        fn encode_is_copy() -> bool {
1618            true
1619        }
1620
1621        #[inline(always)]
1622        fn decode_is_copy() -> bool {
1623            true
1624        }
1625    }
1626
1627    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HtOperation, D>
1628        for &HtOperation
1629    {
1630        #[inline]
1631        unsafe fn encode(
1632            self,
1633            encoder: &mut fidl::encoding::Encoder<'_, D>,
1634            offset: usize,
1635            _depth: fidl::encoding::Depth,
1636        ) -> fidl::Result<()> {
1637            encoder.debug_check_bounds::<HtOperation>(offset);
1638            unsafe {
1639                // Copy the object into the buffer.
1640                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1641                (buf_ptr as *mut HtOperation).write_unaligned((self as *const HtOperation).read());
1642                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1643                // done second because the memcpy will write garbage to these bytes.
1644            }
1645            Ok(())
1646        }
1647    }
1648    unsafe impl<
1649            D: fidl::encoding::ResourceDialect,
1650            T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 22>, D>,
1651        > fidl::encoding::Encode<HtOperation, D> for (T0,)
1652    {
1653        #[inline]
1654        unsafe fn encode(
1655            self,
1656            encoder: &mut fidl::encoding::Encoder<'_, D>,
1657            offset: usize,
1658            depth: fidl::encoding::Depth,
1659        ) -> fidl::Result<()> {
1660            encoder.debug_check_bounds::<HtOperation>(offset);
1661            // Zero out padding regions. There's no need to apply masks
1662            // because the unmasked parts will be overwritten by fields.
1663            // Write the fields.
1664            self.0.encode(encoder, offset + 0, depth)?;
1665            Ok(())
1666        }
1667    }
1668
1669    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HtOperation {
1670        #[inline(always)]
1671        fn new_empty() -> Self {
1672            Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 22>, D) }
1673        }
1674
1675        #[inline]
1676        unsafe fn decode(
1677            &mut self,
1678            decoder: &mut fidl::encoding::Decoder<'_, D>,
1679            offset: usize,
1680            _depth: fidl::encoding::Depth,
1681        ) -> fidl::Result<()> {
1682            decoder.debug_check_bounds::<Self>(offset);
1683            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1684            // Verify that padding bytes are zero.
1685            // Copy from the buffer into the object.
1686            unsafe {
1687                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 22);
1688            }
1689            Ok(())
1690        }
1691    }
1692
1693    impl fidl::encoding::ValueTypeMarker for VhtCapabilities {
1694        type Borrowed<'a> = &'a Self;
1695        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1696            value
1697        }
1698    }
1699
1700    unsafe impl fidl::encoding::TypeMarker for VhtCapabilities {
1701        type Owned = Self;
1702
1703        #[inline(always)]
1704        fn inline_align(_context: fidl::encoding::Context) -> usize {
1705            1
1706        }
1707
1708        #[inline(always)]
1709        fn inline_size(_context: fidl::encoding::Context) -> usize {
1710            12
1711        }
1712        #[inline(always)]
1713        fn encode_is_copy() -> bool {
1714            true
1715        }
1716
1717        #[inline(always)]
1718        fn decode_is_copy() -> bool {
1719            true
1720        }
1721    }
1722
1723    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VhtCapabilities, D>
1724        for &VhtCapabilities
1725    {
1726        #[inline]
1727        unsafe fn encode(
1728            self,
1729            encoder: &mut fidl::encoding::Encoder<'_, D>,
1730            offset: usize,
1731            _depth: fidl::encoding::Depth,
1732        ) -> fidl::Result<()> {
1733            encoder.debug_check_bounds::<VhtCapabilities>(offset);
1734            unsafe {
1735                // Copy the object into the buffer.
1736                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1737                (buf_ptr as *mut VhtCapabilities)
1738                    .write_unaligned((self as *const VhtCapabilities).read());
1739                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1740                // done second because the memcpy will write garbage to these bytes.
1741            }
1742            Ok(())
1743        }
1744    }
1745    unsafe impl<
1746            D: fidl::encoding::ResourceDialect,
1747            T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 12>, D>,
1748        > fidl::encoding::Encode<VhtCapabilities, D> for (T0,)
1749    {
1750        #[inline]
1751        unsafe fn encode(
1752            self,
1753            encoder: &mut fidl::encoding::Encoder<'_, D>,
1754            offset: usize,
1755            depth: fidl::encoding::Depth,
1756        ) -> fidl::Result<()> {
1757            encoder.debug_check_bounds::<VhtCapabilities>(offset);
1758            // Zero out padding regions. There's no need to apply masks
1759            // because the unmasked parts will be overwritten by fields.
1760            // Write the fields.
1761            self.0.encode(encoder, offset + 0, depth)?;
1762            Ok(())
1763        }
1764    }
1765
1766    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VhtCapabilities {
1767        #[inline(always)]
1768        fn new_empty() -> Self {
1769            Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 12>, D) }
1770        }
1771
1772        #[inline]
1773        unsafe fn decode(
1774            &mut self,
1775            decoder: &mut fidl::encoding::Decoder<'_, D>,
1776            offset: usize,
1777            _depth: fidl::encoding::Depth,
1778        ) -> fidl::Result<()> {
1779            decoder.debug_check_bounds::<Self>(offset);
1780            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1781            // Verify that padding bytes are zero.
1782            // Copy from the buffer into the object.
1783            unsafe {
1784                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
1785            }
1786            Ok(())
1787        }
1788    }
1789
1790    impl fidl::encoding::ValueTypeMarker for VhtOperation {
1791        type Borrowed<'a> = &'a Self;
1792        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1793            value
1794        }
1795    }
1796
1797    unsafe impl fidl::encoding::TypeMarker for VhtOperation {
1798        type Owned = Self;
1799
1800        #[inline(always)]
1801        fn inline_align(_context: fidl::encoding::Context) -> usize {
1802            1
1803        }
1804
1805        #[inline(always)]
1806        fn inline_size(_context: fidl::encoding::Context) -> usize {
1807            5
1808        }
1809        #[inline(always)]
1810        fn encode_is_copy() -> bool {
1811            true
1812        }
1813
1814        #[inline(always)]
1815        fn decode_is_copy() -> bool {
1816            true
1817        }
1818    }
1819
1820    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VhtOperation, D>
1821        for &VhtOperation
1822    {
1823        #[inline]
1824        unsafe fn encode(
1825            self,
1826            encoder: &mut fidl::encoding::Encoder<'_, D>,
1827            offset: usize,
1828            _depth: fidl::encoding::Depth,
1829        ) -> fidl::Result<()> {
1830            encoder.debug_check_bounds::<VhtOperation>(offset);
1831            unsafe {
1832                // Copy the object into the buffer.
1833                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1834                (buf_ptr as *mut VhtOperation)
1835                    .write_unaligned((self as *const VhtOperation).read());
1836                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
1837                // done second because the memcpy will write garbage to these bytes.
1838            }
1839            Ok(())
1840        }
1841    }
1842    unsafe impl<
1843            D: fidl::encoding::ResourceDialect,
1844            T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 5>, D>,
1845        > fidl::encoding::Encode<VhtOperation, D> for (T0,)
1846    {
1847        #[inline]
1848        unsafe fn encode(
1849            self,
1850            encoder: &mut fidl::encoding::Encoder<'_, D>,
1851            offset: usize,
1852            depth: fidl::encoding::Depth,
1853        ) -> fidl::Result<()> {
1854            encoder.debug_check_bounds::<VhtOperation>(offset);
1855            // Zero out padding regions. There's no need to apply masks
1856            // because the unmasked parts will be overwritten by fields.
1857            // Write the fields.
1858            self.0.encode(encoder, offset + 0, depth)?;
1859            Ok(())
1860        }
1861    }
1862
1863    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VhtOperation {
1864        #[inline(always)]
1865        fn new_empty() -> Self {
1866            Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 5>, D) }
1867        }
1868
1869        #[inline]
1870        unsafe fn decode(
1871            &mut self,
1872            decoder: &mut fidl::encoding::Decoder<'_, D>,
1873            offset: usize,
1874            _depth: fidl::encoding::Depth,
1875        ) -> fidl::Result<()> {
1876            decoder.debug_check_bounds::<Self>(offset);
1877            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1878            // Verify that padding bytes are zero.
1879            // Copy from the buffer into the object.
1880            unsafe {
1881                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 5);
1882            }
1883            Ok(())
1884        }
1885    }
1886
1887    impl SetKeyDescriptor {
1888        #[inline(always)]
1889        fn max_ordinal_present(&self) -> u64 {
1890            if let Some(_) = self.cipher_type {
1891                return 7;
1892            }
1893            if let Some(_) = self.cipher_oui {
1894                return 6;
1895            }
1896            if let Some(_) = self.rsc {
1897                return 5;
1898            }
1899            if let Some(_) = self.peer_addr {
1900                return 4;
1901            }
1902            if let Some(_) = self.key_type {
1903                return 3;
1904            }
1905            if let Some(_) = self.key_id {
1906                return 2;
1907            }
1908            if let Some(_) = self.key {
1909                return 1;
1910            }
1911            0
1912        }
1913    }
1914
1915    impl fidl::encoding::ValueTypeMarker for SetKeyDescriptor {
1916        type Borrowed<'a> = &'a Self;
1917        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1918            value
1919        }
1920    }
1921
1922    unsafe impl fidl::encoding::TypeMarker for SetKeyDescriptor {
1923        type Owned = Self;
1924
1925        #[inline(always)]
1926        fn inline_align(_context: fidl::encoding::Context) -> usize {
1927            8
1928        }
1929
1930        #[inline(always)]
1931        fn inline_size(_context: fidl::encoding::Context) -> usize {
1932            16
1933        }
1934    }
1935
1936    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SetKeyDescriptor, D>
1937        for &SetKeyDescriptor
1938    {
1939        unsafe fn encode(
1940            self,
1941            encoder: &mut fidl::encoding::Encoder<'_, D>,
1942            offset: usize,
1943            mut depth: fidl::encoding::Depth,
1944        ) -> fidl::Result<()> {
1945            encoder.debug_check_bounds::<SetKeyDescriptor>(offset);
1946            // Vector header
1947            let max_ordinal: u64 = self.max_ordinal_present();
1948            encoder.write_num(max_ordinal, offset);
1949            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1950            // Calling encoder.out_of_line_offset(0) is not allowed.
1951            if max_ordinal == 0 {
1952                return Ok(());
1953            }
1954            depth.increment()?;
1955            let envelope_size = 8;
1956            let bytes_len = max_ordinal as usize * envelope_size;
1957            #[allow(unused_variables)]
1958            let offset = encoder.out_of_line_offset(bytes_len);
1959            let mut _prev_end_offset: usize = 0;
1960            if 1 > max_ordinal {
1961                return Ok(());
1962            }
1963
1964            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1965            // are envelope_size bytes.
1966            let cur_offset: usize = (1 - 1) * envelope_size;
1967
1968            // Zero reserved fields.
1969            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1970
1971            // Safety:
1972            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1973            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1974            //   envelope_size bytes, there is always sufficient room.
1975            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32>, D>(
1976                self.key.as_ref().map(
1977                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
1978                ),
1979                encoder,
1980                offset + cur_offset,
1981                depth,
1982            )?;
1983
1984            _prev_end_offset = cur_offset + envelope_size;
1985            if 2 > max_ordinal {
1986                return Ok(());
1987            }
1988
1989            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1990            // are envelope_size bytes.
1991            let cur_offset: usize = (2 - 1) * envelope_size;
1992
1993            // Zero reserved fields.
1994            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1995
1996            // Safety:
1997            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1998            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1999            //   envelope_size bytes, there is always sufficient room.
2000            fidl::encoding::encode_in_envelope_optional::<u16, D>(
2001                self.key_id.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
2002                encoder,
2003                offset + cur_offset,
2004                depth,
2005            )?;
2006
2007            _prev_end_offset = cur_offset + envelope_size;
2008            if 3 > max_ordinal {
2009                return Ok(());
2010            }
2011
2012            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2013            // are envelope_size bytes.
2014            let cur_offset: usize = (3 - 1) * envelope_size;
2015
2016            // Zero reserved fields.
2017            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2018
2019            // Safety:
2020            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2021            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2022            //   envelope_size bytes, there is always sufficient room.
2023            fidl::encoding::encode_in_envelope_optional::<KeyType, D>(
2024                self.key_type.as_ref().map(<KeyType as fidl::encoding::ValueTypeMarker>::borrow),
2025                encoder,
2026                offset + cur_offset,
2027                depth,
2028            )?;
2029
2030            _prev_end_offset = cur_offset + envelope_size;
2031            if 4 > max_ordinal {
2032                return Ok(());
2033            }
2034
2035            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2036            // are envelope_size bytes.
2037            let cur_offset: usize = (4 - 1) * envelope_size;
2038
2039            // Zero reserved fields.
2040            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2041
2042            // Safety:
2043            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2044            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2045            //   envelope_size bytes, there is always sufficient room.
2046            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 6>, D>(
2047                self.peer_addr
2048                    .as_ref()
2049                    .map(<fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow),
2050                encoder,
2051                offset + cur_offset,
2052                depth,
2053            )?;
2054
2055            _prev_end_offset = cur_offset + envelope_size;
2056            if 5 > max_ordinal {
2057                return Ok(());
2058            }
2059
2060            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2061            // are envelope_size bytes.
2062            let cur_offset: usize = (5 - 1) * envelope_size;
2063
2064            // Zero reserved fields.
2065            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2066
2067            // Safety:
2068            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2069            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2070            //   envelope_size bytes, there is always sufficient room.
2071            fidl::encoding::encode_in_envelope_optional::<u64, D>(
2072                self.rsc.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2073                encoder,
2074                offset + cur_offset,
2075                depth,
2076            )?;
2077
2078            _prev_end_offset = cur_offset + envelope_size;
2079            if 6 > max_ordinal {
2080                return Ok(());
2081            }
2082
2083            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2084            // are envelope_size bytes.
2085            let cur_offset: usize = (6 - 1) * envelope_size;
2086
2087            // Zero reserved fields.
2088            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2089
2090            // Safety:
2091            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2092            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2093            //   envelope_size bytes, there is always sufficient room.
2094            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 3>, D>(
2095                self.cipher_oui
2096                    .as_ref()
2097                    .map(<fidl::encoding::Array<u8, 3> as fidl::encoding::ValueTypeMarker>::borrow),
2098                encoder,
2099                offset + cur_offset,
2100                depth,
2101            )?;
2102
2103            _prev_end_offset = cur_offset + envelope_size;
2104            if 7 > max_ordinal {
2105                return Ok(());
2106            }
2107
2108            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
2109            // are envelope_size bytes.
2110            let cur_offset: usize = (7 - 1) * envelope_size;
2111
2112            // Zero reserved fields.
2113            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2114
2115            // Safety:
2116            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
2117            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
2118            //   envelope_size bytes, there is always sufficient room.
2119            fidl::encoding::encode_in_envelope_optional::<CipherSuiteType, D>(
2120                self.cipher_type
2121                    .as_ref()
2122                    .map(<CipherSuiteType as fidl::encoding::ValueTypeMarker>::borrow),
2123                encoder,
2124                offset + cur_offset,
2125                depth,
2126            )?;
2127
2128            _prev_end_offset = cur_offset + envelope_size;
2129
2130            Ok(())
2131        }
2132    }
2133
2134    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SetKeyDescriptor {
2135        #[inline(always)]
2136        fn new_empty() -> Self {
2137            Self::default()
2138        }
2139
2140        unsafe fn decode(
2141            &mut self,
2142            decoder: &mut fidl::encoding::Decoder<'_, D>,
2143            offset: usize,
2144            mut depth: fidl::encoding::Depth,
2145        ) -> fidl::Result<()> {
2146            decoder.debug_check_bounds::<Self>(offset);
2147            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2148                None => return Err(fidl::Error::NotNullable),
2149                Some(len) => len,
2150            };
2151            // Calling decoder.out_of_line_offset(0) is not allowed.
2152            if len == 0 {
2153                return Ok(());
2154            };
2155            depth.increment()?;
2156            let envelope_size = 8;
2157            let bytes_len = len * envelope_size;
2158            let offset = decoder.out_of_line_offset(bytes_len)?;
2159            // Decode the envelope for each type.
2160            let mut _next_ordinal_to_read = 0;
2161            let mut next_offset = offset;
2162            let end_offset = offset + bytes_len;
2163            _next_ordinal_to_read += 1;
2164            if next_offset >= end_offset {
2165                return Ok(());
2166            }
2167
2168            // Decode unknown envelopes for gaps in ordinals.
2169            while _next_ordinal_to_read < 1 {
2170                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2171                _next_ordinal_to_read += 1;
2172                next_offset += envelope_size;
2173            }
2174
2175            let next_out_of_line = decoder.next_out_of_line();
2176            let handles_before = decoder.remaining_handles();
2177            if let Some((inlined, num_bytes, num_handles)) =
2178                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2179            {
2180                let member_inline_size =
2181                    <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
2182                        decoder.context,
2183                    );
2184                if inlined != (member_inline_size <= 4) {
2185                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2186                }
2187                let inner_offset;
2188                let mut inner_depth = depth.clone();
2189                if inlined {
2190                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2191                    inner_offset = next_offset;
2192                } else {
2193                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2194                    inner_depth.increment()?;
2195                }
2196                let val_ref = self
2197                    .key
2198                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D));
2199                fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
2200                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2201                {
2202                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2203                }
2204                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2205                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2206                }
2207            }
2208
2209            next_offset += envelope_size;
2210            _next_ordinal_to_read += 1;
2211            if next_offset >= end_offset {
2212                return Ok(());
2213            }
2214
2215            // Decode unknown envelopes for gaps in ordinals.
2216            while _next_ordinal_to_read < 2 {
2217                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2218                _next_ordinal_to_read += 1;
2219                next_offset += envelope_size;
2220            }
2221
2222            let next_out_of_line = decoder.next_out_of_line();
2223            let handles_before = decoder.remaining_handles();
2224            if let Some((inlined, num_bytes, num_handles)) =
2225                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2226            {
2227                let member_inline_size =
2228                    <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2229                if inlined != (member_inline_size <= 4) {
2230                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2231                }
2232                let inner_offset;
2233                let mut inner_depth = depth.clone();
2234                if inlined {
2235                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2236                    inner_offset = next_offset;
2237                } else {
2238                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2239                    inner_depth.increment()?;
2240                }
2241                let val_ref = self.key_id.get_or_insert_with(|| fidl::new_empty!(u16, D));
2242                fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
2243                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2244                {
2245                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2246                }
2247                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2248                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2249                }
2250            }
2251
2252            next_offset += envelope_size;
2253            _next_ordinal_to_read += 1;
2254            if next_offset >= end_offset {
2255                return Ok(());
2256            }
2257
2258            // Decode unknown envelopes for gaps in ordinals.
2259            while _next_ordinal_to_read < 3 {
2260                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2261                _next_ordinal_to_read += 1;
2262                next_offset += envelope_size;
2263            }
2264
2265            let next_out_of_line = decoder.next_out_of_line();
2266            let handles_before = decoder.remaining_handles();
2267            if let Some((inlined, num_bytes, num_handles)) =
2268                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2269            {
2270                let member_inline_size =
2271                    <KeyType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2272                if inlined != (member_inline_size <= 4) {
2273                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2274                }
2275                let inner_offset;
2276                let mut inner_depth = depth.clone();
2277                if inlined {
2278                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2279                    inner_offset = next_offset;
2280                } else {
2281                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2282                    inner_depth.increment()?;
2283                }
2284                let val_ref = self.key_type.get_or_insert_with(|| fidl::new_empty!(KeyType, D));
2285                fidl::decode!(KeyType, D, val_ref, decoder, inner_offset, inner_depth)?;
2286                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2287                {
2288                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2289                }
2290                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2291                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2292                }
2293            }
2294
2295            next_offset += envelope_size;
2296            _next_ordinal_to_read += 1;
2297            if next_offset >= end_offset {
2298                return Ok(());
2299            }
2300
2301            // Decode unknown envelopes for gaps in ordinals.
2302            while _next_ordinal_to_read < 4 {
2303                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2304                _next_ordinal_to_read += 1;
2305                next_offset += envelope_size;
2306            }
2307
2308            let next_out_of_line = decoder.next_out_of_line();
2309            let handles_before = decoder.remaining_handles();
2310            if let Some((inlined, num_bytes, num_handles)) =
2311                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2312            {
2313                let member_inline_size =
2314                    <fidl::encoding::Array<u8, 6> as fidl::encoding::TypeMarker>::inline_size(
2315                        decoder.context,
2316                    );
2317                if inlined != (member_inline_size <= 4) {
2318                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2319                }
2320                let inner_offset;
2321                let mut inner_depth = depth.clone();
2322                if inlined {
2323                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2324                    inner_offset = next_offset;
2325                } else {
2326                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2327                    inner_depth.increment()?;
2328                }
2329                let val_ref = self
2330                    .peer_addr
2331                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 6>, D));
2332                fidl::decode!(fidl::encoding::Array<u8, 6>, D, val_ref, decoder, inner_offset, inner_depth)?;
2333                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2334                {
2335                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2336                }
2337                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2338                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2339                }
2340            }
2341
2342            next_offset += envelope_size;
2343            _next_ordinal_to_read += 1;
2344            if next_offset >= end_offset {
2345                return Ok(());
2346            }
2347
2348            // Decode unknown envelopes for gaps in ordinals.
2349            while _next_ordinal_to_read < 5 {
2350                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2351                _next_ordinal_to_read += 1;
2352                next_offset += envelope_size;
2353            }
2354
2355            let next_out_of_line = decoder.next_out_of_line();
2356            let handles_before = decoder.remaining_handles();
2357            if let Some((inlined, num_bytes, num_handles)) =
2358                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2359            {
2360                let member_inline_size =
2361                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2362                if inlined != (member_inline_size <= 4) {
2363                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2364                }
2365                let inner_offset;
2366                let mut inner_depth = depth.clone();
2367                if inlined {
2368                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2369                    inner_offset = next_offset;
2370                } else {
2371                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2372                    inner_depth.increment()?;
2373                }
2374                let val_ref = self.rsc.get_or_insert_with(|| fidl::new_empty!(u64, D));
2375                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2376                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2377                {
2378                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2379                }
2380                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2381                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2382                }
2383            }
2384
2385            next_offset += envelope_size;
2386            _next_ordinal_to_read += 1;
2387            if next_offset >= end_offset {
2388                return Ok(());
2389            }
2390
2391            // Decode unknown envelopes for gaps in ordinals.
2392            while _next_ordinal_to_read < 6 {
2393                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2394                _next_ordinal_to_read += 1;
2395                next_offset += envelope_size;
2396            }
2397
2398            let next_out_of_line = decoder.next_out_of_line();
2399            let handles_before = decoder.remaining_handles();
2400            if let Some((inlined, num_bytes, num_handles)) =
2401                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2402            {
2403                let member_inline_size =
2404                    <fidl::encoding::Array<u8, 3> as fidl::encoding::TypeMarker>::inline_size(
2405                        decoder.context,
2406                    );
2407                if inlined != (member_inline_size <= 4) {
2408                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2409                }
2410                let inner_offset;
2411                let mut inner_depth = depth.clone();
2412                if inlined {
2413                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2414                    inner_offset = next_offset;
2415                } else {
2416                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2417                    inner_depth.increment()?;
2418                }
2419                let val_ref = self
2420                    .cipher_oui
2421                    .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 3>, D));
2422                fidl::decode!(fidl::encoding::Array<u8, 3>, D, val_ref, decoder, inner_offset, inner_depth)?;
2423                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2424                {
2425                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2426                }
2427                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2428                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2429                }
2430            }
2431
2432            next_offset += envelope_size;
2433            _next_ordinal_to_read += 1;
2434            if next_offset >= end_offset {
2435                return Ok(());
2436            }
2437
2438            // Decode unknown envelopes for gaps in ordinals.
2439            while _next_ordinal_to_read < 7 {
2440                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2441                _next_ordinal_to_read += 1;
2442                next_offset += envelope_size;
2443            }
2444
2445            let next_out_of_line = decoder.next_out_of_line();
2446            let handles_before = decoder.remaining_handles();
2447            if let Some((inlined, num_bytes, num_handles)) =
2448                fidl::encoding::decode_envelope_header(decoder, next_offset)?
2449            {
2450                let member_inline_size =
2451                    <CipherSuiteType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2452                if inlined != (member_inline_size <= 4) {
2453                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
2454                }
2455                let inner_offset;
2456                let mut inner_depth = depth.clone();
2457                if inlined {
2458                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2459                    inner_offset = next_offset;
2460                } else {
2461                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2462                    inner_depth.increment()?;
2463                }
2464                let val_ref =
2465                    self.cipher_type.get_or_insert_with(|| fidl::new_empty!(CipherSuiteType, D));
2466                fidl::decode!(CipherSuiteType, D, val_ref, decoder, inner_offset, inner_depth)?;
2467                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2468                {
2469                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
2470                }
2471                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2472                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2473                }
2474            }
2475
2476            next_offset += envelope_size;
2477
2478            // Decode the remaining unknown envelopes.
2479            while next_offset < end_offset {
2480                _next_ordinal_to_read += 1;
2481                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2482                next_offset += envelope_size;
2483            }
2484
2485            Ok(())
2486        }
2487    }
2488}