Skip to main content

fidl_fuchsia_net_neighbor_common/
fidl_fuchsia_net_neighbor_common.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![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
11/// The maximum number of [`EntryIteratorItem`] returned in a
12/// [`EntryIterator.GetNext`] response.
13pub const MAX_ITEM_BATCH_SIZE: u64 = 256;
14
15/// Errors associated with the neighbor table `Controller` protocol.
16#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
17pub enum ControllerError {
18    /// The specified interface does not exist.
19    InterfaceNotFound,
20    /// The specified interface does not keep a neighbor table (e.g.
21    /// point-to-point links).
22    InterfaceNotSupported,
23    /// The specified neighbor does not exist in the provided interface's
24    /// neighbor table.
25    NeighborNotFound,
26    /// The provided IP address is not a valid neighbor address.
27    InvalidIpAddress,
28    /// The provided MAC address is not a unicast MAC address.
29    MacAddressNotUnicast,
30    /// A probe cannot be manually triggered against the specified neighbor
31    /// because its link address is not known.
32    LinkAddressUnknown,
33    #[doc(hidden)]
34    __SourceBreaking { unknown_ordinal: u32 },
35}
36
37/// Pattern that matches an unknown `ControllerError` member.
38#[macro_export]
39macro_rules! ControllerErrorUnknown {
40    () => {
41        _
42    };
43}
44
45impl ControllerError {
46    #[inline]
47    pub fn from_primitive(prim: u32) -> Option<Self> {
48        match prim {
49            1 => Some(Self::InterfaceNotFound),
50            2 => Some(Self::InterfaceNotSupported),
51            3 => Some(Self::NeighborNotFound),
52            4 => Some(Self::InvalidIpAddress),
53            5 => Some(Self::MacAddressNotUnicast),
54            6 => Some(Self::LinkAddressUnknown),
55            _ => None,
56        }
57    }
58
59    #[inline]
60    pub fn from_primitive_allow_unknown(prim: u32) -> Self {
61        match prim {
62            1 => Self::InterfaceNotFound,
63            2 => Self::InterfaceNotSupported,
64            3 => Self::NeighborNotFound,
65            4 => Self::InvalidIpAddress,
66            5 => Self::MacAddressNotUnicast,
67            6 => Self::LinkAddressUnknown,
68            unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
69        }
70    }
71
72    #[inline]
73    pub fn unknown() -> Self {
74        Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
75    }
76
77    #[inline]
78    pub const fn into_primitive(self) -> u32 {
79        match self {
80            Self::InterfaceNotFound => 1,
81            Self::InterfaceNotSupported => 2,
82            Self::NeighborNotFound => 3,
83            Self::InvalidIpAddress => 4,
84            Self::MacAddressNotUnicast => 5,
85            Self::LinkAddressUnknown => 6,
86            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
87        }
88    }
89
90    #[inline]
91    pub fn is_unknown(&self) -> bool {
92        match self {
93            Self::__SourceBreaking { unknown_ordinal: _ } => true,
94            _ => false,
95        }
96    }
97}
98
99#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
100#[repr(u32)]
101pub enum EntryState {
102    /// Reachability is in the process of being confirmed for a newly
103    /// created, non-static entry.
104    Incomplete = 1,
105    /// Positive reachability has been confirmed; the path to the neighbor
106    /// is functioning properly.
107    Reachable = 2,
108    /// Reachability is considered unknown.
109    ///
110    /// Occurs in one of two ways:
111    ///   1. Too much time has elapsed since the last positive reachability
112    ///      confirmation was received.
113    ///   2. Received a reachability confirmation from a neighbor with a
114    ///      different MAC address than the one cached.
115    Stale = 3,
116    /// A packet was recently sent while reachability was considered
117    /// unknown.
118    ///
119    /// This state is an optimization that gives non-Neighbor-Discovery
120    /// related protocols time to confirm reachability after the last
121    /// confirmation of reachability has expired due to lack of recent
122    /// traffic.
123    Delay = 4,
124    /// A reachability confirmation is actively sought by periodically
125    /// retransmitting reachability probes until a reachability confirmation
126    /// is received, or until the maximum number of probes has been sent.
127    Probe = 5,
128    /// Static entries are explicitly added with [`Controller.AddEntry`].
129    /// They do not expire and are not deleted until explicitly removed with
130    /// [`Controller.RemoveEntry`]. A static entry may be converted into a
131    /// dynamic entry with [`Controller.ProbeEntry`], however, at which
132    /// point it may be subject to expiry and deletion.
133    Static = 6,
134    /// Negative reachability has been confirmed; the path to the neighbor
135    /// may not be functioning properly. A reachability confirmation was not
136    /// received after transmitting the maximum number of reachability
137    /// probes.
138    Unreachable = 7,
139}
140
141impl EntryState {
142    #[inline]
143    pub fn from_primitive(prim: u32) -> Option<Self> {
144        match prim {
145            1 => Some(Self::Incomplete),
146            2 => Some(Self::Reachable),
147            3 => Some(Self::Stale),
148            4 => Some(Self::Delay),
149            5 => Some(Self::Probe),
150            6 => Some(Self::Static),
151            7 => Some(Self::Unreachable),
152            _ => None,
153        }
154    }
155
156    #[inline]
157    pub const fn into_primitive(self) -> u32 {
158        self as u32
159    }
160}
161
162#[derive(Clone, Debug, PartialEq)]
163pub struct ControllerAddEntryRequest {
164    pub interface: u64,
165    pub neighbor: fidl_fuchsia_net_common::IpAddress,
166    pub mac: fidl_fuchsia_net_common::MacAddress,
167}
168
169impl fidl::Persistable for ControllerAddEntryRequest {}
170
171#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
172pub struct ControllerClearEntriesRequest {
173    pub interface: u64,
174    pub ip_version: fidl_fuchsia_net_common::IpVersion,
175}
176
177impl fidl::Persistable for ControllerClearEntriesRequest {}
178
179#[derive(Clone, Debug, PartialEq)]
180pub struct ControllerProbeEntryRequest {
181    pub interface: u64,
182    pub neighbor: fidl_fuchsia_net_common::IpAddress,
183}
184
185impl fidl::Persistable for ControllerProbeEntryRequest {}
186
187#[derive(Clone, Debug, PartialEq)]
188pub struct ControllerRemoveEntryRequest {
189    pub interface: u64,
190    pub neighbor: fidl_fuchsia_net_common::IpAddress,
191}
192
193impl fidl::Persistable for ControllerRemoveEntryRequest {}
194
195#[derive(Clone, Debug, PartialEq)]
196pub struct EntryIteratorGetNextResponse {
197    pub events: Vec<EntryIteratorItem>,
198}
199
200impl fidl::Persistable for EntryIteratorGetNextResponse {}
201
202#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
203pub struct IdleEvent;
204
205impl fidl::Persistable for IdleEvent {}
206
207/// Information on a neighboring device in the local network.
208///
209/// There are two types of entries available in the neighbor table.
210///   1. Dynamic entries are discovered automatically by neighbor discovery
211///      protocols (e.g. ARP, NDP). These protocols will attempt to reconfirm
212///      reachability with the device once its `state` becomes
213///      [`EntryState.STALE`].
214///   2. Static entries are explicitly added by a user with
215///      [`Controller.AddEntry`] and have no expiration. Their `state` is always
216///      [`EntryState.STATIC`] unless converted to a dynamic entry as the result
217///      of a [`Controller.ProbeEntry`] call.
218#[derive(Clone, Debug, Default, PartialEq)]
219pub struct Entry {
220    /// Identifier for the interface used for communicating with the neighbor.
221    ///
222    /// Required.
223    pub interface: Option<u64>,
224    /// IP address of the neighbor.
225    ///
226    /// Required.
227    pub neighbor: Option<fidl_fuchsia_net_common::IpAddress>,
228    /// State of the entry within the Neighbor Unreachability Detection (NUD)
229    /// state machine.
230    ///
231    /// Modeled after RFC 4861 section 7.3.2. Descriptions are kept
232    /// implementation-independent by using a set of generic terminology.
233    ///
234    /// ,------------------------------------------------------------------.
235    /// | Generic Term              | ARP Term    | NDP Term               |
236    /// |---------------------------+-------------+------------------------|
237    /// | Reachability Probe        | ARP Request | Neighbor Solicitation  |
238    /// | Reachability Confirmation | ARP Reply   | Neighbor Advertisement |
239    /// `---------------------------+-------------+------------------------'
240    ///
241    /// Required.
242    pub state: Option<EntryState>,
243    /// MAC address of the neighboring device's network interface controller.
244    ///
245    /// May be absent for dynamic entries in [`EntryState.UNREACHABLE`] or
246    /// [`EntryState.INCOMPLETE`].
247    pub mac: Option<fidl_fuchsia_net_common::MacAddress>,
248    /// Timestamp when this entry has changed `state`.
249    ///
250    /// Required.
251    pub updated_at: Option<i64>,
252    #[doc(hidden)]
253    pub __source_breaking: fidl::marker::SourceBreaking,
254}
255
256impl fidl::Persistable for Entry {}
257
258#[derive(Clone, Debug, Default, PartialEq)]
259pub struct EntryIteratorOptions {
260    #[doc(hidden)]
261    pub __source_breaking: fidl::marker::SourceBreaking,
262}
263
264impl fidl::Persistable for EntryIteratorOptions {}
265
266#[derive(Clone, Debug, PartialEq)]
267pub enum EntryIteratorItem {
268    /// An existing entry in the neighbor table. Does not indicate that
269    /// an event occurred.
270    Existing(Entry),
271    /// Empty event for indicating there are no more
272    /// [`EntryIteratorItem.existing`] items to yield.
273    Idle(IdleEvent),
274    /// Event indicating a new entry has been added to the neighbor
275    /// table.
276    Added(Entry),
277    /// Event indicating an entry has changed.
278    Changed(Entry),
279    /// Event indicating an entry has been removed from the neighbor
280    /// table.
281    Removed(Entry),
282}
283
284impl EntryIteratorItem {
285    #[inline]
286    pub fn ordinal(&self) -> u64 {
287        match *self {
288            Self::Existing(_) => 1,
289            Self::Idle(_) => 2,
290            Self::Added(_) => 3,
291            Self::Changed(_) => 4,
292            Self::Removed(_) => 5,
293        }
294    }
295}
296
297impl fidl::Persistable for EntryIteratorItem {}
298
299pub mod controller_ordinals {
300    pub const ADD_ENTRY: u64 = 0x778c829580aa23ac;
301    pub const PROBE_ENTRY: u64 = 0x4f71dd58473f58ad;
302    pub const REMOVE_ENTRY: u64 = 0xfd0b52f53a0f815;
303    pub const CLEAR_ENTRIES: u64 = 0x33e53d9769a999d;
304}
305
306pub mod entry_iterator_ordinals {
307    pub const GET_NEXT: u64 = 0x6d03407803da8647;
308}
309
310pub mod view_ordinals {
311    pub const OPEN_ENTRY_ITERATOR: u64 = 0x3c9531929383e911;
312}
313
314mod internal {
315    use super::*;
316    unsafe impl fidl::encoding::TypeMarker for ControllerError {
317        type Owned = Self;
318
319        #[inline(always)]
320        fn inline_align(_context: fidl::encoding::Context) -> usize {
321            std::mem::align_of::<u32>()
322        }
323
324        #[inline(always)]
325        fn inline_size(_context: fidl::encoding::Context) -> usize {
326            std::mem::size_of::<u32>()
327        }
328
329        #[inline(always)]
330        fn encode_is_copy() -> bool {
331            false
332        }
333
334        #[inline(always)]
335        fn decode_is_copy() -> bool {
336            false
337        }
338    }
339
340    impl fidl::encoding::ValueTypeMarker for ControllerError {
341        type Borrowed<'a> = Self;
342        #[inline(always)]
343        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
344            *value
345        }
346    }
347
348    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
349        for ControllerError
350    {
351        #[inline]
352        unsafe fn encode(
353            self,
354            encoder: &mut fidl::encoding::Encoder<'_, D>,
355            offset: usize,
356            _depth: fidl::encoding::Depth,
357        ) -> fidl::Result<()> {
358            encoder.debug_check_bounds::<Self>(offset);
359            encoder.write_num(self.into_primitive(), offset);
360            Ok(())
361        }
362    }
363
364    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ControllerError {
365        #[inline(always)]
366        fn new_empty() -> Self {
367            Self::unknown()
368        }
369
370        #[inline]
371        unsafe fn decode(
372            &mut self,
373            decoder: &mut fidl::encoding::Decoder<'_, D>,
374            offset: usize,
375            _depth: fidl::encoding::Depth,
376        ) -> fidl::Result<()> {
377            decoder.debug_check_bounds::<Self>(offset);
378            let prim = decoder.read_num::<u32>(offset);
379
380            *self = Self::from_primitive_allow_unknown(prim);
381            Ok(())
382        }
383    }
384    unsafe impl fidl::encoding::TypeMarker for EntryState {
385        type Owned = Self;
386
387        #[inline(always)]
388        fn inline_align(_context: fidl::encoding::Context) -> usize {
389            std::mem::align_of::<u32>()
390        }
391
392        #[inline(always)]
393        fn inline_size(_context: fidl::encoding::Context) -> usize {
394            std::mem::size_of::<u32>()
395        }
396
397        #[inline(always)]
398        fn encode_is_copy() -> bool {
399            true
400        }
401
402        #[inline(always)]
403        fn decode_is_copy() -> bool {
404            false
405        }
406    }
407
408    impl fidl::encoding::ValueTypeMarker for EntryState {
409        type Borrowed<'a> = Self;
410        #[inline(always)]
411        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
412            *value
413        }
414    }
415
416    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for EntryState {
417        #[inline]
418        unsafe fn encode(
419            self,
420            encoder: &mut fidl::encoding::Encoder<'_, D>,
421            offset: usize,
422            _depth: fidl::encoding::Depth,
423        ) -> fidl::Result<()> {
424            encoder.debug_check_bounds::<Self>(offset);
425            encoder.write_num(self.into_primitive(), offset);
426            Ok(())
427        }
428    }
429
430    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EntryState {
431        #[inline(always)]
432        fn new_empty() -> Self {
433            Self::Incomplete
434        }
435
436        #[inline]
437        unsafe fn decode(
438            &mut self,
439            decoder: &mut fidl::encoding::Decoder<'_, D>,
440            offset: usize,
441            _depth: fidl::encoding::Depth,
442        ) -> fidl::Result<()> {
443            decoder.debug_check_bounds::<Self>(offset);
444            let prim = decoder.read_num::<u32>(offset);
445
446            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
447            Ok(())
448        }
449    }
450
451    impl fidl::encoding::ValueTypeMarker for ControllerAddEntryRequest {
452        type Borrowed<'a> = &'a Self;
453        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
454            value
455        }
456    }
457
458    unsafe impl fidl::encoding::TypeMarker for ControllerAddEntryRequest {
459        type Owned = Self;
460
461        #[inline(always)]
462        fn inline_align(_context: fidl::encoding::Context) -> usize {
463            8
464        }
465
466        #[inline(always)]
467        fn inline_size(_context: fidl::encoding::Context) -> usize {
468            32
469        }
470    }
471
472    unsafe impl<D: fidl::encoding::ResourceDialect>
473        fidl::encoding::Encode<ControllerAddEntryRequest, D> for &ControllerAddEntryRequest
474    {
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::<ControllerAddEntryRequest>(offset);
483            // Delegate to tuple encoding.
484            fidl::encoding::Encode::<ControllerAddEntryRequest, D>::encode(
485                (
486                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.interface),
487                    <fidl_fuchsia_net_common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.neighbor),
488                    <fidl_fuchsia_net_common::MacAddress as fidl::encoding::ValueTypeMarker>::borrow(&self.mac),
489                ),
490                encoder, offset, _depth
491            )
492        }
493    }
494    unsafe impl<
495        D: fidl::encoding::ResourceDialect,
496        T0: fidl::encoding::Encode<u64, D>,
497        T1: fidl::encoding::Encode<fidl_fuchsia_net_common::IpAddress, D>,
498        T2: fidl::encoding::Encode<fidl_fuchsia_net_common::MacAddress, D>,
499    > fidl::encoding::Encode<ControllerAddEntryRequest, D> for (T0, T1, T2)
500    {
501        #[inline]
502        unsafe fn encode(
503            self,
504            encoder: &mut fidl::encoding::Encoder<'_, D>,
505            offset: usize,
506            depth: fidl::encoding::Depth,
507        ) -> fidl::Result<()> {
508            encoder.debug_check_bounds::<ControllerAddEntryRequest>(offset);
509            // Zero out padding regions. There's no need to apply masks
510            // because the unmasked parts will be overwritten by fields.
511            unsafe {
512                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
513                (ptr as *mut u64).write_unaligned(0);
514            }
515            // Write the fields.
516            self.0.encode(encoder, offset + 0, depth)?;
517            self.1.encode(encoder, offset + 8, depth)?;
518            self.2.encode(encoder, offset + 24, depth)?;
519            Ok(())
520        }
521    }
522
523    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
524        for ControllerAddEntryRequest
525    {
526        #[inline(always)]
527        fn new_empty() -> Self {
528            Self {
529                interface: fidl::new_empty!(u64, D),
530                neighbor: fidl::new_empty!(fidl_fuchsia_net_common::IpAddress, D),
531                mac: fidl::new_empty!(fidl_fuchsia_net_common::MacAddress, D),
532            }
533        }
534
535        #[inline]
536        unsafe fn decode(
537            &mut self,
538            decoder: &mut fidl::encoding::Decoder<'_, D>,
539            offset: usize,
540            _depth: fidl::encoding::Depth,
541        ) -> fidl::Result<()> {
542            decoder.debug_check_bounds::<Self>(offset);
543            // Verify that padding bytes are zero.
544            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
545            let padval = unsafe { (ptr as *const u64).read_unaligned() };
546            let mask = 0xffff000000000000u64;
547            let maskedval = padval & mask;
548            if maskedval != 0 {
549                return Err(fidl::Error::NonZeroPadding {
550                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
551                });
552            }
553            fidl::decode!(u64, D, &mut self.interface, decoder, offset + 0, _depth)?;
554            fidl::decode!(
555                fidl_fuchsia_net_common::IpAddress,
556                D,
557                &mut self.neighbor,
558                decoder,
559                offset + 8,
560                _depth
561            )?;
562            fidl::decode!(
563                fidl_fuchsia_net_common::MacAddress,
564                D,
565                &mut self.mac,
566                decoder,
567                offset + 24,
568                _depth
569            )?;
570            Ok(())
571        }
572    }
573
574    impl fidl::encoding::ValueTypeMarker for ControllerClearEntriesRequest {
575        type Borrowed<'a> = &'a Self;
576        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
577            value
578        }
579    }
580
581    unsafe impl fidl::encoding::TypeMarker for ControllerClearEntriesRequest {
582        type Owned = Self;
583
584        #[inline(always)]
585        fn inline_align(_context: fidl::encoding::Context) -> usize {
586            8
587        }
588
589        #[inline(always)]
590        fn inline_size(_context: fidl::encoding::Context) -> usize {
591            16
592        }
593    }
594
595    unsafe impl<D: fidl::encoding::ResourceDialect>
596        fidl::encoding::Encode<ControllerClearEntriesRequest, D>
597        for &ControllerClearEntriesRequest
598    {
599        #[inline]
600        unsafe fn encode(
601            self,
602            encoder: &mut fidl::encoding::Encoder<'_, D>,
603            offset: usize,
604            _depth: fidl::encoding::Depth,
605        ) -> fidl::Result<()> {
606            encoder.debug_check_bounds::<ControllerClearEntriesRequest>(offset);
607            // Delegate to tuple encoding.
608            fidl::encoding::Encode::<ControllerClearEntriesRequest, D>::encode(
609                (
610                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.interface),
611                    <fidl_fuchsia_net_common::IpVersion as fidl::encoding::ValueTypeMarker>::borrow(
612                        &self.ip_version,
613                    ),
614                ),
615                encoder,
616                offset,
617                _depth,
618            )
619        }
620    }
621    unsafe impl<
622        D: fidl::encoding::ResourceDialect,
623        T0: fidl::encoding::Encode<u64, D>,
624        T1: fidl::encoding::Encode<fidl_fuchsia_net_common::IpVersion, D>,
625    > fidl::encoding::Encode<ControllerClearEntriesRequest, D> for (T0, T1)
626    {
627        #[inline]
628        unsafe fn encode(
629            self,
630            encoder: &mut fidl::encoding::Encoder<'_, D>,
631            offset: usize,
632            depth: fidl::encoding::Depth,
633        ) -> fidl::Result<()> {
634            encoder.debug_check_bounds::<ControllerClearEntriesRequest>(offset);
635            // Zero out padding regions. There's no need to apply masks
636            // because the unmasked parts will be overwritten by fields.
637            unsafe {
638                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
639                (ptr as *mut u64).write_unaligned(0);
640            }
641            // Write the fields.
642            self.0.encode(encoder, offset + 0, depth)?;
643            self.1.encode(encoder, offset + 8, depth)?;
644            Ok(())
645        }
646    }
647
648    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
649        for ControllerClearEntriesRequest
650    {
651        #[inline(always)]
652        fn new_empty() -> Self {
653            Self {
654                interface: fidl::new_empty!(u64, D),
655                ip_version: fidl::new_empty!(fidl_fuchsia_net_common::IpVersion, D),
656            }
657        }
658
659        #[inline]
660        unsafe fn decode(
661            &mut self,
662            decoder: &mut fidl::encoding::Decoder<'_, D>,
663            offset: usize,
664            _depth: fidl::encoding::Depth,
665        ) -> fidl::Result<()> {
666            decoder.debug_check_bounds::<Self>(offset);
667            // Verify that padding bytes are zero.
668            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
669            let padval = unsafe { (ptr as *const u64).read_unaligned() };
670            let mask = 0xffffffff00000000u64;
671            let maskedval = padval & mask;
672            if maskedval != 0 {
673                return Err(fidl::Error::NonZeroPadding {
674                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
675                });
676            }
677            fidl::decode!(u64, D, &mut self.interface, decoder, offset + 0, _depth)?;
678            fidl::decode!(
679                fidl_fuchsia_net_common::IpVersion,
680                D,
681                &mut self.ip_version,
682                decoder,
683                offset + 8,
684                _depth
685            )?;
686            Ok(())
687        }
688    }
689
690    impl fidl::encoding::ValueTypeMarker for ControllerProbeEntryRequest {
691        type Borrowed<'a> = &'a Self;
692        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
693            value
694        }
695    }
696
697    unsafe impl fidl::encoding::TypeMarker for ControllerProbeEntryRequest {
698        type Owned = Self;
699
700        #[inline(always)]
701        fn inline_align(_context: fidl::encoding::Context) -> usize {
702            8
703        }
704
705        #[inline(always)]
706        fn inline_size(_context: fidl::encoding::Context) -> usize {
707            24
708        }
709    }
710
711    unsafe impl<D: fidl::encoding::ResourceDialect>
712        fidl::encoding::Encode<ControllerProbeEntryRequest, D> for &ControllerProbeEntryRequest
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::<ControllerProbeEntryRequest>(offset);
722            // Delegate to tuple encoding.
723            fidl::encoding::Encode::<ControllerProbeEntryRequest, D>::encode(
724                (
725                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.interface),
726                    <fidl_fuchsia_net_common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(
727                        &self.neighbor,
728                    ),
729                ),
730                encoder,
731                offset,
732                _depth,
733            )
734        }
735    }
736    unsafe impl<
737        D: fidl::encoding::ResourceDialect,
738        T0: fidl::encoding::Encode<u64, D>,
739        T1: fidl::encoding::Encode<fidl_fuchsia_net_common::IpAddress, D>,
740    > fidl::encoding::Encode<ControllerProbeEntryRequest, D> for (T0, T1)
741    {
742        #[inline]
743        unsafe fn encode(
744            self,
745            encoder: &mut fidl::encoding::Encoder<'_, D>,
746            offset: usize,
747            depth: fidl::encoding::Depth,
748        ) -> fidl::Result<()> {
749            encoder.debug_check_bounds::<ControllerProbeEntryRequest>(offset);
750            // Zero out padding regions. There's no need to apply masks
751            // because the unmasked parts will be overwritten by fields.
752            // Write the fields.
753            self.0.encode(encoder, offset + 0, depth)?;
754            self.1.encode(encoder, offset + 8, depth)?;
755            Ok(())
756        }
757    }
758
759    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
760        for ControllerProbeEntryRequest
761    {
762        #[inline(always)]
763        fn new_empty() -> Self {
764            Self {
765                interface: fidl::new_empty!(u64, D),
766                neighbor: fidl::new_empty!(fidl_fuchsia_net_common::IpAddress, D),
767            }
768        }
769
770        #[inline]
771        unsafe fn decode(
772            &mut self,
773            decoder: &mut fidl::encoding::Decoder<'_, D>,
774            offset: usize,
775            _depth: fidl::encoding::Depth,
776        ) -> fidl::Result<()> {
777            decoder.debug_check_bounds::<Self>(offset);
778            // Verify that padding bytes are zero.
779            fidl::decode!(u64, D, &mut self.interface, decoder, offset + 0, _depth)?;
780            fidl::decode!(
781                fidl_fuchsia_net_common::IpAddress,
782                D,
783                &mut self.neighbor,
784                decoder,
785                offset + 8,
786                _depth
787            )?;
788            Ok(())
789        }
790    }
791
792    impl fidl::encoding::ValueTypeMarker for ControllerRemoveEntryRequest {
793        type Borrowed<'a> = &'a Self;
794        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
795            value
796        }
797    }
798
799    unsafe impl fidl::encoding::TypeMarker for ControllerRemoveEntryRequest {
800        type Owned = Self;
801
802        #[inline(always)]
803        fn inline_align(_context: fidl::encoding::Context) -> usize {
804            8
805        }
806
807        #[inline(always)]
808        fn inline_size(_context: fidl::encoding::Context) -> usize {
809            24
810        }
811    }
812
813    unsafe impl<D: fidl::encoding::ResourceDialect>
814        fidl::encoding::Encode<ControllerRemoveEntryRequest, D> for &ControllerRemoveEntryRequest
815    {
816        #[inline]
817        unsafe fn encode(
818            self,
819            encoder: &mut fidl::encoding::Encoder<'_, D>,
820            offset: usize,
821            _depth: fidl::encoding::Depth,
822        ) -> fidl::Result<()> {
823            encoder.debug_check_bounds::<ControllerRemoveEntryRequest>(offset);
824            // Delegate to tuple encoding.
825            fidl::encoding::Encode::<ControllerRemoveEntryRequest, D>::encode(
826                (
827                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.interface),
828                    <fidl_fuchsia_net_common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow(
829                        &self.neighbor,
830                    ),
831                ),
832                encoder,
833                offset,
834                _depth,
835            )
836        }
837    }
838    unsafe impl<
839        D: fidl::encoding::ResourceDialect,
840        T0: fidl::encoding::Encode<u64, D>,
841        T1: fidl::encoding::Encode<fidl_fuchsia_net_common::IpAddress, D>,
842    > fidl::encoding::Encode<ControllerRemoveEntryRequest, D> for (T0, T1)
843    {
844        #[inline]
845        unsafe fn encode(
846            self,
847            encoder: &mut fidl::encoding::Encoder<'_, D>,
848            offset: usize,
849            depth: fidl::encoding::Depth,
850        ) -> fidl::Result<()> {
851            encoder.debug_check_bounds::<ControllerRemoveEntryRequest>(offset);
852            // Zero out padding regions. There's no need to apply masks
853            // because the unmasked parts will be overwritten by fields.
854            // Write the fields.
855            self.0.encode(encoder, offset + 0, depth)?;
856            self.1.encode(encoder, offset + 8, depth)?;
857            Ok(())
858        }
859    }
860
861    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
862        for ControllerRemoveEntryRequest
863    {
864        #[inline(always)]
865        fn new_empty() -> Self {
866            Self {
867                interface: fidl::new_empty!(u64, D),
868                neighbor: fidl::new_empty!(fidl_fuchsia_net_common::IpAddress, D),
869            }
870        }
871
872        #[inline]
873        unsafe fn decode(
874            &mut self,
875            decoder: &mut fidl::encoding::Decoder<'_, D>,
876            offset: usize,
877            _depth: fidl::encoding::Depth,
878        ) -> fidl::Result<()> {
879            decoder.debug_check_bounds::<Self>(offset);
880            // Verify that padding bytes are zero.
881            fidl::decode!(u64, D, &mut self.interface, decoder, offset + 0, _depth)?;
882            fidl::decode!(
883                fidl_fuchsia_net_common::IpAddress,
884                D,
885                &mut self.neighbor,
886                decoder,
887                offset + 8,
888                _depth
889            )?;
890            Ok(())
891        }
892    }
893
894    impl fidl::encoding::ValueTypeMarker for EntryIteratorGetNextResponse {
895        type Borrowed<'a> = &'a Self;
896        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
897            value
898        }
899    }
900
901    unsafe impl fidl::encoding::TypeMarker for EntryIteratorGetNextResponse {
902        type Owned = Self;
903
904        #[inline(always)]
905        fn inline_align(_context: fidl::encoding::Context) -> usize {
906            8
907        }
908
909        #[inline(always)]
910        fn inline_size(_context: fidl::encoding::Context) -> usize {
911            16
912        }
913    }
914
915    unsafe impl<D: fidl::encoding::ResourceDialect>
916        fidl::encoding::Encode<EntryIteratorGetNextResponse, D> for &EntryIteratorGetNextResponse
917    {
918        #[inline]
919        unsafe fn encode(
920            self,
921            encoder: &mut fidl::encoding::Encoder<'_, D>,
922            offset: usize,
923            _depth: fidl::encoding::Depth,
924        ) -> fidl::Result<()> {
925            encoder.debug_check_bounds::<EntryIteratorGetNextResponse>(offset);
926            // Delegate to tuple encoding.
927            fidl::encoding::Encode::<EntryIteratorGetNextResponse, D>::encode(
928                (
929                    <fidl::encoding::Vector<EntryIteratorItem, 256> as fidl::encoding::ValueTypeMarker>::borrow(&self.events),
930                ),
931                encoder, offset, _depth
932            )
933        }
934    }
935    unsafe impl<
936        D: fidl::encoding::ResourceDialect,
937        T0: fidl::encoding::Encode<fidl::encoding::Vector<EntryIteratorItem, 256>, D>,
938    > fidl::encoding::Encode<EntryIteratorGetNextResponse, D> for (T0,)
939    {
940        #[inline]
941        unsafe fn encode(
942            self,
943            encoder: &mut fidl::encoding::Encoder<'_, D>,
944            offset: usize,
945            depth: fidl::encoding::Depth,
946        ) -> fidl::Result<()> {
947            encoder.debug_check_bounds::<EntryIteratorGetNextResponse>(offset);
948            // Zero out padding regions. There's no need to apply masks
949            // because the unmasked parts will be overwritten by fields.
950            // Write the fields.
951            self.0.encode(encoder, offset + 0, depth)?;
952            Ok(())
953        }
954    }
955
956    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
957        for EntryIteratorGetNextResponse
958    {
959        #[inline(always)]
960        fn new_empty() -> Self {
961            Self { events: fidl::new_empty!(fidl::encoding::Vector<EntryIteratorItem, 256>, D) }
962        }
963
964        #[inline]
965        unsafe fn decode(
966            &mut self,
967            decoder: &mut fidl::encoding::Decoder<'_, D>,
968            offset: usize,
969            _depth: fidl::encoding::Depth,
970        ) -> fidl::Result<()> {
971            decoder.debug_check_bounds::<Self>(offset);
972            // Verify that padding bytes are zero.
973            fidl::decode!(fidl::encoding::Vector<EntryIteratorItem, 256>, D, &mut self.events, decoder, offset + 0, _depth)?;
974            Ok(())
975        }
976    }
977
978    impl fidl::encoding::ValueTypeMarker for IdleEvent {
979        type Borrowed<'a> = &'a Self;
980        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
981            value
982        }
983    }
984
985    unsafe impl fidl::encoding::TypeMarker for IdleEvent {
986        type Owned = Self;
987
988        #[inline(always)]
989        fn inline_align(_context: fidl::encoding::Context) -> usize {
990            1
991        }
992
993        #[inline(always)]
994        fn inline_size(_context: fidl::encoding::Context) -> usize {
995            1
996        }
997    }
998
999    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<IdleEvent, D>
1000        for &IdleEvent
1001    {
1002        #[inline]
1003        unsafe fn encode(
1004            self,
1005            encoder: &mut fidl::encoding::Encoder<'_, D>,
1006            offset: usize,
1007            _depth: fidl::encoding::Depth,
1008        ) -> fidl::Result<()> {
1009            encoder.debug_check_bounds::<IdleEvent>(offset);
1010            encoder.write_num(0u8, offset);
1011            Ok(())
1012        }
1013    }
1014
1015    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for IdleEvent {
1016        #[inline(always)]
1017        fn new_empty() -> Self {
1018            Self
1019        }
1020
1021        #[inline]
1022        unsafe fn decode(
1023            &mut self,
1024            decoder: &mut fidl::encoding::Decoder<'_, D>,
1025            offset: usize,
1026            _depth: fidl::encoding::Depth,
1027        ) -> fidl::Result<()> {
1028            decoder.debug_check_bounds::<Self>(offset);
1029            match decoder.read_num::<u8>(offset) {
1030                0 => Ok(()),
1031                _ => Err(fidl::Error::Invalid),
1032            }
1033        }
1034    }
1035
1036    impl Entry {
1037        #[inline(always)]
1038        fn max_ordinal_present(&self) -> u64 {
1039            if let Some(_) = self.updated_at {
1040                return 5;
1041            }
1042            if let Some(_) = self.mac {
1043                return 4;
1044            }
1045            if let Some(_) = self.state {
1046                return 3;
1047            }
1048            if let Some(_) = self.neighbor {
1049                return 2;
1050            }
1051            if let Some(_) = self.interface {
1052                return 1;
1053            }
1054            0
1055        }
1056    }
1057
1058    impl fidl::encoding::ValueTypeMarker for Entry {
1059        type Borrowed<'a> = &'a Self;
1060        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1061            value
1062        }
1063    }
1064
1065    unsafe impl fidl::encoding::TypeMarker for Entry {
1066        type Owned = Self;
1067
1068        #[inline(always)]
1069        fn inline_align(_context: fidl::encoding::Context) -> usize {
1070            8
1071        }
1072
1073        #[inline(always)]
1074        fn inline_size(_context: fidl::encoding::Context) -> usize {
1075            16
1076        }
1077    }
1078
1079    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Entry, D> for &Entry {
1080        unsafe fn encode(
1081            self,
1082            encoder: &mut fidl::encoding::Encoder<'_, D>,
1083            offset: usize,
1084            mut depth: fidl::encoding::Depth,
1085        ) -> fidl::Result<()> {
1086            encoder.debug_check_bounds::<Entry>(offset);
1087            // Vector header
1088            let max_ordinal: u64 = self.max_ordinal_present();
1089            encoder.write_num(max_ordinal, offset);
1090            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1091            // Calling encoder.out_of_line_offset(0) is not allowed.
1092            if max_ordinal == 0 {
1093                return Ok(());
1094            }
1095            depth.increment()?;
1096            let envelope_size = 8;
1097            let bytes_len = max_ordinal as usize * envelope_size;
1098            #[allow(unused_variables)]
1099            let offset = encoder.out_of_line_offset(bytes_len);
1100            let mut _prev_end_offset: usize = 0;
1101            if 1 > max_ordinal {
1102                return Ok(());
1103            }
1104
1105            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1106            // are envelope_size bytes.
1107            let cur_offset: usize = (1 - 1) * envelope_size;
1108
1109            // Zero reserved fields.
1110            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1111
1112            // Safety:
1113            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1114            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1115            //   envelope_size bytes, there is always sufficient room.
1116            fidl::encoding::encode_in_envelope_optional::<u64, D>(
1117                self.interface.as_ref().map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
1118                encoder,
1119                offset + cur_offset,
1120                depth,
1121            )?;
1122
1123            _prev_end_offset = cur_offset + envelope_size;
1124            if 2 > max_ordinal {
1125                return Ok(());
1126            }
1127
1128            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1129            // are envelope_size bytes.
1130            let cur_offset: usize = (2 - 1) * envelope_size;
1131
1132            // Zero reserved fields.
1133            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1134
1135            // Safety:
1136            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1137            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1138            //   envelope_size bytes, there is always sufficient room.
1139            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_common::IpAddress, D>(
1140                self.neighbor.as_ref().map(
1141                    <fidl_fuchsia_net_common::IpAddress as fidl::encoding::ValueTypeMarker>::borrow,
1142                ),
1143                encoder,
1144                offset + cur_offset,
1145                depth,
1146            )?;
1147
1148            _prev_end_offset = cur_offset + envelope_size;
1149            if 3 > max_ordinal {
1150                return Ok(());
1151            }
1152
1153            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1154            // are envelope_size bytes.
1155            let cur_offset: usize = (3 - 1) * envelope_size;
1156
1157            // Zero reserved fields.
1158            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1159
1160            // Safety:
1161            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1162            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1163            //   envelope_size bytes, there is always sufficient room.
1164            fidl::encoding::encode_in_envelope_optional::<EntryState, D>(
1165                self.state.as_ref().map(<EntryState as fidl::encoding::ValueTypeMarker>::borrow),
1166                encoder,
1167                offset + cur_offset,
1168                depth,
1169            )?;
1170
1171            _prev_end_offset = cur_offset + envelope_size;
1172            if 4 > max_ordinal {
1173                return Ok(());
1174            }
1175
1176            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1177            // are envelope_size bytes.
1178            let cur_offset: usize = (4 - 1) * envelope_size;
1179
1180            // Zero reserved fields.
1181            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1182
1183            // Safety:
1184            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1185            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1186            //   envelope_size bytes, there is always sufficient room.
1187            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_common::MacAddress, D>(
1188            self.mac.as_ref().map(<fidl_fuchsia_net_common::MacAddress as fidl::encoding::ValueTypeMarker>::borrow),
1189            encoder, offset + cur_offset, depth
1190        )?;
1191
1192            _prev_end_offset = cur_offset + envelope_size;
1193            if 5 > max_ordinal {
1194                return Ok(());
1195            }
1196
1197            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
1198            // are envelope_size bytes.
1199            let cur_offset: usize = (5 - 1) * envelope_size;
1200
1201            // Zero reserved fields.
1202            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
1203
1204            // Safety:
1205            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
1206            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
1207            //   envelope_size bytes, there is always sufficient room.
1208            fidl::encoding::encode_in_envelope_optional::<i64, D>(
1209                self.updated_at.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
1210                encoder,
1211                offset + cur_offset,
1212                depth,
1213            )?;
1214
1215            _prev_end_offset = cur_offset + envelope_size;
1216
1217            Ok(())
1218        }
1219    }
1220
1221    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Entry {
1222        #[inline(always)]
1223        fn new_empty() -> Self {
1224            Self::default()
1225        }
1226
1227        unsafe fn decode(
1228            &mut self,
1229            decoder: &mut fidl::encoding::Decoder<'_, D>,
1230            offset: usize,
1231            mut depth: fidl::encoding::Depth,
1232        ) -> fidl::Result<()> {
1233            decoder.debug_check_bounds::<Self>(offset);
1234            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1235                None => return Err(fidl::Error::NotNullable),
1236                Some(len) => len,
1237            };
1238            // Calling decoder.out_of_line_offset(0) is not allowed.
1239            if len == 0 {
1240                return Ok(());
1241            };
1242            depth.increment()?;
1243            let envelope_size = 8;
1244            let bytes_len = len * envelope_size;
1245            let offset = decoder.out_of_line_offset(bytes_len)?;
1246            // Decode the envelope for each type.
1247            let mut _next_ordinal_to_read = 0;
1248            let mut next_offset = offset;
1249            let end_offset = offset + bytes_len;
1250            _next_ordinal_to_read += 1;
1251            if next_offset >= end_offset {
1252                return Ok(());
1253            }
1254
1255            // Decode unknown envelopes for gaps in ordinals.
1256            while _next_ordinal_to_read < 1 {
1257                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1258                _next_ordinal_to_read += 1;
1259                next_offset += envelope_size;
1260            }
1261
1262            let next_out_of_line = decoder.next_out_of_line();
1263            let handles_before = decoder.remaining_handles();
1264            if let Some((inlined, num_bytes, num_handles)) =
1265                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1266            {
1267                let member_inline_size =
1268                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1269                if inlined != (member_inline_size <= 4) {
1270                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1271                }
1272                let inner_offset;
1273                let mut inner_depth = depth.clone();
1274                if inlined {
1275                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1276                    inner_offset = next_offset;
1277                } else {
1278                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1279                    inner_depth.increment()?;
1280                }
1281                let val_ref = self.interface.get_or_insert_with(|| fidl::new_empty!(u64, D));
1282                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
1283                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1284                {
1285                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1286                }
1287                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1288                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1289                }
1290            }
1291
1292            next_offset += envelope_size;
1293            _next_ordinal_to_read += 1;
1294            if next_offset >= end_offset {
1295                return Ok(());
1296            }
1297
1298            // Decode unknown envelopes for gaps in ordinals.
1299            while _next_ordinal_to_read < 2 {
1300                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1301                _next_ordinal_to_read += 1;
1302                next_offset += envelope_size;
1303            }
1304
1305            let next_out_of_line = decoder.next_out_of_line();
1306            let handles_before = decoder.remaining_handles();
1307            if let Some((inlined, num_bytes, num_handles)) =
1308                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1309            {
1310                let member_inline_size =
1311                    <fidl_fuchsia_net_common::IpAddress as fidl::encoding::TypeMarker>::inline_size(
1312                        decoder.context,
1313                    );
1314                if inlined != (member_inline_size <= 4) {
1315                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1316                }
1317                let inner_offset;
1318                let mut inner_depth = depth.clone();
1319                if inlined {
1320                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1321                    inner_offset = next_offset;
1322                } else {
1323                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1324                    inner_depth.increment()?;
1325                }
1326                let val_ref = self
1327                    .neighbor
1328                    .get_or_insert_with(|| fidl::new_empty!(fidl_fuchsia_net_common::IpAddress, D));
1329                fidl::decode!(
1330                    fidl_fuchsia_net_common::IpAddress,
1331                    D,
1332                    val_ref,
1333                    decoder,
1334                    inner_offset,
1335                    inner_depth
1336                )?;
1337                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1338                {
1339                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1340                }
1341                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1342                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1343                }
1344            }
1345
1346            next_offset += envelope_size;
1347            _next_ordinal_to_read += 1;
1348            if next_offset >= end_offset {
1349                return Ok(());
1350            }
1351
1352            // Decode unknown envelopes for gaps in ordinals.
1353            while _next_ordinal_to_read < 3 {
1354                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1355                _next_ordinal_to_read += 1;
1356                next_offset += envelope_size;
1357            }
1358
1359            let next_out_of_line = decoder.next_out_of_line();
1360            let handles_before = decoder.remaining_handles();
1361            if let Some((inlined, num_bytes, num_handles)) =
1362                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1363            {
1364                let member_inline_size =
1365                    <EntryState as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1366                if inlined != (member_inline_size <= 4) {
1367                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1368                }
1369                let inner_offset;
1370                let mut inner_depth = depth.clone();
1371                if inlined {
1372                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1373                    inner_offset = next_offset;
1374                } else {
1375                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1376                    inner_depth.increment()?;
1377                }
1378                let val_ref = self.state.get_or_insert_with(|| fidl::new_empty!(EntryState, D));
1379                fidl::decode!(EntryState, D, val_ref, decoder, inner_offset, inner_depth)?;
1380                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1381                {
1382                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1383                }
1384                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1385                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1386                }
1387            }
1388
1389            next_offset += envelope_size;
1390            _next_ordinal_to_read += 1;
1391            if next_offset >= end_offset {
1392                return Ok(());
1393            }
1394
1395            // Decode unknown envelopes for gaps in ordinals.
1396            while _next_ordinal_to_read < 4 {
1397                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1398                _next_ordinal_to_read += 1;
1399                next_offset += envelope_size;
1400            }
1401
1402            let next_out_of_line = decoder.next_out_of_line();
1403            let handles_before = decoder.remaining_handles();
1404            if let Some((inlined, num_bytes, num_handles)) =
1405                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1406            {
1407                let member_inline_size = <fidl_fuchsia_net_common::MacAddress as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1408                if inlined != (member_inline_size <= 4) {
1409                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1410                }
1411                let inner_offset;
1412                let mut inner_depth = depth.clone();
1413                if inlined {
1414                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1415                    inner_offset = next_offset;
1416                } else {
1417                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1418                    inner_depth.increment()?;
1419                }
1420                let val_ref = self.mac.get_or_insert_with(|| {
1421                    fidl::new_empty!(fidl_fuchsia_net_common::MacAddress, D)
1422                });
1423                fidl::decode!(
1424                    fidl_fuchsia_net_common::MacAddress,
1425                    D,
1426                    val_ref,
1427                    decoder,
1428                    inner_offset,
1429                    inner_depth
1430                )?;
1431                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1432                {
1433                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1434                }
1435                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1436                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1437                }
1438            }
1439
1440            next_offset += envelope_size;
1441            _next_ordinal_to_read += 1;
1442            if next_offset >= end_offset {
1443                return Ok(());
1444            }
1445
1446            // Decode unknown envelopes for gaps in ordinals.
1447            while _next_ordinal_to_read < 5 {
1448                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1449                _next_ordinal_to_read += 1;
1450                next_offset += envelope_size;
1451            }
1452
1453            let next_out_of_line = decoder.next_out_of_line();
1454            let handles_before = decoder.remaining_handles();
1455            if let Some((inlined, num_bytes, num_handles)) =
1456                fidl::encoding::decode_envelope_header(decoder, next_offset)?
1457            {
1458                let member_inline_size =
1459                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
1460                if inlined != (member_inline_size <= 4) {
1461                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
1462                }
1463                let inner_offset;
1464                let mut inner_depth = depth.clone();
1465                if inlined {
1466                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
1467                    inner_offset = next_offset;
1468                } else {
1469                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1470                    inner_depth.increment()?;
1471                }
1472                let val_ref = self.updated_at.get_or_insert_with(|| fidl::new_empty!(i64, D));
1473                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
1474                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
1475                {
1476                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
1477                }
1478                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1479                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1480                }
1481            }
1482
1483            next_offset += envelope_size;
1484
1485            // Decode the remaining unknown envelopes.
1486            while next_offset < end_offset {
1487                _next_ordinal_to_read += 1;
1488                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1489                next_offset += envelope_size;
1490            }
1491
1492            Ok(())
1493        }
1494    }
1495
1496    impl EntryIteratorOptions {
1497        #[inline(always)]
1498        fn max_ordinal_present(&self) -> u64 {
1499            0
1500        }
1501    }
1502
1503    impl fidl::encoding::ValueTypeMarker for EntryIteratorOptions {
1504        type Borrowed<'a> = &'a Self;
1505        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1506            value
1507        }
1508    }
1509
1510    unsafe impl fidl::encoding::TypeMarker for EntryIteratorOptions {
1511        type Owned = Self;
1512
1513        #[inline(always)]
1514        fn inline_align(_context: fidl::encoding::Context) -> usize {
1515            8
1516        }
1517
1518        #[inline(always)]
1519        fn inline_size(_context: fidl::encoding::Context) -> usize {
1520            16
1521        }
1522    }
1523
1524    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EntryIteratorOptions, D>
1525        for &EntryIteratorOptions
1526    {
1527        unsafe fn encode(
1528            self,
1529            encoder: &mut fidl::encoding::Encoder<'_, D>,
1530            offset: usize,
1531            mut depth: fidl::encoding::Depth,
1532        ) -> fidl::Result<()> {
1533            encoder.debug_check_bounds::<EntryIteratorOptions>(offset);
1534            // Vector header
1535            let max_ordinal: u64 = self.max_ordinal_present();
1536            encoder.write_num(max_ordinal, offset);
1537            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
1538            // Calling encoder.out_of_line_offset(0) is not allowed.
1539            if max_ordinal == 0 {
1540                return Ok(());
1541            }
1542            depth.increment()?;
1543            let envelope_size = 8;
1544            let bytes_len = max_ordinal as usize * envelope_size;
1545            #[allow(unused_variables)]
1546            let offset = encoder.out_of_line_offset(bytes_len);
1547            let mut _prev_end_offset: usize = 0;
1548
1549            Ok(())
1550        }
1551    }
1552
1553    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EntryIteratorOptions {
1554        #[inline(always)]
1555        fn new_empty() -> Self {
1556            Self::default()
1557        }
1558
1559        unsafe fn decode(
1560            &mut self,
1561            decoder: &mut fidl::encoding::Decoder<'_, D>,
1562            offset: usize,
1563            mut depth: fidl::encoding::Depth,
1564        ) -> fidl::Result<()> {
1565            decoder.debug_check_bounds::<Self>(offset);
1566            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
1567                None => return Err(fidl::Error::NotNullable),
1568                Some(len) => len,
1569            };
1570            // Calling decoder.out_of_line_offset(0) is not allowed.
1571            if len == 0 {
1572                return Ok(());
1573            };
1574            depth.increment()?;
1575            let envelope_size = 8;
1576            let bytes_len = len * envelope_size;
1577            let offset = decoder.out_of_line_offset(bytes_len)?;
1578            // Decode the envelope for each type.
1579            let mut _next_ordinal_to_read = 0;
1580            let mut next_offset = offset;
1581            let end_offset = offset + bytes_len;
1582
1583            // Decode the remaining unknown envelopes.
1584            while next_offset < end_offset {
1585                _next_ordinal_to_read += 1;
1586                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
1587                next_offset += envelope_size;
1588            }
1589
1590            Ok(())
1591        }
1592    }
1593
1594    impl fidl::encoding::ValueTypeMarker for EntryIteratorItem {
1595        type Borrowed<'a> = &'a Self;
1596        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
1597            value
1598        }
1599    }
1600
1601    unsafe impl fidl::encoding::TypeMarker for EntryIteratorItem {
1602        type Owned = Self;
1603
1604        #[inline(always)]
1605        fn inline_align(_context: fidl::encoding::Context) -> usize {
1606            8
1607        }
1608
1609        #[inline(always)]
1610        fn inline_size(_context: fidl::encoding::Context) -> usize {
1611            16
1612        }
1613    }
1614
1615    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<EntryIteratorItem, D>
1616        for &EntryIteratorItem
1617    {
1618        #[inline]
1619        unsafe fn encode(
1620            self,
1621            encoder: &mut fidl::encoding::Encoder<'_, D>,
1622            offset: usize,
1623            _depth: fidl::encoding::Depth,
1624        ) -> fidl::Result<()> {
1625            encoder.debug_check_bounds::<EntryIteratorItem>(offset);
1626            encoder.write_num::<u64>(self.ordinal(), offset);
1627            match self {
1628                EntryIteratorItem::Existing(ref val) => {
1629                    fidl::encoding::encode_in_envelope::<Entry, D>(
1630                        <Entry as fidl::encoding::ValueTypeMarker>::borrow(val),
1631                        encoder,
1632                        offset + 8,
1633                        _depth,
1634                    )
1635                }
1636                EntryIteratorItem::Idle(ref val) => {
1637                    fidl::encoding::encode_in_envelope::<IdleEvent, D>(
1638                        <IdleEvent as fidl::encoding::ValueTypeMarker>::borrow(val),
1639                        encoder,
1640                        offset + 8,
1641                        _depth,
1642                    )
1643                }
1644                EntryIteratorItem::Added(ref val) => {
1645                    fidl::encoding::encode_in_envelope::<Entry, D>(
1646                        <Entry as fidl::encoding::ValueTypeMarker>::borrow(val),
1647                        encoder,
1648                        offset + 8,
1649                        _depth,
1650                    )
1651                }
1652                EntryIteratorItem::Changed(ref val) => {
1653                    fidl::encoding::encode_in_envelope::<Entry, D>(
1654                        <Entry as fidl::encoding::ValueTypeMarker>::borrow(val),
1655                        encoder,
1656                        offset + 8,
1657                        _depth,
1658                    )
1659                }
1660                EntryIteratorItem::Removed(ref val) => {
1661                    fidl::encoding::encode_in_envelope::<Entry, D>(
1662                        <Entry as fidl::encoding::ValueTypeMarker>::borrow(val),
1663                        encoder,
1664                        offset + 8,
1665                        _depth,
1666                    )
1667                }
1668            }
1669        }
1670    }
1671
1672    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for EntryIteratorItem {
1673        #[inline(always)]
1674        fn new_empty() -> Self {
1675            Self::Existing(fidl::new_empty!(Entry, D))
1676        }
1677
1678        #[inline]
1679        unsafe fn decode(
1680            &mut self,
1681            decoder: &mut fidl::encoding::Decoder<'_, D>,
1682            offset: usize,
1683            mut depth: fidl::encoding::Depth,
1684        ) -> fidl::Result<()> {
1685            decoder.debug_check_bounds::<Self>(offset);
1686            #[allow(unused_variables)]
1687            let next_out_of_line = decoder.next_out_of_line();
1688            let handles_before = decoder.remaining_handles();
1689            let (ordinal, inlined, num_bytes, num_handles) =
1690                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
1691
1692            let member_inline_size = match ordinal {
1693                1 => <Entry as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1694                2 => <IdleEvent as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1695                3 => <Entry as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1696                4 => <Entry as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1697                5 => <Entry as fidl::encoding::TypeMarker>::inline_size(decoder.context),
1698                _ => return Err(fidl::Error::UnknownUnionTag),
1699            };
1700
1701            if inlined != (member_inline_size <= 4) {
1702                return Err(fidl::Error::InvalidInlineBitInEnvelope);
1703            }
1704            let _inner_offset;
1705            if inlined {
1706                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
1707                _inner_offset = offset + 8;
1708            } else {
1709                depth.increment()?;
1710                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
1711            }
1712            match ordinal {
1713                1 => {
1714                    #[allow(irrefutable_let_patterns)]
1715                    if let EntryIteratorItem::Existing(_) = self {
1716                        // Do nothing, read the value into the object
1717                    } else {
1718                        // Initialize `self` to the right variant
1719                        *self = EntryIteratorItem::Existing(fidl::new_empty!(Entry, D));
1720                    }
1721                    #[allow(irrefutable_let_patterns)]
1722                    if let EntryIteratorItem::Existing(ref mut val) = self {
1723                        fidl::decode!(Entry, D, val, decoder, _inner_offset, depth)?;
1724                    } else {
1725                        unreachable!()
1726                    }
1727                }
1728                2 => {
1729                    #[allow(irrefutable_let_patterns)]
1730                    if let EntryIteratorItem::Idle(_) = self {
1731                        // Do nothing, read the value into the object
1732                    } else {
1733                        // Initialize `self` to the right variant
1734                        *self = EntryIteratorItem::Idle(fidl::new_empty!(IdleEvent, D));
1735                    }
1736                    #[allow(irrefutable_let_patterns)]
1737                    if let EntryIteratorItem::Idle(ref mut val) = self {
1738                        fidl::decode!(IdleEvent, D, val, decoder, _inner_offset, depth)?;
1739                    } else {
1740                        unreachable!()
1741                    }
1742                }
1743                3 => {
1744                    #[allow(irrefutable_let_patterns)]
1745                    if let EntryIteratorItem::Added(_) = self {
1746                        // Do nothing, read the value into the object
1747                    } else {
1748                        // Initialize `self` to the right variant
1749                        *self = EntryIteratorItem::Added(fidl::new_empty!(Entry, D));
1750                    }
1751                    #[allow(irrefutable_let_patterns)]
1752                    if let EntryIteratorItem::Added(ref mut val) = self {
1753                        fidl::decode!(Entry, D, val, decoder, _inner_offset, depth)?;
1754                    } else {
1755                        unreachable!()
1756                    }
1757                }
1758                4 => {
1759                    #[allow(irrefutable_let_patterns)]
1760                    if let EntryIteratorItem::Changed(_) = self {
1761                        // Do nothing, read the value into the object
1762                    } else {
1763                        // Initialize `self` to the right variant
1764                        *self = EntryIteratorItem::Changed(fidl::new_empty!(Entry, D));
1765                    }
1766                    #[allow(irrefutable_let_patterns)]
1767                    if let EntryIteratorItem::Changed(ref mut val) = self {
1768                        fidl::decode!(Entry, D, val, decoder, _inner_offset, depth)?;
1769                    } else {
1770                        unreachable!()
1771                    }
1772                }
1773                5 => {
1774                    #[allow(irrefutable_let_patterns)]
1775                    if let EntryIteratorItem::Removed(_) = self {
1776                        // Do nothing, read the value into the object
1777                    } else {
1778                        // Initialize `self` to the right variant
1779                        *self = EntryIteratorItem::Removed(fidl::new_empty!(Entry, D));
1780                    }
1781                    #[allow(irrefutable_let_patterns)]
1782                    if let EntryIteratorItem::Removed(ref mut val) = self {
1783                        fidl::decode!(Entry, D, val, decoder, _inner_offset, depth)?;
1784                    } else {
1785                        unreachable!()
1786                    }
1787                }
1788                ordinal => panic!("unexpected ordinal {:?}", ordinal),
1789            }
1790            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
1791                return Err(fidl::Error::InvalidNumBytesInEnvelope);
1792            }
1793            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
1794                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
1795            }
1796            Ok(())
1797        }
1798    }
1799}