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