Skip to main content

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