1#![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
19pub 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
32pub const MAX_MESH_ID_BYTE_LEN: u8 = 32;
34
35pub const MAX_MGMT_FRAME_MAC_HEADER_BYTE_LEN: u8 = 28;
37
38pub const MAX_MMPDU_BYTE_LEN: u16 = 2304;
40
41pub const MAX_SSID_BYTE_LEN: u8 = 32;
48
49pub const MAX_SUPPORTED_BASIC_RATES: u8 = 12;
50
51pub 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
65pub const SSID_LIST_MAX: u8 = 84;
69
70pub 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
79pub const WLAN_IE_MAX_LEN: u32 = 257;
84
85pub const WLAN_MSDU_MAX_LEN: u32 = 2304;
87
88#[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#[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#[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#[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 FourwayHandshakeTimeout,
289 GkHandshakeTimeout,
290 HandshakeElementMismatch,
291 ReasonInvalidGroupCipher,
292 ReasonInvalidPairwiseCipher,
293 ReasonInvalidAkmp,
294 UnsupportedRsneVersion,
295 InvalidRsneCapabilities,
296 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 EndTsBaDls,
313 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 MlmeLinkFailed,
344 FwRxStalled,
346 FwHighWmeRxErrRate,
348 #[doc(hidden)]
349 __SourceBreaking {
350 unknown_ordinal: u16,
351 },
352}
353
354#[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#[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 SecurityDisabled = 5,
601 UnacceptableLifetime = 6,
602 NotInSameBss = 7,
603 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 RejectedSpectrumManagementRequired = 22,
616 RejectedBadPowerCapability = 23,
617 RejectedBadSupportedChannels = 24,
618 DeniedNoShortSlotTimeSupport = 25,
619 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 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 RejectedForSspPermissions = 67,
662 RefusedUnauthenticatedAccessNotSupported = 68,
663 InvalidRsne = 72,
665 UApsdCoexistanceNotSupported = 73,
666 UApsdCoexModeNotSupported = 74,
667 BadIntervalWithUApsdCoex = 75,
668 AntiCloggingTokenRequired = 76,
669 UnsupportedFiniteCyclicGroup = 77,
670 CannotFindAlternativeTbtt = 78,
671 TransmissionFailure = 79,
672 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 JoinFailure = 256,
703 SpuriousDeauthOrDisassoc = 257,
705 Canceled = 258,
707 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 #[deprecated = "Strict enums should not use `is_unknown`"]
824 #[inline]
825 pub fn is_unknown(&self) -> bool {
826 false
827 }
828}
829
830#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
832#[repr(u32)]
833pub enum WlanAccessCategory {
834 Background = 1,
835 BestEffort = 2,
836 Video = 3,
837 Voice = 4,
838}
839
840impl WlanAccessCategory {
841 #[inline]
842 pub fn from_primitive(prim: u32) -> Option<Self> {
843 match prim {
844 1 => Some(Self::Background),
845 2 => Some(Self::BestEffort),
846 3 => Some(Self::Video),
847 4 => Some(Self::Voice),
848 _ => None,
849 }
850 }
851
852 #[inline]
853 pub const fn into_primitive(self) -> u32 {
854 self as u32
855 }
856
857 #[deprecated = "Strict enums should not use `is_unknown`"]
858 #[inline]
859 pub fn is_unknown(&self) -> bool {
860 false
861 }
862}
863
864#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
875pub enum WlanBand {
876 TwoGhz,
877 FiveGhz,
878 #[doc(hidden)]
879 __SourceBreaking {
880 unknown_ordinal: u8,
881 },
882}
883
884#[macro_export]
886macro_rules! WlanBandUnknown {
887 () => {
888 _
889 };
890}
891
892impl WlanBand {
893 #[inline]
894 pub fn from_primitive(prim: u8) -> Option<Self> {
895 match prim {
896 0 => Some(Self::TwoGhz),
897 1 => Some(Self::FiveGhz),
898 _ => None,
899 }
900 }
901
902 #[inline]
903 pub fn from_primitive_allow_unknown(prim: u8) -> Self {
904 match prim {
905 0 => Self::TwoGhz,
906 1 => Self::FiveGhz,
907 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
908 }
909 }
910
911 #[inline]
912 pub fn unknown() -> Self {
913 Self::__SourceBreaking { unknown_ordinal: 0xff }
914 }
915
916 #[inline]
917 pub const fn into_primitive(self) -> u8 {
918 match self {
919 Self::TwoGhz => 0,
920 Self::FiveGhz => 1,
921 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
922 }
923 }
924
925 #[inline]
926 pub fn is_unknown(&self) -> bool {
927 match self {
928 Self::__SourceBreaking { unknown_ordinal: _ } => true,
929 _ => false,
930 }
931 }
932}
933
934#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
935#[repr(C)]
936pub struct CSsid {
937 pub len: u8,
938 pub data: [u8; 32],
939}
940
941impl fidl::Persistable for CSsid {}
942
943#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
944#[repr(C)]
945pub struct HtCapabilities {
946 pub bytes: [u8; 26],
947}
948
949impl fidl::Persistable for HtCapabilities {}
950
951#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
952#[repr(C)]
953pub struct HtOperation {
954 pub bytes: [u8; 22],
955}
956
957impl fidl::Persistable for HtOperation {}
958
959#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
960#[repr(C)]
961pub struct VhtCapabilities {
962 pub bytes: [u8; 12],
963}
964
965impl fidl::Persistable for VhtCapabilities {}
966
967#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
968#[repr(C)]
969pub struct VhtOperation {
970 pub bytes: [u8; 5],
971}
972
973impl fidl::Persistable for VhtOperation {}
974
975#[derive(Clone, Debug, Default, PartialEq)]
977pub struct SetKeyDescriptor {
978 pub key: Option<Vec<u8>>,
983 pub key_id: Option<u16>,
987 pub key_type: Option<KeyType>,
990 pub peer_addr: Option<[u8; 6]>,
994 pub rsc: Option<u64>,
998 pub cipher_oui: Option<[u8; 3]>,
1001 pub cipher_type: Option<CipherSuiteType>,
1004 #[doc(hidden)]
1005 pub __source_breaking: fidl::marker::SourceBreaking,
1006}
1007
1008impl fidl::Persistable for SetKeyDescriptor {}
1009
1010mod internal {
1011 use super::*;
1012 unsafe impl fidl::encoding::TypeMarker for CipherSuiteType {
1013 type Owned = Self;
1014
1015 #[inline(always)]
1016 fn inline_align(_context: fidl::encoding::Context) -> usize {
1017 std::mem::align_of::<u32>()
1018 }
1019
1020 #[inline(always)]
1021 fn inline_size(_context: fidl::encoding::Context) -> usize {
1022 std::mem::size_of::<u32>()
1023 }
1024
1025 #[inline(always)]
1026 fn encode_is_copy() -> bool {
1027 false
1028 }
1029
1030 #[inline(always)]
1031 fn decode_is_copy() -> bool {
1032 false
1033 }
1034 }
1035
1036 impl fidl::encoding::ValueTypeMarker for CipherSuiteType {
1037 type Borrowed<'a> = Self;
1038 #[inline(always)]
1039 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1040 *value
1041 }
1042 }
1043
1044 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1045 for CipherSuiteType
1046 {
1047 #[inline]
1048 unsafe fn encode(
1049 self,
1050 encoder: &mut fidl::encoding::Encoder<'_, D>,
1051 offset: usize,
1052 _depth: fidl::encoding::Depth,
1053 ) -> fidl::Result<()> {
1054 encoder.debug_check_bounds::<Self>(offset);
1055 encoder.write_num(self.into_primitive(), offset);
1056 Ok(())
1057 }
1058 }
1059
1060 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CipherSuiteType {
1061 #[inline(always)]
1062 fn new_empty() -> Self {
1063 Self::unknown()
1064 }
1065
1066 #[inline]
1067 unsafe fn decode(
1068 &mut self,
1069 decoder: &mut fidl::encoding::Decoder<'_, D>,
1070 offset: usize,
1071 _depth: fidl::encoding::Depth,
1072 ) -> fidl::Result<()> {
1073 decoder.debug_check_bounds::<Self>(offset);
1074 let prim = decoder.read_num::<u32>(offset);
1075
1076 *self = Self::from_primitive_allow_unknown(prim);
1077 Ok(())
1078 }
1079 }
1080 unsafe impl fidl::encoding::TypeMarker for KeyType {
1081 type Owned = Self;
1082
1083 #[inline(always)]
1084 fn inline_align(_context: fidl::encoding::Context) -> usize {
1085 std::mem::align_of::<u8>()
1086 }
1087
1088 #[inline(always)]
1089 fn inline_size(_context: fidl::encoding::Context) -> usize {
1090 std::mem::size_of::<u8>()
1091 }
1092
1093 #[inline(always)]
1094 fn encode_is_copy() -> bool {
1095 false
1096 }
1097
1098 #[inline(always)]
1099 fn decode_is_copy() -> bool {
1100 false
1101 }
1102 }
1103
1104 impl fidl::encoding::ValueTypeMarker for KeyType {
1105 type Borrowed<'a> = Self;
1106 #[inline(always)]
1107 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1108 *value
1109 }
1110 }
1111
1112 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for KeyType {
1113 #[inline]
1114 unsafe fn encode(
1115 self,
1116 encoder: &mut fidl::encoding::Encoder<'_, D>,
1117 offset: usize,
1118 _depth: fidl::encoding::Depth,
1119 ) -> fidl::Result<()> {
1120 encoder.debug_check_bounds::<Self>(offset);
1121 encoder.write_num(self.into_primitive(), offset);
1122 Ok(())
1123 }
1124 }
1125
1126 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for KeyType {
1127 #[inline(always)]
1128 fn new_empty() -> Self {
1129 Self::unknown()
1130 }
1131
1132 #[inline]
1133 unsafe fn decode(
1134 &mut self,
1135 decoder: &mut fidl::encoding::Decoder<'_, D>,
1136 offset: usize,
1137 _depth: fidl::encoding::Depth,
1138 ) -> fidl::Result<()> {
1139 decoder.debug_check_bounds::<Self>(offset);
1140 let prim = decoder.read_num::<u8>(offset);
1141
1142 *self = Self::from_primitive_allow_unknown(prim);
1143 Ok(())
1144 }
1145 }
1146 unsafe impl fidl::encoding::TypeMarker for ReasonCode {
1147 type Owned = Self;
1148
1149 #[inline(always)]
1150 fn inline_align(_context: fidl::encoding::Context) -> usize {
1151 std::mem::align_of::<u16>()
1152 }
1153
1154 #[inline(always)]
1155 fn inline_size(_context: fidl::encoding::Context) -> usize {
1156 std::mem::size_of::<u16>()
1157 }
1158
1159 #[inline(always)]
1160 fn encode_is_copy() -> bool {
1161 false
1162 }
1163
1164 #[inline(always)]
1165 fn decode_is_copy() -> bool {
1166 false
1167 }
1168 }
1169
1170 impl fidl::encoding::ValueTypeMarker for ReasonCode {
1171 type Borrowed<'a> = Self;
1172 #[inline(always)]
1173 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1174 *value
1175 }
1176 }
1177
1178 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for ReasonCode {
1179 #[inline]
1180 unsafe fn encode(
1181 self,
1182 encoder: &mut fidl::encoding::Encoder<'_, D>,
1183 offset: usize,
1184 _depth: fidl::encoding::Depth,
1185 ) -> fidl::Result<()> {
1186 encoder.debug_check_bounds::<Self>(offset);
1187 encoder.write_num(self.into_primitive(), offset);
1188 Ok(())
1189 }
1190 }
1191
1192 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ReasonCode {
1193 #[inline(always)]
1194 fn new_empty() -> Self {
1195 Self::unknown()
1196 }
1197
1198 #[inline]
1199 unsafe fn decode(
1200 &mut self,
1201 decoder: &mut fidl::encoding::Decoder<'_, D>,
1202 offset: usize,
1203 _depth: fidl::encoding::Depth,
1204 ) -> fidl::Result<()> {
1205 decoder.debug_check_bounds::<Self>(offset);
1206 let prim = decoder.read_num::<u16>(offset);
1207
1208 *self = Self::from_primitive_allow_unknown(prim);
1209 Ok(())
1210 }
1211 }
1212 unsafe impl fidl::encoding::TypeMarker for StatusCode {
1213 type Owned = Self;
1214
1215 #[inline(always)]
1216 fn inline_align(_context: fidl::encoding::Context) -> usize {
1217 std::mem::align_of::<u16>()
1218 }
1219
1220 #[inline(always)]
1221 fn inline_size(_context: fidl::encoding::Context) -> usize {
1222 std::mem::size_of::<u16>()
1223 }
1224
1225 #[inline(always)]
1226 fn encode_is_copy() -> bool {
1227 true
1228 }
1229
1230 #[inline(always)]
1231 fn decode_is_copy() -> bool {
1232 false
1233 }
1234 }
1235
1236 impl fidl::encoding::ValueTypeMarker for StatusCode {
1237 type Borrowed<'a> = Self;
1238 #[inline(always)]
1239 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1240 *value
1241 }
1242 }
1243
1244 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for StatusCode {
1245 #[inline]
1246 unsafe fn encode(
1247 self,
1248 encoder: &mut fidl::encoding::Encoder<'_, D>,
1249 offset: usize,
1250 _depth: fidl::encoding::Depth,
1251 ) -> fidl::Result<()> {
1252 encoder.debug_check_bounds::<Self>(offset);
1253 encoder.write_num(self.into_primitive(), offset);
1254 Ok(())
1255 }
1256 }
1257
1258 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for StatusCode {
1259 #[inline(always)]
1260 fn new_empty() -> Self {
1261 Self::Success
1262 }
1263
1264 #[inline]
1265 unsafe fn decode(
1266 &mut self,
1267 decoder: &mut fidl::encoding::Decoder<'_, D>,
1268 offset: usize,
1269 _depth: fidl::encoding::Depth,
1270 ) -> fidl::Result<()> {
1271 decoder.debug_check_bounds::<Self>(offset);
1272 let prim = decoder.read_num::<u16>(offset);
1273
1274 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1275 Ok(())
1276 }
1277 }
1278 unsafe impl fidl::encoding::TypeMarker for WlanAccessCategory {
1279 type Owned = Self;
1280
1281 #[inline(always)]
1282 fn inline_align(_context: fidl::encoding::Context) -> usize {
1283 std::mem::align_of::<u32>()
1284 }
1285
1286 #[inline(always)]
1287 fn inline_size(_context: fidl::encoding::Context) -> usize {
1288 std::mem::size_of::<u32>()
1289 }
1290
1291 #[inline(always)]
1292 fn encode_is_copy() -> bool {
1293 true
1294 }
1295
1296 #[inline(always)]
1297 fn decode_is_copy() -> bool {
1298 false
1299 }
1300 }
1301
1302 impl fidl::encoding::ValueTypeMarker for WlanAccessCategory {
1303 type Borrowed<'a> = Self;
1304 #[inline(always)]
1305 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1306 *value
1307 }
1308 }
1309
1310 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
1311 for WlanAccessCategory
1312 {
1313 #[inline]
1314 unsafe fn encode(
1315 self,
1316 encoder: &mut fidl::encoding::Encoder<'_, D>,
1317 offset: usize,
1318 _depth: fidl::encoding::Depth,
1319 ) -> fidl::Result<()> {
1320 encoder.debug_check_bounds::<Self>(offset);
1321 encoder.write_num(self.into_primitive(), offset);
1322 Ok(())
1323 }
1324 }
1325
1326 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanAccessCategory {
1327 #[inline(always)]
1328 fn new_empty() -> Self {
1329 Self::Background
1330 }
1331
1332 #[inline]
1333 unsafe fn decode(
1334 &mut self,
1335 decoder: &mut fidl::encoding::Decoder<'_, D>,
1336 offset: usize,
1337 _depth: fidl::encoding::Depth,
1338 ) -> fidl::Result<()> {
1339 decoder.debug_check_bounds::<Self>(offset);
1340 let prim = decoder.read_num::<u32>(offset);
1341
1342 *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
1343 Ok(())
1344 }
1345 }
1346 unsafe impl fidl::encoding::TypeMarker for WlanBand {
1347 type Owned = Self;
1348
1349 #[inline(always)]
1350 fn inline_align(_context: fidl::encoding::Context) -> usize {
1351 std::mem::align_of::<u8>()
1352 }
1353
1354 #[inline(always)]
1355 fn inline_size(_context: fidl::encoding::Context) -> usize {
1356 std::mem::size_of::<u8>()
1357 }
1358
1359 #[inline(always)]
1360 fn encode_is_copy() -> bool {
1361 false
1362 }
1363
1364 #[inline(always)]
1365 fn decode_is_copy() -> bool {
1366 false
1367 }
1368 }
1369
1370 impl fidl::encoding::ValueTypeMarker for WlanBand {
1371 type Borrowed<'a> = Self;
1372 #[inline(always)]
1373 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1374 *value
1375 }
1376 }
1377
1378 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for WlanBand {
1379 #[inline]
1380 unsafe fn encode(
1381 self,
1382 encoder: &mut fidl::encoding::Encoder<'_, D>,
1383 offset: usize,
1384 _depth: fidl::encoding::Depth,
1385 ) -> fidl::Result<()> {
1386 encoder.debug_check_bounds::<Self>(offset);
1387 encoder.write_num(self.into_primitive(), offset);
1388 Ok(())
1389 }
1390 }
1391
1392 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WlanBand {
1393 #[inline(always)]
1394 fn new_empty() -> Self {
1395 Self::unknown()
1396 }
1397
1398 #[inline]
1399 unsafe fn decode(
1400 &mut self,
1401 decoder: &mut fidl::encoding::Decoder<'_, D>,
1402 offset: usize,
1403 _depth: fidl::encoding::Depth,
1404 ) -> fidl::Result<()> {
1405 decoder.debug_check_bounds::<Self>(offset);
1406 let prim = decoder.read_num::<u8>(offset);
1407
1408 *self = Self::from_primitive_allow_unknown(prim);
1409 Ok(())
1410 }
1411 }
1412
1413 impl fidl::encoding::ValueTypeMarker for CSsid {
1414 type Borrowed<'a> = &'a Self;
1415 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1416 value
1417 }
1418 }
1419
1420 unsafe impl fidl::encoding::TypeMarker for CSsid {
1421 type Owned = Self;
1422
1423 #[inline(always)]
1424 fn inline_align(_context: fidl::encoding::Context) -> usize {
1425 1
1426 }
1427
1428 #[inline(always)]
1429 fn inline_size(_context: fidl::encoding::Context) -> usize {
1430 33
1431 }
1432 #[inline(always)]
1433 fn encode_is_copy() -> bool {
1434 true
1435 }
1436
1437 #[inline(always)]
1438 fn decode_is_copy() -> bool {
1439 true
1440 }
1441 }
1442
1443 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<CSsid, D> for &CSsid {
1444 #[inline]
1445 unsafe fn encode(
1446 self,
1447 encoder: &mut fidl::encoding::Encoder<'_, D>,
1448 offset: usize,
1449 _depth: fidl::encoding::Depth,
1450 ) -> fidl::Result<()> {
1451 encoder.debug_check_bounds::<CSsid>(offset);
1452 unsafe {
1453 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1455 (buf_ptr as *mut CSsid).write_unaligned((self as *const CSsid).read());
1456 }
1459 Ok(())
1460 }
1461 }
1462 unsafe impl<
1463 D: fidl::encoding::ResourceDialect,
1464 T0: fidl::encoding::Encode<u8, D>,
1465 T1: fidl::encoding::Encode<fidl::encoding::Array<u8, 32>, D>,
1466 > fidl::encoding::Encode<CSsid, D> for (T0, T1)
1467 {
1468 #[inline]
1469 unsafe fn encode(
1470 self,
1471 encoder: &mut fidl::encoding::Encoder<'_, D>,
1472 offset: usize,
1473 depth: fidl::encoding::Depth,
1474 ) -> fidl::Result<()> {
1475 encoder.debug_check_bounds::<CSsid>(offset);
1476 self.0.encode(encoder, offset + 0, depth)?;
1480 self.1.encode(encoder, offset + 1, depth)?;
1481 Ok(())
1482 }
1483 }
1484
1485 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CSsid {
1486 #[inline(always)]
1487 fn new_empty() -> Self {
1488 Self {
1489 len: fidl::new_empty!(u8, D),
1490 data: fidl::new_empty!(fidl::encoding::Array<u8, 32>, D),
1491 }
1492 }
1493
1494 #[inline]
1495 unsafe fn decode(
1496 &mut self,
1497 decoder: &mut fidl::encoding::Decoder<'_, D>,
1498 offset: usize,
1499 _depth: fidl::encoding::Depth,
1500 ) -> fidl::Result<()> {
1501 decoder.debug_check_bounds::<Self>(offset);
1502 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1503 unsafe {
1506 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 33);
1507 }
1508 Ok(())
1509 }
1510 }
1511
1512 impl fidl::encoding::ValueTypeMarker for HtCapabilities {
1513 type Borrowed<'a> = &'a Self;
1514 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1515 value
1516 }
1517 }
1518
1519 unsafe impl fidl::encoding::TypeMarker for HtCapabilities {
1520 type Owned = Self;
1521
1522 #[inline(always)]
1523 fn inline_align(_context: fidl::encoding::Context) -> usize {
1524 1
1525 }
1526
1527 #[inline(always)]
1528 fn inline_size(_context: fidl::encoding::Context) -> usize {
1529 26
1530 }
1531 #[inline(always)]
1532 fn encode_is_copy() -> bool {
1533 true
1534 }
1535
1536 #[inline(always)]
1537 fn decode_is_copy() -> bool {
1538 true
1539 }
1540 }
1541
1542 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HtCapabilities, D>
1543 for &HtCapabilities
1544 {
1545 #[inline]
1546 unsafe fn encode(
1547 self,
1548 encoder: &mut fidl::encoding::Encoder<'_, D>,
1549 offset: usize,
1550 _depth: fidl::encoding::Depth,
1551 ) -> fidl::Result<()> {
1552 encoder.debug_check_bounds::<HtCapabilities>(offset);
1553 unsafe {
1554 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1556 (buf_ptr as *mut HtCapabilities)
1557 .write_unaligned((self as *const HtCapabilities).read());
1558 }
1561 Ok(())
1562 }
1563 }
1564 unsafe impl<
1565 D: fidl::encoding::ResourceDialect,
1566 T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 26>, D>,
1567 > fidl::encoding::Encode<HtCapabilities, D> for (T0,)
1568 {
1569 #[inline]
1570 unsafe fn encode(
1571 self,
1572 encoder: &mut fidl::encoding::Encoder<'_, D>,
1573 offset: usize,
1574 depth: fidl::encoding::Depth,
1575 ) -> fidl::Result<()> {
1576 encoder.debug_check_bounds::<HtCapabilities>(offset);
1577 self.0.encode(encoder, offset + 0, depth)?;
1581 Ok(())
1582 }
1583 }
1584
1585 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HtCapabilities {
1586 #[inline(always)]
1587 fn new_empty() -> Self {
1588 Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 26>, D) }
1589 }
1590
1591 #[inline]
1592 unsafe fn decode(
1593 &mut self,
1594 decoder: &mut fidl::encoding::Decoder<'_, D>,
1595 offset: usize,
1596 _depth: fidl::encoding::Depth,
1597 ) -> fidl::Result<()> {
1598 decoder.debug_check_bounds::<Self>(offset);
1599 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1600 unsafe {
1603 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 26);
1604 }
1605 Ok(())
1606 }
1607 }
1608
1609 impl fidl::encoding::ValueTypeMarker for HtOperation {
1610 type Borrowed<'a> = &'a Self;
1611 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1612 value
1613 }
1614 }
1615
1616 unsafe impl fidl::encoding::TypeMarker for HtOperation {
1617 type Owned = Self;
1618
1619 #[inline(always)]
1620 fn inline_align(_context: fidl::encoding::Context) -> usize {
1621 1
1622 }
1623
1624 #[inline(always)]
1625 fn inline_size(_context: fidl::encoding::Context) -> usize {
1626 22
1627 }
1628 #[inline(always)]
1629 fn encode_is_copy() -> bool {
1630 true
1631 }
1632
1633 #[inline(always)]
1634 fn decode_is_copy() -> bool {
1635 true
1636 }
1637 }
1638
1639 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<HtOperation, D>
1640 for &HtOperation
1641 {
1642 #[inline]
1643 unsafe fn encode(
1644 self,
1645 encoder: &mut fidl::encoding::Encoder<'_, D>,
1646 offset: usize,
1647 _depth: fidl::encoding::Depth,
1648 ) -> fidl::Result<()> {
1649 encoder.debug_check_bounds::<HtOperation>(offset);
1650 unsafe {
1651 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1653 (buf_ptr as *mut HtOperation).write_unaligned((self as *const HtOperation).read());
1654 }
1657 Ok(())
1658 }
1659 }
1660 unsafe impl<
1661 D: fidl::encoding::ResourceDialect,
1662 T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 22>, D>,
1663 > fidl::encoding::Encode<HtOperation, D> for (T0,)
1664 {
1665 #[inline]
1666 unsafe fn encode(
1667 self,
1668 encoder: &mut fidl::encoding::Encoder<'_, D>,
1669 offset: usize,
1670 depth: fidl::encoding::Depth,
1671 ) -> fidl::Result<()> {
1672 encoder.debug_check_bounds::<HtOperation>(offset);
1673 self.0.encode(encoder, offset + 0, depth)?;
1677 Ok(())
1678 }
1679 }
1680
1681 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for HtOperation {
1682 #[inline(always)]
1683 fn new_empty() -> Self {
1684 Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 22>, D) }
1685 }
1686
1687 #[inline]
1688 unsafe fn decode(
1689 &mut self,
1690 decoder: &mut fidl::encoding::Decoder<'_, D>,
1691 offset: usize,
1692 _depth: fidl::encoding::Depth,
1693 ) -> fidl::Result<()> {
1694 decoder.debug_check_bounds::<Self>(offset);
1695 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1696 unsafe {
1699 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 22);
1700 }
1701 Ok(())
1702 }
1703 }
1704
1705 impl fidl::encoding::ValueTypeMarker for VhtCapabilities {
1706 type Borrowed<'a> = &'a Self;
1707 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1708 value
1709 }
1710 }
1711
1712 unsafe impl fidl::encoding::TypeMarker for VhtCapabilities {
1713 type Owned = Self;
1714
1715 #[inline(always)]
1716 fn inline_align(_context: fidl::encoding::Context) -> usize {
1717 1
1718 }
1719
1720 #[inline(always)]
1721 fn inline_size(_context: fidl::encoding::Context) -> usize {
1722 12
1723 }
1724 #[inline(always)]
1725 fn encode_is_copy() -> bool {
1726 true
1727 }
1728
1729 #[inline(always)]
1730 fn decode_is_copy() -> bool {
1731 true
1732 }
1733 }
1734
1735 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VhtCapabilities, D>
1736 for &VhtCapabilities
1737 {
1738 #[inline]
1739 unsafe fn encode(
1740 self,
1741 encoder: &mut fidl::encoding::Encoder<'_, D>,
1742 offset: usize,
1743 _depth: fidl::encoding::Depth,
1744 ) -> fidl::Result<()> {
1745 encoder.debug_check_bounds::<VhtCapabilities>(offset);
1746 unsafe {
1747 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1749 (buf_ptr as *mut VhtCapabilities)
1750 .write_unaligned((self as *const VhtCapabilities).read());
1751 }
1754 Ok(())
1755 }
1756 }
1757 unsafe impl<
1758 D: fidl::encoding::ResourceDialect,
1759 T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 12>, D>,
1760 > fidl::encoding::Encode<VhtCapabilities, D> for (T0,)
1761 {
1762 #[inline]
1763 unsafe fn encode(
1764 self,
1765 encoder: &mut fidl::encoding::Encoder<'_, D>,
1766 offset: usize,
1767 depth: fidl::encoding::Depth,
1768 ) -> fidl::Result<()> {
1769 encoder.debug_check_bounds::<VhtCapabilities>(offset);
1770 self.0.encode(encoder, offset + 0, depth)?;
1774 Ok(())
1775 }
1776 }
1777
1778 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VhtCapabilities {
1779 #[inline(always)]
1780 fn new_empty() -> Self {
1781 Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 12>, D) }
1782 }
1783
1784 #[inline]
1785 unsafe fn decode(
1786 &mut self,
1787 decoder: &mut fidl::encoding::Decoder<'_, D>,
1788 offset: usize,
1789 _depth: fidl::encoding::Depth,
1790 ) -> fidl::Result<()> {
1791 decoder.debug_check_bounds::<Self>(offset);
1792 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1793 unsafe {
1796 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 12);
1797 }
1798 Ok(())
1799 }
1800 }
1801
1802 impl fidl::encoding::ValueTypeMarker for VhtOperation {
1803 type Borrowed<'a> = &'a Self;
1804 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1805 value
1806 }
1807 }
1808
1809 unsafe impl fidl::encoding::TypeMarker for VhtOperation {
1810 type Owned = Self;
1811
1812 #[inline(always)]
1813 fn inline_align(_context: fidl::encoding::Context) -> usize {
1814 1
1815 }
1816
1817 #[inline(always)]
1818 fn inline_size(_context: fidl::encoding::Context) -> usize {
1819 5
1820 }
1821 #[inline(always)]
1822 fn encode_is_copy() -> bool {
1823 true
1824 }
1825
1826 #[inline(always)]
1827 fn decode_is_copy() -> bool {
1828 true
1829 }
1830 }
1831
1832 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<VhtOperation, D>
1833 for &VhtOperation
1834 {
1835 #[inline]
1836 unsafe fn encode(
1837 self,
1838 encoder: &mut fidl::encoding::Encoder<'_, D>,
1839 offset: usize,
1840 _depth: fidl::encoding::Depth,
1841 ) -> fidl::Result<()> {
1842 encoder.debug_check_bounds::<VhtOperation>(offset);
1843 unsafe {
1844 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
1846 (buf_ptr as *mut VhtOperation)
1847 .write_unaligned((self as *const VhtOperation).read());
1848 }
1851 Ok(())
1852 }
1853 }
1854 unsafe impl<
1855 D: fidl::encoding::ResourceDialect,
1856 T0: fidl::encoding::Encode<fidl::encoding::Array<u8, 5>, D>,
1857 > fidl::encoding::Encode<VhtOperation, D> for (T0,)
1858 {
1859 #[inline]
1860 unsafe fn encode(
1861 self,
1862 encoder: &mut fidl::encoding::Encoder<'_, D>,
1863 offset: usize,
1864 depth: fidl::encoding::Depth,
1865 ) -> fidl::Result<()> {
1866 encoder.debug_check_bounds::<VhtOperation>(offset);
1867 self.0.encode(encoder, offset + 0, depth)?;
1871 Ok(())
1872 }
1873 }
1874
1875 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for VhtOperation {
1876 #[inline(always)]
1877 fn new_empty() -> Self {
1878 Self { bytes: fidl::new_empty!(fidl::encoding::Array<u8, 5>, D) }
1879 }
1880
1881 #[inline]
1882 unsafe fn decode(
1883 &mut self,
1884 decoder: &mut fidl::encoding::Decoder<'_, D>,
1885 offset: usize,
1886 _depth: fidl::encoding::Depth,
1887 ) -> fidl::Result<()> {
1888 decoder.debug_check_bounds::<Self>(offset);
1889 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
1890 unsafe {
1893 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 5);
1894 }
1895 Ok(())
1896 }
1897 }
1898
1899 impl SetKeyDescriptor {
1900 #[inline(always)]
1901 fn max_ordinal_present(&self) -> u64 {
1902 if let Some(_) = self.cipher_type {
1903 return 7;
1904 }
1905 if let Some(_) = self.cipher_oui {
1906 return 6;
1907 }
1908 if let Some(_) = self.rsc {
1909 return 5;
1910 }
1911 if let Some(_) = self.peer_addr {
1912 return 4;
1913 }
1914 if let Some(_) = self.key_type {
1915 return 3;
1916 }
1917 if let Some(_) = self.key_id {
1918 return 2;
1919 }
1920 if let Some(_) = self.key {
1921 return 1;
1922 }
1923 0
1924 }
1925 }
1926
1927 impl fidl::encoding::ValueTypeMarker for SetKeyDescriptor {
1928 type Borrowed<'a> = &'a Self;
1929 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1930 value
1931 }
1932 }
1933
1934 unsafe impl fidl::encoding::TypeMarker for SetKeyDescriptor {
1935 type Owned = Self;
1936
1937 #[inline(always)]
1938 fn inline_align(_context: fidl::encoding::Context) -> usize {
1939 8
1940 }
1941
1942 #[inline(always)]
1943 fn inline_size(_context: fidl::encoding::Context) -> usize {
1944 16
1945 }
1946 }
1947
1948 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<SetKeyDescriptor, D>
1949 for &SetKeyDescriptor
1950 {
1951 unsafe fn encode(
1952 self,
1953 encoder: &mut fidl::encoding::Encoder<'_, D>,
1954 offset: usize,
1955 mut depth: fidl::encoding::Depth,
1956 ) -> fidl::Result<()> {
1957 encoder.debug_check_bounds::<SetKeyDescriptor>(offset);
1958 let max_ordinal: u64 = self.max_ordinal_present();
1960 encoder.write_num(max_ordinal, offset);
1961 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1962 if max_ordinal == 0 {
1964 return Ok(());
1965 }
1966 depth.increment()?;
1967 let envelope_size = 8;
1968 let bytes_len = max_ordinal as usize * envelope_size;
1969 #[allow(unused_variables)]
1970 let offset = encoder.out_of_line_offset(bytes_len);
1971 let mut _prev_end_offset: usize = 0;
1972 if 1 > max_ordinal {
1973 return Ok(());
1974 }
1975
1976 let cur_offset: usize = (1 - 1) * envelope_size;
1979
1980 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1982
1983 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<u8, 32>, D>(
1988 self.key.as_ref().map(
1989 <fidl::encoding::Vector<u8, 32> as fidl::encoding::ValueTypeMarker>::borrow,
1990 ),
1991 encoder,
1992 offset + cur_offset,
1993 depth,
1994 )?;
1995
1996 _prev_end_offset = cur_offset + envelope_size;
1997 if 2 > max_ordinal {
1998 return Ok(());
1999 }
2000
2001 let cur_offset: usize = (2 - 1) * envelope_size;
2004
2005 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2007
2008 fidl::encoding::encode_in_envelope_optional::<u16, D>(
2013 self.key_id.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
2014 encoder,
2015 offset + cur_offset,
2016 depth,
2017 )?;
2018
2019 _prev_end_offset = cur_offset + envelope_size;
2020 if 3 > max_ordinal {
2021 return Ok(());
2022 }
2023
2024 let cur_offset: usize = (3 - 1) * envelope_size;
2027
2028 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2030
2031 fidl::encoding::encode_in_envelope_optional::<KeyType, D>(
2036 self.key_type.as_ref().map(<KeyType as fidl::encoding::ValueTypeMarker>::borrow),
2037 encoder,
2038 offset + cur_offset,
2039 depth,
2040 )?;
2041
2042 _prev_end_offset = cur_offset + envelope_size;
2043 if 4 > max_ordinal {
2044 return Ok(());
2045 }
2046
2047 let cur_offset: usize = (4 - 1) * envelope_size;
2050
2051 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2053
2054 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 6>, D>(
2059 self.peer_addr
2060 .as_ref()
2061 .map(<fidl::encoding::Array<u8, 6> as fidl::encoding::ValueTypeMarker>::borrow),
2062 encoder,
2063 offset + cur_offset,
2064 depth,
2065 )?;
2066
2067 _prev_end_offset = cur_offset + envelope_size;
2068 if 5 > max_ordinal {
2069 return Ok(());
2070 }
2071
2072 let cur_offset: usize = (5 - 1) * envelope_size;
2075
2076 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2078
2079 fidl::encoding::encode_in_envelope_optional::<u64, D>(
2084 self.rsc.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
2085 encoder,
2086 offset + cur_offset,
2087 depth,
2088 )?;
2089
2090 _prev_end_offset = cur_offset + envelope_size;
2091 if 6 > max_ordinal {
2092 return Ok(());
2093 }
2094
2095 let cur_offset: usize = (6 - 1) * envelope_size;
2098
2099 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2101
2102 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Array<u8, 3>, D>(
2107 self.cipher_oui
2108 .as_ref()
2109 .map(<fidl::encoding::Array<u8, 3> as fidl::encoding::ValueTypeMarker>::borrow),
2110 encoder,
2111 offset + cur_offset,
2112 depth,
2113 )?;
2114
2115 _prev_end_offset = cur_offset + envelope_size;
2116 if 7 > max_ordinal {
2117 return Ok(());
2118 }
2119
2120 let cur_offset: usize = (7 - 1) * envelope_size;
2123
2124 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2126
2127 fidl::encoding::encode_in_envelope_optional::<CipherSuiteType, D>(
2132 self.cipher_type
2133 .as_ref()
2134 .map(<CipherSuiteType as fidl::encoding::ValueTypeMarker>::borrow),
2135 encoder,
2136 offset + cur_offset,
2137 depth,
2138 )?;
2139
2140 _prev_end_offset = cur_offset + envelope_size;
2141
2142 Ok(())
2143 }
2144 }
2145
2146 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for SetKeyDescriptor {
2147 #[inline(always)]
2148 fn new_empty() -> Self {
2149 Self::default()
2150 }
2151
2152 unsafe fn decode(
2153 &mut self,
2154 decoder: &mut fidl::encoding::Decoder<'_, D>,
2155 offset: usize,
2156 mut depth: fidl::encoding::Depth,
2157 ) -> fidl::Result<()> {
2158 decoder.debug_check_bounds::<Self>(offset);
2159 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2160 None => return Err(fidl::Error::NotNullable),
2161 Some(len) => len,
2162 };
2163 if len == 0 {
2165 return Ok(());
2166 };
2167 depth.increment()?;
2168 let envelope_size = 8;
2169 let bytes_len = len * envelope_size;
2170 let offset = decoder.out_of_line_offset(bytes_len)?;
2171 let mut _next_ordinal_to_read = 0;
2173 let mut next_offset = offset;
2174 let end_offset = offset + bytes_len;
2175 _next_ordinal_to_read += 1;
2176 if next_offset >= end_offset {
2177 return Ok(());
2178 }
2179
2180 while _next_ordinal_to_read < 1 {
2182 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2183 _next_ordinal_to_read += 1;
2184 next_offset += envelope_size;
2185 }
2186
2187 let next_out_of_line = decoder.next_out_of_line();
2188 let handles_before = decoder.remaining_handles();
2189 if let Some((inlined, num_bytes, num_handles)) =
2190 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2191 {
2192 let member_inline_size =
2193 <fidl::encoding::Vector<u8, 32> as fidl::encoding::TypeMarker>::inline_size(
2194 decoder.context,
2195 );
2196 if inlined != (member_inline_size <= 4) {
2197 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2198 }
2199 let inner_offset;
2200 let mut inner_depth = depth.clone();
2201 if inlined {
2202 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2203 inner_offset = next_offset;
2204 } else {
2205 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2206 inner_depth.increment()?;
2207 }
2208 let val_ref = self
2209 .key
2210 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<u8, 32>, D));
2211 fidl::decode!(fidl::encoding::Vector<u8, 32>, D, val_ref, decoder, inner_offset, inner_depth)?;
2212 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2213 {
2214 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2215 }
2216 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2217 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2218 }
2219 }
2220
2221 next_offset += envelope_size;
2222 _next_ordinal_to_read += 1;
2223 if next_offset >= end_offset {
2224 return Ok(());
2225 }
2226
2227 while _next_ordinal_to_read < 2 {
2229 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2230 _next_ordinal_to_read += 1;
2231 next_offset += envelope_size;
2232 }
2233
2234 let next_out_of_line = decoder.next_out_of_line();
2235 let handles_before = decoder.remaining_handles();
2236 if let Some((inlined, num_bytes, num_handles)) =
2237 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2238 {
2239 let member_inline_size =
2240 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2241 if inlined != (member_inline_size <= 4) {
2242 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2243 }
2244 let inner_offset;
2245 let mut inner_depth = depth.clone();
2246 if inlined {
2247 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2248 inner_offset = next_offset;
2249 } else {
2250 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2251 inner_depth.increment()?;
2252 }
2253 let val_ref = self.key_id.get_or_insert_with(|| fidl::new_empty!(u16, D));
2254 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
2255 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2256 {
2257 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2258 }
2259 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2260 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2261 }
2262 }
2263
2264 next_offset += envelope_size;
2265 _next_ordinal_to_read += 1;
2266 if next_offset >= end_offset {
2267 return Ok(());
2268 }
2269
2270 while _next_ordinal_to_read < 3 {
2272 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2273 _next_ordinal_to_read += 1;
2274 next_offset += envelope_size;
2275 }
2276
2277 let next_out_of_line = decoder.next_out_of_line();
2278 let handles_before = decoder.remaining_handles();
2279 if let Some((inlined, num_bytes, num_handles)) =
2280 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2281 {
2282 let member_inline_size =
2283 <KeyType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2284 if inlined != (member_inline_size <= 4) {
2285 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2286 }
2287 let inner_offset;
2288 let mut inner_depth = depth.clone();
2289 if inlined {
2290 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2291 inner_offset = next_offset;
2292 } else {
2293 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2294 inner_depth.increment()?;
2295 }
2296 let val_ref = self.key_type.get_or_insert_with(|| fidl::new_empty!(KeyType, D));
2297 fidl::decode!(KeyType, D, val_ref, decoder, inner_offset, inner_depth)?;
2298 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2299 {
2300 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2301 }
2302 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2303 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2304 }
2305 }
2306
2307 next_offset += envelope_size;
2308 _next_ordinal_to_read += 1;
2309 if next_offset >= end_offset {
2310 return Ok(());
2311 }
2312
2313 while _next_ordinal_to_read < 4 {
2315 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2316 _next_ordinal_to_read += 1;
2317 next_offset += envelope_size;
2318 }
2319
2320 let next_out_of_line = decoder.next_out_of_line();
2321 let handles_before = decoder.remaining_handles();
2322 if let Some((inlined, num_bytes, num_handles)) =
2323 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2324 {
2325 let member_inline_size =
2326 <fidl::encoding::Array<u8, 6> as fidl::encoding::TypeMarker>::inline_size(
2327 decoder.context,
2328 );
2329 if inlined != (member_inline_size <= 4) {
2330 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2331 }
2332 let inner_offset;
2333 let mut inner_depth = depth.clone();
2334 if inlined {
2335 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2336 inner_offset = next_offset;
2337 } else {
2338 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2339 inner_depth.increment()?;
2340 }
2341 let val_ref = self
2342 .peer_addr
2343 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 6>, D));
2344 fidl::decode!(fidl::encoding::Array<u8, 6>, D, val_ref, decoder, inner_offset, inner_depth)?;
2345 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2346 {
2347 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2348 }
2349 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2350 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2351 }
2352 }
2353
2354 next_offset += envelope_size;
2355 _next_ordinal_to_read += 1;
2356 if next_offset >= end_offset {
2357 return Ok(());
2358 }
2359
2360 while _next_ordinal_to_read < 5 {
2362 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2363 _next_ordinal_to_read += 1;
2364 next_offset += envelope_size;
2365 }
2366
2367 let next_out_of_line = decoder.next_out_of_line();
2368 let handles_before = decoder.remaining_handles();
2369 if let Some((inlined, num_bytes, num_handles)) =
2370 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2371 {
2372 let member_inline_size =
2373 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2374 if inlined != (member_inline_size <= 4) {
2375 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2376 }
2377 let inner_offset;
2378 let mut inner_depth = depth.clone();
2379 if inlined {
2380 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2381 inner_offset = next_offset;
2382 } else {
2383 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2384 inner_depth.increment()?;
2385 }
2386 let val_ref = self.rsc.get_or_insert_with(|| fidl::new_empty!(u64, D));
2387 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
2388 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2389 {
2390 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2391 }
2392 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2393 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2394 }
2395 }
2396
2397 next_offset += envelope_size;
2398 _next_ordinal_to_read += 1;
2399 if next_offset >= end_offset {
2400 return Ok(());
2401 }
2402
2403 while _next_ordinal_to_read < 6 {
2405 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2406 _next_ordinal_to_read += 1;
2407 next_offset += envelope_size;
2408 }
2409
2410 let next_out_of_line = decoder.next_out_of_line();
2411 let handles_before = decoder.remaining_handles();
2412 if let Some((inlined, num_bytes, num_handles)) =
2413 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2414 {
2415 let member_inline_size =
2416 <fidl::encoding::Array<u8, 3> as fidl::encoding::TypeMarker>::inline_size(
2417 decoder.context,
2418 );
2419 if inlined != (member_inline_size <= 4) {
2420 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2421 }
2422 let inner_offset;
2423 let mut inner_depth = depth.clone();
2424 if inlined {
2425 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2426 inner_offset = next_offset;
2427 } else {
2428 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2429 inner_depth.increment()?;
2430 }
2431 let val_ref = self
2432 .cipher_oui
2433 .get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Array<u8, 3>, D));
2434 fidl::decode!(fidl::encoding::Array<u8, 3>, D, val_ref, decoder, inner_offset, inner_depth)?;
2435 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2436 {
2437 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2438 }
2439 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2440 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2441 }
2442 }
2443
2444 next_offset += envelope_size;
2445 _next_ordinal_to_read += 1;
2446 if next_offset >= end_offset {
2447 return Ok(());
2448 }
2449
2450 while _next_ordinal_to_read < 7 {
2452 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2453 _next_ordinal_to_read += 1;
2454 next_offset += envelope_size;
2455 }
2456
2457 let next_out_of_line = decoder.next_out_of_line();
2458 let handles_before = decoder.remaining_handles();
2459 if let Some((inlined, num_bytes, num_handles)) =
2460 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2461 {
2462 let member_inline_size =
2463 <CipherSuiteType as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2464 if inlined != (member_inline_size <= 4) {
2465 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2466 }
2467 let inner_offset;
2468 let mut inner_depth = depth.clone();
2469 if inlined {
2470 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2471 inner_offset = next_offset;
2472 } else {
2473 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2474 inner_depth.increment()?;
2475 }
2476 let val_ref =
2477 self.cipher_type.get_or_insert_with(|| fidl::new_empty!(CipherSuiteType, D));
2478 fidl::decode!(CipherSuiteType, D, val_ref, decoder, inner_offset, inner_depth)?;
2479 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2480 {
2481 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2482 }
2483 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2484 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2485 }
2486 }
2487
2488 next_offset += envelope_size;
2489
2490 while next_offset < end_offset {
2492 _next_ordinal_to_read += 1;
2493 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2494 next_offset += envelope_size;
2495 }
2496
2497 Ok(())
2498 }
2499 }
2500}