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