fidl_fuchsia_net_root/
fidl_fuchsia_net_root.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 _};
10pub use fidl_fuchsia_net_root__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct FilterOpenControllerRequest {
16    pub id: String,
17    pub request: fidl::endpoints::ServerEnd<fidl_fuchsia_net_filter::NamespaceControllerMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for FilterOpenControllerRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct InterfacesGetAdminRequest {
27    pub id: u64,
28    pub control: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for InterfacesGetAdminRequest {}
32
33#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
34pub struct RoutesV4GlobalRouteSetRequest {
35    pub route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV4Marker>,
36}
37
38impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
39    for RoutesV4GlobalRouteSetRequest
40{
41}
42
43#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
44pub struct RoutesV6GlobalRouteSetRequest {
45    pub route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV6Marker>,
46}
47
48impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
49    for RoutesV6GlobalRouteSetRequest
50{
51}
52
53#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
54pub struct FilterMarker;
55
56impl fidl::endpoints::ProtocolMarker for FilterMarker {
57    type Proxy = FilterProxy;
58    type RequestStream = FilterRequestStream;
59    #[cfg(target_os = "fuchsia")]
60    type SynchronousProxy = FilterSynchronousProxy;
61
62    const DEBUG_NAME: &'static str = "fuchsia.net.root.Filter";
63}
64impl fidl::endpoints::DiscoverableProtocolMarker for FilterMarker {}
65
66pub trait FilterProxyInterface: Send + Sync {
67    fn r#open_controller(
68        &self,
69        id: &str,
70        request: fidl::endpoints::ServerEnd<fidl_fuchsia_net_filter::NamespaceControllerMarker>,
71    ) -> Result<(), fidl::Error>;
72}
73#[derive(Debug)]
74#[cfg(target_os = "fuchsia")]
75pub struct FilterSynchronousProxy {
76    client: fidl::client::sync::Client,
77}
78
79#[cfg(target_os = "fuchsia")]
80impl fidl::endpoints::SynchronousProxy for FilterSynchronousProxy {
81    type Proxy = FilterProxy;
82    type Protocol = FilterMarker;
83
84    fn from_channel(inner: fidl::Channel) -> Self {
85        Self::new(inner)
86    }
87
88    fn into_channel(self) -> fidl::Channel {
89        self.client.into_channel()
90    }
91
92    fn as_channel(&self) -> &fidl::Channel {
93        self.client.as_channel()
94    }
95}
96
97#[cfg(target_os = "fuchsia")]
98impl FilterSynchronousProxy {
99    pub fn new(channel: fidl::Channel) -> Self {
100        let protocol_name = <FilterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
101        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
102    }
103
104    pub fn into_channel(self) -> fidl::Channel {
105        self.client.into_channel()
106    }
107
108    /// Waits until an event arrives and returns it. It is safe for other
109    /// threads to make concurrent requests while waiting for an event.
110    pub fn wait_for_event(
111        &self,
112        deadline: zx::MonotonicInstant,
113    ) -> Result<FilterEvent, fidl::Error> {
114        FilterEvent::decode(self.client.wait_for_event(deadline)?)
115    }
116
117    /// Open a new *or* existing `NamespaceController`. The server end is
118    /// "auto-detached": in other words, it behaves as if the client has called
119    /// `Detach` on creation, and the lifetime of the filtering state is not
120    /// tied to the client end of the protocol. If the client does call
121    /// `Detach` on the `NamespaceController`, the server will close the
122    /// channel.
123    ///
124    /// Clients have unilateral access to add or remove resources owned by the
125    /// controller, irrespective of other clients' ownership. This includes the
126    /// ability to remove resources installed by other clients.
127    pub fn r#open_controller(
128        &self,
129        mut id: &str,
130        mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_net_filter::NamespaceControllerMarker>,
131    ) -> Result<(), fidl::Error> {
132        self.client.send::<FilterOpenControllerRequest>(
133            (id, request),
134            0x4f8742ed854ea1d1,
135            fidl::encoding::DynamicFlags::empty(),
136        )
137    }
138}
139
140#[cfg(target_os = "fuchsia")]
141impl From<FilterSynchronousProxy> for zx::Handle {
142    fn from(value: FilterSynchronousProxy) -> Self {
143        value.into_channel().into()
144    }
145}
146
147#[cfg(target_os = "fuchsia")]
148impl From<fidl::Channel> for FilterSynchronousProxy {
149    fn from(value: fidl::Channel) -> Self {
150        Self::new(value)
151    }
152}
153
154#[cfg(target_os = "fuchsia")]
155impl fidl::endpoints::FromClient for FilterSynchronousProxy {
156    type Protocol = FilterMarker;
157
158    fn from_client(value: fidl::endpoints::ClientEnd<FilterMarker>) -> Self {
159        Self::new(value.into_channel())
160    }
161}
162
163#[derive(Debug, Clone)]
164pub struct FilterProxy {
165    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
166}
167
168impl fidl::endpoints::Proxy for FilterProxy {
169    type Protocol = FilterMarker;
170
171    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
172        Self::new(inner)
173    }
174
175    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
176        self.client.into_channel().map_err(|client| Self { client })
177    }
178
179    fn as_channel(&self) -> &::fidl::AsyncChannel {
180        self.client.as_channel()
181    }
182}
183
184impl FilterProxy {
185    /// Create a new Proxy for fuchsia.net.root/Filter.
186    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
187        let protocol_name = <FilterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
188        Self { client: fidl::client::Client::new(channel, protocol_name) }
189    }
190
191    /// Get a Stream of events from the remote end of the protocol.
192    ///
193    /// # Panics
194    ///
195    /// Panics if the event stream was already taken.
196    pub fn take_event_stream(&self) -> FilterEventStream {
197        FilterEventStream { event_receiver: self.client.take_event_receiver() }
198    }
199
200    /// Open a new *or* existing `NamespaceController`. The server end is
201    /// "auto-detached": in other words, it behaves as if the client has called
202    /// `Detach` on creation, and the lifetime of the filtering state is not
203    /// tied to the client end of the protocol. If the client does call
204    /// `Detach` on the `NamespaceController`, the server will close the
205    /// channel.
206    ///
207    /// Clients have unilateral access to add or remove resources owned by the
208    /// controller, irrespective of other clients' ownership. This includes the
209    /// ability to remove resources installed by other clients.
210    pub fn r#open_controller(
211        &self,
212        mut id: &str,
213        mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_net_filter::NamespaceControllerMarker>,
214    ) -> Result<(), fidl::Error> {
215        FilterProxyInterface::r#open_controller(self, id, request)
216    }
217}
218
219impl FilterProxyInterface for FilterProxy {
220    fn r#open_controller(
221        &self,
222        mut id: &str,
223        mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_net_filter::NamespaceControllerMarker>,
224    ) -> Result<(), fidl::Error> {
225        self.client.send::<FilterOpenControllerRequest>(
226            (id, request),
227            0x4f8742ed854ea1d1,
228            fidl::encoding::DynamicFlags::empty(),
229        )
230    }
231}
232
233pub struct FilterEventStream {
234    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
235}
236
237impl std::marker::Unpin for FilterEventStream {}
238
239impl futures::stream::FusedStream for FilterEventStream {
240    fn is_terminated(&self) -> bool {
241        self.event_receiver.is_terminated()
242    }
243}
244
245impl futures::Stream for FilterEventStream {
246    type Item = Result<FilterEvent, fidl::Error>;
247
248    fn poll_next(
249        mut self: std::pin::Pin<&mut Self>,
250        cx: &mut std::task::Context<'_>,
251    ) -> std::task::Poll<Option<Self::Item>> {
252        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
253            &mut self.event_receiver,
254            cx
255        )?) {
256            Some(buf) => std::task::Poll::Ready(Some(FilterEvent::decode(buf))),
257            None => std::task::Poll::Ready(None),
258        }
259    }
260}
261
262#[derive(Debug)]
263pub enum FilterEvent {}
264
265impl FilterEvent {
266    /// Decodes a message buffer as a [`FilterEvent`].
267    fn decode(
268        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
269    ) -> Result<FilterEvent, fidl::Error> {
270        let (bytes, _handles) = buf.split_mut();
271        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
272        debug_assert_eq!(tx_header.tx_id, 0);
273        match tx_header.ordinal {
274            _ => Err(fidl::Error::UnknownOrdinal {
275                ordinal: tx_header.ordinal,
276                protocol_name: <FilterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
277            }),
278        }
279    }
280}
281
282/// A Stream of incoming requests for fuchsia.net.root/Filter.
283pub struct FilterRequestStream {
284    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
285    is_terminated: bool,
286}
287
288impl std::marker::Unpin for FilterRequestStream {}
289
290impl futures::stream::FusedStream for FilterRequestStream {
291    fn is_terminated(&self) -> bool {
292        self.is_terminated
293    }
294}
295
296impl fidl::endpoints::RequestStream for FilterRequestStream {
297    type Protocol = FilterMarker;
298    type ControlHandle = FilterControlHandle;
299
300    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
301        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
302    }
303
304    fn control_handle(&self) -> Self::ControlHandle {
305        FilterControlHandle { inner: self.inner.clone() }
306    }
307
308    fn into_inner(
309        self,
310    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
311    {
312        (self.inner, self.is_terminated)
313    }
314
315    fn from_inner(
316        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
317        is_terminated: bool,
318    ) -> Self {
319        Self { inner, is_terminated }
320    }
321}
322
323impl futures::Stream for FilterRequestStream {
324    type Item = Result<FilterRequest, fidl::Error>;
325
326    fn poll_next(
327        mut self: std::pin::Pin<&mut Self>,
328        cx: &mut std::task::Context<'_>,
329    ) -> std::task::Poll<Option<Self::Item>> {
330        let this = &mut *self;
331        if this.inner.check_shutdown(cx) {
332            this.is_terminated = true;
333            return std::task::Poll::Ready(None);
334        }
335        if this.is_terminated {
336            panic!("polled FilterRequestStream after completion");
337        }
338        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
339            |bytes, handles| {
340                match this.inner.channel().read_etc(cx, bytes, handles) {
341                    std::task::Poll::Ready(Ok(())) => {}
342                    std::task::Poll::Pending => return std::task::Poll::Pending,
343                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
344                        this.is_terminated = true;
345                        return std::task::Poll::Ready(None);
346                    }
347                    std::task::Poll::Ready(Err(e)) => {
348                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
349                            e.into(),
350                        ))))
351                    }
352                }
353
354                // A message has been received from the channel
355                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
356
357                std::task::Poll::Ready(Some(match header.ordinal {
358                    0x4f8742ed854ea1d1 => {
359                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
360                        let mut req = fidl::new_empty!(
361                            FilterOpenControllerRequest,
362                            fidl::encoding::DefaultFuchsiaResourceDialect
363                        );
364                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FilterOpenControllerRequest>(&header, _body_bytes, handles, &mut req)?;
365                        let control_handle = FilterControlHandle { inner: this.inner.clone() };
366                        Ok(FilterRequest::OpenController {
367                            id: req.id,
368                            request: req.request,
369
370                            control_handle,
371                        })
372                    }
373                    _ => Err(fidl::Error::UnknownOrdinal {
374                        ordinal: header.ordinal,
375                        protocol_name:
376                            <FilterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
377                    }),
378                }))
379            },
380        )
381    }
382}
383
384/// Provides administrative access to all filtering state.
385///
386/// This protocol provides the ability to bypass regular ownership controls
387/// which allow only the owner of each controller to modify or remove resources
388/// they added.
389///
390/// Circumventing the strong-ownership semantics through use of this protocol
391/// is highly discouraged and applications considering use of this protocol
392/// are encouraged to exhaust other options first by working with the Netstack
393/// team to find an alternative solution.
394#[derive(Debug)]
395pub enum FilterRequest {
396    /// Open a new *or* existing `NamespaceController`. The server end is
397    /// "auto-detached": in other words, it behaves as if the client has called
398    /// `Detach` on creation, and the lifetime of the filtering state is not
399    /// tied to the client end of the protocol. If the client does call
400    /// `Detach` on the `NamespaceController`, the server will close the
401    /// channel.
402    ///
403    /// Clients have unilateral access to add or remove resources owned by the
404    /// controller, irrespective of other clients' ownership. This includes the
405    /// ability to remove resources installed by other clients.
406    OpenController {
407        id: String,
408        request: fidl::endpoints::ServerEnd<fidl_fuchsia_net_filter::NamespaceControllerMarker>,
409        control_handle: FilterControlHandle,
410    },
411}
412
413impl FilterRequest {
414    #[allow(irrefutable_let_patterns)]
415    pub fn into_open_controller(
416        self,
417    ) -> Option<(
418        String,
419        fidl::endpoints::ServerEnd<fidl_fuchsia_net_filter::NamespaceControllerMarker>,
420        FilterControlHandle,
421    )> {
422        if let FilterRequest::OpenController { id, request, control_handle } = self {
423            Some((id, request, control_handle))
424        } else {
425            None
426        }
427    }
428
429    /// Name of the method defined in FIDL
430    pub fn method_name(&self) -> &'static str {
431        match *self {
432            FilterRequest::OpenController { .. } => "open_controller",
433        }
434    }
435}
436
437#[derive(Debug, Clone)]
438pub struct FilterControlHandle {
439    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
440}
441
442impl fidl::endpoints::ControlHandle for FilterControlHandle {
443    fn shutdown(&self) {
444        self.inner.shutdown()
445    }
446    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
447        self.inner.shutdown_with_epitaph(status)
448    }
449
450    fn is_closed(&self) -> bool {
451        self.inner.channel().is_closed()
452    }
453    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
454        self.inner.channel().on_closed()
455    }
456
457    #[cfg(target_os = "fuchsia")]
458    fn signal_peer(
459        &self,
460        clear_mask: zx::Signals,
461        set_mask: zx::Signals,
462    ) -> Result<(), zx_status::Status> {
463        use fidl::Peered;
464        self.inner.channel().signal_peer(clear_mask, set_mask)
465    }
466}
467
468impl FilterControlHandle {}
469
470#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
471pub struct InterfacesMarker;
472
473impl fidl::endpoints::ProtocolMarker for InterfacesMarker {
474    type Proxy = InterfacesProxy;
475    type RequestStream = InterfacesRequestStream;
476    #[cfg(target_os = "fuchsia")]
477    type SynchronousProxy = InterfacesSynchronousProxy;
478
479    const DEBUG_NAME: &'static str = "fuchsia.net.root.Interfaces";
480}
481impl fidl::endpoints::DiscoverableProtocolMarker for InterfacesMarker {}
482pub type InterfacesGetMacResult =
483    Result<Option<Box<fidl_fuchsia_net::MacAddress>>, InterfacesGetMacError>;
484
485pub trait InterfacesProxyInterface: Send + Sync {
486    fn r#get_admin(
487        &self,
488        id: u64,
489        control: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
490    ) -> Result<(), fidl::Error>;
491    type GetMacResponseFut: std::future::Future<Output = Result<InterfacesGetMacResult, fidl::Error>>
492        + Send;
493    fn r#get_mac(&self, id: u64) -> Self::GetMacResponseFut;
494}
495#[derive(Debug)]
496#[cfg(target_os = "fuchsia")]
497pub struct InterfacesSynchronousProxy {
498    client: fidl::client::sync::Client,
499}
500
501#[cfg(target_os = "fuchsia")]
502impl fidl::endpoints::SynchronousProxy for InterfacesSynchronousProxy {
503    type Proxy = InterfacesProxy;
504    type Protocol = InterfacesMarker;
505
506    fn from_channel(inner: fidl::Channel) -> Self {
507        Self::new(inner)
508    }
509
510    fn into_channel(self) -> fidl::Channel {
511        self.client.into_channel()
512    }
513
514    fn as_channel(&self) -> &fidl::Channel {
515        self.client.as_channel()
516    }
517}
518
519#[cfg(target_os = "fuchsia")]
520impl InterfacesSynchronousProxy {
521    pub fn new(channel: fidl::Channel) -> Self {
522        let protocol_name = <InterfacesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
523        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
524    }
525
526    pub fn into_channel(self) -> fidl::Channel {
527        self.client.into_channel()
528    }
529
530    /// Waits until an event arrives and returns it. It is safe for other
531    /// threads to make concurrent requests while waiting for an event.
532    pub fn wait_for_event(
533        &self,
534        deadline: zx::MonotonicInstant,
535    ) -> Result<InterfacesEvent, fidl::Error> {
536        InterfacesEvent::decode(self.client.wait_for_event(deadline)?)
537    }
538
539    /// Obtain administrative control over a network interface.
540    ///
541    /// + request `id` identifies the interface to be controlled.
542    /// + request `control` grants the client administrative control over
543    ///     the interface. Closed without a terminal event if `id` does not
544    ///     match an existing interface.
545    pub fn r#get_admin(
546        &self,
547        mut id: u64,
548        mut control: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
549    ) -> Result<(), fidl::Error> {
550        self.client.send::<InterfacesGetAdminRequest>(
551            (id, control),
552            0x3cdcbf2452babedd,
553            fidl::encoding::DynamicFlags::empty(),
554        )
555    }
556
557    /// Return an interface's MAC address.
558    ///
559    /// + request `id` identifies the interface whose MAC is requested.
560    /// - response `mac` is the interface's MAC address, if it has one.
561    pub fn r#get_mac(
562        &self,
563        mut id: u64,
564        ___deadline: zx::MonotonicInstant,
565    ) -> Result<InterfacesGetMacResult, fidl::Error> {
566        let _response =
567            self.client.send_query::<InterfacesGetMacRequest, fidl::encoding::ResultType<
568                InterfacesGetMacResponse,
569                InterfacesGetMacError,
570            >>(
571                (id,),
572                0x720643bc62a26d61,
573                fidl::encoding::DynamicFlags::empty(),
574                ___deadline,
575            )?;
576        Ok(_response.map(|x| x.mac))
577    }
578}
579
580#[cfg(target_os = "fuchsia")]
581impl From<InterfacesSynchronousProxy> for zx::Handle {
582    fn from(value: InterfacesSynchronousProxy) -> Self {
583        value.into_channel().into()
584    }
585}
586
587#[cfg(target_os = "fuchsia")]
588impl From<fidl::Channel> for InterfacesSynchronousProxy {
589    fn from(value: fidl::Channel) -> Self {
590        Self::new(value)
591    }
592}
593
594#[cfg(target_os = "fuchsia")]
595impl fidl::endpoints::FromClient for InterfacesSynchronousProxy {
596    type Protocol = InterfacesMarker;
597
598    fn from_client(value: fidl::endpoints::ClientEnd<InterfacesMarker>) -> Self {
599        Self::new(value.into_channel())
600    }
601}
602
603#[derive(Debug, Clone)]
604pub struct InterfacesProxy {
605    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
606}
607
608impl fidl::endpoints::Proxy for InterfacesProxy {
609    type Protocol = InterfacesMarker;
610
611    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
612        Self::new(inner)
613    }
614
615    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
616        self.client.into_channel().map_err(|client| Self { client })
617    }
618
619    fn as_channel(&self) -> &::fidl::AsyncChannel {
620        self.client.as_channel()
621    }
622}
623
624impl InterfacesProxy {
625    /// Create a new Proxy for fuchsia.net.root/Interfaces.
626    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
627        let protocol_name = <InterfacesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
628        Self { client: fidl::client::Client::new(channel, protocol_name) }
629    }
630
631    /// Get a Stream of events from the remote end of the protocol.
632    ///
633    /// # Panics
634    ///
635    /// Panics if the event stream was already taken.
636    pub fn take_event_stream(&self) -> InterfacesEventStream {
637        InterfacesEventStream { event_receiver: self.client.take_event_receiver() }
638    }
639
640    /// Obtain administrative control over a network interface.
641    ///
642    /// + request `id` identifies the interface to be controlled.
643    /// + request `control` grants the client administrative control over
644    ///     the interface. Closed without a terminal event if `id` does not
645    ///     match an existing interface.
646    pub fn r#get_admin(
647        &self,
648        mut id: u64,
649        mut control: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
650    ) -> Result<(), fidl::Error> {
651        InterfacesProxyInterface::r#get_admin(self, id, control)
652    }
653
654    /// Return an interface's MAC address.
655    ///
656    /// + request `id` identifies the interface whose MAC is requested.
657    /// - response `mac` is the interface's MAC address, if it has one.
658    pub fn r#get_mac(
659        &self,
660        mut id: u64,
661    ) -> fidl::client::QueryResponseFut<
662        InterfacesGetMacResult,
663        fidl::encoding::DefaultFuchsiaResourceDialect,
664    > {
665        InterfacesProxyInterface::r#get_mac(self, id)
666    }
667}
668
669impl InterfacesProxyInterface for InterfacesProxy {
670    fn r#get_admin(
671        &self,
672        mut id: u64,
673        mut control: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
674    ) -> Result<(), fidl::Error> {
675        self.client.send::<InterfacesGetAdminRequest>(
676            (id, control),
677            0x3cdcbf2452babedd,
678            fidl::encoding::DynamicFlags::empty(),
679        )
680    }
681
682    type GetMacResponseFut = fidl::client::QueryResponseFut<
683        InterfacesGetMacResult,
684        fidl::encoding::DefaultFuchsiaResourceDialect,
685    >;
686    fn r#get_mac(&self, mut id: u64) -> Self::GetMacResponseFut {
687        fn _decode(
688            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
689        ) -> Result<InterfacesGetMacResult, fidl::Error> {
690            let _response = fidl::client::decode_transaction_body::<
691                fidl::encoding::ResultType<InterfacesGetMacResponse, InterfacesGetMacError>,
692                fidl::encoding::DefaultFuchsiaResourceDialect,
693                0x720643bc62a26d61,
694            >(_buf?)?;
695            Ok(_response.map(|x| x.mac))
696        }
697        self.client.send_query_and_decode::<InterfacesGetMacRequest, InterfacesGetMacResult>(
698            (id,),
699            0x720643bc62a26d61,
700            fidl::encoding::DynamicFlags::empty(),
701            _decode,
702        )
703    }
704}
705
706pub struct InterfacesEventStream {
707    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
708}
709
710impl std::marker::Unpin for InterfacesEventStream {}
711
712impl futures::stream::FusedStream for InterfacesEventStream {
713    fn is_terminated(&self) -> bool {
714        self.event_receiver.is_terminated()
715    }
716}
717
718impl futures::Stream for InterfacesEventStream {
719    type Item = Result<InterfacesEvent, fidl::Error>;
720
721    fn poll_next(
722        mut self: std::pin::Pin<&mut Self>,
723        cx: &mut std::task::Context<'_>,
724    ) -> std::task::Poll<Option<Self::Item>> {
725        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
726            &mut self.event_receiver,
727            cx
728        )?) {
729            Some(buf) => std::task::Poll::Ready(Some(InterfacesEvent::decode(buf))),
730            None => std::task::Poll::Ready(None),
731        }
732    }
733}
734
735#[derive(Debug)]
736pub enum InterfacesEvent {}
737
738impl InterfacesEvent {
739    /// Decodes a message buffer as a [`InterfacesEvent`].
740    fn decode(
741        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
742    ) -> Result<InterfacesEvent, fidl::Error> {
743        let (bytes, _handles) = buf.split_mut();
744        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
745        debug_assert_eq!(tx_header.tx_id, 0);
746        match tx_header.ordinal {
747            _ => Err(fidl::Error::UnknownOrdinal {
748                ordinal: tx_header.ordinal,
749                protocol_name: <InterfacesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
750            }),
751        }
752    }
753}
754
755/// A Stream of incoming requests for fuchsia.net.root/Interfaces.
756pub struct InterfacesRequestStream {
757    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
758    is_terminated: bool,
759}
760
761impl std::marker::Unpin for InterfacesRequestStream {}
762
763impl futures::stream::FusedStream for InterfacesRequestStream {
764    fn is_terminated(&self) -> bool {
765        self.is_terminated
766    }
767}
768
769impl fidl::endpoints::RequestStream for InterfacesRequestStream {
770    type Protocol = InterfacesMarker;
771    type ControlHandle = InterfacesControlHandle;
772
773    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
774        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
775    }
776
777    fn control_handle(&self) -> Self::ControlHandle {
778        InterfacesControlHandle { inner: self.inner.clone() }
779    }
780
781    fn into_inner(
782        self,
783    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
784    {
785        (self.inner, self.is_terminated)
786    }
787
788    fn from_inner(
789        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
790        is_terminated: bool,
791    ) -> Self {
792        Self { inner, is_terminated }
793    }
794}
795
796impl futures::Stream for InterfacesRequestStream {
797    type Item = Result<InterfacesRequest, fidl::Error>;
798
799    fn poll_next(
800        mut self: std::pin::Pin<&mut Self>,
801        cx: &mut std::task::Context<'_>,
802    ) -> std::task::Poll<Option<Self::Item>> {
803        let this = &mut *self;
804        if this.inner.check_shutdown(cx) {
805            this.is_terminated = true;
806            return std::task::Poll::Ready(None);
807        }
808        if this.is_terminated {
809            panic!("polled InterfacesRequestStream after completion");
810        }
811        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
812            |bytes, handles| {
813                match this.inner.channel().read_etc(cx, bytes, handles) {
814                    std::task::Poll::Ready(Ok(())) => {}
815                    std::task::Poll::Pending => return std::task::Poll::Pending,
816                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
817                        this.is_terminated = true;
818                        return std::task::Poll::Ready(None);
819                    }
820                    std::task::Poll::Ready(Err(e)) => {
821                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
822                            e.into(),
823                        ))))
824                    }
825                }
826
827                // A message has been received from the channel
828                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
829
830                std::task::Poll::Ready(Some(match header.ordinal {
831                    0x3cdcbf2452babedd => {
832                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
833                        let mut req = fidl::new_empty!(
834                            InterfacesGetAdminRequest,
835                            fidl::encoding::DefaultFuchsiaResourceDialect
836                        );
837                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InterfacesGetAdminRequest>(&header, _body_bytes, handles, &mut req)?;
838                        let control_handle = InterfacesControlHandle { inner: this.inner.clone() };
839                        Ok(InterfacesRequest::GetAdmin {
840                            id: req.id,
841                            control: req.control,
842
843                            control_handle,
844                        })
845                    }
846                    0x720643bc62a26d61 => {
847                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
848                        let mut req = fidl::new_empty!(
849                            InterfacesGetMacRequest,
850                            fidl::encoding::DefaultFuchsiaResourceDialect
851                        );
852                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InterfacesGetMacRequest>(&header, _body_bytes, handles, &mut req)?;
853                        let control_handle = InterfacesControlHandle { inner: this.inner.clone() };
854                        Ok(InterfacesRequest::GetMac {
855                            id: req.id,
856
857                            responder: InterfacesGetMacResponder {
858                                control_handle: std::mem::ManuallyDrop::new(control_handle),
859                                tx_id: header.tx_id,
860                            },
861                        })
862                    }
863                    _ => Err(fidl::Error::UnknownOrdinal {
864                        ordinal: header.ordinal,
865                        protocol_name:
866                            <InterfacesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
867                    }),
868                }))
869            },
870        )
871    }
872}
873
874/// Provides access to installed network interfaces.
875///
876/// This protocol provides the ability to bypass regular ownership-controls
877/// which allow only the interface owner (generally the entity installing the
878/// interface) to perform management operations on an interface.
879///
880/// Circumventing the strong-ownership semantics through use of this protocol
881/// is highly discouraged and applications considering use of this protocol
882/// are encouraged to exhaust other options first by working with the Netstack
883/// team to find an alternative solution.
884#[derive(Debug)]
885pub enum InterfacesRequest {
886    /// Obtain administrative control over a network interface.
887    ///
888    /// + request `id` identifies the interface to be controlled.
889    /// + request `control` grants the client administrative control over
890    ///     the interface. Closed without a terminal event if `id` does not
891    ///     match an existing interface.
892    GetAdmin {
893        id: u64,
894        control: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
895        control_handle: InterfacesControlHandle,
896    },
897    /// Return an interface's MAC address.
898    ///
899    /// + request `id` identifies the interface whose MAC is requested.
900    /// - response `mac` is the interface's MAC address, if it has one.
901    GetMac { id: u64, responder: InterfacesGetMacResponder },
902}
903
904impl InterfacesRequest {
905    #[allow(irrefutable_let_patterns)]
906    pub fn into_get_admin(
907        self,
908    ) -> Option<(
909        u64,
910        fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
911        InterfacesControlHandle,
912    )> {
913        if let InterfacesRequest::GetAdmin { id, control, control_handle } = self {
914            Some((id, control, control_handle))
915        } else {
916            None
917        }
918    }
919
920    #[allow(irrefutable_let_patterns)]
921    pub fn into_get_mac(self) -> Option<(u64, InterfacesGetMacResponder)> {
922        if let InterfacesRequest::GetMac { id, responder } = self {
923            Some((id, responder))
924        } else {
925            None
926        }
927    }
928
929    /// Name of the method defined in FIDL
930    pub fn method_name(&self) -> &'static str {
931        match *self {
932            InterfacesRequest::GetAdmin { .. } => "get_admin",
933            InterfacesRequest::GetMac { .. } => "get_mac",
934        }
935    }
936}
937
938#[derive(Debug, Clone)]
939pub struct InterfacesControlHandle {
940    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
941}
942
943impl fidl::endpoints::ControlHandle for InterfacesControlHandle {
944    fn shutdown(&self) {
945        self.inner.shutdown()
946    }
947    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
948        self.inner.shutdown_with_epitaph(status)
949    }
950
951    fn is_closed(&self) -> bool {
952        self.inner.channel().is_closed()
953    }
954    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
955        self.inner.channel().on_closed()
956    }
957
958    #[cfg(target_os = "fuchsia")]
959    fn signal_peer(
960        &self,
961        clear_mask: zx::Signals,
962        set_mask: zx::Signals,
963    ) -> Result<(), zx_status::Status> {
964        use fidl::Peered;
965        self.inner.channel().signal_peer(clear_mask, set_mask)
966    }
967}
968
969impl InterfacesControlHandle {}
970
971#[must_use = "FIDL methods require a response to be sent"]
972#[derive(Debug)]
973pub struct InterfacesGetMacResponder {
974    control_handle: std::mem::ManuallyDrop<InterfacesControlHandle>,
975    tx_id: u32,
976}
977
978/// Set the the channel to be shutdown (see [`InterfacesControlHandle::shutdown`])
979/// if the responder is dropped without sending a response, so that the client
980/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
981impl std::ops::Drop for InterfacesGetMacResponder {
982    fn drop(&mut self) {
983        self.control_handle.shutdown();
984        // Safety: drops once, never accessed again
985        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
986    }
987}
988
989impl fidl::endpoints::Responder for InterfacesGetMacResponder {
990    type ControlHandle = InterfacesControlHandle;
991
992    fn control_handle(&self) -> &InterfacesControlHandle {
993        &self.control_handle
994    }
995
996    fn drop_without_shutdown(mut self) {
997        // Safety: drops once, never accessed again due to mem::forget
998        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
999        // Prevent Drop from running (which would shut down the channel)
1000        std::mem::forget(self);
1001    }
1002}
1003
1004impl InterfacesGetMacResponder {
1005    /// Sends a response to the FIDL transaction.
1006    ///
1007    /// Sets the channel to shutdown if an error occurs.
1008    pub fn send(
1009        self,
1010        mut result: Result<Option<&fidl_fuchsia_net::MacAddress>, InterfacesGetMacError>,
1011    ) -> Result<(), fidl::Error> {
1012        let _result = self.send_raw(result);
1013        if _result.is_err() {
1014            self.control_handle.shutdown();
1015        }
1016        self.drop_without_shutdown();
1017        _result
1018    }
1019
1020    /// Similar to "send" but does not shutdown the channel if an error occurs.
1021    pub fn send_no_shutdown_on_err(
1022        self,
1023        mut result: Result<Option<&fidl_fuchsia_net::MacAddress>, InterfacesGetMacError>,
1024    ) -> Result<(), fidl::Error> {
1025        let _result = self.send_raw(result);
1026        self.drop_without_shutdown();
1027        _result
1028    }
1029
1030    fn send_raw(
1031        &self,
1032        mut result: Result<Option<&fidl_fuchsia_net::MacAddress>, InterfacesGetMacError>,
1033    ) -> Result<(), fidl::Error> {
1034        self.control_handle.inner.send::<fidl::encoding::ResultType<
1035            InterfacesGetMacResponse,
1036            InterfacesGetMacError,
1037        >>(
1038            result.map(|mac| (mac,)),
1039            self.tx_id,
1040            0x720643bc62a26d61,
1041            fidl::encoding::DynamicFlags::empty(),
1042        )
1043    }
1044}
1045
1046#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1047pub struct RoutesV4Marker;
1048
1049impl fidl::endpoints::ProtocolMarker for RoutesV4Marker {
1050    type Proxy = RoutesV4Proxy;
1051    type RequestStream = RoutesV4RequestStream;
1052    #[cfg(target_os = "fuchsia")]
1053    type SynchronousProxy = RoutesV4SynchronousProxy;
1054
1055    const DEBUG_NAME: &'static str = "fuchsia.net.root.RoutesV4";
1056}
1057impl fidl::endpoints::DiscoverableProtocolMarker for RoutesV4Marker {}
1058
1059pub trait RoutesV4ProxyInterface: Send + Sync {
1060    fn r#global_route_set(
1061        &self,
1062        route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV4Marker>,
1063    ) -> Result<(), fidl::Error>;
1064}
1065#[derive(Debug)]
1066#[cfg(target_os = "fuchsia")]
1067pub struct RoutesV4SynchronousProxy {
1068    client: fidl::client::sync::Client,
1069}
1070
1071#[cfg(target_os = "fuchsia")]
1072impl fidl::endpoints::SynchronousProxy for RoutesV4SynchronousProxy {
1073    type Proxy = RoutesV4Proxy;
1074    type Protocol = RoutesV4Marker;
1075
1076    fn from_channel(inner: fidl::Channel) -> Self {
1077        Self::new(inner)
1078    }
1079
1080    fn into_channel(self) -> fidl::Channel {
1081        self.client.into_channel()
1082    }
1083
1084    fn as_channel(&self) -> &fidl::Channel {
1085        self.client.as_channel()
1086    }
1087}
1088
1089#[cfg(target_os = "fuchsia")]
1090impl RoutesV4SynchronousProxy {
1091    pub fn new(channel: fidl::Channel) -> Self {
1092        let protocol_name = <RoutesV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1093        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1094    }
1095
1096    pub fn into_channel(self) -> fidl::Channel {
1097        self.client.into_channel()
1098    }
1099
1100    /// Waits until an event arrives and returns it. It is safe for other
1101    /// threads to make concurrent requests while waiting for an event.
1102    pub fn wait_for_event(
1103        &self,
1104        deadline: zx::MonotonicInstant,
1105    ) -> Result<RoutesV4Event, fidl::Error> {
1106        RoutesV4Event::decode(self.client.wait_for_event(deadline)?)
1107    }
1108
1109    /// Returns a `RouteSetV4` containing all IPv4 routes from the global
1110    /// routing table. Clients have unilateral access to add or remove routes
1111    /// from the set. This includes the ability to remove routes installed by
1112    /// the system, or routes installed by other clients of the `RouteSetV4`
1113    /// protocol.
1114    ///
1115    /// Note that the established connection to the `RouteSetV4` protocol will
1116    /// have a few notable differences from a `RouteSetV4` obtained by
1117    /// [`fuchsia.net.routes.admin/RouteTableV4.NewRouteSet`]:
1118    ///   - When removing a route from this route set, the route will be
1119    ///     completely removed from the system, including removal from all other
1120    ///     route sets to which it belongs.
1121    ///   - The protocol does not encode the lifetime of the route set or its
1122    ///     routes. Closing the client end will not cause the routes within this
1123    ///     route set to be removed from the system. Thus, routes added via this
1124    ///     route set will effectively be abandoned/unowned after this
1125    ///     client-end closes.
1126    ///
1127    /// + request `route set` grants access to the `RouteSetV4` protocol.
1128    pub fn r#global_route_set(
1129        &self,
1130        mut route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV4Marker>,
1131    ) -> Result<(), fidl::Error> {
1132        self.client.send::<RoutesV4GlobalRouteSetRequest>(
1133            (route_set,),
1134            0x3c0b279c61d81812,
1135            fidl::encoding::DynamicFlags::empty(),
1136        )
1137    }
1138}
1139
1140#[cfg(target_os = "fuchsia")]
1141impl From<RoutesV4SynchronousProxy> for zx::Handle {
1142    fn from(value: RoutesV4SynchronousProxy) -> Self {
1143        value.into_channel().into()
1144    }
1145}
1146
1147#[cfg(target_os = "fuchsia")]
1148impl From<fidl::Channel> for RoutesV4SynchronousProxy {
1149    fn from(value: fidl::Channel) -> Self {
1150        Self::new(value)
1151    }
1152}
1153
1154#[cfg(target_os = "fuchsia")]
1155impl fidl::endpoints::FromClient for RoutesV4SynchronousProxy {
1156    type Protocol = RoutesV4Marker;
1157
1158    fn from_client(value: fidl::endpoints::ClientEnd<RoutesV4Marker>) -> Self {
1159        Self::new(value.into_channel())
1160    }
1161}
1162
1163#[derive(Debug, Clone)]
1164pub struct RoutesV4Proxy {
1165    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1166}
1167
1168impl fidl::endpoints::Proxy for RoutesV4Proxy {
1169    type Protocol = RoutesV4Marker;
1170
1171    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1172        Self::new(inner)
1173    }
1174
1175    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1176        self.client.into_channel().map_err(|client| Self { client })
1177    }
1178
1179    fn as_channel(&self) -> &::fidl::AsyncChannel {
1180        self.client.as_channel()
1181    }
1182}
1183
1184impl RoutesV4Proxy {
1185    /// Create a new Proxy for fuchsia.net.root/RoutesV4.
1186    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1187        let protocol_name = <RoutesV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1188        Self { client: fidl::client::Client::new(channel, protocol_name) }
1189    }
1190
1191    /// Get a Stream of events from the remote end of the protocol.
1192    ///
1193    /// # Panics
1194    ///
1195    /// Panics if the event stream was already taken.
1196    pub fn take_event_stream(&self) -> RoutesV4EventStream {
1197        RoutesV4EventStream { event_receiver: self.client.take_event_receiver() }
1198    }
1199
1200    /// Returns a `RouteSetV4` containing all IPv4 routes from the global
1201    /// routing table. Clients have unilateral access to add or remove routes
1202    /// from the set. This includes the ability to remove routes installed by
1203    /// the system, or routes installed by other clients of the `RouteSetV4`
1204    /// protocol.
1205    ///
1206    /// Note that the established connection to the `RouteSetV4` protocol will
1207    /// have a few notable differences from a `RouteSetV4` obtained by
1208    /// [`fuchsia.net.routes.admin/RouteTableV4.NewRouteSet`]:
1209    ///   - When removing a route from this route set, the route will be
1210    ///     completely removed from the system, including removal from all other
1211    ///     route sets to which it belongs.
1212    ///   - The protocol does not encode the lifetime of the route set or its
1213    ///     routes. Closing the client end will not cause the routes within this
1214    ///     route set to be removed from the system. Thus, routes added via this
1215    ///     route set will effectively be abandoned/unowned after this
1216    ///     client-end closes.
1217    ///
1218    /// + request `route set` grants access to the `RouteSetV4` protocol.
1219    pub fn r#global_route_set(
1220        &self,
1221        mut route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV4Marker>,
1222    ) -> Result<(), fidl::Error> {
1223        RoutesV4ProxyInterface::r#global_route_set(self, route_set)
1224    }
1225}
1226
1227impl RoutesV4ProxyInterface for RoutesV4Proxy {
1228    fn r#global_route_set(
1229        &self,
1230        mut route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV4Marker>,
1231    ) -> Result<(), fidl::Error> {
1232        self.client.send::<RoutesV4GlobalRouteSetRequest>(
1233            (route_set,),
1234            0x3c0b279c61d81812,
1235            fidl::encoding::DynamicFlags::empty(),
1236        )
1237    }
1238}
1239
1240pub struct RoutesV4EventStream {
1241    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1242}
1243
1244impl std::marker::Unpin for RoutesV4EventStream {}
1245
1246impl futures::stream::FusedStream for RoutesV4EventStream {
1247    fn is_terminated(&self) -> bool {
1248        self.event_receiver.is_terminated()
1249    }
1250}
1251
1252impl futures::Stream for RoutesV4EventStream {
1253    type Item = Result<RoutesV4Event, fidl::Error>;
1254
1255    fn poll_next(
1256        mut self: std::pin::Pin<&mut Self>,
1257        cx: &mut std::task::Context<'_>,
1258    ) -> std::task::Poll<Option<Self::Item>> {
1259        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1260            &mut self.event_receiver,
1261            cx
1262        )?) {
1263            Some(buf) => std::task::Poll::Ready(Some(RoutesV4Event::decode(buf))),
1264            None => std::task::Poll::Ready(None),
1265        }
1266    }
1267}
1268
1269#[derive(Debug)]
1270pub enum RoutesV4Event {}
1271
1272impl RoutesV4Event {
1273    /// Decodes a message buffer as a [`RoutesV4Event`].
1274    fn decode(
1275        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1276    ) -> Result<RoutesV4Event, fidl::Error> {
1277        let (bytes, _handles) = buf.split_mut();
1278        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1279        debug_assert_eq!(tx_header.tx_id, 0);
1280        match tx_header.ordinal {
1281            _ => Err(fidl::Error::UnknownOrdinal {
1282                ordinal: tx_header.ordinal,
1283                protocol_name: <RoutesV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1284            }),
1285        }
1286    }
1287}
1288
1289/// A Stream of incoming requests for fuchsia.net.root/RoutesV4.
1290pub struct RoutesV4RequestStream {
1291    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1292    is_terminated: bool,
1293}
1294
1295impl std::marker::Unpin for RoutesV4RequestStream {}
1296
1297impl futures::stream::FusedStream for RoutesV4RequestStream {
1298    fn is_terminated(&self) -> bool {
1299        self.is_terminated
1300    }
1301}
1302
1303impl fidl::endpoints::RequestStream for RoutesV4RequestStream {
1304    type Protocol = RoutesV4Marker;
1305    type ControlHandle = RoutesV4ControlHandle;
1306
1307    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1308        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1309    }
1310
1311    fn control_handle(&self) -> Self::ControlHandle {
1312        RoutesV4ControlHandle { inner: self.inner.clone() }
1313    }
1314
1315    fn into_inner(
1316        self,
1317    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1318    {
1319        (self.inner, self.is_terminated)
1320    }
1321
1322    fn from_inner(
1323        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1324        is_terminated: bool,
1325    ) -> Self {
1326        Self { inner, is_terminated }
1327    }
1328}
1329
1330impl futures::Stream for RoutesV4RequestStream {
1331    type Item = Result<RoutesV4Request, fidl::Error>;
1332
1333    fn poll_next(
1334        mut self: std::pin::Pin<&mut Self>,
1335        cx: &mut std::task::Context<'_>,
1336    ) -> std::task::Poll<Option<Self::Item>> {
1337        let this = &mut *self;
1338        if this.inner.check_shutdown(cx) {
1339            this.is_terminated = true;
1340            return std::task::Poll::Ready(None);
1341        }
1342        if this.is_terminated {
1343            panic!("polled RoutesV4RequestStream after completion");
1344        }
1345        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1346            |bytes, handles| {
1347                match this.inner.channel().read_etc(cx, bytes, handles) {
1348                    std::task::Poll::Ready(Ok(())) => {}
1349                    std::task::Poll::Pending => return std::task::Poll::Pending,
1350                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1351                        this.is_terminated = true;
1352                        return std::task::Poll::Ready(None);
1353                    }
1354                    std::task::Poll::Ready(Err(e)) => {
1355                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1356                            e.into(),
1357                        ))))
1358                    }
1359                }
1360
1361                // A message has been received from the channel
1362                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1363
1364                std::task::Poll::Ready(Some(match header.ordinal {
1365                    0x3c0b279c61d81812 => {
1366                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1367                        let mut req = fidl::new_empty!(
1368                            RoutesV4GlobalRouteSetRequest,
1369                            fidl::encoding::DefaultFuchsiaResourceDialect
1370                        );
1371                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RoutesV4GlobalRouteSetRequest>(&header, _body_bytes, handles, &mut req)?;
1372                        let control_handle = RoutesV4ControlHandle { inner: this.inner.clone() };
1373                        Ok(RoutesV4Request::GlobalRouteSet {
1374                            route_set: req.route_set,
1375
1376                            control_handle,
1377                        })
1378                    }
1379                    _ => Err(fidl::Error::UnknownOrdinal {
1380                        ordinal: header.ordinal,
1381                        protocol_name:
1382                            <RoutesV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1383                    }),
1384                }))
1385            },
1386        )
1387    }
1388}
1389
1390/// Provides access to IPv4 routes.
1391///
1392/// This protocol provides the ability to bypass regular ownership-controls
1393/// which allow only the route set owner to remove routes it added.
1394///
1395/// Circumventing the strong-ownership semantics through use of this protocol
1396/// is highly discouraged and applications considering use of this protocol
1397/// are encouraged to exhaust other options first by working with the Netstack
1398/// team to find an alternative solution.
1399#[derive(Debug)]
1400pub enum RoutesV4Request {
1401    /// Returns a `RouteSetV4` containing all IPv4 routes from the global
1402    /// routing table. Clients have unilateral access to add or remove routes
1403    /// from the set. This includes the ability to remove routes installed by
1404    /// the system, or routes installed by other clients of the `RouteSetV4`
1405    /// protocol.
1406    ///
1407    /// Note that the established connection to the `RouteSetV4` protocol will
1408    /// have a few notable differences from a `RouteSetV4` obtained by
1409    /// [`fuchsia.net.routes.admin/RouteTableV4.NewRouteSet`]:
1410    ///   - When removing a route from this route set, the route will be
1411    ///     completely removed from the system, including removal from all other
1412    ///     route sets to which it belongs.
1413    ///   - The protocol does not encode the lifetime of the route set or its
1414    ///     routes. Closing the client end will not cause the routes within this
1415    ///     route set to be removed from the system. Thus, routes added via this
1416    ///     route set will effectively be abandoned/unowned after this
1417    ///     client-end closes.
1418    ///
1419    /// + request `route set` grants access to the `RouteSetV4` protocol.
1420    GlobalRouteSet {
1421        route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV4Marker>,
1422        control_handle: RoutesV4ControlHandle,
1423    },
1424}
1425
1426impl RoutesV4Request {
1427    #[allow(irrefutable_let_patterns)]
1428    pub fn into_global_route_set(
1429        self,
1430    ) -> Option<(
1431        fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV4Marker>,
1432        RoutesV4ControlHandle,
1433    )> {
1434        if let RoutesV4Request::GlobalRouteSet { route_set, control_handle } = self {
1435            Some((route_set, control_handle))
1436        } else {
1437            None
1438        }
1439    }
1440
1441    /// Name of the method defined in FIDL
1442    pub fn method_name(&self) -> &'static str {
1443        match *self {
1444            RoutesV4Request::GlobalRouteSet { .. } => "global_route_set",
1445        }
1446    }
1447}
1448
1449#[derive(Debug, Clone)]
1450pub struct RoutesV4ControlHandle {
1451    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1452}
1453
1454impl fidl::endpoints::ControlHandle for RoutesV4ControlHandle {
1455    fn shutdown(&self) {
1456        self.inner.shutdown()
1457    }
1458    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1459        self.inner.shutdown_with_epitaph(status)
1460    }
1461
1462    fn is_closed(&self) -> bool {
1463        self.inner.channel().is_closed()
1464    }
1465    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1466        self.inner.channel().on_closed()
1467    }
1468
1469    #[cfg(target_os = "fuchsia")]
1470    fn signal_peer(
1471        &self,
1472        clear_mask: zx::Signals,
1473        set_mask: zx::Signals,
1474    ) -> Result<(), zx_status::Status> {
1475        use fidl::Peered;
1476        self.inner.channel().signal_peer(clear_mask, set_mask)
1477    }
1478}
1479
1480impl RoutesV4ControlHandle {}
1481
1482#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1483pub struct RoutesV6Marker;
1484
1485impl fidl::endpoints::ProtocolMarker for RoutesV6Marker {
1486    type Proxy = RoutesV6Proxy;
1487    type RequestStream = RoutesV6RequestStream;
1488    #[cfg(target_os = "fuchsia")]
1489    type SynchronousProxy = RoutesV6SynchronousProxy;
1490
1491    const DEBUG_NAME: &'static str = "fuchsia.net.root.RoutesV6";
1492}
1493impl fidl::endpoints::DiscoverableProtocolMarker for RoutesV6Marker {}
1494
1495pub trait RoutesV6ProxyInterface: Send + Sync {
1496    fn r#global_route_set(
1497        &self,
1498        route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV6Marker>,
1499    ) -> Result<(), fidl::Error>;
1500}
1501#[derive(Debug)]
1502#[cfg(target_os = "fuchsia")]
1503pub struct RoutesV6SynchronousProxy {
1504    client: fidl::client::sync::Client,
1505}
1506
1507#[cfg(target_os = "fuchsia")]
1508impl fidl::endpoints::SynchronousProxy for RoutesV6SynchronousProxy {
1509    type Proxy = RoutesV6Proxy;
1510    type Protocol = RoutesV6Marker;
1511
1512    fn from_channel(inner: fidl::Channel) -> Self {
1513        Self::new(inner)
1514    }
1515
1516    fn into_channel(self) -> fidl::Channel {
1517        self.client.into_channel()
1518    }
1519
1520    fn as_channel(&self) -> &fidl::Channel {
1521        self.client.as_channel()
1522    }
1523}
1524
1525#[cfg(target_os = "fuchsia")]
1526impl RoutesV6SynchronousProxy {
1527    pub fn new(channel: fidl::Channel) -> Self {
1528        let protocol_name = <RoutesV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1529        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1530    }
1531
1532    pub fn into_channel(self) -> fidl::Channel {
1533        self.client.into_channel()
1534    }
1535
1536    /// Waits until an event arrives and returns it. It is safe for other
1537    /// threads to make concurrent requests while waiting for an event.
1538    pub fn wait_for_event(
1539        &self,
1540        deadline: zx::MonotonicInstant,
1541    ) -> Result<RoutesV6Event, fidl::Error> {
1542        RoutesV6Event::decode(self.client.wait_for_event(deadline)?)
1543    }
1544
1545    /// Returns a `RouteSetV6` containing all IPv6 routes from the global
1546    /// routing table. Clients have unilateral access to add or remove routes
1547    /// from the set. This includes the ability to remove routes installed by
1548    /// the system, or routes installed by other clients of the `RouteSetV6`
1549    /// protocol.
1550    ///
1551    /// Note that the established connection to the `RouteSetV6` protocol will
1552    /// have a few notable differences from a `RouteSetV6` obtained by
1553    /// [`fuchsia.net.routes.admin/RouteTableV6.NewRouteSet`]:
1554    ///   - When removing a route from this route set, the route will be
1555    ///     completely removed from the system, including removal from all other
1556    ///     route sets to which it belongs.
1557    ///   - The protocol does not encode the lifetime of the route set or its
1558    ///     routes. Closing the client end will not cause the routes within this
1559    ///     route set to be removed from the system. Thus, routes added via this
1560    ///     route set will effectively be abandoned/unowned after this
1561    ///     client-end closes.
1562    ///
1563    /// + request `route set` grants access to the `RouteSetV6` protocol.
1564    pub fn r#global_route_set(
1565        &self,
1566        mut route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV6Marker>,
1567    ) -> Result<(), fidl::Error> {
1568        self.client.send::<RoutesV6GlobalRouteSetRequest>(
1569            (route_set,),
1570            0x41336f581f8d6a61,
1571            fidl::encoding::DynamicFlags::empty(),
1572        )
1573    }
1574}
1575
1576#[cfg(target_os = "fuchsia")]
1577impl From<RoutesV6SynchronousProxy> for zx::Handle {
1578    fn from(value: RoutesV6SynchronousProxy) -> Self {
1579        value.into_channel().into()
1580    }
1581}
1582
1583#[cfg(target_os = "fuchsia")]
1584impl From<fidl::Channel> for RoutesV6SynchronousProxy {
1585    fn from(value: fidl::Channel) -> Self {
1586        Self::new(value)
1587    }
1588}
1589
1590#[cfg(target_os = "fuchsia")]
1591impl fidl::endpoints::FromClient for RoutesV6SynchronousProxy {
1592    type Protocol = RoutesV6Marker;
1593
1594    fn from_client(value: fidl::endpoints::ClientEnd<RoutesV6Marker>) -> Self {
1595        Self::new(value.into_channel())
1596    }
1597}
1598
1599#[derive(Debug, Clone)]
1600pub struct RoutesV6Proxy {
1601    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1602}
1603
1604impl fidl::endpoints::Proxy for RoutesV6Proxy {
1605    type Protocol = RoutesV6Marker;
1606
1607    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1608        Self::new(inner)
1609    }
1610
1611    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1612        self.client.into_channel().map_err(|client| Self { client })
1613    }
1614
1615    fn as_channel(&self) -> &::fidl::AsyncChannel {
1616        self.client.as_channel()
1617    }
1618}
1619
1620impl RoutesV6Proxy {
1621    /// Create a new Proxy for fuchsia.net.root/RoutesV6.
1622    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1623        let protocol_name = <RoutesV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1624        Self { client: fidl::client::Client::new(channel, protocol_name) }
1625    }
1626
1627    /// Get a Stream of events from the remote end of the protocol.
1628    ///
1629    /// # Panics
1630    ///
1631    /// Panics if the event stream was already taken.
1632    pub fn take_event_stream(&self) -> RoutesV6EventStream {
1633        RoutesV6EventStream { event_receiver: self.client.take_event_receiver() }
1634    }
1635
1636    /// Returns a `RouteSetV6` containing all IPv6 routes from the global
1637    /// routing table. Clients have unilateral access to add or remove routes
1638    /// from the set. This includes the ability to remove routes installed by
1639    /// the system, or routes installed by other clients of the `RouteSetV6`
1640    /// protocol.
1641    ///
1642    /// Note that the established connection to the `RouteSetV6` protocol will
1643    /// have a few notable differences from a `RouteSetV6` obtained by
1644    /// [`fuchsia.net.routes.admin/RouteTableV6.NewRouteSet`]:
1645    ///   - When removing a route from this route set, the route will be
1646    ///     completely removed from the system, including removal from all other
1647    ///     route sets to which it belongs.
1648    ///   - The protocol does not encode the lifetime of the route set or its
1649    ///     routes. Closing the client end will not cause the routes within this
1650    ///     route set to be removed from the system. Thus, routes added via this
1651    ///     route set will effectively be abandoned/unowned after this
1652    ///     client-end closes.
1653    ///
1654    /// + request `route set` grants access to the `RouteSetV6` protocol.
1655    pub fn r#global_route_set(
1656        &self,
1657        mut route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV6Marker>,
1658    ) -> Result<(), fidl::Error> {
1659        RoutesV6ProxyInterface::r#global_route_set(self, route_set)
1660    }
1661}
1662
1663impl RoutesV6ProxyInterface for RoutesV6Proxy {
1664    fn r#global_route_set(
1665        &self,
1666        mut route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV6Marker>,
1667    ) -> Result<(), fidl::Error> {
1668        self.client.send::<RoutesV6GlobalRouteSetRequest>(
1669            (route_set,),
1670            0x41336f581f8d6a61,
1671            fidl::encoding::DynamicFlags::empty(),
1672        )
1673    }
1674}
1675
1676pub struct RoutesV6EventStream {
1677    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1678}
1679
1680impl std::marker::Unpin for RoutesV6EventStream {}
1681
1682impl futures::stream::FusedStream for RoutesV6EventStream {
1683    fn is_terminated(&self) -> bool {
1684        self.event_receiver.is_terminated()
1685    }
1686}
1687
1688impl futures::Stream for RoutesV6EventStream {
1689    type Item = Result<RoutesV6Event, fidl::Error>;
1690
1691    fn poll_next(
1692        mut self: std::pin::Pin<&mut Self>,
1693        cx: &mut std::task::Context<'_>,
1694    ) -> std::task::Poll<Option<Self::Item>> {
1695        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1696            &mut self.event_receiver,
1697            cx
1698        )?) {
1699            Some(buf) => std::task::Poll::Ready(Some(RoutesV6Event::decode(buf))),
1700            None => std::task::Poll::Ready(None),
1701        }
1702    }
1703}
1704
1705#[derive(Debug)]
1706pub enum RoutesV6Event {}
1707
1708impl RoutesV6Event {
1709    /// Decodes a message buffer as a [`RoutesV6Event`].
1710    fn decode(
1711        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1712    ) -> Result<RoutesV6Event, fidl::Error> {
1713        let (bytes, _handles) = buf.split_mut();
1714        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1715        debug_assert_eq!(tx_header.tx_id, 0);
1716        match tx_header.ordinal {
1717            _ => Err(fidl::Error::UnknownOrdinal {
1718                ordinal: tx_header.ordinal,
1719                protocol_name: <RoutesV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1720            }),
1721        }
1722    }
1723}
1724
1725/// A Stream of incoming requests for fuchsia.net.root/RoutesV6.
1726pub struct RoutesV6RequestStream {
1727    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1728    is_terminated: bool,
1729}
1730
1731impl std::marker::Unpin for RoutesV6RequestStream {}
1732
1733impl futures::stream::FusedStream for RoutesV6RequestStream {
1734    fn is_terminated(&self) -> bool {
1735        self.is_terminated
1736    }
1737}
1738
1739impl fidl::endpoints::RequestStream for RoutesV6RequestStream {
1740    type Protocol = RoutesV6Marker;
1741    type ControlHandle = RoutesV6ControlHandle;
1742
1743    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1744        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1745    }
1746
1747    fn control_handle(&self) -> Self::ControlHandle {
1748        RoutesV6ControlHandle { inner: self.inner.clone() }
1749    }
1750
1751    fn into_inner(
1752        self,
1753    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1754    {
1755        (self.inner, self.is_terminated)
1756    }
1757
1758    fn from_inner(
1759        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1760        is_terminated: bool,
1761    ) -> Self {
1762        Self { inner, is_terminated }
1763    }
1764}
1765
1766impl futures::Stream for RoutesV6RequestStream {
1767    type Item = Result<RoutesV6Request, fidl::Error>;
1768
1769    fn poll_next(
1770        mut self: std::pin::Pin<&mut Self>,
1771        cx: &mut std::task::Context<'_>,
1772    ) -> std::task::Poll<Option<Self::Item>> {
1773        let this = &mut *self;
1774        if this.inner.check_shutdown(cx) {
1775            this.is_terminated = true;
1776            return std::task::Poll::Ready(None);
1777        }
1778        if this.is_terminated {
1779            panic!("polled RoutesV6RequestStream after completion");
1780        }
1781        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1782            |bytes, handles| {
1783                match this.inner.channel().read_etc(cx, bytes, handles) {
1784                    std::task::Poll::Ready(Ok(())) => {}
1785                    std::task::Poll::Pending => return std::task::Poll::Pending,
1786                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1787                        this.is_terminated = true;
1788                        return std::task::Poll::Ready(None);
1789                    }
1790                    std::task::Poll::Ready(Err(e)) => {
1791                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1792                            e.into(),
1793                        ))))
1794                    }
1795                }
1796
1797                // A message has been received from the channel
1798                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1799
1800                std::task::Poll::Ready(Some(match header.ordinal {
1801                    0x41336f581f8d6a61 => {
1802                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1803                        let mut req = fidl::new_empty!(
1804                            RoutesV6GlobalRouteSetRequest,
1805                            fidl::encoding::DefaultFuchsiaResourceDialect
1806                        );
1807                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RoutesV6GlobalRouteSetRequest>(&header, _body_bytes, handles, &mut req)?;
1808                        let control_handle = RoutesV6ControlHandle { inner: this.inner.clone() };
1809                        Ok(RoutesV6Request::GlobalRouteSet {
1810                            route_set: req.route_set,
1811
1812                            control_handle,
1813                        })
1814                    }
1815                    _ => Err(fidl::Error::UnknownOrdinal {
1816                        ordinal: header.ordinal,
1817                        protocol_name:
1818                            <RoutesV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1819                    }),
1820                }))
1821            },
1822        )
1823    }
1824}
1825
1826/// Provides access to IPv6 routes.
1827///
1828/// This protocol provides the ability to bypass regular ownership-controls
1829/// which allow only the route set owner to remove routes it added.
1830///
1831/// Circumventing the strong-ownership semantics through use of this protocol
1832/// is highly discouraged and applications considering use of this protocol
1833/// are encouraged to exhaust other options first by working with the Netstack
1834/// team to find an alternative solution.
1835#[derive(Debug)]
1836pub enum RoutesV6Request {
1837    /// Returns a `RouteSetV6` containing all IPv6 routes from the global
1838    /// routing table. Clients have unilateral access to add or remove routes
1839    /// from the set. This includes the ability to remove routes installed by
1840    /// the system, or routes installed by other clients of the `RouteSetV6`
1841    /// protocol.
1842    ///
1843    /// Note that the established connection to the `RouteSetV6` protocol will
1844    /// have a few notable differences from a `RouteSetV6` obtained by
1845    /// [`fuchsia.net.routes.admin/RouteTableV6.NewRouteSet`]:
1846    ///   - When removing a route from this route set, the route will be
1847    ///     completely removed from the system, including removal from all other
1848    ///     route sets to which it belongs.
1849    ///   - The protocol does not encode the lifetime of the route set or its
1850    ///     routes. Closing the client end will not cause the routes within this
1851    ///     route set to be removed from the system. Thus, routes added via this
1852    ///     route set will effectively be abandoned/unowned after this
1853    ///     client-end closes.
1854    ///
1855    /// + request `route set` grants access to the `RouteSetV6` protocol.
1856    GlobalRouteSet {
1857        route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV6Marker>,
1858        control_handle: RoutesV6ControlHandle,
1859    },
1860}
1861
1862impl RoutesV6Request {
1863    #[allow(irrefutable_let_patterns)]
1864    pub fn into_global_route_set(
1865        self,
1866    ) -> Option<(
1867        fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV6Marker>,
1868        RoutesV6ControlHandle,
1869    )> {
1870        if let RoutesV6Request::GlobalRouteSet { route_set, control_handle } = self {
1871            Some((route_set, control_handle))
1872        } else {
1873            None
1874        }
1875    }
1876
1877    /// Name of the method defined in FIDL
1878    pub fn method_name(&self) -> &'static str {
1879        match *self {
1880            RoutesV6Request::GlobalRouteSet { .. } => "global_route_set",
1881        }
1882    }
1883}
1884
1885#[derive(Debug, Clone)]
1886pub struct RoutesV6ControlHandle {
1887    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1888}
1889
1890impl fidl::endpoints::ControlHandle for RoutesV6ControlHandle {
1891    fn shutdown(&self) {
1892        self.inner.shutdown()
1893    }
1894    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1895        self.inner.shutdown_with_epitaph(status)
1896    }
1897
1898    fn is_closed(&self) -> bool {
1899        self.inner.channel().is_closed()
1900    }
1901    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1902        self.inner.channel().on_closed()
1903    }
1904
1905    #[cfg(target_os = "fuchsia")]
1906    fn signal_peer(
1907        &self,
1908        clear_mask: zx::Signals,
1909        set_mask: zx::Signals,
1910    ) -> Result<(), zx_status::Status> {
1911        use fidl::Peered;
1912        self.inner.channel().signal_peer(clear_mask, set_mask)
1913    }
1914}
1915
1916impl RoutesV6ControlHandle {}
1917
1918mod internal {
1919    use super::*;
1920
1921    impl fidl::encoding::ResourceTypeMarker for FilterOpenControllerRequest {
1922        type Borrowed<'a> = &'a mut Self;
1923        fn take_or_borrow<'a>(
1924            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1925        ) -> Self::Borrowed<'a> {
1926            value
1927        }
1928    }
1929
1930    unsafe impl fidl::encoding::TypeMarker for FilterOpenControllerRequest {
1931        type Owned = Self;
1932
1933        #[inline(always)]
1934        fn inline_align(_context: fidl::encoding::Context) -> usize {
1935            8
1936        }
1937
1938        #[inline(always)]
1939        fn inline_size(_context: fidl::encoding::Context) -> usize {
1940            24
1941        }
1942    }
1943
1944    unsafe impl
1945        fidl::encoding::Encode<
1946            FilterOpenControllerRequest,
1947            fidl::encoding::DefaultFuchsiaResourceDialect,
1948        > for &mut FilterOpenControllerRequest
1949    {
1950        #[inline]
1951        unsafe fn encode(
1952            self,
1953            encoder: &mut fidl::encoding::Encoder<
1954                '_,
1955                fidl::encoding::DefaultFuchsiaResourceDialect,
1956            >,
1957            offset: usize,
1958            _depth: fidl::encoding::Depth,
1959        ) -> fidl::Result<()> {
1960            encoder.debug_check_bounds::<FilterOpenControllerRequest>(offset);
1961            // Delegate to tuple encoding.
1962            fidl::encoding::Encode::<
1963                FilterOpenControllerRequest,
1964                fidl::encoding::DefaultFuchsiaResourceDialect,
1965            >::encode(
1966                (
1967                    <fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow(
1968                        &self.id,
1969                    ),
1970                    <fidl::encoding::Endpoint<
1971                        fidl::endpoints::ServerEnd<
1972                            fidl_fuchsia_net_filter::NamespaceControllerMarker,
1973                        >,
1974                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
1975                        &mut self.request
1976                    ),
1977                ),
1978                encoder,
1979                offset,
1980                _depth,
1981            )
1982        }
1983    }
1984    unsafe impl<
1985            T0: fidl::encoding::Encode<
1986                fidl::encoding::BoundedString<255>,
1987                fidl::encoding::DefaultFuchsiaResourceDialect,
1988            >,
1989            T1: fidl::encoding::Encode<
1990                fidl::encoding::Endpoint<
1991                    fidl::endpoints::ServerEnd<fidl_fuchsia_net_filter::NamespaceControllerMarker>,
1992                >,
1993                fidl::encoding::DefaultFuchsiaResourceDialect,
1994            >,
1995        >
1996        fidl::encoding::Encode<
1997            FilterOpenControllerRequest,
1998            fidl::encoding::DefaultFuchsiaResourceDialect,
1999        > for (T0, T1)
2000    {
2001        #[inline]
2002        unsafe fn encode(
2003            self,
2004            encoder: &mut fidl::encoding::Encoder<
2005                '_,
2006                fidl::encoding::DefaultFuchsiaResourceDialect,
2007            >,
2008            offset: usize,
2009            depth: fidl::encoding::Depth,
2010        ) -> fidl::Result<()> {
2011            encoder.debug_check_bounds::<FilterOpenControllerRequest>(offset);
2012            // Zero out padding regions. There's no need to apply masks
2013            // because the unmasked parts will be overwritten by fields.
2014            unsafe {
2015                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2016                (ptr as *mut u64).write_unaligned(0);
2017            }
2018            // Write the fields.
2019            self.0.encode(encoder, offset + 0, depth)?;
2020            self.1.encode(encoder, offset + 16, depth)?;
2021            Ok(())
2022        }
2023    }
2024
2025    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2026        for FilterOpenControllerRequest
2027    {
2028        #[inline(always)]
2029        fn new_empty() -> Self {
2030            Self {
2031                id: fidl::new_empty!(
2032                    fidl::encoding::BoundedString<255>,
2033                    fidl::encoding::DefaultFuchsiaResourceDialect
2034                ),
2035                request: fidl::new_empty!(
2036                    fidl::encoding::Endpoint<
2037                        fidl::endpoints::ServerEnd<
2038                            fidl_fuchsia_net_filter::NamespaceControllerMarker,
2039                        >,
2040                    >,
2041                    fidl::encoding::DefaultFuchsiaResourceDialect
2042                ),
2043            }
2044        }
2045
2046        #[inline]
2047        unsafe fn decode(
2048            &mut self,
2049            decoder: &mut fidl::encoding::Decoder<
2050                '_,
2051                fidl::encoding::DefaultFuchsiaResourceDialect,
2052            >,
2053            offset: usize,
2054            _depth: fidl::encoding::Depth,
2055        ) -> fidl::Result<()> {
2056            decoder.debug_check_bounds::<Self>(offset);
2057            // Verify that padding bytes are zero.
2058            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2059            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2060            let mask = 0xffffffff00000000u64;
2061            let maskedval = padval & mask;
2062            if maskedval != 0 {
2063                return Err(fidl::Error::NonZeroPadding {
2064                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2065                });
2066            }
2067            fidl::decode!(
2068                fidl::encoding::BoundedString<255>,
2069                fidl::encoding::DefaultFuchsiaResourceDialect,
2070                &mut self.id,
2071                decoder,
2072                offset + 0,
2073                _depth
2074            )?;
2075            fidl::decode!(
2076                fidl::encoding::Endpoint<
2077                    fidl::endpoints::ServerEnd<fidl_fuchsia_net_filter::NamespaceControllerMarker>,
2078                >,
2079                fidl::encoding::DefaultFuchsiaResourceDialect,
2080                &mut self.request,
2081                decoder,
2082                offset + 16,
2083                _depth
2084            )?;
2085            Ok(())
2086        }
2087    }
2088
2089    impl fidl::encoding::ResourceTypeMarker for InterfacesGetAdminRequest {
2090        type Borrowed<'a> = &'a mut Self;
2091        fn take_or_borrow<'a>(
2092            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2093        ) -> Self::Borrowed<'a> {
2094            value
2095        }
2096    }
2097
2098    unsafe impl fidl::encoding::TypeMarker for InterfacesGetAdminRequest {
2099        type Owned = Self;
2100
2101        #[inline(always)]
2102        fn inline_align(_context: fidl::encoding::Context) -> usize {
2103            8
2104        }
2105
2106        #[inline(always)]
2107        fn inline_size(_context: fidl::encoding::Context) -> usize {
2108            16
2109        }
2110    }
2111
2112    unsafe impl
2113        fidl::encoding::Encode<
2114            InterfacesGetAdminRequest,
2115            fidl::encoding::DefaultFuchsiaResourceDialect,
2116        > for &mut InterfacesGetAdminRequest
2117    {
2118        #[inline]
2119        unsafe fn encode(
2120            self,
2121            encoder: &mut fidl::encoding::Encoder<
2122                '_,
2123                fidl::encoding::DefaultFuchsiaResourceDialect,
2124            >,
2125            offset: usize,
2126            _depth: fidl::encoding::Depth,
2127        ) -> fidl::Result<()> {
2128            encoder.debug_check_bounds::<InterfacesGetAdminRequest>(offset);
2129            // Delegate to tuple encoding.
2130            fidl::encoding::Encode::<
2131                InterfacesGetAdminRequest,
2132                fidl::encoding::DefaultFuchsiaResourceDialect,
2133            >::encode(
2134                (
2135                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
2136                    <fidl::encoding::Endpoint<
2137                        fidl::endpoints::ServerEnd<
2138                            fidl_fuchsia_net_interfaces_admin::ControlMarker,
2139                        >,
2140                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2141                        &mut self.control
2142                    ),
2143                ),
2144                encoder,
2145                offset,
2146                _depth,
2147            )
2148        }
2149    }
2150    unsafe impl<
2151            T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
2152            T1: fidl::encoding::Encode<
2153                fidl::encoding::Endpoint<
2154                    fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
2155                >,
2156                fidl::encoding::DefaultFuchsiaResourceDialect,
2157            >,
2158        >
2159        fidl::encoding::Encode<
2160            InterfacesGetAdminRequest,
2161            fidl::encoding::DefaultFuchsiaResourceDialect,
2162        > for (T0, T1)
2163    {
2164        #[inline]
2165        unsafe fn encode(
2166            self,
2167            encoder: &mut fidl::encoding::Encoder<
2168                '_,
2169                fidl::encoding::DefaultFuchsiaResourceDialect,
2170            >,
2171            offset: usize,
2172            depth: fidl::encoding::Depth,
2173        ) -> fidl::Result<()> {
2174            encoder.debug_check_bounds::<InterfacesGetAdminRequest>(offset);
2175            // Zero out padding regions. There's no need to apply masks
2176            // because the unmasked parts will be overwritten by fields.
2177            unsafe {
2178                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
2179                (ptr as *mut u64).write_unaligned(0);
2180            }
2181            // Write the fields.
2182            self.0.encode(encoder, offset + 0, depth)?;
2183            self.1.encode(encoder, offset + 8, depth)?;
2184            Ok(())
2185        }
2186    }
2187
2188    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2189        for InterfacesGetAdminRequest
2190    {
2191        #[inline(always)]
2192        fn new_empty() -> Self {
2193            Self {
2194                id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
2195                control: fidl::new_empty!(
2196                    fidl::encoding::Endpoint<
2197                        fidl::endpoints::ServerEnd<
2198                            fidl_fuchsia_net_interfaces_admin::ControlMarker,
2199                        >,
2200                    >,
2201                    fidl::encoding::DefaultFuchsiaResourceDialect
2202                ),
2203            }
2204        }
2205
2206        #[inline]
2207        unsafe fn decode(
2208            &mut self,
2209            decoder: &mut fidl::encoding::Decoder<
2210                '_,
2211                fidl::encoding::DefaultFuchsiaResourceDialect,
2212            >,
2213            offset: usize,
2214            _depth: fidl::encoding::Depth,
2215        ) -> fidl::Result<()> {
2216            decoder.debug_check_bounds::<Self>(offset);
2217            // Verify that padding bytes are zero.
2218            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
2219            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2220            let mask = 0xffffffff00000000u64;
2221            let maskedval = padval & mask;
2222            if maskedval != 0 {
2223                return Err(fidl::Error::NonZeroPadding {
2224                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
2225                });
2226            }
2227            fidl::decode!(
2228                u64,
2229                fidl::encoding::DefaultFuchsiaResourceDialect,
2230                &mut self.id,
2231                decoder,
2232                offset + 0,
2233                _depth
2234            )?;
2235            fidl::decode!(
2236                fidl::encoding::Endpoint<
2237                    fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
2238                >,
2239                fidl::encoding::DefaultFuchsiaResourceDialect,
2240                &mut self.control,
2241                decoder,
2242                offset + 8,
2243                _depth
2244            )?;
2245            Ok(())
2246        }
2247    }
2248
2249    impl fidl::encoding::ResourceTypeMarker for RoutesV4GlobalRouteSetRequest {
2250        type Borrowed<'a> = &'a mut Self;
2251        fn take_or_borrow<'a>(
2252            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2253        ) -> Self::Borrowed<'a> {
2254            value
2255        }
2256    }
2257
2258    unsafe impl fidl::encoding::TypeMarker for RoutesV4GlobalRouteSetRequest {
2259        type Owned = Self;
2260
2261        #[inline(always)]
2262        fn inline_align(_context: fidl::encoding::Context) -> usize {
2263            4
2264        }
2265
2266        #[inline(always)]
2267        fn inline_size(_context: fidl::encoding::Context) -> usize {
2268            4
2269        }
2270    }
2271
2272    unsafe impl
2273        fidl::encoding::Encode<
2274            RoutesV4GlobalRouteSetRequest,
2275            fidl::encoding::DefaultFuchsiaResourceDialect,
2276        > for &mut RoutesV4GlobalRouteSetRequest
2277    {
2278        #[inline]
2279        unsafe fn encode(
2280            self,
2281            encoder: &mut fidl::encoding::Encoder<
2282                '_,
2283                fidl::encoding::DefaultFuchsiaResourceDialect,
2284            >,
2285            offset: usize,
2286            _depth: fidl::encoding::Depth,
2287        ) -> fidl::Result<()> {
2288            encoder.debug_check_bounds::<RoutesV4GlobalRouteSetRequest>(offset);
2289            // Delegate to tuple encoding.
2290            fidl::encoding::Encode::<
2291                RoutesV4GlobalRouteSetRequest,
2292                fidl::encoding::DefaultFuchsiaResourceDialect,
2293            >::encode(
2294                (<fidl::encoding::Endpoint<
2295                    fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV4Marker>,
2296                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2297                    &mut self.route_set
2298                ),),
2299                encoder,
2300                offset,
2301                _depth,
2302            )
2303        }
2304    }
2305    unsafe impl<
2306            T0: fidl::encoding::Encode<
2307                fidl::encoding::Endpoint<
2308                    fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV4Marker>,
2309                >,
2310                fidl::encoding::DefaultFuchsiaResourceDialect,
2311            >,
2312        >
2313        fidl::encoding::Encode<
2314            RoutesV4GlobalRouteSetRequest,
2315            fidl::encoding::DefaultFuchsiaResourceDialect,
2316        > for (T0,)
2317    {
2318        #[inline]
2319        unsafe fn encode(
2320            self,
2321            encoder: &mut fidl::encoding::Encoder<
2322                '_,
2323                fidl::encoding::DefaultFuchsiaResourceDialect,
2324            >,
2325            offset: usize,
2326            depth: fidl::encoding::Depth,
2327        ) -> fidl::Result<()> {
2328            encoder.debug_check_bounds::<RoutesV4GlobalRouteSetRequest>(offset);
2329            // Zero out padding regions. There's no need to apply masks
2330            // because the unmasked parts will be overwritten by fields.
2331            // Write the fields.
2332            self.0.encode(encoder, offset + 0, depth)?;
2333            Ok(())
2334        }
2335    }
2336
2337    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2338        for RoutesV4GlobalRouteSetRequest
2339    {
2340        #[inline(always)]
2341        fn new_empty() -> Self {
2342            Self {
2343                route_set: fidl::new_empty!(
2344                    fidl::encoding::Endpoint<
2345                        fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV4Marker>,
2346                    >,
2347                    fidl::encoding::DefaultFuchsiaResourceDialect
2348                ),
2349            }
2350        }
2351
2352        #[inline]
2353        unsafe fn decode(
2354            &mut self,
2355            decoder: &mut fidl::encoding::Decoder<
2356                '_,
2357                fidl::encoding::DefaultFuchsiaResourceDialect,
2358            >,
2359            offset: usize,
2360            _depth: fidl::encoding::Depth,
2361        ) -> fidl::Result<()> {
2362            decoder.debug_check_bounds::<Self>(offset);
2363            // Verify that padding bytes are zero.
2364            fidl::decode!(
2365                fidl::encoding::Endpoint<
2366                    fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV4Marker>,
2367                >,
2368                fidl::encoding::DefaultFuchsiaResourceDialect,
2369                &mut self.route_set,
2370                decoder,
2371                offset + 0,
2372                _depth
2373            )?;
2374            Ok(())
2375        }
2376    }
2377
2378    impl fidl::encoding::ResourceTypeMarker for RoutesV6GlobalRouteSetRequest {
2379        type Borrowed<'a> = &'a mut Self;
2380        fn take_or_borrow<'a>(
2381            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2382        ) -> Self::Borrowed<'a> {
2383            value
2384        }
2385    }
2386
2387    unsafe impl fidl::encoding::TypeMarker for RoutesV6GlobalRouteSetRequest {
2388        type Owned = Self;
2389
2390        #[inline(always)]
2391        fn inline_align(_context: fidl::encoding::Context) -> usize {
2392            4
2393        }
2394
2395        #[inline(always)]
2396        fn inline_size(_context: fidl::encoding::Context) -> usize {
2397            4
2398        }
2399    }
2400
2401    unsafe impl
2402        fidl::encoding::Encode<
2403            RoutesV6GlobalRouteSetRequest,
2404            fidl::encoding::DefaultFuchsiaResourceDialect,
2405        > for &mut RoutesV6GlobalRouteSetRequest
2406    {
2407        #[inline]
2408        unsafe fn encode(
2409            self,
2410            encoder: &mut fidl::encoding::Encoder<
2411                '_,
2412                fidl::encoding::DefaultFuchsiaResourceDialect,
2413            >,
2414            offset: usize,
2415            _depth: fidl::encoding::Depth,
2416        ) -> fidl::Result<()> {
2417            encoder.debug_check_bounds::<RoutesV6GlobalRouteSetRequest>(offset);
2418            // Delegate to tuple encoding.
2419            fidl::encoding::Encode::<
2420                RoutesV6GlobalRouteSetRequest,
2421                fidl::encoding::DefaultFuchsiaResourceDialect,
2422            >::encode(
2423                (<fidl::encoding::Endpoint<
2424                    fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV6Marker>,
2425                > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
2426                    &mut self.route_set
2427                ),),
2428                encoder,
2429                offset,
2430                _depth,
2431            )
2432        }
2433    }
2434    unsafe impl<
2435            T0: fidl::encoding::Encode<
2436                fidl::encoding::Endpoint<
2437                    fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV6Marker>,
2438                >,
2439                fidl::encoding::DefaultFuchsiaResourceDialect,
2440            >,
2441        >
2442        fidl::encoding::Encode<
2443            RoutesV6GlobalRouteSetRequest,
2444            fidl::encoding::DefaultFuchsiaResourceDialect,
2445        > for (T0,)
2446    {
2447        #[inline]
2448        unsafe fn encode(
2449            self,
2450            encoder: &mut fidl::encoding::Encoder<
2451                '_,
2452                fidl::encoding::DefaultFuchsiaResourceDialect,
2453            >,
2454            offset: usize,
2455            depth: fidl::encoding::Depth,
2456        ) -> fidl::Result<()> {
2457            encoder.debug_check_bounds::<RoutesV6GlobalRouteSetRequest>(offset);
2458            // Zero out padding regions. There's no need to apply masks
2459            // because the unmasked parts will be overwritten by fields.
2460            // Write the fields.
2461            self.0.encode(encoder, offset + 0, depth)?;
2462            Ok(())
2463        }
2464    }
2465
2466    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2467        for RoutesV6GlobalRouteSetRequest
2468    {
2469        #[inline(always)]
2470        fn new_empty() -> Self {
2471            Self {
2472                route_set: fidl::new_empty!(
2473                    fidl::encoding::Endpoint<
2474                        fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV6Marker>,
2475                    >,
2476                    fidl::encoding::DefaultFuchsiaResourceDialect
2477                ),
2478            }
2479        }
2480
2481        #[inline]
2482        unsafe fn decode(
2483            &mut self,
2484            decoder: &mut fidl::encoding::Decoder<
2485                '_,
2486                fidl::encoding::DefaultFuchsiaResourceDialect,
2487            >,
2488            offset: usize,
2489            _depth: fidl::encoding::Depth,
2490        ) -> fidl::Result<()> {
2491            decoder.debug_check_bounds::<Self>(offset);
2492            // Verify that padding bytes are zero.
2493            fidl::decode!(
2494                fidl::encoding::Endpoint<
2495                    fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV6Marker>,
2496                >,
2497                fidl::encoding::DefaultFuchsiaResourceDialect,
2498                &mut self.route_set,
2499                decoder,
2500                offset + 0,
2501                _depth
2502            )?;
2503            Ok(())
2504        }
2505    }
2506}