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