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 PacketCaptureName = String;
12
13pub const DEFAULT_SNAP_LEN: u32 = 262144;
20
21pub const MIN_BUFFER_SIZE: u32 = DEFAULT_SNAP_LEN as u32;
23
24#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
26pub enum CloseSessionError {
27 InterfaceNotFound,
29 NotSupported,
32 #[doc(hidden)]
33 __SourceBreaking { unknown_ordinal: u32 },
34}
35
36#[macro_export]
38macro_rules! CloseSessionErrorUnknown {
39 () => {
40 _
41 };
42}
43
44impl CloseSessionError {
45 #[inline]
46 pub fn from_primitive(prim: u32) -> Option<Self> {
47 match prim {
48 1 => Some(Self::InterfaceNotFound),
49 2 => Some(Self::NotSupported),
50 _ => None,
51 }
52 }
53
54 #[inline]
55 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
56 match prim {
57 1 => Self::InterfaceNotFound,
58 2 => Self::NotSupported,
59 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
60 }
61 }
62
63 #[inline]
64 pub fn unknown() -> Self {
65 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
66 }
67
68 #[inline]
69 pub const fn into_primitive(self) -> u32 {
70 match self {
71 Self::InterfaceNotFound => 1,
72 Self::NotSupported => 2,
73 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
74 }
75 }
76
77 #[inline]
78 pub fn is_unknown(&self) -> bool {
79 match self {
80 Self::__SourceBreaking { unknown_ordinal: _ } => true,
81 _ => false,
82 }
83 }
84}
85
86#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
88pub enum PacketCaptureEndReason {
89 InterfaceRemoved,
94 UserRequest,
96 #[doc(hidden)]
97 __SourceBreaking { unknown_ordinal: u32 },
98}
99
100#[macro_export]
102macro_rules! PacketCaptureEndReasonUnknown {
103 () => {
104 _
105 };
106}
107
108impl PacketCaptureEndReason {
109 #[inline]
110 pub fn from_primitive(prim: u32) -> Option<Self> {
111 match prim {
112 1 => Some(Self::InterfaceRemoved),
113 2 => Some(Self::UserRequest),
114 _ => None,
115 }
116 }
117
118 #[inline]
119 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
120 match prim {
121 1 => Self::InterfaceRemoved,
122 2 => Self::UserRequest,
123 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
124 }
125 }
126
127 #[inline]
128 pub fn unknown() -> Self {
129 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
130 }
131
132 #[inline]
133 pub const fn into_primitive(self) -> u32 {
134 match self {
135 Self::InterfaceRemoved => 1,
136 Self::UserRequest => 2,
137 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
138 }
139 }
140
141 #[inline]
142 pub fn is_unknown(&self) -> bool {
143 match self {
144 Self::__SourceBreaking { unknown_ordinal: _ } => true,
145 _ => false,
146 }
147 }
148}
149
150#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
152pub enum PacketCaptureReconnectError {
153 NotFound,
155 #[doc(hidden)]
156 __SourceBreaking { unknown_ordinal: u32 },
157}
158
159#[macro_export]
161macro_rules! PacketCaptureReconnectErrorUnknown {
162 () => {
163 _
164 };
165}
166
167impl PacketCaptureReconnectError {
168 #[inline]
169 pub fn from_primitive(prim: u32) -> Option<Self> {
170 match prim {
171 1 => Some(Self::NotFound),
172 _ => None,
173 }
174 }
175
176 #[inline]
177 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
178 match prim {
179 1 => Self::NotFound,
180 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
181 }
182 }
183
184 #[inline]
185 pub fn unknown() -> Self {
186 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
187 }
188
189 #[inline]
190 pub const fn into_primitive(self) -> u32 {
191 match self {
192 Self::NotFound => 1,
193 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
194 }
195 }
196
197 #[inline]
198 pub fn is_unknown(&self) -> bool {
199 match self {
200 Self::__SourceBreaking { unknown_ordinal: _ } => true,
201 _ => false,
202 }
203 }
204}
205
206#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
208pub enum PacketCaptureStartError {
209 QuotaExceeded,
211 InvalidInterfaceIds,
213 InvalidBpfFilter,
215 InvalidBufferSize,
217 CannotAllocateBuffer,
219 #[doc(hidden)]
220 __SourceBreaking { unknown_ordinal: u32 },
221}
222
223#[macro_export]
225macro_rules! PacketCaptureStartErrorUnknown {
226 () => {
227 _
228 };
229}
230
231impl PacketCaptureStartError {
232 #[inline]
233 pub fn from_primitive(prim: u32) -> Option<Self> {
234 match prim {
235 1 => Some(Self::QuotaExceeded),
236 2 => Some(Self::InvalidInterfaceIds),
237 3 => Some(Self::InvalidBpfFilter),
238 4 => Some(Self::InvalidBufferSize),
239 5 => Some(Self::CannotAllocateBuffer),
240 _ => None,
241 }
242 }
243
244 #[inline]
245 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
246 match prim {
247 1 => Self::QuotaExceeded,
248 2 => Self::InvalidInterfaceIds,
249 3 => Self::InvalidBpfFilter,
250 4 => Self::InvalidBufferSize,
251 5 => Self::CannotAllocateBuffer,
252 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
253 }
254 }
255
256 #[inline]
257 pub fn unknown() -> Self {
258 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
259 }
260
261 #[inline]
262 pub const fn into_primitive(self) -> u32 {
263 match self {
264 Self::QuotaExceeded => 1,
265 Self::InvalidInterfaceIds => 2,
266 Self::InvalidBpfFilter => 3,
267 Self::InvalidBufferSize => 4,
268 Self::CannotAllocateBuffer => 5,
269 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
270 }
271 }
272
273 #[inline]
274 pub fn is_unknown(&self) -> bool {
275 match self {
276 Self::__SourceBreaking { unknown_ordinal: _ } => true,
277 _ => false,
278 }
279 }
280}
281
282#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
283pub enum RollingPacketCaptureDetachError {
284 AlreadyDetached,
286 #[doc(hidden)]
287 __SourceBreaking { unknown_ordinal: u32 },
288}
289
290#[macro_export]
292macro_rules! RollingPacketCaptureDetachErrorUnknown {
293 () => {
294 _
295 };
296}
297
298impl RollingPacketCaptureDetachError {
299 #[inline]
300 pub fn from_primitive(prim: u32) -> Option<Self> {
301 match prim {
302 1 => Some(Self::AlreadyDetached),
303 _ => None,
304 }
305 }
306
307 #[inline]
308 pub fn from_primitive_allow_unknown(prim: u32) -> Self {
309 match prim {
310 1 => Self::AlreadyDetached,
311 unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
312 }
313 }
314
315 #[inline]
316 pub fn unknown() -> Self {
317 Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
318 }
319
320 #[inline]
321 pub const fn into_primitive(self) -> u32 {
322 match self {
323 Self::AlreadyDetached => 1,
324 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
325 }
326 }
327
328 #[inline]
329 pub fn is_unknown(&self) -> bool {
330 match self {
331 Self::__SourceBreaking { unknown_ordinal: _ } => true,
332 _ => false,
333 }
334 }
335}
336
337#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
338pub struct Empty;
339
340impl fidl::Persistable for Empty {}
341
342#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
343#[repr(C)]
344pub struct InterfacesCloseBackingSessionRequest {
345 pub id: u64,
346}
347
348impl fidl::Persistable for InterfacesCloseBackingSessionRequest {}
349
350#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
351pub struct RollingPacketCaptureDetachRequest {
352 pub name: String,
353}
354
355impl fidl::Persistable for RollingPacketCaptureDetachRequest {}
356
357#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
358pub struct RollingPacketCaptureOnEndedRequest {
359 pub reason: PacketCaptureEndReason,
361}
362
363impl fidl::Persistable for RollingPacketCaptureOnEndedRequest {}
364
365#[derive(Clone, Debug, Default, PartialEq)]
367pub struct RollingPacketCaptureParams {
368 pub capture_size: Option<u32>,
375 #[doc(hidden)]
376 pub __source_breaking: fidl::marker::SourceBreaking,
377}
378
379impl fidl::Persistable for RollingPacketCaptureParams {}
380
381#[derive(Clone, Debug)]
383pub enum InterfaceSpecifier {
384 Any(Empty),
386 InterfaceIds(Vec<u64>),
388 #[doc(hidden)]
389 __SourceBreaking { unknown_ordinal: u64 },
390}
391
392#[macro_export]
394macro_rules! InterfaceSpecifierUnknown {
395 () => {
396 _
397 };
398}
399
400impl PartialEq for InterfaceSpecifier {
402 fn eq(&self, other: &Self) -> bool {
403 match (self, other) {
404 (Self::Any(x), Self::Any(y)) => *x == *y,
405 (Self::InterfaceIds(x), Self::InterfaceIds(y)) => *x == *y,
406 _ => false,
407 }
408 }
409}
410
411impl InterfaceSpecifier {
412 #[inline]
413 pub fn ordinal(&self) -> u64 {
414 match *self {
415 Self::Any(_) => 1,
416 Self::InterfaceIds(_) => 2,
417 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
418 }
419 }
420
421 #[inline]
422 pub fn unknown_variant_for_testing() -> Self {
423 Self::__SourceBreaking { unknown_ordinal: 0 }
424 }
425
426 #[inline]
427 pub fn is_unknown(&self) -> bool {
428 match self {
429 Self::__SourceBreaking { .. } => true,
430 _ => false,
431 }
432 }
433}
434
435impl fidl::Persistable for InterfaceSpecifier {}
436
437pub mod diagnostics_ordinals {
438 pub const LOG_DEBUG_INFO_TO_SYSLOG: u64 = 0x336c39330bd8e1ac;
439 pub const GET_PROCESS_HANDLE_FOR_INSPECTION: u64 = 0x563e5df030f2f4d5;
440}
441
442pub mod interfaces_ordinals {
443 pub const GET_PORT: u64 = 0xdd15c4df17fb148;
444 pub const CLOSE_BACKING_SESSION: u64 = 0x57da4d8a53ac6d0c;
445}
446
447pub mod packet_capture_provider_ordinals {
448 pub const START_ROLLING: u64 = 0x4a5b2305ea27e845;
449 pub const RECONNECT_ROLLING: u64 = 0x57828e9ed034a522;
450}
451
452pub mod rolling_packet_capture_ordinals {
453 pub const DETACH: u64 = 0xb3d28b9518e7db0;
454 pub const ON_ENDED: u64 = 0x74690c9d4f59f506;
455 pub const STOP_AND_DOWNLOAD: u64 = 0x268270260a49e2ea;
456 pub const DISCARD: u64 = 0x89e60c428d47a1;
457}
458
459mod internal {
460 use super::*;
461 unsafe impl fidl::encoding::TypeMarker for CloseSessionError {
462 type Owned = Self;
463
464 #[inline(always)]
465 fn inline_align(_context: fidl::encoding::Context) -> usize {
466 std::mem::align_of::<u32>()
467 }
468
469 #[inline(always)]
470 fn inline_size(_context: fidl::encoding::Context) -> usize {
471 std::mem::size_of::<u32>()
472 }
473
474 #[inline(always)]
475 fn encode_is_copy() -> bool {
476 false
477 }
478
479 #[inline(always)]
480 fn decode_is_copy() -> bool {
481 false
482 }
483 }
484
485 impl fidl::encoding::ValueTypeMarker for CloseSessionError {
486 type Borrowed<'a> = Self;
487 #[inline(always)]
488 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
489 *value
490 }
491 }
492
493 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
494 for CloseSessionError
495 {
496 #[inline]
497 unsafe fn encode(
498 self,
499 encoder: &mut fidl::encoding::Encoder<'_, D>,
500 offset: usize,
501 _depth: fidl::encoding::Depth,
502 ) -> fidl::Result<()> {
503 encoder.debug_check_bounds::<Self>(offset);
504 encoder.write_num(self.into_primitive(), offset);
505 Ok(())
506 }
507 }
508
509 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for CloseSessionError {
510 #[inline(always)]
511 fn new_empty() -> Self {
512 Self::unknown()
513 }
514
515 #[inline]
516 unsafe fn decode(
517 &mut self,
518 decoder: &mut fidl::encoding::Decoder<'_, D>,
519 offset: usize,
520 _depth: fidl::encoding::Depth,
521 ) -> fidl::Result<()> {
522 decoder.debug_check_bounds::<Self>(offset);
523 let prim = decoder.read_num::<u32>(offset);
524
525 *self = Self::from_primitive_allow_unknown(prim);
526 Ok(())
527 }
528 }
529 unsafe impl fidl::encoding::TypeMarker for PacketCaptureEndReason {
530 type Owned = Self;
531
532 #[inline(always)]
533 fn inline_align(_context: fidl::encoding::Context) -> usize {
534 std::mem::align_of::<u32>()
535 }
536
537 #[inline(always)]
538 fn inline_size(_context: fidl::encoding::Context) -> usize {
539 std::mem::size_of::<u32>()
540 }
541
542 #[inline(always)]
543 fn encode_is_copy() -> bool {
544 false
545 }
546
547 #[inline(always)]
548 fn decode_is_copy() -> bool {
549 false
550 }
551 }
552
553 impl fidl::encoding::ValueTypeMarker for PacketCaptureEndReason {
554 type Borrowed<'a> = Self;
555 #[inline(always)]
556 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
557 *value
558 }
559 }
560
561 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
562 for PacketCaptureEndReason
563 {
564 #[inline]
565 unsafe fn encode(
566 self,
567 encoder: &mut fidl::encoding::Encoder<'_, D>,
568 offset: usize,
569 _depth: fidl::encoding::Depth,
570 ) -> fidl::Result<()> {
571 encoder.debug_check_bounds::<Self>(offset);
572 encoder.write_num(self.into_primitive(), offset);
573 Ok(())
574 }
575 }
576
577 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
578 for PacketCaptureEndReason
579 {
580 #[inline(always)]
581 fn new_empty() -> Self {
582 Self::unknown()
583 }
584
585 #[inline]
586 unsafe fn decode(
587 &mut self,
588 decoder: &mut fidl::encoding::Decoder<'_, D>,
589 offset: usize,
590 _depth: fidl::encoding::Depth,
591 ) -> fidl::Result<()> {
592 decoder.debug_check_bounds::<Self>(offset);
593 let prim = decoder.read_num::<u32>(offset);
594
595 *self = Self::from_primitive_allow_unknown(prim);
596 Ok(())
597 }
598 }
599 unsafe impl fidl::encoding::TypeMarker for PacketCaptureReconnectError {
600 type Owned = Self;
601
602 #[inline(always)]
603 fn inline_align(_context: fidl::encoding::Context) -> usize {
604 std::mem::align_of::<u32>()
605 }
606
607 #[inline(always)]
608 fn inline_size(_context: fidl::encoding::Context) -> usize {
609 std::mem::size_of::<u32>()
610 }
611
612 #[inline(always)]
613 fn encode_is_copy() -> bool {
614 false
615 }
616
617 #[inline(always)]
618 fn decode_is_copy() -> bool {
619 false
620 }
621 }
622
623 impl fidl::encoding::ValueTypeMarker for PacketCaptureReconnectError {
624 type Borrowed<'a> = Self;
625 #[inline(always)]
626 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
627 *value
628 }
629 }
630
631 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
632 for PacketCaptureReconnectError
633 {
634 #[inline]
635 unsafe fn encode(
636 self,
637 encoder: &mut fidl::encoding::Encoder<'_, D>,
638 offset: usize,
639 _depth: fidl::encoding::Depth,
640 ) -> fidl::Result<()> {
641 encoder.debug_check_bounds::<Self>(offset);
642 encoder.write_num(self.into_primitive(), offset);
643 Ok(())
644 }
645 }
646
647 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
648 for PacketCaptureReconnectError
649 {
650 #[inline(always)]
651 fn new_empty() -> Self {
652 Self::unknown()
653 }
654
655 #[inline]
656 unsafe fn decode(
657 &mut self,
658 decoder: &mut fidl::encoding::Decoder<'_, D>,
659 offset: usize,
660 _depth: fidl::encoding::Depth,
661 ) -> fidl::Result<()> {
662 decoder.debug_check_bounds::<Self>(offset);
663 let prim = decoder.read_num::<u32>(offset);
664
665 *self = Self::from_primitive_allow_unknown(prim);
666 Ok(())
667 }
668 }
669 unsafe impl fidl::encoding::TypeMarker for PacketCaptureStartError {
670 type Owned = Self;
671
672 #[inline(always)]
673 fn inline_align(_context: fidl::encoding::Context) -> usize {
674 std::mem::align_of::<u32>()
675 }
676
677 #[inline(always)]
678 fn inline_size(_context: fidl::encoding::Context) -> usize {
679 std::mem::size_of::<u32>()
680 }
681
682 #[inline(always)]
683 fn encode_is_copy() -> bool {
684 false
685 }
686
687 #[inline(always)]
688 fn decode_is_copy() -> bool {
689 false
690 }
691 }
692
693 impl fidl::encoding::ValueTypeMarker for PacketCaptureStartError {
694 type Borrowed<'a> = Self;
695 #[inline(always)]
696 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
697 *value
698 }
699 }
700
701 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
702 for PacketCaptureStartError
703 {
704 #[inline]
705 unsafe fn encode(
706 self,
707 encoder: &mut fidl::encoding::Encoder<'_, D>,
708 offset: usize,
709 _depth: fidl::encoding::Depth,
710 ) -> fidl::Result<()> {
711 encoder.debug_check_bounds::<Self>(offset);
712 encoder.write_num(self.into_primitive(), offset);
713 Ok(())
714 }
715 }
716
717 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
718 for PacketCaptureStartError
719 {
720 #[inline(always)]
721 fn new_empty() -> Self {
722 Self::unknown()
723 }
724
725 #[inline]
726 unsafe fn decode(
727 &mut self,
728 decoder: &mut fidl::encoding::Decoder<'_, D>,
729 offset: usize,
730 _depth: fidl::encoding::Depth,
731 ) -> fidl::Result<()> {
732 decoder.debug_check_bounds::<Self>(offset);
733 let prim = decoder.read_num::<u32>(offset);
734
735 *self = Self::from_primitive_allow_unknown(prim);
736 Ok(())
737 }
738 }
739 unsafe impl fidl::encoding::TypeMarker for RollingPacketCaptureDetachError {
740 type Owned = Self;
741
742 #[inline(always)]
743 fn inline_align(_context: fidl::encoding::Context) -> usize {
744 std::mem::align_of::<u32>()
745 }
746
747 #[inline(always)]
748 fn inline_size(_context: fidl::encoding::Context) -> usize {
749 std::mem::size_of::<u32>()
750 }
751
752 #[inline(always)]
753 fn encode_is_copy() -> bool {
754 false
755 }
756
757 #[inline(always)]
758 fn decode_is_copy() -> bool {
759 false
760 }
761 }
762
763 impl fidl::encoding::ValueTypeMarker for RollingPacketCaptureDetachError {
764 type Borrowed<'a> = Self;
765 #[inline(always)]
766 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
767 *value
768 }
769 }
770
771 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
772 for RollingPacketCaptureDetachError
773 {
774 #[inline]
775 unsafe fn encode(
776 self,
777 encoder: &mut fidl::encoding::Encoder<'_, D>,
778 offset: usize,
779 _depth: fidl::encoding::Depth,
780 ) -> fidl::Result<()> {
781 encoder.debug_check_bounds::<Self>(offset);
782 encoder.write_num(self.into_primitive(), offset);
783 Ok(())
784 }
785 }
786
787 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
788 for RollingPacketCaptureDetachError
789 {
790 #[inline(always)]
791 fn new_empty() -> Self {
792 Self::unknown()
793 }
794
795 #[inline]
796 unsafe fn decode(
797 &mut self,
798 decoder: &mut fidl::encoding::Decoder<'_, D>,
799 offset: usize,
800 _depth: fidl::encoding::Depth,
801 ) -> fidl::Result<()> {
802 decoder.debug_check_bounds::<Self>(offset);
803 let prim = decoder.read_num::<u32>(offset);
804
805 *self = Self::from_primitive_allow_unknown(prim);
806 Ok(())
807 }
808 }
809
810 impl fidl::encoding::ValueTypeMarker for Empty {
811 type Borrowed<'a> = &'a Self;
812 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
813 value
814 }
815 }
816
817 unsafe impl fidl::encoding::TypeMarker for Empty {
818 type Owned = Self;
819
820 #[inline(always)]
821 fn inline_align(_context: fidl::encoding::Context) -> usize {
822 1
823 }
824
825 #[inline(always)]
826 fn inline_size(_context: fidl::encoding::Context) -> usize {
827 1
828 }
829 }
830
831 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
832 #[inline]
833 unsafe fn encode(
834 self,
835 encoder: &mut fidl::encoding::Encoder<'_, D>,
836 offset: usize,
837 _depth: fidl::encoding::Depth,
838 ) -> fidl::Result<()> {
839 encoder.debug_check_bounds::<Empty>(offset);
840 encoder.write_num(0u8, offset);
841 Ok(())
842 }
843 }
844
845 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
846 #[inline(always)]
847 fn new_empty() -> Self {
848 Self
849 }
850
851 #[inline]
852 unsafe fn decode(
853 &mut self,
854 decoder: &mut fidl::encoding::Decoder<'_, D>,
855 offset: usize,
856 _depth: fidl::encoding::Depth,
857 ) -> fidl::Result<()> {
858 decoder.debug_check_bounds::<Self>(offset);
859 match decoder.read_num::<u8>(offset) {
860 0 => Ok(()),
861 _ => Err(fidl::Error::Invalid),
862 }
863 }
864 }
865
866 impl fidl::encoding::ValueTypeMarker for InterfacesCloseBackingSessionRequest {
867 type Borrowed<'a> = &'a Self;
868 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
869 value
870 }
871 }
872
873 unsafe impl fidl::encoding::TypeMarker for InterfacesCloseBackingSessionRequest {
874 type Owned = Self;
875
876 #[inline(always)]
877 fn inline_align(_context: fidl::encoding::Context) -> usize {
878 8
879 }
880
881 #[inline(always)]
882 fn inline_size(_context: fidl::encoding::Context) -> usize {
883 8
884 }
885 #[inline(always)]
886 fn encode_is_copy() -> bool {
887 true
888 }
889
890 #[inline(always)]
891 fn decode_is_copy() -> bool {
892 true
893 }
894 }
895
896 unsafe impl<D: fidl::encoding::ResourceDialect>
897 fidl::encoding::Encode<InterfacesCloseBackingSessionRequest, D>
898 for &InterfacesCloseBackingSessionRequest
899 {
900 #[inline]
901 unsafe fn encode(
902 self,
903 encoder: &mut fidl::encoding::Encoder<'_, D>,
904 offset: usize,
905 _depth: fidl::encoding::Depth,
906 ) -> fidl::Result<()> {
907 encoder.debug_check_bounds::<InterfacesCloseBackingSessionRequest>(offset);
908 unsafe {
909 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
911 (buf_ptr as *mut InterfacesCloseBackingSessionRequest)
912 .write_unaligned((self as *const InterfacesCloseBackingSessionRequest).read());
913 }
916 Ok(())
917 }
918 }
919 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u64, D>>
920 fidl::encoding::Encode<InterfacesCloseBackingSessionRequest, D> for (T0,)
921 {
922 #[inline]
923 unsafe fn encode(
924 self,
925 encoder: &mut fidl::encoding::Encoder<'_, D>,
926 offset: usize,
927 depth: fidl::encoding::Depth,
928 ) -> fidl::Result<()> {
929 encoder.debug_check_bounds::<InterfacesCloseBackingSessionRequest>(offset);
930 self.0.encode(encoder, offset + 0, depth)?;
934 Ok(())
935 }
936 }
937
938 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
939 for InterfacesCloseBackingSessionRequest
940 {
941 #[inline(always)]
942 fn new_empty() -> Self {
943 Self { id: fidl::new_empty!(u64, D) }
944 }
945
946 #[inline]
947 unsafe fn decode(
948 &mut self,
949 decoder: &mut fidl::encoding::Decoder<'_, D>,
950 offset: usize,
951 _depth: fidl::encoding::Depth,
952 ) -> fidl::Result<()> {
953 decoder.debug_check_bounds::<Self>(offset);
954 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
955 unsafe {
958 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 8);
959 }
960 Ok(())
961 }
962 }
963
964 impl fidl::encoding::ValueTypeMarker for RollingPacketCaptureDetachRequest {
965 type Borrowed<'a> = &'a Self;
966 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
967 value
968 }
969 }
970
971 unsafe impl fidl::encoding::TypeMarker for RollingPacketCaptureDetachRequest {
972 type Owned = Self;
973
974 #[inline(always)]
975 fn inline_align(_context: fidl::encoding::Context) -> usize {
976 8
977 }
978
979 #[inline(always)]
980 fn inline_size(_context: fidl::encoding::Context) -> usize {
981 16
982 }
983 }
984
985 unsafe impl<D: fidl::encoding::ResourceDialect>
986 fidl::encoding::Encode<RollingPacketCaptureDetachRequest, D>
987 for &RollingPacketCaptureDetachRequest
988 {
989 #[inline]
990 unsafe fn encode(
991 self,
992 encoder: &mut fidl::encoding::Encoder<'_, D>,
993 offset: usize,
994 _depth: fidl::encoding::Depth,
995 ) -> fidl::Result<()> {
996 encoder.debug_check_bounds::<RollingPacketCaptureDetachRequest>(offset);
997 fidl::encoding::Encode::<RollingPacketCaptureDetachRequest, D>::encode(
999 (<fidl::encoding::BoundedString<64> as fidl::encoding::ValueTypeMarker>::borrow(
1000 &self.name,
1001 ),),
1002 encoder,
1003 offset,
1004 _depth,
1005 )
1006 }
1007 }
1008 unsafe impl<
1009 D: fidl::encoding::ResourceDialect,
1010 T0: fidl::encoding::Encode<fidl::encoding::BoundedString<64>, D>,
1011 > fidl::encoding::Encode<RollingPacketCaptureDetachRequest, D> for (T0,)
1012 {
1013 #[inline]
1014 unsafe fn encode(
1015 self,
1016 encoder: &mut fidl::encoding::Encoder<'_, D>,
1017 offset: usize,
1018 depth: fidl::encoding::Depth,
1019 ) -> fidl::Result<()> {
1020 encoder.debug_check_bounds::<RollingPacketCaptureDetachRequest>(offset);
1021 self.0.encode(encoder, offset + 0, depth)?;
1025 Ok(())
1026 }
1027 }
1028
1029 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1030 for RollingPacketCaptureDetachRequest
1031 {
1032 #[inline(always)]
1033 fn new_empty() -> Self {
1034 Self { name: fidl::new_empty!(fidl::encoding::BoundedString<64>, D) }
1035 }
1036
1037 #[inline]
1038 unsafe fn decode(
1039 &mut self,
1040 decoder: &mut fidl::encoding::Decoder<'_, D>,
1041 offset: usize,
1042 _depth: fidl::encoding::Depth,
1043 ) -> fidl::Result<()> {
1044 decoder.debug_check_bounds::<Self>(offset);
1045 fidl::decode!(
1047 fidl::encoding::BoundedString<64>,
1048 D,
1049 &mut self.name,
1050 decoder,
1051 offset + 0,
1052 _depth
1053 )?;
1054 Ok(())
1055 }
1056 }
1057
1058 impl fidl::encoding::ValueTypeMarker for RollingPacketCaptureOnEndedRequest {
1059 type Borrowed<'a> = &'a Self;
1060 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1061 value
1062 }
1063 }
1064
1065 unsafe impl fidl::encoding::TypeMarker for RollingPacketCaptureOnEndedRequest {
1066 type Owned = Self;
1067
1068 #[inline(always)]
1069 fn inline_align(_context: fidl::encoding::Context) -> usize {
1070 4
1071 }
1072
1073 #[inline(always)]
1074 fn inline_size(_context: fidl::encoding::Context) -> usize {
1075 4
1076 }
1077 }
1078
1079 unsafe impl<D: fidl::encoding::ResourceDialect>
1080 fidl::encoding::Encode<RollingPacketCaptureOnEndedRequest, D>
1081 for &RollingPacketCaptureOnEndedRequest
1082 {
1083 #[inline]
1084 unsafe fn encode(
1085 self,
1086 encoder: &mut fidl::encoding::Encoder<'_, D>,
1087 offset: usize,
1088 _depth: fidl::encoding::Depth,
1089 ) -> fidl::Result<()> {
1090 encoder.debug_check_bounds::<RollingPacketCaptureOnEndedRequest>(offset);
1091 fidl::encoding::Encode::<RollingPacketCaptureOnEndedRequest, D>::encode(
1093 (<PacketCaptureEndReason as fidl::encoding::ValueTypeMarker>::borrow(&self.reason),),
1094 encoder,
1095 offset,
1096 _depth,
1097 )
1098 }
1099 }
1100 unsafe impl<
1101 D: fidl::encoding::ResourceDialect,
1102 T0: fidl::encoding::Encode<PacketCaptureEndReason, D>,
1103 > fidl::encoding::Encode<RollingPacketCaptureOnEndedRequest, D> for (T0,)
1104 {
1105 #[inline]
1106 unsafe fn encode(
1107 self,
1108 encoder: &mut fidl::encoding::Encoder<'_, D>,
1109 offset: usize,
1110 depth: fidl::encoding::Depth,
1111 ) -> fidl::Result<()> {
1112 encoder.debug_check_bounds::<RollingPacketCaptureOnEndedRequest>(offset);
1113 self.0.encode(encoder, offset + 0, depth)?;
1117 Ok(())
1118 }
1119 }
1120
1121 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1122 for RollingPacketCaptureOnEndedRequest
1123 {
1124 #[inline(always)]
1125 fn new_empty() -> Self {
1126 Self { reason: fidl::new_empty!(PacketCaptureEndReason, D) }
1127 }
1128
1129 #[inline]
1130 unsafe fn decode(
1131 &mut self,
1132 decoder: &mut fidl::encoding::Decoder<'_, D>,
1133 offset: usize,
1134 _depth: fidl::encoding::Depth,
1135 ) -> fidl::Result<()> {
1136 decoder.debug_check_bounds::<Self>(offset);
1137 fidl::decode!(
1139 PacketCaptureEndReason,
1140 D,
1141 &mut self.reason,
1142 decoder,
1143 offset + 0,
1144 _depth
1145 )?;
1146 Ok(())
1147 }
1148 }
1149
1150 impl RollingPacketCaptureParams {
1151 #[inline(always)]
1152 fn max_ordinal_present(&self) -> u64 {
1153 if let Some(_) = self.capture_size {
1154 return 1;
1155 }
1156 0
1157 }
1158 }
1159
1160 impl fidl::encoding::ValueTypeMarker for RollingPacketCaptureParams {
1161 type Borrowed<'a> = &'a Self;
1162 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1163 value
1164 }
1165 }
1166
1167 unsafe impl fidl::encoding::TypeMarker for RollingPacketCaptureParams {
1168 type Owned = Self;
1169
1170 #[inline(always)]
1171 fn inline_align(_context: fidl::encoding::Context) -> usize {
1172 8
1173 }
1174
1175 #[inline(always)]
1176 fn inline_size(_context: fidl::encoding::Context) -> usize {
1177 16
1178 }
1179 }
1180
1181 unsafe impl<D: fidl::encoding::ResourceDialect>
1182 fidl::encoding::Encode<RollingPacketCaptureParams, D> for &RollingPacketCaptureParams
1183 {
1184 unsafe fn encode(
1185 self,
1186 encoder: &mut fidl::encoding::Encoder<'_, D>,
1187 offset: usize,
1188 mut depth: fidl::encoding::Depth,
1189 ) -> fidl::Result<()> {
1190 encoder.debug_check_bounds::<RollingPacketCaptureParams>(offset);
1191 let max_ordinal: u64 = self.max_ordinal_present();
1193 encoder.write_num(max_ordinal, offset);
1194 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1195 if max_ordinal == 0 {
1197 return Ok(());
1198 }
1199 depth.increment()?;
1200 let envelope_size = 8;
1201 let bytes_len = max_ordinal as usize * envelope_size;
1202 #[allow(unused_variables)]
1203 let offset = encoder.out_of_line_offset(bytes_len);
1204 let mut _prev_end_offset: usize = 0;
1205 if 1 > max_ordinal {
1206 return Ok(());
1207 }
1208
1209 let cur_offset: usize = (1 - 1) * envelope_size;
1212
1213 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1215
1216 fidl::encoding::encode_in_envelope_optional::<u32, D>(
1221 self.capture_size.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
1222 encoder,
1223 offset + cur_offset,
1224 depth,
1225 )?;
1226
1227 _prev_end_offset = cur_offset + envelope_size;
1228
1229 Ok(())
1230 }
1231 }
1232
1233 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
1234 for RollingPacketCaptureParams
1235 {
1236 #[inline(always)]
1237 fn new_empty() -> Self {
1238 Self::default()
1239 }
1240
1241 unsafe fn decode(
1242 &mut self,
1243 decoder: &mut fidl::encoding::Decoder<'_, D>,
1244 offset: usize,
1245 mut depth: fidl::encoding::Depth,
1246 ) -> fidl::Result<()> {
1247 decoder.debug_check_bounds::<Self>(offset);
1248 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1249 None => return Err(fidl::Error::NotNullable),
1250 Some(len) => len,
1251 };
1252 if len == 0 {
1254 return Ok(());
1255 };
1256 depth.increment()?;
1257 let envelope_size = 8;
1258 let bytes_len = len * envelope_size;
1259 let offset = decoder.out_of_line_offset(bytes_len)?;
1260 let mut _next_ordinal_to_read = 0;
1262 let mut next_offset = offset;
1263 let end_offset = offset + bytes_len;
1264 _next_ordinal_to_read += 1;
1265 if next_offset >= end_offset {
1266 return Ok(());
1267 }
1268
1269 while _next_ordinal_to_read < 1 {
1271 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1272 _next_ordinal_to_read += 1;
1273 next_offset += envelope_size;
1274 }
1275
1276 let next_out_of_line = decoder.next_out_of_line();
1277 let handles_before = decoder.remaining_handles();
1278 if let Some((inlined, num_bytes, num_handles)) =
1279 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1280 {
1281 let member_inline_size =
1282 <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1283 if inlined != (member_inline_size <= 4) {
1284 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1285 }
1286 let inner_offset;
1287 let mut inner_depth = depth.clone();
1288 if inlined {
1289 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1290 inner_offset = next_offset;
1291 } else {
1292 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1293 inner_depth.increment()?;
1294 }
1295 let val_ref = self.capture_size.get_or_insert_with(|| fidl::new_empty!(u32, D));
1296 fidl::decode!(u32, D, val_ref, decoder, inner_offset, inner_depth)?;
1297 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1298 {
1299 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1300 }
1301 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1302 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1303 }
1304 }
1305
1306 next_offset += envelope_size;
1307
1308 while next_offset < end_offset {
1310 _next_ordinal_to_read += 1;
1311 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1312 next_offset += envelope_size;
1313 }
1314
1315 Ok(())
1316 }
1317 }
1318
1319 impl fidl::encoding::ValueTypeMarker for InterfaceSpecifier {
1320 type Borrowed<'a> = &'a Self;
1321 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1322 value
1323 }
1324 }
1325
1326 unsafe impl fidl::encoding::TypeMarker for InterfaceSpecifier {
1327 type Owned = Self;
1328
1329 #[inline(always)]
1330 fn inline_align(_context: fidl::encoding::Context) -> usize {
1331 8
1332 }
1333
1334 #[inline(always)]
1335 fn inline_size(_context: fidl::encoding::Context) -> usize {
1336 16
1337 }
1338 }
1339
1340 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InterfaceSpecifier, D>
1341 for &InterfaceSpecifier
1342 {
1343 #[inline]
1344 unsafe fn encode(
1345 self,
1346 encoder: &mut fidl::encoding::Encoder<'_, D>,
1347 offset: usize,
1348 _depth: fidl::encoding::Depth,
1349 ) -> fidl::Result<()> {
1350 encoder.debug_check_bounds::<InterfaceSpecifier>(offset);
1351 encoder.write_num::<u64>(self.ordinal(), offset);
1352 match self {
1353 InterfaceSpecifier::Any(ref val) => {
1354 fidl::encoding::encode_in_envelope::<Empty, D>(
1355 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
1356 encoder, offset + 8, _depth
1357 )
1358 }
1359 InterfaceSpecifier::InterfaceIds(ref val) => {
1360 fidl::encoding::encode_in_envelope::<fidl::encoding::UnboundedVector<u64>, D>(
1361 <fidl::encoding::UnboundedVector<u64> as fidl::encoding::ValueTypeMarker>::borrow(val),
1362 encoder, offset + 8, _depth
1363 )
1364 }
1365 InterfaceSpecifier::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
1366 }
1367 }
1368 }
1369
1370 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InterfaceSpecifier {
1371 #[inline(always)]
1372 fn new_empty() -> Self {
1373 Self::__SourceBreaking { unknown_ordinal: 0 }
1374 }
1375
1376 #[inline]
1377 unsafe fn decode(
1378 &mut self,
1379 decoder: &mut fidl::encoding::Decoder<'_, D>,
1380 offset: usize,
1381 mut depth: fidl::encoding::Depth,
1382 ) -> fidl::Result<()> {
1383 decoder.debug_check_bounds::<Self>(offset);
1384 #[allow(unused_variables)]
1385 let next_out_of_line = decoder.next_out_of_line();
1386 let handles_before = decoder.remaining_handles();
1387 let (ordinal, inlined, num_bytes, num_handles) =
1388 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1389
1390 let member_inline_size = match ordinal {
1391 1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1392 2 => <fidl::encoding::UnboundedVector<u64> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1393 0 => return Err(fidl::Error::UnknownUnionTag),
1394 _ => num_bytes as usize,
1395 };
1396
1397 if inlined != (member_inline_size <= 4) {
1398 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1399 }
1400 let _inner_offset;
1401 if inlined {
1402 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1403 _inner_offset = offset + 8;
1404 } else {
1405 depth.increment()?;
1406 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1407 }
1408 match ordinal {
1409 1 => {
1410 #[allow(irrefutable_let_patterns)]
1411 if let InterfaceSpecifier::Any(_) = self {
1412 } else {
1414 *self = InterfaceSpecifier::Any(fidl::new_empty!(Empty, D));
1416 }
1417 #[allow(irrefutable_let_patterns)]
1418 if let InterfaceSpecifier::Any(ref mut val) = self {
1419 fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
1420 } else {
1421 unreachable!()
1422 }
1423 }
1424 2 => {
1425 #[allow(irrefutable_let_patterns)]
1426 if let InterfaceSpecifier::InterfaceIds(_) = self {
1427 } else {
1429 *self = InterfaceSpecifier::InterfaceIds(fidl::new_empty!(
1431 fidl::encoding::UnboundedVector<u64>,
1432 D
1433 ));
1434 }
1435 #[allow(irrefutable_let_patterns)]
1436 if let InterfaceSpecifier::InterfaceIds(ref mut val) = self {
1437 fidl::decode!(
1438 fidl::encoding::UnboundedVector<u64>,
1439 D,
1440 val,
1441 decoder,
1442 _inner_offset,
1443 depth
1444 )?;
1445 } else {
1446 unreachable!()
1447 }
1448 }
1449 #[allow(deprecated)]
1450 ordinal => {
1451 for _ in 0..num_handles {
1452 decoder.drop_next_handle()?;
1453 }
1454 *self = InterfaceSpecifier::__SourceBreaking { unknown_ordinal: ordinal };
1455 }
1456 }
1457 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1458 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1459 }
1460 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1461 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1462 }
1463 Ok(())
1464 }
1465 }
1466}