fidl_fuchsia_net_multicast_admin/
fidl_fuchsia_net_multicast_admin.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::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10use futures::future::{self, MaybeDone, TryFutureExt};
11use zx_status;
12
13/// The maximum number of multicast-capable interfaces.
14///
15/// This value was obtained from the Linux multicast routing socket
16/// implementation's `MAXVIFS` (for IPv4)/`MAXMIFS` (for IPv6) value which are
17/// both 32:
18/// https://github.com/torvalds/linux/blob/5bfc75d92efd494db37f5c4c173d3639d4772966/include/uapi/linux/mroute.h#L44
19/// https://github.com/torvalds/linux/blob/5bfc75d92efd494db37f5c4c173d3639d4772966/include/uapi/linux/mroute6.h#L47
20pub const MAX_MULTICAST_INTERFACES: u8 = 32;
21
22/// The maximum number of queued routing events.
23pub const MAX_ROUTING_EVENTS: u16 = 128;
24
25#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
26#[repr(u32)]
27pub enum Ipv4RoutingTableControllerAddRouteError {
28    /// Indicates that the address is invalid (not a unicast source address
29    /// or not a multicast destination address).
30    InvalidAddress = 1,
31    /// Indicates that the route is missing fields that are required.
32    RequiredRouteFieldsMissing = 2,
33    /// Indicates that an interface was not found.
34    InterfaceNotFound = 3,
35    /// Indicates that the route's set of output interfaces contains the
36    /// input interface.
37    InputCannotBeOutput = 4,
38    /// Indicates that the same output interface was specified multiple
39    /// times, regardless of provided minimum TTLs.
40    DuplicateOutput = 5,
41}
42
43impl Ipv4RoutingTableControllerAddRouteError {
44    #[inline]
45    pub fn from_primitive(prim: u32) -> Option<Self> {
46        match prim {
47            1 => Some(Self::InvalidAddress),
48            2 => Some(Self::RequiredRouteFieldsMissing),
49            3 => Some(Self::InterfaceNotFound),
50            4 => Some(Self::InputCannotBeOutput),
51            5 => Some(Self::DuplicateOutput),
52            _ => None,
53        }
54    }
55
56    #[inline]
57    pub const fn into_primitive(self) -> u32 {
58        self as u32
59    }
60
61    #[deprecated = "Strict enums should not use `is_unknown`"]
62    #[inline]
63    pub fn is_unknown(&self) -> bool {
64        false
65    }
66}
67
68#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
69#[repr(u32)]
70pub enum Ipv4RoutingTableControllerDelRouteError {
71    /// Indicates that the address is invalid (not a unicast source address
72    /// or not a multicast destination address).
73    InvalidAddress = 1,
74    /// Indicates that the route was not found.
75    NotFound = 2,
76}
77
78impl Ipv4RoutingTableControllerDelRouteError {
79    #[inline]
80    pub fn from_primitive(prim: u32) -> Option<Self> {
81        match prim {
82            1 => Some(Self::InvalidAddress),
83            2 => Some(Self::NotFound),
84            _ => None,
85        }
86    }
87
88    #[inline]
89    pub const fn into_primitive(self) -> u32 {
90        self as u32
91    }
92
93    #[deprecated = "Strict enums should not use `is_unknown`"]
94    #[inline]
95    pub fn is_unknown(&self) -> bool {
96        false
97    }
98}
99
100#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
101#[repr(u32)]
102pub enum Ipv4RoutingTableControllerGetRouteStatsError {
103    /// Indicates that the address is invalid (not a unicast source address
104    /// or not a multicast destination address).
105    InvalidAddress = 1,
106    /// Indicates that the route was not found.
107    NotFound = 2,
108}
109
110impl Ipv4RoutingTableControllerGetRouteStatsError {
111    #[inline]
112    pub fn from_primitive(prim: u32) -> Option<Self> {
113        match prim {
114            1 => Some(Self::InvalidAddress),
115            2 => Some(Self::NotFound),
116            _ => None,
117        }
118    }
119
120    #[inline]
121    pub const fn into_primitive(self) -> u32 {
122        self as u32
123    }
124
125    #[deprecated = "Strict enums should not use `is_unknown`"]
126    #[inline]
127    pub fn is_unknown(&self) -> bool {
128        false
129    }
130}
131
132#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
133#[repr(u32)]
134pub enum Ipv6RoutingTableControllerAddRouteError {
135    /// Indicates that the address is invalid (not a unicast source address
136    /// or not a multicast destination address).
137    InvalidAddress = 1,
138    /// Indicates that the route is missing fields that are required.
139    RequiredRouteFieldsMissing = 2,
140    /// Indicates that an interface was not found.
141    InterfaceNotFound = 3,
142    /// Indicates that the route's set of output interfaces contains the
143    /// input interface.
144    InputCannotBeOutput = 4,
145    /// Indicates that the same output interface was specified multiple
146    /// times, regardless of provided minimum TTLs.
147    DuplicateOutput = 5,
148}
149
150impl Ipv6RoutingTableControllerAddRouteError {
151    #[inline]
152    pub fn from_primitive(prim: u32) -> Option<Self> {
153        match prim {
154            1 => Some(Self::InvalidAddress),
155            2 => Some(Self::RequiredRouteFieldsMissing),
156            3 => Some(Self::InterfaceNotFound),
157            4 => Some(Self::InputCannotBeOutput),
158            5 => Some(Self::DuplicateOutput),
159            _ => None,
160        }
161    }
162
163    #[inline]
164    pub const fn into_primitive(self) -> u32 {
165        self as u32
166    }
167
168    #[deprecated = "Strict enums should not use `is_unknown`"]
169    #[inline]
170    pub fn is_unknown(&self) -> bool {
171        false
172    }
173}
174
175#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
176#[repr(u32)]
177pub enum Ipv6RoutingTableControllerDelRouteError {
178    /// Indicates that the address is invalid (not a unicast source address
179    /// or not a multicast destination address).
180    InvalidAddress = 1,
181    /// Indicates that the route was not found.
182    NotFound = 2,
183}
184
185impl Ipv6RoutingTableControllerDelRouteError {
186    #[inline]
187    pub fn from_primitive(prim: u32) -> Option<Self> {
188        match prim {
189            1 => Some(Self::InvalidAddress),
190            2 => Some(Self::NotFound),
191            _ => None,
192        }
193    }
194
195    #[inline]
196    pub const fn into_primitive(self) -> u32 {
197        self as u32
198    }
199
200    #[deprecated = "Strict enums should not use `is_unknown`"]
201    #[inline]
202    pub fn is_unknown(&self) -> bool {
203        false
204    }
205}
206
207#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
208#[repr(u32)]
209pub enum Ipv6RoutingTableControllerGetRouteStatsError {
210    /// Indicates that the address is invalid (not a unicast source address
211    /// or not a multicast destination address).
212    InvalidAddress = 1,
213    /// Indicates that the route was not found.
214    NotFound = 2,
215}
216
217impl Ipv6RoutingTableControllerGetRouteStatsError {
218    #[inline]
219    pub fn from_primitive(prim: u32) -> Option<Self> {
220        match prim {
221            1 => Some(Self::InvalidAddress),
222            2 => Some(Self::NotFound),
223            _ => None,
224        }
225    }
226
227    #[inline]
228    pub const fn into_primitive(self) -> u32 {
229        self as u32
230    }
231
232    #[deprecated = "Strict enums should not use `is_unknown`"]
233    #[inline]
234    pub fn is_unknown(&self) -> bool {
235        false
236    }
237}
238
239/// The reason for closing a multicast table controller.
240#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
241#[repr(u32)]
242pub enum TableControllerCloseReason {
243    /// Indicates that a client already holds the controller for a table.
244    AlreadyInUse = 1,
245    /// Indicates that the client made a request to a hanging get method while a
246    /// request was already in-flight.
247    HangingGetError = 2,
248}
249
250impl TableControllerCloseReason {
251    #[inline]
252    pub fn from_primitive(prim: u32) -> Option<Self> {
253        match prim {
254            1 => Some(Self::AlreadyInUse),
255            2 => Some(Self::HangingGetError),
256            _ => None,
257        }
258    }
259
260    #[inline]
261    pub const fn into_primitive(self) -> u32 {
262        self as u32
263    }
264
265    #[deprecated = "Strict enums should not use `is_unknown`"]
266    #[inline]
267    pub fn is_unknown(&self) -> bool {
268        false
269    }
270}
271
272#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
273pub struct Empty;
274
275impl fidl::Persistable for Empty {}
276
277#[derive(Clone, Debug, PartialEq)]
278pub struct Ipv4RoutingTableControllerAddRouteRequest {
279    pub addresses: Ipv4UnicastSourceAndMulticastDestination,
280    pub route: Route,
281}
282
283impl fidl::Persistable for Ipv4RoutingTableControllerAddRouteRequest {}
284
285#[derive(Clone, Debug, PartialEq)]
286pub struct Ipv4RoutingTableControllerDelRouteRequest {
287    pub addresses: Ipv4UnicastSourceAndMulticastDestination,
288}
289
290impl fidl::Persistable for Ipv4RoutingTableControllerDelRouteRequest {}
291
292#[derive(Clone, Debug, PartialEq)]
293pub struct Ipv4RoutingTableControllerGetRouteStatsRequest {
294    pub addresses: Ipv4UnicastSourceAndMulticastDestination,
295}
296
297impl fidl::Persistable for Ipv4RoutingTableControllerGetRouteStatsRequest {}
298
299#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
300pub struct Ipv4RoutingTableControllerOnCloseRequest {
301    pub error: TableControllerCloseReason,
302}
303
304impl fidl::Persistable for Ipv4RoutingTableControllerOnCloseRequest {}
305
306#[derive(Clone, Debug, PartialEq)]
307pub struct Ipv4RoutingTableControllerWatchRoutingEventsResponse {
308    pub dropped_events: u64,
309    pub addresses: Ipv4UnicastSourceAndMulticastDestination,
310    pub input_interface: u64,
311    pub event: RoutingEvent,
312}
313
314impl fidl::Persistable for Ipv4RoutingTableControllerWatchRoutingEventsResponse {}
315
316#[derive(Clone, Debug, PartialEq)]
317pub struct Ipv4RoutingTableControllerGetRouteStatsResponse {
318    pub stats: RouteStats,
319}
320
321impl fidl::Persistable for Ipv4RoutingTableControllerGetRouteStatsResponse {}
322
323/// The source and destination address of an IPv4 multicast route.
324///
325/// This address tuple uniquely identifies an IPv4 multicast route.
326#[derive(Clone, Debug, PartialEq)]
327pub struct Ipv4UnicastSourceAndMulticastDestination {
328    /// A unicast source address found in a multicast packet.
329    pub unicast_source: fidl_fuchsia_net::Ipv4Address,
330    /// A multicast destination address found in a multicast packet.
331    pub multicast_destination: fidl_fuchsia_net::Ipv4Address,
332}
333
334impl fidl::Persistable for Ipv4UnicastSourceAndMulticastDestination {}
335
336#[derive(Clone, Debug, PartialEq)]
337pub struct Ipv6RoutingTableControllerAddRouteRequest {
338    pub addresses: Ipv6UnicastSourceAndMulticastDestination,
339    pub route: Route,
340}
341
342impl fidl::Persistable for Ipv6RoutingTableControllerAddRouteRequest {}
343
344#[derive(Clone, Debug, PartialEq)]
345pub struct Ipv6RoutingTableControllerDelRouteRequest {
346    pub addresses: Ipv6UnicastSourceAndMulticastDestination,
347}
348
349impl fidl::Persistable for Ipv6RoutingTableControllerDelRouteRequest {}
350
351#[derive(Clone, Debug, PartialEq)]
352pub struct Ipv6RoutingTableControllerGetRouteStatsRequest {
353    pub addresses: Ipv6UnicastSourceAndMulticastDestination,
354}
355
356impl fidl::Persistable for Ipv6RoutingTableControllerGetRouteStatsRequest {}
357
358#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
359pub struct Ipv6RoutingTableControllerOnCloseRequest {
360    pub error: TableControllerCloseReason,
361}
362
363impl fidl::Persistable for Ipv6RoutingTableControllerOnCloseRequest {}
364
365#[derive(Clone, Debug, PartialEq)]
366pub struct Ipv6RoutingTableControllerWatchRoutingEventsResponse {
367    pub dropped_events: u64,
368    pub addresses: Ipv6UnicastSourceAndMulticastDestination,
369    pub input_interface: u64,
370    pub event: RoutingEvent,
371}
372
373impl fidl::Persistable for Ipv6RoutingTableControllerWatchRoutingEventsResponse {}
374
375#[derive(Clone, Debug, PartialEq)]
376pub struct Ipv6RoutingTableControllerGetRouteStatsResponse {
377    pub stats: RouteStats,
378}
379
380impl fidl::Persistable for Ipv6RoutingTableControllerGetRouteStatsResponse {}
381
382/// The source and destination address of an IPv6 multicast route.
383///
384/// This address tuple uniquely identifies an IPv6 multicast route.
385#[derive(Clone, Debug, PartialEq)]
386pub struct Ipv6UnicastSourceAndMulticastDestination {
387    /// A unicast source address found in a multicast packet.
388    pub unicast_source: fidl_fuchsia_net::Ipv6Address,
389    /// A multicast destination address found in a multicast packet.
390    pub multicast_destination: fidl_fuchsia_net::Ipv6Address,
391}
392
393impl fidl::Persistable for Ipv6UnicastSourceAndMulticastDestination {}
394
395#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
396#[repr(C)]
397pub struct OutgoingInterfaces {
398    /// The ID for the outgoing interface.
399    pub id: u64,
400    /// The minumum TTL/HopLimit a multicast packet must have to be sent
401    /// through the interface.
402    ///
403    /// Note: a value of 0 naturally allows all packets to be forwarded.
404    pub min_ttl: u8,
405}
406
407impl fidl::Persistable for OutgoingInterfaces {}
408
409/// A multicast route.
410#[derive(Clone, Debug, Default, PartialEq)]
411pub struct Route {
412    /// The expected input interface for a multicast packet using this route.
413    ///
414    /// Required.
415    pub expected_input_interface: Option<u64>,
416    /// The action to take for the route.
417    ///
418    /// Required.
419    pub action: Option<Action>,
420    #[doc(hidden)]
421    pub __source_breaking: fidl::marker::SourceBreaking,
422}
423
424impl fidl::Persistable for Route {}
425
426/// A snapshot of statistics for a multicast route.
427#[derive(Clone, Debug, Default, PartialEq)]
428pub struct RouteStats {
429    /// The last time the route was used to route a packet.
430    ///
431    /// The value is obtained from the system’s monotonic clock.
432    ///
433    /// Required.
434    pub last_used: Option<i64>,
435    #[doc(hidden)]
436    pub __source_breaking: fidl::marker::SourceBreaking,
437}
438
439impl fidl::Persistable for RouteStats {}
440
441#[derive(Clone, Debug, Default, PartialEq)]
442pub struct WrongInputInterface {
443    /// The interface the multicast packet was expected to arrive at.
444    pub expected_input_interface: Option<u64>,
445    #[doc(hidden)]
446    pub __source_breaking: fidl::marker::SourceBreaking,
447}
448
449impl fidl::Persistable for WrongInputInterface {}
450
451#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
452pub enum Action {
453    /// Send multicast packets through a set of output interfaces if the
454    /// multicast packet meets a minimum TTL (IPv4) or HopLimit (IPv6)
455    /// requirement for the interface.
456    OutgoingInterfaces(Vec<OutgoingInterfaces>),
457}
458
459impl Action {
460    #[inline]
461    pub fn ordinal(&self) -> u64 {
462        match *self {
463            Self::OutgoingInterfaces(_) => 1,
464        }
465    }
466
467    #[deprecated = "Strict unions should not use `is_unknown`"]
468    #[inline]
469    pub fn is_unknown(&self) -> bool {
470        false
471    }
472}
473
474impl fidl::Persistable for Action {}
475
476/// An event that can occur during multicast routing.
477#[derive(Clone, Debug, PartialEq)]
478pub enum RoutingEvent {
479    /// An event for a multicast packet that did not match any route.
480    ///
481    /// The packet that triggered this event may be queued so that the
482    /// packet may be transmitted once a route is installed. Note that
483    /// the packet may be dropped as per the server's GC/eviction
484    /// configurations/policies.
485    MissingRoute(Empty),
486    /// An event for a packet that arrived at an interface different
487    /// from what a route expected.
488    ///
489    /// This may be an indication of a routing loop. The packet that
490    /// triggered this event will be dropped without being forwarded.
491    WrongInputInterface(WrongInputInterface),
492}
493
494impl RoutingEvent {
495    #[inline]
496    pub fn ordinal(&self) -> u64 {
497        match *self {
498            Self::MissingRoute(_) => 1,
499            Self::WrongInputInterface(_) => 2,
500        }
501    }
502
503    #[deprecated = "Strict unions should not use `is_unknown`"]
504    #[inline]
505    pub fn is_unknown(&self) -> bool {
506        false
507    }
508}
509
510impl fidl::Persistable for RoutingEvent {}
511
512#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
513pub struct Ipv4RoutingTableControllerMarker;
514
515impl fidl::endpoints::ProtocolMarker for Ipv4RoutingTableControllerMarker {
516    type Proxy = Ipv4RoutingTableControllerProxy;
517    type RequestStream = Ipv4RoutingTableControllerRequestStream;
518    #[cfg(target_os = "fuchsia")]
519    type SynchronousProxy = Ipv4RoutingTableControllerSynchronousProxy;
520
521    const DEBUG_NAME: &'static str = "fuchsia.net.multicast.admin.Ipv4RoutingTableController";
522}
523impl fidl::endpoints::DiscoverableProtocolMarker for Ipv4RoutingTableControllerMarker {}
524pub type Ipv4RoutingTableControllerAddRouteResult =
525    Result<(), Ipv4RoutingTableControllerAddRouteError>;
526pub type Ipv4RoutingTableControllerDelRouteResult =
527    Result<(), Ipv4RoutingTableControllerDelRouteError>;
528pub type Ipv4RoutingTableControllerGetRouteStatsResult =
529    Result<RouteStats, Ipv4RoutingTableControllerGetRouteStatsError>;
530
531pub trait Ipv4RoutingTableControllerProxyInterface: Send + Sync {
532    type AddRouteResponseFut: std::future::Future<Output = Result<Ipv4RoutingTableControllerAddRouteResult, fidl::Error>>
533        + Send;
534    fn r#add_route(
535        &self,
536        addresses: &Ipv4UnicastSourceAndMulticastDestination,
537        route: &Route,
538    ) -> Self::AddRouteResponseFut;
539    type DelRouteResponseFut: std::future::Future<Output = Result<Ipv4RoutingTableControllerDelRouteResult, fidl::Error>>
540        + Send;
541    fn r#del_route(
542        &self,
543        addresses: &Ipv4UnicastSourceAndMulticastDestination,
544    ) -> Self::DelRouteResponseFut;
545    type GetRouteStatsResponseFut: std::future::Future<
546            Output = Result<Ipv4RoutingTableControllerGetRouteStatsResult, fidl::Error>,
547        > + Send;
548    fn r#get_route_stats(
549        &self,
550        addresses: &Ipv4UnicastSourceAndMulticastDestination,
551    ) -> Self::GetRouteStatsResponseFut;
552    type WatchRoutingEventsResponseFut: std::future::Future<
553            Output = Result<
554                (u64, Ipv4UnicastSourceAndMulticastDestination, u64, RoutingEvent),
555                fidl::Error,
556            >,
557        > + Send;
558    fn r#watch_routing_events(&self) -> Self::WatchRoutingEventsResponseFut;
559}
560#[derive(Debug)]
561#[cfg(target_os = "fuchsia")]
562pub struct Ipv4RoutingTableControllerSynchronousProxy {
563    client: fidl::client::sync::Client,
564}
565
566#[cfg(target_os = "fuchsia")]
567impl fidl::endpoints::SynchronousProxy for Ipv4RoutingTableControllerSynchronousProxy {
568    type Proxy = Ipv4RoutingTableControllerProxy;
569    type Protocol = Ipv4RoutingTableControllerMarker;
570
571    fn from_channel(inner: fidl::Channel) -> Self {
572        Self::new(inner)
573    }
574
575    fn into_channel(self) -> fidl::Channel {
576        self.client.into_channel()
577    }
578
579    fn as_channel(&self) -> &fidl::Channel {
580        self.client.as_channel()
581    }
582}
583
584#[cfg(target_os = "fuchsia")]
585impl Ipv4RoutingTableControllerSynchronousProxy {
586    pub fn new(channel: fidl::Channel) -> Self {
587        let protocol_name =
588            <Ipv4RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
589        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
590    }
591
592    pub fn into_channel(self) -> fidl::Channel {
593        self.client.into_channel()
594    }
595
596    /// Waits until an event arrives and returns it. It is safe for other
597    /// threads to make concurrent requests while waiting for an event.
598    pub fn wait_for_event(
599        &self,
600        deadline: zx::MonotonicInstant,
601    ) -> Result<Ipv4RoutingTableControllerEvent, fidl::Error> {
602        Ipv4RoutingTableControllerEvent::decode(self.client.wait_for_event(deadline)?)
603    }
604
605    /// Adds a route such that packets matching the addresses will be forwarded
606    /// accordingly.
607    ///
608    /// The provided addresses act as the key for the route; any existing route
609    /// with the same addresses will be overwritten when this route is
610    /// installed.
611    ///
612    /// If a packet arrives at an interface different from the expected input
613    /// interface set in the route, the packet will not be forwarded and a
614    /// [`RoutingEvent.wrong_input_interface`] event will be sent to the client.
615    /// See [`WatchRoutingEvents`] for more details.
616    ///
617    /// + request `addresses` the addresses used to identify a route.
618    /// + request `route` the multicast route.
619    pub fn r#add_route(
620        &self,
621        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
622        mut route: &Route,
623        ___deadline: zx::MonotonicInstant,
624    ) -> Result<Ipv4RoutingTableControllerAddRouteResult, fidl::Error> {
625        let _response = self
626            .client
627            .send_query::<Ipv4RoutingTableControllerAddRouteRequest, fidl::encoding::ResultType<
628                fidl::encoding::EmptyStruct,
629                Ipv4RoutingTableControllerAddRouteError,
630            >>(
631                (addresses, route),
632                0x6098a90553ef1aed,
633                fidl::encoding::DynamicFlags::empty(),
634                ___deadline,
635            )?;
636        Ok(_response.map(|x| x))
637    }
638
639    /// Delete a route.
640    ///
641    /// + request `addresses` the addresses used to identify a route.
642    pub fn r#del_route(
643        &self,
644        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
645        ___deadline: zx::MonotonicInstant,
646    ) -> Result<Ipv4RoutingTableControllerDelRouteResult, fidl::Error> {
647        let _response = self
648            .client
649            .send_query::<Ipv4RoutingTableControllerDelRouteRequest, fidl::encoding::ResultType<
650                fidl::encoding::EmptyStruct,
651                Ipv4RoutingTableControllerDelRouteError,
652            >>(
653                (addresses,),
654                0x14a0727b797aff74,
655                fidl::encoding::DynamicFlags::empty(),
656                ___deadline,
657            )?;
658        Ok(_response.map(|x| x))
659    }
660
661    /// Get a snapshot of statistics about a specific route.
662    ///
663    /// + request `addresses` the addresses used to identify a route.
664    pub fn r#get_route_stats(
665        &self,
666        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
667        ___deadline: zx::MonotonicInstant,
668    ) -> Result<Ipv4RoutingTableControllerGetRouteStatsResult, fidl::Error> {
669        let _response = self.client.send_query::<
670            Ipv4RoutingTableControllerGetRouteStatsRequest,
671            fidl::encoding::ResultType<Ipv4RoutingTableControllerGetRouteStatsResponse, Ipv4RoutingTableControllerGetRouteStatsError>,
672        >(
673            (addresses,),
674            0x176ad8488370c1e9,
675            fidl::encoding::DynamicFlags::empty(),
676            ___deadline,
677        )?;
678        Ok(_response.map(|x| x.stats))
679    }
680
681    /// Watch for events triggered by multicast packets.
682    ///
683    /// The server will queue events to return when this method is called. If no
684    /// events are ready, the call will block until an event is ready. The
685    /// server will drop new events if the client is not consuming them fast
686    /// enough and return the number of events dropped in-between events.
687    ///
688    /// It is invalid to call this method while a previous call is pending.
689    /// Doing so will cause the server end of the protocol to be closed.
690    ///
691    /// - response `dropped_events` the number of events that were dropped
692    ///   _immediately before_ the returned event was queued.
693    ///   returned event.
694    /// - response `addresses` the addresses in the multicast packet triggering
695    ///   the event.
696    /// - response `input_interface` the interface the multicast packet
697    ///   triggering the event arrived at.
698    /// - response `event` the event.
699    pub fn r#watch_routing_events(
700        &self,
701        ___deadline: zx::MonotonicInstant,
702    ) -> Result<(u64, Ipv4UnicastSourceAndMulticastDestination, u64, RoutingEvent), fidl::Error>
703    {
704        let _response = self.client.send_query::<
705            fidl::encoding::EmptyPayload,
706            Ipv4RoutingTableControllerWatchRoutingEventsResponse,
707        >(
708            (),
709            0x3e4336c50718d7f9,
710            fidl::encoding::DynamicFlags::empty(),
711            ___deadline,
712        )?;
713        Ok((
714            _response.dropped_events,
715            _response.addresses,
716            _response.input_interface,
717            _response.event,
718        ))
719    }
720}
721
722#[derive(Debug, Clone)]
723pub struct Ipv4RoutingTableControllerProxy {
724    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
725}
726
727impl fidl::endpoints::Proxy for Ipv4RoutingTableControllerProxy {
728    type Protocol = Ipv4RoutingTableControllerMarker;
729
730    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
731        Self::new(inner)
732    }
733
734    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
735        self.client.into_channel().map_err(|client| Self { client })
736    }
737
738    fn as_channel(&self) -> &::fidl::AsyncChannel {
739        self.client.as_channel()
740    }
741}
742
743impl Ipv4RoutingTableControllerProxy {
744    /// Create a new Proxy for fuchsia.net.multicast.admin/Ipv4RoutingTableController.
745    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
746        let protocol_name =
747            <Ipv4RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
748        Self { client: fidl::client::Client::new(channel, protocol_name) }
749    }
750
751    /// Get a Stream of events from the remote end of the protocol.
752    ///
753    /// # Panics
754    ///
755    /// Panics if the event stream was already taken.
756    pub fn take_event_stream(&self) -> Ipv4RoutingTableControllerEventStream {
757        Ipv4RoutingTableControllerEventStream { event_receiver: self.client.take_event_receiver() }
758    }
759
760    /// Adds a route such that packets matching the addresses will be forwarded
761    /// accordingly.
762    ///
763    /// The provided addresses act as the key for the route; any existing route
764    /// with the same addresses will be overwritten when this route is
765    /// installed.
766    ///
767    /// If a packet arrives at an interface different from the expected input
768    /// interface set in the route, the packet will not be forwarded and a
769    /// [`RoutingEvent.wrong_input_interface`] event will be sent to the client.
770    /// See [`WatchRoutingEvents`] for more details.
771    ///
772    /// + request `addresses` the addresses used to identify a route.
773    /// + request `route` the multicast route.
774    pub fn r#add_route(
775        &self,
776        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
777        mut route: &Route,
778    ) -> fidl::client::QueryResponseFut<
779        Ipv4RoutingTableControllerAddRouteResult,
780        fidl::encoding::DefaultFuchsiaResourceDialect,
781    > {
782        Ipv4RoutingTableControllerProxyInterface::r#add_route(self, addresses, route)
783    }
784
785    /// Delete a route.
786    ///
787    /// + request `addresses` the addresses used to identify a route.
788    pub fn r#del_route(
789        &self,
790        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
791    ) -> fidl::client::QueryResponseFut<
792        Ipv4RoutingTableControllerDelRouteResult,
793        fidl::encoding::DefaultFuchsiaResourceDialect,
794    > {
795        Ipv4RoutingTableControllerProxyInterface::r#del_route(self, addresses)
796    }
797
798    /// Get a snapshot of statistics about a specific route.
799    ///
800    /// + request `addresses` the addresses used to identify a route.
801    pub fn r#get_route_stats(
802        &self,
803        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
804    ) -> fidl::client::QueryResponseFut<
805        Ipv4RoutingTableControllerGetRouteStatsResult,
806        fidl::encoding::DefaultFuchsiaResourceDialect,
807    > {
808        Ipv4RoutingTableControllerProxyInterface::r#get_route_stats(self, addresses)
809    }
810
811    /// Watch for events triggered by multicast packets.
812    ///
813    /// The server will queue events to return when this method is called. If no
814    /// events are ready, the call will block until an event is ready. The
815    /// server will drop new events if the client is not consuming them fast
816    /// enough and return the number of events dropped in-between events.
817    ///
818    /// It is invalid to call this method while a previous call is pending.
819    /// Doing so will cause the server end of the protocol to be closed.
820    ///
821    /// - response `dropped_events` the number of events that were dropped
822    ///   _immediately before_ the returned event was queued.
823    ///   returned event.
824    /// - response `addresses` the addresses in the multicast packet triggering
825    ///   the event.
826    /// - response `input_interface` the interface the multicast packet
827    ///   triggering the event arrived at.
828    /// - response `event` the event.
829    pub fn r#watch_routing_events(
830        &self,
831    ) -> fidl::client::QueryResponseFut<
832        (u64, Ipv4UnicastSourceAndMulticastDestination, u64, RoutingEvent),
833        fidl::encoding::DefaultFuchsiaResourceDialect,
834    > {
835        Ipv4RoutingTableControllerProxyInterface::r#watch_routing_events(self)
836    }
837}
838
839impl Ipv4RoutingTableControllerProxyInterface for Ipv4RoutingTableControllerProxy {
840    type AddRouteResponseFut = fidl::client::QueryResponseFut<
841        Ipv4RoutingTableControllerAddRouteResult,
842        fidl::encoding::DefaultFuchsiaResourceDialect,
843    >;
844    fn r#add_route(
845        &self,
846        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
847        mut route: &Route,
848    ) -> Self::AddRouteResponseFut {
849        fn _decode(
850            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
851        ) -> Result<Ipv4RoutingTableControllerAddRouteResult, fidl::Error> {
852            let _response = fidl::client::decode_transaction_body::<
853                fidl::encoding::ResultType<
854                    fidl::encoding::EmptyStruct,
855                    Ipv4RoutingTableControllerAddRouteError,
856                >,
857                fidl::encoding::DefaultFuchsiaResourceDialect,
858                0x6098a90553ef1aed,
859            >(_buf?)?;
860            Ok(_response.map(|x| x))
861        }
862        self.client.send_query_and_decode::<
863            Ipv4RoutingTableControllerAddRouteRequest,
864            Ipv4RoutingTableControllerAddRouteResult,
865        >(
866            (addresses, route,),
867            0x6098a90553ef1aed,
868            fidl::encoding::DynamicFlags::empty(),
869            _decode,
870        )
871    }
872
873    type DelRouteResponseFut = fidl::client::QueryResponseFut<
874        Ipv4RoutingTableControllerDelRouteResult,
875        fidl::encoding::DefaultFuchsiaResourceDialect,
876    >;
877    fn r#del_route(
878        &self,
879        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
880    ) -> Self::DelRouteResponseFut {
881        fn _decode(
882            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
883        ) -> Result<Ipv4RoutingTableControllerDelRouteResult, fidl::Error> {
884            let _response = fidl::client::decode_transaction_body::<
885                fidl::encoding::ResultType<
886                    fidl::encoding::EmptyStruct,
887                    Ipv4RoutingTableControllerDelRouteError,
888                >,
889                fidl::encoding::DefaultFuchsiaResourceDialect,
890                0x14a0727b797aff74,
891            >(_buf?)?;
892            Ok(_response.map(|x| x))
893        }
894        self.client.send_query_and_decode::<
895            Ipv4RoutingTableControllerDelRouteRequest,
896            Ipv4RoutingTableControllerDelRouteResult,
897        >(
898            (addresses,),
899            0x14a0727b797aff74,
900            fidl::encoding::DynamicFlags::empty(),
901            _decode,
902        )
903    }
904
905    type GetRouteStatsResponseFut = fidl::client::QueryResponseFut<
906        Ipv4RoutingTableControllerGetRouteStatsResult,
907        fidl::encoding::DefaultFuchsiaResourceDialect,
908    >;
909    fn r#get_route_stats(
910        &self,
911        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
912    ) -> Self::GetRouteStatsResponseFut {
913        fn _decode(
914            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
915        ) -> Result<Ipv4RoutingTableControllerGetRouteStatsResult, fidl::Error> {
916            let _response = fidl::client::decode_transaction_body::<
917                fidl::encoding::ResultType<
918                    Ipv4RoutingTableControllerGetRouteStatsResponse,
919                    Ipv4RoutingTableControllerGetRouteStatsError,
920                >,
921                fidl::encoding::DefaultFuchsiaResourceDialect,
922                0x176ad8488370c1e9,
923            >(_buf?)?;
924            Ok(_response.map(|x| x.stats))
925        }
926        self.client.send_query_and_decode::<
927            Ipv4RoutingTableControllerGetRouteStatsRequest,
928            Ipv4RoutingTableControllerGetRouteStatsResult,
929        >(
930            (addresses,),
931            0x176ad8488370c1e9,
932            fidl::encoding::DynamicFlags::empty(),
933            _decode,
934        )
935    }
936
937    type WatchRoutingEventsResponseFut = fidl::client::QueryResponseFut<
938        (u64, Ipv4UnicastSourceAndMulticastDestination, u64, RoutingEvent),
939        fidl::encoding::DefaultFuchsiaResourceDialect,
940    >;
941    fn r#watch_routing_events(&self) -> Self::WatchRoutingEventsResponseFut {
942        fn _decode(
943            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
944        ) -> Result<(u64, Ipv4UnicastSourceAndMulticastDestination, u64, RoutingEvent), fidl::Error>
945        {
946            let _response = fidl::client::decode_transaction_body::<
947                Ipv4RoutingTableControllerWatchRoutingEventsResponse,
948                fidl::encoding::DefaultFuchsiaResourceDialect,
949                0x3e4336c50718d7f9,
950            >(_buf?)?;
951            Ok((
952                _response.dropped_events,
953                _response.addresses,
954                _response.input_interface,
955                _response.event,
956            ))
957        }
958        self.client.send_query_and_decode::<
959            fidl::encoding::EmptyPayload,
960            (u64, Ipv4UnicastSourceAndMulticastDestination, u64, RoutingEvent),
961        >(
962            (),
963            0x3e4336c50718d7f9,
964            fidl::encoding::DynamicFlags::empty(),
965            _decode,
966        )
967    }
968}
969
970pub struct Ipv4RoutingTableControllerEventStream {
971    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
972}
973
974impl std::marker::Unpin for Ipv4RoutingTableControllerEventStream {}
975
976impl futures::stream::FusedStream for Ipv4RoutingTableControllerEventStream {
977    fn is_terminated(&self) -> bool {
978        self.event_receiver.is_terminated()
979    }
980}
981
982impl futures::Stream for Ipv4RoutingTableControllerEventStream {
983    type Item = Result<Ipv4RoutingTableControllerEvent, fidl::Error>;
984
985    fn poll_next(
986        mut self: std::pin::Pin<&mut Self>,
987        cx: &mut std::task::Context<'_>,
988    ) -> std::task::Poll<Option<Self::Item>> {
989        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
990            &mut self.event_receiver,
991            cx
992        )?) {
993            Some(buf) => std::task::Poll::Ready(Some(Ipv4RoutingTableControllerEvent::decode(buf))),
994            None => std::task::Poll::Ready(None),
995        }
996    }
997}
998
999#[derive(Debug)]
1000pub enum Ipv4RoutingTableControllerEvent {
1001    OnClose { error: TableControllerCloseReason },
1002}
1003
1004impl Ipv4RoutingTableControllerEvent {
1005    #[allow(irrefutable_let_patterns)]
1006    pub fn into_on_close(self) -> Option<TableControllerCloseReason> {
1007        if let Ipv4RoutingTableControllerEvent::OnClose { error } = self {
1008            Some((error))
1009        } else {
1010            None
1011        }
1012    }
1013
1014    /// Decodes a message buffer as a [`Ipv4RoutingTableControllerEvent`].
1015    fn decode(
1016        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1017    ) -> Result<Ipv4RoutingTableControllerEvent, fidl::Error> {
1018        let (bytes, _handles) = buf.split_mut();
1019        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1020        debug_assert_eq!(tx_header.tx_id, 0);
1021        match tx_header.ordinal {
1022            0x3dec49c6c2070f14 => {
1023                let mut out = fidl::new_empty!(Ipv4RoutingTableControllerOnCloseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1024                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv4RoutingTableControllerOnCloseRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1025                Ok((
1026                    Ipv4RoutingTableControllerEvent::OnClose {error: out.error,
1027
1028                    }
1029                ))
1030            }
1031            _ => Err(fidl::Error::UnknownOrdinal {
1032                ordinal: tx_header.ordinal,
1033                protocol_name: <Ipv4RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1034            })
1035        }
1036    }
1037}
1038
1039/// A Stream of incoming requests for fuchsia.net.multicast.admin/Ipv4RoutingTableController.
1040pub struct Ipv4RoutingTableControllerRequestStream {
1041    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1042    is_terminated: bool,
1043}
1044
1045impl std::marker::Unpin for Ipv4RoutingTableControllerRequestStream {}
1046
1047impl futures::stream::FusedStream for Ipv4RoutingTableControllerRequestStream {
1048    fn is_terminated(&self) -> bool {
1049        self.is_terminated
1050    }
1051}
1052
1053impl fidl::endpoints::RequestStream for Ipv4RoutingTableControllerRequestStream {
1054    type Protocol = Ipv4RoutingTableControllerMarker;
1055    type ControlHandle = Ipv4RoutingTableControllerControlHandle;
1056
1057    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1058        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1059    }
1060
1061    fn control_handle(&self) -> Self::ControlHandle {
1062        Ipv4RoutingTableControllerControlHandle { inner: self.inner.clone() }
1063    }
1064
1065    fn into_inner(
1066        self,
1067    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1068    {
1069        (self.inner, self.is_terminated)
1070    }
1071
1072    fn from_inner(
1073        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1074        is_terminated: bool,
1075    ) -> Self {
1076        Self { inner, is_terminated }
1077    }
1078}
1079
1080impl futures::Stream for Ipv4RoutingTableControllerRequestStream {
1081    type Item = Result<Ipv4RoutingTableControllerRequest, fidl::Error>;
1082
1083    fn poll_next(
1084        mut self: std::pin::Pin<&mut Self>,
1085        cx: &mut std::task::Context<'_>,
1086    ) -> std::task::Poll<Option<Self::Item>> {
1087        let this = &mut *self;
1088        if this.inner.check_shutdown(cx) {
1089            this.is_terminated = true;
1090            return std::task::Poll::Ready(None);
1091        }
1092        if this.is_terminated {
1093            panic!("polled Ipv4RoutingTableControllerRequestStream after completion");
1094        }
1095        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1096            |bytes, handles| {
1097                match this.inner.channel().read_etc(cx, bytes, handles) {
1098                    std::task::Poll::Ready(Ok(())) => {}
1099                    std::task::Poll::Pending => return std::task::Poll::Pending,
1100                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1101                        this.is_terminated = true;
1102                        return std::task::Poll::Ready(None);
1103                    }
1104                    std::task::Poll::Ready(Err(e)) => {
1105                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1106                            e.into(),
1107                        ))))
1108                    }
1109                }
1110
1111                // A message has been received from the channel
1112                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1113
1114                std::task::Poll::Ready(Some(match header.ordinal {
1115                0x6098a90553ef1aed => {
1116                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1117                    let mut req = fidl::new_empty!(Ipv4RoutingTableControllerAddRouteRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1118                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv4RoutingTableControllerAddRouteRequest>(&header, _body_bytes, handles, &mut req)?;
1119                    let control_handle = Ipv4RoutingTableControllerControlHandle {
1120                        inner: this.inner.clone(),
1121                    };
1122                    Ok(Ipv4RoutingTableControllerRequest::AddRoute {addresses: req.addresses,
1123route: req.route,
1124
1125                        responder: Ipv4RoutingTableControllerAddRouteResponder {
1126                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1127                            tx_id: header.tx_id,
1128                        },
1129                    })
1130                }
1131                0x14a0727b797aff74 => {
1132                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1133                    let mut req = fidl::new_empty!(Ipv4RoutingTableControllerDelRouteRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1134                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv4RoutingTableControllerDelRouteRequest>(&header, _body_bytes, handles, &mut req)?;
1135                    let control_handle = Ipv4RoutingTableControllerControlHandle {
1136                        inner: this.inner.clone(),
1137                    };
1138                    Ok(Ipv4RoutingTableControllerRequest::DelRoute {addresses: req.addresses,
1139
1140                        responder: Ipv4RoutingTableControllerDelRouteResponder {
1141                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1142                            tx_id: header.tx_id,
1143                        },
1144                    })
1145                }
1146                0x176ad8488370c1e9 => {
1147                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1148                    let mut req = fidl::new_empty!(Ipv4RoutingTableControllerGetRouteStatsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1149                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv4RoutingTableControllerGetRouteStatsRequest>(&header, _body_bytes, handles, &mut req)?;
1150                    let control_handle = Ipv4RoutingTableControllerControlHandle {
1151                        inner: this.inner.clone(),
1152                    };
1153                    Ok(Ipv4RoutingTableControllerRequest::GetRouteStats {addresses: req.addresses,
1154
1155                        responder: Ipv4RoutingTableControllerGetRouteStatsResponder {
1156                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1157                            tx_id: header.tx_id,
1158                        },
1159                    })
1160                }
1161                0x3e4336c50718d7f9 => {
1162                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1163                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1164                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1165                    let control_handle = Ipv4RoutingTableControllerControlHandle {
1166                        inner: this.inner.clone(),
1167                    };
1168                    Ok(Ipv4RoutingTableControllerRequest::WatchRoutingEvents {
1169                        responder: Ipv4RoutingTableControllerWatchRoutingEventsResponder {
1170                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1171                            tx_id: header.tx_id,
1172                        },
1173                    })
1174                }
1175                _ => Err(fidl::Error::UnknownOrdinal {
1176                    ordinal: header.ordinal,
1177                    protocol_name: <Ipv4RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1178                }),
1179            }))
1180            },
1181        )
1182    }
1183}
1184
1185/// The IPv4 multicast routing controller.
1186///
1187/// Closing the client-end of the controller will disable multicast routing and
1188/// clear the multicast routing table.
1189#[derive(Debug)]
1190pub enum Ipv4RoutingTableControllerRequest {
1191    /// Adds a route such that packets matching the addresses will be forwarded
1192    /// accordingly.
1193    ///
1194    /// The provided addresses act as the key for the route; any existing route
1195    /// with the same addresses will be overwritten when this route is
1196    /// installed.
1197    ///
1198    /// If a packet arrives at an interface different from the expected input
1199    /// interface set in the route, the packet will not be forwarded and a
1200    /// [`RoutingEvent.wrong_input_interface`] event will be sent to the client.
1201    /// See [`WatchRoutingEvents`] for more details.
1202    ///
1203    /// + request `addresses` the addresses used to identify a route.
1204    /// + request `route` the multicast route.
1205    AddRoute {
1206        addresses: Ipv4UnicastSourceAndMulticastDestination,
1207        route: Route,
1208        responder: Ipv4RoutingTableControllerAddRouteResponder,
1209    },
1210    /// Delete a route.
1211    ///
1212    /// + request `addresses` the addresses used to identify a route.
1213    DelRoute {
1214        addresses: Ipv4UnicastSourceAndMulticastDestination,
1215        responder: Ipv4RoutingTableControllerDelRouteResponder,
1216    },
1217    /// Get a snapshot of statistics about a specific route.
1218    ///
1219    /// + request `addresses` the addresses used to identify a route.
1220    GetRouteStats {
1221        addresses: Ipv4UnicastSourceAndMulticastDestination,
1222        responder: Ipv4RoutingTableControllerGetRouteStatsResponder,
1223    },
1224    /// Watch for events triggered by multicast packets.
1225    ///
1226    /// The server will queue events to return when this method is called. If no
1227    /// events are ready, the call will block until an event is ready. The
1228    /// server will drop new events if the client is not consuming them fast
1229    /// enough and return the number of events dropped in-between events.
1230    ///
1231    /// It is invalid to call this method while a previous call is pending.
1232    /// Doing so will cause the server end of the protocol to be closed.
1233    ///
1234    /// - response `dropped_events` the number of events that were dropped
1235    ///   _immediately before_ the returned event was queued.
1236    ///   returned event.
1237    /// - response `addresses` the addresses in the multicast packet triggering
1238    ///   the event.
1239    /// - response `input_interface` the interface the multicast packet
1240    ///   triggering the event arrived at.
1241    /// - response `event` the event.
1242    WatchRoutingEvents { responder: Ipv4RoutingTableControllerWatchRoutingEventsResponder },
1243}
1244
1245impl Ipv4RoutingTableControllerRequest {
1246    #[allow(irrefutable_let_patterns)]
1247    pub fn into_add_route(
1248        self,
1249    ) -> Option<(
1250        Ipv4UnicastSourceAndMulticastDestination,
1251        Route,
1252        Ipv4RoutingTableControllerAddRouteResponder,
1253    )> {
1254        if let Ipv4RoutingTableControllerRequest::AddRoute { addresses, route, responder } = self {
1255            Some((addresses, route, responder))
1256        } else {
1257            None
1258        }
1259    }
1260
1261    #[allow(irrefutable_let_patterns)]
1262    pub fn into_del_route(
1263        self,
1264    ) -> Option<(
1265        Ipv4UnicastSourceAndMulticastDestination,
1266        Ipv4RoutingTableControllerDelRouteResponder,
1267    )> {
1268        if let Ipv4RoutingTableControllerRequest::DelRoute { addresses, responder } = self {
1269            Some((addresses, responder))
1270        } else {
1271            None
1272        }
1273    }
1274
1275    #[allow(irrefutable_let_patterns)]
1276    pub fn into_get_route_stats(
1277        self,
1278    ) -> Option<(
1279        Ipv4UnicastSourceAndMulticastDestination,
1280        Ipv4RoutingTableControllerGetRouteStatsResponder,
1281    )> {
1282        if let Ipv4RoutingTableControllerRequest::GetRouteStats { addresses, responder } = self {
1283            Some((addresses, responder))
1284        } else {
1285            None
1286        }
1287    }
1288
1289    #[allow(irrefutable_let_patterns)]
1290    pub fn into_watch_routing_events(
1291        self,
1292    ) -> Option<(Ipv4RoutingTableControllerWatchRoutingEventsResponder)> {
1293        if let Ipv4RoutingTableControllerRequest::WatchRoutingEvents { responder } = self {
1294            Some((responder))
1295        } else {
1296            None
1297        }
1298    }
1299
1300    /// Name of the method defined in FIDL
1301    pub fn method_name(&self) -> &'static str {
1302        match *self {
1303            Ipv4RoutingTableControllerRequest::AddRoute { .. } => "add_route",
1304            Ipv4RoutingTableControllerRequest::DelRoute { .. } => "del_route",
1305            Ipv4RoutingTableControllerRequest::GetRouteStats { .. } => "get_route_stats",
1306            Ipv4RoutingTableControllerRequest::WatchRoutingEvents { .. } => "watch_routing_events",
1307        }
1308    }
1309}
1310
1311#[derive(Debug, Clone)]
1312pub struct Ipv4RoutingTableControllerControlHandle {
1313    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1314}
1315
1316impl fidl::endpoints::ControlHandle for Ipv4RoutingTableControllerControlHandle {
1317    fn shutdown(&self) {
1318        self.inner.shutdown()
1319    }
1320    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1321        self.inner.shutdown_with_epitaph(status)
1322    }
1323
1324    fn is_closed(&self) -> bool {
1325        self.inner.channel().is_closed()
1326    }
1327    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1328        self.inner.channel().on_closed()
1329    }
1330
1331    #[cfg(target_os = "fuchsia")]
1332    fn signal_peer(
1333        &self,
1334        clear_mask: zx::Signals,
1335        set_mask: zx::Signals,
1336    ) -> Result<(), zx_status::Status> {
1337        use fidl::Peered;
1338        self.inner.channel().signal_peer(clear_mask, set_mask)
1339    }
1340}
1341
1342impl Ipv4RoutingTableControllerControlHandle {
1343    pub fn send_on_close(&self, mut error: TableControllerCloseReason) -> Result<(), fidl::Error> {
1344        self.inner.send::<Ipv4RoutingTableControllerOnCloseRequest>(
1345            (error,),
1346            0,
1347            0x3dec49c6c2070f14,
1348            fidl::encoding::DynamicFlags::empty(),
1349        )
1350    }
1351}
1352
1353#[must_use = "FIDL methods require a response to be sent"]
1354#[derive(Debug)]
1355pub struct Ipv4RoutingTableControllerAddRouteResponder {
1356    control_handle: std::mem::ManuallyDrop<Ipv4RoutingTableControllerControlHandle>,
1357    tx_id: u32,
1358}
1359
1360/// Set the the channel to be shutdown (see [`Ipv4RoutingTableControllerControlHandle::shutdown`])
1361/// if the responder is dropped without sending a response, so that the client
1362/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1363impl std::ops::Drop for Ipv4RoutingTableControllerAddRouteResponder {
1364    fn drop(&mut self) {
1365        self.control_handle.shutdown();
1366        // Safety: drops once, never accessed again
1367        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1368    }
1369}
1370
1371impl fidl::endpoints::Responder for Ipv4RoutingTableControllerAddRouteResponder {
1372    type ControlHandle = Ipv4RoutingTableControllerControlHandle;
1373
1374    fn control_handle(&self) -> &Ipv4RoutingTableControllerControlHandle {
1375        &self.control_handle
1376    }
1377
1378    fn drop_without_shutdown(mut self) {
1379        // Safety: drops once, never accessed again due to mem::forget
1380        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1381        // Prevent Drop from running (which would shut down the channel)
1382        std::mem::forget(self);
1383    }
1384}
1385
1386impl Ipv4RoutingTableControllerAddRouteResponder {
1387    /// Sends a response to the FIDL transaction.
1388    ///
1389    /// Sets the channel to shutdown if an error occurs.
1390    pub fn send(
1391        self,
1392        mut result: Result<(), Ipv4RoutingTableControllerAddRouteError>,
1393    ) -> Result<(), fidl::Error> {
1394        let _result = self.send_raw(result);
1395        if _result.is_err() {
1396            self.control_handle.shutdown();
1397        }
1398        self.drop_without_shutdown();
1399        _result
1400    }
1401
1402    /// Similar to "send" but does not shutdown the channel if an error occurs.
1403    pub fn send_no_shutdown_on_err(
1404        self,
1405        mut result: Result<(), Ipv4RoutingTableControllerAddRouteError>,
1406    ) -> Result<(), fidl::Error> {
1407        let _result = self.send_raw(result);
1408        self.drop_without_shutdown();
1409        _result
1410    }
1411
1412    fn send_raw(
1413        &self,
1414        mut result: Result<(), Ipv4RoutingTableControllerAddRouteError>,
1415    ) -> Result<(), fidl::Error> {
1416        self.control_handle.inner.send::<fidl::encoding::ResultType<
1417            fidl::encoding::EmptyStruct,
1418            Ipv4RoutingTableControllerAddRouteError,
1419        >>(
1420            result,
1421            self.tx_id,
1422            0x6098a90553ef1aed,
1423            fidl::encoding::DynamicFlags::empty(),
1424        )
1425    }
1426}
1427
1428#[must_use = "FIDL methods require a response to be sent"]
1429#[derive(Debug)]
1430pub struct Ipv4RoutingTableControllerDelRouteResponder {
1431    control_handle: std::mem::ManuallyDrop<Ipv4RoutingTableControllerControlHandle>,
1432    tx_id: u32,
1433}
1434
1435/// Set the the channel to be shutdown (see [`Ipv4RoutingTableControllerControlHandle::shutdown`])
1436/// if the responder is dropped without sending a response, so that the client
1437/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1438impl std::ops::Drop for Ipv4RoutingTableControllerDelRouteResponder {
1439    fn drop(&mut self) {
1440        self.control_handle.shutdown();
1441        // Safety: drops once, never accessed again
1442        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1443    }
1444}
1445
1446impl fidl::endpoints::Responder for Ipv4RoutingTableControllerDelRouteResponder {
1447    type ControlHandle = Ipv4RoutingTableControllerControlHandle;
1448
1449    fn control_handle(&self) -> &Ipv4RoutingTableControllerControlHandle {
1450        &self.control_handle
1451    }
1452
1453    fn drop_without_shutdown(mut self) {
1454        // Safety: drops once, never accessed again due to mem::forget
1455        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1456        // Prevent Drop from running (which would shut down the channel)
1457        std::mem::forget(self);
1458    }
1459}
1460
1461impl Ipv4RoutingTableControllerDelRouteResponder {
1462    /// Sends a response to the FIDL transaction.
1463    ///
1464    /// Sets the channel to shutdown if an error occurs.
1465    pub fn send(
1466        self,
1467        mut result: Result<(), Ipv4RoutingTableControllerDelRouteError>,
1468    ) -> Result<(), fidl::Error> {
1469        let _result = self.send_raw(result);
1470        if _result.is_err() {
1471            self.control_handle.shutdown();
1472        }
1473        self.drop_without_shutdown();
1474        _result
1475    }
1476
1477    /// Similar to "send" but does not shutdown the channel if an error occurs.
1478    pub fn send_no_shutdown_on_err(
1479        self,
1480        mut result: Result<(), Ipv4RoutingTableControllerDelRouteError>,
1481    ) -> Result<(), fidl::Error> {
1482        let _result = self.send_raw(result);
1483        self.drop_without_shutdown();
1484        _result
1485    }
1486
1487    fn send_raw(
1488        &self,
1489        mut result: Result<(), Ipv4RoutingTableControllerDelRouteError>,
1490    ) -> Result<(), fidl::Error> {
1491        self.control_handle.inner.send::<fidl::encoding::ResultType<
1492            fidl::encoding::EmptyStruct,
1493            Ipv4RoutingTableControllerDelRouteError,
1494        >>(
1495            result,
1496            self.tx_id,
1497            0x14a0727b797aff74,
1498            fidl::encoding::DynamicFlags::empty(),
1499        )
1500    }
1501}
1502
1503#[must_use = "FIDL methods require a response to be sent"]
1504#[derive(Debug)]
1505pub struct Ipv4RoutingTableControllerGetRouteStatsResponder {
1506    control_handle: std::mem::ManuallyDrop<Ipv4RoutingTableControllerControlHandle>,
1507    tx_id: u32,
1508}
1509
1510/// Set the the channel to be shutdown (see [`Ipv4RoutingTableControllerControlHandle::shutdown`])
1511/// if the responder is dropped without sending a response, so that the client
1512/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1513impl std::ops::Drop for Ipv4RoutingTableControllerGetRouteStatsResponder {
1514    fn drop(&mut self) {
1515        self.control_handle.shutdown();
1516        // Safety: drops once, never accessed again
1517        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1518    }
1519}
1520
1521impl fidl::endpoints::Responder for Ipv4RoutingTableControllerGetRouteStatsResponder {
1522    type ControlHandle = Ipv4RoutingTableControllerControlHandle;
1523
1524    fn control_handle(&self) -> &Ipv4RoutingTableControllerControlHandle {
1525        &self.control_handle
1526    }
1527
1528    fn drop_without_shutdown(mut self) {
1529        // Safety: drops once, never accessed again due to mem::forget
1530        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1531        // Prevent Drop from running (which would shut down the channel)
1532        std::mem::forget(self);
1533    }
1534}
1535
1536impl Ipv4RoutingTableControllerGetRouteStatsResponder {
1537    /// Sends a response to the FIDL transaction.
1538    ///
1539    /// Sets the channel to shutdown if an error occurs.
1540    pub fn send(
1541        self,
1542        mut result: Result<&RouteStats, Ipv4RoutingTableControllerGetRouteStatsError>,
1543    ) -> Result<(), fidl::Error> {
1544        let _result = self.send_raw(result);
1545        if _result.is_err() {
1546            self.control_handle.shutdown();
1547        }
1548        self.drop_without_shutdown();
1549        _result
1550    }
1551
1552    /// Similar to "send" but does not shutdown the channel if an error occurs.
1553    pub fn send_no_shutdown_on_err(
1554        self,
1555        mut result: Result<&RouteStats, Ipv4RoutingTableControllerGetRouteStatsError>,
1556    ) -> Result<(), fidl::Error> {
1557        let _result = self.send_raw(result);
1558        self.drop_without_shutdown();
1559        _result
1560    }
1561
1562    fn send_raw(
1563        &self,
1564        mut result: Result<&RouteStats, Ipv4RoutingTableControllerGetRouteStatsError>,
1565    ) -> Result<(), fidl::Error> {
1566        self.control_handle.inner.send::<fidl::encoding::ResultType<
1567            Ipv4RoutingTableControllerGetRouteStatsResponse,
1568            Ipv4RoutingTableControllerGetRouteStatsError,
1569        >>(
1570            result.map(|stats| (stats,)),
1571            self.tx_id,
1572            0x176ad8488370c1e9,
1573            fidl::encoding::DynamicFlags::empty(),
1574        )
1575    }
1576}
1577
1578#[must_use = "FIDL methods require a response to be sent"]
1579#[derive(Debug)]
1580pub struct Ipv4RoutingTableControllerWatchRoutingEventsResponder {
1581    control_handle: std::mem::ManuallyDrop<Ipv4RoutingTableControllerControlHandle>,
1582    tx_id: u32,
1583}
1584
1585/// Set the the channel to be shutdown (see [`Ipv4RoutingTableControllerControlHandle::shutdown`])
1586/// if the responder is dropped without sending a response, so that the client
1587/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1588impl std::ops::Drop for Ipv4RoutingTableControllerWatchRoutingEventsResponder {
1589    fn drop(&mut self) {
1590        self.control_handle.shutdown();
1591        // Safety: drops once, never accessed again
1592        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1593    }
1594}
1595
1596impl fidl::endpoints::Responder for Ipv4RoutingTableControllerWatchRoutingEventsResponder {
1597    type ControlHandle = Ipv4RoutingTableControllerControlHandle;
1598
1599    fn control_handle(&self) -> &Ipv4RoutingTableControllerControlHandle {
1600        &self.control_handle
1601    }
1602
1603    fn drop_without_shutdown(mut self) {
1604        // Safety: drops once, never accessed again due to mem::forget
1605        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1606        // Prevent Drop from running (which would shut down the channel)
1607        std::mem::forget(self);
1608    }
1609}
1610
1611impl Ipv4RoutingTableControllerWatchRoutingEventsResponder {
1612    /// Sends a response to the FIDL transaction.
1613    ///
1614    /// Sets the channel to shutdown if an error occurs.
1615    pub fn send(
1616        self,
1617        mut dropped_events: u64,
1618        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
1619        mut input_interface: u64,
1620        mut event: &RoutingEvent,
1621    ) -> Result<(), fidl::Error> {
1622        let _result = self.send_raw(dropped_events, addresses, input_interface, event);
1623        if _result.is_err() {
1624            self.control_handle.shutdown();
1625        }
1626        self.drop_without_shutdown();
1627        _result
1628    }
1629
1630    /// Similar to "send" but does not shutdown the channel if an error occurs.
1631    pub fn send_no_shutdown_on_err(
1632        self,
1633        mut dropped_events: u64,
1634        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
1635        mut input_interface: u64,
1636        mut event: &RoutingEvent,
1637    ) -> Result<(), fidl::Error> {
1638        let _result = self.send_raw(dropped_events, addresses, input_interface, event);
1639        self.drop_without_shutdown();
1640        _result
1641    }
1642
1643    fn send_raw(
1644        &self,
1645        mut dropped_events: u64,
1646        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
1647        mut input_interface: u64,
1648        mut event: &RoutingEvent,
1649    ) -> Result<(), fidl::Error> {
1650        self.control_handle.inner.send::<Ipv4RoutingTableControllerWatchRoutingEventsResponse>(
1651            (dropped_events, addresses, input_interface, event),
1652            self.tx_id,
1653            0x3e4336c50718d7f9,
1654            fidl::encoding::DynamicFlags::empty(),
1655        )
1656    }
1657}
1658
1659#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1660pub struct Ipv6RoutingTableControllerMarker;
1661
1662impl fidl::endpoints::ProtocolMarker for Ipv6RoutingTableControllerMarker {
1663    type Proxy = Ipv6RoutingTableControllerProxy;
1664    type RequestStream = Ipv6RoutingTableControllerRequestStream;
1665    #[cfg(target_os = "fuchsia")]
1666    type SynchronousProxy = Ipv6RoutingTableControllerSynchronousProxy;
1667
1668    const DEBUG_NAME: &'static str = "fuchsia.net.multicast.admin.Ipv6RoutingTableController";
1669}
1670impl fidl::endpoints::DiscoverableProtocolMarker for Ipv6RoutingTableControllerMarker {}
1671pub type Ipv6RoutingTableControllerAddRouteResult =
1672    Result<(), Ipv6RoutingTableControllerAddRouteError>;
1673pub type Ipv6RoutingTableControllerDelRouteResult =
1674    Result<(), Ipv6RoutingTableControllerDelRouteError>;
1675pub type Ipv6RoutingTableControllerGetRouteStatsResult =
1676    Result<RouteStats, Ipv6RoutingTableControllerGetRouteStatsError>;
1677
1678pub trait Ipv6RoutingTableControllerProxyInterface: Send + Sync {
1679    type AddRouteResponseFut: std::future::Future<Output = Result<Ipv6RoutingTableControllerAddRouteResult, fidl::Error>>
1680        + Send;
1681    fn r#add_route(
1682        &self,
1683        addresses: &Ipv6UnicastSourceAndMulticastDestination,
1684        route: &Route,
1685    ) -> Self::AddRouteResponseFut;
1686    type DelRouteResponseFut: std::future::Future<Output = Result<Ipv6RoutingTableControllerDelRouteResult, fidl::Error>>
1687        + Send;
1688    fn r#del_route(
1689        &self,
1690        addresses: &Ipv6UnicastSourceAndMulticastDestination,
1691    ) -> Self::DelRouteResponseFut;
1692    type GetRouteStatsResponseFut: std::future::Future<
1693            Output = Result<Ipv6RoutingTableControllerGetRouteStatsResult, fidl::Error>,
1694        > + Send;
1695    fn r#get_route_stats(
1696        &self,
1697        addresses: &Ipv6UnicastSourceAndMulticastDestination,
1698    ) -> Self::GetRouteStatsResponseFut;
1699    type WatchRoutingEventsResponseFut: std::future::Future<
1700            Output = Result<
1701                (u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent),
1702                fidl::Error,
1703            >,
1704        > + Send;
1705    fn r#watch_routing_events(&self) -> Self::WatchRoutingEventsResponseFut;
1706}
1707#[derive(Debug)]
1708#[cfg(target_os = "fuchsia")]
1709pub struct Ipv6RoutingTableControllerSynchronousProxy {
1710    client: fidl::client::sync::Client,
1711}
1712
1713#[cfg(target_os = "fuchsia")]
1714impl fidl::endpoints::SynchronousProxy for Ipv6RoutingTableControllerSynchronousProxy {
1715    type Proxy = Ipv6RoutingTableControllerProxy;
1716    type Protocol = Ipv6RoutingTableControllerMarker;
1717
1718    fn from_channel(inner: fidl::Channel) -> Self {
1719        Self::new(inner)
1720    }
1721
1722    fn into_channel(self) -> fidl::Channel {
1723        self.client.into_channel()
1724    }
1725
1726    fn as_channel(&self) -> &fidl::Channel {
1727        self.client.as_channel()
1728    }
1729}
1730
1731#[cfg(target_os = "fuchsia")]
1732impl Ipv6RoutingTableControllerSynchronousProxy {
1733    pub fn new(channel: fidl::Channel) -> Self {
1734        let protocol_name =
1735            <Ipv6RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1736        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1737    }
1738
1739    pub fn into_channel(self) -> fidl::Channel {
1740        self.client.into_channel()
1741    }
1742
1743    /// Waits until an event arrives and returns it. It is safe for other
1744    /// threads to make concurrent requests while waiting for an event.
1745    pub fn wait_for_event(
1746        &self,
1747        deadline: zx::MonotonicInstant,
1748    ) -> Result<Ipv6RoutingTableControllerEvent, fidl::Error> {
1749        Ipv6RoutingTableControllerEvent::decode(self.client.wait_for_event(deadline)?)
1750    }
1751
1752    /// Adds a route such that packets matching the addresses will be forwarded
1753    /// accordingly.
1754    ///
1755    /// The provided addresses act as the key for the route; any existing route
1756    /// with the same addresses will be overwritten when this route is
1757    /// installed.
1758    ///
1759    /// If a packet arrives at an interface different from the expected input
1760    /// interface set in the route, the packet will not be forwarded and a
1761    /// [`RoutingEvent.wrong_input_interface`] event will be sent to the client.
1762    /// See [`WatchRoutingEvents`] for more details.
1763    ///
1764    /// + request `addresses` the addresses used to identify a route.
1765    /// + request `route` the multicast route.
1766    pub fn r#add_route(
1767        &self,
1768        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1769        mut route: &Route,
1770        ___deadline: zx::MonotonicInstant,
1771    ) -> Result<Ipv6RoutingTableControllerAddRouteResult, fidl::Error> {
1772        let _response = self
1773            .client
1774            .send_query::<Ipv6RoutingTableControllerAddRouteRequest, fidl::encoding::ResultType<
1775                fidl::encoding::EmptyStruct,
1776                Ipv6RoutingTableControllerAddRouteError,
1777            >>(
1778                (addresses, route),
1779                0x71ca1f54a716de90,
1780                fidl::encoding::DynamicFlags::empty(),
1781                ___deadline,
1782            )?;
1783        Ok(_response.map(|x| x))
1784    }
1785
1786    /// Delete a route.
1787    ///
1788    /// + request `addresses` the addresses used to identify a route.
1789    pub fn r#del_route(
1790        &self,
1791        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1792        ___deadline: zx::MonotonicInstant,
1793    ) -> Result<Ipv6RoutingTableControllerDelRouteResult, fidl::Error> {
1794        let _response = self
1795            .client
1796            .send_query::<Ipv6RoutingTableControllerDelRouteRequest, fidl::encoding::ResultType<
1797                fidl::encoding::EmptyStruct,
1798                Ipv6RoutingTableControllerDelRouteError,
1799            >>(
1800                (addresses,),
1801                0x35b6c2ce4a7b3f13,
1802                fidl::encoding::DynamicFlags::empty(),
1803                ___deadline,
1804            )?;
1805        Ok(_response.map(|x| x))
1806    }
1807
1808    /// Get a snapshot of statistics about a specific route.
1809    ///
1810    /// + request `addresses` the addresses used to identify a route.
1811    pub fn r#get_route_stats(
1812        &self,
1813        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1814        ___deadline: zx::MonotonicInstant,
1815    ) -> Result<Ipv6RoutingTableControllerGetRouteStatsResult, fidl::Error> {
1816        let _response = self.client.send_query::<
1817            Ipv6RoutingTableControllerGetRouteStatsRequest,
1818            fidl::encoding::ResultType<Ipv6RoutingTableControllerGetRouteStatsResponse, Ipv6RoutingTableControllerGetRouteStatsError>,
1819        >(
1820            (addresses,),
1821            0x6d7fa5e9f18ef79f,
1822            fidl::encoding::DynamicFlags::empty(),
1823            ___deadline,
1824        )?;
1825        Ok(_response.map(|x| x.stats))
1826    }
1827
1828    /// Watch for events triggered by multicast packets.
1829    ///
1830    /// The server will queue events to return when this method is called. If no
1831    /// events are ready, the call will block until an event is ready. The
1832    /// server will drop new events if the client is not consuming them fast
1833    /// enough and return the number of events dropped in-between events.
1834    ///
1835    /// It is invalid to call this method while a previous call is pending.
1836    /// Doing so will cause the server end of the protocol to be closed.
1837    ///
1838    /// - response `dropped_events` the number of events that were dropped
1839    ///   _immediately before_ the returned event was queued.
1840    ///   returned event.
1841    /// - response `addresses` the addresses in the multicast packet triggering
1842    ///   the event.
1843    /// - response `input_interface` the interface the multicast packet
1844    ///   triggering the event arrived at.
1845    /// - response `event` the event.
1846    pub fn r#watch_routing_events(
1847        &self,
1848        ___deadline: zx::MonotonicInstant,
1849    ) -> Result<(u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent), fidl::Error>
1850    {
1851        let _response = self.client.send_query::<
1852            fidl::encoding::EmptyPayload,
1853            Ipv6RoutingTableControllerWatchRoutingEventsResponse,
1854        >(
1855            (),
1856            0x22a94526a0ea1078,
1857            fidl::encoding::DynamicFlags::empty(),
1858            ___deadline,
1859        )?;
1860        Ok((
1861            _response.dropped_events,
1862            _response.addresses,
1863            _response.input_interface,
1864            _response.event,
1865        ))
1866    }
1867}
1868
1869#[derive(Debug, Clone)]
1870pub struct Ipv6RoutingTableControllerProxy {
1871    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1872}
1873
1874impl fidl::endpoints::Proxy for Ipv6RoutingTableControllerProxy {
1875    type Protocol = Ipv6RoutingTableControllerMarker;
1876
1877    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1878        Self::new(inner)
1879    }
1880
1881    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1882        self.client.into_channel().map_err(|client| Self { client })
1883    }
1884
1885    fn as_channel(&self) -> &::fidl::AsyncChannel {
1886        self.client.as_channel()
1887    }
1888}
1889
1890impl Ipv6RoutingTableControllerProxy {
1891    /// Create a new Proxy for fuchsia.net.multicast.admin/Ipv6RoutingTableController.
1892    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1893        let protocol_name =
1894            <Ipv6RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1895        Self { client: fidl::client::Client::new(channel, protocol_name) }
1896    }
1897
1898    /// Get a Stream of events from the remote end of the protocol.
1899    ///
1900    /// # Panics
1901    ///
1902    /// Panics if the event stream was already taken.
1903    pub fn take_event_stream(&self) -> Ipv6RoutingTableControllerEventStream {
1904        Ipv6RoutingTableControllerEventStream { event_receiver: self.client.take_event_receiver() }
1905    }
1906
1907    /// Adds a route such that packets matching the addresses will be forwarded
1908    /// accordingly.
1909    ///
1910    /// The provided addresses act as the key for the route; any existing route
1911    /// with the same addresses will be overwritten when this route is
1912    /// installed.
1913    ///
1914    /// If a packet arrives at an interface different from the expected input
1915    /// interface set in the route, the packet will not be forwarded and a
1916    /// [`RoutingEvent.wrong_input_interface`] event will be sent to the client.
1917    /// See [`WatchRoutingEvents`] for more details.
1918    ///
1919    /// + request `addresses` the addresses used to identify a route.
1920    /// + request `route` the multicast route.
1921    pub fn r#add_route(
1922        &self,
1923        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1924        mut route: &Route,
1925    ) -> fidl::client::QueryResponseFut<
1926        Ipv6RoutingTableControllerAddRouteResult,
1927        fidl::encoding::DefaultFuchsiaResourceDialect,
1928    > {
1929        Ipv6RoutingTableControllerProxyInterface::r#add_route(self, addresses, route)
1930    }
1931
1932    /// Delete a route.
1933    ///
1934    /// + request `addresses` the addresses used to identify a route.
1935    pub fn r#del_route(
1936        &self,
1937        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1938    ) -> fidl::client::QueryResponseFut<
1939        Ipv6RoutingTableControllerDelRouteResult,
1940        fidl::encoding::DefaultFuchsiaResourceDialect,
1941    > {
1942        Ipv6RoutingTableControllerProxyInterface::r#del_route(self, addresses)
1943    }
1944
1945    /// Get a snapshot of statistics about a specific route.
1946    ///
1947    /// + request `addresses` the addresses used to identify a route.
1948    pub fn r#get_route_stats(
1949        &self,
1950        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1951    ) -> fidl::client::QueryResponseFut<
1952        Ipv6RoutingTableControllerGetRouteStatsResult,
1953        fidl::encoding::DefaultFuchsiaResourceDialect,
1954    > {
1955        Ipv6RoutingTableControllerProxyInterface::r#get_route_stats(self, addresses)
1956    }
1957
1958    /// Watch for events triggered by multicast packets.
1959    ///
1960    /// The server will queue events to return when this method is called. If no
1961    /// events are ready, the call will block until an event is ready. The
1962    /// server will drop new events if the client is not consuming them fast
1963    /// enough and return the number of events dropped in-between events.
1964    ///
1965    /// It is invalid to call this method while a previous call is pending.
1966    /// Doing so will cause the server end of the protocol to be closed.
1967    ///
1968    /// - response `dropped_events` the number of events that were dropped
1969    ///   _immediately before_ the returned event was queued.
1970    ///   returned event.
1971    /// - response `addresses` the addresses in the multicast packet triggering
1972    ///   the event.
1973    /// - response `input_interface` the interface the multicast packet
1974    ///   triggering the event arrived at.
1975    /// - response `event` the event.
1976    pub fn r#watch_routing_events(
1977        &self,
1978    ) -> fidl::client::QueryResponseFut<
1979        (u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent),
1980        fidl::encoding::DefaultFuchsiaResourceDialect,
1981    > {
1982        Ipv6RoutingTableControllerProxyInterface::r#watch_routing_events(self)
1983    }
1984}
1985
1986impl Ipv6RoutingTableControllerProxyInterface for Ipv6RoutingTableControllerProxy {
1987    type AddRouteResponseFut = fidl::client::QueryResponseFut<
1988        Ipv6RoutingTableControllerAddRouteResult,
1989        fidl::encoding::DefaultFuchsiaResourceDialect,
1990    >;
1991    fn r#add_route(
1992        &self,
1993        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1994        mut route: &Route,
1995    ) -> Self::AddRouteResponseFut {
1996        fn _decode(
1997            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1998        ) -> Result<Ipv6RoutingTableControllerAddRouteResult, fidl::Error> {
1999            let _response = fidl::client::decode_transaction_body::<
2000                fidl::encoding::ResultType<
2001                    fidl::encoding::EmptyStruct,
2002                    Ipv6RoutingTableControllerAddRouteError,
2003                >,
2004                fidl::encoding::DefaultFuchsiaResourceDialect,
2005                0x71ca1f54a716de90,
2006            >(_buf?)?;
2007            Ok(_response.map(|x| x))
2008        }
2009        self.client.send_query_and_decode::<
2010            Ipv6RoutingTableControllerAddRouteRequest,
2011            Ipv6RoutingTableControllerAddRouteResult,
2012        >(
2013            (addresses, route,),
2014            0x71ca1f54a716de90,
2015            fidl::encoding::DynamicFlags::empty(),
2016            _decode,
2017        )
2018    }
2019
2020    type DelRouteResponseFut = fidl::client::QueryResponseFut<
2021        Ipv6RoutingTableControllerDelRouteResult,
2022        fidl::encoding::DefaultFuchsiaResourceDialect,
2023    >;
2024    fn r#del_route(
2025        &self,
2026        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
2027    ) -> Self::DelRouteResponseFut {
2028        fn _decode(
2029            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2030        ) -> Result<Ipv6RoutingTableControllerDelRouteResult, fidl::Error> {
2031            let _response = fidl::client::decode_transaction_body::<
2032                fidl::encoding::ResultType<
2033                    fidl::encoding::EmptyStruct,
2034                    Ipv6RoutingTableControllerDelRouteError,
2035                >,
2036                fidl::encoding::DefaultFuchsiaResourceDialect,
2037                0x35b6c2ce4a7b3f13,
2038            >(_buf?)?;
2039            Ok(_response.map(|x| x))
2040        }
2041        self.client.send_query_and_decode::<
2042            Ipv6RoutingTableControllerDelRouteRequest,
2043            Ipv6RoutingTableControllerDelRouteResult,
2044        >(
2045            (addresses,),
2046            0x35b6c2ce4a7b3f13,
2047            fidl::encoding::DynamicFlags::empty(),
2048            _decode,
2049        )
2050    }
2051
2052    type GetRouteStatsResponseFut = fidl::client::QueryResponseFut<
2053        Ipv6RoutingTableControllerGetRouteStatsResult,
2054        fidl::encoding::DefaultFuchsiaResourceDialect,
2055    >;
2056    fn r#get_route_stats(
2057        &self,
2058        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
2059    ) -> Self::GetRouteStatsResponseFut {
2060        fn _decode(
2061            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2062        ) -> Result<Ipv6RoutingTableControllerGetRouteStatsResult, fidl::Error> {
2063            let _response = fidl::client::decode_transaction_body::<
2064                fidl::encoding::ResultType<
2065                    Ipv6RoutingTableControllerGetRouteStatsResponse,
2066                    Ipv6RoutingTableControllerGetRouteStatsError,
2067                >,
2068                fidl::encoding::DefaultFuchsiaResourceDialect,
2069                0x6d7fa5e9f18ef79f,
2070            >(_buf?)?;
2071            Ok(_response.map(|x| x.stats))
2072        }
2073        self.client.send_query_and_decode::<
2074            Ipv6RoutingTableControllerGetRouteStatsRequest,
2075            Ipv6RoutingTableControllerGetRouteStatsResult,
2076        >(
2077            (addresses,),
2078            0x6d7fa5e9f18ef79f,
2079            fidl::encoding::DynamicFlags::empty(),
2080            _decode,
2081        )
2082    }
2083
2084    type WatchRoutingEventsResponseFut = fidl::client::QueryResponseFut<
2085        (u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent),
2086        fidl::encoding::DefaultFuchsiaResourceDialect,
2087    >;
2088    fn r#watch_routing_events(&self) -> Self::WatchRoutingEventsResponseFut {
2089        fn _decode(
2090            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2091        ) -> Result<(u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent), fidl::Error>
2092        {
2093            let _response = fidl::client::decode_transaction_body::<
2094                Ipv6RoutingTableControllerWatchRoutingEventsResponse,
2095                fidl::encoding::DefaultFuchsiaResourceDialect,
2096                0x22a94526a0ea1078,
2097            >(_buf?)?;
2098            Ok((
2099                _response.dropped_events,
2100                _response.addresses,
2101                _response.input_interface,
2102                _response.event,
2103            ))
2104        }
2105        self.client.send_query_and_decode::<
2106            fidl::encoding::EmptyPayload,
2107            (u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent),
2108        >(
2109            (),
2110            0x22a94526a0ea1078,
2111            fidl::encoding::DynamicFlags::empty(),
2112            _decode,
2113        )
2114    }
2115}
2116
2117pub struct Ipv6RoutingTableControllerEventStream {
2118    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2119}
2120
2121impl std::marker::Unpin for Ipv6RoutingTableControllerEventStream {}
2122
2123impl futures::stream::FusedStream for Ipv6RoutingTableControllerEventStream {
2124    fn is_terminated(&self) -> bool {
2125        self.event_receiver.is_terminated()
2126    }
2127}
2128
2129impl futures::Stream for Ipv6RoutingTableControllerEventStream {
2130    type Item = Result<Ipv6RoutingTableControllerEvent, fidl::Error>;
2131
2132    fn poll_next(
2133        mut self: std::pin::Pin<&mut Self>,
2134        cx: &mut std::task::Context<'_>,
2135    ) -> std::task::Poll<Option<Self::Item>> {
2136        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2137            &mut self.event_receiver,
2138            cx
2139        )?) {
2140            Some(buf) => std::task::Poll::Ready(Some(Ipv6RoutingTableControllerEvent::decode(buf))),
2141            None => std::task::Poll::Ready(None),
2142        }
2143    }
2144}
2145
2146#[derive(Debug)]
2147pub enum Ipv6RoutingTableControllerEvent {
2148    OnClose { error: TableControllerCloseReason },
2149}
2150
2151impl Ipv6RoutingTableControllerEvent {
2152    #[allow(irrefutable_let_patterns)]
2153    pub fn into_on_close(self) -> Option<TableControllerCloseReason> {
2154        if let Ipv6RoutingTableControllerEvent::OnClose { error } = self {
2155            Some((error))
2156        } else {
2157            None
2158        }
2159    }
2160
2161    /// Decodes a message buffer as a [`Ipv6RoutingTableControllerEvent`].
2162    fn decode(
2163        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2164    ) -> Result<Ipv6RoutingTableControllerEvent, fidl::Error> {
2165        let (bytes, _handles) = buf.split_mut();
2166        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2167        debug_assert_eq!(tx_header.tx_id, 0);
2168        match tx_header.ordinal {
2169            0x2d3a353489d1e0be => {
2170                let mut out = fidl::new_empty!(Ipv6RoutingTableControllerOnCloseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2171                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv6RoutingTableControllerOnCloseRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
2172                Ok((
2173                    Ipv6RoutingTableControllerEvent::OnClose {error: out.error,
2174
2175                    }
2176                ))
2177            }
2178            _ => Err(fidl::Error::UnknownOrdinal {
2179                ordinal: tx_header.ordinal,
2180                protocol_name: <Ipv6RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2181            })
2182        }
2183    }
2184}
2185
2186/// A Stream of incoming requests for fuchsia.net.multicast.admin/Ipv6RoutingTableController.
2187pub struct Ipv6RoutingTableControllerRequestStream {
2188    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2189    is_terminated: bool,
2190}
2191
2192impl std::marker::Unpin for Ipv6RoutingTableControllerRequestStream {}
2193
2194impl futures::stream::FusedStream for Ipv6RoutingTableControllerRequestStream {
2195    fn is_terminated(&self) -> bool {
2196        self.is_terminated
2197    }
2198}
2199
2200impl fidl::endpoints::RequestStream for Ipv6RoutingTableControllerRequestStream {
2201    type Protocol = Ipv6RoutingTableControllerMarker;
2202    type ControlHandle = Ipv6RoutingTableControllerControlHandle;
2203
2204    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2205        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2206    }
2207
2208    fn control_handle(&self) -> Self::ControlHandle {
2209        Ipv6RoutingTableControllerControlHandle { inner: self.inner.clone() }
2210    }
2211
2212    fn into_inner(
2213        self,
2214    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2215    {
2216        (self.inner, self.is_terminated)
2217    }
2218
2219    fn from_inner(
2220        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2221        is_terminated: bool,
2222    ) -> Self {
2223        Self { inner, is_terminated }
2224    }
2225}
2226
2227impl futures::Stream for Ipv6RoutingTableControllerRequestStream {
2228    type Item = Result<Ipv6RoutingTableControllerRequest, fidl::Error>;
2229
2230    fn poll_next(
2231        mut self: std::pin::Pin<&mut Self>,
2232        cx: &mut std::task::Context<'_>,
2233    ) -> std::task::Poll<Option<Self::Item>> {
2234        let this = &mut *self;
2235        if this.inner.check_shutdown(cx) {
2236            this.is_terminated = true;
2237            return std::task::Poll::Ready(None);
2238        }
2239        if this.is_terminated {
2240            panic!("polled Ipv6RoutingTableControllerRequestStream after completion");
2241        }
2242        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2243            |bytes, handles| {
2244                match this.inner.channel().read_etc(cx, bytes, handles) {
2245                    std::task::Poll::Ready(Ok(())) => {}
2246                    std::task::Poll::Pending => return std::task::Poll::Pending,
2247                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2248                        this.is_terminated = true;
2249                        return std::task::Poll::Ready(None);
2250                    }
2251                    std::task::Poll::Ready(Err(e)) => {
2252                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2253                            e.into(),
2254                        ))))
2255                    }
2256                }
2257
2258                // A message has been received from the channel
2259                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2260
2261                std::task::Poll::Ready(Some(match header.ordinal {
2262                0x71ca1f54a716de90 => {
2263                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2264                    let mut req = fidl::new_empty!(Ipv6RoutingTableControllerAddRouteRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2265                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv6RoutingTableControllerAddRouteRequest>(&header, _body_bytes, handles, &mut req)?;
2266                    let control_handle = Ipv6RoutingTableControllerControlHandle {
2267                        inner: this.inner.clone(),
2268                    };
2269                    Ok(Ipv6RoutingTableControllerRequest::AddRoute {addresses: req.addresses,
2270route: req.route,
2271
2272                        responder: Ipv6RoutingTableControllerAddRouteResponder {
2273                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2274                            tx_id: header.tx_id,
2275                        },
2276                    })
2277                }
2278                0x35b6c2ce4a7b3f13 => {
2279                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2280                    let mut req = fidl::new_empty!(Ipv6RoutingTableControllerDelRouteRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2281                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv6RoutingTableControllerDelRouteRequest>(&header, _body_bytes, handles, &mut req)?;
2282                    let control_handle = Ipv6RoutingTableControllerControlHandle {
2283                        inner: this.inner.clone(),
2284                    };
2285                    Ok(Ipv6RoutingTableControllerRequest::DelRoute {addresses: req.addresses,
2286
2287                        responder: Ipv6RoutingTableControllerDelRouteResponder {
2288                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2289                            tx_id: header.tx_id,
2290                        },
2291                    })
2292                }
2293                0x6d7fa5e9f18ef79f => {
2294                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2295                    let mut req = fidl::new_empty!(Ipv6RoutingTableControllerGetRouteStatsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
2296                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv6RoutingTableControllerGetRouteStatsRequest>(&header, _body_bytes, handles, &mut req)?;
2297                    let control_handle = Ipv6RoutingTableControllerControlHandle {
2298                        inner: this.inner.clone(),
2299                    };
2300                    Ok(Ipv6RoutingTableControllerRequest::GetRouteStats {addresses: req.addresses,
2301
2302                        responder: Ipv6RoutingTableControllerGetRouteStatsResponder {
2303                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2304                            tx_id: header.tx_id,
2305                        },
2306                    })
2307                }
2308                0x22a94526a0ea1078 => {
2309                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2310                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
2311                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2312                    let control_handle = Ipv6RoutingTableControllerControlHandle {
2313                        inner: this.inner.clone(),
2314                    };
2315                    Ok(Ipv6RoutingTableControllerRequest::WatchRoutingEvents {
2316                        responder: Ipv6RoutingTableControllerWatchRoutingEventsResponder {
2317                            control_handle: std::mem::ManuallyDrop::new(control_handle),
2318                            tx_id: header.tx_id,
2319                        },
2320                    })
2321                }
2322                _ => Err(fidl::Error::UnknownOrdinal {
2323                    ordinal: header.ordinal,
2324                    protocol_name: <Ipv6RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2325                }),
2326            }))
2327            },
2328        )
2329    }
2330}
2331
2332/// The IPv6 multicast routing controller.
2333///
2334/// Closing the client-end of the controller will disable multicast routing and
2335/// clear the multicast routing table.
2336#[derive(Debug)]
2337pub enum Ipv6RoutingTableControllerRequest {
2338    /// Adds a route such that packets matching the addresses will be forwarded
2339    /// accordingly.
2340    ///
2341    /// The provided addresses act as the key for the route; any existing route
2342    /// with the same addresses will be overwritten when this route is
2343    /// installed.
2344    ///
2345    /// If a packet arrives at an interface different from the expected input
2346    /// interface set in the route, the packet will not be forwarded and a
2347    /// [`RoutingEvent.wrong_input_interface`] event will be sent to the client.
2348    /// See [`WatchRoutingEvents`] for more details.
2349    ///
2350    /// + request `addresses` the addresses used to identify a route.
2351    /// + request `route` the multicast route.
2352    AddRoute {
2353        addresses: Ipv6UnicastSourceAndMulticastDestination,
2354        route: Route,
2355        responder: Ipv6RoutingTableControllerAddRouteResponder,
2356    },
2357    /// Delete a route.
2358    ///
2359    /// + request `addresses` the addresses used to identify a route.
2360    DelRoute {
2361        addresses: Ipv6UnicastSourceAndMulticastDestination,
2362        responder: Ipv6RoutingTableControllerDelRouteResponder,
2363    },
2364    /// Get a snapshot of statistics about a specific route.
2365    ///
2366    /// + request `addresses` the addresses used to identify a route.
2367    GetRouteStats {
2368        addresses: Ipv6UnicastSourceAndMulticastDestination,
2369        responder: Ipv6RoutingTableControllerGetRouteStatsResponder,
2370    },
2371    /// Watch for events triggered by multicast packets.
2372    ///
2373    /// The server will queue events to return when this method is called. If no
2374    /// events are ready, the call will block until an event is ready. The
2375    /// server will drop new events if the client is not consuming them fast
2376    /// enough and return the number of events dropped in-between events.
2377    ///
2378    /// It is invalid to call this method while a previous call is pending.
2379    /// Doing so will cause the server end of the protocol to be closed.
2380    ///
2381    /// - response `dropped_events` the number of events that were dropped
2382    ///   _immediately before_ the returned event was queued.
2383    ///   returned event.
2384    /// - response `addresses` the addresses in the multicast packet triggering
2385    ///   the event.
2386    /// - response `input_interface` the interface the multicast packet
2387    ///   triggering the event arrived at.
2388    /// - response `event` the event.
2389    WatchRoutingEvents { responder: Ipv6RoutingTableControllerWatchRoutingEventsResponder },
2390}
2391
2392impl Ipv6RoutingTableControllerRequest {
2393    #[allow(irrefutable_let_patterns)]
2394    pub fn into_add_route(
2395        self,
2396    ) -> Option<(
2397        Ipv6UnicastSourceAndMulticastDestination,
2398        Route,
2399        Ipv6RoutingTableControllerAddRouteResponder,
2400    )> {
2401        if let Ipv6RoutingTableControllerRequest::AddRoute { addresses, route, responder } = self {
2402            Some((addresses, route, responder))
2403        } else {
2404            None
2405        }
2406    }
2407
2408    #[allow(irrefutable_let_patterns)]
2409    pub fn into_del_route(
2410        self,
2411    ) -> Option<(
2412        Ipv6UnicastSourceAndMulticastDestination,
2413        Ipv6RoutingTableControllerDelRouteResponder,
2414    )> {
2415        if let Ipv6RoutingTableControllerRequest::DelRoute { addresses, responder } = self {
2416            Some((addresses, responder))
2417        } else {
2418            None
2419        }
2420    }
2421
2422    #[allow(irrefutable_let_patterns)]
2423    pub fn into_get_route_stats(
2424        self,
2425    ) -> Option<(
2426        Ipv6UnicastSourceAndMulticastDestination,
2427        Ipv6RoutingTableControllerGetRouteStatsResponder,
2428    )> {
2429        if let Ipv6RoutingTableControllerRequest::GetRouteStats { addresses, responder } = self {
2430            Some((addresses, responder))
2431        } else {
2432            None
2433        }
2434    }
2435
2436    #[allow(irrefutable_let_patterns)]
2437    pub fn into_watch_routing_events(
2438        self,
2439    ) -> Option<(Ipv6RoutingTableControllerWatchRoutingEventsResponder)> {
2440        if let Ipv6RoutingTableControllerRequest::WatchRoutingEvents { responder } = self {
2441            Some((responder))
2442        } else {
2443            None
2444        }
2445    }
2446
2447    /// Name of the method defined in FIDL
2448    pub fn method_name(&self) -> &'static str {
2449        match *self {
2450            Ipv6RoutingTableControllerRequest::AddRoute { .. } => "add_route",
2451            Ipv6RoutingTableControllerRequest::DelRoute { .. } => "del_route",
2452            Ipv6RoutingTableControllerRequest::GetRouteStats { .. } => "get_route_stats",
2453            Ipv6RoutingTableControllerRequest::WatchRoutingEvents { .. } => "watch_routing_events",
2454        }
2455    }
2456}
2457
2458#[derive(Debug, Clone)]
2459pub struct Ipv6RoutingTableControllerControlHandle {
2460    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2461}
2462
2463impl fidl::endpoints::ControlHandle for Ipv6RoutingTableControllerControlHandle {
2464    fn shutdown(&self) {
2465        self.inner.shutdown()
2466    }
2467    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2468        self.inner.shutdown_with_epitaph(status)
2469    }
2470
2471    fn is_closed(&self) -> bool {
2472        self.inner.channel().is_closed()
2473    }
2474    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2475        self.inner.channel().on_closed()
2476    }
2477
2478    #[cfg(target_os = "fuchsia")]
2479    fn signal_peer(
2480        &self,
2481        clear_mask: zx::Signals,
2482        set_mask: zx::Signals,
2483    ) -> Result<(), zx_status::Status> {
2484        use fidl::Peered;
2485        self.inner.channel().signal_peer(clear_mask, set_mask)
2486    }
2487}
2488
2489impl Ipv6RoutingTableControllerControlHandle {
2490    pub fn send_on_close(&self, mut error: TableControllerCloseReason) -> Result<(), fidl::Error> {
2491        self.inner.send::<Ipv6RoutingTableControllerOnCloseRequest>(
2492            (error,),
2493            0,
2494            0x2d3a353489d1e0be,
2495            fidl::encoding::DynamicFlags::empty(),
2496        )
2497    }
2498}
2499
2500#[must_use = "FIDL methods require a response to be sent"]
2501#[derive(Debug)]
2502pub struct Ipv6RoutingTableControllerAddRouteResponder {
2503    control_handle: std::mem::ManuallyDrop<Ipv6RoutingTableControllerControlHandle>,
2504    tx_id: u32,
2505}
2506
2507/// Set the the channel to be shutdown (see [`Ipv6RoutingTableControllerControlHandle::shutdown`])
2508/// if the responder is dropped without sending a response, so that the client
2509/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2510impl std::ops::Drop for Ipv6RoutingTableControllerAddRouteResponder {
2511    fn drop(&mut self) {
2512        self.control_handle.shutdown();
2513        // Safety: drops once, never accessed again
2514        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2515    }
2516}
2517
2518impl fidl::endpoints::Responder for Ipv6RoutingTableControllerAddRouteResponder {
2519    type ControlHandle = Ipv6RoutingTableControllerControlHandle;
2520
2521    fn control_handle(&self) -> &Ipv6RoutingTableControllerControlHandle {
2522        &self.control_handle
2523    }
2524
2525    fn drop_without_shutdown(mut self) {
2526        // Safety: drops once, never accessed again due to mem::forget
2527        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2528        // Prevent Drop from running (which would shut down the channel)
2529        std::mem::forget(self);
2530    }
2531}
2532
2533impl Ipv6RoutingTableControllerAddRouteResponder {
2534    /// Sends a response to the FIDL transaction.
2535    ///
2536    /// Sets the channel to shutdown if an error occurs.
2537    pub fn send(
2538        self,
2539        mut result: Result<(), Ipv6RoutingTableControllerAddRouteError>,
2540    ) -> Result<(), fidl::Error> {
2541        let _result = self.send_raw(result);
2542        if _result.is_err() {
2543            self.control_handle.shutdown();
2544        }
2545        self.drop_without_shutdown();
2546        _result
2547    }
2548
2549    /// Similar to "send" but does not shutdown the channel if an error occurs.
2550    pub fn send_no_shutdown_on_err(
2551        self,
2552        mut result: Result<(), Ipv6RoutingTableControllerAddRouteError>,
2553    ) -> Result<(), fidl::Error> {
2554        let _result = self.send_raw(result);
2555        self.drop_without_shutdown();
2556        _result
2557    }
2558
2559    fn send_raw(
2560        &self,
2561        mut result: Result<(), Ipv6RoutingTableControllerAddRouteError>,
2562    ) -> Result<(), fidl::Error> {
2563        self.control_handle.inner.send::<fidl::encoding::ResultType<
2564            fidl::encoding::EmptyStruct,
2565            Ipv6RoutingTableControllerAddRouteError,
2566        >>(
2567            result,
2568            self.tx_id,
2569            0x71ca1f54a716de90,
2570            fidl::encoding::DynamicFlags::empty(),
2571        )
2572    }
2573}
2574
2575#[must_use = "FIDL methods require a response to be sent"]
2576#[derive(Debug)]
2577pub struct Ipv6RoutingTableControllerDelRouteResponder {
2578    control_handle: std::mem::ManuallyDrop<Ipv6RoutingTableControllerControlHandle>,
2579    tx_id: u32,
2580}
2581
2582/// Set the the channel to be shutdown (see [`Ipv6RoutingTableControllerControlHandle::shutdown`])
2583/// if the responder is dropped without sending a response, so that the client
2584/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2585impl std::ops::Drop for Ipv6RoutingTableControllerDelRouteResponder {
2586    fn drop(&mut self) {
2587        self.control_handle.shutdown();
2588        // Safety: drops once, never accessed again
2589        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2590    }
2591}
2592
2593impl fidl::endpoints::Responder for Ipv6RoutingTableControllerDelRouteResponder {
2594    type ControlHandle = Ipv6RoutingTableControllerControlHandle;
2595
2596    fn control_handle(&self) -> &Ipv6RoutingTableControllerControlHandle {
2597        &self.control_handle
2598    }
2599
2600    fn drop_without_shutdown(mut self) {
2601        // Safety: drops once, never accessed again due to mem::forget
2602        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2603        // Prevent Drop from running (which would shut down the channel)
2604        std::mem::forget(self);
2605    }
2606}
2607
2608impl Ipv6RoutingTableControllerDelRouteResponder {
2609    /// Sends a response to the FIDL transaction.
2610    ///
2611    /// Sets the channel to shutdown if an error occurs.
2612    pub fn send(
2613        self,
2614        mut result: Result<(), Ipv6RoutingTableControllerDelRouteError>,
2615    ) -> Result<(), fidl::Error> {
2616        let _result = self.send_raw(result);
2617        if _result.is_err() {
2618            self.control_handle.shutdown();
2619        }
2620        self.drop_without_shutdown();
2621        _result
2622    }
2623
2624    /// Similar to "send" but does not shutdown the channel if an error occurs.
2625    pub fn send_no_shutdown_on_err(
2626        self,
2627        mut result: Result<(), Ipv6RoutingTableControllerDelRouteError>,
2628    ) -> Result<(), fidl::Error> {
2629        let _result = self.send_raw(result);
2630        self.drop_without_shutdown();
2631        _result
2632    }
2633
2634    fn send_raw(
2635        &self,
2636        mut result: Result<(), Ipv6RoutingTableControllerDelRouteError>,
2637    ) -> Result<(), fidl::Error> {
2638        self.control_handle.inner.send::<fidl::encoding::ResultType<
2639            fidl::encoding::EmptyStruct,
2640            Ipv6RoutingTableControllerDelRouteError,
2641        >>(
2642            result,
2643            self.tx_id,
2644            0x35b6c2ce4a7b3f13,
2645            fidl::encoding::DynamicFlags::empty(),
2646        )
2647    }
2648}
2649
2650#[must_use = "FIDL methods require a response to be sent"]
2651#[derive(Debug)]
2652pub struct Ipv6RoutingTableControllerGetRouteStatsResponder {
2653    control_handle: std::mem::ManuallyDrop<Ipv6RoutingTableControllerControlHandle>,
2654    tx_id: u32,
2655}
2656
2657/// Set the the channel to be shutdown (see [`Ipv6RoutingTableControllerControlHandle::shutdown`])
2658/// if the responder is dropped without sending a response, so that the client
2659/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2660impl std::ops::Drop for Ipv6RoutingTableControllerGetRouteStatsResponder {
2661    fn drop(&mut self) {
2662        self.control_handle.shutdown();
2663        // Safety: drops once, never accessed again
2664        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2665    }
2666}
2667
2668impl fidl::endpoints::Responder for Ipv6RoutingTableControllerGetRouteStatsResponder {
2669    type ControlHandle = Ipv6RoutingTableControllerControlHandle;
2670
2671    fn control_handle(&self) -> &Ipv6RoutingTableControllerControlHandle {
2672        &self.control_handle
2673    }
2674
2675    fn drop_without_shutdown(mut self) {
2676        // Safety: drops once, never accessed again due to mem::forget
2677        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2678        // Prevent Drop from running (which would shut down the channel)
2679        std::mem::forget(self);
2680    }
2681}
2682
2683impl Ipv6RoutingTableControllerGetRouteStatsResponder {
2684    /// Sends a response to the FIDL transaction.
2685    ///
2686    /// Sets the channel to shutdown if an error occurs.
2687    pub fn send(
2688        self,
2689        mut result: Result<&RouteStats, Ipv6RoutingTableControllerGetRouteStatsError>,
2690    ) -> Result<(), fidl::Error> {
2691        let _result = self.send_raw(result);
2692        if _result.is_err() {
2693            self.control_handle.shutdown();
2694        }
2695        self.drop_without_shutdown();
2696        _result
2697    }
2698
2699    /// Similar to "send" but does not shutdown the channel if an error occurs.
2700    pub fn send_no_shutdown_on_err(
2701        self,
2702        mut result: Result<&RouteStats, Ipv6RoutingTableControllerGetRouteStatsError>,
2703    ) -> Result<(), fidl::Error> {
2704        let _result = self.send_raw(result);
2705        self.drop_without_shutdown();
2706        _result
2707    }
2708
2709    fn send_raw(
2710        &self,
2711        mut result: Result<&RouteStats, Ipv6RoutingTableControllerGetRouteStatsError>,
2712    ) -> Result<(), fidl::Error> {
2713        self.control_handle.inner.send::<fidl::encoding::ResultType<
2714            Ipv6RoutingTableControllerGetRouteStatsResponse,
2715            Ipv6RoutingTableControllerGetRouteStatsError,
2716        >>(
2717            result.map(|stats| (stats,)),
2718            self.tx_id,
2719            0x6d7fa5e9f18ef79f,
2720            fidl::encoding::DynamicFlags::empty(),
2721        )
2722    }
2723}
2724
2725#[must_use = "FIDL methods require a response to be sent"]
2726#[derive(Debug)]
2727pub struct Ipv6RoutingTableControllerWatchRoutingEventsResponder {
2728    control_handle: std::mem::ManuallyDrop<Ipv6RoutingTableControllerControlHandle>,
2729    tx_id: u32,
2730}
2731
2732/// Set the the channel to be shutdown (see [`Ipv6RoutingTableControllerControlHandle::shutdown`])
2733/// if the responder is dropped without sending a response, so that the client
2734/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2735impl std::ops::Drop for Ipv6RoutingTableControllerWatchRoutingEventsResponder {
2736    fn drop(&mut self) {
2737        self.control_handle.shutdown();
2738        // Safety: drops once, never accessed again
2739        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2740    }
2741}
2742
2743impl fidl::endpoints::Responder for Ipv6RoutingTableControllerWatchRoutingEventsResponder {
2744    type ControlHandle = Ipv6RoutingTableControllerControlHandle;
2745
2746    fn control_handle(&self) -> &Ipv6RoutingTableControllerControlHandle {
2747        &self.control_handle
2748    }
2749
2750    fn drop_without_shutdown(mut self) {
2751        // Safety: drops once, never accessed again due to mem::forget
2752        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2753        // Prevent Drop from running (which would shut down the channel)
2754        std::mem::forget(self);
2755    }
2756}
2757
2758impl Ipv6RoutingTableControllerWatchRoutingEventsResponder {
2759    /// Sends a response to the FIDL transaction.
2760    ///
2761    /// Sets the channel to shutdown if an error occurs.
2762    pub fn send(
2763        self,
2764        mut dropped_events: u64,
2765        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
2766        mut input_interface: u64,
2767        mut event: &RoutingEvent,
2768    ) -> Result<(), fidl::Error> {
2769        let _result = self.send_raw(dropped_events, addresses, input_interface, event);
2770        if _result.is_err() {
2771            self.control_handle.shutdown();
2772        }
2773        self.drop_without_shutdown();
2774        _result
2775    }
2776
2777    /// Similar to "send" but does not shutdown the channel if an error occurs.
2778    pub fn send_no_shutdown_on_err(
2779        self,
2780        mut dropped_events: u64,
2781        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
2782        mut input_interface: u64,
2783        mut event: &RoutingEvent,
2784    ) -> Result<(), fidl::Error> {
2785        let _result = self.send_raw(dropped_events, addresses, input_interface, event);
2786        self.drop_without_shutdown();
2787        _result
2788    }
2789
2790    fn send_raw(
2791        &self,
2792        mut dropped_events: u64,
2793        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
2794        mut input_interface: u64,
2795        mut event: &RoutingEvent,
2796    ) -> Result<(), fidl::Error> {
2797        self.control_handle.inner.send::<Ipv6RoutingTableControllerWatchRoutingEventsResponse>(
2798            (dropped_events, addresses, input_interface, event),
2799            self.tx_id,
2800            0x22a94526a0ea1078,
2801            fidl::encoding::DynamicFlags::empty(),
2802        )
2803    }
2804}
2805
2806mod internal {
2807    use super::*;
2808    unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerAddRouteError {
2809        type Owned = Self;
2810
2811        #[inline(always)]
2812        fn inline_align(_context: fidl::encoding::Context) -> usize {
2813            std::mem::align_of::<u32>()
2814        }
2815
2816        #[inline(always)]
2817        fn inline_size(_context: fidl::encoding::Context) -> usize {
2818            std::mem::size_of::<u32>()
2819        }
2820
2821        #[inline(always)]
2822        fn encode_is_copy() -> bool {
2823            true
2824        }
2825
2826        #[inline(always)]
2827        fn decode_is_copy() -> bool {
2828            false
2829        }
2830    }
2831
2832    impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerAddRouteError {
2833        type Borrowed<'a> = Self;
2834        #[inline(always)]
2835        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2836            *value
2837        }
2838    }
2839
2840    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2841        for Ipv4RoutingTableControllerAddRouteError
2842    {
2843        #[inline]
2844        unsafe fn encode(
2845            self,
2846            encoder: &mut fidl::encoding::Encoder<'_, D>,
2847            offset: usize,
2848            _depth: fidl::encoding::Depth,
2849        ) -> fidl::Result<()> {
2850            encoder.debug_check_bounds::<Self>(offset);
2851            encoder.write_num(self.into_primitive(), offset);
2852            Ok(())
2853        }
2854    }
2855
2856    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2857        for Ipv4RoutingTableControllerAddRouteError
2858    {
2859        #[inline(always)]
2860        fn new_empty() -> Self {
2861            Self::InvalidAddress
2862        }
2863
2864        #[inline]
2865        unsafe fn decode(
2866            &mut self,
2867            decoder: &mut fidl::encoding::Decoder<'_, D>,
2868            offset: usize,
2869            _depth: fidl::encoding::Depth,
2870        ) -> fidl::Result<()> {
2871            decoder.debug_check_bounds::<Self>(offset);
2872            let prim = decoder.read_num::<u32>(offset);
2873
2874            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
2875            Ok(())
2876        }
2877    }
2878    unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerDelRouteError {
2879        type Owned = Self;
2880
2881        #[inline(always)]
2882        fn inline_align(_context: fidl::encoding::Context) -> usize {
2883            std::mem::align_of::<u32>()
2884        }
2885
2886        #[inline(always)]
2887        fn inline_size(_context: fidl::encoding::Context) -> usize {
2888            std::mem::size_of::<u32>()
2889        }
2890
2891        #[inline(always)]
2892        fn encode_is_copy() -> bool {
2893            true
2894        }
2895
2896        #[inline(always)]
2897        fn decode_is_copy() -> bool {
2898            false
2899        }
2900    }
2901
2902    impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerDelRouteError {
2903        type Borrowed<'a> = Self;
2904        #[inline(always)]
2905        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2906            *value
2907        }
2908    }
2909
2910    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2911        for Ipv4RoutingTableControllerDelRouteError
2912    {
2913        #[inline]
2914        unsafe fn encode(
2915            self,
2916            encoder: &mut fidl::encoding::Encoder<'_, D>,
2917            offset: usize,
2918            _depth: fidl::encoding::Depth,
2919        ) -> fidl::Result<()> {
2920            encoder.debug_check_bounds::<Self>(offset);
2921            encoder.write_num(self.into_primitive(), offset);
2922            Ok(())
2923        }
2924    }
2925
2926    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2927        for Ipv4RoutingTableControllerDelRouteError
2928    {
2929        #[inline(always)]
2930        fn new_empty() -> Self {
2931            Self::InvalidAddress
2932        }
2933
2934        #[inline]
2935        unsafe fn decode(
2936            &mut self,
2937            decoder: &mut fidl::encoding::Decoder<'_, D>,
2938            offset: usize,
2939            _depth: fidl::encoding::Depth,
2940        ) -> fidl::Result<()> {
2941            decoder.debug_check_bounds::<Self>(offset);
2942            let prim = decoder.read_num::<u32>(offset);
2943
2944            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
2945            Ok(())
2946        }
2947    }
2948    unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerGetRouteStatsError {
2949        type Owned = Self;
2950
2951        #[inline(always)]
2952        fn inline_align(_context: fidl::encoding::Context) -> usize {
2953            std::mem::align_of::<u32>()
2954        }
2955
2956        #[inline(always)]
2957        fn inline_size(_context: fidl::encoding::Context) -> usize {
2958            std::mem::size_of::<u32>()
2959        }
2960
2961        #[inline(always)]
2962        fn encode_is_copy() -> bool {
2963            true
2964        }
2965
2966        #[inline(always)]
2967        fn decode_is_copy() -> bool {
2968            false
2969        }
2970    }
2971
2972    impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerGetRouteStatsError {
2973        type Borrowed<'a> = Self;
2974        #[inline(always)]
2975        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
2976            *value
2977        }
2978    }
2979
2980    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
2981        for Ipv4RoutingTableControllerGetRouteStatsError
2982    {
2983        #[inline]
2984        unsafe fn encode(
2985            self,
2986            encoder: &mut fidl::encoding::Encoder<'_, D>,
2987            offset: usize,
2988            _depth: fidl::encoding::Depth,
2989        ) -> fidl::Result<()> {
2990            encoder.debug_check_bounds::<Self>(offset);
2991            encoder.write_num(self.into_primitive(), offset);
2992            Ok(())
2993        }
2994    }
2995
2996    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
2997        for Ipv4RoutingTableControllerGetRouteStatsError
2998    {
2999        #[inline(always)]
3000        fn new_empty() -> Self {
3001            Self::InvalidAddress
3002        }
3003
3004        #[inline]
3005        unsafe fn decode(
3006            &mut self,
3007            decoder: &mut fidl::encoding::Decoder<'_, D>,
3008            offset: usize,
3009            _depth: fidl::encoding::Depth,
3010        ) -> fidl::Result<()> {
3011            decoder.debug_check_bounds::<Self>(offset);
3012            let prim = decoder.read_num::<u32>(offset);
3013
3014            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
3015            Ok(())
3016        }
3017    }
3018    unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerAddRouteError {
3019        type Owned = Self;
3020
3021        #[inline(always)]
3022        fn inline_align(_context: fidl::encoding::Context) -> usize {
3023            std::mem::align_of::<u32>()
3024        }
3025
3026        #[inline(always)]
3027        fn inline_size(_context: fidl::encoding::Context) -> usize {
3028            std::mem::size_of::<u32>()
3029        }
3030
3031        #[inline(always)]
3032        fn encode_is_copy() -> bool {
3033            true
3034        }
3035
3036        #[inline(always)]
3037        fn decode_is_copy() -> bool {
3038            false
3039        }
3040    }
3041
3042    impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerAddRouteError {
3043        type Borrowed<'a> = Self;
3044        #[inline(always)]
3045        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3046            *value
3047        }
3048    }
3049
3050    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
3051        for Ipv6RoutingTableControllerAddRouteError
3052    {
3053        #[inline]
3054        unsafe fn encode(
3055            self,
3056            encoder: &mut fidl::encoding::Encoder<'_, D>,
3057            offset: usize,
3058            _depth: fidl::encoding::Depth,
3059        ) -> fidl::Result<()> {
3060            encoder.debug_check_bounds::<Self>(offset);
3061            encoder.write_num(self.into_primitive(), offset);
3062            Ok(())
3063        }
3064    }
3065
3066    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3067        for Ipv6RoutingTableControllerAddRouteError
3068    {
3069        #[inline(always)]
3070        fn new_empty() -> Self {
3071            Self::InvalidAddress
3072        }
3073
3074        #[inline]
3075        unsafe fn decode(
3076            &mut self,
3077            decoder: &mut fidl::encoding::Decoder<'_, D>,
3078            offset: usize,
3079            _depth: fidl::encoding::Depth,
3080        ) -> fidl::Result<()> {
3081            decoder.debug_check_bounds::<Self>(offset);
3082            let prim = decoder.read_num::<u32>(offset);
3083
3084            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
3085            Ok(())
3086        }
3087    }
3088    unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerDelRouteError {
3089        type Owned = Self;
3090
3091        #[inline(always)]
3092        fn inline_align(_context: fidl::encoding::Context) -> usize {
3093            std::mem::align_of::<u32>()
3094        }
3095
3096        #[inline(always)]
3097        fn inline_size(_context: fidl::encoding::Context) -> usize {
3098            std::mem::size_of::<u32>()
3099        }
3100
3101        #[inline(always)]
3102        fn encode_is_copy() -> bool {
3103            true
3104        }
3105
3106        #[inline(always)]
3107        fn decode_is_copy() -> bool {
3108            false
3109        }
3110    }
3111
3112    impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerDelRouteError {
3113        type Borrowed<'a> = Self;
3114        #[inline(always)]
3115        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3116            *value
3117        }
3118    }
3119
3120    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
3121        for Ipv6RoutingTableControllerDelRouteError
3122    {
3123        #[inline]
3124        unsafe fn encode(
3125            self,
3126            encoder: &mut fidl::encoding::Encoder<'_, D>,
3127            offset: usize,
3128            _depth: fidl::encoding::Depth,
3129        ) -> fidl::Result<()> {
3130            encoder.debug_check_bounds::<Self>(offset);
3131            encoder.write_num(self.into_primitive(), offset);
3132            Ok(())
3133        }
3134    }
3135
3136    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3137        for Ipv6RoutingTableControllerDelRouteError
3138    {
3139        #[inline(always)]
3140        fn new_empty() -> Self {
3141            Self::InvalidAddress
3142        }
3143
3144        #[inline]
3145        unsafe fn decode(
3146            &mut self,
3147            decoder: &mut fidl::encoding::Decoder<'_, D>,
3148            offset: usize,
3149            _depth: fidl::encoding::Depth,
3150        ) -> fidl::Result<()> {
3151            decoder.debug_check_bounds::<Self>(offset);
3152            let prim = decoder.read_num::<u32>(offset);
3153
3154            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
3155            Ok(())
3156        }
3157    }
3158    unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerGetRouteStatsError {
3159        type Owned = Self;
3160
3161        #[inline(always)]
3162        fn inline_align(_context: fidl::encoding::Context) -> usize {
3163            std::mem::align_of::<u32>()
3164        }
3165
3166        #[inline(always)]
3167        fn inline_size(_context: fidl::encoding::Context) -> usize {
3168            std::mem::size_of::<u32>()
3169        }
3170
3171        #[inline(always)]
3172        fn encode_is_copy() -> bool {
3173            true
3174        }
3175
3176        #[inline(always)]
3177        fn decode_is_copy() -> bool {
3178            false
3179        }
3180    }
3181
3182    impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerGetRouteStatsError {
3183        type Borrowed<'a> = Self;
3184        #[inline(always)]
3185        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3186            *value
3187        }
3188    }
3189
3190    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
3191        for Ipv6RoutingTableControllerGetRouteStatsError
3192    {
3193        #[inline]
3194        unsafe fn encode(
3195            self,
3196            encoder: &mut fidl::encoding::Encoder<'_, D>,
3197            offset: usize,
3198            _depth: fidl::encoding::Depth,
3199        ) -> fidl::Result<()> {
3200            encoder.debug_check_bounds::<Self>(offset);
3201            encoder.write_num(self.into_primitive(), offset);
3202            Ok(())
3203        }
3204    }
3205
3206    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3207        for Ipv6RoutingTableControllerGetRouteStatsError
3208    {
3209        #[inline(always)]
3210        fn new_empty() -> Self {
3211            Self::InvalidAddress
3212        }
3213
3214        #[inline]
3215        unsafe fn decode(
3216            &mut self,
3217            decoder: &mut fidl::encoding::Decoder<'_, D>,
3218            offset: usize,
3219            _depth: fidl::encoding::Depth,
3220        ) -> fidl::Result<()> {
3221            decoder.debug_check_bounds::<Self>(offset);
3222            let prim = decoder.read_num::<u32>(offset);
3223
3224            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
3225            Ok(())
3226        }
3227    }
3228    unsafe impl fidl::encoding::TypeMarker for TableControllerCloseReason {
3229        type Owned = Self;
3230
3231        #[inline(always)]
3232        fn inline_align(_context: fidl::encoding::Context) -> usize {
3233            std::mem::align_of::<u32>()
3234        }
3235
3236        #[inline(always)]
3237        fn inline_size(_context: fidl::encoding::Context) -> usize {
3238            std::mem::size_of::<u32>()
3239        }
3240
3241        #[inline(always)]
3242        fn encode_is_copy() -> bool {
3243            true
3244        }
3245
3246        #[inline(always)]
3247        fn decode_is_copy() -> bool {
3248            false
3249        }
3250    }
3251
3252    impl fidl::encoding::ValueTypeMarker for TableControllerCloseReason {
3253        type Borrowed<'a> = Self;
3254        #[inline(always)]
3255        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3256            *value
3257        }
3258    }
3259
3260    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
3261        for TableControllerCloseReason
3262    {
3263        #[inline]
3264        unsafe fn encode(
3265            self,
3266            encoder: &mut fidl::encoding::Encoder<'_, D>,
3267            offset: usize,
3268            _depth: fidl::encoding::Depth,
3269        ) -> fidl::Result<()> {
3270            encoder.debug_check_bounds::<Self>(offset);
3271            encoder.write_num(self.into_primitive(), offset);
3272            Ok(())
3273        }
3274    }
3275
3276    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3277        for TableControllerCloseReason
3278    {
3279        #[inline(always)]
3280        fn new_empty() -> Self {
3281            Self::AlreadyInUse
3282        }
3283
3284        #[inline]
3285        unsafe fn decode(
3286            &mut self,
3287            decoder: &mut fidl::encoding::Decoder<'_, D>,
3288            offset: usize,
3289            _depth: fidl::encoding::Depth,
3290        ) -> fidl::Result<()> {
3291            decoder.debug_check_bounds::<Self>(offset);
3292            let prim = decoder.read_num::<u32>(offset);
3293
3294            *self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
3295            Ok(())
3296        }
3297    }
3298
3299    impl fidl::encoding::ValueTypeMarker for Empty {
3300        type Borrowed<'a> = &'a Self;
3301        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3302            value
3303        }
3304    }
3305
3306    unsafe impl fidl::encoding::TypeMarker for Empty {
3307        type Owned = Self;
3308
3309        #[inline(always)]
3310        fn inline_align(_context: fidl::encoding::Context) -> usize {
3311            1
3312        }
3313
3314        #[inline(always)]
3315        fn inline_size(_context: fidl::encoding::Context) -> usize {
3316            1
3317        }
3318    }
3319
3320    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
3321        #[inline]
3322        unsafe fn encode(
3323            self,
3324            encoder: &mut fidl::encoding::Encoder<'_, D>,
3325            offset: usize,
3326            _depth: fidl::encoding::Depth,
3327        ) -> fidl::Result<()> {
3328            encoder.debug_check_bounds::<Empty>(offset);
3329            encoder.write_num(0u8, offset);
3330            Ok(())
3331        }
3332    }
3333
3334    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
3335        #[inline(always)]
3336        fn new_empty() -> Self {
3337            Self
3338        }
3339
3340        #[inline]
3341        unsafe fn decode(
3342            &mut self,
3343            decoder: &mut fidl::encoding::Decoder<'_, D>,
3344            offset: usize,
3345            _depth: fidl::encoding::Depth,
3346        ) -> fidl::Result<()> {
3347            decoder.debug_check_bounds::<Self>(offset);
3348            match decoder.read_num::<u8>(offset) {
3349                0 => Ok(()),
3350                _ => Err(fidl::Error::Invalid),
3351            }
3352        }
3353    }
3354
3355    impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerAddRouteRequest {
3356        type Borrowed<'a> = &'a Self;
3357        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3358            value
3359        }
3360    }
3361
3362    unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerAddRouteRequest {
3363        type Owned = Self;
3364
3365        #[inline(always)]
3366        fn inline_align(_context: fidl::encoding::Context) -> usize {
3367            8
3368        }
3369
3370        #[inline(always)]
3371        fn inline_size(_context: fidl::encoding::Context) -> usize {
3372            24
3373        }
3374    }
3375
3376    unsafe impl<D: fidl::encoding::ResourceDialect>
3377        fidl::encoding::Encode<Ipv4RoutingTableControllerAddRouteRequest, D>
3378        for &Ipv4RoutingTableControllerAddRouteRequest
3379    {
3380        #[inline]
3381        unsafe fn encode(
3382            self,
3383            encoder: &mut fidl::encoding::Encoder<'_, D>,
3384            offset: usize,
3385            _depth: fidl::encoding::Depth,
3386        ) -> fidl::Result<()> {
3387            encoder.debug_check_bounds::<Ipv4RoutingTableControllerAddRouteRequest>(offset);
3388            // Delegate to tuple encoding.
3389            fidl::encoding::Encode::<Ipv4RoutingTableControllerAddRouteRequest, D>::encode(
3390                (
3391                    <Ipv4UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
3392                    <Route as fidl::encoding::ValueTypeMarker>::borrow(&self.route),
3393                ),
3394                encoder, offset, _depth
3395            )
3396        }
3397    }
3398    unsafe impl<
3399            D: fidl::encoding::ResourceDialect,
3400            T0: fidl::encoding::Encode<Ipv4UnicastSourceAndMulticastDestination, D>,
3401            T1: fidl::encoding::Encode<Route, D>,
3402        > fidl::encoding::Encode<Ipv4RoutingTableControllerAddRouteRequest, D> for (T0, T1)
3403    {
3404        #[inline]
3405        unsafe fn encode(
3406            self,
3407            encoder: &mut fidl::encoding::Encoder<'_, D>,
3408            offset: usize,
3409            depth: fidl::encoding::Depth,
3410        ) -> fidl::Result<()> {
3411            encoder.debug_check_bounds::<Ipv4RoutingTableControllerAddRouteRequest>(offset);
3412            // Zero out padding regions. There's no need to apply masks
3413            // because the unmasked parts will be overwritten by fields.
3414            // Write the fields.
3415            self.0.encode(encoder, offset + 0, depth)?;
3416            self.1.encode(encoder, offset + 8, depth)?;
3417            Ok(())
3418        }
3419    }
3420
3421    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3422        for Ipv4RoutingTableControllerAddRouteRequest
3423    {
3424        #[inline(always)]
3425        fn new_empty() -> Self {
3426            Self {
3427                addresses: fidl::new_empty!(Ipv4UnicastSourceAndMulticastDestination, D),
3428                route: fidl::new_empty!(Route, D),
3429            }
3430        }
3431
3432        #[inline]
3433        unsafe fn decode(
3434            &mut self,
3435            decoder: &mut fidl::encoding::Decoder<'_, D>,
3436            offset: usize,
3437            _depth: fidl::encoding::Depth,
3438        ) -> fidl::Result<()> {
3439            decoder.debug_check_bounds::<Self>(offset);
3440            // Verify that padding bytes are zero.
3441            fidl::decode!(
3442                Ipv4UnicastSourceAndMulticastDestination,
3443                D,
3444                &mut self.addresses,
3445                decoder,
3446                offset + 0,
3447                _depth
3448            )?;
3449            fidl::decode!(Route, D, &mut self.route, decoder, offset + 8, _depth)?;
3450            Ok(())
3451        }
3452    }
3453
3454    impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerDelRouteRequest {
3455        type Borrowed<'a> = &'a Self;
3456        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3457            value
3458        }
3459    }
3460
3461    unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerDelRouteRequest {
3462        type Owned = Self;
3463
3464        #[inline(always)]
3465        fn inline_align(_context: fidl::encoding::Context) -> usize {
3466            1
3467        }
3468
3469        #[inline(always)]
3470        fn inline_size(_context: fidl::encoding::Context) -> usize {
3471            8
3472        }
3473    }
3474
3475    unsafe impl<D: fidl::encoding::ResourceDialect>
3476        fidl::encoding::Encode<Ipv4RoutingTableControllerDelRouteRequest, D>
3477        for &Ipv4RoutingTableControllerDelRouteRequest
3478    {
3479        #[inline]
3480        unsafe fn encode(
3481            self,
3482            encoder: &mut fidl::encoding::Encoder<'_, D>,
3483            offset: usize,
3484            _depth: fidl::encoding::Depth,
3485        ) -> fidl::Result<()> {
3486            encoder.debug_check_bounds::<Ipv4RoutingTableControllerDelRouteRequest>(offset);
3487            // Delegate to tuple encoding.
3488            fidl::encoding::Encode::<Ipv4RoutingTableControllerDelRouteRequest, D>::encode(
3489                (
3490                    <Ipv4UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
3491                ),
3492                encoder, offset, _depth
3493            )
3494        }
3495    }
3496    unsafe impl<
3497            D: fidl::encoding::ResourceDialect,
3498            T0: fidl::encoding::Encode<Ipv4UnicastSourceAndMulticastDestination, D>,
3499        > fidl::encoding::Encode<Ipv4RoutingTableControllerDelRouteRequest, D> for (T0,)
3500    {
3501        #[inline]
3502        unsafe fn encode(
3503            self,
3504            encoder: &mut fidl::encoding::Encoder<'_, D>,
3505            offset: usize,
3506            depth: fidl::encoding::Depth,
3507        ) -> fidl::Result<()> {
3508            encoder.debug_check_bounds::<Ipv4RoutingTableControllerDelRouteRequest>(offset);
3509            // Zero out padding regions. There's no need to apply masks
3510            // because the unmasked parts will be overwritten by fields.
3511            // Write the fields.
3512            self.0.encode(encoder, offset + 0, depth)?;
3513            Ok(())
3514        }
3515    }
3516
3517    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3518        for Ipv4RoutingTableControllerDelRouteRequest
3519    {
3520        #[inline(always)]
3521        fn new_empty() -> Self {
3522            Self { addresses: fidl::new_empty!(Ipv4UnicastSourceAndMulticastDestination, D) }
3523        }
3524
3525        #[inline]
3526        unsafe fn decode(
3527            &mut self,
3528            decoder: &mut fidl::encoding::Decoder<'_, D>,
3529            offset: usize,
3530            _depth: fidl::encoding::Depth,
3531        ) -> fidl::Result<()> {
3532            decoder.debug_check_bounds::<Self>(offset);
3533            // Verify that padding bytes are zero.
3534            fidl::decode!(
3535                Ipv4UnicastSourceAndMulticastDestination,
3536                D,
3537                &mut self.addresses,
3538                decoder,
3539                offset + 0,
3540                _depth
3541            )?;
3542            Ok(())
3543        }
3544    }
3545
3546    impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerGetRouteStatsRequest {
3547        type Borrowed<'a> = &'a Self;
3548        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3549            value
3550        }
3551    }
3552
3553    unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerGetRouteStatsRequest {
3554        type Owned = Self;
3555
3556        #[inline(always)]
3557        fn inline_align(_context: fidl::encoding::Context) -> usize {
3558            1
3559        }
3560
3561        #[inline(always)]
3562        fn inline_size(_context: fidl::encoding::Context) -> usize {
3563            8
3564        }
3565    }
3566
3567    unsafe impl<D: fidl::encoding::ResourceDialect>
3568        fidl::encoding::Encode<Ipv4RoutingTableControllerGetRouteStatsRequest, D>
3569        for &Ipv4RoutingTableControllerGetRouteStatsRequest
3570    {
3571        #[inline]
3572        unsafe fn encode(
3573            self,
3574            encoder: &mut fidl::encoding::Encoder<'_, D>,
3575            offset: usize,
3576            _depth: fidl::encoding::Depth,
3577        ) -> fidl::Result<()> {
3578            encoder.debug_check_bounds::<Ipv4RoutingTableControllerGetRouteStatsRequest>(offset);
3579            // Delegate to tuple encoding.
3580            fidl::encoding::Encode::<Ipv4RoutingTableControllerGetRouteStatsRequest, D>::encode(
3581                (
3582                    <Ipv4UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
3583                ),
3584                encoder, offset, _depth
3585            )
3586        }
3587    }
3588    unsafe impl<
3589            D: fidl::encoding::ResourceDialect,
3590            T0: fidl::encoding::Encode<Ipv4UnicastSourceAndMulticastDestination, D>,
3591        > fidl::encoding::Encode<Ipv4RoutingTableControllerGetRouteStatsRequest, D> for (T0,)
3592    {
3593        #[inline]
3594        unsafe fn encode(
3595            self,
3596            encoder: &mut fidl::encoding::Encoder<'_, D>,
3597            offset: usize,
3598            depth: fidl::encoding::Depth,
3599        ) -> fidl::Result<()> {
3600            encoder.debug_check_bounds::<Ipv4RoutingTableControllerGetRouteStatsRequest>(offset);
3601            // Zero out padding regions. There's no need to apply masks
3602            // because the unmasked parts will be overwritten by fields.
3603            // Write the fields.
3604            self.0.encode(encoder, offset + 0, depth)?;
3605            Ok(())
3606        }
3607    }
3608
3609    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3610        for Ipv4RoutingTableControllerGetRouteStatsRequest
3611    {
3612        #[inline(always)]
3613        fn new_empty() -> Self {
3614            Self { addresses: fidl::new_empty!(Ipv4UnicastSourceAndMulticastDestination, D) }
3615        }
3616
3617        #[inline]
3618        unsafe fn decode(
3619            &mut self,
3620            decoder: &mut fidl::encoding::Decoder<'_, D>,
3621            offset: usize,
3622            _depth: fidl::encoding::Depth,
3623        ) -> fidl::Result<()> {
3624            decoder.debug_check_bounds::<Self>(offset);
3625            // Verify that padding bytes are zero.
3626            fidl::decode!(
3627                Ipv4UnicastSourceAndMulticastDestination,
3628                D,
3629                &mut self.addresses,
3630                decoder,
3631                offset + 0,
3632                _depth
3633            )?;
3634            Ok(())
3635        }
3636    }
3637
3638    impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerOnCloseRequest {
3639        type Borrowed<'a> = &'a Self;
3640        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3641            value
3642        }
3643    }
3644
3645    unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerOnCloseRequest {
3646        type Owned = Self;
3647
3648        #[inline(always)]
3649        fn inline_align(_context: fidl::encoding::Context) -> usize {
3650            4
3651        }
3652
3653        #[inline(always)]
3654        fn inline_size(_context: fidl::encoding::Context) -> usize {
3655            4
3656        }
3657    }
3658
3659    unsafe impl<D: fidl::encoding::ResourceDialect>
3660        fidl::encoding::Encode<Ipv4RoutingTableControllerOnCloseRequest, D>
3661        for &Ipv4RoutingTableControllerOnCloseRequest
3662    {
3663        #[inline]
3664        unsafe fn encode(
3665            self,
3666            encoder: &mut fidl::encoding::Encoder<'_, D>,
3667            offset: usize,
3668            _depth: fidl::encoding::Depth,
3669        ) -> fidl::Result<()> {
3670            encoder.debug_check_bounds::<Ipv4RoutingTableControllerOnCloseRequest>(offset);
3671            // Delegate to tuple encoding.
3672            fidl::encoding::Encode::<Ipv4RoutingTableControllerOnCloseRequest, D>::encode(
3673                (<TableControllerCloseReason as fidl::encoding::ValueTypeMarker>::borrow(
3674                    &self.error,
3675                ),),
3676                encoder,
3677                offset,
3678                _depth,
3679            )
3680        }
3681    }
3682    unsafe impl<
3683            D: fidl::encoding::ResourceDialect,
3684            T0: fidl::encoding::Encode<TableControllerCloseReason, D>,
3685        > fidl::encoding::Encode<Ipv4RoutingTableControllerOnCloseRequest, D> for (T0,)
3686    {
3687        #[inline]
3688        unsafe fn encode(
3689            self,
3690            encoder: &mut fidl::encoding::Encoder<'_, D>,
3691            offset: usize,
3692            depth: fidl::encoding::Depth,
3693        ) -> fidl::Result<()> {
3694            encoder.debug_check_bounds::<Ipv4RoutingTableControllerOnCloseRequest>(offset);
3695            // Zero out padding regions. There's no need to apply masks
3696            // because the unmasked parts will be overwritten by fields.
3697            // Write the fields.
3698            self.0.encode(encoder, offset + 0, depth)?;
3699            Ok(())
3700        }
3701    }
3702
3703    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3704        for Ipv4RoutingTableControllerOnCloseRequest
3705    {
3706        #[inline(always)]
3707        fn new_empty() -> Self {
3708            Self { error: fidl::new_empty!(TableControllerCloseReason, D) }
3709        }
3710
3711        #[inline]
3712        unsafe fn decode(
3713            &mut self,
3714            decoder: &mut fidl::encoding::Decoder<'_, D>,
3715            offset: usize,
3716            _depth: fidl::encoding::Depth,
3717        ) -> fidl::Result<()> {
3718            decoder.debug_check_bounds::<Self>(offset);
3719            // Verify that padding bytes are zero.
3720            fidl::decode!(
3721                TableControllerCloseReason,
3722                D,
3723                &mut self.error,
3724                decoder,
3725                offset + 0,
3726                _depth
3727            )?;
3728            Ok(())
3729        }
3730    }
3731
3732    impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerWatchRoutingEventsResponse {
3733        type Borrowed<'a> = &'a Self;
3734        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3735            value
3736        }
3737    }
3738
3739    unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerWatchRoutingEventsResponse {
3740        type Owned = Self;
3741
3742        #[inline(always)]
3743        fn inline_align(_context: fidl::encoding::Context) -> usize {
3744            8
3745        }
3746
3747        #[inline(always)]
3748        fn inline_size(_context: fidl::encoding::Context) -> usize {
3749            40
3750        }
3751    }
3752
3753    unsafe impl<D: fidl::encoding::ResourceDialect>
3754        fidl::encoding::Encode<Ipv4RoutingTableControllerWatchRoutingEventsResponse, D>
3755        for &Ipv4RoutingTableControllerWatchRoutingEventsResponse
3756    {
3757        #[inline]
3758        unsafe fn encode(
3759            self,
3760            encoder: &mut fidl::encoding::Encoder<'_, D>,
3761            offset: usize,
3762            _depth: fidl::encoding::Depth,
3763        ) -> fidl::Result<()> {
3764            encoder
3765                .debug_check_bounds::<Ipv4RoutingTableControllerWatchRoutingEventsResponse>(offset);
3766            // Delegate to tuple encoding.
3767            fidl::encoding::Encode::<Ipv4RoutingTableControllerWatchRoutingEventsResponse, D>::encode(
3768                (
3769                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.dropped_events),
3770                    <Ipv4UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
3771                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.input_interface),
3772                    <RoutingEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
3773                ),
3774                encoder, offset, _depth
3775            )
3776        }
3777    }
3778    unsafe impl<
3779            D: fidl::encoding::ResourceDialect,
3780            T0: fidl::encoding::Encode<u64, D>,
3781            T1: fidl::encoding::Encode<Ipv4UnicastSourceAndMulticastDestination, D>,
3782            T2: fidl::encoding::Encode<u64, D>,
3783            T3: fidl::encoding::Encode<RoutingEvent, D>,
3784        > fidl::encoding::Encode<Ipv4RoutingTableControllerWatchRoutingEventsResponse, D>
3785        for (T0, T1, T2, T3)
3786    {
3787        #[inline]
3788        unsafe fn encode(
3789            self,
3790            encoder: &mut fidl::encoding::Encoder<'_, D>,
3791            offset: usize,
3792            depth: fidl::encoding::Depth,
3793        ) -> fidl::Result<()> {
3794            encoder
3795                .debug_check_bounds::<Ipv4RoutingTableControllerWatchRoutingEventsResponse>(offset);
3796            // Zero out padding regions. There's no need to apply masks
3797            // because the unmasked parts will be overwritten by fields.
3798            // Write the fields.
3799            self.0.encode(encoder, offset + 0, depth)?;
3800            self.1.encode(encoder, offset + 8, depth)?;
3801            self.2.encode(encoder, offset + 16, depth)?;
3802            self.3.encode(encoder, offset + 24, depth)?;
3803            Ok(())
3804        }
3805    }
3806
3807    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3808        for Ipv4RoutingTableControllerWatchRoutingEventsResponse
3809    {
3810        #[inline(always)]
3811        fn new_empty() -> Self {
3812            Self {
3813                dropped_events: fidl::new_empty!(u64, D),
3814                addresses: fidl::new_empty!(Ipv4UnicastSourceAndMulticastDestination, D),
3815                input_interface: fidl::new_empty!(u64, D),
3816                event: fidl::new_empty!(RoutingEvent, D),
3817            }
3818        }
3819
3820        #[inline]
3821        unsafe fn decode(
3822            &mut self,
3823            decoder: &mut fidl::encoding::Decoder<'_, D>,
3824            offset: usize,
3825            _depth: fidl::encoding::Depth,
3826        ) -> fidl::Result<()> {
3827            decoder.debug_check_bounds::<Self>(offset);
3828            // Verify that padding bytes are zero.
3829            fidl::decode!(u64, D, &mut self.dropped_events, decoder, offset + 0, _depth)?;
3830            fidl::decode!(
3831                Ipv4UnicastSourceAndMulticastDestination,
3832                D,
3833                &mut self.addresses,
3834                decoder,
3835                offset + 8,
3836                _depth
3837            )?;
3838            fidl::decode!(u64, D, &mut self.input_interface, decoder, offset + 16, _depth)?;
3839            fidl::decode!(RoutingEvent, D, &mut self.event, decoder, offset + 24, _depth)?;
3840            Ok(())
3841        }
3842    }
3843
3844    impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerGetRouteStatsResponse {
3845        type Borrowed<'a> = &'a Self;
3846        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3847            value
3848        }
3849    }
3850
3851    unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerGetRouteStatsResponse {
3852        type Owned = Self;
3853
3854        #[inline(always)]
3855        fn inline_align(_context: fidl::encoding::Context) -> usize {
3856            8
3857        }
3858
3859        #[inline(always)]
3860        fn inline_size(_context: fidl::encoding::Context) -> usize {
3861            16
3862        }
3863    }
3864
3865    unsafe impl<D: fidl::encoding::ResourceDialect>
3866        fidl::encoding::Encode<Ipv4RoutingTableControllerGetRouteStatsResponse, D>
3867        for &Ipv4RoutingTableControllerGetRouteStatsResponse
3868    {
3869        #[inline]
3870        unsafe fn encode(
3871            self,
3872            encoder: &mut fidl::encoding::Encoder<'_, D>,
3873            offset: usize,
3874            _depth: fidl::encoding::Depth,
3875        ) -> fidl::Result<()> {
3876            encoder.debug_check_bounds::<Ipv4RoutingTableControllerGetRouteStatsResponse>(offset);
3877            // Delegate to tuple encoding.
3878            fidl::encoding::Encode::<Ipv4RoutingTableControllerGetRouteStatsResponse, D>::encode(
3879                (<RouteStats as fidl::encoding::ValueTypeMarker>::borrow(&self.stats),),
3880                encoder,
3881                offset,
3882                _depth,
3883            )
3884        }
3885    }
3886    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RouteStats, D>>
3887        fidl::encoding::Encode<Ipv4RoutingTableControllerGetRouteStatsResponse, D> for (T0,)
3888    {
3889        #[inline]
3890        unsafe fn encode(
3891            self,
3892            encoder: &mut fidl::encoding::Encoder<'_, D>,
3893            offset: usize,
3894            depth: fidl::encoding::Depth,
3895        ) -> fidl::Result<()> {
3896            encoder.debug_check_bounds::<Ipv4RoutingTableControllerGetRouteStatsResponse>(offset);
3897            // Zero out padding regions. There's no need to apply masks
3898            // because the unmasked parts will be overwritten by fields.
3899            // Write the fields.
3900            self.0.encode(encoder, offset + 0, depth)?;
3901            Ok(())
3902        }
3903    }
3904
3905    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
3906        for Ipv4RoutingTableControllerGetRouteStatsResponse
3907    {
3908        #[inline(always)]
3909        fn new_empty() -> Self {
3910            Self { stats: fidl::new_empty!(RouteStats, D) }
3911        }
3912
3913        #[inline]
3914        unsafe fn decode(
3915            &mut self,
3916            decoder: &mut fidl::encoding::Decoder<'_, D>,
3917            offset: usize,
3918            _depth: fidl::encoding::Depth,
3919        ) -> fidl::Result<()> {
3920            decoder.debug_check_bounds::<Self>(offset);
3921            // Verify that padding bytes are zero.
3922            fidl::decode!(RouteStats, D, &mut self.stats, decoder, offset + 0, _depth)?;
3923            Ok(())
3924        }
3925    }
3926
3927    impl fidl::encoding::ValueTypeMarker for Ipv4UnicastSourceAndMulticastDestination {
3928        type Borrowed<'a> = &'a Self;
3929        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
3930            value
3931        }
3932    }
3933
3934    unsafe impl fidl::encoding::TypeMarker for Ipv4UnicastSourceAndMulticastDestination {
3935        type Owned = Self;
3936
3937        #[inline(always)]
3938        fn inline_align(_context: fidl::encoding::Context) -> usize {
3939            1
3940        }
3941
3942        #[inline(always)]
3943        fn inline_size(_context: fidl::encoding::Context) -> usize {
3944            8
3945        }
3946    }
3947
3948    unsafe impl<D: fidl::encoding::ResourceDialect>
3949        fidl::encoding::Encode<Ipv4UnicastSourceAndMulticastDestination, D>
3950        for &Ipv4UnicastSourceAndMulticastDestination
3951    {
3952        #[inline]
3953        unsafe fn encode(
3954            self,
3955            encoder: &mut fidl::encoding::Encoder<'_, D>,
3956            offset: usize,
3957            _depth: fidl::encoding::Depth,
3958        ) -> fidl::Result<()> {
3959            encoder.debug_check_bounds::<Ipv4UnicastSourceAndMulticastDestination>(offset);
3960            // Delegate to tuple encoding.
3961            fidl::encoding::Encode::<Ipv4UnicastSourceAndMulticastDestination, D>::encode(
3962                (
3963                    <fidl_fuchsia_net::Ipv4Address as fidl::encoding::ValueTypeMarker>::borrow(
3964                        &self.unicast_source,
3965                    ),
3966                    <fidl_fuchsia_net::Ipv4Address as fidl::encoding::ValueTypeMarker>::borrow(
3967                        &self.multicast_destination,
3968                    ),
3969                ),
3970                encoder,
3971                offset,
3972                _depth,
3973            )
3974        }
3975    }
3976    unsafe impl<
3977            D: fidl::encoding::ResourceDialect,
3978            T0: fidl::encoding::Encode<fidl_fuchsia_net::Ipv4Address, D>,
3979            T1: fidl::encoding::Encode<fidl_fuchsia_net::Ipv4Address, D>,
3980        > fidl::encoding::Encode<Ipv4UnicastSourceAndMulticastDestination, D> for (T0, T1)
3981    {
3982        #[inline]
3983        unsafe fn encode(
3984            self,
3985            encoder: &mut fidl::encoding::Encoder<'_, D>,
3986            offset: usize,
3987            depth: fidl::encoding::Depth,
3988        ) -> fidl::Result<()> {
3989            encoder.debug_check_bounds::<Ipv4UnicastSourceAndMulticastDestination>(offset);
3990            // Zero out padding regions. There's no need to apply masks
3991            // because the unmasked parts will be overwritten by fields.
3992            // Write the fields.
3993            self.0.encode(encoder, offset + 0, depth)?;
3994            self.1.encode(encoder, offset + 4, depth)?;
3995            Ok(())
3996        }
3997    }
3998
3999    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4000        for Ipv4UnicastSourceAndMulticastDestination
4001    {
4002        #[inline(always)]
4003        fn new_empty() -> Self {
4004            Self {
4005                unicast_source: fidl::new_empty!(fidl_fuchsia_net::Ipv4Address, D),
4006                multicast_destination: fidl::new_empty!(fidl_fuchsia_net::Ipv4Address, D),
4007            }
4008        }
4009
4010        #[inline]
4011        unsafe fn decode(
4012            &mut self,
4013            decoder: &mut fidl::encoding::Decoder<'_, D>,
4014            offset: usize,
4015            _depth: fidl::encoding::Depth,
4016        ) -> fidl::Result<()> {
4017            decoder.debug_check_bounds::<Self>(offset);
4018            // Verify that padding bytes are zero.
4019            fidl::decode!(
4020                fidl_fuchsia_net::Ipv4Address,
4021                D,
4022                &mut self.unicast_source,
4023                decoder,
4024                offset + 0,
4025                _depth
4026            )?;
4027            fidl::decode!(
4028                fidl_fuchsia_net::Ipv4Address,
4029                D,
4030                &mut self.multicast_destination,
4031                decoder,
4032                offset + 4,
4033                _depth
4034            )?;
4035            Ok(())
4036        }
4037    }
4038
4039    impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerAddRouteRequest {
4040        type Borrowed<'a> = &'a Self;
4041        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4042            value
4043        }
4044    }
4045
4046    unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerAddRouteRequest {
4047        type Owned = Self;
4048
4049        #[inline(always)]
4050        fn inline_align(_context: fidl::encoding::Context) -> usize {
4051            8
4052        }
4053
4054        #[inline(always)]
4055        fn inline_size(_context: fidl::encoding::Context) -> usize {
4056            48
4057        }
4058    }
4059
4060    unsafe impl<D: fidl::encoding::ResourceDialect>
4061        fidl::encoding::Encode<Ipv6RoutingTableControllerAddRouteRequest, D>
4062        for &Ipv6RoutingTableControllerAddRouteRequest
4063    {
4064        #[inline]
4065        unsafe fn encode(
4066            self,
4067            encoder: &mut fidl::encoding::Encoder<'_, D>,
4068            offset: usize,
4069            _depth: fidl::encoding::Depth,
4070        ) -> fidl::Result<()> {
4071            encoder.debug_check_bounds::<Ipv6RoutingTableControllerAddRouteRequest>(offset);
4072            // Delegate to tuple encoding.
4073            fidl::encoding::Encode::<Ipv6RoutingTableControllerAddRouteRequest, D>::encode(
4074                (
4075                    <Ipv6UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
4076                    <Route as fidl::encoding::ValueTypeMarker>::borrow(&self.route),
4077                ),
4078                encoder, offset, _depth
4079            )
4080        }
4081    }
4082    unsafe impl<
4083            D: fidl::encoding::ResourceDialect,
4084            T0: fidl::encoding::Encode<Ipv6UnicastSourceAndMulticastDestination, D>,
4085            T1: fidl::encoding::Encode<Route, D>,
4086        > fidl::encoding::Encode<Ipv6RoutingTableControllerAddRouteRequest, D> for (T0, T1)
4087    {
4088        #[inline]
4089        unsafe fn encode(
4090            self,
4091            encoder: &mut fidl::encoding::Encoder<'_, D>,
4092            offset: usize,
4093            depth: fidl::encoding::Depth,
4094        ) -> fidl::Result<()> {
4095            encoder.debug_check_bounds::<Ipv6RoutingTableControllerAddRouteRequest>(offset);
4096            // Zero out padding regions. There's no need to apply masks
4097            // because the unmasked parts will be overwritten by fields.
4098            // Write the fields.
4099            self.0.encode(encoder, offset + 0, depth)?;
4100            self.1.encode(encoder, offset + 32, depth)?;
4101            Ok(())
4102        }
4103    }
4104
4105    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4106        for Ipv6RoutingTableControllerAddRouteRequest
4107    {
4108        #[inline(always)]
4109        fn new_empty() -> Self {
4110            Self {
4111                addresses: fidl::new_empty!(Ipv6UnicastSourceAndMulticastDestination, D),
4112                route: fidl::new_empty!(Route, D),
4113            }
4114        }
4115
4116        #[inline]
4117        unsafe fn decode(
4118            &mut self,
4119            decoder: &mut fidl::encoding::Decoder<'_, D>,
4120            offset: usize,
4121            _depth: fidl::encoding::Depth,
4122        ) -> fidl::Result<()> {
4123            decoder.debug_check_bounds::<Self>(offset);
4124            // Verify that padding bytes are zero.
4125            fidl::decode!(
4126                Ipv6UnicastSourceAndMulticastDestination,
4127                D,
4128                &mut self.addresses,
4129                decoder,
4130                offset + 0,
4131                _depth
4132            )?;
4133            fidl::decode!(Route, D, &mut self.route, decoder, offset + 32, _depth)?;
4134            Ok(())
4135        }
4136    }
4137
4138    impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerDelRouteRequest {
4139        type Borrowed<'a> = &'a Self;
4140        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4141            value
4142        }
4143    }
4144
4145    unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerDelRouteRequest {
4146        type Owned = Self;
4147
4148        #[inline(always)]
4149        fn inline_align(_context: fidl::encoding::Context) -> usize {
4150            1
4151        }
4152
4153        #[inline(always)]
4154        fn inline_size(_context: fidl::encoding::Context) -> usize {
4155            32
4156        }
4157    }
4158
4159    unsafe impl<D: fidl::encoding::ResourceDialect>
4160        fidl::encoding::Encode<Ipv6RoutingTableControllerDelRouteRequest, D>
4161        for &Ipv6RoutingTableControllerDelRouteRequest
4162    {
4163        #[inline]
4164        unsafe fn encode(
4165            self,
4166            encoder: &mut fidl::encoding::Encoder<'_, D>,
4167            offset: usize,
4168            _depth: fidl::encoding::Depth,
4169        ) -> fidl::Result<()> {
4170            encoder.debug_check_bounds::<Ipv6RoutingTableControllerDelRouteRequest>(offset);
4171            // Delegate to tuple encoding.
4172            fidl::encoding::Encode::<Ipv6RoutingTableControllerDelRouteRequest, D>::encode(
4173                (
4174                    <Ipv6UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
4175                ),
4176                encoder, offset, _depth
4177            )
4178        }
4179    }
4180    unsafe impl<
4181            D: fidl::encoding::ResourceDialect,
4182            T0: fidl::encoding::Encode<Ipv6UnicastSourceAndMulticastDestination, D>,
4183        > fidl::encoding::Encode<Ipv6RoutingTableControllerDelRouteRequest, D> for (T0,)
4184    {
4185        #[inline]
4186        unsafe fn encode(
4187            self,
4188            encoder: &mut fidl::encoding::Encoder<'_, D>,
4189            offset: usize,
4190            depth: fidl::encoding::Depth,
4191        ) -> fidl::Result<()> {
4192            encoder.debug_check_bounds::<Ipv6RoutingTableControllerDelRouteRequest>(offset);
4193            // Zero out padding regions. There's no need to apply masks
4194            // because the unmasked parts will be overwritten by fields.
4195            // Write the fields.
4196            self.0.encode(encoder, offset + 0, depth)?;
4197            Ok(())
4198        }
4199    }
4200
4201    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4202        for Ipv6RoutingTableControllerDelRouteRequest
4203    {
4204        #[inline(always)]
4205        fn new_empty() -> Self {
4206            Self { addresses: fidl::new_empty!(Ipv6UnicastSourceAndMulticastDestination, D) }
4207        }
4208
4209        #[inline]
4210        unsafe fn decode(
4211            &mut self,
4212            decoder: &mut fidl::encoding::Decoder<'_, D>,
4213            offset: usize,
4214            _depth: fidl::encoding::Depth,
4215        ) -> fidl::Result<()> {
4216            decoder.debug_check_bounds::<Self>(offset);
4217            // Verify that padding bytes are zero.
4218            fidl::decode!(
4219                Ipv6UnicastSourceAndMulticastDestination,
4220                D,
4221                &mut self.addresses,
4222                decoder,
4223                offset + 0,
4224                _depth
4225            )?;
4226            Ok(())
4227        }
4228    }
4229
4230    impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerGetRouteStatsRequest {
4231        type Borrowed<'a> = &'a Self;
4232        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4233            value
4234        }
4235    }
4236
4237    unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerGetRouteStatsRequest {
4238        type Owned = Self;
4239
4240        #[inline(always)]
4241        fn inline_align(_context: fidl::encoding::Context) -> usize {
4242            1
4243        }
4244
4245        #[inline(always)]
4246        fn inline_size(_context: fidl::encoding::Context) -> usize {
4247            32
4248        }
4249    }
4250
4251    unsafe impl<D: fidl::encoding::ResourceDialect>
4252        fidl::encoding::Encode<Ipv6RoutingTableControllerGetRouteStatsRequest, D>
4253        for &Ipv6RoutingTableControllerGetRouteStatsRequest
4254    {
4255        #[inline]
4256        unsafe fn encode(
4257            self,
4258            encoder: &mut fidl::encoding::Encoder<'_, D>,
4259            offset: usize,
4260            _depth: fidl::encoding::Depth,
4261        ) -> fidl::Result<()> {
4262            encoder.debug_check_bounds::<Ipv6RoutingTableControllerGetRouteStatsRequest>(offset);
4263            // Delegate to tuple encoding.
4264            fidl::encoding::Encode::<Ipv6RoutingTableControllerGetRouteStatsRequest, D>::encode(
4265                (
4266                    <Ipv6UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
4267                ),
4268                encoder, offset, _depth
4269            )
4270        }
4271    }
4272    unsafe impl<
4273            D: fidl::encoding::ResourceDialect,
4274            T0: fidl::encoding::Encode<Ipv6UnicastSourceAndMulticastDestination, D>,
4275        > fidl::encoding::Encode<Ipv6RoutingTableControllerGetRouteStatsRequest, D> for (T0,)
4276    {
4277        #[inline]
4278        unsafe fn encode(
4279            self,
4280            encoder: &mut fidl::encoding::Encoder<'_, D>,
4281            offset: usize,
4282            depth: fidl::encoding::Depth,
4283        ) -> fidl::Result<()> {
4284            encoder.debug_check_bounds::<Ipv6RoutingTableControllerGetRouteStatsRequest>(offset);
4285            // Zero out padding regions. There's no need to apply masks
4286            // because the unmasked parts will be overwritten by fields.
4287            // Write the fields.
4288            self.0.encode(encoder, offset + 0, depth)?;
4289            Ok(())
4290        }
4291    }
4292
4293    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4294        for Ipv6RoutingTableControllerGetRouteStatsRequest
4295    {
4296        #[inline(always)]
4297        fn new_empty() -> Self {
4298            Self { addresses: fidl::new_empty!(Ipv6UnicastSourceAndMulticastDestination, D) }
4299        }
4300
4301        #[inline]
4302        unsafe fn decode(
4303            &mut self,
4304            decoder: &mut fidl::encoding::Decoder<'_, D>,
4305            offset: usize,
4306            _depth: fidl::encoding::Depth,
4307        ) -> fidl::Result<()> {
4308            decoder.debug_check_bounds::<Self>(offset);
4309            // Verify that padding bytes are zero.
4310            fidl::decode!(
4311                Ipv6UnicastSourceAndMulticastDestination,
4312                D,
4313                &mut self.addresses,
4314                decoder,
4315                offset + 0,
4316                _depth
4317            )?;
4318            Ok(())
4319        }
4320    }
4321
4322    impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerOnCloseRequest {
4323        type Borrowed<'a> = &'a Self;
4324        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4325            value
4326        }
4327    }
4328
4329    unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerOnCloseRequest {
4330        type Owned = Self;
4331
4332        #[inline(always)]
4333        fn inline_align(_context: fidl::encoding::Context) -> usize {
4334            4
4335        }
4336
4337        #[inline(always)]
4338        fn inline_size(_context: fidl::encoding::Context) -> usize {
4339            4
4340        }
4341    }
4342
4343    unsafe impl<D: fidl::encoding::ResourceDialect>
4344        fidl::encoding::Encode<Ipv6RoutingTableControllerOnCloseRequest, D>
4345        for &Ipv6RoutingTableControllerOnCloseRequest
4346    {
4347        #[inline]
4348        unsafe fn encode(
4349            self,
4350            encoder: &mut fidl::encoding::Encoder<'_, D>,
4351            offset: usize,
4352            _depth: fidl::encoding::Depth,
4353        ) -> fidl::Result<()> {
4354            encoder.debug_check_bounds::<Ipv6RoutingTableControllerOnCloseRequest>(offset);
4355            // Delegate to tuple encoding.
4356            fidl::encoding::Encode::<Ipv6RoutingTableControllerOnCloseRequest, D>::encode(
4357                (<TableControllerCloseReason as fidl::encoding::ValueTypeMarker>::borrow(
4358                    &self.error,
4359                ),),
4360                encoder,
4361                offset,
4362                _depth,
4363            )
4364        }
4365    }
4366    unsafe impl<
4367            D: fidl::encoding::ResourceDialect,
4368            T0: fidl::encoding::Encode<TableControllerCloseReason, D>,
4369        > fidl::encoding::Encode<Ipv6RoutingTableControllerOnCloseRequest, D> for (T0,)
4370    {
4371        #[inline]
4372        unsafe fn encode(
4373            self,
4374            encoder: &mut fidl::encoding::Encoder<'_, D>,
4375            offset: usize,
4376            depth: fidl::encoding::Depth,
4377        ) -> fidl::Result<()> {
4378            encoder.debug_check_bounds::<Ipv6RoutingTableControllerOnCloseRequest>(offset);
4379            // Zero out padding regions. There's no need to apply masks
4380            // because the unmasked parts will be overwritten by fields.
4381            // Write the fields.
4382            self.0.encode(encoder, offset + 0, depth)?;
4383            Ok(())
4384        }
4385    }
4386
4387    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4388        for Ipv6RoutingTableControllerOnCloseRequest
4389    {
4390        #[inline(always)]
4391        fn new_empty() -> Self {
4392            Self { error: fidl::new_empty!(TableControllerCloseReason, D) }
4393        }
4394
4395        #[inline]
4396        unsafe fn decode(
4397            &mut self,
4398            decoder: &mut fidl::encoding::Decoder<'_, D>,
4399            offset: usize,
4400            _depth: fidl::encoding::Depth,
4401        ) -> fidl::Result<()> {
4402            decoder.debug_check_bounds::<Self>(offset);
4403            // Verify that padding bytes are zero.
4404            fidl::decode!(
4405                TableControllerCloseReason,
4406                D,
4407                &mut self.error,
4408                decoder,
4409                offset + 0,
4410                _depth
4411            )?;
4412            Ok(())
4413        }
4414    }
4415
4416    impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerWatchRoutingEventsResponse {
4417        type Borrowed<'a> = &'a Self;
4418        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4419            value
4420        }
4421    }
4422
4423    unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerWatchRoutingEventsResponse {
4424        type Owned = Self;
4425
4426        #[inline(always)]
4427        fn inline_align(_context: fidl::encoding::Context) -> usize {
4428            8
4429        }
4430
4431        #[inline(always)]
4432        fn inline_size(_context: fidl::encoding::Context) -> usize {
4433            64
4434        }
4435    }
4436
4437    unsafe impl<D: fidl::encoding::ResourceDialect>
4438        fidl::encoding::Encode<Ipv6RoutingTableControllerWatchRoutingEventsResponse, D>
4439        for &Ipv6RoutingTableControllerWatchRoutingEventsResponse
4440    {
4441        #[inline]
4442        unsafe fn encode(
4443            self,
4444            encoder: &mut fidl::encoding::Encoder<'_, D>,
4445            offset: usize,
4446            _depth: fidl::encoding::Depth,
4447        ) -> fidl::Result<()> {
4448            encoder
4449                .debug_check_bounds::<Ipv6RoutingTableControllerWatchRoutingEventsResponse>(offset);
4450            // Delegate to tuple encoding.
4451            fidl::encoding::Encode::<Ipv6RoutingTableControllerWatchRoutingEventsResponse, D>::encode(
4452                (
4453                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.dropped_events),
4454                    <Ipv6UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
4455                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.input_interface),
4456                    <RoutingEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
4457                ),
4458                encoder, offset, _depth
4459            )
4460        }
4461    }
4462    unsafe impl<
4463            D: fidl::encoding::ResourceDialect,
4464            T0: fidl::encoding::Encode<u64, D>,
4465            T1: fidl::encoding::Encode<Ipv6UnicastSourceAndMulticastDestination, D>,
4466            T2: fidl::encoding::Encode<u64, D>,
4467            T3: fidl::encoding::Encode<RoutingEvent, D>,
4468        > fidl::encoding::Encode<Ipv6RoutingTableControllerWatchRoutingEventsResponse, D>
4469        for (T0, T1, T2, T3)
4470    {
4471        #[inline]
4472        unsafe fn encode(
4473            self,
4474            encoder: &mut fidl::encoding::Encoder<'_, D>,
4475            offset: usize,
4476            depth: fidl::encoding::Depth,
4477        ) -> fidl::Result<()> {
4478            encoder
4479                .debug_check_bounds::<Ipv6RoutingTableControllerWatchRoutingEventsResponse>(offset);
4480            // Zero out padding regions. There's no need to apply masks
4481            // because the unmasked parts will be overwritten by fields.
4482            // Write the fields.
4483            self.0.encode(encoder, offset + 0, depth)?;
4484            self.1.encode(encoder, offset + 8, depth)?;
4485            self.2.encode(encoder, offset + 40, depth)?;
4486            self.3.encode(encoder, offset + 48, depth)?;
4487            Ok(())
4488        }
4489    }
4490
4491    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4492        for Ipv6RoutingTableControllerWatchRoutingEventsResponse
4493    {
4494        #[inline(always)]
4495        fn new_empty() -> Self {
4496            Self {
4497                dropped_events: fidl::new_empty!(u64, D),
4498                addresses: fidl::new_empty!(Ipv6UnicastSourceAndMulticastDestination, D),
4499                input_interface: fidl::new_empty!(u64, D),
4500                event: fidl::new_empty!(RoutingEvent, D),
4501            }
4502        }
4503
4504        #[inline]
4505        unsafe fn decode(
4506            &mut self,
4507            decoder: &mut fidl::encoding::Decoder<'_, D>,
4508            offset: usize,
4509            _depth: fidl::encoding::Depth,
4510        ) -> fidl::Result<()> {
4511            decoder.debug_check_bounds::<Self>(offset);
4512            // Verify that padding bytes are zero.
4513            fidl::decode!(u64, D, &mut self.dropped_events, decoder, offset + 0, _depth)?;
4514            fidl::decode!(
4515                Ipv6UnicastSourceAndMulticastDestination,
4516                D,
4517                &mut self.addresses,
4518                decoder,
4519                offset + 8,
4520                _depth
4521            )?;
4522            fidl::decode!(u64, D, &mut self.input_interface, decoder, offset + 40, _depth)?;
4523            fidl::decode!(RoutingEvent, D, &mut self.event, decoder, offset + 48, _depth)?;
4524            Ok(())
4525        }
4526    }
4527
4528    impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerGetRouteStatsResponse {
4529        type Borrowed<'a> = &'a Self;
4530        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4531            value
4532        }
4533    }
4534
4535    unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerGetRouteStatsResponse {
4536        type Owned = Self;
4537
4538        #[inline(always)]
4539        fn inline_align(_context: fidl::encoding::Context) -> usize {
4540            8
4541        }
4542
4543        #[inline(always)]
4544        fn inline_size(_context: fidl::encoding::Context) -> usize {
4545            16
4546        }
4547    }
4548
4549    unsafe impl<D: fidl::encoding::ResourceDialect>
4550        fidl::encoding::Encode<Ipv6RoutingTableControllerGetRouteStatsResponse, D>
4551        for &Ipv6RoutingTableControllerGetRouteStatsResponse
4552    {
4553        #[inline]
4554        unsafe fn encode(
4555            self,
4556            encoder: &mut fidl::encoding::Encoder<'_, D>,
4557            offset: usize,
4558            _depth: fidl::encoding::Depth,
4559        ) -> fidl::Result<()> {
4560            encoder.debug_check_bounds::<Ipv6RoutingTableControllerGetRouteStatsResponse>(offset);
4561            // Delegate to tuple encoding.
4562            fidl::encoding::Encode::<Ipv6RoutingTableControllerGetRouteStatsResponse, D>::encode(
4563                (<RouteStats as fidl::encoding::ValueTypeMarker>::borrow(&self.stats),),
4564                encoder,
4565                offset,
4566                _depth,
4567            )
4568        }
4569    }
4570    unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RouteStats, D>>
4571        fidl::encoding::Encode<Ipv6RoutingTableControllerGetRouteStatsResponse, D> for (T0,)
4572    {
4573        #[inline]
4574        unsafe fn encode(
4575            self,
4576            encoder: &mut fidl::encoding::Encoder<'_, D>,
4577            offset: usize,
4578            depth: fidl::encoding::Depth,
4579        ) -> fidl::Result<()> {
4580            encoder.debug_check_bounds::<Ipv6RoutingTableControllerGetRouteStatsResponse>(offset);
4581            // Zero out padding regions. There's no need to apply masks
4582            // because the unmasked parts will be overwritten by fields.
4583            // Write the fields.
4584            self.0.encode(encoder, offset + 0, depth)?;
4585            Ok(())
4586        }
4587    }
4588
4589    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4590        for Ipv6RoutingTableControllerGetRouteStatsResponse
4591    {
4592        #[inline(always)]
4593        fn new_empty() -> Self {
4594            Self { stats: fidl::new_empty!(RouteStats, D) }
4595        }
4596
4597        #[inline]
4598        unsafe fn decode(
4599            &mut self,
4600            decoder: &mut fidl::encoding::Decoder<'_, D>,
4601            offset: usize,
4602            _depth: fidl::encoding::Depth,
4603        ) -> fidl::Result<()> {
4604            decoder.debug_check_bounds::<Self>(offset);
4605            // Verify that padding bytes are zero.
4606            fidl::decode!(RouteStats, D, &mut self.stats, decoder, offset + 0, _depth)?;
4607            Ok(())
4608        }
4609    }
4610
4611    impl fidl::encoding::ValueTypeMarker for Ipv6UnicastSourceAndMulticastDestination {
4612        type Borrowed<'a> = &'a Self;
4613        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4614            value
4615        }
4616    }
4617
4618    unsafe impl fidl::encoding::TypeMarker for Ipv6UnicastSourceAndMulticastDestination {
4619        type Owned = Self;
4620
4621        #[inline(always)]
4622        fn inline_align(_context: fidl::encoding::Context) -> usize {
4623            1
4624        }
4625
4626        #[inline(always)]
4627        fn inline_size(_context: fidl::encoding::Context) -> usize {
4628            32
4629        }
4630    }
4631
4632    unsafe impl<D: fidl::encoding::ResourceDialect>
4633        fidl::encoding::Encode<Ipv6UnicastSourceAndMulticastDestination, D>
4634        for &Ipv6UnicastSourceAndMulticastDestination
4635    {
4636        #[inline]
4637        unsafe fn encode(
4638            self,
4639            encoder: &mut fidl::encoding::Encoder<'_, D>,
4640            offset: usize,
4641            _depth: fidl::encoding::Depth,
4642        ) -> fidl::Result<()> {
4643            encoder.debug_check_bounds::<Ipv6UnicastSourceAndMulticastDestination>(offset);
4644            // Delegate to tuple encoding.
4645            fidl::encoding::Encode::<Ipv6UnicastSourceAndMulticastDestination, D>::encode(
4646                (
4647                    <fidl_fuchsia_net::Ipv6Address as fidl::encoding::ValueTypeMarker>::borrow(
4648                        &self.unicast_source,
4649                    ),
4650                    <fidl_fuchsia_net::Ipv6Address as fidl::encoding::ValueTypeMarker>::borrow(
4651                        &self.multicast_destination,
4652                    ),
4653                ),
4654                encoder,
4655                offset,
4656                _depth,
4657            )
4658        }
4659    }
4660    unsafe impl<
4661            D: fidl::encoding::ResourceDialect,
4662            T0: fidl::encoding::Encode<fidl_fuchsia_net::Ipv6Address, D>,
4663            T1: fidl::encoding::Encode<fidl_fuchsia_net::Ipv6Address, D>,
4664        > fidl::encoding::Encode<Ipv6UnicastSourceAndMulticastDestination, D> for (T0, T1)
4665    {
4666        #[inline]
4667        unsafe fn encode(
4668            self,
4669            encoder: &mut fidl::encoding::Encoder<'_, D>,
4670            offset: usize,
4671            depth: fidl::encoding::Depth,
4672        ) -> fidl::Result<()> {
4673            encoder.debug_check_bounds::<Ipv6UnicastSourceAndMulticastDestination>(offset);
4674            // Zero out padding regions. There's no need to apply masks
4675            // because the unmasked parts will be overwritten by fields.
4676            // Write the fields.
4677            self.0.encode(encoder, offset + 0, depth)?;
4678            self.1.encode(encoder, offset + 16, depth)?;
4679            Ok(())
4680        }
4681    }
4682
4683    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
4684        for Ipv6UnicastSourceAndMulticastDestination
4685    {
4686        #[inline(always)]
4687        fn new_empty() -> Self {
4688            Self {
4689                unicast_source: fidl::new_empty!(fidl_fuchsia_net::Ipv6Address, D),
4690                multicast_destination: fidl::new_empty!(fidl_fuchsia_net::Ipv6Address, D),
4691            }
4692        }
4693
4694        #[inline]
4695        unsafe fn decode(
4696            &mut self,
4697            decoder: &mut fidl::encoding::Decoder<'_, D>,
4698            offset: usize,
4699            _depth: fidl::encoding::Depth,
4700        ) -> fidl::Result<()> {
4701            decoder.debug_check_bounds::<Self>(offset);
4702            // Verify that padding bytes are zero.
4703            fidl::decode!(
4704                fidl_fuchsia_net::Ipv6Address,
4705                D,
4706                &mut self.unicast_source,
4707                decoder,
4708                offset + 0,
4709                _depth
4710            )?;
4711            fidl::decode!(
4712                fidl_fuchsia_net::Ipv6Address,
4713                D,
4714                &mut self.multicast_destination,
4715                decoder,
4716                offset + 16,
4717                _depth
4718            )?;
4719            Ok(())
4720        }
4721    }
4722
4723    impl fidl::encoding::ValueTypeMarker for OutgoingInterfaces {
4724        type Borrowed<'a> = &'a Self;
4725        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4726            value
4727        }
4728    }
4729
4730    unsafe impl fidl::encoding::TypeMarker for OutgoingInterfaces {
4731        type Owned = Self;
4732
4733        #[inline(always)]
4734        fn inline_align(_context: fidl::encoding::Context) -> usize {
4735            8
4736        }
4737
4738        #[inline(always)]
4739        fn inline_size(_context: fidl::encoding::Context) -> usize {
4740            16
4741        }
4742    }
4743
4744    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OutgoingInterfaces, D>
4745        for &OutgoingInterfaces
4746    {
4747        #[inline]
4748        unsafe fn encode(
4749            self,
4750            encoder: &mut fidl::encoding::Encoder<'_, D>,
4751            offset: usize,
4752            _depth: fidl::encoding::Depth,
4753        ) -> fidl::Result<()> {
4754            encoder.debug_check_bounds::<OutgoingInterfaces>(offset);
4755            unsafe {
4756                // Copy the object into the buffer.
4757                let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
4758                (buf_ptr as *mut OutgoingInterfaces)
4759                    .write_unaligned((self as *const OutgoingInterfaces).read());
4760                // Zero out padding regions. Unlike `fidl_struct_impl_noncopy!`, this must be
4761                // done second because the memcpy will write garbage to these bytes.
4762                let padding_ptr = buf_ptr.offset(8) as *mut u64;
4763                let padding_mask = 0xffffffffffffff00u64;
4764                padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
4765            }
4766            Ok(())
4767        }
4768    }
4769    unsafe impl<
4770            D: fidl::encoding::ResourceDialect,
4771            T0: fidl::encoding::Encode<u64, D>,
4772            T1: fidl::encoding::Encode<u8, D>,
4773        > fidl::encoding::Encode<OutgoingInterfaces, D> for (T0, T1)
4774    {
4775        #[inline]
4776        unsafe fn encode(
4777            self,
4778            encoder: &mut fidl::encoding::Encoder<'_, D>,
4779            offset: usize,
4780            depth: fidl::encoding::Depth,
4781        ) -> fidl::Result<()> {
4782            encoder.debug_check_bounds::<OutgoingInterfaces>(offset);
4783            // Zero out padding regions. There's no need to apply masks
4784            // because the unmasked parts will be overwritten by fields.
4785            unsafe {
4786                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4787                (ptr as *mut u64).write_unaligned(0);
4788            }
4789            // Write the fields.
4790            self.0.encode(encoder, offset + 0, depth)?;
4791            self.1.encode(encoder, offset + 8, depth)?;
4792            Ok(())
4793        }
4794    }
4795
4796    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OutgoingInterfaces {
4797        #[inline(always)]
4798        fn new_empty() -> Self {
4799            Self { id: fidl::new_empty!(u64, D), min_ttl: fidl::new_empty!(u8, D) }
4800        }
4801
4802        #[inline]
4803        unsafe fn decode(
4804            &mut self,
4805            decoder: &mut fidl::encoding::Decoder<'_, D>,
4806            offset: usize,
4807            _depth: fidl::encoding::Depth,
4808        ) -> fidl::Result<()> {
4809            decoder.debug_check_bounds::<Self>(offset);
4810            let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
4811            // Verify that padding bytes are zero.
4812            let ptr = unsafe { buf_ptr.offset(8) };
4813            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4814            let mask = 0xffffffffffffff00u64;
4815            let maskedval = padval & mask;
4816            if maskedval != 0 {
4817                return Err(fidl::Error::NonZeroPadding {
4818                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4819                });
4820            }
4821            // Copy from the buffer into the object.
4822            unsafe {
4823                std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
4824            }
4825            Ok(())
4826        }
4827    }
4828
4829    impl Route {
4830        #[inline(always)]
4831        fn max_ordinal_present(&self) -> u64 {
4832            if let Some(_) = self.action {
4833                return 2;
4834            }
4835            if let Some(_) = self.expected_input_interface {
4836                return 1;
4837            }
4838            0
4839        }
4840    }
4841
4842    impl fidl::encoding::ValueTypeMarker for Route {
4843        type Borrowed<'a> = &'a Self;
4844        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
4845            value
4846        }
4847    }
4848
4849    unsafe impl fidl::encoding::TypeMarker for Route {
4850        type Owned = Self;
4851
4852        #[inline(always)]
4853        fn inline_align(_context: fidl::encoding::Context) -> usize {
4854            8
4855        }
4856
4857        #[inline(always)]
4858        fn inline_size(_context: fidl::encoding::Context) -> usize {
4859            16
4860        }
4861    }
4862
4863    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Route, D> for &Route {
4864        unsafe fn encode(
4865            self,
4866            encoder: &mut fidl::encoding::Encoder<'_, D>,
4867            offset: usize,
4868            mut depth: fidl::encoding::Depth,
4869        ) -> fidl::Result<()> {
4870            encoder.debug_check_bounds::<Route>(offset);
4871            // Vector header
4872            let max_ordinal: u64 = self.max_ordinal_present();
4873            encoder.write_num(max_ordinal, offset);
4874            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4875            // Calling encoder.out_of_line_offset(0) is not allowed.
4876            if max_ordinal == 0 {
4877                return Ok(());
4878            }
4879            depth.increment()?;
4880            let envelope_size = 8;
4881            let bytes_len = max_ordinal as usize * envelope_size;
4882            #[allow(unused_variables)]
4883            let offset = encoder.out_of_line_offset(bytes_len);
4884            let mut _prev_end_offset: usize = 0;
4885            if 1 > max_ordinal {
4886                return Ok(());
4887            }
4888
4889            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4890            // are envelope_size bytes.
4891            let cur_offset: usize = (1 - 1) * envelope_size;
4892
4893            // Zero reserved fields.
4894            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4895
4896            // Safety:
4897            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4898            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4899            //   envelope_size bytes, there is always sufficient room.
4900            fidl::encoding::encode_in_envelope_optional::<u64, D>(
4901                self.expected_input_interface
4902                    .as_ref()
4903                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
4904                encoder,
4905                offset + cur_offset,
4906                depth,
4907            )?;
4908
4909            _prev_end_offset = cur_offset + envelope_size;
4910            if 2 > max_ordinal {
4911                return Ok(());
4912            }
4913
4914            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4915            // are envelope_size bytes.
4916            let cur_offset: usize = (2 - 1) * envelope_size;
4917
4918            // Zero reserved fields.
4919            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4920
4921            // Safety:
4922            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4923            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4924            //   envelope_size bytes, there is always sufficient room.
4925            fidl::encoding::encode_in_envelope_optional::<Action, D>(
4926                self.action.as_ref().map(<Action as fidl::encoding::ValueTypeMarker>::borrow),
4927                encoder,
4928                offset + cur_offset,
4929                depth,
4930            )?;
4931
4932            _prev_end_offset = cur_offset + envelope_size;
4933
4934            Ok(())
4935        }
4936    }
4937
4938    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Route {
4939        #[inline(always)]
4940        fn new_empty() -> Self {
4941            Self::default()
4942        }
4943
4944        unsafe fn decode(
4945            &mut self,
4946            decoder: &mut fidl::encoding::Decoder<'_, D>,
4947            offset: usize,
4948            mut depth: fidl::encoding::Depth,
4949        ) -> fidl::Result<()> {
4950            decoder.debug_check_bounds::<Self>(offset);
4951            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4952                None => return Err(fidl::Error::NotNullable),
4953                Some(len) => len,
4954            };
4955            // Calling decoder.out_of_line_offset(0) is not allowed.
4956            if len == 0 {
4957                return Ok(());
4958            };
4959            depth.increment()?;
4960            let envelope_size = 8;
4961            let bytes_len = len * envelope_size;
4962            let offset = decoder.out_of_line_offset(bytes_len)?;
4963            // Decode the envelope for each type.
4964            let mut _next_ordinal_to_read = 0;
4965            let mut next_offset = offset;
4966            let end_offset = offset + bytes_len;
4967            _next_ordinal_to_read += 1;
4968            if next_offset >= end_offset {
4969                return Ok(());
4970            }
4971
4972            // Decode unknown envelopes for gaps in ordinals.
4973            while _next_ordinal_to_read < 1 {
4974                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4975                _next_ordinal_to_read += 1;
4976                next_offset += envelope_size;
4977            }
4978
4979            let next_out_of_line = decoder.next_out_of_line();
4980            let handles_before = decoder.remaining_handles();
4981            if let Some((inlined, num_bytes, num_handles)) =
4982                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4983            {
4984                let member_inline_size =
4985                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4986                if inlined != (member_inline_size <= 4) {
4987                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4988                }
4989                let inner_offset;
4990                let mut inner_depth = depth.clone();
4991                if inlined {
4992                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4993                    inner_offset = next_offset;
4994                } else {
4995                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4996                    inner_depth.increment()?;
4997                }
4998                let val_ref =
4999                    self.expected_input_interface.get_or_insert_with(|| fidl::new_empty!(u64, D));
5000                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5001                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5002                {
5003                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5004                }
5005                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5006                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5007                }
5008            }
5009
5010            next_offset += envelope_size;
5011            _next_ordinal_to_read += 1;
5012            if next_offset >= end_offset {
5013                return Ok(());
5014            }
5015
5016            // Decode unknown envelopes for gaps in ordinals.
5017            while _next_ordinal_to_read < 2 {
5018                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5019                _next_ordinal_to_read += 1;
5020                next_offset += envelope_size;
5021            }
5022
5023            let next_out_of_line = decoder.next_out_of_line();
5024            let handles_before = decoder.remaining_handles();
5025            if let Some((inlined, num_bytes, num_handles)) =
5026                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5027            {
5028                let member_inline_size =
5029                    <Action as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5030                if inlined != (member_inline_size <= 4) {
5031                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5032                }
5033                let inner_offset;
5034                let mut inner_depth = depth.clone();
5035                if inlined {
5036                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5037                    inner_offset = next_offset;
5038                } else {
5039                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5040                    inner_depth.increment()?;
5041                }
5042                let val_ref = self.action.get_or_insert_with(|| fidl::new_empty!(Action, D));
5043                fidl::decode!(Action, D, val_ref, decoder, inner_offset, inner_depth)?;
5044                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5045                {
5046                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5047                }
5048                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5049                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5050                }
5051            }
5052
5053            next_offset += envelope_size;
5054
5055            // Decode the remaining unknown envelopes.
5056            while next_offset < end_offset {
5057                _next_ordinal_to_read += 1;
5058                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5059                next_offset += envelope_size;
5060            }
5061
5062            Ok(())
5063        }
5064    }
5065
5066    impl RouteStats {
5067        #[inline(always)]
5068        fn max_ordinal_present(&self) -> u64 {
5069            if let Some(_) = self.last_used {
5070                return 1;
5071            }
5072            0
5073        }
5074    }
5075
5076    impl fidl::encoding::ValueTypeMarker for RouteStats {
5077        type Borrowed<'a> = &'a Self;
5078        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5079            value
5080        }
5081    }
5082
5083    unsafe impl fidl::encoding::TypeMarker for RouteStats {
5084        type Owned = Self;
5085
5086        #[inline(always)]
5087        fn inline_align(_context: fidl::encoding::Context) -> usize {
5088            8
5089        }
5090
5091        #[inline(always)]
5092        fn inline_size(_context: fidl::encoding::Context) -> usize {
5093            16
5094        }
5095    }
5096
5097    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RouteStats, D>
5098        for &RouteStats
5099    {
5100        unsafe fn encode(
5101            self,
5102            encoder: &mut fidl::encoding::Encoder<'_, D>,
5103            offset: usize,
5104            mut depth: fidl::encoding::Depth,
5105        ) -> fidl::Result<()> {
5106            encoder.debug_check_bounds::<RouteStats>(offset);
5107            // Vector header
5108            let max_ordinal: u64 = self.max_ordinal_present();
5109            encoder.write_num(max_ordinal, offset);
5110            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5111            // Calling encoder.out_of_line_offset(0) is not allowed.
5112            if max_ordinal == 0 {
5113                return Ok(());
5114            }
5115            depth.increment()?;
5116            let envelope_size = 8;
5117            let bytes_len = max_ordinal as usize * envelope_size;
5118            #[allow(unused_variables)]
5119            let offset = encoder.out_of_line_offset(bytes_len);
5120            let mut _prev_end_offset: usize = 0;
5121            if 1 > max_ordinal {
5122                return Ok(());
5123            }
5124
5125            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5126            // are envelope_size bytes.
5127            let cur_offset: usize = (1 - 1) * envelope_size;
5128
5129            // Zero reserved fields.
5130            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5131
5132            // Safety:
5133            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5134            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5135            //   envelope_size bytes, there is always sufficient room.
5136            fidl::encoding::encode_in_envelope_optional::<i64, D>(
5137                self.last_used.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
5138                encoder,
5139                offset + cur_offset,
5140                depth,
5141            )?;
5142
5143            _prev_end_offset = cur_offset + envelope_size;
5144
5145            Ok(())
5146        }
5147    }
5148
5149    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RouteStats {
5150        #[inline(always)]
5151        fn new_empty() -> Self {
5152            Self::default()
5153        }
5154
5155        unsafe fn decode(
5156            &mut self,
5157            decoder: &mut fidl::encoding::Decoder<'_, D>,
5158            offset: usize,
5159            mut depth: fidl::encoding::Depth,
5160        ) -> fidl::Result<()> {
5161            decoder.debug_check_bounds::<Self>(offset);
5162            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5163                None => return Err(fidl::Error::NotNullable),
5164                Some(len) => len,
5165            };
5166            // Calling decoder.out_of_line_offset(0) is not allowed.
5167            if len == 0 {
5168                return Ok(());
5169            };
5170            depth.increment()?;
5171            let envelope_size = 8;
5172            let bytes_len = len * envelope_size;
5173            let offset = decoder.out_of_line_offset(bytes_len)?;
5174            // Decode the envelope for each type.
5175            let mut _next_ordinal_to_read = 0;
5176            let mut next_offset = offset;
5177            let end_offset = offset + bytes_len;
5178            _next_ordinal_to_read += 1;
5179            if next_offset >= end_offset {
5180                return Ok(());
5181            }
5182
5183            // Decode unknown envelopes for gaps in ordinals.
5184            while _next_ordinal_to_read < 1 {
5185                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5186                _next_ordinal_to_read += 1;
5187                next_offset += envelope_size;
5188            }
5189
5190            let next_out_of_line = decoder.next_out_of_line();
5191            let handles_before = decoder.remaining_handles();
5192            if let Some((inlined, num_bytes, num_handles)) =
5193                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5194            {
5195                let member_inline_size =
5196                    <i64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5197                if inlined != (member_inline_size <= 4) {
5198                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5199                }
5200                let inner_offset;
5201                let mut inner_depth = depth.clone();
5202                if inlined {
5203                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5204                    inner_offset = next_offset;
5205                } else {
5206                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5207                    inner_depth.increment()?;
5208                }
5209                let val_ref = self.last_used.get_or_insert_with(|| fidl::new_empty!(i64, D));
5210                fidl::decode!(i64, D, val_ref, decoder, inner_offset, inner_depth)?;
5211                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5212                {
5213                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5214                }
5215                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5216                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5217                }
5218            }
5219
5220            next_offset += envelope_size;
5221
5222            // Decode the remaining unknown envelopes.
5223            while next_offset < end_offset {
5224                _next_ordinal_to_read += 1;
5225                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5226                next_offset += envelope_size;
5227            }
5228
5229            Ok(())
5230        }
5231    }
5232
5233    impl WrongInputInterface {
5234        #[inline(always)]
5235        fn max_ordinal_present(&self) -> u64 {
5236            if let Some(_) = self.expected_input_interface {
5237                return 1;
5238            }
5239            0
5240        }
5241    }
5242
5243    impl fidl::encoding::ValueTypeMarker for WrongInputInterface {
5244        type Borrowed<'a> = &'a Self;
5245        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5246            value
5247        }
5248    }
5249
5250    unsafe impl fidl::encoding::TypeMarker for WrongInputInterface {
5251        type Owned = Self;
5252
5253        #[inline(always)]
5254        fn inline_align(_context: fidl::encoding::Context) -> usize {
5255            8
5256        }
5257
5258        #[inline(always)]
5259        fn inline_size(_context: fidl::encoding::Context) -> usize {
5260            16
5261        }
5262    }
5263
5264    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WrongInputInterface, D>
5265        for &WrongInputInterface
5266    {
5267        unsafe fn encode(
5268            self,
5269            encoder: &mut fidl::encoding::Encoder<'_, D>,
5270            offset: usize,
5271            mut depth: fidl::encoding::Depth,
5272        ) -> fidl::Result<()> {
5273            encoder.debug_check_bounds::<WrongInputInterface>(offset);
5274            // Vector header
5275            let max_ordinal: u64 = self.max_ordinal_present();
5276            encoder.write_num(max_ordinal, offset);
5277            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
5278            // Calling encoder.out_of_line_offset(0) is not allowed.
5279            if max_ordinal == 0 {
5280                return Ok(());
5281            }
5282            depth.increment()?;
5283            let envelope_size = 8;
5284            let bytes_len = max_ordinal as usize * envelope_size;
5285            #[allow(unused_variables)]
5286            let offset = encoder.out_of_line_offset(bytes_len);
5287            let mut _prev_end_offset: usize = 0;
5288            if 1 > max_ordinal {
5289                return Ok(());
5290            }
5291
5292            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5293            // are envelope_size bytes.
5294            let cur_offset: usize = (1 - 1) * envelope_size;
5295
5296            // Zero reserved fields.
5297            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5298
5299            // Safety:
5300            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5301            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5302            //   envelope_size bytes, there is always sufficient room.
5303            fidl::encoding::encode_in_envelope_optional::<u64, D>(
5304                self.expected_input_interface
5305                    .as_ref()
5306                    .map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
5307                encoder,
5308                offset + cur_offset,
5309                depth,
5310            )?;
5311
5312            _prev_end_offset = cur_offset + envelope_size;
5313
5314            Ok(())
5315        }
5316    }
5317
5318    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WrongInputInterface {
5319        #[inline(always)]
5320        fn new_empty() -> Self {
5321            Self::default()
5322        }
5323
5324        unsafe fn decode(
5325            &mut self,
5326            decoder: &mut fidl::encoding::Decoder<'_, D>,
5327            offset: usize,
5328            mut depth: fidl::encoding::Depth,
5329        ) -> fidl::Result<()> {
5330            decoder.debug_check_bounds::<Self>(offset);
5331            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5332                None => return Err(fidl::Error::NotNullable),
5333                Some(len) => len,
5334            };
5335            // Calling decoder.out_of_line_offset(0) is not allowed.
5336            if len == 0 {
5337                return Ok(());
5338            };
5339            depth.increment()?;
5340            let envelope_size = 8;
5341            let bytes_len = len * envelope_size;
5342            let offset = decoder.out_of_line_offset(bytes_len)?;
5343            // Decode the envelope for each type.
5344            let mut _next_ordinal_to_read = 0;
5345            let mut next_offset = offset;
5346            let end_offset = offset + bytes_len;
5347            _next_ordinal_to_read += 1;
5348            if next_offset >= end_offset {
5349                return Ok(());
5350            }
5351
5352            // Decode unknown envelopes for gaps in ordinals.
5353            while _next_ordinal_to_read < 1 {
5354                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5355                _next_ordinal_to_read += 1;
5356                next_offset += envelope_size;
5357            }
5358
5359            let next_out_of_line = decoder.next_out_of_line();
5360            let handles_before = decoder.remaining_handles();
5361            if let Some((inlined, num_bytes, num_handles)) =
5362                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5363            {
5364                let member_inline_size =
5365                    <u64 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5366                if inlined != (member_inline_size <= 4) {
5367                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5368                }
5369                let inner_offset;
5370                let mut inner_depth = depth.clone();
5371                if inlined {
5372                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5373                    inner_offset = next_offset;
5374                } else {
5375                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5376                    inner_depth.increment()?;
5377                }
5378                let val_ref =
5379                    self.expected_input_interface.get_or_insert_with(|| fidl::new_empty!(u64, D));
5380                fidl::decode!(u64, D, val_ref, decoder, inner_offset, inner_depth)?;
5381                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5382                {
5383                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5384                }
5385                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5386                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5387                }
5388            }
5389
5390            next_offset += envelope_size;
5391
5392            // Decode the remaining unknown envelopes.
5393            while next_offset < end_offset {
5394                _next_ordinal_to_read += 1;
5395                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5396                next_offset += envelope_size;
5397            }
5398
5399            Ok(())
5400        }
5401    }
5402
5403    impl fidl::encoding::ValueTypeMarker for Action {
5404        type Borrowed<'a> = &'a Self;
5405        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5406            value
5407        }
5408    }
5409
5410    unsafe impl fidl::encoding::TypeMarker for Action {
5411        type Owned = Self;
5412
5413        #[inline(always)]
5414        fn inline_align(_context: fidl::encoding::Context) -> usize {
5415            8
5416        }
5417
5418        #[inline(always)]
5419        fn inline_size(_context: fidl::encoding::Context) -> usize {
5420            16
5421        }
5422    }
5423
5424    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Action, D> for &Action {
5425        #[inline]
5426        unsafe fn encode(
5427            self,
5428            encoder: &mut fidl::encoding::Encoder<'_, D>,
5429            offset: usize,
5430            _depth: fidl::encoding::Depth,
5431        ) -> fidl::Result<()> {
5432            encoder.debug_check_bounds::<Action>(offset);
5433            encoder.write_num::<u64>(self.ordinal(), offset);
5434            match self {
5435            Action::OutgoingInterfaces(ref val) => {
5436                fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<OutgoingInterfaces, 32>, D>(
5437                    <fidl::encoding::Vector<OutgoingInterfaces, 32> as fidl::encoding::ValueTypeMarker>::borrow(val),
5438                    encoder, offset + 8, _depth
5439                )
5440            }
5441        }
5442        }
5443    }
5444
5445    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Action {
5446        #[inline(always)]
5447        fn new_empty() -> Self {
5448            Self::OutgoingInterfaces(
5449                fidl::new_empty!(fidl::encoding::Vector<OutgoingInterfaces, 32>, D),
5450            )
5451        }
5452
5453        #[inline]
5454        unsafe fn decode(
5455            &mut self,
5456            decoder: &mut fidl::encoding::Decoder<'_, D>,
5457            offset: usize,
5458            mut depth: fidl::encoding::Depth,
5459        ) -> fidl::Result<()> {
5460            decoder.debug_check_bounds::<Self>(offset);
5461            #[allow(unused_variables)]
5462            let next_out_of_line = decoder.next_out_of_line();
5463            let handles_before = decoder.remaining_handles();
5464            let (ordinal, inlined, num_bytes, num_handles) =
5465                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
5466
5467            let member_inline_size = match ordinal {
5468            1 => <fidl::encoding::Vector<OutgoingInterfaces, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5469            _ => return Err(fidl::Error::UnknownUnionTag),
5470        };
5471
5472            if inlined != (member_inline_size <= 4) {
5473                return Err(fidl::Error::InvalidInlineBitInEnvelope);
5474            }
5475            let _inner_offset;
5476            if inlined {
5477                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
5478                _inner_offset = offset + 8;
5479            } else {
5480                depth.increment()?;
5481                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5482            }
5483            match ordinal {
5484                1 => {
5485                    #[allow(irrefutable_let_patterns)]
5486                    if let Action::OutgoingInterfaces(_) = self {
5487                        // Do nothing, read the value into the object
5488                    } else {
5489                        // Initialize `self` to the right variant
5490                        *self = Action::OutgoingInterfaces(
5491                            fidl::new_empty!(fidl::encoding::Vector<OutgoingInterfaces, 32>, D),
5492                        );
5493                    }
5494                    #[allow(irrefutable_let_patterns)]
5495                    if let Action::OutgoingInterfaces(ref mut val) = self {
5496                        fidl::decode!(fidl::encoding::Vector<OutgoingInterfaces, 32>, D, val, decoder, _inner_offset, depth)?;
5497                    } else {
5498                        unreachable!()
5499                    }
5500                }
5501                ordinal => panic!("unexpected ordinal {:?}", ordinal),
5502            }
5503            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
5504                return Err(fidl::Error::InvalidNumBytesInEnvelope);
5505            }
5506            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5507                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5508            }
5509            Ok(())
5510        }
5511    }
5512
5513    impl fidl::encoding::ValueTypeMarker for RoutingEvent {
5514        type Borrowed<'a> = &'a Self;
5515        fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
5516            value
5517        }
5518    }
5519
5520    unsafe impl fidl::encoding::TypeMarker for RoutingEvent {
5521        type Owned = Self;
5522
5523        #[inline(always)]
5524        fn inline_align(_context: fidl::encoding::Context) -> usize {
5525            8
5526        }
5527
5528        #[inline(always)]
5529        fn inline_size(_context: fidl::encoding::Context) -> usize {
5530            16
5531        }
5532    }
5533
5534    unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RoutingEvent, D>
5535        for &RoutingEvent
5536    {
5537        #[inline]
5538        unsafe fn encode(
5539            self,
5540            encoder: &mut fidl::encoding::Encoder<'_, D>,
5541            offset: usize,
5542            _depth: fidl::encoding::Depth,
5543        ) -> fidl::Result<()> {
5544            encoder.debug_check_bounds::<RoutingEvent>(offset);
5545            encoder.write_num::<u64>(self.ordinal(), offset);
5546            match self {
5547                RoutingEvent::MissingRoute(ref val) => {
5548                    fidl::encoding::encode_in_envelope::<Empty, D>(
5549                        <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
5550                        encoder,
5551                        offset + 8,
5552                        _depth,
5553                    )
5554                }
5555                RoutingEvent::WrongInputInterface(ref val) => {
5556                    fidl::encoding::encode_in_envelope::<WrongInputInterface, D>(
5557                        <WrongInputInterface as fidl::encoding::ValueTypeMarker>::borrow(val),
5558                        encoder,
5559                        offset + 8,
5560                        _depth,
5561                    )
5562                }
5563            }
5564        }
5565    }
5566
5567    impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RoutingEvent {
5568        #[inline(always)]
5569        fn new_empty() -> Self {
5570            Self::MissingRoute(fidl::new_empty!(Empty, D))
5571        }
5572
5573        #[inline]
5574        unsafe fn decode(
5575            &mut self,
5576            decoder: &mut fidl::encoding::Decoder<'_, D>,
5577            offset: usize,
5578            mut depth: fidl::encoding::Depth,
5579        ) -> fidl::Result<()> {
5580            decoder.debug_check_bounds::<Self>(offset);
5581            #[allow(unused_variables)]
5582            let next_out_of_line = decoder.next_out_of_line();
5583            let handles_before = decoder.remaining_handles();
5584            let (ordinal, inlined, num_bytes, num_handles) =
5585                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
5586
5587            let member_inline_size = match ordinal {
5588                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5589                2 => <WrongInputInterface as fidl::encoding::TypeMarker>::inline_size(
5590                    decoder.context,
5591                ),
5592                _ => return Err(fidl::Error::UnknownUnionTag),
5593            };
5594
5595            if inlined != (member_inline_size <= 4) {
5596                return Err(fidl::Error::InvalidInlineBitInEnvelope);
5597            }
5598            let _inner_offset;
5599            if inlined {
5600                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
5601                _inner_offset = offset + 8;
5602            } else {
5603                depth.increment()?;
5604                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5605            }
5606            match ordinal {
5607                1 => {
5608                    #[allow(irrefutable_let_patterns)]
5609                    if let RoutingEvent::MissingRoute(_) = self {
5610                        // Do nothing, read the value into the object
5611                    } else {
5612                        // Initialize `self` to the right variant
5613                        *self = RoutingEvent::MissingRoute(fidl::new_empty!(Empty, D));
5614                    }
5615                    #[allow(irrefutable_let_patterns)]
5616                    if let RoutingEvent::MissingRoute(ref mut val) = self {
5617                        fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
5618                    } else {
5619                        unreachable!()
5620                    }
5621                }
5622                2 => {
5623                    #[allow(irrefutable_let_patterns)]
5624                    if let RoutingEvent::WrongInputInterface(_) = self {
5625                        // Do nothing, read the value into the object
5626                    } else {
5627                        // Initialize `self` to the right variant
5628                        *self = RoutingEvent::WrongInputInterface(fidl::new_empty!(
5629                            WrongInputInterface,
5630                            D
5631                        ));
5632                    }
5633                    #[allow(irrefutable_let_patterns)]
5634                    if let RoutingEvent::WrongInputInterface(ref mut val) = self {
5635                        fidl::decode!(WrongInputInterface, D, val, decoder, _inner_offset, depth)?;
5636                    } else {
5637                        unreachable!()
5638                    }
5639                }
5640                ordinal => panic!("unexpected ordinal {:?}", ordinal),
5641            }
5642            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
5643                return Err(fidl::Error::InvalidNumBytesInEnvelope);
5644            }
5645            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5646                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5647            }
5648            Ok(())
5649        }
5650    }
5651}