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