fidl_fuchsia_net_root/
fidl_fuchsia_net_root.rs

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