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