Skip to main content

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