Skip to main content

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        Self { client: fidl::client::sync::Client::new(channel) }
101    }
102
103    pub fn into_channel(self) -> fidl::Channel {
104        self.client.into_channel()
105    }
106
107    /// Waits until an event arrives and returns it. It is safe for other
108    /// threads to make concurrent requests while waiting for an event.
109    pub fn wait_for_event(
110        &self,
111        deadline: zx::MonotonicInstant,
112    ) -> Result<FilterEvent, fidl::Error> {
113        FilterEvent::decode(self.client.wait_for_event::<FilterMarker>(deadline)?)
114    }
115
116    /// Open a new *or* existing `NamespaceController`. The server end is
117    /// "auto-detached": in other words, it behaves as if the client has called
118    /// `Detach` on creation, and the lifetime of the filtering state is not
119    /// tied to the client end of the protocol. If the client does call
120    /// `Detach` on the `NamespaceController`, the server will close the
121    /// channel.
122    ///
123    /// Clients have unilateral access to add or remove resources owned by the
124    /// controller, irrespective of other clients' ownership. This includes the
125    /// ability to remove resources installed by other clients.
126    pub fn r#open_controller(
127        &self,
128        mut id: &str,
129        mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_net_filter::NamespaceControllerMarker>,
130    ) -> Result<(), fidl::Error> {
131        self.client.send::<FilterOpenControllerRequest>(
132            (id, request),
133            0x4f8742ed854ea1d1,
134            fidl::encoding::DynamicFlags::empty(),
135        )
136    }
137}
138
139#[cfg(target_os = "fuchsia")]
140impl From<FilterSynchronousProxy> for zx::NullableHandle {
141    fn from(value: FilterSynchronousProxy) -> Self {
142        value.into_channel().into()
143    }
144}
145
146#[cfg(target_os = "fuchsia")]
147impl From<fidl::Channel> for FilterSynchronousProxy {
148    fn from(value: fidl::Channel) -> Self {
149        Self::new(value)
150    }
151}
152
153#[cfg(target_os = "fuchsia")]
154impl fidl::endpoints::FromClient for FilterSynchronousProxy {
155    type Protocol = FilterMarker;
156
157    fn from_client(value: fidl::endpoints::ClientEnd<FilterMarker>) -> Self {
158        Self::new(value.into_channel())
159    }
160}
161
162#[derive(Debug, Clone)]
163pub struct FilterProxy {
164    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
165}
166
167impl fidl::endpoints::Proxy for FilterProxy {
168    type Protocol = FilterMarker;
169
170    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
171        Self::new(inner)
172    }
173
174    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
175        self.client.into_channel().map_err(|client| Self { client })
176    }
177
178    fn as_channel(&self) -> &::fidl::AsyncChannel {
179        self.client.as_channel()
180    }
181}
182
183impl FilterProxy {
184    /// Create a new Proxy for fuchsia.net.root/Filter.
185    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
186        let protocol_name = <FilterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
187        Self { client: fidl::client::Client::new(channel, protocol_name) }
188    }
189
190    /// Get a Stream of events from the remote end of the protocol.
191    ///
192    /// # Panics
193    ///
194    /// Panics if the event stream was already taken.
195    pub fn take_event_stream(&self) -> FilterEventStream {
196        FilterEventStream { event_receiver: self.client.take_event_receiver() }
197    }
198
199    /// Open a new *or* existing `NamespaceController`. The server end is
200    /// "auto-detached": in other words, it behaves as if the client has called
201    /// `Detach` on creation, and the lifetime of the filtering state is not
202    /// tied to the client end of the protocol. If the client does call
203    /// `Detach` on the `NamespaceController`, the server will close the
204    /// channel.
205    ///
206    /// Clients have unilateral access to add or remove resources owned by the
207    /// controller, irrespective of other clients' ownership. This includes the
208    /// ability to remove resources installed by other clients.
209    pub fn r#open_controller(
210        &self,
211        mut id: &str,
212        mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_net_filter::NamespaceControllerMarker>,
213    ) -> Result<(), fidl::Error> {
214        FilterProxyInterface::r#open_controller(self, id, request)
215    }
216}
217
218impl FilterProxyInterface for FilterProxy {
219    fn r#open_controller(
220        &self,
221        mut id: &str,
222        mut request: fidl::endpoints::ServerEnd<fidl_fuchsia_net_filter::NamespaceControllerMarker>,
223    ) -> Result<(), fidl::Error> {
224        self.client.send::<FilterOpenControllerRequest>(
225            (id, request),
226            0x4f8742ed854ea1d1,
227            fidl::encoding::DynamicFlags::empty(),
228        )
229    }
230}
231
232pub struct FilterEventStream {
233    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
234}
235
236impl std::marker::Unpin for FilterEventStream {}
237
238impl futures::stream::FusedStream for FilterEventStream {
239    fn is_terminated(&self) -> bool {
240        self.event_receiver.is_terminated()
241    }
242}
243
244impl futures::Stream for FilterEventStream {
245    type Item = Result<FilterEvent, fidl::Error>;
246
247    fn poll_next(
248        mut self: std::pin::Pin<&mut Self>,
249        cx: &mut std::task::Context<'_>,
250    ) -> std::task::Poll<Option<Self::Item>> {
251        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
252            &mut self.event_receiver,
253            cx
254        )?) {
255            Some(buf) => std::task::Poll::Ready(Some(FilterEvent::decode(buf))),
256            None => std::task::Poll::Ready(None),
257        }
258    }
259}
260
261#[derive(Debug)]
262pub enum FilterEvent {}
263
264impl FilterEvent {
265    /// Decodes a message buffer as a [`FilterEvent`].
266    fn decode(
267        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
268    ) -> Result<FilterEvent, fidl::Error> {
269        let (bytes, _handles) = buf.split_mut();
270        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
271        debug_assert_eq!(tx_header.tx_id, 0);
272        match tx_header.ordinal {
273            _ => Err(fidl::Error::UnknownOrdinal {
274                ordinal: tx_header.ordinal,
275                protocol_name: <FilterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
276            }),
277        }
278    }
279}
280
281/// A Stream of incoming requests for fuchsia.net.root/Filter.
282pub struct FilterRequestStream {
283    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
284    is_terminated: bool,
285}
286
287impl std::marker::Unpin for FilterRequestStream {}
288
289impl futures::stream::FusedStream for FilterRequestStream {
290    fn is_terminated(&self) -> bool {
291        self.is_terminated
292    }
293}
294
295impl fidl::endpoints::RequestStream for FilterRequestStream {
296    type Protocol = FilterMarker;
297    type ControlHandle = FilterControlHandle;
298
299    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
300        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
301    }
302
303    fn control_handle(&self) -> Self::ControlHandle {
304        FilterControlHandle { inner: self.inner.clone() }
305    }
306
307    fn into_inner(
308        self,
309    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
310    {
311        (self.inner, self.is_terminated)
312    }
313
314    fn from_inner(
315        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
316        is_terminated: bool,
317    ) -> Self {
318        Self { inner, is_terminated }
319    }
320}
321
322impl futures::Stream for FilterRequestStream {
323    type Item = Result<FilterRequest, fidl::Error>;
324
325    fn poll_next(
326        mut self: std::pin::Pin<&mut Self>,
327        cx: &mut std::task::Context<'_>,
328    ) -> std::task::Poll<Option<Self::Item>> {
329        let this = &mut *self;
330        if this.inner.check_shutdown(cx) {
331            this.is_terminated = true;
332            return std::task::Poll::Ready(None);
333        }
334        if this.is_terminated {
335            panic!("polled FilterRequestStream after completion");
336        }
337        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
338            |bytes, handles| {
339                match this.inner.channel().read_etc(cx, bytes, handles) {
340                    std::task::Poll::Ready(Ok(())) => {}
341                    std::task::Poll::Pending => return std::task::Poll::Pending,
342                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
343                        this.is_terminated = true;
344                        return std::task::Poll::Ready(None);
345                    }
346                    std::task::Poll::Ready(Err(e)) => {
347                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
348                            e.into(),
349                        ))));
350                    }
351                }
352
353                // A message has been received from the channel
354                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
355
356                std::task::Poll::Ready(Some(match header.ordinal {
357                    0x4f8742ed854ea1d1 => {
358                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
359                        let mut req = fidl::new_empty!(
360                            FilterOpenControllerRequest,
361                            fidl::encoding::DefaultFuchsiaResourceDialect
362                        );
363                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<FilterOpenControllerRequest>(&header, _body_bytes, handles, &mut req)?;
364                        let control_handle = FilterControlHandle { inner: this.inner.clone() };
365                        Ok(FilterRequest::OpenController {
366                            id: req.id,
367                            request: req.request,
368
369                            control_handle,
370                        })
371                    }
372                    _ => Err(fidl::Error::UnknownOrdinal {
373                        ordinal: header.ordinal,
374                        protocol_name:
375                            <FilterMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
376                    }),
377                }))
378            },
379        )
380    }
381}
382
383/// Provides administrative access to all filtering state.
384///
385/// This protocol provides the ability to bypass regular ownership controls
386/// which allow only the owner of each controller to modify or remove resources
387/// they added.
388///
389/// Circumventing the strong-ownership semantics through use of this protocol
390/// is highly discouraged and applications considering use of this protocol
391/// are encouraged to exhaust other options first by working with the Netstack
392/// team to find an alternative solution.
393#[derive(Debug)]
394pub enum FilterRequest {
395    /// Open a new *or* existing `NamespaceController`. The server end is
396    /// "auto-detached": in other words, it behaves as if the client has called
397    /// `Detach` on creation, and the lifetime of the filtering state is not
398    /// tied to the client end of the protocol. If the client does call
399    /// `Detach` on the `NamespaceController`, the server will close the
400    /// channel.
401    ///
402    /// Clients have unilateral access to add or remove resources owned by the
403    /// controller, irrespective of other clients' ownership. This includes the
404    /// ability to remove resources installed by other clients.
405    OpenController {
406        id: String,
407        request: fidl::endpoints::ServerEnd<fidl_fuchsia_net_filter::NamespaceControllerMarker>,
408        control_handle: FilterControlHandle,
409    },
410}
411
412impl FilterRequest {
413    #[allow(irrefutable_let_patterns)]
414    pub fn into_open_controller(
415        self,
416    ) -> Option<(
417        String,
418        fidl::endpoints::ServerEnd<fidl_fuchsia_net_filter::NamespaceControllerMarker>,
419        FilterControlHandle,
420    )> {
421        if let FilterRequest::OpenController { id, request, control_handle } = self {
422            Some((id, request, control_handle))
423        } else {
424            None
425        }
426    }
427
428    /// Name of the method defined in FIDL
429    pub fn method_name(&self) -> &'static str {
430        match *self {
431            FilterRequest::OpenController { .. } => "open_controller",
432        }
433    }
434}
435
436#[derive(Debug, Clone)]
437pub struct FilterControlHandle {
438    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
439}
440
441impl fidl::endpoints::ControlHandle for FilterControlHandle {
442    fn shutdown(&self) {
443        self.inner.shutdown()
444    }
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        Self { client: fidl::client::sync::Client::new(channel) }
523    }
524
525    pub fn into_channel(self) -> fidl::Channel {
526        self.client.into_channel()
527    }
528
529    /// Waits until an event arrives and returns it. It is safe for other
530    /// threads to make concurrent requests while waiting for an event.
531    pub fn wait_for_event(
532        &self,
533        deadline: zx::MonotonicInstant,
534    ) -> Result<InterfacesEvent, fidl::Error> {
535        InterfacesEvent::decode(self.client.wait_for_event::<InterfacesMarker>(deadline)?)
536    }
537
538    /// Obtain administrative control over a network interface.
539    ///
540    /// + request `id` identifies the interface to be controlled.
541    /// + request `control` grants the client administrative control over
542    ///     the interface. Closed without a terminal event if `id` does not
543    ///     match an existing interface.
544    pub fn r#get_admin(
545        &self,
546        mut id: u64,
547        mut control: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
548    ) -> Result<(), fidl::Error> {
549        self.client.send::<InterfacesGetAdminRequest>(
550            (id, control),
551            0x3cdcbf2452babedd,
552            fidl::encoding::DynamicFlags::empty(),
553        )
554    }
555
556    /// Return an interface's MAC address.
557    ///
558    /// + request `id` identifies the interface whose MAC is requested.
559    /// - response `mac` is the interface's MAC address, if it has one.
560    pub fn r#get_mac(
561        &self,
562        mut id: u64,
563        ___deadline: zx::MonotonicInstant,
564    ) -> Result<InterfacesGetMacResult, fidl::Error> {
565        let _response =
566            self.client.send_query::<InterfacesGetMacRequest, fidl::encoding::ResultType<
567                InterfacesGetMacResponse,
568                InterfacesGetMacError,
569            >, InterfacesMarker>(
570                (id,),
571                0x720643bc62a26d61,
572                fidl::encoding::DynamicFlags::empty(),
573                ___deadline,
574            )?;
575        Ok(_response.map(|x| x.mac))
576    }
577}
578
579#[cfg(target_os = "fuchsia")]
580impl From<InterfacesSynchronousProxy> for zx::NullableHandle {
581    fn from(value: InterfacesSynchronousProxy) -> Self {
582        value.into_channel().into()
583    }
584}
585
586#[cfg(target_os = "fuchsia")]
587impl From<fidl::Channel> for InterfacesSynchronousProxy {
588    fn from(value: fidl::Channel) -> Self {
589        Self::new(value)
590    }
591}
592
593#[cfg(target_os = "fuchsia")]
594impl fidl::endpoints::FromClient for InterfacesSynchronousProxy {
595    type Protocol = InterfacesMarker;
596
597    fn from_client(value: fidl::endpoints::ClientEnd<InterfacesMarker>) -> Self {
598        Self::new(value.into_channel())
599    }
600}
601
602#[derive(Debug, Clone)]
603pub struct InterfacesProxy {
604    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
605}
606
607impl fidl::endpoints::Proxy for InterfacesProxy {
608    type Protocol = InterfacesMarker;
609
610    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
611        Self::new(inner)
612    }
613
614    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
615        self.client.into_channel().map_err(|client| Self { client })
616    }
617
618    fn as_channel(&self) -> &::fidl::AsyncChannel {
619        self.client.as_channel()
620    }
621}
622
623impl InterfacesProxy {
624    /// Create a new Proxy for fuchsia.net.root/Interfaces.
625    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
626        let protocol_name = <InterfacesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
627        Self { client: fidl::client::Client::new(channel, protocol_name) }
628    }
629
630    /// Get a Stream of events from the remote end of the protocol.
631    ///
632    /// # Panics
633    ///
634    /// Panics if the event stream was already taken.
635    pub fn take_event_stream(&self) -> InterfacesEventStream {
636        InterfacesEventStream { event_receiver: self.client.take_event_receiver() }
637    }
638
639    /// Obtain administrative control over a network interface.
640    ///
641    /// + request `id` identifies the interface to be controlled.
642    /// + request `control` grants the client administrative control over
643    ///     the interface. Closed without a terminal event if `id` does not
644    ///     match an existing interface.
645    pub fn r#get_admin(
646        &self,
647        mut id: u64,
648        mut control: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
649    ) -> Result<(), fidl::Error> {
650        InterfacesProxyInterface::r#get_admin(self, id, control)
651    }
652
653    /// Return an interface's MAC address.
654    ///
655    /// + request `id` identifies the interface whose MAC is requested.
656    /// - response `mac` is the interface's MAC address, if it has one.
657    pub fn r#get_mac(
658        &self,
659        mut id: u64,
660    ) -> fidl::client::QueryResponseFut<
661        InterfacesGetMacResult,
662        fidl::encoding::DefaultFuchsiaResourceDialect,
663    > {
664        InterfacesProxyInterface::r#get_mac(self, id)
665    }
666}
667
668impl InterfacesProxyInterface for InterfacesProxy {
669    fn r#get_admin(
670        &self,
671        mut id: u64,
672        mut control: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
673    ) -> Result<(), fidl::Error> {
674        self.client.send::<InterfacesGetAdminRequest>(
675            (id, control),
676            0x3cdcbf2452babedd,
677            fidl::encoding::DynamicFlags::empty(),
678        )
679    }
680
681    type GetMacResponseFut = fidl::client::QueryResponseFut<
682        InterfacesGetMacResult,
683        fidl::encoding::DefaultFuchsiaResourceDialect,
684    >;
685    fn r#get_mac(&self, mut id: u64) -> Self::GetMacResponseFut {
686        fn _decode(
687            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
688        ) -> Result<InterfacesGetMacResult, fidl::Error> {
689            let _response = fidl::client::decode_transaction_body::<
690                fidl::encoding::ResultType<InterfacesGetMacResponse, InterfacesGetMacError>,
691                fidl::encoding::DefaultFuchsiaResourceDialect,
692                0x720643bc62a26d61,
693            >(_buf?)?;
694            Ok(_response.map(|x| x.mac))
695        }
696        self.client.send_query_and_decode::<InterfacesGetMacRequest, InterfacesGetMacResult>(
697            (id,),
698            0x720643bc62a26d61,
699            fidl::encoding::DynamicFlags::empty(),
700            _decode,
701        )
702    }
703}
704
705pub struct InterfacesEventStream {
706    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
707}
708
709impl std::marker::Unpin for InterfacesEventStream {}
710
711impl futures::stream::FusedStream for InterfacesEventStream {
712    fn is_terminated(&self) -> bool {
713        self.event_receiver.is_terminated()
714    }
715}
716
717impl futures::Stream for InterfacesEventStream {
718    type Item = Result<InterfacesEvent, fidl::Error>;
719
720    fn poll_next(
721        mut self: std::pin::Pin<&mut Self>,
722        cx: &mut std::task::Context<'_>,
723    ) -> std::task::Poll<Option<Self::Item>> {
724        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
725            &mut self.event_receiver,
726            cx
727        )?) {
728            Some(buf) => std::task::Poll::Ready(Some(InterfacesEvent::decode(buf))),
729            None => std::task::Poll::Ready(None),
730        }
731    }
732}
733
734#[derive(Debug)]
735pub enum InterfacesEvent {}
736
737impl InterfacesEvent {
738    /// Decodes a message buffer as a [`InterfacesEvent`].
739    fn decode(
740        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
741    ) -> Result<InterfacesEvent, fidl::Error> {
742        let (bytes, _handles) = buf.split_mut();
743        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
744        debug_assert_eq!(tx_header.tx_id, 0);
745        match tx_header.ordinal {
746            _ => Err(fidl::Error::UnknownOrdinal {
747                ordinal: tx_header.ordinal,
748                protocol_name: <InterfacesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
749            }),
750        }
751    }
752}
753
754/// A Stream of incoming requests for fuchsia.net.root/Interfaces.
755pub struct InterfacesRequestStream {
756    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
757    is_terminated: bool,
758}
759
760impl std::marker::Unpin for InterfacesRequestStream {}
761
762impl futures::stream::FusedStream for InterfacesRequestStream {
763    fn is_terminated(&self) -> bool {
764        self.is_terminated
765    }
766}
767
768impl fidl::endpoints::RequestStream for InterfacesRequestStream {
769    type Protocol = InterfacesMarker;
770    type ControlHandle = InterfacesControlHandle;
771
772    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
773        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
774    }
775
776    fn control_handle(&self) -> Self::ControlHandle {
777        InterfacesControlHandle { inner: self.inner.clone() }
778    }
779
780    fn into_inner(
781        self,
782    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
783    {
784        (self.inner, self.is_terminated)
785    }
786
787    fn from_inner(
788        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
789        is_terminated: bool,
790    ) -> Self {
791        Self { inner, is_terminated }
792    }
793}
794
795impl futures::Stream for InterfacesRequestStream {
796    type Item = Result<InterfacesRequest, fidl::Error>;
797
798    fn poll_next(
799        mut self: std::pin::Pin<&mut Self>,
800        cx: &mut std::task::Context<'_>,
801    ) -> std::task::Poll<Option<Self::Item>> {
802        let this = &mut *self;
803        if this.inner.check_shutdown(cx) {
804            this.is_terminated = true;
805            return std::task::Poll::Ready(None);
806        }
807        if this.is_terminated {
808            panic!("polled InterfacesRequestStream after completion");
809        }
810        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
811            |bytes, handles| {
812                match this.inner.channel().read_etc(cx, bytes, handles) {
813                    std::task::Poll::Ready(Ok(())) => {}
814                    std::task::Poll::Pending => return std::task::Poll::Pending,
815                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
816                        this.is_terminated = true;
817                        return std::task::Poll::Ready(None);
818                    }
819                    std::task::Poll::Ready(Err(e)) => {
820                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
821                            e.into(),
822                        ))));
823                    }
824                }
825
826                // A message has been received from the channel
827                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
828
829                std::task::Poll::Ready(Some(match header.ordinal {
830                    0x3cdcbf2452babedd => {
831                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
832                        let mut req = fidl::new_empty!(
833                            InterfacesGetAdminRequest,
834                            fidl::encoding::DefaultFuchsiaResourceDialect
835                        );
836                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InterfacesGetAdminRequest>(&header, _body_bytes, handles, &mut req)?;
837                        let control_handle = InterfacesControlHandle { inner: this.inner.clone() };
838                        Ok(InterfacesRequest::GetAdmin {
839                            id: req.id,
840                            control: req.control,
841
842                            control_handle,
843                        })
844                    }
845                    0x720643bc62a26d61 => {
846                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
847                        let mut req = fidl::new_empty!(
848                            InterfacesGetMacRequest,
849                            fidl::encoding::DefaultFuchsiaResourceDialect
850                        );
851                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InterfacesGetMacRequest>(&header, _body_bytes, handles, &mut req)?;
852                        let control_handle = InterfacesControlHandle { inner: this.inner.clone() };
853                        Ok(InterfacesRequest::GetMac {
854                            id: req.id,
855
856                            responder: InterfacesGetMacResponder {
857                                control_handle: std::mem::ManuallyDrop::new(control_handle),
858                                tx_id: header.tx_id,
859                            },
860                        })
861                    }
862                    _ => Err(fidl::Error::UnknownOrdinal {
863                        ordinal: header.ordinal,
864                        protocol_name:
865                            <InterfacesMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
866                    }),
867                }))
868            },
869        )
870    }
871}
872
873/// Provides access to installed network interfaces.
874///
875/// This protocol provides the ability to bypass regular ownership-controls
876/// which allow only the interface owner (generally the entity installing the
877/// interface) to perform management operations on an interface.
878///
879/// Circumventing the strong-ownership semantics through use of this protocol
880/// is highly discouraged and applications considering use of this protocol
881/// are encouraged to exhaust other options first by working with the Netstack
882/// team to find an alternative solution.
883#[derive(Debug)]
884pub enum InterfacesRequest {
885    /// Obtain administrative control over a network interface.
886    ///
887    /// + request `id` identifies the interface to be controlled.
888    /// + request `control` grants the client administrative control over
889    ///     the interface. Closed without a terminal event if `id` does not
890    ///     match an existing interface.
891    GetAdmin {
892        id: u64,
893        control: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
894        control_handle: InterfacesControlHandle,
895    },
896    /// Return an interface's MAC address.
897    ///
898    /// + request `id` identifies the interface whose MAC is requested.
899    /// - response `mac` is the interface's MAC address, if it has one.
900    GetMac { id: u64, responder: InterfacesGetMacResponder },
901}
902
903impl InterfacesRequest {
904    #[allow(irrefutable_let_patterns)]
905    pub fn into_get_admin(
906        self,
907    ) -> Option<(
908        u64,
909        fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
910        InterfacesControlHandle,
911    )> {
912        if let InterfacesRequest::GetAdmin { id, control, control_handle } = self {
913            Some((id, control, control_handle))
914        } else {
915            None
916        }
917    }
918
919    #[allow(irrefutable_let_patterns)]
920    pub fn into_get_mac(self) -> Option<(u64, InterfacesGetMacResponder)> {
921        if let InterfacesRequest::GetMac { id, responder } = self {
922            Some((id, responder))
923        } else {
924            None
925        }
926    }
927
928    /// Name of the method defined in FIDL
929    pub fn method_name(&self) -> &'static str {
930        match *self {
931            InterfacesRequest::GetAdmin { .. } => "get_admin",
932            InterfacesRequest::GetMac { .. } => "get_mac",
933        }
934    }
935}
936
937#[derive(Debug, Clone)]
938pub struct InterfacesControlHandle {
939    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
940}
941
942impl fidl::endpoints::ControlHandle for InterfacesControlHandle {
943    fn shutdown(&self) {
944        self.inner.shutdown()
945    }
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        Self { client: fidl::client::sync::Client::new(channel) }
1093    }
1094
1095    pub fn into_channel(self) -> fidl::Channel {
1096        self.client.into_channel()
1097    }
1098
1099    /// Waits until an event arrives and returns it. It is safe for other
1100    /// threads to make concurrent requests while waiting for an event.
1101    pub fn wait_for_event(
1102        &self,
1103        deadline: zx::MonotonicInstant,
1104    ) -> Result<RoutesV4Event, fidl::Error> {
1105        RoutesV4Event::decode(self.client.wait_for_event::<RoutesV4Marker>(deadline)?)
1106    }
1107
1108    /// Returns a `RouteSetV4` containing all IPv4 routes from the global
1109    /// routing table. Clients have unilateral access to add or remove routes
1110    /// from the set. This includes the ability to remove routes installed by
1111    /// the system, or routes installed by other clients of the `RouteSetV4`
1112    /// protocol.
1113    ///
1114    /// Note that the established connection to the `RouteSetV4` protocol will
1115    /// have a few notable differences from a `RouteSetV4` obtained by
1116    /// [`fuchsia.net.routes.admin/RouteTableV4.NewRouteSet`]:
1117    ///   - When removing a route from this route set, the route will be
1118    ///     completely removed from the system, including removal from all other
1119    ///     route sets to which it belongs.
1120    ///   - The protocol does not encode the lifetime of the route set or its
1121    ///     routes. Closing the client end will not cause the routes within this
1122    ///     route set to be removed from the system. Thus, routes added via this
1123    ///     route set will effectively be abandoned/unowned after this
1124    ///     client-end closes.
1125    ///
1126    /// + request `route set` grants access to the `RouteSetV4` protocol.
1127    pub fn r#global_route_set(
1128        &self,
1129        mut route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV4Marker>,
1130    ) -> Result<(), fidl::Error> {
1131        self.client.send::<RoutesV4GlobalRouteSetRequest>(
1132            (route_set,),
1133            0x3c0b279c61d81812,
1134            fidl::encoding::DynamicFlags::empty(),
1135        )
1136    }
1137}
1138
1139#[cfg(target_os = "fuchsia")]
1140impl From<RoutesV4SynchronousProxy> for zx::NullableHandle {
1141    fn from(value: RoutesV4SynchronousProxy) -> Self {
1142        value.into_channel().into()
1143    }
1144}
1145
1146#[cfg(target_os = "fuchsia")]
1147impl From<fidl::Channel> for RoutesV4SynchronousProxy {
1148    fn from(value: fidl::Channel) -> Self {
1149        Self::new(value)
1150    }
1151}
1152
1153#[cfg(target_os = "fuchsia")]
1154impl fidl::endpoints::FromClient for RoutesV4SynchronousProxy {
1155    type Protocol = RoutesV4Marker;
1156
1157    fn from_client(value: fidl::endpoints::ClientEnd<RoutesV4Marker>) -> Self {
1158        Self::new(value.into_channel())
1159    }
1160}
1161
1162#[derive(Debug, Clone)]
1163pub struct RoutesV4Proxy {
1164    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1165}
1166
1167impl fidl::endpoints::Proxy for RoutesV4Proxy {
1168    type Protocol = RoutesV4Marker;
1169
1170    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1171        Self::new(inner)
1172    }
1173
1174    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1175        self.client.into_channel().map_err(|client| Self { client })
1176    }
1177
1178    fn as_channel(&self) -> &::fidl::AsyncChannel {
1179        self.client.as_channel()
1180    }
1181}
1182
1183impl RoutesV4Proxy {
1184    /// Create a new Proxy for fuchsia.net.root/RoutesV4.
1185    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1186        let protocol_name = <RoutesV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1187        Self { client: fidl::client::Client::new(channel, protocol_name) }
1188    }
1189
1190    /// Get a Stream of events from the remote end of the protocol.
1191    ///
1192    /// # Panics
1193    ///
1194    /// Panics if the event stream was already taken.
1195    pub fn take_event_stream(&self) -> RoutesV4EventStream {
1196        RoutesV4EventStream { event_receiver: self.client.take_event_receiver() }
1197    }
1198
1199    /// Returns a `RouteSetV4` containing all IPv4 routes from the global
1200    /// routing table. Clients have unilateral access to add or remove routes
1201    /// from the set. This includes the ability to remove routes installed by
1202    /// the system, or routes installed by other clients of the `RouteSetV4`
1203    /// protocol.
1204    ///
1205    /// Note that the established connection to the `RouteSetV4` protocol will
1206    /// have a few notable differences from a `RouteSetV4` obtained by
1207    /// [`fuchsia.net.routes.admin/RouteTableV4.NewRouteSet`]:
1208    ///   - When removing a route from this route set, the route will be
1209    ///     completely removed from the system, including removal from all other
1210    ///     route sets to which it belongs.
1211    ///   - The protocol does not encode the lifetime of the route set or its
1212    ///     routes. Closing the client end will not cause the routes within this
1213    ///     route set to be removed from the system. Thus, routes added via this
1214    ///     route set will effectively be abandoned/unowned after this
1215    ///     client-end closes.
1216    ///
1217    /// + request `route set` grants access to the `RouteSetV4` protocol.
1218    pub fn r#global_route_set(
1219        &self,
1220        mut route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV4Marker>,
1221    ) -> Result<(), fidl::Error> {
1222        RoutesV4ProxyInterface::r#global_route_set(self, route_set)
1223    }
1224}
1225
1226impl RoutesV4ProxyInterface for RoutesV4Proxy {
1227    fn r#global_route_set(
1228        &self,
1229        mut route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV4Marker>,
1230    ) -> Result<(), fidl::Error> {
1231        self.client.send::<RoutesV4GlobalRouteSetRequest>(
1232            (route_set,),
1233            0x3c0b279c61d81812,
1234            fidl::encoding::DynamicFlags::empty(),
1235        )
1236    }
1237}
1238
1239pub struct RoutesV4EventStream {
1240    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1241}
1242
1243impl std::marker::Unpin for RoutesV4EventStream {}
1244
1245impl futures::stream::FusedStream for RoutesV4EventStream {
1246    fn is_terminated(&self) -> bool {
1247        self.event_receiver.is_terminated()
1248    }
1249}
1250
1251impl futures::Stream for RoutesV4EventStream {
1252    type Item = Result<RoutesV4Event, fidl::Error>;
1253
1254    fn poll_next(
1255        mut self: std::pin::Pin<&mut Self>,
1256        cx: &mut std::task::Context<'_>,
1257    ) -> std::task::Poll<Option<Self::Item>> {
1258        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1259            &mut self.event_receiver,
1260            cx
1261        )?) {
1262            Some(buf) => std::task::Poll::Ready(Some(RoutesV4Event::decode(buf))),
1263            None => std::task::Poll::Ready(None),
1264        }
1265    }
1266}
1267
1268#[derive(Debug)]
1269pub enum RoutesV4Event {}
1270
1271impl RoutesV4Event {
1272    /// Decodes a message buffer as a [`RoutesV4Event`].
1273    fn decode(
1274        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1275    ) -> Result<RoutesV4Event, fidl::Error> {
1276        let (bytes, _handles) = buf.split_mut();
1277        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1278        debug_assert_eq!(tx_header.tx_id, 0);
1279        match tx_header.ordinal {
1280            _ => Err(fidl::Error::UnknownOrdinal {
1281                ordinal: tx_header.ordinal,
1282                protocol_name: <RoutesV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1283            }),
1284        }
1285    }
1286}
1287
1288/// A Stream of incoming requests for fuchsia.net.root/RoutesV4.
1289pub struct RoutesV4RequestStream {
1290    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1291    is_terminated: bool,
1292}
1293
1294impl std::marker::Unpin for RoutesV4RequestStream {}
1295
1296impl futures::stream::FusedStream for RoutesV4RequestStream {
1297    fn is_terminated(&self) -> bool {
1298        self.is_terminated
1299    }
1300}
1301
1302impl fidl::endpoints::RequestStream for RoutesV4RequestStream {
1303    type Protocol = RoutesV4Marker;
1304    type ControlHandle = RoutesV4ControlHandle;
1305
1306    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1307        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1308    }
1309
1310    fn control_handle(&self) -> Self::ControlHandle {
1311        RoutesV4ControlHandle { inner: self.inner.clone() }
1312    }
1313
1314    fn into_inner(
1315        self,
1316    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1317    {
1318        (self.inner, self.is_terminated)
1319    }
1320
1321    fn from_inner(
1322        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1323        is_terminated: bool,
1324    ) -> Self {
1325        Self { inner, is_terminated }
1326    }
1327}
1328
1329impl futures::Stream for RoutesV4RequestStream {
1330    type Item = Result<RoutesV4Request, fidl::Error>;
1331
1332    fn poll_next(
1333        mut self: std::pin::Pin<&mut Self>,
1334        cx: &mut std::task::Context<'_>,
1335    ) -> std::task::Poll<Option<Self::Item>> {
1336        let this = &mut *self;
1337        if this.inner.check_shutdown(cx) {
1338            this.is_terminated = true;
1339            return std::task::Poll::Ready(None);
1340        }
1341        if this.is_terminated {
1342            panic!("polled RoutesV4RequestStream after completion");
1343        }
1344        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1345            |bytes, handles| {
1346                match this.inner.channel().read_etc(cx, bytes, handles) {
1347                    std::task::Poll::Ready(Ok(())) => {}
1348                    std::task::Poll::Pending => return std::task::Poll::Pending,
1349                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1350                        this.is_terminated = true;
1351                        return std::task::Poll::Ready(None);
1352                    }
1353                    std::task::Poll::Ready(Err(e)) => {
1354                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1355                            e.into(),
1356                        ))));
1357                    }
1358                }
1359
1360                // A message has been received from the channel
1361                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1362
1363                std::task::Poll::Ready(Some(match header.ordinal {
1364                    0x3c0b279c61d81812 => {
1365                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1366                        let mut req = fidl::new_empty!(
1367                            RoutesV4GlobalRouteSetRequest,
1368                            fidl::encoding::DefaultFuchsiaResourceDialect
1369                        );
1370                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RoutesV4GlobalRouteSetRequest>(&header, _body_bytes, handles, &mut req)?;
1371                        let control_handle = RoutesV4ControlHandle { inner: this.inner.clone() };
1372                        Ok(RoutesV4Request::GlobalRouteSet {
1373                            route_set: req.route_set,
1374
1375                            control_handle,
1376                        })
1377                    }
1378                    _ => Err(fidl::Error::UnknownOrdinal {
1379                        ordinal: header.ordinal,
1380                        protocol_name:
1381                            <RoutesV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1382                    }),
1383                }))
1384            },
1385        )
1386    }
1387}
1388
1389/// Provides access to IPv4 routes.
1390///
1391/// This protocol provides the ability to bypass regular ownership-controls
1392/// which allow only the route set owner to remove routes it added.
1393///
1394/// Circumventing the strong-ownership semantics through use of this protocol
1395/// is highly discouraged and applications considering use of this protocol
1396/// are encouraged to exhaust other options first by working with the Netstack
1397/// team to find an alternative solution.
1398#[derive(Debug)]
1399pub enum RoutesV4Request {
1400    /// Returns a `RouteSetV4` containing all IPv4 routes from the global
1401    /// routing table. Clients have unilateral access to add or remove routes
1402    /// from the set. This includes the ability to remove routes installed by
1403    /// the system, or routes installed by other clients of the `RouteSetV4`
1404    /// protocol.
1405    ///
1406    /// Note that the established connection to the `RouteSetV4` protocol will
1407    /// have a few notable differences from a `RouteSetV4` obtained by
1408    /// [`fuchsia.net.routes.admin/RouteTableV4.NewRouteSet`]:
1409    ///   - When removing a route from this route set, the route will be
1410    ///     completely removed from the system, including removal from all other
1411    ///     route sets to which it belongs.
1412    ///   - The protocol does not encode the lifetime of the route set or its
1413    ///     routes. Closing the client end will not cause the routes within this
1414    ///     route set to be removed from the system. Thus, routes added via this
1415    ///     route set will effectively be abandoned/unowned after this
1416    ///     client-end closes.
1417    ///
1418    /// + request `route set` grants access to the `RouteSetV4` protocol.
1419    GlobalRouteSet {
1420        route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV4Marker>,
1421        control_handle: RoutesV4ControlHandle,
1422    },
1423}
1424
1425impl RoutesV4Request {
1426    #[allow(irrefutable_let_patterns)]
1427    pub fn into_global_route_set(
1428        self,
1429    ) -> Option<(
1430        fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV4Marker>,
1431        RoutesV4ControlHandle,
1432    )> {
1433        if let RoutesV4Request::GlobalRouteSet { route_set, control_handle } = self {
1434            Some((route_set, control_handle))
1435        } else {
1436            None
1437        }
1438    }
1439
1440    /// Name of the method defined in FIDL
1441    pub fn method_name(&self) -> &'static str {
1442        match *self {
1443            RoutesV4Request::GlobalRouteSet { .. } => "global_route_set",
1444        }
1445    }
1446}
1447
1448#[derive(Debug, Clone)]
1449pub struct RoutesV4ControlHandle {
1450    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1451}
1452
1453impl fidl::endpoints::ControlHandle for RoutesV4ControlHandle {
1454    fn shutdown(&self) {
1455        self.inner.shutdown()
1456    }
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        Self { client: fidl::client::sync::Client::new(channel) }
1529    }
1530
1531    pub fn into_channel(self) -> fidl::Channel {
1532        self.client.into_channel()
1533    }
1534
1535    /// Waits until an event arrives and returns it. It is safe for other
1536    /// threads to make concurrent requests while waiting for an event.
1537    pub fn wait_for_event(
1538        &self,
1539        deadline: zx::MonotonicInstant,
1540    ) -> Result<RoutesV6Event, fidl::Error> {
1541        RoutesV6Event::decode(self.client.wait_for_event::<RoutesV6Marker>(deadline)?)
1542    }
1543
1544    /// Returns a `RouteSetV6` containing all IPv6 routes from the global
1545    /// routing table. Clients have unilateral access to add or remove routes
1546    /// from the set. This includes the ability to remove routes installed by
1547    /// the system, or routes installed by other clients of the `RouteSetV6`
1548    /// protocol.
1549    ///
1550    /// Note that the established connection to the `RouteSetV6` protocol will
1551    /// have a few notable differences from a `RouteSetV6` obtained by
1552    /// [`fuchsia.net.routes.admin/RouteTableV6.NewRouteSet`]:
1553    ///   - When removing a route from this route set, the route will be
1554    ///     completely removed from the system, including removal from all other
1555    ///     route sets to which it belongs.
1556    ///   - The protocol does not encode the lifetime of the route set or its
1557    ///     routes. Closing the client end will not cause the routes within this
1558    ///     route set to be removed from the system. Thus, routes added via this
1559    ///     route set will effectively be abandoned/unowned after this
1560    ///     client-end closes.
1561    ///
1562    /// + request `route set` grants access to the `RouteSetV6` protocol.
1563    pub fn r#global_route_set(
1564        &self,
1565        mut route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV6Marker>,
1566    ) -> Result<(), fidl::Error> {
1567        self.client.send::<RoutesV6GlobalRouteSetRequest>(
1568            (route_set,),
1569            0x41336f581f8d6a61,
1570            fidl::encoding::DynamicFlags::empty(),
1571        )
1572    }
1573}
1574
1575#[cfg(target_os = "fuchsia")]
1576impl From<RoutesV6SynchronousProxy> for zx::NullableHandle {
1577    fn from(value: RoutesV6SynchronousProxy) -> Self {
1578        value.into_channel().into()
1579    }
1580}
1581
1582#[cfg(target_os = "fuchsia")]
1583impl From<fidl::Channel> for RoutesV6SynchronousProxy {
1584    fn from(value: fidl::Channel) -> Self {
1585        Self::new(value)
1586    }
1587}
1588
1589#[cfg(target_os = "fuchsia")]
1590impl fidl::endpoints::FromClient for RoutesV6SynchronousProxy {
1591    type Protocol = RoutesV6Marker;
1592
1593    fn from_client(value: fidl::endpoints::ClientEnd<RoutesV6Marker>) -> Self {
1594        Self::new(value.into_channel())
1595    }
1596}
1597
1598#[derive(Debug, Clone)]
1599pub struct RoutesV6Proxy {
1600    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1601}
1602
1603impl fidl::endpoints::Proxy for RoutesV6Proxy {
1604    type Protocol = RoutesV6Marker;
1605
1606    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1607        Self::new(inner)
1608    }
1609
1610    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1611        self.client.into_channel().map_err(|client| Self { client })
1612    }
1613
1614    fn as_channel(&self) -> &::fidl::AsyncChannel {
1615        self.client.as_channel()
1616    }
1617}
1618
1619impl RoutesV6Proxy {
1620    /// Create a new Proxy for fuchsia.net.root/RoutesV6.
1621    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1622        let protocol_name = <RoutesV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1623        Self { client: fidl::client::Client::new(channel, protocol_name) }
1624    }
1625
1626    /// Get a Stream of events from the remote end of the protocol.
1627    ///
1628    /// # Panics
1629    ///
1630    /// Panics if the event stream was already taken.
1631    pub fn take_event_stream(&self) -> RoutesV6EventStream {
1632        RoutesV6EventStream { event_receiver: self.client.take_event_receiver() }
1633    }
1634
1635    /// Returns a `RouteSetV6` containing all IPv6 routes from the global
1636    /// routing table. Clients have unilateral access to add or remove routes
1637    /// from the set. This includes the ability to remove routes installed by
1638    /// the system, or routes installed by other clients of the `RouteSetV6`
1639    /// protocol.
1640    ///
1641    /// Note that the established connection to the `RouteSetV6` protocol will
1642    /// have a few notable differences from a `RouteSetV6` obtained by
1643    /// [`fuchsia.net.routes.admin/RouteTableV6.NewRouteSet`]:
1644    ///   - When removing a route from this route set, the route will be
1645    ///     completely removed from the system, including removal from all other
1646    ///     route sets to which it belongs.
1647    ///   - The protocol does not encode the lifetime of the route set or its
1648    ///     routes. Closing the client end will not cause the routes within this
1649    ///     route set to be removed from the system. Thus, routes added via this
1650    ///     route set will effectively be abandoned/unowned after this
1651    ///     client-end closes.
1652    ///
1653    /// + request `route set` grants access to the `RouteSetV6` protocol.
1654    pub fn r#global_route_set(
1655        &self,
1656        mut route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV6Marker>,
1657    ) -> Result<(), fidl::Error> {
1658        RoutesV6ProxyInterface::r#global_route_set(self, route_set)
1659    }
1660}
1661
1662impl RoutesV6ProxyInterface for RoutesV6Proxy {
1663    fn r#global_route_set(
1664        &self,
1665        mut route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV6Marker>,
1666    ) -> Result<(), fidl::Error> {
1667        self.client.send::<RoutesV6GlobalRouteSetRequest>(
1668            (route_set,),
1669            0x41336f581f8d6a61,
1670            fidl::encoding::DynamicFlags::empty(),
1671        )
1672    }
1673}
1674
1675pub struct RoutesV6EventStream {
1676    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1677}
1678
1679impl std::marker::Unpin for RoutesV6EventStream {}
1680
1681impl futures::stream::FusedStream for RoutesV6EventStream {
1682    fn is_terminated(&self) -> bool {
1683        self.event_receiver.is_terminated()
1684    }
1685}
1686
1687impl futures::Stream for RoutesV6EventStream {
1688    type Item = Result<RoutesV6Event, fidl::Error>;
1689
1690    fn poll_next(
1691        mut self: std::pin::Pin<&mut Self>,
1692        cx: &mut std::task::Context<'_>,
1693    ) -> std::task::Poll<Option<Self::Item>> {
1694        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1695            &mut self.event_receiver,
1696            cx
1697        )?) {
1698            Some(buf) => std::task::Poll::Ready(Some(RoutesV6Event::decode(buf))),
1699            None => std::task::Poll::Ready(None),
1700        }
1701    }
1702}
1703
1704#[derive(Debug)]
1705pub enum RoutesV6Event {}
1706
1707impl RoutesV6Event {
1708    /// Decodes a message buffer as a [`RoutesV6Event`].
1709    fn decode(
1710        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1711    ) -> Result<RoutesV6Event, fidl::Error> {
1712        let (bytes, _handles) = buf.split_mut();
1713        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1714        debug_assert_eq!(tx_header.tx_id, 0);
1715        match tx_header.ordinal {
1716            _ => Err(fidl::Error::UnknownOrdinal {
1717                ordinal: tx_header.ordinal,
1718                protocol_name: <RoutesV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1719            }),
1720        }
1721    }
1722}
1723
1724/// A Stream of incoming requests for fuchsia.net.root/RoutesV6.
1725pub struct RoutesV6RequestStream {
1726    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1727    is_terminated: bool,
1728}
1729
1730impl std::marker::Unpin for RoutesV6RequestStream {}
1731
1732impl futures::stream::FusedStream for RoutesV6RequestStream {
1733    fn is_terminated(&self) -> bool {
1734        self.is_terminated
1735    }
1736}
1737
1738impl fidl::endpoints::RequestStream for RoutesV6RequestStream {
1739    type Protocol = RoutesV6Marker;
1740    type ControlHandle = RoutesV6ControlHandle;
1741
1742    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1743        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1744    }
1745
1746    fn control_handle(&self) -> Self::ControlHandle {
1747        RoutesV6ControlHandle { inner: self.inner.clone() }
1748    }
1749
1750    fn into_inner(
1751        self,
1752    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1753    {
1754        (self.inner, self.is_terminated)
1755    }
1756
1757    fn from_inner(
1758        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1759        is_terminated: bool,
1760    ) -> Self {
1761        Self { inner, is_terminated }
1762    }
1763}
1764
1765impl futures::Stream for RoutesV6RequestStream {
1766    type Item = Result<RoutesV6Request, fidl::Error>;
1767
1768    fn poll_next(
1769        mut self: std::pin::Pin<&mut Self>,
1770        cx: &mut std::task::Context<'_>,
1771    ) -> std::task::Poll<Option<Self::Item>> {
1772        let this = &mut *self;
1773        if this.inner.check_shutdown(cx) {
1774            this.is_terminated = true;
1775            return std::task::Poll::Ready(None);
1776        }
1777        if this.is_terminated {
1778            panic!("polled RoutesV6RequestStream after completion");
1779        }
1780        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1781            |bytes, handles| {
1782                match this.inner.channel().read_etc(cx, bytes, handles) {
1783                    std::task::Poll::Ready(Ok(())) => {}
1784                    std::task::Poll::Pending => return std::task::Poll::Pending,
1785                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1786                        this.is_terminated = true;
1787                        return std::task::Poll::Ready(None);
1788                    }
1789                    std::task::Poll::Ready(Err(e)) => {
1790                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1791                            e.into(),
1792                        ))));
1793                    }
1794                }
1795
1796                // A message has been received from the channel
1797                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1798
1799                std::task::Poll::Ready(Some(match header.ordinal {
1800                    0x41336f581f8d6a61 => {
1801                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1802                        let mut req = fidl::new_empty!(
1803                            RoutesV6GlobalRouteSetRequest,
1804                            fidl::encoding::DefaultFuchsiaResourceDialect
1805                        );
1806                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<RoutesV6GlobalRouteSetRequest>(&header, _body_bytes, handles, &mut req)?;
1807                        let control_handle = RoutesV6ControlHandle { inner: this.inner.clone() };
1808                        Ok(RoutesV6Request::GlobalRouteSet {
1809                            route_set: req.route_set,
1810
1811                            control_handle,
1812                        })
1813                    }
1814                    _ => Err(fidl::Error::UnknownOrdinal {
1815                        ordinal: header.ordinal,
1816                        protocol_name:
1817                            <RoutesV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1818                    }),
1819                }))
1820            },
1821        )
1822    }
1823}
1824
1825/// Provides access to IPv6 routes.
1826///
1827/// This protocol provides the ability to bypass regular ownership-controls
1828/// which allow only the route set owner to remove routes it added.
1829///
1830/// Circumventing the strong-ownership semantics through use of this protocol
1831/// is highly discouraged and applications considering use of this protocol
1832/// are encouraged to exhaust other options first by working with the Netstack
1833/// team to find an alternative solution.
1834#[derive(Debug)]
1835pub enum RoutesV6Request {
1836    /// Returns a `RouteSetV6` containing all IPv6 routes from the global
1837    /// routing table. Clients have unilateral access to add or remove routes
1838    /// from the set. This includes the ability to remove routes installed by
1839    /// the system, or routes installed by other clients of the `RouteSetV6`
1840    /// protocol.
1841    ///
1842    /// Note that the established connection to the `RouteSetV6` protocol will
1843    /// have a few notable differences from a `RouteSetV6` obtained by
1844    /// [`fuchsia.net.routes.admin/RouteTableV6.NewRouteSet`]:
1845    ///   - When removing a route from this route set, the route will be
1846    ///     completely removed from the system, including removal from all other
1847    ///     route sets to which it belongs.
1848    ///   - The protocol does not encode the lifetime of the route set or its
1849    ///     routes. Closing the client end will not cause the routes within this
1850    ///     route set to be removed from the system. Thus, routes added via this
1851    ///     route set will effectively be abandoned/unowned after this
1852    ///     client-end closes.
1853    ///
1854    /// + request `route set` grants access to the `RouteSetV6` protocol.
1855    GlobalRouteSet {
1856        route_set: fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV6Marker>,
1857        control_handle: RoutesV6ControlHandle,
1858    },
1859}
1860
1861impl RoutesV6Request {
1862    #[allow(irrefutable_let_patterns)]
1863    pub fn into_global_route_set(
1864        self,
1865    ) -> Option<(
1866        fidl::endpoints::ServerEnd<fidl_fuchsia_net_routes_admin::RouteSetV6Marker>,
1867        RoutesV6ControlHandle,
1868    )> {
1869        if let RoutesV6Request::GlobalRouteSet { route_set, control_handle } = self {
1870            Some((route_set, control_handle))
1871        } else {
1872            None
1873        }
1874    }
1875
1876    /// Name of the method defined in FIDL
1877    pub fn method_name(&self) -> &'static str {
1878        match *self {
1879            RoutesV6Request::GlobalRouteSet { .. } => "global_route_set",
1880        }
1881    }
1882}
1883
1884#[derive(Debug, Clone)]
1885pub struct RoutesV6ControlHandle {
1886    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1887}
1888
1889impl fidl::endpoints::ControlHandle for RoutesV6ControlHandle {
1890    fn shutdown(&self) {
1891        self.inner.shutdown()
1892    }
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}