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