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 const MAX_IP_SOCKET_BATCH_SIZE: u32 = 92;
20
21pub const MAX_IP_SOCKET_MATCHERS: u32 = 128;
27
28bitflags! {
29 #[derive(Clone, Copy, Debug, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
30 pub struct Extensions: u32 {
31 const TCP_INFO = 1;
33 }
34}
35
36impl Extensions {
37 #[inline(always)]
38 pub fn from_bits_allow_unknown(bits: u32) -> Self {
39 Self::from_bits_retain(bits)
40 }
41
42 #[inline(always)]
43 pub fn has_unknown_bits(&self) -> bool {
44 self.get_unknown_bits() != 0
45 }
46
47 #[inline(always)]
48 pub fn get_unknown_bits(&self) -> u32 {
49 self.bits() & !Self::all().bits()
50 }
51}
52
53#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
54#[repr(C)]
55pub struct DisconnectIpResponse {
56 pub disconnected: u32,
58}
59
60impl fidl::Persistable for DisconnectIpResponse {}
61
62#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
63pub struct Empty;
64
65impl fidl::Persistable for Empty {}
66
67#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
69#[repr(C)]
70pub struct InvalidMatcher {
71 pub index: u32,
73}
74
75impl fidl::Persistable for InvalidMatcher {}
76
77#[derive(Clone, Debug, PartialEq)]
78pub struct IpIteratorNextResponse {
79 pub sockets: Vec<IpSocketState>,
83 pub has_more: bool,
87}
88
89impl fidl::Persistable for IpIteratorNextResponse {}
90
91#[derive(Clone, Debug, Default, PartialEq)]
92pub struct ControlDisconnectIpRequest {
93 pub matchers: Option<Vec<IpSocketMatcher>>,
100 #[doc(hidden)]
101 pub __source_breaking: fidl::marker::SourceBreaking,
102}
103
104impl fidl::Persistable for ControlDisconnectIpRequest {}
105
106#[derive(Clone, Debug, Default, PartialEq)]
108pub struct IpSocketState {
109 pub family: Option<fidl_fuchsia_net__common::IpVersion>,
114 pub src_addr: Option<fidl_fuchsia_net__common::IpAddress>,
118 pub dst_addr: Option<fidl_fuchsia_net__common::IpAddress>,
122 pub cookie: Option<u64>,
128 pub marks: Option<fidl_fuchsia_net__common::Marks>,
132 pub transport: Option<IpSocketTransportState>,
136 #[doc(hidden)]
137 pub __source_breaking: fidl::marker::SourceBreaking,
138}
139
140impl fidl::Persistable for IpSocketState {}
141
142#[derive(Clone, Debug, Default, PartialEq)]
143pub struct IpSocketTcpState {
144 pub src_port: Option<u16>,
148 pub dst_port: Option<u16>,
152 pub state: Option<fidl_fuchsia_net_tcp__common::State>,
156 pub tcp_info: Option<fidl_fuchsia_net_tcp__common::Info>,
160 #[doc(hidden)]
161 pub __source_breaking: fidl::marker::SourceBreaking,
162}
163
164impl fidl::Persistable for IpSocketTcpState {}
165
166#[derive(Clone, Debug, Default, PartialEq)]
167pub struct IpSocketUdpState {
168 pub src_port: Option<u16>,
172 pub dst_port: Option<u16>,
176 pub state: Option<fidl_fuchsia_net_udp__common::State>,
180 #[doc(hidden)]
181 pub __source_breaking: fidl::marker::SourceBreaking,
182}
183
184impl fidl::Persistable for IpSocketUdpState {}
185
186#[derive(Clone, Debug)]
187pub enum DisconnectIpResult {
188 Ok(DisconnectIpResponse),
190 InvalidMatcher(InvalidMatcher),
194 UnconstrainedMatchers(Empty),
197 #[doc(hidden)]
198 __SourceBreaking { unknown_ordinal: u64 },
199}
200
201#[macro_export]
203macro_rules! DisconnectIpResultUnknown {
204 () => {
205 _
206 };
207}
208
209impl PartialEq for DisconnectIpResult {
211 fn eq(&self, other: &Self) -> bool {
212 match (self, other) {
213 (Self::Ok(x), Self::Ok(y)) => *x == *y,
214 (Self::InvalidMatcher(x), Self::InvalidMatcher(y)) => *x == *y,
215 (Self::UnconstrainedMatchers(x), Self::UnconstrainedMatchers(y)) => *x == *y,
216 _ => false,
217 }
218 }
219}
220
221impl DisconnectIpResult {
222 #[inline]
223 pub fn ordinal(&self) -> u64 {
224 match *self {
225 Self::Ok(_) => 1,
226 Self::InvalidMatcher(_) => 2,
227 Self::UnconstrainedMatchers(_) => 3,
228 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
229 }
230 }
231
232 #[inline]
233 pub fn unknown_variant_for_testing() -> Self {
234 Self::__SourceBreaking { unknown_ordinal: 0 }
235 }
236
237 #[inline]
238 pub fn is_unknown(&self) -> bool {
239 match self {
240 Self::__SourceBreaking { .. } => true,
241 _ => false,
242 }
243 }
244}
245
246impl fidl::Persistable for DisconnectIpResult {}
247
248#[derive(Clone, Debug)]
250pub enum IpSocketMatcher {
251 Family(fidl_fuchsia_net__common::IpVersion),
253 SrcAddr(fidl_fuchsia_net_matchers__common::BoundAddress),
255 DstAddr(fidl_fuchsia_net_matchers__common::BoundAddress),
257 Proto(fidl_fuchsia_net_matchers__common::SocketTransportProtocol),
259 BoundInterface(fidl_fuchsia_net_matchers__common::BoundInterface),
262 Cookie(fidl_fuchsia_net_matchers__common::SocketCookie),
264 Mark(fidl_fuchsia_net_matchers__common::MarkInDomain),
266 #[doc(hidden)]
267 __SourceBreaking { unknown_ordinal: u64 },
268}
269
270#[macro_export]
272macro_rules! IpSocketMatcherUnknown {
273 () => {
274 _
275 };
276}
277
278impl PartialEq for IpSocketMatcher {
280 fn eq(&self, other: &Self) -> bool {
281 match (self, other) {
282 (Self::Family(x), Self::Family(y)) => *x == *y,
283 (Self::SrcAddr(x), Self::SrcAddr(y)) => *x == *y,
284 (Self::DstAddr(x), Self::DstAddr(y)) => *x == *y,
285 (Self::Proto(x), Self::Proto(y)) => *x == *y,
286 (Self::BoundInterface(x), Self::BoundInterface(y)) => *x == *y,
287 (Self::Cookie(x), Self::Cookie(y)) => *x == *y,
288 (Self::Mark(x), Self::Mark(y)) => *x == *y,
289 _ => false,
290 }
291 }
292}
293
294impl IpSocketMatcher {
295 #[inline]
296 pub fn ordinal(&self) -> u64 {
297 match *self {
298 Self::Family(_) => 1,
299 Self::SrcAddr(_) => 2,
300 Self::DstAddr(_) => 3,
301 Self::Proto(_) => 4,
302 Self::BoundInterface(_) => 5,
303 Self::Cookie(_) => 6,
304 Self::Mark(_) => 7,
305 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
306 }
307 }
308
309 #[inline]
310 pub fn unknown_variant_for_testing() -> Self {
311 Self::__SourceBreaking { unknown_ordinal: 0 }
312 }
313
314 #[inline]
315 pub fn is_unknown(&self) -> bool {
316 match self {
317 Self::__SourceBreaking { .. } => true,
318 _ => false,
319 }
320 }
321}
322
323impl fidl::Persistable for IpSocketMatcher {}
324
325#[derive(Clone, Debug)]
326pub enum IpSocketTransportState {
327 Tcp(IpSocketTcpState),
328 Udp(IpSocketUdpState),
329 #[doc(hidden)]
330 __SourceBreaking {
331 unknown_ordinal: u64,
332 },
333}
334
335#[macro_export]
337macro_rules! IpSocketTransportStateUnknown {
338 () => {
339 _
340 };
341}
342
343impl PartialEq for IpSocketTransportState {
345 fn eq(&self, other: &Self) -> bool {
346 match (self, other) {
347 (Self::Tcp(x), Self::Tcp(y)) => *x == *y,
348 (Self::Udp(x), Self::Udp(y)) => *x == *y,
349 _ => false,
350 }
351 }
352}
353
354impl IpSocketTransportState {
355 #[inline]
356 pub fn ordinal(&self) -> u64 {
357 match *self {
358 Self::Tcp(_) => 1,
359 Self::Udp(_) => 2,
360 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
361 }
362 }
363
364 #[inline]
365 pub fn unknown_variant_for_testing() -> Self {
366 Self::__SourceBreaking { unknown_ordinal: 0 }
367 }
368
369 #[inline]
370 pub fn is_unknown(&self) -> bool {
371 match self {
372 Self::__SourceBreaking { .. } => true,
373 _ => false,
374 }
375 }
376}
377
378impl fidl::Persistable for IpSocketTransportState {}
379
380#[derive(Clone, Debug)]
381pub enum IterateIpResult {
382 Ok(Empty),
384 InvalidMatcher(InvalidMatcher),
388 #[doc(hidden)]
389 __SourceBreaking { unknown_ordinal: u64 },
390}
391
392#[macro_export]
394macro_rules! IterateIpResultUnknown {
395 () => {
396 _
397 };
398}
399
400impl PartialEq for IterateIpResult {
402 fn eq(&self, other: &Self) -> bool {
403 match (self, other) {
404 (Self::Ok(x), Self::Ok(y)) => *x == *y,
405 (Self::InvalidMatcher(x), Self::InvalidMatcher(y)) => *x == *y,
406 _ => false,
407 }
408 }
409}
410
411impl IterateIpResult {
412 #[inline]
413 pub fn ordinal(&self) -> u64 {
414 match *self {
415 Self::Ok(_) => 1,
416 Self::InvalidMatcher(_) => 2,
417 Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
418 }
419 }
420
421 #[inline]
422 pub fn unknown_variant_for_testing() -> Self {
423 Self::__SourceBreaking { unknown_ordinal: 0 }
424 }
425
426 #[inline]
427 pub fn is_unknown(&self) -> bool {
428 match self {
429 Self::__SourceBreaking { .. } => true,
430 _ => false,
431 }
432 }
433}
434
435impl fidl::Persistable for IterateIpResult {}
436
437pub mod control_ordinals {
438 pub const DISCONNECT_IP: u64 = 0xbdaa66fbb4241a4;
439}
440
441pub mod diagnostics_ordinals {
442 pub const ITERATE_IP: u64 = 0x7b05425e48d07605;
443}
444
445pub mod ip_iterator_ordinals {
446 pub const NEXT: u64 = 0x3d50aa08ce641a6b;
447}
448
449mod internal {
450 use super::*;
451 unsafe impl fidl::encoding::TypeMarker for Extensions {
452 type Owned = Self;
453
454 #[inline(always)]
455 fn inline_align(_context: fidl::encoding::Context) -> usize {
456 4
457 }
458
459 #[inline(always)]
460 fn inline_size(_context: fidl::encoding::Context) -> usize {
461 4
462 }
463 }
464
465 impl fidl::encoding::ValueTypeMarker for Extensions {
466 type Borrowed<'a> = Self;
467 #[inline(always)]
468 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
469 *value
470 }
471 }
472
473 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Extensions {
474 #[inline]
475 unsafe fn encode(
476 self,
477 encoder: &mut fidl::encoding::Encoder<'_, D>,
478 offset: usize,
479 _depth: fidl::encoding::Depth,
480 ) -> fidl::Result<()> {
481 encoder.debug_check_bounds::<Self>(offset);
482 encoder.write_num(self.bits(), offset);
483 Ok(())
484 }
485 }
486
487 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Extensions {
488 #[inline(always)]
489 fn new_empty() -> Self {
490 Self::empty()
491 }
492
493 #[inline]
494 unsafe fn decode(
495 &mut self,
496 decoder: &mut fidl::encoding::Decoder<'_, D>,
497 offset: usize,
498 _depth: fidl::encoding::Depth,
499 ) -> fidl::Result<()> {
500 decoder.debug_check_bounds::<Self>(offset);
501 let prim = decoder.read_num::<u32>(offset);
502 *self = Self::from_bits_allow_unknown(prim);
503 Ok(())
504 }
505 }
506
507 impl fidl::encoding::ValueTypeMarker for DisconnectIpResponse {
508 type Borrowed<'a> = &'a Self;
509 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
510 value
511 }
512 }
513
514 unsafe impl fidl::encoding::TypeMarker for DisconnectIpResponse {
515 type Owned = Self;
516
517 #[inline(always)]
518 fn inline_align(_context: fidl::encoding::Context) -> usize {
519 4
520 }
521
522 #[inline(always)]
523 fn inline_size(_context: fidl::encoding::Context) -> usize {
524 4
525 }
526 #[inline(always)]
527 fn encode_is_copy() -> bool {
528 true
529 }
530
531 #[inline(always)]
532 fn decode_is_copy() -> bool {
533 true
534 }
535 }
536
537 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DisconnectIpResponse, D>
538 for &DisconnectIpResponse
539 {
540 #[inline]
541 unsafe fn encode(
542 self,
543 encoder: &mut fidl::encoding::Encoder<'_, D>,
544 offset: usize,
545 _depth: fidl::encoding::Depth,
546 ) -> fidl::Result<()> {
547 encoder.debug_check_bounds::<DisconnectIpResponse>(offset);
548 unsafe {
549 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
551 (buf_ptr as *mut DisconnectIpResponse)
552 .write_unaligned((self as *const DisconnectIpResponse).read());
553 }
556 Ok(())
557 }
558 }
559 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
560 fidl::encoding::Encode<DisconnectIpResponse, D> for (T0,)
561 {
562 #[inline]
563 unsafe fn encode(
564 self,
565 encoder: &mut fidl::encoding::Encoder<'_, D>,
566 offset: usize,
567 depth: fidl::encoding::Depth,
568 ) -> fidl::Result<()> {
569 encoder.debug_check_bounds::<DisconnectIpResponse>(offset);
570 self.0.encode(encoder, offset + 0, depth)?;
574 Ok(())
575 }
576 }
577
578 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DisconnectIpResponse {
579 #[inline(always)]
580 fn new_empty() -> Self {
581 Self { disconnected: fidl::new_empty!(u32, D) }
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 buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
593 unsafe {
596 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
597 }
598 Ok(())
599 }
600 }
601
602 impl fidl::encoding::ValueTypeMarker for Empty {
603 type Borrowed<'a> = &'a Self;
604 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
605 value
606 }
607 }
608
609 unsafe impl fidl::encoding::TypeMarker for Empty {
610 type Owned = Self;
611
612 #[inline(always)]
613 fn inline_align(_context: fidl::encoding::Context) -> usize {
614 1
615 }
616
617 #[inline(always)]
618 fn inline_size(_context: fidl::encoding::Context) -> usize {
619 1
620 }
621 }
622
623 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
624 #[inline]
625 unsafe fn encode(
626 self,
627 encoder: &mut fidl::encoding::Encoder<'_, D>,
628 offset: usize,
629 _depth: fidl::encoding::Depth,
630 ) -> fidl::Result<()> {
631 encoder.debug_check_bounds::<Empty>(offset);
632 encoder.write_num(0u8, offset);
633 Ok(())
634 }
635 }
636
637 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
638 #[inline(always)]
639 fn new_empty() -> Self {
640 Self
641 }
642
643 #[inline]
644 unsafe fn decode(
645 &mut self,
646 decoder: &mut fidl::encoding::Decoder<'_, D>,
647 offset: usize,
648 _depth: fidl::encoding::Depth,
649 ) -> fidl::Result<()> {
650 decoder.debug_check_bounds::<Self>(offset);
651 match decoder.read_num::<u8>(offset) {
652 0 => Ok(()),
653 _ => Err(fidl::Error::Invalid),
654 }
655 }
656 }
657
658 impl fidl::encoding::ValueTypeMarker for InvalidMatcher {
659 type Borrowed<'a> = &'a Self;
660 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
661 value
662 }
663 }
664
665 unsafe impl fidl::encoding::TypeMarker for InvalidMatcher {
666 type Owned = Self;
667
668 #[inline(always)]
669 fn inline_align(_context: fidl::encoding::Context) -> usize {
670 4
671 }
672
673 #[inline(always)]
674 fn inline_size(_context: fidl::encoding::Context) -> usize {
675 4
676 }
677 #[inline(always)]
678 fn encode_is_copy() -> bool {
679 true
680 }
681
682 #[inline(always)]
683 fn decode_is_copy() -> bool {
684 true
685 }
686 }
687
688 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<InvalidMatcher, D>
689 for &InvalidMatcher
690 {
691 #[inline]
692 unsafe fn encode(
693 self,
694 encoder: &mut fidl::encoding::Encoder<'_, D>,
695 offset: usize,
696 _depth: fidl::encoding::Depth,
697 ) -> fidl::Result<()> {
698 encoder.debug_check_bounds::<InvalidMatcher>(offset);
699 unsafe {
700 let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
702 (buf_ptr as *mut InvalidMatcher)
703 .write_unaligned((self as *const InvalidMatcher).read());
704 }
707 Ok(())
708 }
709 }
710 unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<u32, D>>
711 fidl::encoding::Encode<InvalidMatcher, D> for (T0,)
712 {
713 #[inline]
714 unsafe fn encode(
715 self,
716 encoder: &mut fidl::encoding::Encoder<'_, D>,
717 offset: usize,
718 depth: fidl::encoding::Depth,
719 ) -> fidl::Result<()> {
720 encoder.debug_check_bounds::<InvalidMatcher>(offset);
721 self.0.encode(encoder, offset + 0, depth)?;
725 Ok(())
726 }
727 }
728
729 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for InvalidMatcher {
730 #[inline(always)]
731 fn new_empty() -> Self {
732 Self { index: fidl::new_empty!(u32, D) }
733 }
734
735 #[inline]
736 unsafe fn decode(
737 &mut self,
738 decoder: &mut fidl::encoding::Decoder<'_, D>,
739 offset: usize,
740 _depth: fidl::encoding::Depth,
741 ) -> fidl::Result<()> {
742 decoder.debug_check_bounds::<Self>(offset);
743 let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
744 unsafe {
747 std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
748 }
749 Ok(())
750 }
751 }
752
753 impl fidl::encoding::ValueTypeMarker for IpIteratorNextResponse {
754 type Borrowed<'a> = &'a Self;
755 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
756 value
757 }
758 }
759
760 unsafe impl fidl::encoding::TypeMarker for IpIteratorNextResponse {
761 type Owned = Self;
762
763 #[inline(always)]
764 fn inline_align(_context: fidl::encoding::Context) -> usize {
765 8
766 }
767
768 #[inline(always)]
769 fn inline_size(_context: fidl::encoding::Context) -> usize {
770 24
771 }
772 }
773
774 unsafe impl<D: fidl::encoding::ResourceDialect>
775 fidl::encoding::Encode<IpIteratorNextResponse, D> for &IpIteratorNextResponse
776 {
777 #[inline]
778 unsafe fn encode(
779 self,
780 encoder: &mut fidl::encoding::Encoder<'_, D>,
781 offset: usize,
782 _depth: fidl::encoding::Depth,
783 ) -> fidl::Result<()> {
784 encoder.debug_check_bounds::<IpIteratorNextResponse>(offset);
785 fidl::encoding::Encode::<IpIteratorNextResponse, D>::encode(
787 (
788 <fidl::encoding::Vector<IpSocketState, 92> as fidl::encoding::ValueTypeMarker>::borrow(&self.sockets),
789 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.has_more),
790 ),
791 encoder, offset, _depth
792 )
793 }
794 }
795 unsafe impl<
796 D: fidl::encoding::ResourceDialect,
797 T0: fidl::encoding::Encode<fidl::encoding::Vector<IpSocketState, 92>, D>,
798 T1: fidl::encoding::Encode<bool, D>,
799 > fidl::encoding::Encode<IpIteratorNextResponse, D> for (T0, T1)
800 {
801 #[inline]
802 unsafe fn encode(
803 self,
804 encoder: &mut fidl::encoding::Encoder<'_, D>,
805 offset: usize,
806 depth: fidl::encoding::Depth,
807 ) -> fidl::Result<()> {
808 encoder.debug_check_bounds::<IpIteratorNextResponse>(offset);
809 unsafe {
812 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
813 (ptr as *mut u64).write_unaligned(0);
814 }
815 self.0.encode(encoder, offset + 0, depth)?;
817 self.1.encode(encoder, offset + 16, depth)?;
818 Ok(())
819 }
820 }
821
822 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
823 for IpIteratorNextResponse
824 {
825 #[inline(always)]
826 fn new_empty() -> Self {
827 Self {
828 sockets: fidl::new_empty!(fidl::encoding::Vector<IpSocketState, 92>, D),
829 has_more: fidl::new_empty!(bool, D),
830 }
831 }
832
833 #[inline]
834 unsafe fn decode(
835 &mut self,
836 decoder: &mut fidl::encoding::Decoder<'_, D>,
837 offset: usize,
838 _depth: fidl::encoding::Depth,
839 ) -> fidl::Result<()> {
840 decoder.debug_check_bounds::<Self>(offset);
841 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
843 let padval = unsafe { (ptr as *const u64).read_unaligned() };
844 let mask = 0xffffffffffffff00u64;
845 let maskedval = padval & mask;
846 if maskedval != 0 {
847 return Err(fidl::Error::NonZeroPadding {
848 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
849 });
850 }
851 fidl::decode!(fidl::encoding::Vector<IpSocketState, 92>, D, &mut self.sockets, decoder, offset + 0, _depth)?;
852 fidl::decode!(bool, D, &mut self.has_more, decoder, offset + 16, _depth)?;
853 Ok(())
854 }
855 }
856
857 impl ControlDisconnectIpRequest {
858 #[inline(always)]
859 fn max_ordinal_present(&self) -> u64 {
860 if let Some(_) = self.matchers {
861 return 1;
862 }
863 0
864 }
865 }
866
867 impl fidl::encoding::ValueTypeMarker for ControlDisconnectIpRequest {
868 type Borrowed<'a> = &'a Self;
869 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
870 value
871 }
872 }
873
874 unsafe impl fidl::encoding::TypeMarker for ControlDisconnectIpRequest {
875 type Owned = Self;
876
877 #[inline(always)]
878 fn inline_align(_context: fidl::encoding::Context) -> usize {
879 8
880 }
881
882 #[inline(always)]
883 fn inline_size(_context: fidl::encoding::Context) -> usize {
884 16
885 }
886 }
887
888 unsafe impl<D: fidl::encoding::ResourceDialect>
889 fidl::encoding::Encode<ControlDisconnectIpRequest, D> for &ControlDisconnectIpRequest
890 {
891 unsafe fn encode(
892 self,
893 encoder: &mut fidl::encoding::Encoder<'_, D>,
894 offset: usize,
895 mut depth: fidl::encoding::Depth,
896 ) -> fidl::Result<()> {
897 encoder.debug_check_bounds::<ControlDisconnectIpRequest>(offset);
898 let max_ordinal: u64 = self.max_ordinal_present();
900 encoder.write_num(max_ordinal, offset);
901 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
902 if max_ordinal == 0 {
904 return Ok(());
905 }
906 depth.increment()?;
907 let envelope_size = 8;
908 let bytes_len = max_ordinal as usize * envelope_size;
909 #[allow(unused_variables)]
910 let offset = encoder.out_of_line_offset(bytes_len);
911 let mut _prev_end_offset: usize = 0;
912 if 1 > max_ordinal {
913 return Ok(());
914 }
915
916 let cur_offset: usize = (1 - 1) * envelope_size;
919
920 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
922
923 fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<IpSocketMatcher, 128>, D>(
928 self.matchers.as_ref().map(<fidl::encoding::Vector<IpSocketMatcher, 128> as fidl::encoding::ValueTypeMarker>::borrow),
929 encoder, offset + cur_offset, depth
930 )?;
931
932 _prev_end_offset = cur_offset + envelope_size;
933
934 Ok(())
935 }
936 }
937
938 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
939 for ControlDisconnectIpRequest
940 {
941 #[inline(always)]
942 fn new_empty() -> Self {
943 Self::default()
944 }
945
946 unsafe fn decode(
947 &mut self,
948 decoder: &mut fidl::encoding::Decoder<'_, D>,
949 offset: usize,
950 mut depth: fidl::encoding::Depth,
951 ) -> fidl::Result<()> {
952 decoder.debug_check_bounds::<Self>(offset);
953 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
954 None => return Err(fidl::Error::NotNullable),
955 Some(len) => len,
956 };
957 if len == 0 {
959 return Ok(());
960 };
961 depth.increment()?;
962 let envelope_size = 8;
963 let bytes_len = len * envelope_size;
964 let offset = decoder.out_of_line_offset(bytes_len)?;
965 let mut _next_ordinal_to_read = 0;
967 let mut next_offset = offset;
968 let end_offset = offset + bytes_len;
969 _next_ordinal_to_read += 1;
970 if next_offset >= end_offset {
971 return Ok(());
972 }
973
974 while _next_ordinal_to_read < 1 {
976 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
977 _next_ordinal_to_read += 1;
978 next_offset += envelope_size;
979 }
980
981 let next_out_of_line = decoder.next_out_of_line();
982 let handles_before = decoder.remaining_handles();
983 if let Some((inlined, num_bytes, num_handles)) =
984 fidl::encoding::decode_envelope_header(decoder, next_offset)?
985 {
986 let member_inline_size = <fidl::encoding::Vector<IpSocketMatcher, 128> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
987 if inlined != (member_inline_size <= 4) {
988 return Err(fidl::Error::InvalidInlineBitInEnvelope);
989 }
990 let inner_offset;
991 let mut inner_depth = depth.clone();
992 if inlined {
993 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
994 inner_offset = next_offset;
995 } else {
996 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
997 inner_depth.increment()?;
998 }
999 let val_ref = self.matchers.get_or_insert_with(
1000 || fidl::new_empty!(fidl::encoding::Vector<IpSocketMatcher, 128>, D),
1001 );
1002 fidl::decode!(fidl::encoding::Vector<IpSocketMatcher, 128>, D, val_ref, decoder, inner_offset, inner_depth)?;
1003 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1004 {
1005 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1006 }
1007 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1008 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1009 }
1010 }
1011
1012 next_offset += envelope_size;
1013
1014 while next_offset < end_offset {
1016 _next_ordinal_to_read += 1;
1017 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1018 next_offset += envelope_size;
1019 }
1020
1021 Ok(())
1022 }
1023 }
1024
1025 impl IpSocketState {
1026 #[inline(always)]
1027 fn max_ordinal_present(&self) -> u64 {
1028 if let Some(_) = self.transport {
1029 return 7;
1030 }
1031 if let Some(_) = self.marks {
1032 return 6;
1033 }
1034 if let Some(_) = self.cookie {
1035 return 5;
1036 }
1037 if let Some(_) = self.dst_addr {
1038 return 3;
1039 }
1040 if let Some(_) = self.src_addr {
1041 return 2;
1042 }
1043 if let Some(_) = self.family {
1044 return 1;
1045 }
1046 0
1047 }
1048 }
1049
1050 impl fidl::encoding::ValueTypeMarker for IpSocketState {
1051 type Borrowed<'a> = &'a Self;
1052 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1053 value
1054 }
1055 }
1056
1057 unsafe impl fidl::encoding::TypeMarker for IpSocketState {
1058 type Owned = Self;
1059
1060 #[inline(always)]
1061 fn inline_align(_context: fidl::encoding::Context) -> usize {
1062 8
1063 }
1064
1065 #[inline(always)]
1066 fn inline_size(_context: fidl::encoding::Context) -> usize {
1067 16
1068 }
1069 }
1070
1071 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IpSocketState, D>
1072 for &IpSocketState
1073 {
1074 unsafe fn encode(
1075 self,
1076 encoder: &mut fidl::encoding::Encoder<'_, D>,
1077 offset: usize,
1078 mut depth: fidl::encoding::Depth,
1079 ) -> fidl::Result<()> {
1080 encoder.debug_check_bounds::<IpSocketState>(offset);
1081 let max_ordinal: u64 = self.max_ordinal_present();
1083 encoder.write_num(max_ordinal, offset);
1084 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1085 if max_ordinal == 0 {
1087 return Ok(());
1088 }
1089 depth.increment()?;
1090 let envelope_size = 8;
1091 let bytes_len = max_ordinal as usize * envelope_size;
1092 #[allow(unused_variables)]
1093 let offset = encoder.out_of_line_offset(bytes_len);
1094 let mut _prev_end_offset: usize = 0;
1095 if 1 > max_ordinal {
1096 return Ok(());
1097 }
1098
1099 let cur_offset: usize = (1 - 1) * envelope_size;
1102
1103 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1105
1106 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net__common::IpVersion, D>(
1111 self.family.as_ref().map(<fidl_fuchsia_net__common::IpVersion as fidl::encoding::ValueTypeMarker>::borrow),
1112 encoder, offset + cur_offset, depth
1113 )?;
1114
1115 _prev_end_offset = cur_offset + envelope_size;
1116 if 2 > max_ordinal {
1117 return Ok(());
1118 }
1119
1120 let cur_offset: usize = (2 - 1) * envelope_size;
1123
1124 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1126
1127 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net__common::IpAddress, D>(
1132 self.src_addr.as_ref().map(<fidl_fuchsia_net__common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow),
1133 encoder, offset + cur_offset, depth
1134 )?;
1135
1136 _prev_end_offset = cur_offset + envelope_size;
1137 if 3 > max_ordinal {
1138 return Ok(());
1139 }
1140
1141 let cur_offset: usize = (3 - 1) * envelope_size;
1144
1145 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1147
1148 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net__common::IpAddress, D>(
1153 self.dst_addr.as_ref().map(<fidl_fuchsia_net__common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow),
1154 encoder, offset + cur_offset, depth
1155 )?;
1156
1157 _prev_end_offset = cur_offset + envelope_size;
1158 if 5 > max_ordinal {
1159 return Ok(());
1160 }
1161
1162 let cur_offset: usize = (5 - 1) * envelope_size;
1165
1166 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1168
1169 fidl::encoding::encode_in_envelope_optional::<u64, D>(
1174 self.cookie.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1175 encoder,
1176 offset + cur_offset,
1177 depth,
1178 )?;
1179
1180 _prev_end_offset = cur_offset + envelope_size;
1181 if 6 > max_ordinal {
1182 return Ok(());
1183 }
1184
1185 let cur_offset: usize = (6 - 1) * envelope_size;
1188
1189 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1191
1192 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net__common::Marks, D>(
1197 self.marks.as_ref().map(
1198 <fidl_fuchsia_net__common::Marks as fidl::encoding::ValueTypeMarker>::borrow,
1199 ),
1200 encoder,
1201 offset + cur_offset,
1202 depth,
1203 )?;
1204
1205 _prev_end_offset = cur_offset + envelope_size;
1206 if 7 > max_ordinal {
1207 return Ok(());
1208 }
1209
1210 let cur_offset: usize = (7 - 1) * envelope_size;
1213
1214 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1216
1217 fidl::encoding::encode_in_envelope_optional::<IpSocketTransportState, D>(
1222 self.transport
1223 .as_ref()
1224 .map(<IpSocketTransportState as fidl::encoding::ValueTypeMarker>::borrow),
1225 encoder,
1226 offset + cur_offset,
1227 depth,
1228 )?;
1229
1230 _prev_end_offset = cur_offset + envelope_size;
1231
1232 Ok(())
1233 }
1234 }
1235
1236 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IpSocketState {
1237 #[inline(always)]
1238 fn new_empty() -> Self {
1239 Self::default()
1240 }
1241
1242 unsafe fn decode(
1243 &mut self,
1244 decoder: &mut fidl::encoding::Decoder<'_, D>,
1245 offset: usize,
1246 mut depth: fidl::encoding::Depth,
1247 ) -> fidl::Result<()> {
1248 decoder.debug_check_bounds::<Self>(offset);
1249 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1250 None => return Err(fidl::Error::NotNullable),
1251 Some(len) => len,
1252 };
1253 if len == 0 {
1255 return Ok(());
1256 };
1257 depth.increment()?;
1258 let envelope_size = 8;
1259 let bytes_len = len * envelope_size;
1260 let offset = decoder.out_of_line_offset(bytes_len)?;
1261 let mut _next_ordinal_to_read = 0;
1263 let mut next_offset = offset;
1264 let end_offset = offset + bytes_len;
1265 _next_ordinal_to_read += 1;
1266 if next_offset >= end_offset {
1267 return Ok(());
1268 }
1269
1270 while _next_ordinal_to_read < 1 {
1272 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1273 _next_ordinal_to_read += 1;
1274 next_offset += envelope_size;
1275 }
1276
1277 let next_out_of_line = decoder.next_out_of_line();
1278 let handles_before = decoder.remaining_handles();
1279 if let Some((inlined, num_bytes, num_handles)) =
1280 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1281 {
1282 let member_inline_size = <fidl_fuchsia_net__common::IpVersion as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1283 if inlined != (member_inline_size <= 4) {
1284 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1285 }
1286 let inner_offset;
1287 let mut inner_depth = depth.clone();
1288 if inlined {
1289 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1290 inner_offset = next_offset;
1291 } else {
1292 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1293 inner_depth.increment()?;
1294 }
1295 let val_ref = self.family.get_or_insert_with(|| {
1296 fidl::new_empty!(fidl_fuchsia_net__common::IpVersion, D)
1297 });
1298 fidl::decode!(
1299 fidl_fuchsia_net__common::IpVersion,
1300 D,
1301 val_ref,
1302 decoder,
1303 inner_offset,
1304 inner_depth
1305 )?;
1306 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1307 {
1308 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1309 }
1310 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1311 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1312 }
1313 }
1314
1315 next_offset += envelope_size;
1316 _next_ordinal_to_read += 1;
1317 if next_offset >= end_offset {
1318 return Ok(());
1319 }
1320
1321 while _next_ordinal_to_read < 2 {
1323 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1324 _next_ordinal_to_read += 1;
1325 next_offset += envelope_size;
1326 }
1327
1328 let next_out_of_line = decoder.next_out_of_line();
1329 let handles_before = decoder.remaining_handles();
1330 if let Some((inlined, num_bytes, num_handles)) =
1331 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1332 {
1333 let member_inline_size = <fidl_fuchsia_net__common::IpAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1334 if inlined != (member_inline_size <= 4) {
1335 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1336 }
1337 let inner_offset;
1338 let mut inner_depth = depth.clone();
1339 if inlined {
1340 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1341 inner_offset = next_offset;
1342 } else {
1343 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1344 inner_depth.increment()?;
1345 }
1346 let val_ref = self.src_addr.get_or_insert_with(|| {
1347 fidl::new_empty!(fidl_fuchsia_net__common::IpAddress, D)
1348 });
1349 fidl::decode!(
1350 fidl_fuchsia_net__common::IpAddress,
1351 D,
1352 val_ref,
1353 decoder,
1354 inner_offset,
1355 inner_depth
1356 )?;
1357 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1358 {
1359 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1360 }
1361 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1362 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1363 }
1364 }
1365
1366 next_offset += envelope_size;
1367 _next_ordinal_to_read += 1;
1368 if next_offset >= end_offset {
1369 return Ok(());
1370 }
1371
1372 while _next_ordinal_to_read < 3 {
1374 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1375 _next_ordinal_to_read += 1;
1376 next_offset += envelope_size;
1377 }
1378
1379 let next_out_of_line = decoder.next_out_of_line();
1380 let handles_before = decoder.remaining_handles();
1381 if let Some((inlined, num_bytes, num_handles)) =
1382 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1383 {
1384 let member_inline_size = <fidl_fuchsia_net__common::IpAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1385 if inlined != (member_inline_size <= 4) {
1386 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1387 }
1388 let inner_offset;
1389 let mut inner_depth = depth.clone();
1390 if inlined {
1391 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1392 inner_offset = next_offset;
1393 } else {
1394 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1395 inner_depth.increment()?;
1396 }
1397 let val_ref = self.dst_addr.get_or_insert_with(|| {
1398 fidl::new_empty!(fidl_fuchsia_net__common::IpAddress, D)
1399 });
1400 fidl::decode!(
1401 fidl_fuchsia_net__common::IpAddress,
1402 D,
1403 val_ref,
1404 decoder,
1405 inner_offset,
1406 inner_depth
1407 )?;
1408 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1409 {
1410 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1411 }
1412 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1413 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1414 }
1415 }
1416
1417 next_offset += envelope_size;
1418 _next_ordinal_to_read += 1;
1419 if next_offset >= end_offset {
1420 return Ok(());
1421 }
1422
1423 while _next_ordinal_to_read < 5 {
1425 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1426 _next_ordinal_to_read += 1;
1427 next_offset += envelope_size;
1428 }
1429
1430 let next_out_of_line = decoder.next_out_of_line();
1431 let handles_before = decoder.remaining_handles();
1432 if let Some((inlined, num_bytes, num_handles)) =
1433 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1434 {
1435 let member_inline_size =
1436 <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1437 if inlined != (member_inline_size <= 4) {
1438 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1439 }
1440 let inner_offset;
1441 let mut inner_depth = depth.clone();
1442 if inlined {
1443 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1444 inner_offset = next_offset;
1445 } else {
1446 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1447 inner_depth.increment()?;
1448 }
1449 let val_ref = self.cookie.get_or_insert_with(|| fidl::new_empty!(u64, D));
1450 fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1451 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1452 {
1453 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1454 }
1455 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1456 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1457 }
1458 }
1459
1460 next_offset += envelope_size;
1461 _next_ordinal_to_read += 1;
1462 if next_offset >= end_offset {
1463 return Ok(());
1464 }
1465
1466 while _next_ordinal_to_read < 6 {
1468 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1469 _next_ordinal_to_read += 1;
1470 next_offset += envelope_size;
1471 }
1472
1473 let next_out_of_line = decoder.next_out_of_line();
1474 let handles_before = decoder.remaining_handles();
1475 if let Some((inlined, num_bytes, num_handles)) =
1476 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1477 {
1478 let member_inline_size =
1479 <fidl_fuchsia_net__common::Marks as fidl::encoding::TypeMarker>::inline_size(
1480 decoder.context,
1481 );
1482 if inlined != (member_inline_size <= 4) {
1483 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1484 }
1485 let inner_offset;
1486 let mut inner_depth = depth.clone();
1487 if inlined {
1488 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1489 inner_offset = next_offset;
1490 } else {
1491 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1492 inner_depth.increment()?;
1493 }
1494 let val_ref = self
1495 .marks
1496 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_net__common::Marks, D));
1497 fidl::decode!(
1498 fidl_fuchsia_net__common::Marks,
1499 D,
1500 val_ref,
1501 decoder,
1502 inner_offset,
1503 inner_depth
1504 )?;
1505 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1506 {
1507 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1508 }
1509 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1510 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1511 }
1512 }
1513
1514 next_offset += envelope_size;
1515 _next_ordinal_to_read += 1;
1516 if next_offset >= end_offset {
1517 return Ok(());
1518 }
1519
1520 while _next_ordinal_to_read < 7 {
1522 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1523 _next_ordinal_to_read += 1;
1524 next_offset += envelope_size;
1525 }
1526
1527 let next_out_of_line = decoder.next_out_of_line();
1528 let handles_before = decoder.remaining_handles();
1529 if let Some((inlined, num_bytes, num_handles)) =
1530 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1531 {
1532 let member_inline_size =
1533 <IpSocketTransportState as fidl::encoding::TypeMarker>::inline_size(
1534 decoder.context,
1535 );
1536 if inlined != (member_inline_size <= 4) {
1537 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1538 }
1539 let inner_offset;
1540 let mut inner_depth = depth.clone();
1541 if inlined {
1542 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1543 inner_offset = next_offset;
1544 } else {
1545 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1546 inner_depth.increment()?;
1547 }
1548 let val_ref = self
1549 .transport
1550 .get_or_insert_with(|| fidl::new_empty!(IpSocketTransportState, D));
1551 fidl::decode!(
1552 IpSocketTransportState,
1553 D,
1554 val_ref,
1555 decoder,
1556 inner_offset,
1557 inner_depth
1558 )?;
1559 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1560 {
1561 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1562 }
1563 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1564 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1565 }
1566 }
1567
1568 next_offset += envelope_size;
1569
1570 while next_offset < end_offset {
1572 _next_ordinal_to_read += 1;
1573 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1574 next_offset += envelope_size;
1575 }
1576
1577 Ok(())
1578 }
1579 }
1580
1581 impl IpSocketTcpState {
1582 #[inline(always)]
1583 fn max_ordinal_present(&self) -> u64 {
1584 if let Some(_) = self.tcp_info {
1585 return 4;
1586 }
1587 if let Some(_) = self.state {
1588 return 3;
1589 }
1590 if let Some(_) = self.dst_port {
1591 return 2;
1592 }
1593 if let Some(_) = self.src_port {
1594 return 1;
1595 }
1596 0
1597 }
1598 }
1599
1600 impl fidl::encoding::ValueTypeMarker for IpSocketTcpState {
1601 type Borrowed<'a> = &'a Self;
1602 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1603 value
1604 }
1605 }
1606
1607 unsafe impl fidl::encoding::TypeMarker for IpSocketTcpState {
1608 type Owned = Self;
1609
1610 #[inline(always)]
1611 fn inline_align(_context: fidl::encoding::Context) -> usize {
1612 8
1613 }
1614
1615 #[inline(always)]
1616 fn inline_size(_context: fidl::encoding::Context) -> usize {
1617 16
1618 }
1619 }
1620
1621 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IpSocketTcpState, D>
1622 for &IpSocketTcpState
1623 {
1624 unsafe fn encode(
1625 self,
1626 encoder: &mut fidl::encoding::Encoder<'_, D>,
1627 offset: usize,
1628 mut depth: fidl::encoding::Depth,
1629 ) -> fidl::Result<()> {
1630 encoder.debug_check_bounds::<IpSocketTcpState>(offset);
1631 let max_ordinal: u64 = self.max_ordinal_present();
1633 encoder.write_num(max_ordinal, offset);
1634 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1635 if max_ordinal == 0 {
1637 return Ok(());
1638 }
1639 depth.increment()?;
1640 let envelope_size = 8;
1641 let bytes_len = max_ordinal as usize * envelope_size;
1642 #[allow(unused_variables)]
1643 let offset = encoder.out_of_line_offset(bytes_len);
1644 let mut _prev_end_offset: usize = 0;
1645 if 1 > max_ordinal {
1646 return Ok(());
1647 }
1648
1649 let cur_offset: usize = (1 - 1) * envelope_size;
1652
1653 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1655
1656 fidl::encoding::encode_in_envelope_optional::<u16, D>(
1661 self.src_port.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
1662 encoder,
1663 offset + cur_offset,
1664 depth,
1665 )?;
1666
1667 _prev_end_offset = cur_offset + envelope_size;
1668 if 2 > max_ordinal {
1669 return Ok(());
1670 }
1671
1672 let cur_offset: usize = (2 - 1) * envelope_size;
1675
1676 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1678
1679 fidl::encoding::encode_in_envelope_optional::<u16, D>(
1684 self.dst_port.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
1685 encoder,
1686 offset + cur_offset,
1687 depth,
1688 )?;
1689
1690 _prev_end_offset = cur_offset + envelope_size;
1691 if 3 > max_ordinal {
1692 return Ok(());
1693 }
1694
1695 let cur_offset: usize = (3 - 1) * envelope_size;
1698
1699 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1701
1702 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_tcp__common::State, D>(
1707 self.state.as_ref().map(<fidl_fuchsia_net_tcp__common::State as fidl::encoding::ValueTypeMarker>::borrow),
1708 encoder, offset + cur_offset, depth
1709 )?;
1710
1711 _prev_end_offset = cur_offset + envelope_size;
1712 if 4 > max_ordinal {
1713 return Ok(());
1714 }
1715
1716 let cur_offset: usize = (4 - 1) * envelope_size;
1719
1720 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1722
1723 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_tcp__common::Info, D>(
1728 self.tcp_info.as_ref().map(
1729 <fidl_fuchsia_net_tcp__common::Info as fidl::encoding::ValueTypeMarker>::borrow,
1730 ),
1731 encoder,
1732 offset + cur_offset,
1733 depth,
1734 )?;
1735
1736 _prev_end_offset = cur_offset + envelope_size;
1737
1738 Ok(())
1739 }
1740 }
1741
1742 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IpSocketTcpState {
1743 #[inline(always)]
1744 fn new_empty() -> Self {
1745 Self::default()
1746 }
1747
1748 unsafe fn decode(
1749 &mut self,
1750 decoder: &mut fidl::encoding::Decoder<'_, D>,
1751 offset: usize,
1752 mut depth: fidl::encoding::Depth,
1753 ) -> fidl::Result<()> {
1754 decoder.debug_check_bounds::<Self>(offset);
1755 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1756 None => return Err(fidl::Error::NotNullable),
1757 Some(len) => len,
1758 };
1759 if len == 0 {
1761 return Ok(());
1762 };
1763 depth.increment()?;
1764 let envelope_size = 8;
1765 let bytes_len = len * envelope_size;
1766 let offset = decoder.out_of_line_offset(bytes_len)?;
1767 let mut _next_ordinal_to_read = 0;
1769 let mut next_offset = offset;
1770 let end_offset = offset + bytes_len;
1771 _next_ordinal_to_read += 1;
1772 if next_offset >= end_offset {
1773 return Ok(());
1774 }
1775
1776 while _next_ordinal_to_read < 1 {
1778 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1779 _next_ordinal_to_read += 1;
1780 next_offset += envelope_size;
1781 }
1782
1783 let next_out_of_line = decoder.next_out_of_line();
1784 let handles_before = decoder.remaining_handles();
1785 if let Some((inlined, num_bytes, num_handles)) =
1786 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1787 {
1788 let member_inline_size =
1789 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1790 if inlined != (member_inline_size <= 4) {
1791 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1792 }
1793 let inner_offset;
1794 let mut inner_depth = depth.clone();
1795 if inlined {
1796 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1797 inner_offset = next_offset;
1798 } else {
1799 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1800 inner_depth.increment()?;
1801 }
1802 let val_ref = self.src_port.get_or_insert_with(|| fidl::new_empty!(u16, D));
1803 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
1804 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1805 {
1806 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1807 }
1808 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1809 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1810 }
1811 }
1812
1813 next_offset += envelope_size;
1814 _next_ordinal_to_read += 1;
1815 if next_offset >= end_offset {
1816 return Ok(());
1817 }
1818
1819 while _next_ordinal_to_read < 2 {
1821 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1822 _next_ordinal_to_read += 1;
1823 next_offset += envelope_size;
1824 }
1825
1826 let next_out_of_line = decoder.next_out_of_line();
1827 let handles_before = decoder.remaining_handles();
1828 if let Some((inlined, num_bytes, num_handles)) =
1829 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1830 {
1831 let member_inline_size =
1832 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1833 if inlined != (member_inline_size <= 4) {
1834 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1835 }
1836 let inner_offset;
1837 let mut inner_depth = depth.clone();
1838 if inlined {
1839 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1840 inner_offset = next_offset;
1841 } else {
1842 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1843 inner_depth.increment()?;
1844 }
1845 let val_ref = self.dst_port.get_or_insert_with(|| fidl::new_empty!(u16, D));
1846 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
1847 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1848 {
1849 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1850 }
1851 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1852 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1853 }
1854 }
1855
1856 next_offset += envelope_size;
1857 _next_ordinal_to_read += 1;
1858 if next_offset >= end_offset {
1859 return Ok(());
1860 }
1861
1862 while _next_ordinal_to_read < 3 {
1864 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1865 _next_ordinal_to_read += 1;
1866 next_offset += envelope_size;
1867 }
1868
1869 let next_out_of_line = decoder.next_out_of_line();
1870 let handles_before = decoder.remaining_handles();
1871 if let Some((inlined, num_bytes, num_handles)) =
1872 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1873 {
1874 let member_inline_size = <fidl_fuchsia_net_tcp__common::State as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1875 if inlined != (member_inline_size <= 4) {
1876 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1877 }
1878 let inner_offset;
1879 let mut inner_depth = depth.clone();
1880 if inlined {
1881 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1882 inner_offset = next_offset;
1883 } else {
1884 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1885 inner_depth.increment()?;
1886 }
1887 let val_ref = self.state.get_or_insert_with(|| {
1888 fidl::new_empty!(fidl_fuchsia_net_tcp__common::State, D)
1889 });
1890 fidl::decode!(
1891 fidl_fuchsia_net_tcp__common::State,
1892 D,
1893 val_ref,
1894 decoder,
1895 inner_offset,
1896 inner_depth
1897 )?;
1898 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1899 {
1900 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1901 }
1902 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1903 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1904 }
1905 }
1906
1907 next_offset += envelope_size;
1908 _next_ordinal_to_read += 1;
1909 if next_offset >= end_offset {
1910 return Ok(());
1911 }
1912
1913 while _next_ordinal_to_read < 4 {
1915 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1916 _next_ordinal_to_read += 1;
1917 next_offset += envelope_size;
1918 }
1919
1920 let next_out_of_line = decoder.next_out_of_line();
1921 let handles_before = decoder.remaining_handles();
1922 if let Some((inlined, num_bytes, num_handles)) =
1923 fidl::encoding::decode_envelope_header(decoder, next_offset)?
1924 {
1925 let member_inline_size =
1926 <fidl_fuchsia_net_tcp__common::Info as fidl::encoding::TypeMarker>::inline_size(
1927 decoder.context,
1928 );
1929 if inlined != (member_inline_size <= 4) {
1930 return Err(fidl::Error::InvalidInlineBitInEnvelope);
1931 }
1932 let inner_offset;
1933 let mut inner_depth = depth.clone();
1934 if inlined {
1935 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1936 inner_offset = next_offset;
1937 } else {
1938 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1939 inner_depth.increment()?;
1940 }
1941 let val_ref = self
1942 .tcp_info
1943 .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_net_tcp__common::Info, D));
1944 fidl::decode!(
1945 fidl_fuchsia_net_tcp__common::Info,
1946 D,
1947 val_ref,
1948 decoder,
1949 inner_offset,
1950 inner_depth
1951 )?;
1952 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1953 {
1954 return Err(fidl::Error::InvalidNumBytesInEnvelope);
1955 }
1956 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1957 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1958 }
1959 }
1960
1961 next_offset += envelope_size;
1962
1963 while next_offset < end_offset {
1965 _next_ordinal_to_read += 1;
1966 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1967 next_offset += envelope_size;
1968 }
1969
1970 Ok(())
1971 }
1972 }
1973
1974 impl IpSocketUdpState {
1975 #[inline(always)]
1976 fn max_ordinal_present(&self) -> u64 {
1977 if let Some(_) = self.state {
1978 return 3;
1979 }
1980 if let Some(_) = self.dst_port {
1981 return 2;
1982 }
1983 if let Some(_) = self.src_port {
1984 return 1;
1985 }
1986 0
1987 }
1988 }
1989
1990 impl fidl::encoding::ValueTypeMarker for IpSocketUdpState {
1991 type Borrowed<'a> = &'a Self;
1992 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1993 value
1994 }
1995 }
1996
1997 unsafe impl fidl::encoding::TypeMarker for IpSocketUdpState {
1998 type Owned = Self;
1999
2000 #[inline(always)]
2001 fn inline_align(_context: fidl::encoding::Context) -> usize {
2002 8
2003 }
2004
2005 #[inline(always)]
2006 fn inline_size(_context: fidl::encoding::Context) -> usize {
2007 16
2008 }
2009 }
2010
2011 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IpSocketUdpState, D>
2012 for &IpSocketUdpState
2013 {
2014 unsafe fn encode(
2015 self,
2016 encoder: &mut fidl::encoding::Encoder<'_, D>,
2017 offset: usize,
2018 mut depth: fidl::encoding::Depth,
2019 ) -> fidl::Result<()> {
2020 encoder.debug_check_bounds::<IpSocketUdpState>(offset);
2021 let max_ordinal: u64 = self.max_ordinal_present();
2023 encoder.write_num(max_ordinal, offset);
2024 encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
2025 if max_ordinal == 0 {
2027 return Ok(());
2028 }
2029 depth.increment()?;
2030 let envelope_size = 8;
2031 let bytes_len = max_ordinal as usize * envelope_size;
2032 #[allow(unused_variables)]
2033 let offset = encoder.out_of_line_offset(bytes_len);
2034 let mut _prev_end_offset: usize = 0;
2035 if 1 > max_ordinal {
2036 return Ok(());
2037 }
2038
2039 let cur_offset: usize = (1 - 1) * envelope_size;
2042
2043 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2045
2046 fidl::encoding::encode_in_envelope_optional::<u16, D>(
2051 self.src_port.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
2052 encoder,
2053 offset + cur_offset,
2054 depth,
2055 )?;
2056
2057 _prev_end_offset = cur_offset + envelope_size;
2058 if 2 > max_ordinal {
2059 return Ok(());
2060 }
2061
2062 let cur_offset: usize = (2 - 1) * envelope_size;
2065
2066 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2068
2069 fidl::encoding::encode_in_envelope_optional::<u16, D>(
2074 self.dst_port.as_ref().map(<u16 as fidl::encoding::ValueTypeMarker>::borrow),
2075 encoder,
2076 offset + cur_offset,
2077 depth,
2078 )?;
2079
2080 _prev_end_offset = cur_offset + envelope_size;
2081 if 3 > max_ordinal {
2082 return Ok(());
2083 }
2084
2085 let cur_offset: usize = (3 - 1) * envelope_size;
2088
2089 encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
2091
2092 fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_udp__common::State, D>(
2097 self.state.as_ref().map(<fidl_fuchsia_net_udp__common::State as fidl::encoding::ValueTypeMarker>::borrow),
2098 encoder, offset + cur_offset, depth
2099 )?;
2100
2101 _prev_end_offset = cur_offset + envelope_size;
2102
2103 Ok(())
2104 }
2105 }
2106
2107 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IpSocketUdpState {
2108 #[inline(always)]
2109 fn new_empty() -> Self {
2110 Self::default()
2111 }
2112
2113 unsafe fn decode(
2114 &mut self,
2115 decoder: &mut fidl::encoding::Decoder<'_, D>,
2116 offset: usize,
2117 mut depth: fidl::encoding::Depth,
2118 ) -> fidl::Result<()> {
2119 decoder.debug_check_bounds::<Self>(offset);
2120 let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
2121 None => return Err(fidl::Error::NotNullable),
2122 Some(len) => len,
2123 };
2124 if len == 0 {
2126 return Ok(());
2127 };
2128 depth.increment()?;
2129 let envelope_size = 8;
2130 let bytes_len = len * envelope_size;
2131 let offset = decoder.out_of_line_offset(bytes_len)?;
2132 let mut _next_ordinal_to_read = 0;
2134 let mut next_offset = offset;
2135 let end_offset = offset + bytes_len;
2136 _next_ordinal_to_read += 1;
2137 if next_offset >= end_offset {
2138 return Ok(());
2139 }
2140
2141 while _next_ordinal_to_read < 1 {
2143 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2144 _next_ordinal_to_read += 1;
2145 next_offset += envelope_size;
2146 }
2147
2148 let next_out_of_line = decoder.next_out_of_line();
2149 let handles_before = decoder.remaining_handles();
2150 if let Some((inlined, num_bytes, num_handles)) =
2151 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2152 {
2153 let member_inline_size =
2154 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2155 if inlined != (member_inline_size <= 4) {
2156 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2157 }
2158 let inner_offset;
2159 let mut inner_depth = depth.clone();
2160 if inlined {
2161 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2162 inner_offset = next_offset;
2163 } else {
2164 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2165 inner_depth.increment()?;
2166 }
2167 let val_ref = self.src_port.get_or_insert_with(|| fidl::new_empty!(u16, D));
2168 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
2169 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2170 {
2171 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2172 }
2173 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2174 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2175 }
2176 }
2177
2178 next_offset += envelope_size;
2179 _next_ordinal_to_read += 1;
2180 if next_offset >= end_offset {
2181 return Ok(());
2182 }
2183
2184 while _next_ordinal_to_read < 2 {
2186 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2187 _next_ordinal_to_read += 1;
2188 next_offset += envelope_size;
2189 }
2190
2191 let next_out_of_line = decoder.next_out_of_line();
2192 let handles_before = decoder.remaining_handles();
2193 if let Some((inlined, num_bytes, num_handles)) =
2194 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2195 {
2196 let member_inline_size =
2197 <u16 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2198 if inlined != (member_inline_size <= 4) {
2199 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2200 }
2201 let inner_offset;
2202 let mut inner_depth = depth.clone();
2203 if inlined {
2204 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2205 inner_offset = next_offset;
2206 } else {
2207 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2208 inner_depth.increment()?;
2209 }
2210 let val_ref = self.dst_port.get_or_insert_with(|| fidl::new_empty!(u16, D));
2211 fidl::decode!(u16, D, val_ref, decoder, inner_offset, inner_depth)?;
2212 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2213 {
2214 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2215 }
2216 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2217 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2218 }
2219 }
2220
2221 next_offset += envelope_size;
2222 _next_ordinal_to_read += 1;
2223 if next_offset >= end_offset {
2224 return Ok(());
2225 }
2226
2227 while _next_ordinal_to_read < 3 {
2229 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2230 _next_ordinal_to_read += 1;
2231 next_offset += envelope_size;
2232 }
2233
2234 let next_out_of_line = decoder.next_out_of_line();
2235 let handles_before = decoder.remaining_handles();
2236 if let Some((inlined, num_bytes, num_handles)) =
2237 fidl::encoding::decode_envelope_header(decoder, next_offset)?
2238 {
2239 let member_inline_size = <fidl_fuchsia_net_udp__common::State as fidl::encoding::TypeMarker>::inline_size(decoder.context);
2240 if inlined != (member_inline_size <= 4) {
2241 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2242 }
2243 let inner_offset;
2244 let mut inner_depth = depth.clone();
2245 if inlined {
2246 decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
2247 inner_offset = next_offset;
2248 } else {
2249 inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2250 inner_depth.increment()?;
2251 }
2252 let val_ref = self.state.get_or_insert_with(|| {
2253 fidl::new_empty!(fidl_fuchsia_net_udp__common::State, D)
2254 });
2255 fidl::decode!(
2256 fidl_fuchsia_net_udp__common::State,
2257 D,
2258 val_ref,
2259 decoder,
2260 inner_offset,
2261 inner_depth
2262 )?;
2263 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
2264 {
2265 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2266 }
2267 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2268 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2269 }
2270 }
2271
2272 next_offset += envelope_size;
2273
2274 while next_offset < end_offset {
2276 _next_ordinal_to_read += 1;
2277 fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
2278 next_offset += envelope_size;
2279 }
2280
2281 Ok(())
2282 }
2283 }
2284
2285 impl fidl::encoding::ValueTypeMarker for DisconnectIpResult {
2286 type Borrowed<'a> = &'a Self;
2287 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2288 value
2289 }
2290 }
2291
2292 unsafe impl fidl::encoding::TypeMarker for DisconnectIpResult {
2293 type Owned = Self;
2294
2295 #[inline(always)]
2296 fn inline_align(_context: fidl::encoding::Context) -> usize {
2297 8
2298 }
2299
2300 #[inline(always)]
2301 fn inline_size(_context: fidl::encoding::Context) -> usize {
2302 16
2303 }
2304 }
2305
2306 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<DisconnectIpResult, D>
2307 for &DisconnectIpResult
2308 {
2309 #[inline]
2310 unsafe fn encode(
2311 self,
2312 encoder: &mut fidl::encoding::Encoder<'_, D>,
2313 offset: usize,
2314 _depth: fidl::encoding::Depth,
2315 ) -> fidl::Result<()> {
2316 encoder.debug_check_bounds::<DisconnectIpResult>(offset);
2317 encoder.write_num::<u64>(self.ordinal(), offset);
2318 match self {
2319 DisconnectIpResult::Ok(ref val) => {
2320 fidl::encoding::encode_in_envelope::<DisconnectIpResponse, D>(
2321 <DisconnectIpResponse as fidl::encoding::ValueTypeMarker>::borrow(val),
2322 encoder,
2323 offset + 8,
2324 _depth,
2325 )
2326 }
2327 DisconnectIpResult::InvalidMatcher(ref val) => {
2328 fidl::encoding::encode_in_envelope::<InvalidMatcher, D>(
2329 <InvalidMatcher as fidl::encoding::ValueTypeMarker>::borrow(val),
2330 encoder,
2331 offset + 8,
2332 _depth,
2333 )
2334 }
2335 DisconnectIpResult::UnconstrainedMatchers(ref val) => {
2336 fidl::encoding::encode_in_envelope::<Empty, D>(
2337 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2338 encoder,
2339 offset + 8,
2340 _depth,
2341 )
2342 }
2343 DisconnectIpResult::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2344 }
2345 }
2346 }
2347
2348 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for DisconnectIpResult {
2349 #[inline(always)]
2350 fn new_empty() -> Self {
2351 Self::__SourceBreaking { unknown_ordinal: 0 }
2352 }
2353
2354 #[inline]
2355 unsafe fn decode(
2356 &mut self,
2357 decoder: &mut fidl::encoding::Decoder<'_, D>,
2358 offset: usize,
2359 mut depth: fidl::encoding::Depth,
2360 ) -> fidl::Result<()> {
2361 decoder.debug_check_bounds::<Self>(offset);
2362 #[allow(unused_variables)]
2363 let next_out_of_line = decoder.next_out_of_line();
2364 let handles_before = decoder.remaining_handles();
2365 let (ordinal, inlined, num_bytes, num_handles) =
2366 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2367
2368 let member_inline_size = match ordinal {
2369 1 => <DisconnectIpResponse as fidl::encoding::TypeMarker>::inline_size(
2370 decoder.context,
2371 ),
2372 2 => <InvalidMatcher as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2373 3 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2374 0 => return Err(fidl::Error::UnknownUnionTag),
2375 _ => num_bytes as usize,
2376 };
2377
2378 if inlined != (member_inline_size <= 4) {
2379 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2380 }
2381 let _inner_offset;
2382 if inlined {
2383 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2384 _inner_offset = offset + 8;
2385 } else {
2386 depth.increment()?;
2387 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2388 }
2389 match ordinal {
2390 1 => {
2391 #[allow(irrefutable_let_patterns)]
2392 if let DisconnectIpResult::Ok(_) = self {
2393 } else {
2395 *self = DisconnectIpResult::Ok(fidl::new_empty!(DisconnectIpResponse, D));
2397 }
2398 #[allow(irrefutable_let_patterns)]
2399 if let DisconnectIpResult::Ok(ref mut val) = self {
2400 fidl::decode!(DisconnectIpResponse, D, val, decoder, _inner_offset, depth)?;
2401 } else {
2402 unreachable!()
2403 }
2404 }
2405 2 => {
2406 #[allow(irrefutable_let_patterns)]
2407 if let DisconnectIpResult::InvalidMatcher(_) = self {
2408 } else {
2410 *self =
2412 DisconnectIpResult::InvalidMatcher(fidl::new_empty!(InvalidMatcher, D));
2413 }
2414 #[allow(irrefutable_let_patterns)]
2415 if let DisconnectIpResult::InvalidMatcher(ref mut val) = self {
2416 fidl::decode!(InvalidMatcher, D, val, decoder, _inner_offset, depth)?;
2417 } else {
2418 unreachable!()
2419 }
2420 }
2421 3 => {
2422 #[allow(irrefutable_let_patterns)]
2423 if let DisconnectIpResult::UnconstrainedMatchers(_) = self {
2424 } else {
2426 *self =
2428 DisconnectIpResult::UnconstrainedMatchers(fidl::new_empty!(Empty, D));
2429 }
2430 #[allow(irrefutable_let_patterns)]
2431 if let DisconnectIpResult::UnconstrainedMatchers(ref mut val) = self {
2432 fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
2433 } else {
2434 unreachable!()
2435 }
2436 }
2437 #[allow(deprecated)]
2438 ordinal => {
2439 for _ in 0..num_handles {
2440 decoder.drop_next_handle()?;
2441 }
2442 *self = DisconnectIpResult::__SourceBreaking { unknown_ordinal: ordinal };
2443 }
2444 }
2445 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2446 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2447 }
2448 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2449 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2450 }
2451 Ok(())
2452 }
2453 }
2454
2455 impl fidl::encoding::ValueTypeMarker for IpSocketMatcher {
2456 type Borrowed<'a> = &'a Self;
2457 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2458 value
2459 }
2460 }
2461
2462 unsafe impl fidl::encoding::TypeMarker for IpSocketMatcher {
2463 type Owned = Self;
2464
2465 #[inline(always)]
2466 fn inline_align(_context: fidl::encoding::Context) -> usize {
2467 8
2468 }
2469
2470 #[inline(always)]
2471 fn inline_size(_context: fidl::encoding::Context) -> usize {
2472 16
2473 }
2474 }
2475
2476 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IpSocketMatcher, D>
2477 for &IpSocketMatcher
2478 {
2479 #[inline]
2480 unsafe fn encode(
2481 self,
2482 encoder: &mut fidl::encoding::Encoder<'_, D>,
2483 offset: usize,
2484 _depth: fidl::encoding::Depth,
2485 ) -> fidl::Result<()> {
2486 encoder.debug_check_bounds::<IpSocketMatcher>(offset);
2487 encoder.write_num::<u64>(self.ordinal(), offset);
2488 match self {
2489 IpSocketMatcher::Family(ref val) => {
2490 fidl::encoding::encode_in_envelope::<fidl_fuchsia_net__common::IpVersion, D>(
2491 <fidl_fuchsia_net__common::IpVersion as fidl::encoding::ValueTypeMarker>::borrow(val),
2492 encoder, offset + 8, _depth
2493 )
2494 }
2495 IpSocketMatcher::SrcAddr(ref val) => {
2496 fidl::encoding::encode_in_envelope::<fidl_fuchsia_net_matchers__common::BoundAddress, D>(
2497 <fidl_fuchsia_net_matchers__common::BoundAddress as fidl::encoding::ValueTypeMarker>::borrow(val),
2498 encoder, offset + 8, _depth
2499 )
2500 }
2501 IpSocketMatcher::DstAddr(ref val) => {
2502 fidl::encoding::encode_in_envelope::<fidl_fuchsia_net_matchers__common::BoundAddress, D>(
2503 <fidl_fuchsia_net_matchers__common::BoundAddress as fidl::encoding::ValueTypeMarker>::borrow(val),
2504 encoder, offset + 8, _depth
2505 )
2506 }
2507 IpSocketMatcher::Proto(ref val) => {
2508 fidl::encoding::encode_in_envelope::<fidl_fuchsia_net_matchers__common::SocketTransportProtocol, D>(
2509 <fidl_fuchsia_net_matchers__common::SocketTransportProtocol as fidl::encoding::ValueTypeMarker>::borrow(val),
2510 encoder, offset + 8, _depth
2511 )
2512 }
2513 IpSocketMatcher::BoundInterface(ref val) => {
2514 fidl::encoding::encode_in_envelope::<fidl_fuchsia_net_matchers__common::BoundInterface, D>(
2515 <fidl_fuchsia_net_matchers__common::BoundInterface as fidl::encoding::ValueTypeMarker>::borrow(val),
2516 encoder, offset + 8, _depth
2517 )
2518 }
2519 IpSocketMatcher::Cookie(ref val) => {
2520 fidl::encoding::encode_in_envelope::<fidl_fuchsia_net_matchers__common::SocketCookie, D>(
2521 <fidl_fuchsia_net_matchers__common::SocketCookie as fidl::encoding::ValueTypeMarker>::borrow(val),
2522 encoder, offset + 8, _depth
2523 )
2524 }
2525 IpSocketMatcher::Mark(ref val) => {
2526 fidl::encoding::encode_in_envelope::<fidl_fuchsia_net_matchers__common::MarkInDomain, D>(
2527 <fidl_fuchsia_net_matchers__common::MarkInDomain as fidl::encoding::ValueTypeMarker>::borrow(val),
2528 encoder, offset + 8, _depth
2529 )
2530 }
2531 IpSocketMatcher::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2532 }
2533 }
2534 }
2535
2536 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IpSocketMatcher {
2537 #[inline(always)]
2538 fn new_empty() -> Self {
2539 Self::__SourceBreaking { unknown_ordinal: 0 }
2540 }
2541
2542 #[inline]
2543 unsafe fn decode(
2544 &mut self,
2545 decoder: &mut fidl::encoding::Decoder<'_, D>,
2546 offset: usize,
2547 mut depth: fidl::encoding::Depth,
2548 ) -> fidl::Result<()> {
2549 decoder.debug_check_bounds::<Self>(offset);
2550 #[allow(unused_variables)]
2551 let next_out_of_line = decoder.next_out_of_line();
2552 let handles_before = decoder.remaining_handles();
2553 let (ordinal, inlined, num_bytes, num_handles) =
2554 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2555
2556 let member_inline_size = match ordinal {
2557 1 => <fidl_fuchsia_net__common::IpVersion as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2558 2 => <fidl_fuchsia_net_matchers__common::BoundAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2559 3 => <fidl_fuchsia_net_matchers__common::BoundAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2560 4 => <fidl_fuchsia_net_matchers__common::SocketTransportProtocol as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2561 5 => <fidl_fuchsia_net_matchers__common::BoundInterface as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2562 6 => <fidl_fuchsia_net_matchers__common::SocketCookie as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2563 7 => <fidl_fuchsia_net_matchers__common::MarkInDomain as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2564 0 => return Err(fidl::Error::UnknownUnionTag),
2565 _ => num_bytes as usize,
2566 };
2567
2568 if inlined != (member_inline_size <= 4) {
2569 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2570 }
2571 let _inner_offset;
2572 if inlined {
2573 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2574 _inner_offset = offset + 8;
2575 } else {
2576 depth.increment()?;
2577 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2578 }
2579 match ordinal {
2580 1 => {
2581 #[allow(irrefutable_let_patterns)]
2582 if let IpSocketMatcher::Family(_) = self {
2583 } else {
2585 *self = IpSocketMatcher::Family(fidl::new_empty!(
2587 fidl_fuchsia_net__common::IpVersion,
2588 D
2589 ));
2590 }
2591 #[allow(irrefutable_let_patterns)]
2592 if let IpSocketMatcher::Family(ref mut val) = self {
2593 fidl::decode!(
2594 fidl_fuchsia_net__common::IpVersion,
2595 D,
2596 val,
2597 decoder,
2598 _inner_offset,
2599 depth
2600 )?;
2601 } else {
2602 unreachable!()
2603 }
2604 }
2605 2 => {
2606 #[allow(irrefutable_let_patterns)]
2607 if let IpSocketMatcher::SrcAddr(_) = self {
2608 } else {
2610 *self = IpSocketMatcher::SrcAddr(fidl::new_empty!(
2612 fidl_fuchsia_net_matchers__common::BoundAddress,
2613 D
2614 ));
2615 }
2616 #[allow(irrefutable_let_patterns)]
2617 if let IpSocketMatcher::SrcAddr(ref mut val) = self {
2618 fidl::decode!(
2619 fidl_fuchsia_net_matchers__common::BoundAddress,
2620 D,
2621 val,
2622 decoder,
2623 _inner_offset,
2624 depth
2625 )?;
2626 } else {
2627 unreachable!()
2628 }
2629 }
2630 3 => {
2631 #[allow(irrefutable_let_patterns)]
2632 if let IpSocketMatcher::DstAddr(_) = self {
2633 } else {
2635 *self = IpSocketMatcher::DstAddr(fidl::new_empty!(
2637 fidl_fuchsia_net_matchers__common::BoundAddress,
2638 D
2639 ));
2640 }
2641 #[allow(irrefutable_let_patterns)]
2642 if let IpSocketMatcher::DstAddr(ref mut val) = self {
2643 fidl::decode!(
2644 fidl_fuchsia_net_matchers__common::BoundAddress,
2645 D,
2646 val,
2647 decoder,
2648 _inner_offset,
2649 depth
2650 )?;
2651 } else {
2652 unreachable!()
2653 }
2654 }
2655 4 => {
2656 #[allow(irrefutable_let_patterns)]
2657 if let IpSocketMatcher::Proto(_) = self {
2658 } else {
2660 *self = IpSocketMatcher::Proto(fidl::new_empty!(
2662 fidl_fuchsia_net_matchers__common::SocketTransportProtocol,
2663 D
2664 ));
2665 }
2666 #[allow(irrefutable_let_patterns)]
2667 if let IpSocketMatcher::Proto(ref mut val) = self {
2668 fidl::decode!(
2669 fidl_fuchsia_net_matchers__common::SocketTransportProtocol,
2670 D,
2671 val,
2672 decoder,
2673 _inner_offset,
2674 depth
2675 )?;
2676 } else {
2677 unreachable!()
2678 }
2679 }
2680 5 => {
2681 #[allow(irrefutable_let_patterns)]
2682 if let IpSocketMatcher::BoundInterface(_) = self {
2683 } else {
2685 *self = IpSocketMatcher::BoundInterface(fidl::new_empty!(
2687 fidl_fuchsia_net_matchers__common::BoundInterface,
2688 D
2689 ));
2690 }
2691 #[allow(irrefutable_let_patterns)]
2692 if let IpSocketMatcher::BoundInterface(ref mut val) = self {
2693 fidl::decode!(
2694 fidl_fuchsia_net_matchers__common::BoundInterface,
2695 D,
2696 val,
2697 decoder,
2698 _inner_offset,
2699 depth
2700 )?;
2701 } else {
2702 unreachable!()
2703 }
2704 }
2705 6 => {
2706 #[allow(irrefutable_let_patterns)]
2707 if let IpSocketMatcher::Cookie(_) = self {
2708 } else {
2710 *self = IpSocketMatcher::Cookie(fidl::new_empty!(
2712 fidl_fuchsia_net_matchers__common::SocketCookie,
2713 D
2714 ));
2715 }
2716 #[allow(irrefutable_let_patterns)]
2717 if let IpSocketMatcher::Cookie(ref mut val) = self {
2718 fidl::decode!(
2719 fidl_fuchsia_net_matchers__common::SocketCookie,
2720 D,
2721 val,
2722 decoder,
2723 _inner_offset,
2724 depth
2725 )?;
2726 } else {
2727 unreachable!()
2728 }
2729 }
2730 7 => {
2731 #[allow(irrefutable_let_patterns)]
2732 if let IpSocketMatcher::Mark(_) = self {
2733 } else {
2735 *self = IpSocketMatcher::Mark(fidl::new_empty!(
2737 fidl_fuchsia_net_matchers__common::MarkInDomain,
2738 D
2739 ));
2740 }
2741 #[allow(irrefutable_let_patterns)]
2742 if let IpSocketMatcher::Mark(ref mut val) = self {
2743 fidl::decode!(
2744 fidl_fuchsia_net_matchers__common::MarkInDomain,
2745 D,
2746 val,
2747 decoder,
2748 _inner_offset,
2749 depth
2750 )?;
2751 } else {
2752 unreachable!()
2753 }
2754 }
2755 #[allow(deprecated)]
2756 ordinal => {
2757 for _ in 0..num_handles {
2758 decoder.drop_next_handle()?;
2759 }
2760 *self = IpSocketMatcher::__SourceBreaking { unknown_ordinal: ordinal };
2761 }
2762 }
2763 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2764 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2765 }
2766 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2767 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2768 }
2769 Ok(())
2770 }
2771 }
2772
2773 impl fidl::encoding::ValueTypeMarker for IpSocketTransportState {
2774 type Borrowed<'a> = &'a Self;
2775 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2776 value
2777 }
2778 }
2779
2780 unsafe impl fidl::encoding::TypeMarker for IpSocketTransportState {
2781 type Owned = Self;
2782
2783 #[inline(always)]
2784 fn inline_align(_context: fidl::encoding::Context) -> usize {
2785 8
2786 }
2787
2788 #[inline(always)]
2789 fn inline_size(_context: fidl::encoding::Context) -> usize {
2790 16
2791 }
2792 }
2793
2794 unsafe impl<D: fidl::encoding::ResourceDialect>
2795 fidl::encoding::Encode<IpSocketTransportState, D> for &IpSocketTransportState
2796 {
2797 #[inline]
2798 unsafe fn encode(
2799 self,
2800 encoder: &mut fidl::encoding::Encoder<'_, D>,
2801 offset: usize,
2802 _depth: fidl::encoding::Depth,
2803 ) -> fidl::Result<()> {
2804 encoder.debug_check_bounds::<IpSocketTransportState>(offset);
2805 encoder.write_num::<u64>(self.ordinal(), offset);
2806 match self {
2807 IpSocketTransportState::Tcp(ref val) => {
2808 fidl::encoding::encode_in_envelope::<IpSocketTcpState, D>(
2809 <IpSocketTcpState as fidl::encoding::ValueTypeMarker>::borrow(val),
2810 encoder,
2811 offset + 8,
2812 _depth,
2813 )
2814 }
2815 IpSocketTransportState::Udp(ref val) => {
2816 fidl::encoding::encode_in_envelope::<IpSocketUdpState, D>(
2817 <IpSocketUdpState as fidl::encoding::ValueTypeMarker>::borrow(val),
2818 encoder,
2819 offset + 8,
2820 _depth,
2821 )
2822 }
2823 IpSocketTransportState::__SourceBreaking { .. } => {
2824 Err(fidl::Error::UnknownUnionTag)
2825 }
2826 }
2827 }
2828 }
2829
2830 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2831 for IpSocketTransportState
2832 {
2833 #[inline(always)]
2834 fn new_empty() -> Self {
2835 Self::__SourceBreaking { unknown_ordinal: 0 }
2836 }
2837
2838 #[inline]
2839 unsafe fn decode(
2840 &mut self,
2841 decoder: &mut fidl::encoding::Decoder<'_, D>,
2842 offset: usize,
2843 mut depth: fidl::encoding::Depth,
2844 ) -> fidl::Result<()> {
2845 decoder.debug_check_bounds::<Self>(offset);
2846 #[allow(unused_variables)]
2847 let next_out_of_line = decoder.next_out_of_line();
2848 let handles_before = decoder.remaining_handles();
2849 let (ordinal, inlined, num_bytes, num_handles) =
2850 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2851
2852 let member_inline_size = match ordinal {
2853 1 => <IpSocketTcpState as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2854 2 => <IpSocketUdpState as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2855 0 => return Err(fidl::Error::UnknownUnionTag),
2856 _ => num_bytes as usize,
2857 };
2858
2859 if inlined != (member_inline_size <= 4) {
2860 return Err(fidl::Error::InvalidInlineBitInEnvelope);
2861 }
2862 let _inner_offset;
2863 if inlined {
2864 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
2865 _inner_offset = offset + 8;
2866 } else {
2867 depth.increment()?;
2868 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
2869 }
2870 match ordinal {
2871 1 => {
2872 #[allow(irrefutable_let_patterns)]
2873 if let IpSocketTransportState::Tcp(_) = self {
2874 } else {
2876 *self = IpSocketTransportState::Tcp(fidl::new_empty!(IpSocketTcpState, D));
2878 }
2879 #[allow(irrefutable_let_patterns)]
2880 if let IpSocketTransportState::Tcp(ref mut val) = self {
2881 fidl::decode!(IpSocketTcpState, D, val, decoder, _inner_offset, depth)?;
2882 } else {
2883 unreachable!()
2884 }
2885 }
2886 2 => {
2887 #[allow(irrefutable_let_patterns)]
2888 if let IpSocketTransportState::Udp(_) = self {
2889 } else {
2891 *self = IpSocketTransportState::Udp(fidl::new_empty!(IpSocketUdpState, D));
2893 }
2894 #[allow(irrefutable_let_patterns)]
2895 if let IpSocketTransportState::Udp(ref mut val) = self {
2896 fidl::decode!(IpSocketUdpState, D, val, decoder, _inner_offset, depth)?;
2897 } else {
2898 unreachable!()
2899 }
2900 }
2901 #[allow(deprecated)]
2902 ordinal => {
2903 for _ in 0..num_handles {
2904 decoder.drop_next_handle()?;
2905 }
2906 *self = IpSocketTransportState::__SourceBreaking { unknown_ordinal: ordinal };
2907 }
2908 }
2909 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
2910 return Err(fidl::Error::InvalidNumBytesInEnvelope);
2911 }
2912 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
2913 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
2914 }
2915 Ok(())
2916 }
2917 }
2918
2919 impl fidl::encoding::ValueTypeMarker for IterateIpResult {
2920 type Borrowed<'a> = &'a Self;
2921 fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2922 value
2923 }
2924 }
2925
2926 unsafe impl fidl::encoding::TypeMarker for IterateIpResult {
2927 type Owned = Self;
2928
2929 #[inline(always)]
2930 fn inline_align(_context: fidl::encoding::Context) -> usize {
2931 8
2932 }
2933
2934 #[inline(always)]
2935 fn inline_size(_context: fidl::encoding::Context) -> usize {
2936 16
2937 }
2938 }
2939
2940 unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IterateIpResult, D>
2941 for &IterateIpResult
2942 {
2943 #[inline]
2944 unsafe fn encode(
2945 self,
2946 encoder: &mut fidl::encoding::Encoder<'_, D>,
2947 offset: usize,
2948 _depth: fidl::encoding::Depth,
2949 ) -> fidl::Result<()> {
2950 encoder.debug_check_bounds::<IterateIpResult>(offset);
2951 encoder.write_num::<u64>(self.ordinal(), offset);
2952 match self {
2953 IterateIpResult::Ok(ref val) => fidl::encoding::encode_in_envelope::<Empty, D>(
2954 <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
2955 encoder,
2956 offset + 8,
2957 _depth,
2958 ),
2959 IterateIpResult::InvalidMatcher(ref val) => {
2960 fidl::encoding::encode_in_envelope::<InvalidMatcher, D>(
2961 <InvalidMatcher as fidl::encoding::ValueTypeMarker>::borrow(val),
2962 encoder,
2963 offset + 8,
2964 _depth,
2965 )
2966 }
2967 IterateIpResult::__SourceBreaking { .. } => Err(fidl::Error::UnknownUnionTag),
2968 }
2969 }
2970 }
2971
2972 impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IterateIpResult {
2973 #[inline(always)]
2974 fn new_empty() -> Self {
2975 Self::__SourceBreaking { unknown_ordinal: 0 }
2976 }
2977
2978 #[inline]
2979 unsafe fn decode(
2980 &mut self,
2981 decoder: &mut fidl::encoding::Decoder<'_, D>,
2982 offset: usize,
2983 mut depth: fidl::encoding::Depth,
2984 ) -> fidl::Result<()> {
2985 decoder.debug_check_bounds::<Self>(offset);
2986 #[allow(unused_variables)]
2987 let next_out_of_line = decoder.next_out_of_line();
2988 let handles_before = decoder.remaining_handles();
2989 let (ordinal, inlined, num_bytes, num_handles) =
2990 fidl::encoding::decode_union_inline_portion(decoder, offset)?;
2991
2992 let member_inline_size = match ordinal {
2993 1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2994 2 => <InvalidMatcher as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2995 0 => return Err(fidl::Error::UnknownUnionTag),
2996 _ => num_bytes as usize,
2997 };
2998
2999 if inlined != (member_inline_size <= 4) {
3000 return Err(fidl::Error::InvalidInlineBitInEnvelope);
3001 }
3002 let _inner_offset;
3003 if inlined {
3004 decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
3005 _inner_offset = offset + 8;
3006 } else {
3007 depth.increment()?;
3008 _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3009 }
3010 match ordinal {
3011 1 => {
3012 #[allow(irrefutable_let_patterns)]
3013 if let IterateIpResult::Ok(_) = self {
3014 } else {
3016 *self = IterateIpResult::Ok(fidl::new_empty!(Empty, D));
3018 }
3019 #[allow(irrefutable_let_patterns)]
3020 if let IterateIpResult::Ok(ref mut val) = self {
3021 fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
3022 } else {
3023 unreachable!()
3024 }
3025 }
3026 2 => {
3027 #[allow(irrefutable_let_patterns)]
3028 if let IterateIpResult::InvalidMatcher(_) = self {
3029 } else {
3031 *self =
3033 IterateIpResult::InvalidMatcher(fidl::new_empty!(InvalidMatcher, D));
3034 }
3035 #[allow(irrefutable_let_patterns)]
3036 if let IterateIpResult::InvalidMatcher(ref mut val) = self {
3037 fidl::decode!(InvalidMatcher, D, val, decoder, _inner_offset, depth)?;
3038 } else {
3039 unreachable!()
3040 }
3041 }
3042 #[allow(deprecated)]
3043 ordinal => {
3044 for _ in 0..num_handles {
3045 decoder.drop_next_handle()?;
3046 }
3047 *self = IterateIpResult::__SourceBreaking { unknown_ordinal: ordinal };
3048 }
3049 }
3050 if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
3051 return Err(fidl::Error::InvalidNumBytesInEnvelope);
3052 }
3053 if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3054 return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3055 }
3056 Ok(())
3057 }
3058 }
3059}