fidl_fuchsia_net_interfaces_admin/
fidl_fuchsia_net_interfaces_admin.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_net_interfaces_admin__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ControlAddAddressRequest {
16    pub address: fidl_fuchsia_net::Subnet,
17    pub parameters: AddressParameters,
18    pub address_state_provider: fidl::endpoints::ServerEnd<AddressStateProviderMarker>,
19}
20
21impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for ControlAddAddressRequest {}
22
23#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
24pub struct ControlGetAuthorizationForInterfaceResponse {
25    pub credential: GrantForInterfaceAuthorization,
26}
27
28impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
29    for ControlGetAuthorizationForInterfaceResponse
30{
31}
32
33#[derive(Debug, PartialEq)]
34pub struct DeviceControlCreateInterfaceRequest {
35    pub port: fidl_fuchsia_hardware_network::PortId,
36    pub control: fidl::endpoints::ServerEnd<ControlMarker>,
37    pub options: Options,
38}
39
40impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
41    for DeviceControlCreateInterfaceRequest
42{
43}
44
45#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
46pub struct GrantForInterfaceAuthorization {
47    /// The ID of the interface this credential is authenticating.
48    pub interface_id: u64,
49    /// The EVENT providing authentication over this interface.
50    pub token: fidl::Event,
51}
52
53impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
54    for GrantForInterfaceAuthorization
55{
56}
57
58#[derive(Debug, PartialEq)]
59pub struct InstallerInstallBlackholeInterfaceRequest {
60    pub interface: fidl::endpoints::ServerEnd<ControlMarker>,
61    pub options: Options,
62}
63
64impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
65    for InstallerInstallBlackholeInterfaceRequest
66{
67}
68
69#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
70pub struct InstallerInstallDeviceRequest {
71    pub device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
72    pub device_control: fidl::endpoints::ServerEnd<DeviceControlMarker>,
73}
74
75impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
76    for InstallerInstallDeviceRequest
77{
78}
79
80/// A credential passed into the `fuchsia.net.*` family of APIs to authenticate
81/// access to a particular interface. The Netstack only needs the ability to
82/// inspect the token's basic info when proving that the client is authorized
83/// to access a resource.
84#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
85pub struct ProofOfInterfaceAuthorization {
86    /// The ID of the interface this credential is authenticating.
87    pub interface_id: u64,
88    /// The EVENT providing authentication over this interface.
89    pub token: fidl::Event,
90}
91
92impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
93    for ProofOfInterfaceAuthorization
94{
95}
96
97/// Options for creating an interface.
98#[derive(Debug, Default, PartialEq)]
99pub struct Options {
100    /// New interface name.
101    ///
102    /// An implementation-defined name is selected if absent.
103    pub name: Option<String>,
104    /// The default metric value used for routes through this interface.
105    ///
106    /// The server uses a sensible default if absent.
107    pub metric: Option<u32>,
108    /// The designation for the netstack-sourced routes.
109    ///
110    /// Interpreted as `NetstackManagedRoutesDesignation.main` if absent.
111    pub netstack_managed_routes_designation: Option<NetstackManagedRoutesDesignation>,
112    #[doc(hidden)]
113    pub __source_breaking: fidl::marker::SourceBreaking,
114}
115
116impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Options {}
117
118/// This can be provided on interface creation to appoint a route table into
119/// which netstack managed routes are installed.
120#[derive(Debug)]
121pub enum NetstackManagedRoutesDesignation {
122    /// The netstack managed routes are installed in the main table.
123    Main(Empty),
124    /// The netstack managed routes are installed in an interface-local table.
125    ///
126    /// The interface creates local tables (one for each IP version). When the
127    /// interface is removed and all the outstanding `RouteTableV{4,6}` protocol
128    /// channels are closed, the local table is removed.
129    InterfaceLocal(Empty),
130    #[doc(hidden)]
131    __SourceBreaking { unknown_ordinal: u64 },
132}
133
134/// Pattern that matches an unknown `NetstackManagedRoutesDesignation` member.
135#[macro_export]
136macro_rules! NetstackManagedRoutesDesignationUnknown {
137    () => {
138        _
139    };
140}
141
142// Custom PartialEq so that unknown variants are not equal to themselves.
143impl PartialEq for NetstackManagedRoutesDesignation {
144    fn eq(&self, other: &Self) -> bool {
145        match (self, other) {
146            (Self::Main(x), Self::Main(y)) => *x == *y,
147            (Self::InterfaceLocal(x), Self::InterfaceLocal(y)) => *x == *y,
148            _ => false,
149        }
150    }
151}
152
153impl NetstackManagedRoutesDesignation {
154    #[inline]
155    pub fn ordinal(&self) -> u64 {
156        match *self {
157            Self::Main(_) => 1,
158            Self::InterfaceLocal(_) => 2,
159            Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
160        }
161    }
162
163    #[inline]
164    pub fn unknown_variant_for_testing() -> Self {
165        Self::__SourceBreaking { unknown_ordinal: 0 }
166    }
167
168    #[inline]
169    pub fn is_unknown(&self) -> bool {
170        match self {
171            Self::__SourceBreaking { .. } => true,
172            _ => false,
173        }
174    }
175}
176
177impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
178    for NetstackManagedRoutesDesignation
179{
180}
181
182#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
183pub struct AddressStateProviderMarker;
184
185impl fidl::endpoints::ProtocolMarker for AddressStateProviderMarker {
186    type Proxy = AddressStateProviderProxy;
187    type RequestStream = AddressStateProviderRequestStream;
188    #[cfg(target_os = "fuchsia")]
189    type SynchronousProxy = AddressStateProviderSynchronousProxy;
190
191    const DEBUG_NAME: &'static str = "(anonymous) AddressStateProvider";
192}
193
194pub trait AddressStateProviderProxyInterface: Send + Sync {
195    type UpdateAddressPropertiesResponseFut: std::future::Future<Output = Result<(), fidl::Error>>
196        + Send;
197    fn r#update_address_properties(
198        &self,
199        address_properties: &AddressProperties,
200    ) -> Self::UpdateAddressPropertiesResponseFut;
201    type WatchAddressAssignmentStateResponseFut: std::future::Future<
202            Output = Result<fidl_fuchsia_net_interfaces::AddressAssignmentState, fidl::Error>,
203        > + Send;
204    fn r#watch_address_assignment_state(&self) -> Self::WatchAddressAssignmentStateResponseFut;
205    fn r#detach(&self) -> Result<(), fidl::Error>;
206    fn r#remove(&self) -> Result<(), fidl::Error>;
207}
208#[derive(Debug)]
209#[cfg(target_os = "fuchsia")]
210pub struct AddressStateProviderSynchronousProxy {
211    client: fidl::client::sync::Client,
212}
213
214#[cfg(target_os = "fuchsia")]
215impl fidl::endpoints::SynchronousProxy for AddressStateProviderSynchronousProxy {
216    type Proxy = AddressStateProviderProxy;
217    type Protocol = AddressStateProviderMarker;
218
219    fn from_channel(inner: fidl::Channel) -> Self {
220        Self::new(inner)
221    }
222
223    fn into_channel(self) -> fidl::Channel {
224        self.client.into_channel()
225    }
226
227    fn as_channel(&self) -> &fidl::Channel {
228        self.client.as_channel()
229    }
230}
231
232#[cfg(target_os = "fuchsia")]
233impl AddressStateProviderSynchronousProxy {
234    pub fn new(channel: fidl::Channel) -> Self {
235        let protocol_name =
236            <AddressStateProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
237        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
238    }
239
240    pub fn into_channel(self) -> fidl::Channel {
241        self.client.into_channel()
242    }
243
244    /// Waits until an event arrives and returns it. It is safe for other
245    /// threads to make concurrent requests while waiting for an event.
246    pub fn wait_for_event(
247        &self,
248        deadline: zx::MonotonicInstant,
249    ) -> Result<AddressStateProviderEvent, fidl::Error> {
250        AddressStateProviderEvent::decode(self.client.wait_for_event(deadline)?)
251    }
252
253    /// Push an update when the address properties change.
254    ///
255    /// The client pushes updates on address properties changes, such as the
256    /// address becoming deprecated, or the preferred and valid lifetimes being
257    /// updated as a result of extending the address' lifetime. The server is
258    /// expected to cache address properties.
259    ///
260    /// If `address_properties` contains invalid property values, the address is
261    /// removed and [`AddressRemovalReason.INVALID_PROPERTIES`] is issued.
262    ///
263    /// + request `address_properties` the updated properties of the address.
264    pub fn r#update_address_properties(
265        &self,
266        mut address_properties: &AddressProperties,
267        ___deadline: zx::MonotonicInstant,
268    ) -> Result<(), fidl::Error> {
269        let _response = self.client.send_query::<
270            AddressStateProviderUpdateAddressPropertiesRequest,
271            fidl::encoding::EmptyPayload,
272        >(
273            (address_properties,),
274            0x52bdf5ed96ef573c,
275            fidl::encoding::DynamicFlags::empty(),
276            ___deadline,
277        )?;
278        Ok(_response)
279    }
280
281    /// Hanging get for address assignment state.
282    ///
283    /// The server does not keep a queue of assignment states, it returns the
284    /// latest state if it differs from the last one observed.
285    ///
286    /// The first call will always immediately return the current assignment
287    /// state. Subsequent calls will block until the returned value differs
288    /// from the last observed value.
289    ///
290    /// It is invalid to call this method while a previous call is pending.
291    /// Doing so will cause the server end of the protocol to be closed.
292    ///
293    /// - response `assignment_state` the assignment state of the address.
294    pub fn r#watch_address_assignment_state(
295        &self,
296        ___deadline: zx::MonotonicInstant,
297    ) -> Result<fidl_fuchsia_net_interfaces::AddressAssignmentState, fidl::Error> {
298        let _response = self.client.send_query::<
299            fidl::encoding::EmptyPayload,
300            AddressStateProviderWatchAddressAssignmentStateResponse,
301        >(
302            (),
303            0x740bb58c1b2d3188,
304            fidl::encoding::DynamicFlags::empty(),
305            ___deadline,
306        )?;
307        Ok(_response.assignment_state)
308    }
309
310    /// Detaches the address' lifetime from the client end of the protocol.
311    ///
312    /// The client end of the protocol can be closed immediately after
313    /// calling this method, and the address will not be removed.
314    pub fn r#detach(&self) -> Result<(), fidl::Error> {
315        self.client.send::<fidl::encoding::EmptyPayload>(
316            (),
317            0xc752381d739622f,
318            fidl::encoding::DynamicFlags::empty(),
319        )
320    }
321
322    /// Removes the address.
323    ///
324    /// The server end of the protocol is closed after address removal has
325    /// completed, and the `USER_REMOVED` `OnAddressRemoved` event is sent.
326    pub fn r#remove(&self) -> Result<(), fidl::Error> {
327        self.client.send::<fidl::encoding::EmptyPayload>(
328            (),
329            0x554407fe183e78ad,
330            fidl::encoding::DynamicFlags::empty(),
331        )
332    }
333}
334
335#[cfg(target_os = "fuchsia")]
336impl From<AddressStateProviderSynchronousProxy> for zx::Handle {
337    fn from(value: AddressStateProviderSynchronousProxy) -> Self {
338        value.into_channel().into()
339    }
340}
341
342#[cfg(target_os = "fuchsia")]
343impl From<fidl::Channel> for AddressStateProviderSynchronousProxy {
344    fn from(value: fidl::Channel) -> Self {
345        Self::new(value)
346    }
347}
348
349#[cfg(target_os = "fuchsia")]
350impl fidl::endpoints::FromClient for AddressStateProviderSynchronousProxy {
351    type Protocol = AddressStateProviderMarker;
352
353    fn from_client(value: fidl::endpoints::ClientEnd<AddressStateProviderMarker>) -> Self {
354        Self::new(value.into_channel())
355    }
356}
357
358#[derive(Debug, Clone)]
359pub struct AddressStateProviderProxy {
360    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
361}
362
363impl fidl::endpoints::Proxy for AddressStateProviderProxy {
364    type Protocol = AddressStateProviderMarker;
365
366    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
367        Self::new(inner)
368    }
369
370    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
371        self.client.into_channel().map_err(|client| Self { client })
372    }
373
374    fn as_channel(&self) -> &::fidl::AsyncChannel {
375        self.client.as_channel()
376    }
377}
378
379impl AddressStateProviderProxy {
380    /// Create a new Proxy for fuchsia.net.interfaces.admin/AddressStateProvider.
381    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
382        let protocol_name =
383            <AddressStateProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
384        Self { client: fidl::client::Client::new(channel, protocol_name) }
385    }
386
387    /// Get a Stream of events from the remote end of the protocol.
388    ///
389    /// # Panics
390    ///
391    /// Panics if the event stream was already taken.
392    pub fn take_event_stream(&self) -> AddressStateProviderEventStream {
393        AddressStateProviderEventStream { event_receiver: self.client.take_event_receiver() }
394    }
395
396    /// Push an update when the address properties change.
397    ///
398    /// The client pushes updates on address properties changes, such as the
399    /// address becoming deprecated, or the preferred and valid lifetimes being
400    /// updated as a result of extending the address' lifetime. The server is
401    /// expected to cache address properties.
402    ///
403    /// If `address_properties` contains invalid property values, the address is
404    /// removed and [`AddressRemovalReason.INVALID_PROPERTIES`] is issued.
405    ///
406    /// + request `address_properties` the updated properties of the address.
407    pub fn r#update_address_properties(
408        &self,
409        mut address_properties: &AddressProperties,
410    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
411        AddressStateProviderProxyInterface::r#update_address_properties(self, address_properties)
412    }
413
414    /// Hanging get for address assignment state.
415    ///
416    /// The server does not keep a queue of assignment states, it returns the
417    /// latest state if it differs from the last one observed.
418    ///
419    /// The first call will always immediately return the current assignment
420    /// state. Subsequent calls will block until the returned value differs
421    /// from the last observed value.
422    ///
423    /// It is invalid to call this method while a previous call is pending.
424    /// Doing so will cause the server end of the protocol to be closed.
425    ///
426    /// - response `assignment_state` the assignment state of the address.
427    pub fn r#watch_address_assignment_state(
428        &self,
429    ) -> fidl::client::QueryResponseFut<
430        fidl_fuchsia_net_interfaces::AddressAssignmentState,
431        fidl::encoding::DefaultFuchsiaResourceDialect,
432    > {
433        AddressStateProviderProxyInterface::r#watch_address_assignment_state(self)
434    }
435
436    /// Detaches the address' lifetime from the client end of the protocol.
437    ///
438    /// The client end of the protocol can be closed immediately after
439    /// calling this method, and the address will not be removed.
440    pub fn r#detach(&self) -> Result<(), fidl::Error> {
441        AddressStateProviderProxyInterface::r#detach(self)
442    }
443
444    /// Removes the address.
445    ///
446    /// The server end of the protocol is closed after address removal has
447    /// completed, and the `USER_REMOVED` `OnAddressRemoved` event is sent.
448    pub fn r#remove(&self) -> Result<(), fidl::Error> {
449        AddressStateProviderProxyInterface::r#remove(self)
450    }
451}
452
453impl AddressStateProviderProxyInterface for AddressStateProviderProxy {
454    type UpdateAddressPropertiesResponseFut =
455        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
456    fn r#update_address_properties(
457        &self,
458        mut address_properties: &AddressProperties,
459    ) -> Self::UpdateAddressPropertiesResponseFut {
460        fn _decode(
461            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
462        ) -> Result<(), fidl::Error> {
463            let _response = fidl::client::decode_transaction_body::<
464                fidl::encoding::EmptyPayload,
465                fidl::encoding::DefaultFuchsiaResourceDialect,
466                0x52bdf5ed96ef573c,
467            >(_buf?)?;
468            Ok(_response)
469        }
470        self.client.send_query_and_decode::<AddressStateProviderUpdateAddressPropertiesRequest, ()>(
471            (address_properties,),
472            0x52bdf5ed96ef573c,
473            fidl::encoding::DynamicFlags::empty(),
474            _decode,
475        )
476    }
477
478    type WatchAddressAssignmentStateResponseFut = fidl::client::QueryResponseFut<
479        fidl_fuchsia_net_interfaces::AddressAssignmentState,
480        fidl::encoding::DefaultFuchsiaResourceDialect,
481    >;
482    fn r#watch_address_assignment_state(&self) -> Self::WatchAddressAssignmentStateResponseFut {
483        fn _decode(
484            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
485        ) -> Result<fidl_fuchsia_net_interfaces::AddressAssignmentState, fidl::Error> {
486            let _response = fidl::client::decode_transaction_body::<
487                AddressStateProviderWatchAddressAssignmentStateResponse,
488                fidl::encoding::DefaultFuchsiaResourceDialect,
489                0x740bb58c1b2d3188,
490            >(_buf?)?;
491            Ok(_response.assignment_state)
492        }
493        self.client.send_query_and_decode::<
494            fidl::encoding::EmptyPayload,
495            fidl_fuchsia_net_interfaces::AddressAssignmentState,
496        >(
497            (),
498            0x740bb58c1b2d3188,
499            fidl::encoding::DynamicFlags::empty(),
500            _decode,
501        )
502    }
503
504    fn r#detach(&self) -> Result<(), fidl::Error> {
505        self.client.send::<fidl::encoding::EmptyPayload>(
506            (),
507            0xc752381d739622f,
508            fidl::encoding::DynamicFlags::empty(),
509        )
510    }
511
512    fn r#remove(&self) -> Result<(), fidl::Error> {
513        self.client.send::<fidl::encoding::EmptyPayload>(
514            (),
515            0x554407fe183e78ad,
516            fidl::encoding::DynamicFlags::empty(),
517        )
518    }
519}
520
521pub struct AddressStateProviderEventStream {
522    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
523}
524
525impl std::marker::Unpin for AddressStateProviderEventStream {}
526
527impl futures::stream::FusedStream for AddressStateProviderEventStream {
528    fn is_terminated(&self) -> bool {
529        self.event_receiver.is_terminated()
530    }
531}
532
533impl futures::Stream for AddressStateProviderEventStream {
534    type Item = Result<AddressStateProviderEvent, fidl::Error>;
535
536    fn poll_next(
537        mut self: std::pin::Pin<&mut Self>,
538        cx: &mut std::task::Context<'_>,
539    ) -> std::task::Poll<Option<Self::Item>> {
540        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
541            &mut self.event_receiver,
542            cx
543        )?) {
544            Some(buf) => std::task::Poll::Ready(Some(AddressStateProviderEvent::decode(buf))),
545            None => std::task::Poll::Ready(None),
546        }
547    }
548}
549
550#[derive(Debug)]
551pub enum AddressStateProviderEvent {
552    OnAddressAdded {},
553    OnAddressRemoved { error: AddressRemovalReason },
554}
555
556impl AddressStateProviderEvent {
557    #[allow(irrefutable_let_patterns)]
558    pub fn into_on_address_added(self) -> Option<()> {
559        if let AddressStateProviderEvent::OnAddressAdded {} = self {
560            Some(())
561        } else {
562            None
563        }
564    }
565    #[allow(irrefutable_let_patterns)]
566    pub fn into_on_address_removed(self) -> Option<AddressRemovalReason> {
567        if let AddressStateProviderEvent::OnAddressRemoved { error } = self {
568            Some((error))
569        } else {
570            None
571        }
572    }
573
574    /// Decodes a message buffer as a [`AddressStateProviderEvent`].
575    fn decode(
576        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
577    ) -> Result<AddressStateProviderEvent, fidl::Error> {
578        let (bytes, _handles) = buf.split_mut();
579        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
580        debug_assert_eq!(tx_header.tx_id, 0);
581        match tx_header.ordinal {
582            0x624f6ea62cce189e => {
583                let mut out = fidl::new_empty!(
584                    fidl::encoding::EmptyPayload,
585                    fidl::encoding::DefaultFuchsiaResourceDialect
586                );
587                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&tx_header, _body_bytes, _handles, &mut out)?;
588                Ok((AddressStateProviderEvent::OnAddressAdded {}))
589            }
590            0x2480eb672ffd5962 => {
591                let mut out = fidl::new_empty!(
592                    AddressStateProviderOnAddressRemovedRequest,
593                    fidl::encoding::DefaultFuchsiaResourceDialect
594                );
595                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AddressStateProviderOnAddressRemovedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
596                Ok((AddressStateProviderEvent::OnAddressRemoved { error: out.error }))
597            }
598            _ => Err(fidl::Error::UnknownOrdinal {
599                ordinal: tx_header.ordinal,
600                protocol_name:
601                    <AddressStateProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
602            }),
603        }
604    }
605}
606
607/// A Stream of incoming requests for fuchsia.net.interfaces.admin/AddressStateProvider.
608pub struct AddressStateProviderRequestStream {
609    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
610    is_terminated: bool,
611}
612
613impl std::marker::Unpin for AddressStateProviderRequestStream {}
614
615impl futures::stream::FusedStream for AddressStateProviderRequestStream {
616    fn is_terminated(&self) -> bool {
617        self.is_terminated
618    }
619}
620
621impl fidl::endpoints::RequestStream for AddressStateProviderRequestStream {
622    type Protocol = AddressStateProviderMarker;
623    type ControlHandle = AddressStateProviderControlHandle;
624
625    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
626        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
627    }
628
629    fn control_handle(&self) -> Self::ControlHandle {
630        AddressStateProviderControlHandle { inner: self.inner.clone() }
631    }
632
633    fn into_inner(
634        self,
635    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
636    {
637        (self.inner, self.is_terminated)
638    }
639
640    fn from_inner(
641        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
642        is_terminated: bool,
643    ) -> Self {
644        Self { inner, is_terminated }
645    }
646}
647
648impl futures::Stream for AddressStateProviderRequestStream {
649    type Item = Result<AddressStateProviderRequest, fidl::Error>;
650
651    fn poll_next(
652        mut self: std::pin::Pin<&mut Self>,
653        cx: &mut std::task::Context<'_>,
654    ) -> std::task::Poll<Option<Self::Item>> {
655        let this = &mut *self;
656        if this.inner.check_shutdown(cx) {
657            this.is_terminated = true;
658            return std::task::Poll::Ready(None);
659        }
660        if this.is_terminated {
661            panic!("polled AddressStateProviderRequestStream after completion");
662        }
663        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
664            |bytes, handles| {
665                match this.inner.channel().read_etc(cx, bytes, handles) {
666                    std::task::Poll::Ready(Ok(())) => {}
667                    std::task::Poll::Pending => return std::task::Poll::Pending,
668                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
669                        this.is_terminated = true;
670                        return std::task::Poll::Ready(None);
671                    }
672                    std::task::Poll::Ready(Err(e)) => {
673                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
674                            e.into(),
675                        ))))
676                    }
677                }
678
679                // A message has been received from the channel
680                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
681
682                std::task::Poll::Ready(Some(match header.ordinal {
683                0x52bdf5ed96ef573c => {
684                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
685                    let mut req = fidl::new_empty!(AddressStateProviderUpdateAddressPropertiesRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
686                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<AddressStateProviderUpdateAddressPropertiesRequest>(&header, _body_bytes, handles, &mut req)?;
687                    let control_handle = AddressStateProviderControlHandle {
688                        inner: this.inner.clone(),
689                    };
690                    Ok(AddressStateProviderRequest::UpdateAddressProperties {address_properties: req.address_properties,
691
692                        responder: AddressStateProviderUpdateAddressPropertiesResponder {
693                            control_handle: std::mem::ManuallyDrop::new(control_handle),
694                            tx_id: header.tx_id,
695                        },
696                    })
697                }
698                0x740bb58c1b2d3188 => {
699                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
700                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
701                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
702                    let control_handle = AddressStateProviderControlHandle {
703                        inner: this.inner.clone(),
704                    };
705                    Ok(AddressStateProviderRequest::WatchAddressAssignmentState {
706                        responder: AddressStateProviderWatchAddressAssignmentStateResponder {
707                            control_handle: std::mem::ManuallyDrop::new(control_handle),
708                            tx_id: header.tx_id,
709                        },
710                    })
711                }
712                0xc752381d739622f => {
713                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
714                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
715                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
716                    let control_handle = AddressStateProviderControlHandle {
717                        inner: this.inner.clone(),
718                    };
719                    Ok(AddressStateProviderRequest::Detach {
720                        control_handle,
721                    })
722                }
723                0x554407fe183e78ad => {
724                    header.validate_request_tx_id(fidl::MethodType::OneWay)?;
725                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
726                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
727                    let control_handle = AddressStateProviderControlHandle {
728                        inner: this.inner.clone(),
729                    };
730                    Ok(AddressStateProviderRequest::Remove {
731                        control_handle,
732                    })
733                }
734                _ => Err(fidl::Error::UnknownOrdinal {
735                    ordinal: header.ordinal,
736                    protocol_name: <AddressStateProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
737                }),
738            }))
739            },
740        )
741    }
742}
743
744/// Offers state information about an IP address.
745///
746/// This protocol encodes the underlying object's lifetime in both directions;
747/// the underlying object is alive iff both ends of the protocol are open
748/// (unless [`AddressStateProvider.Detach`] has been called). That is:
749///
750/// - Closing the client end causes the object to be destroyed.
751/// - Observing a closure of the server end indicates the object no longer
752///   exists.
753#[derive(Debug)]
754pub enum AddressStateProviderRequest {
755    /// Push an update when the address properties change.
756    ///
757    /// The client pushes updates on address properties changes, such as the
758    /// address becoming deprecated, or the preferred and valid lifetimes being
759    /// updated as a result of extending the address' lifetime. The server is
760    /// expected to cache address properties.
761    ///
762    /// If `address_properties` contains invalid property values, the address is
763    /// removed and [`AddressRemovalReason.INVALID_PROPERTIES`] is issued.
764    ///
765    /// + request `address_properties` the updated properties of the address.
766    UpdateAddressProperties {
767        address_properties: AddressProperties,
768        responder: AddressStateProviderUpdateAddressPropertiesResponder,
769    },
770    /// Hanging get for address assignment state.
771    ///
772    /// The server does not keep a queue of assignment states, it returns the
773    /// latest state if it differs from the last one observed.
774    ///
775    /// The first call will always immediately return the current assignment
776    /// state. Subsequent calls will block until the returned value differs
777    /// from the last observed value.
778    ///
779    /// It is invalid to call this method while a previous call is pending.
780    /// Doing so will cause the server end of the protocol to be closed.
781    ///
782    /// - response `assignment_state` the assignment state of the address.
783    WatchAddressAssignmentState {
784        responder: AddressStateProviderWatchAddressAssignmentStateResponder,
785    },
786    /// Detaches the address' lifetime from the client end of the protocol.
787    ///
788    /// The client end of the protocol can be closed immediately after
789    /// calling this method, and the address will not be removed.
790    Detach { control_handle: AddressStateProviderControlHandle },
791    /// Removes the address.
792    ///
793    /// The server end of the protocol is closed after address removal has
794    /// completed, and the `USER_REMOVED` `OnAddressRemoved` event is sent.
795    Remove { control_handle: AddressStateProviderControlHandle },
796}
797
798impl AddressStateProviderRequest {
799    #[allow(irrefutable_let_patterns)]
800    pub fn into_update_address_properties(
801        self,
802    ) -> Option<(AddressProperties, AddressStateProviderUpdateAddressPropertiesResponder)> {
803        if let AddressStateProviderRequest::UpdateAddressProperties {
804            address_properties,
805            responder,
806        } = self
807        {
808            Some((address_properties, responder))
809        } else {
810            None
811        }
812    }
813
814    #[allow(irrefutable_let_patterns)]
815    pub fn into_watch_address_assignment_state(
816        self,
817    ) -> Option<(AddressStateProviderWatchAddressAssignmentStateResponder)> {
818        if let AddressStateProviderRequest::WatchAddressAssignmentState { responder } = self {
819            Some((responder))
820        } else {
821            None
822        }
823    }
824
825    #[allow(irrefutable_let_patterns)]
826    pub fn into_detach(self) -> Option<(AddressStateProviderControlHandle)> {
827        if let AddressStateProviderRequest::Detach { control_handle } = self {
828            Some((control_handle))
829        } else {
830            None
831        }
832    }
833
834    #[allow(irrefutable_let_patterns)]
835    pub fn into_remove(self) -> Option<(AddressStateProviderControlHandle)> {
836        if let AddressStateProviderRequest::Remove { control_handle } = self {
837            Some((control_handle))
838        } else {
839            None
840        }
841    }
842
843    /// Name of the method defined in FIDL
844    pub fn method_name(&self) -> &'static str {
845        match *self {
846            AddressStateProviderRequest::UpdateAddressProperties { .. } => {
847                "update_address_properties"
848            }
849            AddressStateProviderRequest::WatchAddressAssignmentState { .. } => {
850                "watch_address_assignment_state"
851            }
852            AddressStateProviderRequest::Detach { .. } => "detach",
853            AddressStateProviderRequest::Remove { .. } => "remove",
854        }
855    }
856}
857
858#[derive(Debug, Clone)]
859pub struct AddressStateProviderControlHandle {
860    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
861}
862
863impl fidl::endpoints::ControlHandle for AddressStateProviderControlHandle {
864    fn shutdown(&self) {
865        self.inner.shutdown()
866    }
867    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
868        self.inner.shutdown_with_epitaph(status)
869    }
870
871    fn is_closed(&self) -> bool {
872        self.inner.channel().is_closed()
873    }
874    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
875        self.inner.channel().on_closed()
876    }
877
878    #[cfg(target_os = "fuchsia")]
879    fn signal_peer(
880        &self,
881        clear_mask: zx::Signals,
882        set_mask: zx::Signals,
883    ) -> Result<(), zx_status::Status> {
884        use fidl::Peered;
885        self.inner.channel().signal_peer(clear_mask, set_mask)
886    }
887}
888
889impl AddressStateProviderControlHandle {
890    pub fn send_on_address_added(&self) -> Result<(), fidl::Error> {
891        self.inner.send::<fidl::encoding::EmptyPayload>(
892            (),
893            0,
894            0x624f6ea62cce189e,
895            fidl::encoding::DynamicFlags::empty(),
896        )
897    }
898
899    pub fn send_on_address_removed(
900        &self,
901        mut error: AddressRemovalReason,
902    ) -> Result<(), fidl::Error> {
903        self.inner.send::<AddressStateProviderOnAddressRemovedRequest>(
904            (error,),
905            0,
906            0x2480eb672ffd5962,
907            fidl::encoding::DynamicFlags::empty(),
908        )
909    }
910}
911
912#[must_use = "FIDL methods require a response to be sent"]
913#[derive(Debug)]
914pub struct AddressStateProviderUpdateAddressPropertiesResponder {
915    control_handle: std::mem::ManuallyDrop<AddressStateProviderControlHandle>,
916    tx_id: u32,
917}
918
919/// Set the the channel to be shutdown (see [`AddressStateProviderControlHandle::shutdown`])
920/// if the responder is dropped without sending a response, so that the client
921/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
922impl std::ops::Drop for AddressStateProviderUpdateAddressPropertiesResponder {
923    fn drop(&mut self) {
924        self.control_handle.shutdown();
925        // Safety: drops once, never accessed again
926        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
927    }
928}
929
930impl fidl::endpoints::Responder for AddressStateProviderUpdateAddressPropertiesResponder {
931    type ControlHandle = AddressStateProviderControlHandle;
932
933    fn control_handle(&self) -> &AddressStateProviderControlHandle {
934        &self.control_handle
935    }
936
937    fn drop_without_shutdown(mut self) {
938        // Safety: drops once, never accessed again due to mem::forget
939        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
940        // Prevent Drop from running (which would shut down the channel)
941        std::mem::forget(self);
942    }
943}
944
945impl AddressStateProviderUpdateAddressPropertiesResponder {
946    /// Sends a response to the FIDL transaction.
947    ///
948    /// Sets the channel to shutdown if an error occurs.
949    pub fn send(self) -> Result<(), fidl::Error> {
950        let _result = self.send_raw();
951        if _result.is_err() {
952            self.control_handle.shutdown();
953        }
954        self.drop_without_shutdown();
955        _result
956    }
957
958    /// Similar to "send" but does not shutdown the channel if an error occurs.
959    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
960        let _result = self.send_raw();
961        self.drop_without_shutdown();
962        _result
963    }
964
965    fn send_raw(&self) -> Result<(), fidl::Error> {
966        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
967            (),
968            self.tx_id,
969            0x52bdf5ed96ef573c,
970            fidl::encoding::DynamicFlags::empty(),
971        )
972    }
973}
974
975#[must_use = "FIDL methods require a response to be sent"]
976#[derive(Debug)]
977pub struct AddressStateProviderWatchAddressAssignmentStateResponder {
978    control_handle: std::mem::ManuallyDrop<AddressStateProviderControlHandle>,
979    tx_id: u32,
980}
981
982/// Set the the channel to be shutdown (see [`AddressStateProviderControlHandle::shutdown`])
983/// if the responder is dropped without sending a response, so that the client
984/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
985impl std::ops::Drop for AddressStateProviderWatchAddressAssignmentStateResponder {
986    fn drop(&mut self) {
987        self.control_handle.shutdown();
988        // Safety: drops once, never accessed again
989        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
990    }
991}
992
993impl fidl::endpoints::Responder for AddressStateProviderWatchAddressAssignmentStateResponder {
994    type ControlHandle = AddressStateProviderControlHandle;
995
996    fn control_handle(&self) -> &AddressStateProviderControlHandle {
997        &self.control_handle
998    }
999
1000    fn drop_without_shutdown(mut self) {
1001        // Safety: drops once, never accessed again due to mem::forget
1002        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1003        // Prevent Drop from running (which would shut down the channel)
1004        std::mem::forget(self);
1005    }
1006}
1007
1008impl AddressStateProviderWatchAddressAssignmentStateResponder {
1009    /// Sends a response to the FIDL transaction.
1010    ///
1011    /// Sets the channel to shutdown if an error occurs.
1012    pub fn send(
1013        self,
1014        mut assignment_state: fidl_fuchsia_net_interfaces::AddressAssignmentState,
1015    ) -> Result<(), fidl::Error> {
1016        let _result = self.send_raw(assignment_state);
1017        if _result.is_err() {
1018            self.control_handle.shutdown();
1019        }
1020        self.drop_without_shutdown();
1021        _result
1022    }
1023
1024    /// Similar to "send" but does not shutdown the channel if an error occurs.
1025    pub fn send_no_shutdown_on_err(
1026        self,
1027        mut assignment_state: fidl_fuchsia_net_interfaces::AddressAssignmentState,
1028    ) -> Result<(), fidl::Error> {
1029        let _result = self.send_raw(assignment_state);
1030        self.drop_without_shutdown();
1031        _result
1032    }
1033
1034    fn send_raw(
1035        &self,
1036        mut assignment_state: fidl_fuchsia_net_interfaces::AddressAssignmentState,
1037    ) -> Result<(), fidl::Error> {
1038        self.control_handle.inner.send::<AddressStateProviderWatchAddressAssignmentStateResponse>(
1039            (assignment_state,),
1040            self.tx_id,
1041            0x740bb58c1b2d3188,
1042            fidl::encoding::DynamicFlags::empty(),
1043        )
1044    }
1045}
1046
1047#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1048pub struct ControlMarker;
1049
1050impl fidl::endpoints::ProtocolMarker for ControlMarker {
1051    type Proxy = ControlProxy;
1052    type RequestStream = ControlRequestStream;
1053    #[cfg(target_os = "fuchsia")]
1054    type SynchronousProxy = ControlSynchronousProxy;
1055
1056    const DEBUG_NAME: &'static str = "(anonymous) Control";
1057}
1058pub type ControlRemoveAddressResult = Result<bool, ControlRemoveAddressError>;
1059pub type ControlSetConfigurationResult = Result<Configuration, ControlSetConfigurationError>;
1060pub type ControlGetConfigurationResult = Result<Configuration, ControlGetConfigurationError>;
1061pub type ControlEnableResult = Result<bool, ControlEnableError>;
1062pub type ControlDisableResult = Result<bool, ControlDisableError>;
1063pub type ControlRemoveResult = Result<(), ControlRemoveError>;
1064
1065pub trait ControlProxyInterface: Send + Sync {
1066    fn r#add_address(
1067        &self,
1068        address: &fidl_fuchsia_net::Subnet,
1069        parameters: &AddressParameters,
1070        address_state_provider: fidl::endpoints::ServerEnd<AddressStateProviderMarker>,
1071    ) -> Result<(), fidl::Error>;
1072    type RemoveAddressResponseFut: std::future::Future<Output = Result<ControlRemoveAddressResult, fidl::Error>>
1073        + Send;
1074    fn r#remove_address(
1075        &self,
1076        address: &fidl_fuchsia_net::Subnet,
1077    ) -> Self::RemoveAddressResponseFut;
1078    type GetIdResponseFut: std::future::Future<Output = Result<u64, fidl::Error>> + Send;
1079    fn r#get_id(&self) -> Self::GetIdResponseFut;
1080    type SetConfigurationResponseFut: std::future::Future<Output = Result<ControlSetConfigurationResult, fidl::Error>>
1081        + Send;
1082    fn r#set_configuration(&self, config: &Configuration) -> Self::SetConfigurationResponseFut;
1083    type GetConfigurationResponseFut: std::future::Future<Output = Result<ControlGetConfigurationResult, fidl::Error>>
1084        + Send;
1085    fn r#get_configuration(&self) -> Self::GetConfigurationResponseFut;
1086    type EnableResponseFut: std::future::Future<Output = Result<ControlEnableResult, fidl::Error>>
1087        + Send;
1088    fn r#enable(&self) -> Self::EnableResponseFut;
1089    type DisableResponseFut: std::future::Future<Output = Result<ControlDisableResult, fidl::Error>>
1090        + Send;
1091    fn r#disable(&self) -> Self::DisableResponseFut;
1092    fn r#detach(&self) -> Result<(), fidl::Error>;
1093    type GetAuthorizationForInterfaceResponseFut: std::future::Future<Output = Result<GrantForInterfaceAuthorization, fidl::Error>>
1094        + Send;
1095    fn r#get_authorization_for_interface(&self) -> Self::GetAuthorizationForInterfaceResponseFut;
1096    type RemoveResponseFut: std::future::Future<Output = Result<ControlRemoveResult, fidl::Error>>
1097        + Send;
1098    fn r#remove(&self) -> Self::RemoveResponseFut;
1099}
1100#[derive(Debug)]
1101#[cfg(target_os = "fuchsia")]
1102pub struct ControlSynchronousProxy {
1103    client: fidl::client::sync::Client,
1104}
1105
1106#[cfg(target_os = "fuchsia")]
1107impl fidl::endpoints::SynchronousProxy for ControlSynchronousProxy {
1108    type Proxy = ControlProxy;
1109    type Protocol = ControlMarker;
1110
1111    fn from_channel(inner: fidl::Channel) -> Self {
1112        Self::new(inner)
1113    }
1114
1115    fn into_channel(self) -> fidl::Channel {
1116        self.client.into_channel()
1117    }
1118
1119    fn as_channel(&self) -> &fidl::Channel {
1120        self.client.as_channel()
1121    }
1122}
1123
1124#[cfg(target_os = "fuchsia")]
1125impl ControlSynchronousProxy {
1126    pub fn new(channel: fidl::Channel) -> Self {
1127        let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1128        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1129    }
1130
1131    pub fn into_channel(self) -> fidl::Channel {
1132        self.client.into_channel()
1133    }
1134
1135    /// Waits until an event arrives and returns it. It is safe for other
1136    /// threads to make concurrent requests while waiting for an event.
1137    pub fn wait_for_event(
1138        &self,
1139        deadline: zx::MonotonicInstant,
1140    ) -> Result<ControlEvent, fidl::Error> {
1141        ControlEvent::decode(self.client.wait_for_event(deadline)?)
1142    }
1143
1144    /// Assigns an address to the interface.
1145    ///
1146    /// Errors are communicated via
1147    /// [`fuchsia.net.interfaces.admin/AddressStateProvider.OnAddressRemoved`].
1148    ///
1149    /// + request `address` the address to assign to the interface.
1150    /// + request `parameters` additional address-specific options.
1151    /// + request `address_state_provider` provides address assignment state
1152    ///     and enables updating address properties.
1153    pub fn r#add_address(
1154        &self,
1155        mut address: &fidl_fuchsia_net::Subnet,
1156        mut parameters: &AddressParameters,
1157        mut address_state_provider: fidl::endpoints::ServerEnd<AddressStateProviderMarker>,
1158    ) -> Result<(), fidl::Error> {
1159        self.client.send::<ControlAddAddressRequest>(
1160            (address, parameters, address_state_provider),
1161            0x1349d36da453ce,
1162            fidl::encoding::DynamicFlags::empty(),
1163        )
1164    }
1165
1166    /// Removes an address from the interface.
1167    ///
1168    /// + request `address` the address to remove.
1169    /// - response `did_remove` `true` iff `address` was removed from the
1170    ///  interface as a consequence of this call.
1171    pub fn r#remove_address(
1172        &self,
1173        mut address: &fidl_fuchsia_net::Subnet,
1174        ___deadline: zx::MonotonicInstant,
1175    ) -> Result<ControlRemoveAddressResult, fidl::Error> {
1176        let _response =
1177            self.client.send_query::<ControlRemoveAddressRequest, fidl::encoding::ResultType<
1178                ControlRemoveAddressResponse,
1179                ControlRemoveAddressError,
1180            >>(
1181                (address,),
1182                0x213ba73da997a620,
1183                fidl::encoding::DynamicFlags::empty(),
1184                ___deadline,
1185            )?;
1186        Ok(_response.map(|x| x.did_remove))
1187    }
1188
1189    /// Gets the interface identifier.
1190    ///
1191    /// - response `id` the interface identifier.
1192    pub fn r#get_id(&self, ___deadline: zx::MonotonicInstant) -> Result<u64, fidl::Error> {
1193        let _response =
1194            self.client.send_query::<fidl::encoding::EmptyPayload, ControlGetIdResponse>(
1195                (),
1196                0x2a2459768d9ecc6f,
1197                fidl::encoding::DynamicFlags::empty(),
1198                ___deadline,
1199            )?;
1200        Ok(_response.id)
1201    }
1202
1203    /// Sets the configuration for the interface.
1204    ///
1205    /// Only set fields that are supported in the provided [`Configuration`]
1206    /// will be set; unset fields will be left unmodified. The server will
1207    /// return a [`Configuration`] which holds the previous configuration for
1208    /// fields that the interface supports and set, even if the call did not
1209    /// update the configuration's value.
1210    ///
1211    /// + request `config` the configuration fields to update on the interface.
1212    /// - response `previous_config` a snapshot of the interface's previous
1213    ///   configuration. Only supported fields present in `config` will be set.
1214    pub fn r#set_configuration(
1215        &self,
1216        mut config: &Configuration,
1217        ___deadline: zx::MonotonicInstant,
1218    ) -> Result<ControlSetConfigurationResult, fidl::Error> {
1219        let _response = self
1220            .client
1221            .send_query::<ControlSetConfigurationRequest, fidl::encoding::ResultType<
1222                ControlSetConfigurationResponse,
1223                ControlSetConfigurationError,
1224            >>(
1225                (config,), 0x573923b7b4bde27f, fidl::encoding::DynamicFlags::empty(), ___deadline
1226            )?;
1227        Ok(_response.map(|x| x.previous_config))
1228    }
1229
1230    /// Gets a snapshot of the interface's configuration.
1231    ///
1232    /// The server will populate the returned [`Configuration`] with the
1233    /// configuration for features/protocols that the interface supports. That
1234    /// is, fields for unsupported configurations will be unset in the returned
1235    /// [`Configuration`].
1236    ///
1237    /// - response `config` a snapshot of the interface's configuration.
1238    pub fn r#get_configuration(
1239        &self,
1240        ___deadline: zx::MonotonicInstant,
1241    ) -> Result<ControlGetConfigurationResult, fidl::Error> {
1242        let _response = self
1243            .client
1244            .send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
1245                ControlGetConfigurationResponse,
1246                ControlGetConfigurationError,
1247            >>(
1248                (), 0x5f5d239820bdcc65, fidl::encoding::DynamicFlags::empty(), ___deadline
1249            )?;
1250        Ok(_response.map(|x| x.config))
1251    }
1252
1253    /// Enables the interface.
1254    ///
1255    /// - response `did_enable` `true` iff the interface moved from disabled to
1256    /// enabled as a consequence of this call.
1257    pub fn r#enable(
1258        &self,
1259        ___deadline: zx::MonotonicInstant,
1260    ) -> Result<ControlEnableResult, fidl::Error> {
1261        let _response = self.client.send_query::<
1262            fidl::encoding::EmptyPayload,
1263            fidl::encoding::ResultType<ControlEnableResponse, ControlEnableError>,
1264        >(
1265            (),
1266            0x15c983d3a8ac0b98,
1267            fidl::encoding::DynamicFlags::empty(),
1268            ___deadline,
1269        )?;
1270        Ok(_response.map(|x| x.did_enable))
1271    }
1272
1273    /// Disables the interface.
1274    ///
1275    /// - response `did_disable` `true` iff the interface moved from enabled to
1276    /// disabled as a consequence of this call.
1277    pub fn r#disable(
1278        &self,
1279        ___deadline: zx::MonotonicInstant,
1280    ) -> Result<ControlDisableResult, fidl::Error> {
1281        let _response = self.client.send_query::<
1282            fidl::encoding::EmptyPayload,
1283            fidl::encoding::ResultType<ControlDisableResponse, ControlDisableError>,
1284        >(
1285            (),
1286            0x98d3a585d905473,
1287            fidl::encoding::DynamicFlags::empty(),
1288            ___deadline,
1289        )?;
1290        Ok(_response.map(|x| x.did_disable))
1291    }
1292
1293    /// Detaches the client end from the interface's lifetime.
1294    ///
1295    /// After calling `Detach`, closing this client end no longer causes the
1296    /// interface to be removed.
1297    pub fn r#detach(&self) -> Result<(), fidl::Error> {
1298        self.client.send::<fidl::encoding::EmptyPayload>(
1299            (),
1300            0x78ee27518b2dbfa,
1301            fidl::encoding::DynamicFlags::empty(),
1302        )
1303    }
1304
1305    /// Get an authentication credential for this interface.
1306    ///
1307    /// The credential contains a [`zx::handle::EVENT`], whose entangled
1308    /// partner is held by the server. This credential can be converted into a
1309    /// [`ProofOfInterfaceAuthorization`] and then passed into `fuchsia.net.*`
1310    /// API calls to prove ownership of this interface. The `EVENT` is
1311    /// stable throughout the lifetime of the interface. Clients may duplicate
1312    /// this `EVENT` to make multiple API calls, or transfer the `EVENT`
1313    /// to other clients.
1314    ///
1315    /// - response `credential` the authorization credential for this interface.
1316    pub fn r#get_authorization_for_interface(
1317        &self,
1318        ___deadline: zx::MonotonicInstant,
1319    ) -> Result<GrantForInterfaceAuthorization, fidl::Error> {
1320        let _response = self.client.send_query::<
1321            fidl::encoding::EmptyPayload,
1322            ControlGetAuthorizationForInterfaceResponse,
1323        >(
1324            (),
1325            0xc1de2ab60b5cb9e,
1326            fidl::encoding::DynamicFlags::empty(),
1327            ___deadline,
1328        )?;
1329        Ok(_response.credential)
1330    }
1331
1332    /// Initiates interface removal.
1333    ///
1334    /// This method returns success once interface removal has started. When the
1335    /// interface is removed, a `USER` removed reason is issued in
1336    /// [`OnInterfaceRemoved`] and the server end is closed.
1337    pub fn r#remove(
1338        &self,
1339        ___deadline: zx::MonotonicInstant,
1340    ) -> Result<ControlRemoveResult, fidl::Error> {
1341        let _response =
1342            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
1343                fidl::encoding::EmptyStruct,
1344                ControlRemoveError,
1345            >>(
1346                (),
1347                0x13aab8bbecc7ff0b,
1348                fidl::encoding::DynamicFlags::empty(),
1349                ___deadline,
1350            )?;
1351        Ok(_response.map(|x| x))
1352    }
1353}
1354
1355#[cfg(target_os = "fuchsia")]
1356impl From<ControlSynchronousProxy> for zx::Handle {
1357    fn from(value: ControlSynchronousProxy) -> Self {
1358        value.into_channel().into()
1359    }
1360}
1361
1362#[cfg(target_os = "fuchsia")]
1363impl From<fidl::Channel> for ControlSynchronousProxy {
1364    fn from(value: fidl::Channel) -> Self {
1365        Self::new(value)
1366    }
1367}
1368
1369#[cfg(target_os = "fuchsia")]
1370impl fidl::endpoints::FromClient for ControlSynchronousProxy {
1371    type Protocol = ControlMarker;
1372
1373    fn from_client(value: fidl::endpoints::ClientEnd<ControlMarker>) -> Self {
1374        Self::new(value.into_channel())
1375    }
1376}
1377
1378#[derive(Debug, Clone)]
1379pub struct ControlProxy {
1380    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1381}
1382
1383impl fidl::endpoints::Proxy for ControlProxy {
1384    type Protocol = ControlMarker;
1385
1386    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1387        Self::new(inner)
1388    }
1389
1390    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1391        self.client.into_channel().map_err(|client| Self { client })
1392    }
1393
1394    fn as_channel(&self) -> &::fidl::AsyncChannel {
1395        self.client.as_channel()
1396    }
1397}
1398
1399impl ControlProxy {
1400    /// Create a new Proxy for fuchsia.net.interfaces.admin/Control.
1401    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1402        let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1403        Self { client: fidl::client::Client::new(channel, protocol_name) }
1404    }
1405
1406    /// Get a Stream of events from the remote end of the protocol.
1407    ///
1408    /// # Panics
1409    ///
1410    /// Panics if the event stream was already taken.
1411    pub fn take_event_stream(&self) -> ControlEventStream {
1412        ControlEventStream { event_receiver: self.client.take_event_receiver() }
1413    }
1414
1415    /// Assigns an address to the interface.
1416    ///
1417    /// Errors are communicated via
1418    /// [`fuchsia.net.interfaces.admin/AddressStateProvider.OnAddressRemoved`].
1419    ///
1420    /// + request `address` the address to assign to the interface.
1421    /// + request `parameters` additional address-specific options.
1422    /// + request `address_state_provider` provides address assignment state
1423    ///     and enables updating address properties.
1424    pub fn r#add_address(
1425        &self,
1426        mut address: &fidl_fuchsia_net::Subnet,
1427        mut parameters: &AddressParameters,
1428        mut address_state_provider: fidl::endpoints::ServerEnd<AddressStateProviderMarker>,
1429    ) -> Result<(), fidl::Error> {
1430        ControlProxyInterface::r#add_address(self, address, parameters, address_state_provider)
1431    }
1432
1433    /// Removes an address from the interface.
1434    ///
1435    /// + request `address` the address to remove.
1436    /// - response `did_remove` `true` iff `address` was removed from the
1437    ///  interface as a consequence of this call.
1438    pub fn r#remove_address(
1439        &self,
1440        mut address: &fidl_fuchsia_net::Subnet,
1441    ) -> fidl::client::QueryResponseFut<
1442        ControlRemoveAddressResult,
1443        fidl::encoding::DefaultFuchsiaResourceDialect,
1444    > {
1445        ControlProxyInterface::r#remove_address(self, address)
1446    }
1447
1448    /// Gets the interface identifier.
1449    ///
1450    /// - response `id` the interface identifier.
1451    pub fn r#get_id(
1452        &self,
1453    ) -> fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect> {
1454        ControlProxyInterface::r#get_id(self)
1455    }
1456
1457    /// Sets the configuration for the interface.
1458    ///
1459    /// Only set fields that are supported in the provided [`Configuration`]
1460    /// will be set; unset fields will be left unmodified. The server will
1461    /// return a [`Configuration`] which holds the previous configuration for
1462    /// fields that the interface supports and set, even if the call did not
1463    /// update the configuration's value.
1464    ///
1465    /// + request `config` the configuration fields to update on the interface.
1466    /// - response `previous_config` a snapshot of the interface's previous
1467    ///   configuration. Only supported fields present in `config` will be set.
1468    pub fn r#set_configuration(
1469        &self,
1470        mut config: &Configuration,
1471    ) -> fidl::client::QueryResponseFut<
1472        ControlSetConfigurationResult,
1473        fidl::encoding::DefaultFuchsiaResourceDialect,
1474    > {
1475        ControlProxyInterface::r#set_configuration(self, config)
1476    }
1477
1478    /// Gets a snapshot of the interface's configuration.
1479    ///
1480    /// The server will populate the returned [`Configuration`] with the
1481    /// configuration for features/protocols that the interface supports. That
1482    /// is, fields for unsupported configurations will be unset in the returned
1483    /// [`Configuration`].
1484    ///
1485    /// - response `config` a snapshot of the interface's configuration.
1486    pub fn r#get_configuration(
1487        &self,
1488    ) -> fidl::client::QueryResponseFut<
1489        ControlGetConfigurationResult,
1490        fidl::encoding::DefaultFuchsiaResourceDialect,
1491    > {
1492        ControlProxyInterface::r#get_configuration(self)
1493    }
1494
1495    /// Enables the interface.
1496    ///
1497    /// - response `did_enable` `true` iff the interface moved from disabled to
1498    /// enabled as a consequence of this call.
1499    pub fn r#enable(
1500        &self,
1501    ) -> fidl::client::QueryResponseFut<
1502        ControlEnableResult,
1503        fidl::encoding::DefaultFuchsiaResourceDialect,
1504    > {
1505        ControlProxyInterface::r#enable(self)
1506    }
1507
1508    /// Disables the interface.
1509    ///
1510    /// - response `did_disable` `true` iff the interface moved from enabled to
1511    /// disabled as a consequence of this call.
1512    pub fn r#disable(
1513        &self,
1514    ) -> fidl::client::QueryResponseFut<
1515        ControlDisableResult,
1516        fidl::encoding::DefaultFuchsiaResourceDialect,
1517    > {
1518        ControlProxyInterface::r#disable(self)
1519    }
1520
1521    /// Detaches the client end from the interface's lifetime.
1522    ///
1523    /// After calling `Detach`, closing this client end no longer causes the
1524    /// interface to be removed.
1525    pub fn r#detach(&self) -> Result<(), fidl::Error> {
1526        ControlProxyInterface::r#detach(self)
1527    }
1528
1529    /// Get an authentication credential for this interface.
1530    ///
1531    /// The credential contains a [`zx::handle::EVENT`], whose entangled
1532    /// partner is held by the server. This credential can be converted into a
1533    /// [`ProofOfInterfaceAuthorization`] and then passed into `fuchsia.net.*`
1534    /// API calls to prove ownership of this interface. The `EVENT` is
1535    /// stable throughout the lifetime of the interface. Clients may duplicate
1536    /// this `EVENT` to make multiple API calls, or transfer the `EVENT`
1537    /// to other clients.
1538    ///
1539    /// - response `credential` the authorization credential for this interface.
1540    pub fn r#get_authorization_for_interface(
1541        &self,
1542    ) -> fidl::client::QueryResponseFut<
1543        GrantForInterfaceAuthorization,
1544        fidl::encoding::DefaultFuchsiaResourceDialect,
1545    > {
1546        ControlProxyInterface::r#get_authorization_for_interface(self)
1547    }
1548
1549    /// Initiates interface removal.
1550    ///
1551    /// This method returns success once interface removal has started. When the
1552    /// interface is removed, a `USER` removed reason is issued in
1553    /// [`OnInterfaceRemoved`] and the server end is closed.
1554    pub fn r#remove(
1555        &self,
1556    ) -> fidl::client::QueryResponseFut<
1557        ControlRemoveResult,
1558        fidl::encoding::DefaultFuchsiaResourceDialect,
1559    > {
1560        ControlProxyInterface::r#remove(self)
1561    }
1562}
1563
1564impl ControlProxyInterface for ControlProxy {
1565    fn r#add_address(
1566        &self,
1567        mut address: &fidl_fuchsia_net::Subnet,
1568        mut parameters: &AddressParameters,
1569        mut address_state_provider: fidl::endpoints::ServerEnd<AddressStateProviderMarker>,
1570    ) -> Result<(), fidl::Error> {
1571        self.client.send::<ControlAddAddressRequest>(
1572            (address, parameters, address_state_provider),
1573            0x1349d36da453ce,
1574            fidl::encoding::DynamicFlags::empty(),
1575        )
1576    }
1577
1578    type RemoveAddressResponseFut = fidl::client::QueryResponseFut<
1579        ControlRemoveAddressResult,
1580        fidl::encoding::DefaultFuchsiaResourceDialect,
1581    >;
1582    fn r#remove_address(
1583        &self,
1584        mut address: &fidl_fuchsia_net::Subnet,
1585    ) -> Self::RemoveAddressResponseFut {
1586        fn _decode(
1587            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1588        ) -> Result<ControlRemoveAddressResult, fidl::Error> {
1589            let _response = fidl::client::decode_transaction_body::<
1590                fidl::encoding::ResultType<ControlRemoveAddressResponse, ControlRemoveAddressError>,
1591                fidl::encoding::DefaultFuchsiaResourceDialect,
1592                0x213ba73da997a620,
1593            >(_buf?)?;
1594            Ok(_response.map(|x| x.did_remove))
1595        }
1596        self.client
1597            .send_query_and_decode::<ControlRemoveAddressRequest, ControlRemoveAddressResult>(
1598                (address,),
1599                0x213ba73da997a620,
1600                fidl::encoding::DynamicFlags::empty(),
1601                _decode,
1602            )
1603    }
1604
1605    type GetIdResponseFut =
1606        fidl::client::QueryResponseFut<u64, fidl::encoding::DefaultFuchsiaResourceDialect>;
1607    fn r#get_id(&self) -> Self::GetIdResponseFut {
1608        fn _decode(
1609            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1610        ) -> Result<u64, fidl::Error> {
1611            let _response = fidl::client::decode_transaction_body::<
1612                ControlGetIdResponse,
1613                fidl::encoding::DefaultFuchsiaResourceDialect,
1614                0x2a2459768d9ecc6f,
1615            >(_buf?)?;
1616            Ok(_response.id)
1617        }
1618        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u64>(
1619            (),
1620            0x2a2459768d9ecc6f,
1621            fidl::encoding::DynamicFlags::empty(),
1622            _decode,
1623        )
1624    }
1625
1626    type SetConfigurationResponseFut = fidl::client::QueryResponseFut<
1627        ControlSetConfigurationResult,
1628        fidl::encoding::DefaultFuchsiaResourceDialect,
1629    >;
1630    fn r#set_configuration(&self, mut config: &Configuration) -> Self::SetConfigurationResponseFut {
1631        fn _decode(
1632            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1633        ) -> Result<ControlSetConfigurationResult, fidl::Error> {
1634            let _response = fidl::client::decode_transaction_body::<
1635                fidl::encoding::ResultType<
1636                    ControlSetConfigurationResponse,
1637                    ControlSetConfigurationError,
1638                >,
1639                fidl::encoding::DefaultFuchsiaResourceDialect,
1640                0x573923b7b4bde27f,
1641            >(_buf?)?;
1642            Ok(_response.map(|x| x.previous_config))
1643        }
1644        self.client
1645            .send_query_and_decode::<ControlSetConfigurationRequest, ControlSetConfigurationResult>(
1646                (config,),
1647                0x573923b7b4bde27f,
1648                fidl::encoding::DynamicFlags::empty(),
1649                _decode,
1650            )
1651    }
1652
1653    type GetConfigurationResponseFut = fidl::client::QueryResponseFut<
1654        ControlGetConfigurationResult,
1655        fidl::encoding::DefaultFuchsiaResourceDialect,
1656    >;
1657    fn r#get_configuration(&self) -> Self::GetConfigurationResponseFut {
1658        fn _decode(
1659            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1660        ) -> Result<ControlGetConfigurationResult, fidl::Error> {
1661            let _response = fidl::client::decode_transaction_body::<
1662                fidl::encoding::ResultType<
1663                    ControlGetConfigurationResponse,
1664                    ControlGetConfigurationError,
1665                >,
1666                fidl::encoding::DefaultFuchsiaResourceDialect,
1667                0x5f5d239820bdcc65,
1668            >(_buf?)?;
1669            Ok(_response.map(|x| x.config))
1670        }
1671        self.client
1672            .send_query_and_decode::<fidl::encoding::EmptyPayload, ControlGetConfigurationResult>(
1673                (),
1674                0x5f5d239820bdcc65,
1675                fidl::encoding::DynamicFlags::empty(),
1676                _decode,
1677            )
1678    }
1679
1680    type EnableResponseFut = fidl::client::QueryResponseFut<
1681        ControlEnableResult,
1682        fidl::encoding::DefaultFuchsiaResourceDialect,
1683    >;
1684    fn r#enable(&self) -> Self::EnableResponseFut {
1685        fn _decode(
1686            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1687        ) -> Result<ControlEnableResult, fidl::Error> {
1688            let _response = fidl::client::decode_transaction_body::<
1689                fidl::encoding::ResultType<ControlEnableResponse, ControlEnableError>,
1690                fidl::encoding::DefaultFuchsiaResourceDialect,
1691                0x15c983d3a8ac0b98,
1692            >(_buf?)?;
1693            Ok(_response.map(|x| x.did_enable))
1694        }
1695        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControlEnableResult>(
1696            (),
1697            0x15c983d3a8ac0b98,
1698            fidl::encoding::DynamicFlags::empty(),
1699            _decode,
1700        )
1701    }
1702
1703    type DisableResponseFut = fidl::client::QueryResponseFut<
1704        ControlDisableResult,
1705        fidl::encoding::DefaultFuchsiaResourceDialect,
1706    >;
1707    fn r#disable(&self) -> Self::DisableResponseFut {
1708        fn _decode(
1709            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1710        ) -> Result<ControlDisableResult, fidl::Error> {
1711            let _response = fidl::client::decode_transaction_body::<
1712                fidl::encoding::ResultType<ControlDisableResponse, ControlDisableError>,
1713                fidl::encoding::DefaultFuchsiaResourceDialect,
1714                0x98d3a585d905473,
1715            >(_buf?)?;
1716            Ok(_response.map(|x| x.did_disable))
1717        }
1718        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControlDisableResult>(
1719            (),
1720            0x98d3a585d905473,
1721            fidl::encoding::DynamicFlags::empty(),
1722            _decode,
1723        )
1724    }
1725
1726    fn r#detach(&self) -> Result<(), fidl::Error> {
1727        self.client.send::<fidl::encoding::EmptyPayload>(
1728            (),
1729            0x78ee27518b2dbfa,
1730            fidl::encoding::DynamicFlags::empty(),
1731        )
1732    }
1733
1734    type GetAuthorizationForInterfaceResponseFut = fidl::client::QueryResponseFut<
1735        GrantForInterfaceAuthorization,
1736        fidl::encoding::DefaultFuchsiaResourceDialect,
1737    >;
1738    fn r#get_authorization_for_interface(&self) -> Self::GetAuthorizationForInterfaceResponseFut {
1739        fn _decode(
1740            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1741        ) -> Result<GrantForInterfaceAuthorization, fidl::Error> {
1742            let _response = fidl::client::decode_transaction_body::<
1743                ControlGetAuthorizationForInterfaceResponse,
1744                fidl::encoding::DefaultFuchsiaResourceDialect,
1745                0xc1de2ab60b5cb9e,
1746            >(_buf?)?;
1747            Ok(_response.credential)
1748        }
1749        self.client
1750            .send_query_and_decode::<fidl::encoding::EmptyPayload, GrantForInterfaceAuthorization>(
1751                (),
1752                0xc1de2ab60b5cb9e,
1753                fidl::encoding::DynamicFlags::empty(),
1754                _decode,
1755            )
1756    }
1757
1758    type RemoveResponseFut = fidl::client::QueryResponseFut<
1759        ControlRemoveResult,
1760        fidl::encoding::DefaultFuchsiaResourceDialect,
1761    >;
1762    fn r#remove(&self) -> Self::RemoveResponseFut {
1763        fn _decode(
1764            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1765        ) -> Result<ControlRemoveResult, fidl::Error> {
1766            let _response = fidl::client::decode_transaction_body::<
1767                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, ControlRemoveError>,
1768                fidl::encoding::DefaultFuchsiaResourceDialect,
1769                0x13aab8bbecc7ff0b,
1770            >(_buf?)?;
1771            Ok(_response.map(|x| x))
1772        }
1773        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControlRemoveResult>(
1774            (),
1775            0x13aab8bbecc7ff0b,
1776            fidl::encoding::DynamicFlags::empty(),
1777            _decode,
1778        )
1779    }
1780}
1781
1782pub struct ControlEventStream {
1783    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1784}
1785
1786impl std::marker::Unpin for ControlEventStream {}
1787
1788impl futures::stream::FusedStream for ControlEventStream {
1789    fn is_terminated(&self) -> bool {
1790        self.event_receiver.is_terminated()
1791    }
1792}
1793
1794impl futures::Stream for ControlEventStream {
1795    type Item = Result<ControlEvent, fidl::Error>;
1796
1797    fn poll_next(
1798        mut self: std::pin::Pin<&mut Self>,
1799        cx: &mut std::task::Context<'_>,
1800    ) -> std::task::Poll<Option<Self::Item>> {
1801        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1802            &mut self.event_receiver,
1803            cx
1804        )?) {
1805            Some(buf) => std::task::Poll::Ready(Some(ControlEvent::decode(buf))),
1806            None => std::task::Poll::Ready(None),
1807        }
1808    }
1809}
1810
1811#[derive(Debug)]
1812pub enum ControlEvent {
1813    OnInterfaceRemoved { reason: InterfaceRemovedReason },
1814}
1815
1816impl ControlEvent {
1817    #[allow(irrefutable_let_patterns)]
1818    pub fn into_on_interface_removed(self) -> Option<InterfaceRemovedReason> {
1819        if let ControlEvent::OnInterfaceRemoved { reason } = self {
1820            Some((reason))
1821        } else {
1822            None
1823        }
1824    }
1825
1826    /// Decodes a message buffer as a [`ControlEvent`].
1827    fn decode(
1828        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1829    ) -> Result<ControlEvent, fidl::Error> {
1830        let (bytes, _handles) = buf.split_mut();
1831        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1832        debug_assert_eq!(tx_header.tx_id, 0);
1833        match tx_header.ordinal {
1834            0x800d39e76c1cddd => {
1835                let mut out = fidl::new_empty!(
1836                    ControlOnInterfaceRemovedRequest,
1837                    fidl::encoding::DefaultFuchsiaResourceDialect
1838                );
1839                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlOnInterfaceRemovedRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1840                Ok((ControlEvent::OnInterfaceRemoved { reason: out.reason }))
1841            }
1842            _ => Err(fidl::Error::UnknownOrdinal {
1843                ordinal: tx_header.ordinal,
1844                protocol_name: <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1845            }),
1846        }
1847    }
1848}
1849
1850/// A Stream of incoming requests for fuchsia.net.interfaces.admin/Control.
1851pub struct ControlRequestStream {
1852    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1853    is_terminated: bool,
1854}
1855
1856impl std::marker::Unpin for ControlRequestStream {}
1857
1858impl futures::stream::FusedStream for ControlRequestStream {
1859    fn is_terminated(&self) -> bool {
1860        self.is_terminated
1861    }
1862}
1863
1864impl fidl::endpoints::RequestStream for ControlRequestStream {
1865    type Protocol = ControlMarker;
1866    type ControlHandle = ControlControlHandle;
1867
1868    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1869        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1870    }
1871
1872    fn control_handle(&self) -> Self::ControlHandle {
1873        ControlControlHandle { inner: self.inner.clone() }
1874    }
1875
1876    fn into_inner(
1877        self,
1878    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1879    {
1880        (self.inner, self.is_terminated)
1881    }
1882
1883    fn from_inner(
1884        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1885        is_terminated: bool,
1886    ) -> Self {
1887        Self { inner, is_terminated }
1888    }
1889}
1890
1891impl futures::Stream for ControlRequestStream {
1892    type Item = Result<ControlRequest, fidl::Error>;
1893
1894    fn poll_next(
1895        mut self: std::pin::Pin<&mut Self>,
1896        cx: &mut std::task::Context<'_>,
1897    ) -> std::task::Poll<Option<Self::Item>> {
1898        let this = &mut *self;
1899        if this.inner.check_shutdown(cx) {
1900            this.is_terminated = true;
1901            return std::task::Poll::Ready(None);
1902        }
1903        if this.is_terminated {
1904            panic!("polled ControlRequestStream after completion");
1905        }
1906        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1907            |bytes, handles| {
1908                match this.inner.channel().read_etc(cx, bytes, handles) {
1909                    std::task::Poll::Ready(Ok(())) => {}
1910                    std::task::Poll::Pending => return std::task::Poll::Pending,
1911                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1912                        this.is_terminated = true;
1913                        return std::task::Poll::Ready(None);
1914                    }
1915                    std::task::Poll::Ready(Err(e)) => {
1916                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1917                            e.into(),
1918                        ))))
1919                    }
1920                }
1921
1922                // A message has been received from the channel
1923                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1924
1925                std::task::Poll::Ready(Some(match header.ordinal {
1926                    0x1349d36da453ce => {
1927                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1928                        let mut req = fidl::new_empty!(
1929                            ControlAddAddressRequest,
1930                            fidl::encoding::DefaultFuchsiaResourceDialect
1931                        );
1932                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlAddAddressRequest>(&header, _body_bytes, handles, &mut req)?;
1933                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
1934                        Ok(ControlRequest::AddAddress {
1935                            address: req.address,
1936                            parameters: req.parameters,
1937                            address_state_provider: req.address_state_provider,
1938
1939                            control_handle,
1940                        })
1941                    }
1942                    0x213ba73da997a620 => {
1943                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1944                        let mut req = fidl::new_empty!(
1945                            ControlRemoveAddressRequest,
1946                            fidl::encoding::DefaultFuchsiaResourceDialect
1947                        );
1948                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlRemoveAddressRequest>(&header, _body_bytes, handles, &mut req)?;
1949                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
1950                        Ok(ControlRequest::RemoveAddress {
1951                            address: req.address,
1952
1953                            responder: ControlRemoveAddressResponder {
1954                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1955                                tx_id: header.tx_id,
1956                            },
1957                        })
1958                    }
1959                    0x2a2459768d9ecc6f => {
1960                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1961                        let mut req = fidl::new_empty!(
1962                            fidl::encoding::EmptyPayload,
1963                            fidl::encoding::DefaultFuchsiaResourceDialect
1964                        );
1965                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1966                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
1967                        Ok(ControlRequest::GetId {
1968                            responder: ControlGetIdResponder {
1969                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1970                                tx_id: header.tx_id,
1971                            },
1972                        })
1973                    }
1974                    0x573923b7b4bde27f => {
1975                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1976                        let mut req = fidl::new_empty!(
1977                            ControlSetConfigurationRequest,
1978                            fidl::encoding::DefaultFuchsiaResourceDialect
1979                        );
1980                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlSetConfigurationRequest>(&header, _body_bytes, handles, &mut req)?;
1981                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
1982                        Ok(ControlRequest::SetConfiguration {
1983                            config: req.config,
1984
1985                            responder: ControlSetConfigurationResponder {
1986                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1987                                tx_id: header.tx_id,
1988                            },
1989                        })
1990                    }
1991                    0x5f5d239820bdcc65 => {
1992                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1993                        let mut req = fidl::new_empty!(
1994                            fidl::encoding::EmptyPayload,
1995                            fidl::encoding::DefaultFuchsiaResourceDialect
1996                        );
1997                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1998                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
1999                        Ok(ControlRequest::GetConfiguration {
2000                            responder: ControlGetConfigurationResponder {
2001                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2002                                tx_id: header.tx_id,
2003                            },
2004                        })
2005                    }
2006                    0x15c983d3a8ac0b98 => {
2007                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2008                        let mut req = fidl::new_empty!(
2009                            fidl::encoding::EmptyPayload,
2010                            fidl::encoding::DefaultFuchsiaResourceDialect
2011                        );
2012                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2013                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
2014                        Ok(ControlRequest::Enable {
2015                            responder: ControlEnableResponder {
2016                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2017                                tx_id: header.tx_id,
2018                            },
2019                        })
2020                    }
2021                    0x98d3a585d905473 => {
2022                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2023                        let mut req = fidl::new_empty!(
2024                            fidl::encoding::EmptyPayload,
2025                            fidl::encoding::DefaultFuchsiaResourceDialect
2026                        );
2027                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2028                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
2029                        Ok(ControlRequest::Disable {
2030                            responder: ControlDisableResponder {
2031                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2032                                tx_id: header.tx_id,
2033                            },
2034                        })
2035                    }
2036                    0x78ee27518b2dbfa => {
2037                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2038                        let mut req = fidl::new_empty!(
2039                            fidl::encoding::EmptyPayload,
2040                            fidl::encoding::DefaultFuchsiaResourceDialect
2041                        );
2042                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2043                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
2044                        Ok(ControlRequest::Detach { control_handle })
2045                    }
2046                    0xc1de2ab60b5cb9e => {
2047                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2048                        let mut req = fidl::new_empty!(
2049                            fidl::encoding::EmptyPayload,
2050                            fidl::encoding::DefaultFuchsiaResourceDialect
2051                        );
2052                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2053                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
2054                        Ok(ControlRequest::GetAuthorizationForInterface {
2055                            responder: ControlGetAuthorizationForInterfaceResponder {
2056                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2057                                tx_id: header.tx_id,
2058                            },
2059                        })
2060                    }
2061                    0x13aab8bbecc7ff0b => {
2062                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2063                        let mut req = fidl::new_empty!(
2064                            fidl::encoding::EmptyPayload,
2065                            fidl::encoding::DefaultFuchsiaResourceDialect
2066                        );
2067                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2068                        let control_handle = ControlControlHandle { inner: this.inner.clone() };
2069                        Ok(ControlRequest::Remove {
2070                            responder: ControlRemoveResponder {
2071                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2072                                tx_id: header.tx_id,
2073                            },
2074                        })
2075                    }
2076                    _ => Err(fidl::Error::UnknownOrdinal {
2077                        ordinal: header.ordinal,
2078                        protocol_name:
2079                            <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2080                    }),
2081                }))
2082            },
2083        )
2084    }
2085}
2086
2087/// Provides control over an interface.
2088///
2089/// This protocol encodes the underlying interface's lifetime in both
2090/// directions; the interface exists iff both ends of the protocol are open.
2091/// That is:
2092///
2093/// - Closing the client end causes the interface to be removed.
2094/// - Observing a closure of the server end indicates the interface no longer
2095///   exists.
2096#[derive(Debug)]
2097pub enum ControlRequest {
2098    /// Assigns an address to the interface.
2099    ///
2100    /// Errors are communicated via
2101    /// [`fuchsia.net.interfaces.admin/AddressStateProvider.OnAddressRemoved`].
2102    ///
2103    /// + request `address` the address to assign to the interface.
2104    /// + request `parameters` additional address-specific options.
2105    /// + request `address_state_provider` provides address assignment state
2106    ///     and enables updating address properties.
2107    AddAddress {
2108        address: fidl_fuchsia_net::Subnet,
2109        parameters: AddressParameters,
2110        address_state_provider: fidl::endpoints::ServerEnd<AddressStateProviderMarker>,
2111        control_handle: ControlControlHandle,
2112    },
2113    /// Removes an address from the interface.
2114    ///
2115    /// + request `address` the address to remove.
2116    /// - response `did_remove` `true` iff `address` was removed from the
2117    ///  interface as a consequence of this call.
2118    RemoveAddress { address: fidl_fuchsia_net::Subnet, responder: ControlRemoveAddressResponder },
2119    /// Gets the interface identifier.
2120    ///
2121    /// - response `id` the interface identifier.
2122    GetId { responder: ControlGetIdResponder },
2123    /// Sets the configuration for the interface.
2124    ///
2125    /// Only set fields that are supported in the provided [`Configuration`]
2126    /// will be set; unset fields will be left unmodified. The server will
2127    /// return a [`Configuration`] which holds the previous configuration for
2128    /// fields that the interface supports and set, even if the call did not
2129    /// update the configuration's value.
2130    ///
2131    /// + request `config` the configuration fields to update on the interface.
2132    /// - response `previous_config` a snapshot of the interface's previous
2133    ///   configuration. Only supported fields present in `config` will be set.
2134    SetConfiguration { config: Configuration, responder: ControlSetConfigurationResponder },
2135    /// Gets a snapshot of the interface's configuration.
2136    ///
2137    /// The server will populate the returned [`Configuration`] with the
2138    /// configuration for features/protocols that the interface supports. That
2139    /// is, fields for unsupported configurations will be unset in the returned
2140    /// [`Configuration`].
2141    ///
2142    /// - response `config` a snapshot of the interface's configuration.
2143    GetConfiguration { responder: ControlGetConfigurationResponder },
2144    /// Enables the interface.
2145    ///
2146    /// - response `did_enable` `true` iff the interface moved from disabled to
2147    /// enabled as a consequence of this call.
2148    Enable { responder: ControlEnableResponder },
2149    /// Disables the interface.
2150    ///
2151    /// - response `did_disable` `true` iff the interface moved from enabled to
2152    /// disabled as a consequence of this call.
2153    Disable { responder: ControlDisableResponder },
2154    /// Detaches the client end from the interface's lifetime.
2155    ///
2156    /// After calling `Detach`, closing this client end no longer causes the
2157    /// interface to be removed.
2158    Detach { control_handle: ControlControlHandle },
2159    /// Get an authentication credential for this interface.
2160    ///
2161    /// The credential contains a [`zx::handle::EVENT`], whose entangled
2162    /// partner is held by the server. This credential can be converted into a
2163    /// [`ProofOfInterfaceAuthorization`] and then passed into `fuchsia.net.*`
2164    /// API calls to prove ownership of this interface. The `EVENT` is
2165    /// stable throughout the lifetime of the interface. Clients may duplicate
2166    /// this `EVENT` to make multiple API calls, or transfer the `EVENT`
2167    /// to other clients.
2168    ///
2169    /// - response `credential` the authorization credential for this interface.
2170    GetAuthorizationForInterface { responder: ControlGetAuthorizationForInterfaceResponder },
2171    /// Initiates interface removal.
2172    ///
2173    /// This method returns success once interface removal has started. When the
2174    /// interface is removed, a `USER` removed reason is issued in
2175    /// [`OnInterfaceRemoved`] and the server end is closed.
2176    Remove { responder: ControlRemoveResponder },
2177}
2178
2179impl ControlRequest {
2180    #[allow(irrefutable_let_patterns)]
2181    pub fn into_add_address(
2182        self,
2183    ) -> Option<(
2184        fidl_fuchsia_net::Subnet,
2185        AddressParameters,
2186        fidl::endpoints::ServerEnd<AddressStateProviderMarker>,
2187        ControlControlHandle,
2188    )> {
2189        if let ControlRequest::AddAddress {
2190            address,
2191            parameters,
2192            address_state_provider,
2193            control_handle,
2194        } = self
2195        {
2196            Some((address, parameters, address_state_provider, control_handle))
2197        } else {
2198            None
2199        }
2200    }
2201
2202    #[allow(irrefutable_let_patterns)]
2203    pub fn into_remove_address(
2204        self,
2205    ) -> Option<(fidl_fuchsia_net::Subnet, ControlRemoveAddressResponder)> {
2206        if let ControlRequest::RemoveAddress { address, responder } = self {
2207            Some((address, responder))
2208        } else {
2209            None
2210        }
2211    }
2212
2213    #[allow(irrefutable_let_patterns)]
2214    pub fn into_get_id(self) -> Option<(ControlGetIdResponder)> {
2215        if let ControlRequest::GetId { responder } = self {
2216            Some((responder))
2217        } else {
2218            None
2219        }
2220    }
2221
2222    #[allow(irrefutable_let_patterns)]
2223    pub fn into_set_configuration(
2224        self,
2225    ) -> Option<(Configuration, ControlSetConfigurationResponder)> {
2226        if let ControlRequest::SetConfiguration { config, responder } = self {
2227            Some((config, responder))
2228        } else {
2229            None
2230        }
2231    }
2232
2233    #[allow(irrefutable_let_patterns)]
2234    pub fn into_get_configuration(self) -> Option<(ControlGetConfigurationResponder)> {
2235        if let ControlRequest::GetConfiguration { responder } = self {
2236            Some((responder))
2237        } else {
2238            None
2239        }
2240    }
2241
2242    #[allow(irrefutable_let_patterns)]
2243    pub fn into_enable(self) -> Option<(ControlEnableResponder)> {
2244        if let ControlRequest::Enable { responder } = self {
2245            Some((responder))
2246        } else {
2247            None
2248        }
2249    }
2250
2251    #[allow(irrefutable_let_patterns)]
2252    pub fn into_disable(self) -> Option<(ControlDisableResponder)> {
2253        if let ControlRequest::Disable { responder } = self {
2254            Some((responder))
2255        } else {
2256            None
2257        }
2258    }
2259
2260    #[allow(irrefutable_let_patterns)]
2261    pub fn into_detach(self) -> Option<(ControlControlHandle)> {
2262        if let ControlRequest::Detach { control_handle } = self {
2263            Some((control_handle))
2264        } else {
2265            None
2266        }
2267    }
2268
2269    #[allow(irrefutable_let_patterns)]
2270    pub fn into_get_authorization_for_interface(
2271        self,
2272    ) -> Option<(ControlGetAuthorizationForInterfaceResponder)> {
2273        if let ControlRequest::GetAuthorizationForInterface { responder } = self {
2274            Some((responder))
2275        } else {
2276            None
2277        }
2278    }
2279
2280    #[allow(irrefutable_let_patterns)]
2281    pub fn into_remove(self) -> Option<(ControlRemoveResponder)> {
2282        if let ControlRequest::Remove { responder } = self {
2283            Some((responder))
2284        } else {
2285            None
2286        }
2287    }
2288
2289    /// Name of the method defined in FIDL
2290    pub fn method_name(&self) -> &'static str {
2291        match *self {
2292            ControlRequest::AddAddress { .. } => "add_address",
2293            ControlRequest::RemoveAddress { .. } => "remove_address",
2294            ControlRequest::GetId { .. } => "get_id",
2295            ControlRequest::SetConfiguration { .. } => "set_configuration",
2296            ControlRequest::GetConfiguration { .. } => "get_configuration",
2297            ControlRequest::Enable { .. } => "enable",
2298            ControlRequest::Disable { .. } => "disable",
2299            ControlRequest::Detach { .. } => "detach",
2300            ControlRequest::GetAuthorizationForInterface { .. } => {
2301                "get_authorization_for_interface"
2302            }
2303            ControlRequest::Remove { .. } => "remove",
2304        }
2305    }
2306}
2307
2308#[derive(Debug, Clone)]
2309pub struct ControlControlHandle {
2310    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2311}
2312
2313impl fidl::endpoints::ControlHandle for ControlControlHandle {
2314    fn shutdown(&self) {
2315        self.inner.shutdown()
2316    }
2317    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2318        self.inner.shutdown_with_epitaph(status)
2319    }
2320
2321    fn is_closed(&self) -> bool {
2322        self.inner.channel().is_closed()
2323    }
2324    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2325        self.inner.channel().on_closed()
2326    }
2327
2328    #[cfg(target_os = "fuchsia")]
2329    fn signal_peer(
2330        &self,
2331        clear_mask: zx::Signals,
2332        set_mask: zx::Signals,
2333    ) -> Result<(), zx_status::Status> {
2334        use fidl::Peered;
2335        self.inner.channel().signal_peer(clear_mask, set_mask)
2336    }
2337}
2338
2339impl ControlControlHandle {
2340    pub fn send_on_interface_removed(
2341        &self,
2342        mut reason: InterfaceRemovedReason,
2343    ) -> Result<(), fidl::Error> {
2344        self.inner.send::<ControlOnInterfaceRemovedRequest>(
2345            (reason,),
2346            0,
2347            0x800d39e76c1cddd,
2348            fidl::encoding::DynamicFlags::empty(),
2349        )
2350    }
2351}
2352
2353#[must_use = "FIDL methods require a response to be sent"]
2354#[derive(Debug)]
2355pub struct ControlRemoveAddressResponder {
2356    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2357    tx_id: u32,
2358}
2359
2360/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
2361/// if the responder is dropped without sending a response, so that the client
2362/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2363impl std::ops::Drop for ControlRemoveAddressResponder {
2364    fn drop(&mut self) {
2365        self.control_handle.shutdown();
2366        // Safety: drops once, never accessed again
2367        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2368    }
2369}
2370
2371impl fidl::endpoints::Responder for ControlRemoveAddressResponder {
2372    type ControlHandle = ControlControlHandle;
2373
2374    fn control_handle(&self) -> &ControlControlHandle {
2375        &self.control_handle
2376    }
2377
2378    fn drop_without_shutdown(mut self) {
2379        // Safety: drops once, never accessed again due to mem::forget
2380        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2381        // Prevent Drop from running (which would shut down the channel)
2382        std::mem::forget(self);
2383    }
2384}
2385
2386impl ControlRemoveAddressResponder {
2387    /// Sends a response to the FIDL transaction.
2388    ///
2389    /// Sets the channel to shutdown if an error occurs.
2390    pub fn send(
2391        self,
2392        mut result: Result<bool, ControlRemoveAddressError>,
2393    ) -> Result<(), fidl::Error> {
2394        let _result = self.send_raw(result);
2395        if _result.is_err() {
2396            self.control_handle.shutdown();
2397        }
2398        self.drop_without_shutdown();
2399        _result
2400    }
2401
2402    /// Similar to "send" but does not shutdown the channel if an error occurs.
2403    pub fn send_no_shutdown_on_err(
2404        self,
2405        mut result: Result<bool, ControlRemoveAddressError>,
2406    ) -> Result<(), fidl::Error> {
2407        let _result = self.send_raw(result);
2408        self.drop_without_shutdown();
2409        _result
2410    }
2411
2412    fn send_raw(
2413        &self,
2414        mut result: Result<bool, ControlRemoveAddressError>,
2415    ) -> Result<(), fidl::Error> {
2416        self.control_handle.inner.send::<fidl::encoding::ResultType<
2417            ControlRemoveAddressResponse,
2418            ControlRemoveAddressError,
2419        >>(
2420            result.map(|did_remove| (did_remove,)),
2421            self.tx_id,
2422            0x213ba73da997a620,
2423            fidl::encoding::DynamicFlags::empty(),
2424        )
2425    }
2426}
2427
2428#[must_use = "FIDL methods require a response to be sent"]
2429#[derive(Debug)]
2430pub struct ControlGetIdResponder {
2431    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2432    tx_id: u32,
2433}
2434
2435/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
2436/// if the responder is dropped without sending a response, so that the client
2437/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2438impl std::ops::Drop for ControlGetIdResponder {
2439    fn drop(&mut self) {
2440        self.control_handle.shutdown();
2441        // Safety: drops once, never accessed again
2442        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2443    }
2444}
2445
2446impl fidl::endpoints::Responder for ControlGetIdResponder {
2447    type ControlHandle = ControlControlHandle;
2448
2449    fn control_handle(&self) -> &ControlControlHandle {
2450        &self.control_handle
2451    }
2452
2453    fn drop_without_shutdown(mut self) {
2454        // Safety: drops once, never accessed again due to mem::forget
2455        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2456        // Prevent Drop from running (which would shut down the channel)
2457        std::mem::forget(self);
2458    }
2459}
2460
2461impl ControlGetIdResponder {
2462    /// Sends a response to the FIDL transaction.
2463    ///
2464    /// Sets the channel to shutdown if an error occurs.
2465    pub fn send(self, mut id: u64) -> Result<(), fidl::Error> {
2466        let _result = self.send_raw(id);
2467        if _result.is_err() {
2468            self.control_handle.shutdown();
2469        }
2470        self.drop_without_shutdown();
2471        _result
2472    }
2473
2474    /// Similar to "send" but does not shutdown the channel if an error occurs.
2475    pub fn send_no_shutdown_on_err(self, mut id: u64) -> Result<(), fidl::Error> {
2476        let _result = self.send_raw(id);
2477        self.drop_without_shutdown();
2478        _result
2479    }
2480
2481    fn send_raw(&self, mut id: u64) -> Result<(), fidl::Error> {
2482        self.control_handle.inner.send::<ControlGetIdResponse>(
2483            (id,),
2484            self.tx_id,
2485            0x2a2459768d9ecc6f,
2486            fidl::encoding::DynamicFlags::empty(),
2487        )
2488    }
2489}
2490
2491#[must_use = "FIDL methods require a response to be sent"]
2492#[derive(Debug)]
2493pub struct ControlSetConfigurationResponder {
2494    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2495    tx_id: u32,
2496}
2497
2498/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
2499/// if the responder is dropped without sending a response, so that the client
2500/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2501impl std::ops::Drop for ControlSetConfigurationResponder {
2502    fn drop(&mut self) {
2503        self.control_handle.shutdown();
2504        // Safety: drops once, never accessed again
2505        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2506    }
2507}
2508
2509impl fidl::endpoints::Responder for ControlSetConfigurationResponder {
2510    type ControlHandle = ControlControlHandle;
2511
2512    fn control_handle(&self) -> &ControlControlHandle {
2513        &self.control_handle
2514    }
2515
2516    fn drop_without_shutdown(mut self) {
2517        // Safety: drops once, never accessed again due to mem::forget
2518        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2519        // Prevent Drop from running (which would shut down the channel)
2520        std::mem::forget(self);
2521    }
2522}
2523
2524impl ControlSetConfigurationResponder {
2525    /// Sends a response to the FIDL transaction.
2526    ///
2527    /// Sets the channel to shutdown if an error occurs.
2528    pub fn send(
2529        self,
2530        mut result: Result<&Configuration, ControlSetConfigurationError>,
2531    ) -> Result<(), fidl::Error> {
2532        let _result = self.send_raw(result);
2533        if _result.is_err() {
2534            self.control_handle.shutdown();
2535        }
2536        self.drop_without_shutdown();
2537        _result
2538    }
2539
2540    /// Similar to "send" but does not shutdown the channel if an error occurs.
2541    pub fn send_no_shutdown_on_err(
2542        self,
2543        mut result: Result<&Configuration, ControlSetConfigurationError>,
2544    ) -> Result<(), fidl::Error> {
2545        let _result = self.send_raw(result);
2546        self.drop_without_shutdown();
2547        _result
2548    }
2549
2550    fn send_raw(
2551        &self,
2552        mut result: Result<&Configuration, ControlSetConfigurationError>,
2553    ) -> Result<(), fidl::Error> {
2554        self.control_handle.inner.send::<fidl::encoding::ResultType<
2555            ControlSetConfigurationResponse,
2556            ControlSetConfigurationError,
2557        >>(
2558            result.map(|previous_config| (previous_config,)),
2559            self.tx_id,
2560            0x573923b7b4bde27f,
2561            fidl::encoding::DynamicFlags::empty(),
2562        )
2563    }
2564}
2565
2566#[must_use = "FIDL methods require a response to be sent"]
2567#[derive(Debug)]
2568pub struct ControlGetConfigurationResponder {
2569    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2570    tx_id: u32,
2571}
2572
2573/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
2574/// if the responder is dropped without sending a response, so that the client
2575/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2576impl std::ops::Drop for ControlGetConfigurationResponder {
2577    fn drop(&mut self) {
2578        self.control_handle.shutdown();
2579        // Safety: drops once, never accessed again
2580        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2581    }
2582}
2583
2584impl fidl::endpoints::Responder for ControlGetConfigurationResponder {
2585    type ControlHandle = ControlControlHandle;
2586
2587    fn control_handle(&self) -> &ControlControlHandle {
2588        &self.control_handle
2589    }
2590
2591    fn drop_without_shutdown(mut self) {
2592        // Safety: drops once, never accessed again due to mem::forget
2593        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2594        // Prevent Drop from running (which would shut down the channel)
2595        std::mem::forget(self);
2596    }
2597}
2598
2599impl ControlGetConfigurationResponder {
2600    /// Sends a response to the FIDL transaction.
2601    ///
2602    /// Sets the channel to shutdown if an error occurs.
2603    pub fn send(
2604        self,
2605        mut result: Result<&Configuration, ControlGetConfigurationError>,
2606    ) -> Result<(), fidl::Error> {
2607        let _result = self.send_raw(result);
2608        if _result.is_err() {
2609            self.control_handle.shutdown();
2610        }
2611        self.drop_without_shutdown();
2612        _result
2613    }
2614
2615    /// Similar to "send" but does not shutdown the channel if an error occurs.
2616    pub fn send_no_shutdown_on_err(
2617        self,
2618        mut result: Result<&Configuration, ControlGetConfigurationError>,
2619    ) -> Result<(), fidl::Error> {
2620        let _result = self.send_raw(result);
2621        self.drop_without_shutdown();
2622        _result
2623    }
2624
2625    fn send_raw(
2626        &self,
2627        mut result: Result<&Configuration, ControlGetConfigurationError>,
2628    ) -> Result<(), fidl::Error> {
2629        self.control_handle.inner.send::<fidl::encoding::ResultType<
2630            ControlGetConfigurationResponse,
2631            ControlGetConfigurationError,
2632        >>(
2633            result.map(|config| (config,)),
2634            self.tx_id,
2635            0x5f5d239820bdcc65,
2636            fidl::encoding::DynamicFlags::empty(),
2637        )
2638    }
2639}
2640
2641#[must_use = "FIDL methods require a response to be sent"]
2642#[derive(Debug)]
2643pub struct ControlEnableResponder {
2644    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2645    tx_id: u32,
2646}
2647
2648/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
2649/// if the responder is dropped without sending a response, so that the client
2650/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2651impl std::ops::Drop for ControlEnableResponder {
2652    fn drop(&mut self) {
2653        self.control_handle.shutdown();
2654        // Safety: drops once, never accessed again
2655        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2656    }
2657}
2658
2659impl fidl::endpoints::Responder for ControlEnableResponder {
2660    type ControlHandle = ControlControlHandle;
2661
2662    fn control_handle(&self) -> &ControlControlHandle {
2663        &self.control_handle
2664    }
2665
2666    fn drop_without_shutdown(mut self) {
2667        // Safety: drops once, never accessed again due to mem::forget
2668        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2669        // Prevent Drop from running (which would shut down the channel)
2670        std::mem::forget(self);
2671    }
2672}
2673
2674impl ControlEnableResponder {
2675    /// Sends a response to the FIDL transaction.
2676    ///
2677    /// Sets the channel to shutdown if an error occurs.
2678    pub fn send(self, mut result: Result<bool, ControlEnableError>) -> Result<(), fidl::Error> {
2679        let _result = self.send_raw(result);
2680        if _result.is_err() {
2681            self.control_handle.shutdown();
2682        }
2683        self.drop_without_shutdown();
2684        _result
2685    }
2686
2687    /// Similar to "send" but does not shutdown the channel if an error occurs.
2688    pub fn send_no_shutdown_on_err(
2689        self,
2690        mut result: Result<bool, ControlEnableError>,
2691    ) -> Result<(), fidl::Error> {
2692        let _result = self.send_raw(result);
2693        self.drop_without_shutdown();
2694        _result
2695    }
2696
2697    fn send_raw(&self, mut result: Result<bool, ControlEnableError>) -> Result<(), fidl::Error> {
2698        self.control_handle.inner.send::<fidl::encoding::ResultType<
2699            ControlEnableResponse,
2700            ControlEnableError,
2701        >>(
2702            result.map(|did_enable| (did_enable,)),
2703            self.tx_id,
2704            0x15c983d3a8ac0b98,
2705            fidl::encoding::DynamicFlags::empty(),
2706        )
2707    }
2708}
2709
2710#[must_use = "FIDL methods require a response to be sent"]
2711#[derive(Debug)]
2712pub struct ControlDisableResponder {
2713    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2714    tx_id: u32,
2715}
2716
2717/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
2718/// if the responder is dropped without sending a response, so that the client
2719/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2720impl std::ops::Drop for ControlDisableResponder {
2721    fn drop(&mut self) {
2722        self.control_handle.shutdown();
2723        // Safety: drops once, never accessed again
2724        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2725    }
2726}
2727
2728impl fidl::endpoints::Responder for ControlDisableResponder {
2729    type ControlHandle = ControlControlHandle;
2730
2731    fn control_handle(&self) -> &ControlControlHandle {
2732        &self.control_handle
2733    }
2734
2735    fn drop_without_shutdown(mut self) {
2736        // Safety: drops once, never accessed again due to mem::forget
2737        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2738        // Prevent Drop from running (which would shut down the channel)
2739        std::mem::forget(self);
2740    }
2741}
2742
2743impl ControlDisableResponder {
2744    /// Sends a response to the FIDL transaction.
2745    ///
2746    /// Sets the channel to shutdown if an error occurs.
2747    pub fn send(self, mut result: Result<bool, ControlDisableError>) -> Result<(), fidl::Error> {
2748        let _result = self.send_raw(result);
2749        if _result.is_err() {
2750            self.control_handle.shutdown();
2751        }
2752        self.drop_without_shutdown();
2753        _result
2754    }
2755
2756    /// Similar to "send" but does not shutdown the channel if an error occurs.
2757    pub fn send_no_shutdown_on_err(
2758        self,
2759        mut result: Result<bool, ControlDisableError>,
2760    ) -> Result<(), fidl::Error> {
2761        let _result = self.send_raw(result);
2762        self.drop_without_shutdown();
2763        _result
2764    }
2765
2766    fn send_raw(&self, mut result: Result<bool, ControlDisableError>) -> Result<(), fidl::Error> {
2767        self.control_handle.inner.send::<fidl::encoding::ResultType<
2768            ControlDisableResponse,
2769            ControlDisableError,
2770        >>(
2771            result.map(|did_disable| (did_disable,)),
2772            self.tx_id,
2773            0x98d3a585d905473,
2774            fidl::encoding::DynamicFlags::empty(),
2775        )
2776    }
2777}
2778
2779#[must_use = "FIDL methods require a response to be sent"]
2780#[derive(Debug)]
2781pub struct ControlGetAuthorizationForInterfaceResponder {
2782    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2783    tx_id: u32,
2784}
2785
2786/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
2787/// if the responder is dropped without sending a response, so that the client
2788/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2789impl std::ops::Drop for ControlGetAuthorizationForInterfaceResponder {
2790    fn drop(&mut self) {
2791        self.control_handle.shutdown();
2792        // Safety: drops once, never accessed again
2793        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2794    }
2795}
2796
2797impl fidl::endpoints::Responder for ControlGetAuthorizationForInterfaceResponder {
2798    type ControlHandle = ControlControlHandle;
2799
2800    fn control_handle(&self) -> &ControlControlHandle {
2801        &self.control_handle
2802    }
2803
2804    fn drop_without_shutdown(mut self) {
2805        // Safety: drops once, never accessed again due to mem::forget
2806        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2807        // Prevent Drop from running (which would shut down the channel)
2808        std::mem::forget(self);
2809    }
2810}
2811
2812impl ControlGetAuthorizationForInterfaceResponder {
2813    /// Sends a response to the FIDL transaction.
2814    ///
2815    /// Sets the channel to shutdown if an error occurs.
2816    pub fn send(self, mut credential: GrantForInterfaceAuthorization) -> Result<(), fidl::Error> {
2817        let _result = self.send_raw(credential);
2818        if _result.is_err() {
2819            self.control_handle.shutdown();
2820        }
2821        self.drop_without_shutdown();
2822        _result
2823    }
2824
2825    /// Similar to "send" but does not shutdown the channel if an error occurs.
2826    pub fn send_no_shutdown_on_err(
2827        self,
2828        mut credential: GrantForInterfaceAuthorization,
2829    ) -> Result<(), fidl::Error> {
2830        let _result = self.send_raw(credential);
2831        self.drop_without_shutdown();
2832        _result
2833    }
2834
2835    fn send_raw(&self, mut credential: GrantForInterfaceAuthorization) -> Result<(), fidl::Error> {
2836        self.control_handle.inner.send::<ControlGetAuthorizationForInterfaceResponse>(
2837            (&mut credential,),
2838            self.tx_id,
2839            0xc1de2ab60b5cb9e,
2840            fidl::encoding::DynamicFlags::empty(),
2841        )
2842    }
2843}
2844
2845#[must_use = "FIDL methods require a response to be sent"]
2846#[derive(Debug)]
2847pub struct ControlRemoveResponder {
2848    control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
2849    tx_id: u32,
2850}
2851
2852/// Set the the channel to be shutdown (see [`ControlControlHandle::shutdown`])
2853/// if the responder is dropped without sending a response, so that the client
2854/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2855impl std::ops::Drop for ControlRemoveResponder {
2856    fn drop(&mut self) {
2857        self.control_handle.shutdown();
2858        // Safety: drops once, never accessed again
2859        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2860    }
2861}
2862
2863impl fidl::endpoints::Responder for ControlRemoveResponder {
2864    type ControlHandle = ControlControlHandle;
2865
2866    fn control_handle(&self) -> &ControlControlHandle {
2867        &self.control_handle
2868    }
2869
2870    fn drop_without_shutdown(mut self) {
2871        // Safety: drops once, never accessed again due to mem::forget
2872        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2873        // Prevent Drop from running (which would shut down the channel)
2874        std::mem::forget(self);
2875    }
2876}
2877
2878impl ControlRemoveResponder {
2879    /// Sends a response to the FIDL transaction.
2880    ///
2881    /// Sets the channel to shutdown if an error occurs.
2882    pub fn send(self, mut result: Result<(), ControlRemoveError>) -> Result<(), fidl::Error> {
2883        let _result = self.send_raw(result);
2884        if _result.is_err() {
2885            self.control_handle.shutdown();
2886        }
2887        self.drop_without_shutdown();
2888        _result
2889    }
2890
2891    /// Similar to "send" but does not shutdown the channel if an error occurs.
2892    pub fn send_no_shutdown_on_err(
2893        self,
2894        mut result: Result<(), ControlRemoveError>,
2895    ) -> Result<(), fidl::Error> {
2896        let _result = self.send_raw(result);
2897        self.drop_without_shutdown();
2898        _result
2899    }
2900
2901    fn send_raw(&self, mut result: Result<(), ControlRemoveError>) -> Result<(), fidl::Error> {
2902        self.control_handle.inner.send::<fidl::encoding::ResultType<
2903            fidl::encoding::EmptyStruct,
2904            ControlRemoveError,
2905        >>(
2906            result,
2907            self.tx_id,
2908            0x13aab8bbecc7ff0b,
2909            fidl::encoding::DynamicFlags::empty(),
2910        )
2911    }
2912}
2913
2914#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2915pub struct DeviceControlMarker;
2916
2917impl fidl::endpoints::ProtocolMarker for DeviceControlMarker {
2918    type Proxy = DeviceControlProxy;
2919    type RequestStream = DeviceControlRequestStream;
2920    #[cfg(target_os = "fuchsia")]
2921    type SynchronousProxy = DeviceControlSynchronousProxy;
2922
2923    const DEBUG_NAME: &'static str = "(anonymous) DeviceControl";
2924}
2925
2926pub trait DeviceControlProxyInterface: Send + Sync {
2927    fn r#create_interface(
2928        &self,
2929        port: &fidl_fuchsia_hardware_network::PortId,
2930        control: fidl::endpoints::ServerEnd<ControlMarker>,
2931        options: Options,
2932    ) -> Result<(), fidl::Error>;
2933    fn r#detach(&self) -> Result<(), fidl::Error>;
2934}
2935#[derive(Debug)]
2936#[cfg(target_os = "fuchsia")]
2937pub struct DeviceControlSynchronousProxy {
2938    client: fidl::client::sync::Client,
2939}
2940
2941#[cfg(target_os = "fuchsia")]
2942impl fidl::endpoints::SynchronousProxy for DeviceControlSynchronousProxy {
2943    type Proxy = DeviceControlProxy;
2944    type Protocol = DeviceControlMarker;
2945
2946    fn from_channel(inner: fidl::Channel) -> Self {
2947        Self::new(inner)
2948    }
2949
2950    fn into_channel(self) -> fidl::Channel {
2951        self.client.into_channel()
2952    }
2953
2954    fn as_channel(&self) -> &fidl::Channel {
2955        self.client.as_channel()
2956    }
2957}
2958
2959#[cfg(target_os = "fuchsia")]
2960impl DeviceControlSynchronousProxy {
2961    pub fn new(channel: fidl::Channel) -> Self {
2962        let protocol_name = <DeviceControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2963        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2964    }
2965
2966    pub fn into_channel(self) -> fidl::Channel {
2967        self.client.into_channel()
2968    }
2969
2970    /// Waits until an event arrives and returns it. It is safe for other
2971    /// threads to make concurrent requests while waiting for an event.
2972    pub fn wait_for_event(
2973        &self,
2974        deadline: zx::MonotonicInstant,
2975    ) -> Result<DeviceControlEvent, fidl::Error> {
2976        DeviceControlEvent::decode(self.client.wait_for_event(deadline)?)
2977    }
2978
2979    /// Creates an interface on the network stack.
2980    ///
2981    /// + request `port` the device's port to instantiate as an interface.
2982    /// + request `control` grants access to the created interface.
2983    pub fn r#create_interface(
2984        &self,
2985        mut port: &fidl_fuchsia_hardware_network::PortId,
2986        mut control: fidl::endpoints::ServerEnd<ControlMarker>,
2987        mut options: Options,
2988    ) -> Result<(), fidl::Error> {
2989        self.client.send::<DeviceControlCreateInterfaceRequest>(
2990            (port, control, &mut options),
2991            0x4ff8be7351d12f86,
2992            fidl::encoding::DynamicFlags::empty(),
2993        )
2994    }
2995
2996    /// Detaches the client end from the device's lifetime.
2997    ///
2998    /// After calling `Detach`, closing this client end no longer causes the
2999    /// device or any of the interfaces created from it to be removed. Note that
3000    /// the lifetime of any created interface will continue to be coupled with
3001    /// the associated [`Control`] client end.
3002    pub fn r#detach(&self) -> Result<(), fidl::Error> {
3003        self.client.send::<fidl::encoding::EmptyPayload>(
3004            (),
3005            0x57489f1554d489d2,
3006            fidl::encoding::DynamicFlags::empty(),
3007        )
3008    }
3009}
3010
3011#[cfg(target_os = "fuchsia")]
3012impl From<DeviceControlSynchronousProxy> for zx::Handle {
3013    fn from(value: DeviceControlSynchronousProxy) -> Self {
3014        value.into_channel().into()
3015    }
3016}
3017
3018#[cfg(target_os = "fuchsia")]
3019impl From<fidl::Channel> for DeviceControlSynchronousProxy {
3020    fn from(value: fidl::Channel) -> Self {
3021        Self::new(value)
3022    }
3023}
3024
3025#[cfg(target_os = "fuchsia")]
3026impl fidl::endpoints::FromClient for DeviceControlSynchronousProxy {
3027    type Protocol = DeviceControlMarker;
3028
3029    fn from_client(value: fidl::endpoints::ClientEnd<DeviceControlMarker>) -> Self {
3030        Self::new(value.into_channel())
3031    }
3032}
3033
3034#[derive(Debug, Clone)]
3035pub struct DeviceControlProxy {
3036    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3037}
3038
3039impl fidl::endpoints::Proxy for DeviceControlProxy {
3040    type Protocol = DeviceControlMarker;
3041
3042    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3043        Self::new(inner)
3044    }
3045
3046    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3047        self.client.into_channel().map_err(|client| Self { client })
3048    }
3049
3050    fn as_channel(&self) -> &::fidl::AsyncChannel {
3051        self.client.as_channel()
3052    }
3053}
3054
3055impl DeviceControlProxy {
3056    /// Create a new Proxy for fuchsia.net.interfaces.admin/DeviceControl.
3057    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3058        let protocol_name = <DeviceControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3059        Self { client: fidl::client::Client::new(channel, protocol_name) }
3060    }
3061
3062    /// Get a Stream of events from the remote end of the protocol.
3063    ///
3064    /// # Panics
3065    ///
3066    /// Panics if the event stream was already taken.
3067    pub fn take_event_stream(&self) -> DeviceControlEventStream {
3068        DeviceControlEventStream { event_receiver: self.client.take_event_receiver() }
3069    }
3070
3071    /// Creates an interface on the network stack.
3072    ///
3073    /// + request `port` the device's port to instantiate as an interface.
3074    /// + request `control` grants access to the created interface.
3075    pub fn r#create_interface(
3076        &self,
3077        mut port: &fidl_fuchsia_hardware_network::PortId,
3078        mut control: fidl::endpoints::ServerEnd<ControlMarker>,
3079        mut options: Options,
3080    ) -> Result<(), fidl::Error> {
3081        DeviceControlProxyInterface::r#create_interface(self, port, control, options)
3082    }
3083
3084    /// Detaches the client end from the device's lifetime.
3085    ///
3086    /// After calling `Detach`, closing this client end no longer causes the
3087    /// device or any of the interfaces created from it to be removed. Note that
3088    /// the lifetime of any created interface will continue to be coupled with
3089    /// the associated [`Control`] client end.
3090    pub fn r#detach(&self) -> Result<(), fidl::Error> {
3091        DeviceControlProxyInterface::r#detach(self)
3092    }
3093}
3094
3095impl DeviceControlProxyInterface for DeviceControlProxy {
3096    fn r#create_interface(
3097        &self,
3098        mut port: &fidl_fuchsia_hardware_network::PortId,
3099        mut control: fidl::endpoints::ServerEnd<ControlMarker>,
3100        mut options: Options,
3101    ) -> Result<(), fidl::Error> {
3102        self.client.send::<DeviceControlCreateInterfaceRequest>(
3103            (port, control, &mut options),
3104            0x4ff8be7351d12f86,
3105            fidl::encoding::DynamicFlags::empty(),
3106        )
3107    }
3108
3109    fn r#detach(&self) -> Result<(), fidl::Error> {
3110        self.client.send::<fidl::encoding::EmptyPayload>(
3111            (),
3112            0x57489f1554d489d2,
3113            fidl::encoding::DynamicFlags::empty(),
3114        )
3115    }
3116}
3117
3118pub struct DeviceControlEventStream {
3119    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3120}
3121
3122impl std::marker::Unpin for DeviceControlEventStream {}
3123
3124impl futures::stream::FusedStream for DeviceControlEventStream {
3125    fn is_terminated(&self) -> bool {
3126        self.event_receiver.is_terminated()
3127    }
3128}
3129
3130impl futures::Stream for DeviceControlEventStream {
3131    type Item = Result<DeviceControlEvent, fidl::Error>;
3132
3133    fn poll_next(
3134        mut self: std::pin::Pin<&mut Self>,
3135        cx: &mut std::task::Context<'_>,
3136    ) -> std::task::Poll<Option<Self::Item>> {
3137        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3138            &mut self.event_receiver,
3139            cx
3140        )?) {
3141            Some(buf) => std::task::Poll::Ready(Some(DeviceControlEvent::decode(buf))),
3142            None => std::task::Poll::Ready(None),
3143        }
3144    }
3145}
3146
3147#[derive(Debug)]
3148pub enum DeviceControlEvent {}
3149
3150impl DeviceControlEvent {
3151    /// Decodes a message buffer as a [`DeviceControlEvent`].
3152    fn decode(
3153        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3154    ) -> Result<DeviceControlEvent, fidl::Error> {
3155        let (bytes, _handles) = buf.split_mut();
3156        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3157        debug_assert_eq!(tx_header.tx_id, 0);
3158        match tx_header.ordinal {
3159            _ => Err(fidl::Error::UnknownOrdinal {
3160                ordinal: tx_header.ordinal,
3161                protocol_name: <DeviceControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3162            }),
3163        }
3164    }
3165}
3166
3167/// A Stream of incoming requests for fuchsia.net.interfaces.admin/DeviceControl.
3168pub struct DeviceControlRequestStream {
3169    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3170    is_terminated: bool,
3171}
3172
3173impl std::marker::Unpin for DeviceControlRequestStream {}
3174
3175impl futures::stream::FusedStream for DeviceControlRequestStream {
3176    fn is_terminated(&self) -> bool {
3177        self.is_terminated
3178    }
3179}
3180
3181impl fidl::endpoints::RequestStream for DeviceControlRequestStream {
3182    type Protocol = DeviceControlMarker;
3183    type ControlHandle = DeviceControlControlHandle;
3184
3185    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3186        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3187    }
3188
3189    fn control_handle(&self) -> Self::ControlHandle {
3190        DeviceControlControlHandle { inner: self.inner.clone() }
3191    }
3192
3193    fn into_inner(
3194        self,
3195    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3196    {
3197        (self.inner, self.is_terminated)
3198    }
3199
3200    fn from_inner(
3201        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3202        is_terminated: bool,
3203    ) -> Self {
3204        Self { inner, is_terminated }
3205    }
3206}
3207
3208impl futures::Stream for DeviceControlRequestStream {
3209    type Item = Result<DeviceControlRequest, fidl::Error>;
3210
3211    fn poll_next(
3212        mut self: std::pin::Pin<&mut Self>,
3213        cx: &mut std::task::Context<'_>,
3214    ) -> std::task::Poll<Option<Self::Item>> {
3215        let this = &mut *self;
3216        if this.inner.check_shutdown(cx) {
3217            this.is_terminated = true;
3218            return std::task::Poll::Ready(None);
3219        }
3220        if this.is_terminated {
3221            panic!("polled DeviceControlRequestStream after completion");
3222        }
3223        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3224            |bytes, handles| {
3225                match this.inner.channel().read_etc(cx, bytes, handles) {
3226                    std::task::Poll::Ready(Ok(())) => {}
3227                    std::task::Poll::Pending => return std::task::Poll::Pending,
3228                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3229                        this.is_terminated = true;
3230                        return std::task::Poll::Ready(None);
3231                    }
3232                    std::task::Poll::Ready(Err(e)) => {
3233                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3234                            e.into(),
3235                        ))))
3236                    }
3237                }
3238
3239                // A message has been received from the channel
3240                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3241
3242                std::task::Poll::Ready(Some(match header.ordinal {
3243                    0x4ff8be7351d12f86 => {
3244                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3245                        let mut req = fidl::new_empty!(
3246                            DeviceControlCreateInterfaceRequest,
3247                            fidl::encoding::DefaultFuchsiaResourceDialect
3248                        );
3249                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeviceControlCreateInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
3250                        let control_handle =
3251                            DeviceControlControlHandle { inner: this.inner.clone() };
3252                        Ok(DeviceControlRequest::CreateInterface {
3253                            port: req.port,
3254                            control: req.control,
3255                            options: req.options,
3256
3257                            control_handle,
3258                        })
3259                    }
3260                    0x57489f1554d489d2 => {
3261                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3262                        let mut req = fidl::new_empty!(
3263                            fidl::encoding::EmptyPayload,
3264                            fidl::encoding::DefaultFuchsiaResourceDialect
3265                        );
3266                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
3267                        let control_handle =
3268                            DeviceControlControlHandle { inner: this.inner.clone() };
3269                        Ok(DeviceControlRequest::Detach { control_handle })
3270                    }
3271                    _ => Err(fidl::Error::UnknownOrdinal {
3272                        ordinal: header.ordinal,
3273                        protocol_name:
3274                            <DeviceControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3275                    }),
3276                }))
3277            },
3278        )
3279    }
3280}
3281
3282/// Administrative control over an installed device on the network stack.
3283///
3284/// An instance of `DeviceControl` maps to an instance of
3285/// [`fuchsia.hardware.network/Session`]. All interfaces generated from a single
3286/// `DeviceControl` instance share the same `Session` and set of device buffers;
3287/// and are therefore subject to backpressure over the same pool of resources.
3288///
3289/// By the same measure, creating multiple `DeviceControl` instances attached to
3290/// the same underlying device causes data copies, because each `DeviceControl`
3291/// starts a new `Session`. For that reason, users should avoid creating
3292/// multiple `DeviceControl` instances for the same device and prefer
3293/// instantiating ports into interfaces from a single `DeviceControl` instance
3294/// per device.
3295///
3296/// This protocol encodes the underlying device's lifetime in both
3297/// directions; the device exists iff both ends of the protocol are open.
3298/// That is:
3299///
3300/// - Closing the client end causes the device to be removed, including all
3301///   interfaces created from it.
3302/// - Observing a closure of the server end indicates the device (and all
3303///   interfaces created from it) no longer exists.
3304#[derive(Debug)]
3305pub enum DeviceControlRequest {
3306    /// Creates an interface on the network stack.
3307    ///
3308    /// + request `port` the device's port to instantiate as an interface.
3309    /// + request `control` grants access to the created interface.
3310    CreateInterface {
3311        port: fidl_fuchsia_hardware_network::PortId,
3312        control: fidl::endpoints::ServerEnd<ControlMarker>,
3313        options: Options,
3314        control_handle: DeviceControlControlHandle,
3315    },
3316    /// Detaches the client end from the device's lifetime.
3317    ///
3318    /// After calling `Detach`, closing this client end no longer causes the
3319    /// device or any of the interfaces created from it to be removed. Note that
3320    /// the lifetime of any created interface will continue to be coupled with
3321    /// the associated [`Control`] client end.
3322    Detach { control_handle: DeviceControlControlHandle },
3323}
3324
3325impl DeviceControlRequest {
3326    #[allow(irrefutable_let_patterns)]
3327    pub fn into_create_interface(
3328        self,
3329    ) -> Option<(
3330        fidl_fuchsia_hardware_network::PortId,
3331        fidl::endpoints::ServerEnd<ControlMarker>,
3332        Options,
3333        DeviceControlControlHandle,
3334    )> {
3335        if let DeviceControlRequest::CreateInterface { port, control, options, control_handle } =
3336            self
3337        {
3338            Some((port, control, options, control_handle))
3339        } else {
3340            None
3341        }
3342    }
3343
3344    #[allow(irrefutable_let_patterns)]
3345    pub fn into_detach(self) -> Option<(DeviceControlControlHandle)> {
3346        if let DeviceControlRequest::Detach { control_handle } = self {
3347            Some((control_handle))
3348        } else {
3349            None
3350        }
3351    }
3352
3353    /// Name of the method defined in FIDL
3354    pub fn method_name(&self) -> &'static str {
3355        match *self {
3356            DeviceControlRequest::CreateInterface { .. } => "create_interface",
3357            DeviceControlRequest::Detach { .. } => "detach",
3358        }
3359    }
3360}
3361
3362#[derive(Debug, Clone)]
3363pub struct DeviceControlControlHandle {
3364    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3365}
3366
3367impl fidl::endpoints::ControlHandle for DeviceControlControlHandle {
3368    fn shutdown(&self) {
3369        self.inner.shutdown()
3370    }
3371    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3372        self.inner.shutdown_with_epitaph(status)
3373    }
3374
3375    fn is_closed(&self) -> bool {
3376        self.inner.channel().is_closed()
3377    }
3378    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3379        self.inner.channel().on_closed()
3380    }
3381
3382    #[cfg(target_os = "fuchsia")]
3383    fn signal_peer(
3384        &self,
3385        clear_mask: zx::Signals,
3386        set_mask: zx::Signals,
3387    ) -> Result<(), zx_status::Status> {
3388        use fidl::Peered;
3389        self.inner.channel().signal_peer(clear_mask, set_mask)
3390    }
3391}
3392
3393impl DeviceControlControlHandle {}
3394
3395#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
3396pub struct InstallerMarker;
3397
3398impl fidl::endpoints::ProtocolMarker for InstallerMarker {
3399    type Proxy = InstallerProxy;
3400    type RequestStream = InstallerRequestStream;
3401    #[cfg(target_os = "fuchsia")]
3402    type SynchronousProxy = InstallerSynchronousProxy;
3403
3404    const DEBUG_NAME: &'static str = "fuchsia.net.interfaces.admin.Installer";
3405}
3406impl fidl::endpoints::DiscoverableProtocolMarker for InstallerMarker {}
3407
3408pub trait InstallerProxyInterface: Send + Sync {
3409    fn r#install_device(
3410        &self,
3411        device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
3412        device_control: fidl::endpoints::ServerEnd<DeviceControlMarker>,
3413    ) -> Result<(), fidl::Error>;
3414    fn r#install_blackhole_interface(
3415        &self,
3416        interface: fidl::endpoints::ServerEnd<ControlMarker>,
3417        options: Options,
3418    ) -> Result<(), fidl::Error>;
3419}
3420#[derive(Debug)]
3421#[cfg(target_os = "fuchsia")]
3422pub struct InstallerSynchronousProxy {
3423    client: fidl::client::sync::Client,
3424}
3425
3426#[cfg(target_os = "fuchsia")]
3427impl fidl::endpoints::SynchronousProxy for InstallerSynchronousProxy {
3428    type Proxy = InstallerProxy;
3429    type Protocol = InstallerMarker;
3430
3431    fn from_channel(inner: fidl::Channel) -> Self {
3432        Self::new(inner)
3433    }
3434
3435    fn into_channel(self) -> fidl::Channel {
3436        self.client.into_channel()
3437    }
3438
3439    fn as_channel(&self) -> &fidl::Channel {
3440        self.client.as_channel()
3441    }
3442}
3443
3444#[cfg(target_os = "fuchsia")]
3445impl InstallerSynchronousProxy {
3446    pub fn new(channel: fidl::Channel) -> Self {
3447        let protocol_name = <InstallerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3448        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
3449    }
3450
3451    pub fn into_channel(self) -> fidl::Channel {
3452        self.client.into_channel()
3453    }
3454
3455    /// Waits until an event arrives and returns it. It is safe for other
3456    /// threads to make concurrent requests while waiting for an event.
3457    pub fn wait_for_event(
3458        &self,
3459        deadline: zx::MonotonicInstant,
3460    ) -> Result<InstallerEvent, fidl::Error> {
3461        InstallerEvent::decode(self.client.wait_for_event(deadline)?)
3462    }
3463
3464    /// Installs a device on the network stack.
3465    ///
3466    /// + request `device` the device to install on the network stack.
3467    /// + request `device_control` grants access to the installed device.
3468    pub fn r#install_device(
3469        &self,
3470        mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
3471        mut device_control: fidl::endpoints::ServerEnd<DeviceControlMarker>,
3472    ) -> Result<(), fidl::Error> {
3473        self.client.send::<InstallerInstallDeviceRequest>(
3474            (device, device_control),
3475            0x3e84524dcecab23a,
3476            fidl::encoding::DynamicFlags::empty(),
3477        )
3478    }
3479
3480    /// Installs a blackhole interface on the network stack.
3481    ///
3482    /// A "blackhole" interface is an interface that drops any outbound traffic
3483    /// transmitted through it, and never receives any inbound traffic.
3484    ///
3485    /// + request `interface` grants access to the installed interface.
3486    pub fn r#install_blackhole_interface(
3487        &self,
3488        mut interface: fidl::endpoints::ServerEnd<ControlMarker>,
3489        mut options: Options,
3490    ) -> Result<(), fidl::Error> {
3491        self.client.send::<InstallerInstallBlackholeInterfaceRequest>(
3492            (interface, &mut options),
3493            0x2ce57e87cdbcb809,
3494            fidl::encoding::DynamicFlags::empty(),
3495        )
3496    }
3497}
3498
3499#[cfg(target_os = "fuchsia")]
3500impl From<InstallerSynchronousProxy> for zx::Handle {
3501    fn from(value: InstallerSynchronousProxy) -> Self {
3502        value.into_channel().into()
3503    }
3504}
3505
3506#[cfg(target_os = "fuchsia")]
3507impl From<fidl::Channel> for InstallerSynchronousProxy {
3508    fn from(value: fidl::Channel) -> Self {
3509        Self::new(value)
3510    }
3511}
3512
3513#[cfg(target_os = "fuchsia")]
3514impl fidl::endpoints::FromClient for InstallerSynchronousProxy {
3515    type Protocol = InstallerMarker;
3516
3517    fn from_client(value: fidl::endpoints::ClientEnd<InstallerMarker>) -> Self {
3518        Self::new(value.into_channel())
3519    }
3520}
3521
3522#[derive(Debug, Clone)]
3523pub struct InstallerProxy {
3524    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
3525}
3526
3527impl fidl::endpoints::Proxy for InstallerProxy {
3528    type Protocol = InstallerMarker;
3529
3530    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
3531        Self::new(inner)
3532    }
3533
3534    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
3535        self.client.into_channel().map_err(|client| Self { client })
3536    }
3537
3538    fn as_channel(&self) -> &::fidl::AsyncChannel {
3539        self.client.as_channel()
3540    }
3541}
3542
3543impl InstallerProxy {
3544    /// Create a new Proxy for fuchsia.net.interfaces.admin/Installer.
3545    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
3546        let protocol_name = <InstallerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
3547        Self { client: fidl::client::Client::new(channel, protocol_name) }
3548    }
3549
3550    /// Get a Stream of events from the remote end of the protocol.
3551    ///
3552    /// # Panics
3553    ///
3554    /// Panics if the event stream was already taken.
3555    pub fn take_event_stream(&self) -> InstallerEventStream {
3556        InstallerEventStream { event_receiver: self.client.take_event_receiver() }
3557    }
3558
3559    /// Installs a device on the network stack.
3560    ///
3561    /// + request `device` the device to install on the network stack.
3562    /// + request `device_control` grants access to the installed device.
3563    pub fn r#install_device(
3564        &self,
3565        mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
3566        mut device_control: fidl::endpoints::ServerEnd<DeviceControlMarker>,
3567    ) -> Result<(), fidl::Error> {
3568        InstallerProxyInterface::r#install_device(self, device, device_control)
3569    }
3570
3571    /// Installs a blackhole interface on the network stack.
3572    ///
3573    /// A "blackhole" interface is an interface that drops any outbound traffic
3574    /// transmitted through it, and never receives any inbound traffic.
3575    ///
3576    /// + request `interface` grants access to the installed interface.
3577    pub fn r#install_blackhole_interface(
3578        &self,
3579        mut interface: fidl::endpoints::ServerEnd<ControlMarker>,
3580        mut options: Options,
3581    ) -> Result<(), fidl::Error> {
3582        InstallerProxyInterface::r#install_blackhole_interface(self, interface, options)
3583    }
3584}
3585
3586impl InstallerProxyInterface for InstallerProxy {
3587    fn r#install_device(
3588        &self,
3589        mut device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
3590        mut device_control: fidl::endpoints::ServerEnd<DeviceControlMarker>,
3591    ) -> Result<(), fidl::Error> {
3592        self.client.send::<InstallerInstallDeviceRequest>(
3593            (device, device_control),
3594            0x3e84524dcecab23a,
3595            fidl::encoding::DynamicFlags::empty(),
3596        )
3597    }
3598
3599    fn r#install_blackhole_interface(
3600        &self,
3601        mut interface: fidl::endpoints::ServerEnd<ControlMarker>,
3602        mut options: Options,
3603    ) -> Result<(), fidl::Error> {
3604        self.client.send::<InstallerInstallBlackholeInterfaceRequest>(
3605            (interface, &mut options),
3606            0x2ce57e87cdbcb809,
3607            fidl::encoding::DynamicFlags::empty(),
3608        )
3609    }
3610}
3611
3612pub struct InstallerEventStream {
3613    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
3614}
3615
3616impl std::marker::Unpin for InstallerEventStream {}
3617
3618impl futures::stream::FusedStream for InstallerEventStream {
3619    fn is_terminated(&self) -> bool {
3620        self.event_receiver.is_terminated()
3621    }
3622}
3623
3624impl futures::Stream for InstallerEventStream {
3625    type Item = Result<InstallerEvent, fidl::Error>;
3626
3627    fn poll_next(
3628        mut self: std::pin::Pin<&mut Self>,
3629        cx: &mut std::task::Context<'_>,
3630    ) -> std::task::Poll<Option<Self::Item>> {
3631        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
3632            &mut self.event_receiver,
3633            cx
3634        )?) {
3635            Some(buf) => std::task::Poll::Ready(Some(InstallerEvent::decode(buf))),
3636            None => std::task::Poll::Ready(None),
3637        }
3638    }
3639}
3640
3641#[derive(Debug)]
3642pub enum InstallerEvent {}
3643
3644impl InstallerEvent {
3645    /// Decodes a message buffer as a [`InstallerEvent`].
3646    fn decode(
3647        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
3648    ) -> Result<InstallerEvent, fidl::Error> {
3649        let (bytes, _handles) = buf.split_mut();
3650        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3651        debug_assert_eq!(tx_header.tx_id, 0);
3652        match tx_header.ordinal {
3653            _ => Err(fidl::Error::UnknownOrdinal {
3654                ordinal: tx_header.ordinal,
3655                protocol_name: <InstallerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3656            }),
3657        }
3658    }
3659}
3660
3661/// A Stream of incoming requests for fuchsia.net.interfaces.admin/Installer.
3662pub struct InstallerRequestStream {
3663    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3664    is_terminated: bool,
3665}
3666
3667impl std::marker::Unpin for InstallerRequestStream {}
3668
3669impl futures::stream::FusedStream for InstallerRequestStream {
3670    fn is_terminated(&self) -> bool {
3671        self.is_terminated
3672    }
3673}
3674
3675impl fidl::endpoints::RequestStream for InstallerRequestStream {
3676    type Protocol = InstallerMarker;
3677    type ControlHandle = InstallerControlHandle;
3678
3679    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
3680        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
3681    }
3682
3683    fn control_handle(&self) -> Self::ControlHandle {
3684        InstallerControlHandle { inner: self.inner.clone() }
3685    }
3686
3687    fn into_inner(
3688        self,
3689    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
3690    {
3691        (self.inner, self.is_terminated)
3692    }
3693
3694    fn from_inner(
3695        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3696        is_terminated: bool,
3697    ) -> Self {
3698        Self { inner, is_terminated }
3699    }
3700}
3701
3702impl futures::Stream for InstallerRequestStream {
3703    type Item = Result<InstallerRequest, fidl::Error>;
3704
3705    fn poll_next(
3706        mut self: std::pin::Pin<&mut Self>,
3707        cx: &mut std::task::Context<'_>,
3708    ) -> std::task::Poll<Option<Self::Item>> {
3709        let this = &mut *self;
3710        if this.inner.check_shutdown(cx) {
3711            this.is_terminated = true;
3712            return std::task::Poll::Ready(None);
3713        }
3714        if this.is_terminated {
3715            panic!("polled InstallerRequestStream after completion");
3716        }
3717        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
3718            |bytes, handles| {
3719                match this.inner.channel().read_etc(cx, bytes, handles) {
3720                    std::task::Poll::Ready(Ok(())) => {}
3721                    std::task::Poll::Pending => return std::task::Poll::Pending,
3722                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
3723                        this.is_terminated = true;
3724                        return std::task::Poll::Ready(None);
3725                    }
3726                    std::task::Poll::Ready(Err(e)) => {
3727                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
3728                            e.into(),
3729                        ))))
3730                    }
3731                }
3732
3733                // A message has been received from the channel
3734                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
3735
3736                std::task::Poll::Ready(Some(match header.ordinal {
3737                    0x3e84524dcecab23a => {
3738                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3739                        let mut req = fidl::new_empty!(
3740                            InstallerInstallDeviceRequest,
3741                            fidl::encoding::DefaultFuchsiaResourceDialect
3742                        );
3743                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InstallerInstallDeviceRequest>(&header, _body_bytes, handles, &mut req)?;
3744                        let control_handle = InstallerControlHandle { inner: this.inner.clone() };
3745                        Ok(InstallerRequest::InstallDevice {
3746                            device: req.device,
3747                            device_control: req.device_control,
3748
3749                            control_handle,
3750                        })
3751                    }
3752                    0x2ce57e87cdbcb809 => {
3753                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
3754                        let mut req = fidl::new_empty!(
3755                            InstallerInstallBlackholeInterfaceRequest,
3756                            fidl::encoding::DefaultFuchsiaResourceDialect
3757                        );
3758                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<InstallerInstallBlackholeInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
3759                        let control_handle = InstallerControlHandle { inner: this.inner.clone() };
3760                        Ok(InstallerRequest::InstallBlackholeInterface {
3761                            interface: req.interface,
3762                            options: req.options,
3763
3764                            control_handle,
3765                        })
3766                    }
3767                    _ => Err(fidl::Error::UnknownOrdinal {
3768                        ordinal: header.ordinal,
3769                        protocol_name:
3770                            <InstallerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
3771                    }),
3772                }))
3773            },
3774        )
3775    }
3776}
3777
3778/// Installs devices on the network stack.
3779#[derive(Debug)]
3780pub enum InstallerRequest {
3781    /// Installs a device on the network stack.
3782    ///
3783    /// + request `device` the device to install on the network stack.
3784    /// + request `device_control` grants access to the installed device.
3785    InstallDevice {
3786        device: fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
3787        device_control: fidl::endpoints::ServerEnd<DeviceControlMarker>,
3788        control_handle: InstallerControlHandle,
3789    },
3790    /// Installs a blackhole interface on the network stack.
3791    ///
3792    /// A "blackhole" interface is an interface that drops any outbound traffic
3793    /// transmitted through it, and never receives any inbound traffic.
3794    ///
3795    /// + request `interface` grants access to the installed interface.
3796    InstallBlackholeInterface {
3797        interface: fidl::endpoints::ServerEnd<ControlMarker>,
3798        options: Options,
3799        control_handle: InstallerControlHandle,
3800    },
3801}
3802
3803impl InstallerRequest {
3804    #[allow(irrefutable_let_patterns)]
3805    pub fn into_install_device(
3806        self,
3807    ) -> Option<(
3808        fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
3809        fidl::endpoints::ServerEnd<DeviceControlMarker>,
3810        InstallerControlHandle,
3811    )> {
3812        if let InstallerRequest::InstallDevice { device, device_control, control_handle } = self {
3813            Some((device, device_control, control_handle))
3814        } else {
3815            None
3816        }
3817    }
3818
3819    #[allow(irrefutable_let_patterns)]
3820    pub fn into_install_blackhole_interface(
3821        self,
3822    ) -> Option<(fidl::endpoints::ServerEnd<ControlMarker>, Options, InstallerControlHandle)> {
3823        if let InstallerRequest::InstallBlackholeInterface { interface, options, control_handle } =
3824            self
3825        {
3826            Some((interface, options, control_handle))
3827        } else {
3828            None
3829        }
3830    }
3831
3832    /// Name of the method defined in FIDL
3833    pub fn method_name(&self) -> &'static str {
3834        match *self {
3835            InstallerRequest::InstallDevice { .. } => "install_device",
3836            InstallerRequest::InstallBlackholeInterface { .. } => "install_blackhole_interface",
3837        }
3838    }
3839}
3840
3841#[derive(Debug, Clone)]
3842pub struct InstallerControlHandle {
3843    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
3844}
3845
3846impl fidl::endpoints::ControlHandle for InstallerControlHandle {
3847    fn shutdown(&self) {
3848        self.inner.shutdown()
3849    }
3850    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
3851        self.inner.shutdown_with_epitaph(status)
3852    }
3853
3854    fn is_closed(&self) -> bool {
3855        self.inner.channel().is_closed()
3856    }
3857    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
3858        self.inner.channel().on_closed()
3859    }
3860
3861    #[cfg(target_os = "fuchsia")]
3862    fn signal_peer(
3863        &self,
3864        clear_mask: zx::Signals,
3865        set_mask: zx::Signals,
3866    ) -> Result<(), zx_status::Status> {
3867        use fidl::Peered;
3868        self.inner.channel().signal_peer(clear_mask, set_mask)
3869    }
3870}
3871
3872impl InstallerControlHandle {}
3873
3874mod internal {
3875    use super::*;
3876
3877    impl fidl::encoding::ResourceTypeMarker for ControlAddAddressRequest {
3878        type Borrowed<'a> = &'a mut Self;
3879        fn take_or_borrow<'a>(
3880            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3881        ) -> Self::Borrowed<'a> {
3882            value
3883        }
3884    }
3885
3886    unsafe impl fidl::encoding::TypeMarker for ControlAddAddressRequest {
3887        type Owned = Self;
3888
3889        #[inline(always)]
3890        fn inline_align(_context: fidl::encoding::Context) -> usize {
3891            8
3892        }
3893
3894        #[inline(always)]
3895        fn inline_size(_context: fidl::encoding::Context) -> usize {
3896            48
3897        }
3898    }
3899
3900    unsafe impl
3901        fidl::encoding::Encode<
3902            ControlAddAddressRequest,
3903            fidl::encoding::DefaultFuchsiaResourceDialect,
3904        > for &mut ControlAddAddressRequest
3905    {
3906        #[inline]
3907        unsafe fn encode(
3908            self,
3909            encoder: &mut fidl::encoding::Encoder<
3910                '_,
3911                fidl::encoding::DefaultFuchsiaResourceDialect,
3912            >,
3913            offset: usize,
3914            _depth: fidl::encoding::Depth,
3915        ) -> fidl::Result<()> {
3916            encoder.debug_check_bounds::<ControlAddAddressRequest>(offset);
3917            // Delegate to tuple encoding.
3918            fidl::encoding::Encode::<
3919                ControlAddAddressRequest,
3920                fidl::encoding::DefaultFuchsiaResourceDialect,
3921            >::encode(
3922                (
3923                    <fidl_fuchsia_net::Subnet as fidl::encoding::ValueTypeMarker>::borrow(
3924                        &self.address,
3925                    ),
3926                    <AddressParameters as fidl::encoding::ValueTypeMarker>::borrow(
3927                        &self.parameters,
3928                    ),
3929                    <fidl::encoding::Endpoint<
3930                        fidl::endpoints::ServerEnd<AddressStateProviderMarker>,
3931                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
3932                        &mut self.address_state_provider,
3933                    ),
3934                ),
3935                encoder,
3936                offset,
3937                _depth,
3938            )
3939        }
3940    }
3941    unsafe impl<
3942            T0: fidl::encoding::Encode<
3943                fidl_fuchsia_net::Subnet,
3944                fidl::encoding::DefaultFuchsiaResourceDialect,
3945            >,
3946            T1: fidl::encoding::Encode<
3947                AddressParameters,
3948                fidl::encoding::DefaultFuchsiaResourceDialect,
3949            >,
3950            T2: fidl::encoding::Encode<
3951                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AddressStateProviderMarker>>,
3952                fidl::encoding::DefaultFuchsiaResourceDialect,
3953            >,
3954        >
3955        fidl::encoding::Encode<
3956            ControlAddAddressRequest,
3957            fidl::encoding::DefaultFuchsiaResourceDialect,
3958        > for (T0, T1, T2)
3959    {
3960        #[inline]
3961        unsafe fn encode(
3962            self,
3963            encoder: &mut fidl::encoding::Encoder<
3964                '_,
3965                fidl::encoding::DefaultFuchsiaResourceDialect,
3966            >,
3967            offset: usize,
3968            depth: fidl::encoding::Depth,
3969        ) -> fidl::Result<()> {
3970            encoder.debug_check_bounds::<ControlAddAddressRequest>(offset);
3971            // Zero out padding regions. There's no need to apply masks
3972            // because the unmasked parts will be overwritten by fields.
3973            unsafe {
3974                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
3975                (ptr as *mut u64).write_unaligned(0);
3976            }
3977            // Write the fields.
3978            self.0.encode(encoder, offset + 0, depth)?;
3979            self.1.encode(encoder, offset + 24, depth)?;
3980            self.2.encode(encoder, offset + 40, depth)?;
3981            Ok(())
3982        }
3983    }
3984
3985    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3986        for ControlAddAddressRequest
3987    {
3988        #[inline(always)]
3989        fn new_empty() -> Self {
3990            Self {
3991                address: fidl::new_empty!(
3992                    fidl_fuchsia_net::Subnet,
3993                    fidl::encoding::DefaultFuchsiaResourceDialect
3994                ),
3995                parameters: fidl::new_empty!(
3996                    AddressParameters,
3997                    fidl::encoding::DefaultFuchsiaResourceDialect
3998                ),
3999                address_state_provider: fidl::new_empty!(
4000                    fidl::encoding::Endpoint<
4001                        fidl::endpoints::ServerEnd<AddressStateProviderMarker>,
4002                    >,
4003                    fidl::encoding::DefaultFuchsiaResourceDialect
4004                ),
4005            }
4006        }
4007
4008        #[inline]
4009        unsafe fn decode(
4010            &mut self,
4011            decoder: &mut fidl::encoding::Decoder<
4012                '_,
4013                fidl::encoding::DefaultFuchsiaResourceDialect,
4014            >,
4015            offset: usize,
4016            _depth: fidl::encoding::Depth,
4017        ) -> fidl::Result<()> {
4018            decoder.debug_check_bounds::<Self>(offset);
4019            // Verify that padding bytes are zero.
4020            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
4021            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4022            let mask = 0xffffffff00000000u64;
4023            let maskedval = padval & mask;
4024            if maskedval != 0 {
4025                return Err(fidl::Error::NonZeroPadding {
4026                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
4027                });
4028            }
4029            fidl::decode!(
4030                fidl_fuchsia_net::Subnet,
4031                fidl::encoding::DefaultFuchsiaResourceDialect,
4032                &mut self.address,
4033                decoder,
4034                offset + 0,
4035                _depth
4036            )?;
4037            fidl::decode!(
4038                AddressParameters,
4039                fidl::encoding::DefaultFuchsiaResourceDialect,
4040                &mut self.parameters,
4041                decoder,
4042                offset + 24,
4043                _depth
4044            )?;
4045            fidl::decode!(
4046                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<AddressStateProviderMarker>>,
4047                fidl::encoding::DefaultFuchsiaResourceDialect,
4048                &mut self.address_state_provider,
4049                decoder,
4050                offset + 40,
4051                _depth
4052            )?;
4053            Ok(())
4054        }
4055    }
4056
4057    impl fidl::encoding::ResourceTypeMarker for ControlGetAuthorizationForInterfaceResponse {
4058        type Borrowed<'a> = &'a mut Self;
4059        fn take_or_borrow<'a>(
4060            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4061        ) -> Self::Borrowed<'a> {
4062            value
4063        }
4064    }
4065
4066    unsafe impl fidl::encoding::TypeMarker for ControlGetAuthorizationForInterfaceResponse {
4067        type Owned = Self;
4068
4069        #[inline(always)]
4070        fn inline_align(_context: fidl::encoding::Context) -> usize {
4071            8
4072        }
4073
4074        #[inline(always)]
4075        fn inline_size(_context: fidl::encoding::Context) -> usize {
4076            16
4077        }
4078    }
4079
4080    unsafe impl
4081        fidl::encoding::Encode<
4082            ControlGetAuthorizationForInterfaceResponse,
4083            fidl::encoding::DefaultFuchsiaResourceDialect,
4084        > for &mut ControlGetAuthorizationForInterfaceResponse
4085    {
4086        #[inline]
4087        unsafe fn encode(
4088            self,
4089            encoder: &mut fidl::encoding::Encoder<
4090                '_,
4091                fidl::encoding::DefaultFuchsiaResourceDialect,
4092            >,
4093            offset: usize,
4094            _depth: fidl::encoding::Depth,
4095        ) -> fidl::Result<()> {
4096            encoder.debug_check_bounds::<ControlGetAuthorizationForInterfaceResponse>(offset);
4097            // Delegate to tuple encoding.
4098            fidl::encoding::Encode::<ControlGetAuthorizationForInterfaceResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4099                (
4100                    <GrantForInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
4101                ),
4102                encoder, offset, _depth
4103            )
4104        }
4105    }
4106    unsafe impl<
4107            T0: fidl::encoding::Encode<
4108                GrantForInterfaceAuthorization,
4109                fidl::encoding::DefaultFuchsiaResourceDialect,
4110            >,
4111        >
4112        fidl::encoding::Encode<
4113            ControlGetAuthorizationForInterfaceResponse,
4114            fidl::encoding::DefaultFuchsiaResourceDialect,
4115        > for (T0,)
4116    {
4117        #[inline]
4118        unsafe fn encode(
4119            self,
4120            encoder: &mut fidl::encoding::Encoder<
4121                '_,
4122                fidl::encoding::DefaultFuchsiaResourceDialect,
4123            >,
4124            offset: usize,
4125            depth: fidl::encoding::Depth,
4126        ) -> fidl::Result<()> {
4127            encoder.debug_check_bounds::<ControlGetAuthorizationForInterfaceResponse>(offset);
4128            // Zero out padding regions. There's no need to apply masks
4129            // because the unmasked parts will be overwritten by fields.
4130            // Write the fields.
4131            self.0.encode(encoder, offset + 0, depth)?;
4132            Ok(())
4133        }
4134    }
4135
4136    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4137        for ControlGetAuthorizationForInterfaceResponse
4138    {
4139        #[inline(always)]
4140        fn new_empty() -> Self {
4141            Self {
4142                credential: fidl::new_empty!(
4143                    GrantForInterfaceAuthorization,
4144                    fidl::encoding::DefaultFuchsiaResourceDialect
4145                ),
4146            }
4147        }
4148
4149        #[inline]
4150        unsafe fn decode(
4151            &mut self,
4152            decoder: &mut fidl::encoding::Decoder<
4153                '_,
4154                fidl::encoding::DefaultFuchsiaResourceDialect,
4155            >,
4156            offset: usize,
4157            _depth: fidl::encoding::Depth,
4158        ) -> fidl::Result<()> {
4159            decoder.debug_check_bounds::<Self>(offset);
4160            // Verify that padding bytes are zero.
4161            fidl::decode!(
4162                GrantForInterfaceAuthorization,
4163                fidl::encoding::DefaultFuchsiaResourceDialect,
4164                &mut self.credential,
4165                decoder,
4166                offset + 0,
4167                _depth
4168            )?;
4169            Ok(())
4170        }
4171    }
4172
4173    impl fidl::encoding::ResourceTypeMarker for DeviceControlCreateInterfaceRequest {
4174        type Borrowed<'a> = &'a mut Self;
4175        fn take_or_borrow<'a>(
4176            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4177        ) -> Self::Borrowed<'a> {
4178            value
4179        }
4180    }
4181
4182    unsafe impl fidl::encoding::TypeMarker for DeviceControlCreateInterfaceRequest {
4183        type Owned = Self;
4184
4185        #[inline(always)]
4186        fn inline_align(_context: fidl::encoding::Context) -> usize {
4187            8
4188        }
4189
4190        #[inline(always)]
4191        fn inline_size(_context: fidl::encoding::Context) -> usize {
4192            24
4193        }
4194    }
4195
4196    unsafe impl
4197        fidl::encoding::Encode<
4198            DeviceControlCreateInterfaceRequest,
4199            fidl::encoding::DefaultFuchsiaResourceDialect,
4200        > for &mut DeviceControlCreateInterfaceRequest
4201    {
4202        #[inline]
4203        unsafe fn encode(
4204            self,
4205            encoder: &mut fidl::encoding::Encoder<
4206                '_,
4207                fidl::encoding::DefaultFuchsiaResourceDialect,
4208            >,
4209            offset: usize,
4210            _depth: fidl::encoding::Depth,
4211        ) -> fidl::Result<()> {
4212            encoder.debug_check_bounds::<DeviceControlCreateInterfaceRequest>(offset);
4213            // Delegate to tuple encoding.
4214            fidl::encoding::Encode::<DeviceControlCreateInterfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4215                (
4216                    <fidl_fuchsia_hardware_network::PortId as fidl::encoding::ValueTypeMarker>::borrow(&self.port),
4217                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.control),
4218                    <Options as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.options),
4219                ),
4220                encoder, offset, _depth
4221            )
4222        }
4223    }
4224    unsafe impl<
4225            T0: fidl::encoding::Encode<
4226                fidl_fuchsia_hardware_network::PortId,
4227                fidl::encoding::DefaultFuchsiaResourceDialect,
4228            >,
4229            T1: fidl::encoding::Encode<
4230                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>>,
4231                fidl::encoding::DefaultFuchsiaResourceDialect,
4232            >,
4233            T2: fidl::encoding::Encode<Options, fidl::encoding::DefaultFuchsiaResourceDialect>,
4234        >
4235        fidl::encoding::Encode<
4236            DeviceControlCreateInterfaceRequest,
4237            fidl::encoding::DefaultFuchsiaResourceDialect,
4238        > for (T0, T1, T2)
4239    {
4240        #[inline]
4241        unsafe fn encode(
4242            self,
4243            encoder: &mut fidl::encoding::Encoder<
4244                '_,
4245                fidl::encoding::DefaultFuchsiaResourceDialect,
4246            >,
4247            offset: usize,
4248            depth: fidl::encoding::Depth,
4249        ) -> fidl::Result<()> {
4250            encoder.debug_check_bounds::<DeviceControlCreateInterfaceRequest>(offset);
4251            // Zero out padding regions. There's no need to apply masks
4252            // because the unmasked parts will be overwritten by fields.
4253            unsafe {
4254                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4255                (ptr as *mut u64).write_unaligned(0);
4256            }
4257            // Write the fields.
4258            self.0.encode(encoder, offset + 0, depth)?;
4259            self.1.encode(encoder, offset + 4, depth)?;
4260            self.2.encode(encoder, offset + 8, depth)?;
4261            Ok(())
4262        }
4263    }
4264
4265    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4266        for DeviceControlCreateInterfaceRequest
4267    {
4268        #[inline(always)]
4269        fn new_empty() -> Self {
4270            Self {
4271                port: fidl::new_empty!(
4272                    fidl_fuchsia_hardware_network::PortId,
4273                    fidl::encoding::DefaultFuchsiaResourceDialect
4274                ),
4275                control: fidl::new_empty!(
4276                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>>,
4277                    fidl::encoding::DefaultFuchsiaResourceDialect
4278                ),
4279                options: fidl::new_empty!(Options, fidl::encoding::DefaultFuchsiaResourceDialect),
4280            }
4281        }
4282
4283        #[inline]
4284        unsafe fn decode(
4285            &mut self,
4286            decoder: &mut fidl::encoding::Decoder<
4287                '_,
4288                fidl::encoding::DefaultFuchsiaResourceDialect,
4289            >,
4290            offset: usize,
4291            _depth: fidl::encoding::Depth,
4292        ) -> fidl::Result<()> {
4293            decoder.debug_check_bounds::<Self>(offset);
4294            // Verify that padding bytes are zero.
4295            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4296            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4297            let mask = 0xffff0000u64;
4298            let maskedval = padval & mask;
4299            if maskedval != 0 {
4300                return Err(fidl::Error::NonZeroPadding {
4301                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4302                });
4303            }
4304            fidl::decode!(
4305                fidl_fuchsia_hardware_network::PortId,
4306                fidl::encoding::DefaultFuchsiaResourceDialect,
4307                &mut self.port,
4308                decoder,
4309                offset + 0,
4310                _depth
4311            )?;
4312            fidl::decode!(
4313                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>>,
4314                fidl::encoding::DefaultFuchsiaResourceDialect,
4315                &mut self.control,
4316                decoder,
4317                offset + 4,
4318                _depth
4319            )?;
4320            fidl::decode!(
4321                Options,
4322                fidl::encoding::DefaultFuchsiaResourceDialect,
4323                &mut self.options,
4324                decoder,
4325                offset + 8,
4326                _depth
4327            )?;
4328            Ok(())
4329        }
4330    }
4331
4332    impl fidl::encoding::ResourceTypeMarker for GrantForInterfaceAuthorization {
4333        type Borrowed<'a> = &'a mut Self;
4334        fn take_or_borrow<'a>(
4335            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4336        ) -> Self::Borrowed<'a> {
4337            value
4338        }
4339    }
4340
4341    unsafe impl fidl::encoding::TypeMarker for GrantForInterfaceAuthorization {
4342        type Owned = Self;
4343
4344        #[inline(always)]
4345        fn inline_align(_context: fidl::encoding::Context) -> usize {
4346            8
4347        }
4348
4349        #[inline(always)]
4350        fn inline_size(_context: fidl::encoding::Context) -> usize {
4351            16
4352        }
4353    }
4354
4355    unsafe impl
4356        fidl::encoding::Encode<
4357            GrantForInterfaceAuthorization,
4358            fidl::encoding::DefaultFuchsiaResourceDialect,
4359        > for &mut GrantForInterfaceAuthorization
4360    {
4361        #[inline]
4362        unsafe fn encode(
4363            self,
4364            encoder: &mut fidl::encoding::Encoder<
4365                '_,
4366                fidl::encoding::DefaultFuchsiaResourceDialect,
4367            >,
4368            offset: usize,
4369            _depth: fidl::encoding::Depth,
4370        ) -> fidl::Result<()> {
4371            encoder.debug_check_bounds::<GrantForInterfaceAuthorization>(offset);
4372            // Delegate to tuple encoding.
4373            fidl::encoding::Encode::<
4374                GrantForInterfaceAuthorization,
4375                fidl::encoding::DefaultFuchsiaResourceDialect,
4376            >::encode(
4377                (
4378                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.interface_id),
4379                    <fidl::encoding::HandleType<
4380                        fidl::Event,
4381                        { fidl::ObjectType::EVENT.into_raw() },
4382                        3,
4383                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4384                        &mut self.token
4385                    ),
4386                ),
4387                encoder,
4388                offset,
4389                _depth,
4390            )
4391        }
4392    }
4393    unsafe impl<
4394            T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
4395            T1: fidl::encoding::Encode<
4396                fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>,
4397                fidl::encoding::DefaultFuchsiaResourceDialect,
4398            >,
4399        >
4400        fidl::encoding::Encode<
4401            GrantForInterfaceAuthorization,
4402            fidl::encoding::DefaultFuchsiaResourceDialect,
4403        > for (T0, T1)
4404    {
4405        #[inline]
4406        unsafe fn encode(
4407            self,
4408            encoder: &mut fidl::encoding::Encoder<
4409                '_,
4410                fidl::encoding::DefaultFuchsiaResourceDialect,
4411            >,
4412            offset: usize,
4413            depth: fidl::encoding::Depth,
4414        ) -> fidl::Result<()> {
4415            encoder.debug_check_bounds::<GrantForInterfaceAuthorization>(offset);
4416            // Zero out padding regions. There's no need to apply masks
4417            // because the unmasked parts will be overwritten by fields.
4418            unsafe {
4419                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4420                (ptr as *mut u64).write_unaligned(0);
4421            }
4422            // Write the fields.
4423            self.0.encode(encoder, offset + 0, depth)?;
4424            self.1.encode(encoder, offset + 8, depth)?;
4425            Ok(())
4426        }
4427    }
4428
4429    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4430        for GrantForInterfaceAuthorization
4431    {
4432        #[inline(always)]
4433        fn new_empty() -> Self {
4434            Self {
4435                interface_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
4436                token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>, fidl::encoding::DefaultFuchsiaResourceDialect),
4437            }
4438        }
4439
4440        #[inline]
4441        unsafe fn decode(
4442            &mut self,
4443            decoder: &mut fidl::encoding::Decoder<
4444                '_,
4445                fidl::encoding::DefaultFuchsiaResourceDialect,
4446            >,
4447            offset: usize,
4448            _depth: fidl::encoding::Depth,
4449        ) -> fidl::Result<()> {
4450            decoder.debug_check_bounds::<Self>(offset);
4451            // Verify that padding bytes are zero.
4452            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4453            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4454            let mask = 0xffffffff00000000u64;
4455            let maskedval = padval & mask;
4456            if maskedval != 0 {
4457                return Err(fidl::Error::NonZeroPadding {
4458                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4459                });
4460            }
4461            fidl::decode!(
4462                u64,
4463                fidl::encoding::DefaultFuchsiaResourceDialect,
4464                &mut self.interface_id,
4465                decoder,
4466                offset + 0,
4467                _depth
4468            )?;
4469            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 8, _depth)?;
4470            Ok(())
4471        }
4472    }
4473
4474    impl fidl::encoding::ResourceTypeMarker for InstallerInstallBlackholeInterfaceRequest {
4475        type Borrowed<'a> = &'a mut Self;
4476        fn take_or_borrow<'a>(
4477            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4478        ) -> Self::Borrowed<'a> {
4479            value
4480        }
4481    }
4482
4483    unsafe impl fidl::encoding::TypeMarker for InstallerInstallBlackholeInterfaceRequest {
4484        type Owned = Self;
4485
4486        #[inline(always)]
4487        fn inline_align(_context: fidl::encoding::Context) -> usize {
4488            8
4489        }
4490
4491        #[inline(always)]
4492        fn inline_size(_context: fidl::encoding::Context) -> usize {
4493            24
4494        }
4495    }
4496
4497    unsafe impl
4498        fidl::encoding::Encode<
4499            InstallerInstallBlackholeInterfaceRequest,
4500            fidl::encoding::DefaultFuchsiaResourceDialect,
4501        > for &mut InstallerInstallBlackholeInterfaceRequest
4502    {
4503        #[inline]
4504        unsafe fn encode(
4505            self,
4506            encoder: &mut fidl::encoding::Encoder<
4507                '_,
4508                fidl::encoding::DefaultFuchsiaResourceDialect,
4509            >,
4510            offset: usize,
4511            _depth: fidl::encoding::Depth,
4512        ) -> fidl::Result<()> {
4513            encoder.debug_check_bounds::<InstallerInstallBlackholeInterfaceRequest>(offset);
4514            // Delegate to tuple encoding.
4515            fidl::encoding::Encode::<InstallerInstallBlackholeInterfaceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4516                (
4517                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.interface),
4518                    <Options as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.options),
4519                ),
4520                encoder, offset, _depth
4521            )
4522        }
4523    }
4524    unsafe impl<
4525            T0: fidl::encoding::Encode<
4526                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>>,
4527                fidl::encoding::DefaultFuchsiaResourceDialect,
4528            >,
4529            T1: fidl::encoding::Encode<Options, fidl::encoding::DefaultFuchsiaResourceDialect>,
4530        >
4531        fidl::encoding::Encode<
4532            InstallerInstallBlackholeInterfaceRequest,
4533            fidl::encoding::DefaultFuchsiaResourceDialect,
4534        > for (T0, T1)
4535    {
4536        #[inline]
4537        unsafe fn encode(
4538            self,
4539            encoder: &mut fidl::encoding::Encoder<
4540                '_,
4541                fidl::encoding::DefaultFuchsiaResourceDialect,
4542            >,
4543            offset: usize,
4544            depth: fidl::encoding::Depth,
4545        ) -> fidl::Result<()> {
4546            encoder.debug_check_bounds::<InstallerInstallBlackholeInterfaceRequest>(offset);
4547            // Zero out padding regions. There's no need to apply masks
4548            // because the unmasked parts will be overwritten by fields.
4549            unsafe {
4550                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
4551                (ptr as *mut u64).write_unaligned(0);
4552            }
4553            // Write the fields.
4554            self.0.encode(encoder, offset + 0, depth)?;
4555            self.1.encode(encoder, offset + 8, depth)?;
4556            Ok(())
4557        }
4558    }
4559
4560    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4561        for InstallerInstallBlackholeInterfaceRequest
4562    {
4563        #[inline(always)]
4564        fn new_empty() -> Self {
4565            Self {
4566                interface: fidl::new_empty!(
4567                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>>,
4568                    fidl::encoding::DefaultFuchsiaResourceDialect
4569                ),
4570                options: fidl::new_empty!(Options, fidl::encoding::DefaultFuchsiaResourceDialect),
4571            }
4572        }
4573
4574        #[inline]
4575        unsafe fn decode(
4576            &mut self,
4577            decoder: &mut fidl::encoding::Decoder<
4578                '_,
4579                fidl::encoding::DefaultFuchsiaResourceDialect,
4580            >,
4581            offset: usize,
4582            _depth: fidl::encoding::Depth,
4583        ) -> fidl::Result<()> {
4584            decoder.debug_check_bounds::<Self>(offset);
4585            // Verify that padding bytes are zero.
4586            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(0) };
4587            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4588            let mask = 0xffffffff00000000u64;
4589            let maskedval = padval & mask;
4590            if maskedval != 0 {
4591                return Err(fidl::Error::NonZeroPadding {
4592                    padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
4593                });
4594            }
4595            fidl::decode!(
4596                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ControlMarker>>,
4597                fidl::encoding::DefaultFuchsiaResourceDialect,
4598                &mut self.interface,
4599                decoder,
4600                offset + 0,
4601                _depth
4602            )?;
4603            fidl::decode!(
4604                Options,
4605                fidl::encoding::DefaultFuchsiaResourceDialect,
4606                &mut self.options,
4607                decoder,
4608                offset + 8,
4609                _depth
4610            )?;
4611            Ok(())
4612        }
4613    }
4614
4615    impl fidl::encoding::ResourceTypeMarker for InstallerInstallDeviceRequest {
4616        type Borrowed<'a> = &'a mut Self;
4617        fn take_or_borrow<'a>(
4618            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4619        ) -> Self::Borrowed<'a> {
4620            value
4621        }
4622    }
4623
4624    unsafe impl fidl::encoding::TypeMarker for InstallerInstallDeviceRequest {
4625        type Owned = Self;
4626
4627        #[inline(always)]
4628        fn inline_align(_context: fidl::encoding::Context) -> usize {
4629            4
4630        }
4631
4632        #[inline(always)]
4633        fn inline_size(_context: fidl::encoding::Context) -> usize {
4634            8
4635        }
4636    }
4637
4638    unsafe impl
4639        fidl::encoding::Encode<
4640            InstallerInstallDeviceRequest,
4641            fidl::encoding::DefaultFuchsiaResourceDialect,
4642        > for &mut InstallerInstallDeviceRequest
4643    {
4644        #[inline]
4645        unsafe fn encode(
4646            self,
4647            encoder: &mut fidl::encoding::Encoder<
4648                '_,
4649                fidl::encoding::DefaultFuchsiaResourceDialect,
4650            >,
4651            offset: usize,
4652            _depth: fidl::encoding::Depth,
4653        ) -> fidl::Result<()> {
4654            encoder.debug_check_bounds::<InstallerInstallDeviceRequest>(offset);
4655            // Delegate to tuple encoding.
4656            fidl::encoding::Encode::<InstallerInstallDeviceRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
4657                (
4658                    <fidl::encoding::Endpoint<fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device),
4659                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.device_control),
4660                ),
4661                encoder, offset, _depth
4662            )
4663        }
4664    }
4665    unsafe impl<
4666            T0: fidl::encoding::Encode<
4667                fidl::encoding::Endpoint<
4668                    fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
4669                >,
4670                fidl::encoding::DefaultFuchsiaResourceDialect,
4671            >,
4672            T1: fidl::encoding::Encode<
4673                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceControlMarker>>,
4674                fidl::encoding::DefaultFuchsiaResourceDialect,
4675            >,
4676        >
4677        fidl::encoding::Encode<
4678            InstallerInstallDeviceRequest,
4679            fidl::encoding::DefaultFuchsiaResourceDialect,
4680        > for (T0, T1)
4681    {
4682        #[inline]
4683        unsafe fn encode(
4684            self,
4685            encoder: &mut fidl::encoding::Encoder<
4686                '_,
4687                fidl::encoding::DefaultFuchsiaResourceDialect,
4688            >,
4689            offset: usize,
4690            depth: fidl::encoding::Depth,
4691        ) -> fidl::Result<()> {
4692            encoder.debug_check_bounds::<InstallerInstallDeviceRequest>(offset);
4693            // Zero out padding regions. There's no need to apply masks
4694            // because the unmasked parts will be overwritten by fields.
4695            // Write the fields.
4696            self.0.encode(encoder, offset + 0, depth)?;
4697            self.1.encode(encoder, offset + 4, depth)?;
4698            Ok(())
4699        }
4700    }
4701
4702    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4703        for InstallerInstallDeviceRequest
4704    {
4705        #[inline(always)]
4706        fn new_empty() -> Self {
4707            Self {
4708                device: fidl::new_empty!(
4709                    fidl::encoding::Endpoint<
4710                        fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
4711                    >,
4712                    fidl::encoding::DefaultFuchsiaResourceDialect
4713                ),
4714                device_control: fidl::new_empty!(
4715                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceControlMarker>>,
4716                    fidl::encoding::DefaultFuchsiaResourceDialect
4717                ),
4718            }
4719        }
4720
4721        #[inline]
4722        unsafe fn decode(
4723            &mut self,
4724            decoder: &mut fidl::encoding::Decoder<
4725                '_,
4726                fidl::encoding::DefaultFuchsiaResourceDialect,
4727            >,
4728            offset: usize,
4729            _depth: fidl::encoding::Depth,
4730        ) -> fidl::Result<()> {
4731            decoder.debug_check_bounds::<Self>(offset);
4732            // Verify that padding bytes are zero.
4733            fidl::decode!(
4734                fidl::encoding::Endpoint<
4735                    fidl::endpoints::ClientEnd<fidl_fuchsia_hardware_network::DeviceMarker>,
4736                >,
4737                fidl::encoding::DefaultFuchsiaResourceDialect,
4738                &mut self.device,
4739                decoder,
4740                offset + 0,
4741                _depth
4742            )?;
4743            fidl::decode!(
4744                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<DeviceControlMarker>>,
4745                fidl::encoding::DefaultFuchsiaResourceDialect,
4746                &mut self.device_control,
4747                decoder,
4748                offset + 4,
4749                _depth
4750            )?;
4751            Ok(())
4752        }
4753    }
4754
4755    impl fidl::encoding::ResourceTypeMarker for ProofOfInterfaceAuthorization {
4756        type Borrowed<'a> = &'a mut Self;
4757        fn take_or_borrow<'a>(
4758            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4759        ) -> Self::Borrowed<'a> {
4760            value
4761        }
4762    }
4763
4764    unsafe impl fidl::encoding::TypeMarker for ProofOfInterfaceAuthorization {
4765        type Owned = Self;
4766
4767        #[inline(always)]
4768        fn inline_align(_context: fidl::encoding::Context) -> usize {
4769            8
4770        }
4771
4772        #[inline(always)]
4773        fn inline_size(_context: fidl::encoding::Context) -> usize {
4774            16
4775        }
4776    }
4777
4778    unsafe impl
4779        fidl::encoding::Encode<
4780            ProofOfInterfaceAuthorization,
4781            fidl::encoding::DefaultFuchsiaResourceDialect,
4782        > for &mut ProofOfInterfaceAuthorization
4783    {
4784        #[inline]
4785        unsafe fn encode(
4786            self,
4787            encoder: &mut fidl::encoding::Encoder<
4788                '_,
4789                fidl::encoding::DefaultFuchsiaResourceDialect,
4790            >,
4791            offset: usize,
4792            _depth: fidl::encoding::Depth,
4793        ) -> fidl::Result<()> {
4794            encoder.debug_check_bounds::<ProofOfInterfaceAuthorization>(offset);
4795            // Delegate to tuple encoding.
4796            fidl::encoding::Encode::<
4797                ProofOfInterfaceAuthorization,
4798                fidl::encoding::DefaultFuchsiaResourceDialect,
4799            >::encode(
4800                (
4801                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.interface_id),
4802                    <fidl::encoding::HandleType<
4803                        fidl::Event,
4804                        { fidl::ObjectType::EVENT.into_raw() },
4805                        0,
4806                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
4807                        &mut self.token
4808                    ),
4809                ),
4810                encoder,
4811                offset,
4812                _depth,
4813            )
4814        }
4815    }
4816    unsafe impl<
4817            T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
4818            T1: fidl::encoding::Encode<
4819                fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 0>,
4820                fidl::encoding::DefaultFuchsiaResourceDialect,
4821            >,
4822        >
4823        fidl::encoding::Encode<
4824            ProofOfInterfaceAuthorization,
4825            fidl::encoding::DefaultFuchsiaResourceDialect,
4826        > for (T0, T1)
4827    {
4828        #[inline]
4829        unsafe fn encode(
4830            self,
4831            encoder: &mut fidl::encoding::Encoder<
4832                '_,
4833                fidl::encoding::DefaultFuchsiaResourceDialect,
4834            >,
4835            offset: usize,
4836            depth: fidl::encoding::Depth,
4837        ) -> fidl::Result<()> {
4838            encoder.debug_check_bounds::<ProofOfInterfaceAuthorization>(offset);
4839            // Zero out padding regions. There's no need to apply masks
4840            // because the unmasked parts will be overwritten by fields.
4841            unsafe {
4842                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
4843                (ptr as *mut u64).write_unaligned(0);
4844            }
4845            // Write the fields.
4846            self.0.encode(encoder, offset + 0, depth)?;
4847            self.1.encode(encoder, offset + 8, depth)?;
4848            Ok(())
4849        }
4850    }
4851
4852    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4853        for ProofOfInterfaceAuthorization
4854    {
4855        #[inline(always)]
4856        fn new_empty() -> Self {
4857            Self {
4858                interface_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
4859                token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 0>, fidl::encoding::DefaultFuchsiaResourceDialect),
4860            }
4861        }
4862
4863        #[inline]
4864        unsafe fn decode(
4865            &mut self,
4866            decoder: &mut fidl::encoding::Decoder<
4867                '_,
4868                fidl::encoding::DefaultFuchsiaResourceDialect,
4869            >,
4870            offset: usize,
4871            _depth: fidl::encoding::Depth,
4872        ) -> fidl::Result<()> {
4873            decoder.debug_check_bounds::<Self>(offset);
4874            // Verify that padding bytes are zero.
4875            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
4876            let padval = unsafe { (ptr as *const u64).read_unaligned() };
4877            let mask = 0xffffffff00000000u64;
4878            let maskedval = padval & mask;
4879            if maskedval != 0 {
4880                return Err(fidl::Error::NonZeroPadding {
4881                    padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
4882                });
4883            }
4884            fidl::decode!(
4885                u64,
4886                fidl::encoding::DefaultFuchsiaResourceDialect,
4887                &mut self.interface_id,
4888                decoder,
4889                offset + 0,
4890                _depth
4891            )?;
4892            fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 0>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.token, decoder, offset + 8, _depth)?;
4893            Ok(())
4894        }
4895    }
4896
4897    impl Options {
4898        #[inline(always)]
4899        fn max_ordinal_present(&self) -> u64 {
4900            if let Some(_) = self.netstack_managed_routes_designation {
4901                return 3;
4902            }
4903            if let Some(_) = self.metric {
4904                return 2;
4905            }
4906            if let Some(_) = self.name {
4907                return 1;
4908            }
4909            0
4910        }
4911    }
4912
4913    impl fidl::encoding::ResourceTypeMarker for Options {
4914        type Borrowed<'a> = &'a mut Self;
4915        fn take_or_borrow<'a>(
4916            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4917        ) -> Self::Borrowed<'a> {
4918            value
4919        }
4920    }
4921
4922    unsafe impl fidl::encoding::TypeMarker for Options {
4923        type Owned = Self;
4924
4925        #[inline(always)]
4926        fn inline_align(_context: fidl::encoding::Context) -> usize {
4927            8
4928        }
4929
4930        #[inline(always)]
4931        fn inline_size(_context: fidl::encoding::Context) -> usize {
4932            16
4933        }
4934    }
4935
4936    unsafe impl fidl::encoding::Encode<Options, fidl::encoding::DefaultFuchsiaResourceDialect>
4937        for &mut Options
4938    {
4939        unsafe fn encode(
4940            self,
4941            encoder: &mut fidl::encoding::Encoder<
4942                '_,
4943                fidl::encoding::DefaultFuchsiaResourceDialect,
4944            >,
4945            offset: usize,
4946            mut depth: fidl::encoding::Depth,
4947        ) -> fidl::Result<()> {
4948            encoder.debug_check_bounds::<Options>(offset);
4949            // Vector header
4950            let max_ordinal: u64 = self.max_ordinal_present();
4951            encoder.write_num(max_ordinal, offset);
4952            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4953            // Calling encoder.out_of_line_offset(0) is not allowed.
4954            if max_ordinal == 0 {
4955                return Ok(());
4956            }
4957            depth.increment()?;
4958            let envelope_size = 8;
4959            let bytes_len = max_ordinal as usize * envelope_size;
4960            #[allow(unused_variables)]
4961            let offset = encoder.out_of_line_offset(bytes_len);
4962            let mut _prev_end_offset: usize = 0;
4963            if 1 > max_ordinal {
4964                return Ok(());
4965            }
4966
4967            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4968            // are envelope_size bytes.
4969            let cur_offset: usize = (1 - 1) * envelope_size;
4970
4971            // Zero reserved fields.
4972            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4973
4974            // Safety:
4975            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4976            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4977            //   envelope_size bytes, there is always sufficient room.
4978            fidl::encoding::encode_in_envelope_optional::<
4979                fidl::encoding::BoundedString<15>,
4980                fidl::encoding::DefaultFuchsiaResourceDialect,
4981            >(
4982                self.name.as_ref().map(
4983                    <fidl::encoding::BoundedString<15> as fidl::encoding::ValueTypeMarker>::borrow,
4984                ),
4985                encoder,
4986                offset + cur_offset,
4987                depth,
4988            )?;
4989
4990            _prev_end_offset = cur_offset + envelope_size;
4991            if 2 > max_ordinal {
4992                return Ok(());
4993            }
4994
4995            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4996            // are envelope_size bytes.
4997            let cur_offset: usize = (2 - 1) * envelope_size;
4998
4999            // Zero reserved fields.
5000            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5001
5002            // Safety:
5003            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5004            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5005            //   envelope_size bytes, there is always sufficient room.
5006            fidl::encoding::encode_in_envelope_optional::<
5007                u32,
5008                fidl::encoding::DefaultFuchsiaResourceDialect,
5009            >(
5010                self.metric.as_ref().map(<u32 as fidl::encoding::ValueTypeMarker>::borrow),
5011                encoder,
5012                offset + cur_offset,
5013                depth,
5014            )?;
5015
5016            _prev_end_offset = cur_offset + envelope_size;
5017            if 3 > max_ordinal {
5018                return Ok(());
5019            }
5020
5021            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
5022            // are envelope_size bytes.
5023            let cur_offset: usize = (3 - 1) * envelope_size;
5024
5025            // Zero reserved fields.
5026            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
5027
5028            // Safety:
5029            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
5030            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
5031            //   envelope_size bytes, there is always sufficient room.
5032            fidl::encoding::encode_in_envelope_optional::<NetstackManagedRoutesDesignation, fidl::encoding::DefaultFuchsiaResourceDialect>(
5033            self.netstack_managed_routes_designation.as_mut().map(<NetstackManagedRoutesDesignation as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
5034            encoder, offset + cur_offset, depth
5035        )?;
5036
5037            _prev_end_offset = cur_offset + envelope_size;
5038
5039            Ok(())
5040        }
5041    }
5042
5043    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Options {
5044        #[inline(always)]
5045        fn new_empty() -> Self {
5046            Self::default()
5047        }
5048
5049        unsafe fn decode(
5050            &mut self,
5051            decoder: &mut fidl::encoding::Decoder<
5052                '_,
5053                fidl::encoding::DefaultFuchsiaResourceDialect,
5054            >,
5055            offset: usize,
5056            mut depth: fidl::encoding::Depth,
5057        ) -> fidl::Result<()> {
5058            decoder.debug_check_bounds::<Self>(offset);
5059            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
5060                None => return Err(fidl::Error::NotNullable),
5061                Some(len) => len,
5062            };
5063            // Calling decoder.out_of_line_offset(0) is not allowed.
5064            if len == 0 {
5065                return Ok(());
5066            };
5067            depth.increment()?;
5068            let envelope_size = 8;
5069            let bytes_len = len * envelope_size;
5070            let offset = decoder.out_of_line_offset(bytes_len)?;
5071            // Decode the envelope for each type.
5072            let mut _next_ordinal_to_read = 0;
5073            let mut next_offset = offset;
5074            let end_offset = offset + bytes_len;
5075            _next_ordinal_to_read += 1;
5076            if next_offset >= end_offset {
5077                return Ok(());
5078            }
5079
5080            // Decode unknown envelopes for gaps in ordinals.
5081            while _next_ordinal_to_read < 1 {
5082                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5083                _next_ordinal_to_read += 1;
5084                next_offset += envelope_size;
5085            }
5086
5087            let next_out_of_line = decoder.next_out_of_line();
5088            let handles_before = decoder.remaining_handles();
5089            if let Some((inlined, num_bytes, num_handles)) =
5090                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5091            {
5092                let member_inline_size =
5093                    <fidl::encoding::BoundedString<15> as fidl::encoding::TypeMarker>::inline_size(
5094                        decoder.context,
5095                    );
5096                if inlined != (member_inline_size <= 4) {
5097                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5098                }
5099                let inner_offset;
5100                let mut inner_depth = depth.clone();
5101                if inlined {
5102                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5103                    inner_offset = next_offset;
5104                } else {
5105                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5106                    inner_depth.increment()?;
5107                }
5108                let val_ref = self.name.get_or_insert_with(|| {
5109                    fidl::new_empty!(
5110                        fidl::encoding::BoundedString<15>,
5111                        fidl::encoding::DefaultFuchsiaResourceDialect
5112                    )
5113                });
5114                fidl::decode!(
5115                    fidl::encoding::BoundedString<15>,
5116                    fidl::encoding::DefaultFuchsiaResourceDialect,
5117                    val_ref,
5118                    decoder,
5119                    inner_offset,
5120                    inner_depth
5121                )?;
5122                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5123                {
5124                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5125                }
5126                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5127                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5128                }
5129            }
5130
5131            next_offset += envelope_size;
5132            _next_ordinal_to_read += 1;
5133            if next_offset >= end_offset {
5134                return Ok(());
5135            }
5136
5137            // Decode unknown envelopes for gaps in ordinals.
5138            while _next_ordinal_to_read < 2 {
5139                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5140                _next_ordinal_to_read += 1;
5141                next_offset += envelope_size;
5142            }
5143
5144            let next_out_of_line = decoder.next_out_of_line();
5145            let handles_before = decoder.remaining_handles();
5146            if let Some((inlined, num_bytes, num_handles)) =
5147                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5148            {
5149                let member_inline_size =
5150                    <u32 as fidl::encoding::TypeMarker>::inline_size(decoder.context);
5151                if inlined != (member_inline_size <= 4) {
5152                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5153                }
5154                let inner_offset;
5155                let mut inner_depth = depth.clone();
5156                if inlined {
5157                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5158                    inner_offset = next_offset;
5159                } else {
5160                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5161                    inner_depth.increment()?;
5162                }
5163                let val_ref = self.metric.get_or_insert_with(|| {
5164                    fidl::new_empty!(u32, fidl::encoding::DefaultFuchsiaResourceDialect)
5165                });
5166                fidl::decode!(
5167                    u32,
5168                    fidl::encoding::DefaultFuchsiaResourceDialect,
5169                    val_ref,
5170                    decoder,
5171                    inner_offset,
5172                    inner_depth
5173                )?;
5174                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5175                {
5176                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5177                }
5178                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5179                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5180                }
5181            }
5182
5183            next_offset += envelope_size;
5184            _next_ordinal_to_read += 1;
5185            if next_offset >= end_offset {
5186                return Ok(());
5187            }
5188
5189            // Decode unknown envelopes for gaps in ordinals.
5190            while _next_ordinal_to_read < 3 {
5191                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5192                _next_ordinal_to_read += 1;
5193                next_offset += envelope_size;
5194            }
5195
5196            let next_out_of_line = decoder.next_out_of_line();
5197            let handles_before = decoder.remaining_handles();
5198            if let Some((inlined, num_bytes, num_handles)) =
5199                fidl::encoding::decode_envelope_header(decoder, next_offset)?
5200            {
5201                let member_inline_size =
5202                    <NetstackManagedRoutesDesignation as fidl::encoding::TypeMarker>::inline_size(
5203                        decoder.context,
5204                    );
5205                if inlined != (member_inline_size <= 4) {
5206                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
5207                }
5208                let inner_offset;
5209                let mut inner_depth = depth.clone();
5210                if inlined {
5211                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
5212                    inner_offset = next_offset;
5213                } else {
5214                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5215                    inner_depth.increment()?;
5216                }
5217                let val_ref = self.netstack_managed_routes_designation.get_or_insert_with(|| {
5218                    fidl::new_empty!(
5219                        NetstackManagedRoutesDesignation,
5220                        fidl::encoding::DefaultFuchsiaResourceDialect
5221                    )
5222                });
5223                fidl::decode!(
5224                    NetstackManagedRoutesDesignation,
5225                    fidl::encoding::DefaultFuchsiaResourceDialect,
5226                    val_ref,
5227                    decoder,
5228                    inner_offset,
5229                    inner_depth
5230                )?;
5231                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
5232                {
5233                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
5234                }
5235                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5236                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5237                }
5238            }
5239
5240            next_offset += envelope_size;
5241
5242            // Decode the remaining unknown envelopes.
5243            while next_offset < end_offset {
5244                _next_ordinal_to_read += 1;
5245                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
5246                next_offset += envelope_size;
5247            }
5248
5249            Ok(())
5250        }
5251    }
5252
5253    impl fidl::encoding::ResourceTypeMarker for NetstackManagedRoutesDesignation {
5254        type Borrowed<'a> = &'a mut Self;
5255        fn take_or_borrow<'a>(
5256            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
5257        ) -> Self::Borrowed<'a> {
5258            value
5259        }
5260    }
5261
5262    unsafe impl fidl::encoding::TypeMarker for NetstackManagedRoutesDesignation {
5263        type Owned = Self;
5264
5265        #[inline(always)]
5266        fn inline_align(_context: fidl::encoding::Context) -> usize {
5267            8
5268        }
5269
5270        #[inline(always)]
5271        fn inline_size(_context: fidl::encoding::Context) -> usize {
5272            16
5273        }
5274    }
5275
5276    unsafe impl
5277        fidl::encoding::Encode<
5278            NetstackManagedRoutesDesignation,
5279            fidl::encoding::DefaultFuchsiaResourceDialect,
5280        > for &mut NetstackManagedRoutesDesignation
5281    {
5282        #[inline]
5283        unsafe fn encode(
5284            self,
5285            encoder: &mut fidl::encoding::Encoder<
5286                '_,
5287                fidl::encoding::DefaultFuchsiaResourceDialect,
5288            >,
5289            offset: usize,
5290            _depth: fidl::encoding::Depth,
5291        ) -> fidl::Result<()> {
5292            encoder.debug_check_bounds::<NetstackManagedRoutesDesignation>(offset);
5293            encoder.write_num::<u64>(self.ordinal(), offset);
5294            match self {
5295                NetstackManagedRoutesDesignation::Main(ref val) => {
5296                    fidl::encoding::encode_in_envelope::<
5297                        Empty,
5298                        fidl::encoding::DefaultFuchsiaResourceDialect,
5299                    >(
5300                        <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
5301                        encoder,
5302                        offset + 8,
5303                        _depth,
5304                    )
5305                }
5306                NetstackManagedRoutesDesignation::InterfaceLocal(ref val) => {
5307                    fidl::encoding::encode_in_envelope::<
5308                        Empty,
5309                        fidl::encoding::DefaultFuchsiaResourceDialect,
5310                    >(
5311                        <Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
5312                        encoder,
5313                        offset + 8,
5314                        _depth,
5315                    )
5316                }
5317                NetstackManagedRoutesDesignation::__SourceBreaking { .. } => {
5318                    Err(fidl::Error::UnknownUnionTag)
5319                }
5320            }
5321        }
5322    }
5323
5324    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
5325        for NetstackManagedRoutesDesignation
5326    {
5327        #[inline(always)]
5328        fn new_empty() -> Self {
5329            Self::__SourceBreaking { unknown_ordinal: 0 }
5330        }
5331
5332        #[inline]
5333        unsafe fn decode(
5334            &mut self,
5335            decoder: &mut fidl::encoding::Decoder<
5336                '_,
5337                fidl::encoding::DefaultFuchsiaResourceDialect,
5338            >,
5339            offset: usize,
5340            mut depth: fidl::encoding::Depth,
5341        ) -> fidl::Result<()> {
5342            decoder.debug_check_bounds::<Self>(offset);
5343            #[allow(unused_variables)]
5344            let next_out_of_line = decoder.next_out_of_line();
5345            let handles_before = decoder.remaining_handles();
5346            let (ordinal, inlined, num_bytes, num_handles) =
5347                fidl::encoding::decode_union_inline_portion(decoder, offset)?;
5348
5349            let member_inline_size = match ordinal {
5350                1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5351                2 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
5352                0 => return Err(fidl::Error::UnknownUnionTag),
5353                _ => num_bytes as usize,
5354            };
5355
5356            if inlined != (member_inline_size <= 4) {
5357                return Err(fidl::Error::InvalidInlineBitInEnvelope);
5358            }
5359            let _inner_offset;
5360            if inlined {
5361                decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
5362                _inner_offset = offset + 8;
5363            } else {
5364                depth.increment()?;
5365                _inner_offset = decoder.out_of_line_offset(member_inline_size)?;
5366            }
5367            match ordinal {
5368                1 => {
5369                    #[allow(irrefutable_let_patterns)]
5370                    if let NetstackManagedRoutesDesignation::Main(_) = self {
5371                        // Do nothing, read the value into the object
5372                    } else {
5373                        // Initialize `self` to the right variant
5374                        *self = NetstackManagedRoutesDesignation::Main(fidl::new_empty!(
5375                            Empty,
5376                            fidl::encoding::DefaultFuchsiaResourceDialect
5377                        ));
5378                    }
5379                    #[allow(irrefutable_let_patterns)]
5380                    if let NetstackManagedRoutesDesignation::Main(ref mut val) = self {
5381                        fidl::decode!(
5382                            Empty,
5383                            fidl::encoding::DefaultFuchsiaResourceDialect,
5384                            val,
5385                            decoder,
5386                            _inner_offset,
5387                            depth
5388                        )?;
5389                    } else {
5390                        unreachable!()
5391                    }
5392                }
5393                2 => {
5394                    #[allow(irrefutable_let_patterns)]
5395                    if let NetstackManagedRoutesDesignation::InterfaceLocal(_) = self {
5396                        // Do nothing, read the value into the object
5397                    } else {
5398                        // Initialize `self` to the right variant
5399                        *self = NetstackManagedRoutesDesignation::InterfaceLocal(fidl::new_empty!(
5400                            Empty,
5401                            fidl::encoding::DefaultFuchsiaResourceDialect
5402                        ));
5403                    }
5404                    #[allow(irrefutable_let_patterns)]
5405                    if let NetstackManagedRoutesDesignation::InterfaceLocal(ref mut val) = self {
5406                        fidl::decode!(
5407                            Empty,
5408                            fidl::encoding::DefaultFuchsiaResourceDialect,
5409                            val,
5410                            decoder,
5411                            _inner_offset,
5412                            depth
5413                        )?;
5414                    } else {
5415                        unreachable!()
5416                    }
5417                }
5418                #[allow(deprecated)]
5419                ordinal => {
5420                    for _ in 0..num_handles {
5421                        decoder.drop_next_handle()?;
5422                    }
5423                    *self = NetstackManagedRoutesDesignation::__SourceBreaking {
5424                        unknown_ordinal: ordinal,
5425                    };
5426                }
5427            }
5428            if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize) {
5429                return Err(fidl::Error::InvalidNumBytesInEnvelope);
5430            }
5431            if handles_before != decoder.remaining_handles() + (num_handles as usize) {
5432                return Err(fidl::Error::InvalidNumHandlesInEnvelope);
5433            }
5434            Ok(())
5435        }
5436    }
5437}