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