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