fidl_fuchsia_net_dhcpv6/
fidl_fuchsia_net_dhcpv6.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_dhcpv6__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ClientProviderNewClientRequest {
16    pub params: NewClientParams,
17    pub request: fidl::endpoints::ServerEnd<ClientMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21    for ClientProviderNewClientRequest
22{
23}
24
25#[derive(Debug, PartialEq)]
26pub struct ClientWatchAddressResponse {
27    pub address: fidl_fuchsia_net::Subnet,
28    pub address_parameters: fidl_fuchsia_net_interfaces_admin::AddressParameters,
29    pub address_state_provider:
30        fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker>,
31}
32
33impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
34    for ClientWatchAddressResponse
35{
36}
37
38#[derive(Debug, PartialEq)]
39pub struct PrefixProviderAcquirePrefixRequest {
40    pub config: AcquirePrefixConfig,
41    pub prefix: fidl::endpoints::ServerEnd<PrefixControlMarker>,
42}
43
44impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
45    for PrefixProviderAcquirePrefixRequest
46{
47}
48
49#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
50pub struct ClientMarker;
51
52impl fidl::endpoints::ProtocolMarker for ClientMarker {
53    type Proxy = ClientProxy;
54    type RequestStream = ClientRequestStream;
55    #[cfg(target_os = "fuchsia")]
56    type SynchronousProxy = ClientSynchronousProxy;
57
58    const DEBUG_NAME: &'static str = "(anonymous) Client";
59}
60pub type ClientShutdownResult = Result<(), i32>;
61
62pub trait ClientProxyInterface: Send + Sync {
63    type WatchServersResponseFut: std::future::Future<Output = Result<Vec<fidl_fuchsia_net_name::DnsServer_>, fidl::Error>>
64        + Send;
65    fn r#watch_servers(&self) -> Self::WatchServersResponseFut;
66    type WatchAddressResponseFut: std::future::Future<
67            Output = Result<
68                (
69                    fidl_fuchsia_net::Subnet,
70                    fidl_fuchsia_net_interfaces_admin::AddressParameters,
71                    fidl::endpoints::ServerEnd<
72                        fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
73                    >,
74                ),
75                fidl::Error,
76            >,
77        > + Send;
78    fn r#watch_address(&self) -> Self::WatchAddressResponseFut;
79    type WatchPrefixesResponseFut: std::future::Future<Output = Result<Vec<Prefix>, fidl::Error>>
80        + Send;
81    fn r#watch_prefixes(&self) -> Self::WatchPrefixesResponseFut;
82    type ShutdownResponseFut: std::future::Future<Output = Result<ClientShutdownResult, fidl::Error>>
83        + Send;
84    fn r#shutdown(&self) -> Self::ShutdownResponseFut;
85}
86#[derive(Debug)]
87#[cfg(target_os = "fuchsia")]
88pub struct ClientSynchronousProxy {
89    client: fidl::client::sync::Client,
90}
91
92#[cfg(target_os = "fuchsia")]
93impl fidl::endpoints::SynchronousProxy for ClientSynchronousProxy {
94    type Proxy = ClientProxy;
95    type Protocol = ClientMarker;
96
97    fn from_channel(inner: fidl::Channel) -> Self {
98        Self::new(inner)
99    }
100
101    fn into_channel(self) -> fidl::Channel {
102        self.client.into_channel()
103    }
104
105    fn as_channel(&self) -> &fidl::Channel {
106        self.client.as_channel()
107    }
108}
109
110#[cfg(target_os = "fuchsia")]
111impl ClientSynchronousProxy {
112    pub fn new(channel: fidl::Channel) -> Self {
113        let protocol_name = <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
114        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
115    }
116
117    pub fn into_channel(self) -> fidl::Channel {
118        self.client.into_channel()
119    }
120
121    /// Waits until an event arrives and returns it. It is safe for other
122    /// threads to make concurrent requests while waiting for an event.
123    pub fn wait_for_event(
124        &self,
125        deadline: zx::MonotonicInstant,
126    ) -> Result<ClientEvent, fidl::Error> {
127        ClientEvent::decode(self.client.wait_for_event(deadline)?)
128    }
129
130    /// Returns a list of DNS servers.
131    ///
132    /// First call always returns a snapshot of the current list of servers or blocks if an empty
133    /// list would be returned. Subsequent calls will block until the list of servers changes.
134    ///
135    /// The list of servers changes over time by configuration or network topology changes,
136    /// expiration, etc. Callers must repeatedly call `WatchServers` and replace any previously
137    /// returned `servers` with new ones to avoid using stale or expired entries.
138    ///
139    /// It is invalid to call this method while a previous call is pending. Doing so will cause the
140    /// server end of the protocol to be closed.
141    ///
142    /// - response `servers` The list of servers to use for DNS resolution, in priority order.
143    pub fn r#watch_servers(
144        &self,
145        ___deadline: zx::MonotonicInstant,
146    ) -> Result<Vec<fidl_fuchsia_net_name::DnsServer_>, fidl::Error> {
147        let _response = self.client.send_query::<
148            fidl::encoding::EmptyPayload,
149            fidl_fuchsia_net_name::DnsServerWatcherWatchServersResponse,
150        >(
151            (),
152            0x5748907e7f11b632,
153            fidl::encoding::DynamicFlags::empty(),
154            ___deadline,
155        )?;
156        Ok(_response.servers)
157    }
158
159    /// Returns an address and its parameters.
160    ///
161    /// Yields a value for every address acquired by the client.
162    ///
163    /// It is invalid to call this method while a previous call is pending.
164    /// Doing so will cause the server end of the protocol to be closed.
165    ///
166    /// - response `address` the assigned address.
167    /// - response `address_parameters` the parameters of the address.
168    /// - response `address_state_provider` provides address assignment state
169    ///     and enables updating address properties; client end is closed if
170    ///     the address becomes invalid (its valid lifetime expires and Renew
171    ///     and Rebind fail).
172    pub fn r#watch_address(
173        &self,
174        ___deadline: zx::MonotonicInstant,
175    ) -> Result<
176        (
177            fidl_fuchsia_net::Subnet,
178            fidl_fuchsia_net_interfaces_admin::AddressParameters,
179            fidl::endpoints::ServerEnd<
180                fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
181            >,
182        ),
183        fidl::Error,
184    > {
185        let _response =
186            self.client.send_query::<fidl::encoding::EmptyPayload, ClientWatchAddressResponse>(
187                (),
188                0x942e6f66f63721c,
189                fidl::encoding::DynamicFlags::empty(),
190                ___deadline,
191            )?;
192        Ok((_response.address, _response.address_parameters, _response.address_state_provider))
193    }
194
195    /// Hanging get for prefix leases.
196    ///
197    /// The first call to this method will return when there is at least
198    /// one lease to report (the first call is guaranteed to return with a
199    /// non-empty vector). Subsequent calls will return immediately if there
200    /// is a change to report, or block until a change occurs.
201    ///
202    /// It is invalid to call this method while a previous call is pending.
203    /// Doing so will cause the server end of the protocol to be closed.
204    ///
205    /// - response `prefixes` the assigned prefixes and their lifetimes.
206    pub fn r#watch_prefixes(
207        &self,
208        ___deadline: zx::MonotonicInstant,
209    ) -> Result<Vec<Prefix>, fidl::Error> {
210        let _response =
211            self.client.send_query::<fidl::encoding::EmptyPayload, ClientWatchPrefixesResponse>(
212                (),
213                0x3b7908cc71ae2a5e,
214                fidl::encoding::DynamicFlags::empty(),
215                ___deadline,
216            )?;
217        Ok(_response.prefixes)
218    }
219
220    /// Gracefully tears down the underlying object.
221    ///
222    /// Blocks until any held addresses are gracefully released, as described in
223    /// [RFC 8415, Section 18.2.7](https://tools.ietf.org/html/rfc8415#section-18.2.7).
224    ///
225    /// The server end of the protocol is closed after this method returns.
226    ///
227    /// * error a `zx.Status` if any of the addresses were not gracefully
228    ///     released, e.g. the client times out waiting for Reply to Release,
229    ///     or the interface is down and sending Release fails.
230    pub fn r#shutdown(
231        &self,
232        ___deadline: zx::MonotonicInstant,
233    ) -> Result<ClientShutdownResult, fidl::Error> {
234        let _response = self.client.send_query::<
235            fidl::encoding::EmptyPayload,
236            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
237        >(
238            (),
239            0x6da95f1bcd43fa11,
240            fidl::encoding::DynamicFlags::empty(),
241            ___deadline,
242        )?;
243        Ok(_response.map(|x| x))
244    }
245}
246
247#[cfg(target_os = "fuchsia")]
248impl From<ClientSynchronousProxy> for zx::Handle {
249    fn from(value: ClientSynchronousProxy) -> Self {
250        value.into_channel().into()
251    }
252}
253
254#[cfg(target_os = "fuchsia")]
255impl From<fidl::Channel> for ClientSynchronousProxy {
256    fn from(value: fidl::Channel) -> Self {
257        Self::new(value)
258    }
259}
260
261#[cfg(target_os = "fuchsia")]
262impl fidl::endpoints::FromClient for ClientSynchronousProxy {
263    type Protocol = ClientMarker;
264
265    fn from_client(value: fidl::endpoints::ClientEnd<ClientMarker>) -> Self {
266        Self::new(value.into_channel())
267    }
268}
269
270#[derive(Debug, Clone)]
271pub struct ClientProxy {
272    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
273}
274
275impl fidl::endpoints::Proxy for ClientProxy {
276    type Protocol = ClientMarker;
277
278    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
279        Self::new(inner)
280    }
281
282    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
283        self.client.into_channel().map_err(|client| Self { client })
284    }
285
286    fn as_channel(&self) -> &::fidl::AsyncChannel {
287        self.client.as_channel()
288    }
289}
290
291impl ClientProxy {
292    /// Create a new Proxy for fuchsia.net.dhcpv6/Client.
293    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
294        let protocol_name = <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
295        Self { client: fidl::client::Client::new(channel, protocol_name) }
296    }
297
298    /// Get a Stream of events from the remote end of the protocol.
299    ///
300    /// # Panics
301    ///
302    /// Panics if the event stream was already taken.
303    pub fn take_event_stream(&self) -> ClientEventStream {
304        ClientEventStream { event_receiver: self.client.take_event_receiver() }
305    }
306
307    /// Returns a list of DNS servers.
308    ///
309    /// First call always returns a snapshot of the current list of servers or blocks if an empty
310    /// list would be returned. Subsequent calls will block until the list of servers changes.
311    ///
312    /// The list of servers changes over time by configuration or network topology changes,
313    /// expiration, etc. Callers must repeatedly call `WatchServers` and replace any previously
314    /// returned `servers` with new ones to avoid using stale or expired entries.
315    ///
316    /// It is invalid to call this method while a previous call is pending. Doing so will cause the
317    /// server end of the protocol to be closed.
318    ///
319    /// - response `servers` The list of servers to use for DNS resolution, in priority order.
320    pub fn r#watch_servers(
321        &self,
322    ) -> fidl::client::QueryResponseFut<
323        Vec<fidl_fuchsia_net_name::DnsServer_>,
324        fidl::encoding::DefaultFuchsiaResourceDialect,
325    > {
326        ClientProxyInterface::r#watch_servers(self)
327    }
328
329    /// Returns an address and its parameters.
330    ///
331    /// Yields a value for every address acquired by the client.
332    ///
333    /// It is invalid to call this method while a previous call is pending.
334    /// Doing so will cause the server end of the protocol to be closed.
335    ///
336    /// - response `address` the assigned address.
337    /// - response `address_parameters` the parameters of the address.
338    /// - response `address_state_provider` provides address assignment state
339    ///     and enables updating address properties; client end is closed if
340    ///     the address becomes invalid (its valid lifetime expires and Renew
341    ///     and Rebind fail).
342    pub fn r#watch_address(
343        &self,
344    ) -> fidl::client::QueryResponseFut<
345        (
346            fidl_fuchsia_net::Subnet,
347            fidl_fuchsia_net_interfaces_admin::AddressParameters,
348            fidl::endpoints::ServerEnd<
349                fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
350            >,
351        ),
352        fidl::encoding::DefaultFuchsiaResourceDialect,
353    > {
354        ClientProxyInterface::r#watch_address(self)
355    }
356
357    /// Hanging get for prefix leases.
358    ///
359    /// The first call to this method will return when there is at least
360    /// one lease to report (the first call is guaranteed to return with a
361    /// non-empty vector). Subsequent calls will return immediately if there
362    /// is a change to report, or block until a change occurs.
363    ///
364    /// It is invalid to call this method while a previous call is pending.
365    /// Doing so will cause the server end of the protocol to be closed.
366    ///
367    /// - response `prefixes` the assigned prefixes and their lifetimes.
368    pub fn r#watch_prefixes(
369        &self,
370    ) -> fidl::client::QueryResponseFut<Vec<Prefix>, fidl::encoding::DefaultFuchsiaResourceDialect>
371    {
372        ClientProxyInterface::r#watch_prefixes(self)
373    }
374
375    /// Gracefully tears down the underlying object.
376    ///
377    /// Blocks until any held addresses are gracefully released, as described in
378    /// [RFC 8415, Section 18.2.7](https://tools.ietf.org/html/rfc8415#section-18.2.7).
379    ///
380    /// The server end of the protocol is closed after this method returns.
381    ///
382    /// * error a `zx.Status` if any of the addresses were not gracefully
383    ///     released, e.g. the client times out waiting for Reply to Release,
384    ///     or the interface is down and sending Release fails.
385    pub fn r#shutdown(
386        &self,
387    ) -> fidl::client::QueryResponseFut<
388        ClientShutdownResult,
389        fidl::encoding::DefaultFuchsiaResourceDialect,
390    > {
391        ClientProxyInterface::r#shutdown(self)
392    }
393}
394
395impl ClientProxyInterface for ClientProxy {
396    type WatchServersResponseFut = fidl::client::QueryResponseFut<
397        Vec<fidl_fuchsia_net_name::DnsServer_>,
398        fidl::encoding::DefaultFuchsiaResourceDialect,
399    >;
400    fn r#watch_servers(&self) -> Self::WatchServersResponseFut {
401        fn _decode(
402            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
403        ) -> Result<Vec<fidl_fuchsia_net_name::DnsServer_>, fidl::Error> {
404            let _response = fidl::client::decode_transaction_body::<
405                fidl_fuchsia_net_name::DnsServerWatcherWatchServersResponse,
406                fidl::encoding::DefaultFuchsiaResourceDialect,
407                0x5748907e7f11b632,
408            >(_buf?)?;
409            Ok(_response.servers)
410        }
411        self.client.send_query_and_decode::<
412            fidl::encoding::EmptyPayload,
413            Vec<fidl_fuchsia_net_name::DnsServer_>,
414        >(
415            (),
416            0x5748907e7f11b632,
417            fidl::encoding::DynamicFlags::empty(),
418            _decode,
419        )
420    }
421
422    type WatchAddressResponseFut = fidl::client::QueryResponseFut<
423        (
424            fidl_fuchsia_net::Subnet,
425            fidl_fuchsia_net_interfaces_admin::AddressParameters,
426            fidl::endpoints::ServerEnd<
427                fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
428            >,
429        ),
430        fidl::encoding::DefaultFuchsiaResourceDialect,
431    >;
432    fn r#watch_address(&self) -> Self::WatchAddressResponseFut {
433        fn _decode(
434            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
435        ) -> Result<
436            (
437                fidl_fuchsia_net::Subnet,
438                fidl_fuchsia_net_interfaces_admin::AddressParameters,
439                fidl::endpoints::ServerEnd<
440                    fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
441                >,
442            ),
443            fidl::Error,
444        > {
445            let _response = fidl::client::decode_transaction_body::<
446                ClientWatchAddressResponse,
447                fidl::encoding::DefaultFuchsiaResourceDialect,
448                0x942e6f66f63721c,
449            >(_buf?)?;
450            Ok((_response.address, _response.address_parameters, _response.address_state_provider))
451        }
452        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (
453            fidl_fuchsia_net::Subnet,
454            fidl_fuchsia_net_interfaces_admin::AddressParameters,
455            fidl::endpoints::ServerEnd<
456                fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
457            >,
458        )>((), 0x942e6f66f63721c, fidl::encoding::DynamicFlags::empty(), _decode)
459    }
460
461    type WatchPrefixesResponseFut =
462        fidl::client::QueryResponseFut<Vec<Prefix>, fidl::encoding::DefaultFuchsiaResourceDialect>;
463    fn r#watch_prefixes(&self) -> Self::WatchPrefixesResponseFut {
464        fn _decode(
465            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
466        ) -> Result<Vec<Prefix>, fidl::Error> {
467            let _response = fidl::client::decode_transaction_body::<
468                ClientWatchPrefixesResponse,
469                fidl::encoding::DefaultFuchsiaResourceDialect,
470                0x3b7908cc71ae2a5e,
471            >(_buf?)?;
472            Ok(_response.prefixes)
473        }
474        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<Prefix>>(
475            (),
476            0x3b7908cc71ae2a5e,
477            fidl::encoding::DynamicFlags::empty(),
478            _decode,
479        )
480    }
481
482    type ShutdownResponseFut = fidl::client::QueryResponseFut<
483        ClientShutdownResult,
484        fidl::encoding::DefaultFuchsiaResourceDialect,
485    >;
486    fn r#shutdown(&self) -> Self::ShutdownResponseFut {
487        fn _decode(
488            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
489        ) -> Result<ClientShutdownResult, fidl::Error> {
490            let _response = fidl::client::decode_transaction_body::<
491                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
492                fidl::encoding::DefaultFuchsiaResourceDialect,
493                0x6da95f1bcd43fa11,
494            >(_buf?)?;
495            Ok(_response.map(|x| x))
496        }
497        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ClientShutdownResult>(
498            (),
499            0x6da95f1bcd43fa11,
500            fidl::encoding::DynamicFlags::empty(),
501            _decode,
502        )
503    }
504}
505
506pub struct ClientEventStream {
507    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
508}
509
510impl std::marker::Unpin for ClientEventStream {}
511
512impl futures::stream::FusedStream for ClientEventStream {
513    fn is_terminated(&self) -> bool {
514        self.event_receiver.is_terminated()
515    }
516}
517
518impl futures::Stream for ClientEventStream {
519    type Item = Result<ClientEvent, fidl::Error>;
520
521    fn poll_next(
522        mut self: std::pin::Pin<&mut Self>,
523        cx: &mut std::task::Context<'_>,
524    ) -> std::task::Poll<Option<Self::Item>> {
525        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
526            &mut self.event_receiver,
527            cx
528        )?) {
529            Some(buf) => std::task::Poll::Ready(Some(ClientEvent::decode(buf))),
530            None => std::task::Poll::Ready(None),
531        }
532    }
533}
534
535#[derive(Debug)]
536pub enum ClientEvent {}
537
538impl ClientEvent {
539    /// Decodes a message buffer as a [`ClientEvent`].
540    fn decode(
541        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
542    ) -> Result<ClientEvent, fidl::Error> {
543        let (bytes, _handles) = buf.split_mut();
544        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
545        debug_assert_eq!(tx_header.tx_id, 0);
546        match tx_header.ordinal {
547            _ => Err(fidl::Error::UnknownOrdinal {
548                ordinal: tx_header.ordinal,
549                protocol_name: <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
550            }),
551        }
552    }
553}
554
555/// A Stream of incoming requests for fuchsia.net.dhcpv6/Client.
556pub struct ClientRequestStream {
557    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
558    is_terminated: bool,
559}
560
561impl std::marker::Unpin for ClientRequestStream {}
562
563impl futures::stream::FusedStream for ClientRequestStream {
564    fn is_terminated(&self) -> bool {
565        self.is_terminated
566    }
567}
568
569impl fidl::endpoints::RequestStream for ClientRequestStream {
570    type Protocol = ClientMarker;
571    type ControlHandle = ClientControlHandle;
572
573    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
574        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
575    }
576
577    fn control_handle(&self) -> Self::ControlHandle {
578        ClientControlHandle { inner: self.inner.clone() }
579    }
580
581    fn into_inner(
582        self,
583    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
584    {
585        (self.inner, self.is_terminated)
586    }
587
588    fn from_inner(
589        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
590        is_terminated: bool,
591    ) -> Self {
592        Self { inner, is_terminated }
593    }
594}
595
596impl futures::Stream for ClientRequestStream {
597    type Item = Result<ClientRequest, fidl::Error>;
598
599    fn poll_next(
600        mut self: std::pin::Pin<&mut Self>,
601        cx: &mut std::task::Context<'_>,
602    ) -> std::task::Poll<Option<Self::Item>> {
603        let this = &mut *self;
604        if this.inner.check_shutdown(cx) {
605            this.is_terminated = true;
606            return std::task::Poll::Ready(None);
607        }
608        if this.is_terminated {
609            panic!("polled ClientRequestStream after completion");
610        }
611        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
612            |bytes, handles| {
613                match this.inner.channel().read_etc(cx, bytes, handles) {
614                    std::task::Poll::Ready(Ok(())) => {}
615                    std::task::Poll::Pending => return std::task::Poll::Pending,
616                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
617                        this.is_terminated = true;
618                        return std::task::Poll::Ready(None);
619                    }
620                    std::task::Poll::Ready(Err(e)) => {
621                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
622                            e.into(),
623                        ))))
624                    }
625                }
626
627                // A message has been received from the channel
628                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
629
630                std::task::Poll::Ready(Some(match header.ordinal {
631                    0x5748907e7f11b632 => {
632                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
633                        let mut req = fidl::new_empty!(
634                            fidl::encoding::EmptyPayload,
635                            fidl::encoding::DefaultFuchsiaResourceDialect
636                        );
637                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
638                        let control_handle = ClientControlHandle { inner: this.inner.clone() };
639                        Ok(ClientRequest::WatchServers {
640                            responder: ClientWatchServersResponder {
641                                control_handle: std::mem::ManuallyDrop::new(control_handle),
642                                tx_id: header.tx_id,
643                            },
644                        })
645                    }
646                    0x942e6f66f63721c => {
647                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
648                        let mut req = fidl::new_empty!(
649                            fidl::encoding::EmptyPayload,
650                            fidl::encoding::DefaultFuchsiaResourceDialect
651                        );
652                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
653                        let control_handle = ClientControlHandle { inner: this.inner.clone() };
654                        Ok(ClientRequest::WatchAddress {
655                            responder: ClientWatchAddressResponder {
656                                control_handle: std::mem::ManuallyDrop::new(control_handle),
657                                tx_id: header.tx_id,
658                            },
659                        })
660                    }
661                    0x3b7908cc71ae2a5e => {
662                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
663                        let mut req = fidl::new_empty!(
664                            fidl::encoding::EmptyPayload,
665                            fidl::encoding::DefaultFuchsiaResourceDialect
666                        );
667                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
668                        let control_handle = ClientControlHandle { inner: this.inner.clone() };
669                        Ok(ClientRequest::WatchPrefixes {
670                            responder: ClientWatchPrefixesResponder {
671                                control_handle: std::mem::ManuallyDrop::new(control_handle),
672                                tx_id: header.tx_id,
673                            },
674                        })
675                    }
676                    0x6da95f1bcd43fa11 => {
677                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
678                        let mut req = fidl::new_empty!(
679                            fidl::encoding::EmptyPayload,
680                            fidl::encoding::DefaultFuchsiaResourceDialect
681                        );
682                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
683                        let control_handle = ClientControlHandle { inner: this.inner.clone() };
684                        Ok(ClientRequest::Shutdown {
685                            responder: ClientShutdownResponder {
686                                control_handle: std::mem::ManuallyDrop::new(control_handle),
687                                tx_id: header.tx_id,
688                            },
689                        })
690                    }
691                    _ => Err(fidl::Error::UnknownOrdinal {
692                        ordinal: header.ordinal,
693                        protocol_name:
694                            <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
695                    }),
696                }))
697            },
698        )
699    }
700}
701
702/// Provides methods to watch for discovered network configurations.
703///
704/// This protocol encodes the underlying object's lifetime in both directions;
705/// the underlying object is alive iff both ends of the protocol are open. That
706/// is:
707///
708/// - Closing the client end causes the object to be destroyed.
709/// - Observing a closure of the server end indicates the object no longer
710///   exists.
711#[derive(Debug)]
712pub enum ClientRequest {
713    /// Returns a list of DNS servers.
714    ///
715    /// First call always returns a snapshot of the current list of servers or blocks if an empty
716    /// list would be returned. Subsequent calls will block until the list of servers changes.
717    ///
718    /// The list of servers changes over time by configuration or network topology changes,
719    /// expiration, etc. Callers must repeatedly call `WatchServers` and replace any previously
720    /// returned `servers` with new ones to avoid using stale or expired entries.
721    ///
722    /// It is invalid to call this method while a previous call is pending. Doing so will cause the
723    /// server end of the protocol to be closed.
724    ///
725    /// - response `servers` The list of servers to use for DNS resolution, in priority order.
726    WatchServers { responder: ClientWatchServersResponder },
727    /// Returns an address and its parameters.
728    ///
729    /// Yields a value for every address acquired by the client.
730    ///
731    /// It is invalid to call this method while a previous call is pending.
732    /// Doing so will cause the server end of the protocol to be closed.
733    ///
734    /// - response `address` the assigned address.
735    /// - response `address_parameters` the parameters of the address.
736    /// - response `address_state_provider` provides address assignment state
737    ///     and enables updating address properties; client end is closed if
738    ///     the address becomes invalid (its valid lifetime expires and Renew
739    ///     and Rebind fail).
740    WatchAddress { responder: ClientWatchAddressResponder },
741    /// Hanging get for prefix leases.
742    ///
743    /// The first call to this method will return when there is at least
744    /// one lease to report (the first call is guaranteed to return with a
745    /// non-empty vector). Subsequent calls will return immediately if there
746    /// is a change to report, or block until a change occurs.
747    ///
748    /// It is invalid to call this method while a previous call is pending.
749    /// Doing so will cause the server end of the protocol to be closed.
750    ///
751    /// - response `prefixes` the assigned prefixes and their lifetimes.
752    WatchPrefixes { responder: ClientWatchPrefixesResponder },
753    /// Gracefully tears down the underlying object.
754    ///
755    /// Blocks until any held addresses are gracefully released, as described in
756    /// [RFC 8415, Section 18.2.7](https://tools.ietf.org/html/rfc8415#section-18.2.7).
757    ///
758    /// The server end of the protocol is closed after this method returns.
759    ///
760    /// * error a `zx.Status` if any of the addresses were not gracefully
761    ///     released, e.g. the client times out waiting for Reply to Release,
762    ///     or the interface is down and sending Release fails.
763    Shutdown { responder: ClientShutdownResponder },
764}
765
766impl ClientRequest {
767    #[allow(irrefutable_let_patterns)]
768    pub fn into_watch_servers(self) -> Option<(ClientWatchServersResponder)> {
769        if let ClientRequest::WatchServers { responder } = self {
770            Some((responder))
771        } else {
772            None
773        }
774    }
775
776    #[allow(irrefutable_let_patterns)]
777    pub fn into_watch_address(self) -> Option<(ClientWatchAddressResponder)> {
778        if let ClientRequest::WatchAddress { responder } = self {
779            Some((responder))
780        } else {
781            None
782        }
783    }
784
785    #[allow(irrefutable_let_patterns)]
786    pub fn into_watch_prefixes(self) -> Option<(ClientWatchPrefixesResponder)> {
787        if let ClientRequest::WatchPrefixes { responder } = self {
788            Some((responder))
789        } else {
790            None
791        }
792    }
793
794    #[allow(irrefutable_let_patterns)]
795    pub fn into_shutdown(self) -> Option<(ClientShutdownResponder)> {
796        if let ClientRequest::Shutdown { responder } = self {
797            Some((responder))
798        } else {
799            None
800        }
801    }
802
803    /// Name of the method defined in FIDL
804    pub fn method_name(&self) -> &'static str {
805        match *self {
806            ClientRequest::WatchServers { .. } => "watch_servers",
807            ClientRequest::WatchAddress { .. } => "watch_address",
808            ClientRequest::WatchPrefixes { .. } => "watch_prefixes",
809            ClientRequest::Shutdown { .. } => "shutdown",
810        }
811    }
812}
813
814#[derive(Debug, Clone)]
815pub struct ClientControlHandle {
816    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
817}
818
819impl fidl::endpoints::ControlHandle for ClientControlHandle {
820    fn shutdown(&self) {
821        self.inner.shutdown()
822    }
823    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
824        self.inner.shutdown_with_epitaph(status)
825    }
826
827    fn is_closed(&self) -> bool {
828        self.inner.channel().is_closed()
829    }
830    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
831        self.inner.channel().on_closed()
832    }
833
834    #[cfg(target_os = "fuchsia")]
835    fn signal_peer(
836        &self,
837        clear_mask: zx::Signals,
838        set_mask: zx::Signals,
839    ) -> Result<(), zx_status::Status> {
840        use fidl::Peered;
841        self.inner.channel().signal_peer(clear_mask, set_mask)
842    }
843}
844
845impl ClientControlHandle {}
846
847#[must_use = "FIDL methods require a response to be sent"]
848#[derive(Debug)]
849pub struct ClientWatchServersResponder {
850    control_handle: std::mem::ManuallyDrop<ClientControlHandle>,
851    tx_id: u32,
852}
853
854/// Set the the channel to be shutdown (see [`ClientControlHandle::shutdown`])
855/// if the responder is dropped without sending a response, so that the client
856/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
857impl std::ops::Drop for ClientWatchServersResponder {
858    fn drop(&mut self) {
859        self.control_handle.shutdown();
860        // Safety: drops once, never accessed again
861        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
862    }
863}
864
865impl fidl::endpoints::Responder for ClientWatchServersResponder {
866    type ControlHandle = ClientControlHandle;
867
868    fn control_handle(&self) -> &ClientControlHandle {
869        &self.control_handle
870    }
871
872    fn drop_without_shutdown(mut self) {
873        // Safety: drops once, never accessed again due to mem::forget
874        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
875        // Prevent Drop from running (which would shut down the channel)
876        std::mem::forget(self);
877    }
878}
879
880impl ClientWatchServersResponder {
881    /// Sends a response to the FIDL transaction.
882    ///
883    /// Sets the channel to shutdown if an error occurs.
884    pub fn send(
885        self,
886        mut servers: &[fidl_fuchsia_net_name::DnsServer_],
887    ) -> Result<(), fidl::Error> {
888        let _result = self.send_raw(servers);
889        if _result.is_err() {
890            self.control_handle.shutdown();
891        }
892        self.drop_without_shutdown();
893        _result
894    }
895
896    /// Similar to "send" but does not shutdown the channel if an error occurs.
897    pub fn send_no_shutdown_on_err(
898        self,
899        mut servers: &[fidl_fuchsia_net_name::DnsServer_],
900    ) -> Result<(), fidl::Error> {
901        let _result = self.send_raw(servers);
902        self.drop_without_shutdown();
903        _result
904    }
905
906    fn send_raw(
907        &self,
908        mut servers: &[fidl_fuchsia_net_name::DnsServer_],
909    ) -> Result<(), fidl::Error> {
910        self.control_handle
911            .inner
912            .send::<fidl_fuchsia_net_name::DnsServerWatcherWatchServersResponse>(
913                (servers,),
914                self.tx_id,
915                0x5748907e7f11b632,
916                fidl::encoding::DynamicFlags::empty(),
917            )
918    }
919}
920
921#[must_use = "FIDL methods require a response to be sent"]
922#[derive(Debug)]
923pub struct ClientWatchAddressResponder {
924    control_handle: std::mem::ManuallyDrop<ClientControlHandle>,
925    tx_id: u32,
926}
927
928/// Set the the channel to be shutdown (see [`ClientControlHandle::shutdown`])
929/// if the responder is dropped without sending a response, so that the client
930/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
931impl std::ops::Drop for ClientWatchAddressResponder {
932    fn drop(&mut self) {
933        self.control_handle.shutdown();
934        // Safety: drops once, never accessed again
935        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
936    }
937}
938
939impl fidl::endpoints::Responder for ClientWatchAddressResponder {
940    type ControlHandle = ClientControlHandle;
941
942    fn control_handle(&self) -> &ClientControlHandle {
943        &self.control_handle
944    }
945
946    fn drop_without_shutdown(mut self) {
947        // Safety: drops once, never accessed again due to mem::forget
948        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
949        // Prevent Drop from running (which would shut down the channel)
950        std::mem::forget(self);
951    }
952}
953
954impl ClientWatchAddressResponder {
955    /// Sends a response to the FIDL transaction.
956    ///
957    /// Sets the channel to shutdown if an error occurs.
958    pub fn send(
959        self,
960        mut address: &fidl_fuchsia_net::Subnet,
961        mut address_parameters: &fidl_fuchsia_net_interfaces_admin::AddressParameters,
962        mut address_state_provider: fidl::endpoints::ServerEnd<
963            fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
964        >,
965    ) -> Result<(), fidl::Error> {
966        let _result = self.send_raw(address, address_parameters, address_state_provider);
967        if _result.is_err() {
968            self.control_handle.shutdown();
969        }
970        self.drop_without_shutdown();
971        _result
972    }
973
974    /// Similar to "send" but does not shutdown the channel if an error occurs.
975    pub fn send_no_shutdown_on_err(
976        self,
977        mut address: &fidl_fuchsia_net::Subnet,
978        mut address_parameters: &fidl_fuchsia_net_interfaces_admin::AddressParameters,
979        mut address_state_provider: fidl::endpoints::ServerEnd<
980            fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
981        >,
982    ) -> Result<(), fidl::Error> {
983        let _result = self.send_raw(address, address_parameters, address_state_provider);
984        self.drop_without_shutdown();
985        _result
986    }
987
988    fn send_raw(
989        &self,
990        mut address: &fidl_fuchsia_net::Subnet,
991        mut address_parameters: &fidl_fuchsia_net_interfaces_admin::AddressParameters,
992        mut address_state_provider: fidl::endpoints::ServerEnd<
993            fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
994        >,
995    ) -> Result<(), fidl::Error> {
996        self.control_handle.inner.send::<ClientWatchAddressResponse>(
997            (address, address_parameters, address_state_provider),
998            self.tx_id,
999            0x942e6f66f63721c,
1000            fidl::encoding::DynamicFlags::empty(),
1001        )
1002    }
1003}
1004
1005#[must_use = "FIDL methods require a response to be sent"]
1006#[derive(Debug)]
1007pub struct ClientWatchPrefixesResponder {
1008    control_handle: std::mem::ManuallyDrop<ClientControlHandle>,
1009    tx_id: u32,
1010}
1011
1012/// Set the the channel to be shutdown (see [`ClientControlHandle::shutdown`])
1013/// if the responder is dropped without sending a response, so that the client
1014/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1015impl std::ops::Drop for ClientWatchPrefixesResponder {
1016    fn drop(&mut self) {
1017        self.control_handle.shutdown();
1018        // Safety: drops once, never accessed again
1019        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1020    }
1021}
1022
1023impl fidl::endpoints::Responder for ClientWatchPrefixesResponder {
1024    type ControlHandle = ClientControlHandle;
1025
1026    fn control_handle(&self) -> &ClientControlHandle {
1027        &self.control_handle
1028    }
1029
1030    fn drop_without_shutdown(mut self) {
1031        // Safety: drops once, never accessed again due to mem::forget
1032        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1033        // Prevent Drop from running (which would shut down the channel)
1034        std::mem::forget(self);
1035    }
1036}
1037
1038impl ClientWatchPrefixesResponder {
1039    /// Sends a response to the FIDL transaction.
1040    ///
1041    /// Sets the channel to shutdown if an error occurs.
1042    pub fn send(self, mut prefixes: &[Prefix]) -> Result<(), fidl::Error> {
1043        let _result = self.send_raw(prefixes);
1044        if _result.is_err() {
1045            self.control_handle.shutdown();
1046        }
1047        self.drop_without_shutdown();
1048        _result
1049    }
1050
1051    /// Similar to "send" but does not shutdown the channel if an error occurs.
1052    pub fn send_no_shutdown_on_err(self, mut prefixes: &[Prefix]) -> Result<(), fidl::Error> {
1053        let _result = self.send_raw(prefixes);
1054        self.drop_without_shutdown();
1055        _result
1056    }
1057
1058    fn send_raw(&self, mut prefixes: &[Prefix]) -> Result<(), fidl::Error> {
1059        self.control_handle.inner.send::<ClientWatchPrefixesResponse>(
1060            (prefixes,),
1061            self.tx_id,
1062            0x3b7908cc71ae2a5e,
1063            fidl::encoding::DynamicFlags::empty(),
1064        )
1065    }
1066}
1067
1068#[must_use = "FIDL methods require a response to be sent"]
1069#[derive(Debug)]
1070pub struct ClientShutdownResponder {
1071    control_handle: std::mem::ManuallyDrop<ClientControlHandle>,
1072    tx_id: u32,
1073}
1074
1075/// Set the the channel to be shutdown (see [`ClientControlHandle::shutdown`])
1076/// if the responder is dropped without sending a response, so that the client
1077/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1078impl std::ops::Drop for ClientShutdownResponder {
1079    fn drop(&mut self) {
1080        self.control_handle.shutdown();
1081        // Safety: drops once, never accessed again
1082        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1083    }
1084}
1085
1086impl fidl::endpoints::Responder for ClientShutdownResponder {
1087    type ControlHandle = ClientControlHandle;
1088
1089    fn control_handle(&self) -> &ClientControlHandle {
1090        &self.control_handle
1091    }
1092
1093    fn drop_without_shutdown(mut self) {
1094        // Safety: drops once, never accessed again due to mem::forget
1095        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1096        // Prevent Drop from running (which would shut down the channel)
1097        std::mem::forget(self);
1098    }
1099}
1100
1101impl ClientShutdownResponder {
1102    /// Sends a response to the FIDL transaction.
1103    ///
1104    /// Sets the channel to shutdown if an error occurs.
1105    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1106        let _result = self.send_raw(result);
1107        if _result.is_err() {
1108            self.control_handle.shutdown();
1109        }
1110        self.drop_without_shutdown();
1111        _result
1112    }
1113
1114    /// Similar to "send" but does not shutdown the channel if an error occurs.
1115    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1116        let _result = self.send_raw(result);
1117        self.drop_without_shutdown();
1118        _result
1119    }
1120
1121    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1122        self.control_handle
1123            .inner
1124            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1125                result,
1126                self.tx_id,
1127                0x6da95f1bcd43fa11,
1128                fidl::encoding::DynamicFlags::empty(),
1129            )
1130    }
1131}
1132
1133#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1134pub struct ClientProviderMarker;
1135
1136impl fidl::endpoints::ProtocolMarker for ClientProviderMarker {
1137    type Proxy = ClientProviderProxy;
1138    type RequestStream = ClientProviderRequestStream;
1139    #[cfg(target_os = "fuchsia")]
1140    type SynchronousProxy = ClientProviderSynchronousProxy;
1141
1142    const DEBUG_NAME: &'static str = "fuchsia.net.dhcpv6.ClientProvider";
1143}
1144impl fidl::endpoints::DiscoverableProtocolMarker for ClientProviderMarker {}
1145
1146pub trait ClientProviderProxyInterface: Send + Sync {
1147    fn r#new_client(
1148        &self,
1149        params: &NewClientParams,
1150        request: fidl::endpoints::ServerEnd<ClientMarker>,
1151    ) -> Result<(), fidl::Error>;
1152}
1153#[derive(Debug)]
1154#[cfg(target_os = "fuchsia")]
1155pub struct ClientProviderSynchronousProxy {
1156    client: fidl::client::sync::Client,
1157}
1158
1159#[cfg(target_os = "fuchsia")]
1160impl fidl::endpoints::SynchronousProxy for ClientProviderSynchronousProxy {
1161    type Proxy = ClientProviderProxy;
1162    type Protocol = ClientProviderMarker;
1163
1164    fn from_channel(inner: fidl::Channel) -> Self {
1165        Self::new(inner)
1166    }
1167
1168    fn into_channel(self) -> fidl::Channel {
1169        self.client.into_channel()
1170    }
1171
1172    fn as_channel(&self) -> &fidl::Channel {
1173        self.client.as_channel()
1174    }
1175}
1176
1177#[cfg(target_os = "fuchsia")]
1178impl ClientProviderSynchronousProxy {
1179    pub fn new(channel: fidl::Channel) -> Self {
1180        let protocol_name = <ClientProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1181        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1182    }
1183
1184    pub fn into_channel(self) -> fidl::Channel {
1185        self.client.into_channel()
1186    }
1187
1188    /// Waits until an event arrives and returns it. It is safe for other
1189    /// threads to make concurrent requests while waiting for an event.
1190    pub fn wait_for_event(
1191        &self,
1192        deadline: zx::MonotonicInstant,
1193    ) -> Result<ClientProviderEvent, fidl::Error> {
1194        ClientProviderEvent::decode(self.client.wait_for_event(deadline)?)
1195    }
1196
1197    /// Provides a DHCPv6 client.
1198    ///
1199    /// + request `params` the parameters to create the client with.
1200    /// + request `request` grants control over the client. Closed with an
1201    ///     epitaph if the client cannot be created.
1202    pub fn r#new_client(
1203        &self,
1204        mut params: &NewClientParams,
1205        mut request: fidl::endpoints::ServerEnd<ClientMarker>,
1206    ) -> Result<(), fidl::Error> {
1207        self.client.send::<ClientProviderNewClientRequest>(
1208            (params, request),
1209            0x269268c97d062419,
1210            fidl::encoding::DynamicFlags::empty(),
1211        )
1212    }
1213}
1214
1215#[cfg(target_os = "fuchsia")]
1216impl From<ClientProviderSynchronousProxy> for zx::Handle {
1217    fn from(value: ClientProviderSynchronousProxy) -> Self {
1218        value.into_channel().into()
1219    }
1220}
1221
1222#[cfg(target_os = "fuchsia")]
1223impl From<fidl::Channel> for ClientProviderSynchronousProxy {
1224    fn from(value: fidl::Channel) -> Self {
1225        Self::new(value)
1226    }
1227}
1228
1229#[cfg(target_os = "fuchsia")]
1230impl fidl::endpoints::FromClient for ClientProviderSynchronousProxy {
1231    type Protocol = ClientProviderMarker;
1232
1233    fn from_client(value: fidl::endpoints::ClientEnd<ClientProviderMarker>) -> Self {
1234        Self::new(value.into_channel())
1235    }
1236}
1237
1238#[derive(Debug, Clone)]
1239pub struct ClientProviderProxy {
1240    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1241}
1242
1243impl fidl::endpoints::Proxy for ClientProviderProxy {
1244    type Protocol = ClientProviderMarker;
1245
1246    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1247        Self::new(inner)
1248    }
1249
1250    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1251        self.client.into_channel().map_err(|client| Self { client })
1252    }
1253
1254    fn as_channel(&self) -> &::fidl::AsyncChannel {
1255        self.client.as_channel()
1256    }
1257}
1258
1259impl ClientProviderProxy {
1260    /// Create a new Proxy for fuchsia.net.dhcpv6/ClientProvider.
1261    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1262        let protocol_name = <ClientProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1263        Self { client: fidl::client::Client::new(channel, protocol_name) }
1264    }
1265
1266    /// Get a Stream of events from the remote end of the protocol.
1267    ///
1268    /// # Panics
1269    ///
1270    /// Panics if the event stream was already taken.
1271    pub fn take_event_stream(&self) -> ClientProviderEventStream {
1272        ClientProviderEventStream { event_receiver: self.client.take_event_receiver() }
1273    }
1274
1275    /// Provides a DHCPv6 client.
1276    ///
1277    /// + request `params` the parameters to create the client with.
1278    /// + request `request` grants control over the client. Closed with an
1279    ///     epitaph if the client cannot be created.
1280    pub fn r#new_client(
1281        &self,
1282        mut params: &NewClientParams,
1283        mut request: fidl::endpoints::ServerEnd<ClientMarker>,
1284    ) -> Result<(), fidl::Error> {
1285        ClientProviderProxyInterface::r#new_client(self, params, request)
1286    }
1287}
1288
1289impl ClientProviderProxyInterface for ClientProviderProxy {
1290    fn r#new_client(
1291        &self,
1292        mut params: &NewClientParams,
1293        mut request: fidl::endpoints::ServerEnd<ClientMarker>,
1294    ) -> Result<(), fidl::Error> {
1295        self.client.send::<ClientProviderNewClientRequest>(
1296            (params, request),
1297            0x269268c97d062419,
1298            fidl::encoding::DynamicFlags::empty(),
1299        )
1300    }
1301}
1302
1303pub struct ClientProviderEventStream {
1304    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1305}
1306
1307impl std::marker::Unpin for ClientProviderEventStream {}
1308
1309impl futures::stream::FusedStream for ClientProviderEventStream {
1310    fn is_terminated(&self) -> bool {
1311        self.event_receiver.is_terminated()
1312    }
1313}
1314
1315impl futures::Stream for ClientProviderEventStream {
1316    type Item = Result<ClientProviderEvent, fidl::Error>;
1317
1318    fn poll_next(
1319        mut self: std::pin::Pin<&mut Self>,
1320        cx: &mut std::task::Context<'_>,
1321    ) -> std::task::Poll<Option<Self::Item>> {
1322        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1323            &mut self.event_receiver,
1324            cx
1325        )?) {
1326            Some(buf) => std::task::Poll::Ready(Some(ClientProviderEvent::decode(buf))),
1327            None => std::task::Poll::Ready(None),
1328        }
1329    }
1330}
1331
1332#[derive(Debug)]
1333pub enum ClientProviderEvent {}
1334
1335impl ClientProviderEvent {
1336    /// Decodes a message buffer as a [`ClientProviderEvent`].
1337    fn decode(
1338        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1339    ) -> Result<ClientProviderEvent, fidl::Error> {
1340        let (bytes, _handles) = buf.split_mut();
1341        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1342        debug_assert_eq!(tx_header.tx_id, 0);
1343        match tx_header.ordinal {
1344            _ => Err(fidl::Error::UnknownOrdinal {
1345                ordinal: tx_header.ordinal,
1346                protocol_name:
1347                    <ClientProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1348            }),
1349        }
1350    }
1351}
1352
1353/// A Stream of incoming requests for fuchsia.net.dhcpv6/ClientProvider.
1354pub struct ClientProviderRequestStream {
1355    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1356    is_terminated: bool,
1357}
1358
1359impl std::marker::Unpin for ClientProviderRequestStream {}
1360
1361impl futures::stream::FusedStream for ClientProviderRequestStream {
1362    fn is_terminated(&self) -> bool {
1363        self.is_terminated
1364    }
1365}
1366
1367impl fidl::endpoints::RequestStream for ClientProviderRequestStream {
1368    type Protocol = ClientProviderMarker;
1369    type ControlHandle = ClientProviderControlHandle;
1370
1371    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1372        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1373    }
1374
1375    fn control_handle(&self) -> Self::ControlHandle {
1376        ClientProviderControlHandle { inner: self.inner.clone() }
1377    }
1378
1379    fn into_inner(
1380        self,
1381    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1382    {
1383        (self.inner, self.is_terminated)
1384    }
1385
1386    fn from_inner(
1387        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1388        is_terminated: bool,
1389    ) -> Self {
1390        Self { inner, is_terminated }
1391    }
1392}
1393
1394impl futures::Stream for ClientProviderRequestStream {
1395    type Item = Result<ClientProviderRequest, fidl::Error>;
1396
1397    fn poll_next(
1398        mut self: std::pin::Pin<&mut Self>,
1399        cx: &mut std::task::Context<'_>,
1400    ) -> std::task::Poll<Option<Self::Item>> {
1401        let this = &mut *self;
1402        if this.inner.check_shutdown(cx) {
1403            this.is_terminated = true;
1404            return std::task::Poll::Ready(None);
1405        }
1406        if this.is_terminated {
1407            panic!("polled ClientProviderRequestStream after completion");
1408        }
1409        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1410            |bytes, handles| {
1411                match this.inner.channel().read_etc(cx, bytes, handles) {
1412                    std::task::Poll::Ready(Ok(())) => {}
1413                    std::task::Poll::Pending => return std::task::Poll::Pending,
1414                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1415                        this.is_terminated = true;
1416                        return std::task::Poll::Ready(None);
1417                    }
1418                    std::task::Poll::Ready(Err(e)) => {
1419                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1420                            e.into(),
1421                        ))))
1422                    }
1423                }
1424
1425                // A message has been received from the channel
1426                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1427
1428                std::task::Poll::Ready(Some(match header.ordinal {
1429                    0x269268c97d062419 => {
1430                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1431                        let mut req = fidl::new_empty!(
1432                            ClientProviderNewClientRequest,
1433                            fidl::encoding::DefaultFuchsiaResourceDialect
1434                        );
1435                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientProviderNewClientRequest>(&header, _body_bytes, handles, &mut req)?;
1436                        let control_handle =
1437                            ClientProviderControlHandle { inner: this.inner.clone() };
1438                        Ok(ClientProviderRequest::NewClient {
1439                            params: req.params,
1440                            request: req.request,
1441
1442                            control_handle,
1443                        })
1444                    }
1445                    _ => Err(fidl::Error::UnknownOrdinal {
1446                        ordinal: header.ordinal,
1447                        protocol_name:
1448                            <ClientProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1449                    }),
1450                }))
1451            },
1452        )
1453    }
1454}
1455
1456/// Provides a method to create new clients.
1457#[derive(Debug)]
1458pub enum ClientProviderRequest {
1459    /// Provides a DHCPv6 client.
1460    ///
1461    /// + request `params` the parameters to create the client with.
1462    /// + request `request` grants control over the client. Closed with an
1463    ///     epitaph if the client cannot be created.
1464    NewClient {
1465        params: NewClientParams,
1466        request: fidl::endpoints::ServerEnd<ClientMarker>,
1467        control_handle: ClientProviderControlHandle,
1468    },
1469}
1470
1471impl ClientProviderRequest {
1472    #[allow(irrefutable_let_patterns)]
1473    pub fn into_new_client(
1474        self,
1475    ) -> Option<(
1476        NewClientParams,
1477        fidl::endpoints::ServerEnd<ClientMarker>,
1478        ClientProviderControlHandle,
1479    )> {
1480        if let ClientProviderRequest::NewClient { params, request, control_handle } = self {
1481            Some((params, request, control_handle))
1482        } else {
1483            None
1484        }
1485    }
1486
1487    /// Name of the method defined in FIDL
1488    pub fn method_name(&self) -> &'static str {
1489        match *self {
1490            ClientProviderRequest::NewClient { .. } => "new_client",
1491        }
1492    }
1493}
1494
1495#[derive(Debug, Clone)]
1496pub struct ClientProviderControlHandle {
1497    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1498}
1499
1500impl fidl::endpoints::ControlHandle for ClientProviderControlHandle {
1501    fn shutdown(&self) {
1502        self.inner.shutdown()
1503    }
1504    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1505        self.inner.shutdown_with_epitaph(status)
1506    }
1507
1508    fn is_closed(&self) -> bool {
1509        self.inner.channel().is_closed()
1510    }
1511    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1512        self.inner.channel().on_closed()
1513    }
1514
1515    #[cfg(target_os = "fuchsia")]
1516    fn signal_peer(
1517        &self,
1518        clear_mask: zx::Signals,
1519        set_mask: zx::Signals,
1520    ) -> Result<(), zx_status::Status> {
1521        use fidl::Peered;
1522        self.inner.channel().signal_peer(clear_mask, set_mask)
1523    }
1524}
1525
1526impl ClientProviderControlHandle {}
1527
1528#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1529pub struct PrefixControlMarker;
1530
1531impl fidl::endpoints::ProtocolMarker for PrefixControlMarker {
1532    type Proxy = PrefixControlProxy;
1533    type RequestStream = PrefixControlRequestStream;
1534    #[cfg(target_os = "fuchsia")]
1535    type SynchronousProxy = PrefixControlSynchronousProxy;
1536
1537    const DEBUG_NAME: &'static str = "(anonymous) PrefixControl";
1538}
1539
1540pub trait PrefixControlProxyInterface: Send + Sync {
1541    type WatchPrefixResponseFut: std::future::Future<Output = Result<PrefixEvent, fidl::Error>>
1542        + Send;
1543    fn r#watch_prefix(&self) -> Self::WatchPrefixResponseFut;
1544}
1545#[derive(Debug)]
1546#[cfg(target_os = "fuchsia")]
1547pub struct PrefixControlSynchronousProxy {
1548    client: fidl::client::sync::Client,
1549}
1550
1551#[cfg(target_os = "fuchsia")]
1552impl fidl::endpoints::SynchronousProxy for PrefixControlSynchronousProxy {
1553    type Proxy = PrefixControlProxy;
1554    type Protocol = PrefixControlMarker;
1555
1556    fn from_channel(inner: fidl::Channel) -> Self {
1557        Self::new(inner)
1558    }
1559
1560    fn into_channel(self) -> fidl::Channel {
1561        self.client.into_channel()
1562    }
1563
1564    fn as_channel(&self) -> &fidl::Channel {
1565        self.client.as_channel()
1566    }
1567}
1568
1569#[cfg(target_os = "fuchsia")]
1570impl PrefixControlSynchronousProxy {
1571    pub fn new(channel: fidl::Channel) -> Self {
1572        let protocol_name = <PrefixControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1573        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1574    }
1575
1576    pub fn into_channel(self) -> fidl::Channel {
1577        self.client.into_channel()
1578    }
1579
1580    /// Waits until an event arrives and returns it. It is safe for other
1581    /// threads to make concurrent requests while waiting for an event.
1582    pub fn wait_for_event(
1583        &self,
1584        deadline: zx::MonotonicInstant,
1585    ) -> Result<PrefixControlEvent, fidl::Error> {
1586        PrefixControlEvent::decode(self.client.wait_for_event(deadline)?)
1587    }
1588
1589    /// Hanging get for the prefix and its lifetimes.
1590    ///
1591    /// The first call to this method is guaranteed to return
1592    /// [`PrefixEvent.assigned`], and will occur when there is a prefix
1593    /// to report. Subsequent calls will return immediately if there is a
1594    /// change to report, or block until a change occurs.
1595    ///
1596    /// It is invalid to call this method while a previous call is pending.
1597    /// Doing so will cause the server end of the protocol to be closed with
1598    /// the terminal event [`PrefixControlExitReason.DOUBLE_WATCH`].
1599    ///
1600    /// - response `event` an optional prefix.
1601    pub fn r#watch_prefix(
1602        &self,
1603        ___deadline: zx::MonotonicInstant,
1604    ) -> Result<PrefixEvent, fidl::Error> {
1605        let _response = self
1606            .client
1607            .send_query::<fidl::encoding::EmptyPayload, PrefixControlWatchPrefixResponse>(
1608                (),
1609                0x1f5c40d4d1e84d84,
1610                fidl::encoding::DynamicFlags::empty(),
1611                ___deadline,
1612            )?;
1613        Ok(_response.event)
1614    }
1615}
1616
1617#[cfg(target_os = "fuchsia")]
1618impl From<PrefixControlSynchronousProxy> for zx::Handle {
1619    fn from(value: PrefixControlSynchronousProxy) -> Self {
1620        value.into_channel().into()
1621    }
1622}
1623
1624#[cfg(target_os = "fuchsia")]
1625impl From<fidl::Channel> for PrefixControlSynchronousProxy {
1626    fn from(value: fidl::Channel) -> Self {
1627        Self::new(value)
1628    }
1629}
1630
1631#[cfg(target_os = "fuchsia")]
1632impl fidl::endpoints::FromClient for PrefixControlSynchronousProxy {
1633    type Protocol = PrefixControlMarker;
1634
1635    fn from_client(value: fidl::endpoints::ClientEnd<PrefixControlMarker>) -> Self {
1636        Self::new(value.into_channel())
1637    }
1638}
1639
1640#[derive(Debug, Clone)]
1641pub struct PrefixControlProxy {
1642    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1643}
1644
1645impl fidl::endpoints::Proxy for PrefixControlProxy {
1646    type Protocol = PrefixControlMarker;
1647
1648    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1649        Self::new(inner)
1650    }
1651
1652    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1653        self.client.into_channel().map_err(|client| Self { client })
1654    }
1655
1656    fn as_channel(&self) -> &::fidl::AsyncChannel {
1657        self.client.as_channel()
1658    }
1659}
1660
1661impl PrefixControlProxy {
1662    /// Create a new Proxy for fuchsia.net.dhcpv6/PrefixControl.
1663    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1664        let protocol_name = <PrefixControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1665        Self { client: fidl::client::Client::new(channel, protocol_name) }
1666    }
1667
1668    /// Get a Stream of events from the remote end of the protocol.
1669    ///
1670    /// # Panics
1671    ///
1672    /// Panics if the event stream was already taken.
1673    pub fn take_event_stream(&self) -> PrefixControlEventStream {
1674        PrefixControlEventStream { event_receiver: self.client.take_event_receiver() }
1675    }
1676
1677    /// Hanging get for the prefix and its lifetimes.
1678    ///
1679    /// The first call to this method is guaranteed to return
1680    /// [`PrefixEvent.assigned`], and will occur when there is a prefix
1681    /// to report. Subsequent calls will return immediately if there is a
1682    /// change to report, or block until a change occurs.
1683    ///
1684    /// It is invalid to call this method while a previous call is pending.
1685    /// Doing so will cause the server end of the protocol to be closed with
1686    /// the terminal event [`PrefixControlExitReason.DOUBLE_WATCH`].
1687    ///
1688    /// - response `event` an optional prefix.
1689    pub fn r#watch_prefix(
1690        &self,
1691    ) -> fidl::client::QueryResponseFut<PrefixEvent, fidl::encoding::DefaultFuchsiaResourceDialect>
1692    {
1693        PrefixControlProxyInterface::r#watch_prefix(self)
1694    }
1695}
1696
1697impl PrefixControlProxyInterface for PrefixControlProxy {
1698    type WatchPrefixResponseFut =
1699        fidl::client::QueryResponseFut<PrefixEvent, fidl::encoding::DefaultFuchsiaResourceDialect>;
1700    fn r#watch_prefix(&self) -> Self::WatchPrefixResponseFut {
1701        fn _decode(
1702            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1703        ) -> Result<PrefixEvent, fidl::Error> {
1704            let _response = fidl::client::decode_transaction_body::<
1705                PrefixControlWatchPrefixResponse,
1706                fidl::encoding::DefaultFuchsiaResourceDialect,
1707                0x1f5c40d4d1e84d84,
1708            >(_buf?)?;
1709            Ok(_response.event)
1710        }
1711        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PrefixEvent>(
1712            (),
1713            0x1f5c40d4d1e84d84,
1714            fidl::encoding::DynamicFlags::empty(),
1715            _decode,
1716        )
1717    }
1718}
1719
1720pub struct PrefixControlEventStream {
1721    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1722}
1723
1724impl std::marker::Unpin for PrefixControlEventStream {}
1725
1726impl futures::stream::FusedStream for PrefixControlEventStream {
1727    fn is_terminated(&self) -> bool {
1728        self.event_receiver.is_terminated()
1729    }
1730}
1731
1732impl futures::Stream for PrefixControlEventStream {
1733    type Item = Result<PrefixControlEvent, fidl::Error>;
1734
1735    fn poll_next(
1736        mut self: std::pin::Pin<&mut Self>,
1737        cx: &mut std::task::Context<'_>,
1738    ) -> std::task::Poll<Option<Self::Item>> {
1739        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1740            &mut self.event_receiver,
1741            cx
1742        )?) {
1743            Some(buf) => std::task::Poll::Ready(Some(PrefixControlEvent::decode(buf))),
1744            None => std::task::Poll::Ready(None),
1745        }
1746    }
1747}
1748
1749#[derive(Debug)]
1750pub enum PrefixControlEvent {
1751    OnExit { reason: PrefixControlExitReason },
1752}
1753
1754impl PrefixControlEvent {
1755    #[allow(irrefutable_let_patterns)]
1756    pub fn into_on_exit(self) -> Option<PrefixControlExitReason> {
1757        if let PrefixControlEvent::OnExit { reason } = self {
1758            Some((reason))
1759        } else {
1760            None
1761        }
1762    }
1763
1764    /// Decodes a message buffer as a [`PrefixControlEvent`].
1765    fn decode(
1766        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1767    ) -> Result<PrefixControlEvent, fidl::Error> {
1768        let (bytes, _handles) = buf.split_mut();
1769        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1770        debug_assert_eq!(tx_header.tx_id, 0);
1771        match tx_header.ordinal {
1772            0x353b8c435cbe08f9 => {
1773                let mut out = fidl::new_empty!(
1774                    PrefixControlOnExitRequest,
1775                    fidl::encoding::DefaultFuchsiaResourceDialect
1776                );
1777                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrefixControlOnExitRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1778                Ok((PrefixControlEvent::OnExit { reason: out.reason }))
1779            }
1780            _ => Err(fidl::Error::UnknownOrdinal {
1781                ordinal: tx_header.ordinal,
1782                protocol_name: <PrefixControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1783            }),
1784        }
1785    }
1786}
1787
1788/// A Stream of incoming requests for fuchsia.net.dhcpv6/PrefixControl.
1789pub struct PrefixControlRequestStream {
1790    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1791    is_terminated: bool,
1792}
1793
1794impl std::marker::Unpin for PrefixControlRequestStream {}
1795
1796impl futures::stream::FusedStream for PrefixControlRequestStream {
1797    fn is_terminated(&self) -> bool {
1798        self.is_terminated
1799    }
1800}
1801
1802impl fidl::endpoints::RequestStream for PrefixControlRequestStream {
1803    type Protocol = PrefixControlMarker;
1804    type ControlHandle = PrefixControlControlHandle;
1805
1806    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1807        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1808    }
1809
1810    fn control_handle(&self) -> Self::ControlHandle {
1811        PrefixControlControlHandle { inner: self.inner.clone() }
1812    }
1813
1814    fn into_inner(
1815        self,
1816    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1817    {
1818        (self.inner, self.is_terminated)
1819    }
1820
1821    fn from_inner(
1822        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1823        is_terminated: bool,
1824    ) -> Self {
1825        Self { inner, is_terminated }
1826    }
1827}
1828
1829impl futures::Stream for PrefixControlRequestStream {
1830    type Item = Result<PrefixControlRequest, fidl::Error>;
1831
1832    fn poll_next(
1833        mut self: std::pin::Pin<&mut Self>,
1834        cx: &mut std::task::Context<'_>,
1835    ) -> std::task::Poll<Option<Self::Item>> {
1836        let this = &mut *self;
1837        if this.inner.check_shutdown(cx) {
1838            this.is_terminated = true;
1839            return std::task::Poll::Ready(None);
1840        }
1841        if this.is_terminated {
1842            panic!("polled PrefixControlRequestStream after completion");
1843        }
1844        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1845            |bytes, handles| {
1846                match this.inner.channel().read_etc(cx, bytes, handles) {
1847                    std::task::Poll::Ready(Ok(())) => {}
1848                    std::task::Poll::Pending => return std::task::Poll::Pending,
1849                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1850                        this.is_terminated = true;
1851                        return std::task::Poll::Ready(None);
1852                    }
1853                    std::task::Poll::Ready(Err(e)) => {
1854                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1855                            e.into(),
1856                        ))))
1857                    }
1858                }
1859
1860                // A message has been received from the channel
1861                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1862
1863                std::task::Poll::Ready(Some(match header.ordinal {
1864                    0x1f5c40d4d1e84d84 => {
1865                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1866                        let mut req = fidl::new_empty!(
1867                            fidl::encoding::EmptyPayload,
1868                            fidl::encoding::DefaultFuchsiaResourceDialect
1869                        );
1870                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1871                        let control_handle =
1872                            PrefixControlControlHandle { inner: this.inner.clone() };
1873                        Ok(PrefixControlRequest::WatchPrefix {
1874                            responder: PrefixControlWatchPrefixResponder {
1875                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1876                                tx_id: header.tx_id,
1877                            },
1878                        })
1879                    }
1880                    _ => Err(fidl::Error::UnknownOrdinal {
1881                        ordinal: header.ordinal,
1882                        protocol_name:
1883                            <PrefixControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1884                    }),
1885                }))
1886            },
1887        )
1888    }
1889}
1890
1891/// Provides control over prefix acquisition.
1892///
1893/// If the client end is closed, prefix acquisition will stop. This means that
1894/// a best effort will be made to release leases back to the server, and no
1895/// further attempt will be made to acquire any of the prefixes this protocol
1896/// was configured to acquire.
1897#[derive(Debug)]
1898pub enum PrefixControlRequest {
1899    /// Hanging get for the prefix and its lifetimes.
1900    ///
1901    /// The first call to this method is guaranteed to return
1902    /// [`PrefixEvent.assigned`], and will occur when there is a prefix
1903    /// to report. Subsequent calls will return immediately if there is a
1904    /// change to report, or block until a change occurs.
1905    ///
1906    /// It is invalid to call this method while a previous call is pending.
1907    /// Doing so will cause the server end of the protocol to be closed with
1908    /// the terminal event [`PrefixControlExitReason.DOUBLE_WATCH`].
1909    ///
1910    /// - response `event` an optional prefix.
1911    WatchPrefix { responder: PrefixControlWatchPrefixResponder },
1912}
1913
1914impl PrefixControlRequest {
1915    #[allow(irrefutable_let_patterns)]
1916    pub fn into_watch_prefix(self) -> Option<(PrefixControlWatchPrefixResponder)> {
1917        if let PrefixControlRequest::WatchPrefix { responder } = self {
1918            Some((responder))
1919        } else {
1920            None
1921        }
1922    }
1923
1924    /// Name of the method defined in FIDL
1925    pub fn method_name(&self) -> &'static str {
1926        match *self {
1927            PrefixControlRequest::WatchPrefix { .. } => "watch_prefix",
1928        }
1929    }
1930}
1931
1932#[derive(Debug, Clone)]
1933pub struct PrefixControlControlHandle {
1934    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1935}
1936
1937impl fidl::endpoints::ControlHandle for PrefixControlControlHandle {
1938    fn shutdown(&self) {
1939        self.inner.shutdown()
1940    }
1941    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1942        self.inner.shutdown_with_epitaph(status)
1943    }
1944
1945    fn is_closed(&self) -> bool {
1946        self.inner.channel().is_closed()
1947    }
1948    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1949        self.inner.channel().on_closed()
1950    }
1951
1952    #[cfg(target_os = "fuchsia")]
1953    fn signal_peer(
1954        &self,
1955        clear_mask: zx::Signals,
1956        set_mask: zx::Signals,
1957    ) -> Result<(), zx_status::Status> {
1958        use fidl::Peered;
1959        self.inner.channel().signal_peer(clear_mask, set_mask)
1960    }
1961}
1962
1963impl PrefixControlControlHandle {
1964    pub fn send_on_exit(&self, mut reason: PrefixControlExitReason) -> Result<(), fidl::Error> {
1965        self.inner.send::<PrefixControlOnExitRequest>(
1966            (reason,),
1967            0,
1968            0x353b8c435cbe08f9,
1969            fidl::encoding::DynamicFlags::empty(),
1970        )
1971    }
1972}
1973
1974#[must_use = "FIDL methods require a response to be sent"]
1975#[derive(Debug)]
1976pub struct PrefixControlWatchPrefixResponder {
1977    control_handle: std::mem::ManuallyDrop<PrefixControlControlHandle>,
1978    tx_id: u32,
1979}
1980
1981/// Set the the channel to be shutdown (see [`PrefixControlControlHandle::shutdown`])
1982/// if the responder is dropped without sending a response, so that the client
1983/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1984impl std::ops::Drop for PrefixControlWatchPrefixResponder {
1985    fn drop(&mut self) {
1986        self.control_handle.shutdown();
1987        // Safety: drops once, never accessed again
1988        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1989    }
1990}
1991
1992impl fidl::endpoints::Responder for PrefixControlWatchPrefixResponder {
1993    type ControlHandle = PrefixControlControlHandle;
1994
1995    fn control_handle(&self) -> &PrefixControlControlHandle {
1996        &self.control_handle
1997    }
1998
1999    fn drop_without_shutdown(mut self) {
2000        // Safety: drops once, never accessed again due to mem::forget
2001        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2002        // Prevent Drop from running (which would shut down the channel)
2003        std::mem::forget(self);
2004    }
2005}
2006
2007impl PrefixControlWatchPrefixResponder {
2008    /// Sends a response to the FIDL transaction.
2009    ///
2010    /// Sets the channel to shutdown if an error occurs.
2011    pub fn send(self, mut event: &PrefixEvent) -> Result<(), fidl::Error> {
2012        let _result = self.send_raw(event);
2013        if _result.is_err() {
2014            self.control_handle.shutdown();
2015        }
2016        self.drop_without_shutdown();
2017        _result
2018    }
2019
2020    /// Similar to "send" but does not shutdown the channel if an error occurs.
2021    pub fn send_no_shutdown_on_err(self, mut event: &PrefixEvent) -> Result<(), fidl::Error> {
2022        let _result = self.send_raw(event);
2023        self.drop_without_shutdown();
2024        _result
2025    }
2026
2027    fn send_raw(&self, mut event: &PrefixEvent) -> Result<(), fidl::Error> {
2028        self.control_handle.inner.send::<PrefixControlWatchPrefixResponse>(
2029            (event,),
2030            self.tx_id,
2031            0x1f5c40d4d1e84d84,
2032            fidl::encoding::DynamicFlags::empty(),
2033        )
2034    }
2035}
2036
2037#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2038pub struct PrefixProviderMarker;
2039
2040impl fidl::endpoints::ProtocolMarker for PrefixProviderMarker {
2041    type Proxy = PrefixProviderProxy;
2042    type RequestStream = PrefixProviderRequestStream;
2043    #[cfg(target_os = "fuchsia")]
2044    type SynchronousProxy = PrefixProviderSynchronousProxy;
2045
2046    const DEBUG_NAME: &'static str = "fuchsia.net.dhcpv6.PrefixProvider";
2047}
2048impl fidl::endpoints::DiscoverableProtocolMarker for PrefixProviderMarker {}
2049
2050pub trait PrefixProviderProxyInterface: Send + Sync {
2051    fn r#acquire_prefix(
2052        &self,
2053        config: &AcquirePrefixConfig,
2054        prefix: fidl::endpoints::ServerEnd<PrefixControlMarker>,
2055    ) -> Result<(), fidl::Error>;
2056}
2057#[derive(Debug)]
2058#[cfg(target_os = "fuchsia")]
2059pub struct PrefixProviderSynchronousProxy {
2060    client: fidl::client::sync::Client,
2061}
2062
2063#[cfg(target_os = "fuchsia")]
2064impl fidl::endpoints::SynchronousProxy for PrefixProviderSynchronousProxy {
2065    type Proxy = PrefixProviderProxy;
2066    type Protocol = PrefixProviderMarker;
2067
2068    fn from_channel(inner: fidl::Channel) -> Self {
2069        Self::new(inner)
2070    }
2071
2072    fn into_channel(self) -> fidl::Channel {
2073        self.client.into_channel()
2074    }
2075
2076    fn as_channel(&self) -> &fidl::Channel {
2077        self.client.as_channel()
2078    }
2079}
2080
2081#[cfg(target_os = "fuchsia")]
2082impl PrefixProviderSynchronousProxy {
2083    pub fn new(channel: fidl::Channel) -> Self {
2084        let protocol_name = <PrefixProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2085        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2086    }
2087
2088    pub fn into_channel(self) -> fidl::Channel {
2089        self.client.into_channel()
2090    }
2091
2092    /// Waits until an event arrives and returns it. It is safe for other
2093    /// threads to make concurrent requests while waiting for an event.
2094    pub fn wait_for_event(
2095        &self,
2096        deadline: zx::MonotonicInstant,
2097    ) -> Result<PrefixProviderEvent, fidl::Error> {
2098        PrefixProviderEvent::decode(self.client.wait_for_event(deadline)?)
2099    }
2100
2101    /// Acquire an IPv6 prefix via Prefix Delegation.
2102    ///
2103    /// If this method is called with invalid parameters, a terminal event
2104    /// containing a reason detailing why will be sent via
2105    /// [`PrefixControl.OnExit`] and the server end of [`PrefixControl`]
2106    /// will be closed.
2107    ///
2108    /// + request `config` prefix acquisition configuration.
2109    /// + request `prefix` provides control over prefix acquisition.
2110    pub fn r#acquire_prefix(
2111        &self,
2112        mut config: &AcquirePrefixConfig,
2113        mut prefix: fidl::endpoints::ServerEnd<PrefixControlMarker>,
2114    ) -> Result<(), fidl::Error> {
2115        self.client.send::<PrefixProviderAcquirePrefixRequest>(
2116            (config, prefix),
2117            0x24eff9a5ce404cf8,
2118            fidl::encoding::DynamicFlags::empty(),
2119        )
2120    }
2121}
2122
2123#[cfg(target_os = "fuchsia")]
2124impl From<PrefixProviderSynchronousProxy> for zx::Handle {
2125    fn from(value: PrefixProviderSynchronousProxy) -> Self {
2126        value.into_channel().into()
2127    }
2128}
2129
2130#[cfg(target_os = "fuchsia")]
2131impl From<fidl::Channel> for PrefixProviderSynchronousProxy {
2132    fn from(value: fidl::Channel) -> Self {
2133        Self::new(value)
2134    }
2135}
2136
2137#[cfg(target_os = "fuchsia")]
2138impl fidl::endpoints::FromClient for PrefixProviderSynchronousProxy {
2139    type Protocol = PrefixProviderMarker;
2140
2141    fn from_client(value: fidl::endpoints::ClientEnd<PrefixProviderMarker>) -> Self {
2142        Self::new(value.into_channel())
2143    }
2144}
2145
2146#[derive(Debug, Clone)]
2147pub struct PrefixProviderProxy {
2148    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2149}
2150
2151impl fidl::endpoints::Proxy for PrefixProviderProxy {
2152    type Protocol = PrefixProviderMarker;
2153
2154    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2155        Self::new(inner)
2156    }
2157
2158    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2159        self.client.into_channel().map_err(|client| Self { client })
2160    }
2161
2162    fn as_channel(&self) -> &::fidl::AsyncChannel {
2163        self.client.as_channel()
2164    }
2165}
2166
2167impl PrefixProviderProxy {
2168    /// Create a new Proxy for fuchsia.net.dhcpv6/PrefixProvider.
2169    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2170        let protocol_name = <PrefixProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2171        Self { client: fidl::client::Client::new(channel, protocol_name) }
2172    }
2173
2174    /// Get a Stream of events from the remote end of the protocol.
2175    ///
2176    /// # Panics
2177    ///
2178    /// Panics if the event stream was already taken.
2179    pub fn take_event_stream(&self) -> PrefixProviderEventStream {
2180        PrefixProviderEventStream { event_receiver: self.client.take_event_receiver() }
2181    }
2182
2183    /// Acquire an IPv6 prefix via Prefix Delegation.
2184    ///
2185    /// If this method is called with invalid parameters, a terminal event
2186    /// containing a reason detailing why will be sent via
2187    /// [`PrefixControl.OnExit`] and the server end of [`PrefixControl`]
2188    /// will be closed.
2189    ///
2190    /// + request `config` prefix acquisition configuration.
2191    /// + request `prefix` provides control over prefix acquisition.
2192    pub fn r#acquire_prefix(
2193        &self,
2194        mut config: &AcquirePrefixConfig,
2195        mut prefix: fidl::endpoints::ServerEnd<PrefixControlMarker>,
2196    ) -> Result<(), fidl::Error> {
2197        PrefixProviderProxyInterface::r#acquire_prefix(self, config, prefix)
2198    }
2199}
2200
2201impl PrefixProviderProxyInterface for PrefixProviderProxy {
2202    fn r#acquire_prefix(
2203        &self,
2204        mut config: &AcquirePrefixConfig,
2205        mut prefix: fidl::endpoints::ServerEnd<PrefixControlMarker>,
2206    ) -> Result<(), fidl::Error> {
2207        self.client.send::<PrefixProviderAcquirePrefixRequest>(
2208            (config, prefix),
2209            0x24eff9a5ce404cf8,
2210            fidl::encoding::DynamicFlags::empty(),
2211        )
2212    }
2213}
2214
2215pub struct PrefixProviderEventStream {
2216    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2217}
2218
2219impl std::marker::Unpin for PrefixProviderEventStream {}
2220
2221impl futures::stream::FusedStream for PrefixProviderEventStream {
2222    fn is_terminated(&self) -> bool {
2223        self.event_receiver.is_terminated()
2224    }
2225}
2226
2227impl futures::Stream for PrefixProviderEventStream {
2228    type Item = Result<PrefixProviderEvent, fidl::Error>;
2229
2230    fn poll_next(
2231        mut self: std::pin::Pin<&mut Self>,
2232        cx: &mut std::task::Context<'_>,
2233    ) -> std::task::Poll<Option<Self::Item>> {
2234        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2235            &mut self.event_receiver,
2236            cx
2237        )?) {
2238            Some(buf) => std::task::Poll::Ready(Some(PrefixProviderEvent::decode(buf))),
2239            None => std::task::Poll::Ready(None),
2240        }
2241    }
2242}
2243
2244#[derive(Debug)]
2245pub enum PrefixProviderEvent {}
2246
2247impl PrefixProviderEvent {
2248    /// Decodes a message buffer as a [`PrefixProviderEvent`].
2249    fn decode(
2250        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2251    ) -> Result<PrefixProviderEvent, fidl::Error> {
2252        let (bytes, _handles) = buf.split_mut();
2253        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2254        debug_assert_eq!(tx_header.tx_id, 0);
2255        match tx_header.ordinal {
2256            _ => Err(fidl::Error::UnknownOrdinal {
2257                ordinal: tx_header.ordinal,
2258                protocol_name:
2259                    <PrefixProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2260            }),
2261        }
2262    }
2263}
2264
2265/// A Stream of incoming requests for fuchsia.net.dhcpv6/PrefixProvider.
2266pub struct PrefixProviderRequestStream {
2267    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2268    is_terminated: bool,
2269}
2270
2271impl std::marker::Unpin for PrefixProviderRequestStream {}
2272
2273impl futures::stream::FusedStream for PrefixProviderRequestStream {
2274    fn is_terminated(&self) -> bool {
2275        self.is_terminated
2276    }
2277}
2278
2279impl fidl::endpoints::RequestStream for PrefixProviderRequestStream {
2280    type Protocol = PrefixProviderMarker;
2281    type ControlHandle = PrefixProviderControlHandle;
2282
2283    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2284        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2285    }
2286
2287    fn control_handle(&self) -> Self::ControlHandle {
2288        PrefixProviderControlHandle { inner: self.inner.clone() }
2289    }
2290
2291    fn into_inner(
2292        self,
2293    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2294    {
2295        (self.inner, self.is_terminated)
2296    }
2297
2298    fn from_inner(
2299        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2300        is_terminated: bool,
2301    ) -> Self {
2302        Self { inner, is_terminated }
2303    }
2304}
2305
2306impl futures::Stream for PrefixProviderRequestStream {
2307    type Item = Result<PrefixProviderRequest, fidl::Error>;
2308
2309    fn poll_next(
2310        mut self: std::pin::Pin<&mut Self>,
2311        cx: &mut std::task::Context<'_>,
2312    ) -> std::task::Poll<Option<Self::Item>> {
2313        let this = &mut *self;
2314        if this.inner.check_shutdown(cx) {
2315            this.is_terminated = true;
2316            return std::task::Poll::Ready(None);
2317        }
2318        if this.is_terminated {
2319            panic!("polled PrefixProviderRequestStream after completion");
2320        }
2321        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2322            |bytes, handles| {
2323                match this.inner.channel().read_etc(cx, bytes, handles) {
2324                    std::task::Poll::Ready(Ok(())) => {}
2325                    std::task::Poll::Pending => return std::task::Poll::Pending,
2326                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2327                        this.is_terminated = true;
2328                        return std::task::Poll::Ready(None);
2329                    }
2330                    std::task::Poll::Ready(Err(e)) => {
2331                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2332                            e.into(),
2333                        ))))
2334                    }
2335                }
2336
2337                // A message has been received from the channel
2338                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2339
2340                std::task::Poll::Ready(Some(match header.ordinal {
2341                    0x24eff9a5ce404cf8 => {
2342                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2343                        let mut req = fidl::new_empty!(
2344                            PrefixProviderAcquirePrefixRequest,
2345                            fidl::encoding::DefaultFuchsiaResourceDialect
2346                        );
2347                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrefixProviderAcquirePrefixRequest>(&header, _body_bytes, handles, &mut req)?;
2348                        let control_handle =
2349                            PrefixProviderControlHandle { inner: this.inner.clone() };
2350                        Ok(PrefixProviderRequest::AcquirePrefix {
2351                            config: req.config,
2352                            prefix: req.prefix,
2353
2354                            control_handle,
2355                        })
2356                    }
2357                    _ => Err(fidl::Error::UnknownOrdinal {
2358                        ordinal: header.ordinal,
2359                        protocol_name:
2360                            <PrefixProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2361                    }),
2362                }))
2363            },
2364        )
2365    }
2366}
2367
2368/// Provides IPv6 prefixes acquired via Prefix delegation.
2369#[derive(Debug)]
2370pub enum PrefixProviderRequest {
2371    /// Acquire an IPv6 prefix via Prefix Delegation.
2372    ///
2373    /// If this method is called with invalid parameters, a terminal event
2374    /// containing a reason detailing why will be sent via
2375    /// [`PrefixControl.OnExit`] and the server end of [`PrefixControl`]
2376    /// will be closed.
2377    ///
2378    /// + request `config` prefix acquisition configuration.
2379    /// + request `prefix` provides control over prefix acquisition.
2380    AcquirePrefix {
2381        config: AcquirePrefixConfig,
2382        prefix: fidl::endpoints::ServerEnd<PrefixControlMarker>,
2383        control_handle: PrefixProviderControlHandle,
2384    },
2385}
2386
2387impl PrefixProviderRequest {
2388    #[allow(irrefutable_let_patterns)]
2389    pub fn into_acquire_prefix(
2390        self,
2391    ) -> Option<(
2392        AcquirePrefixConfig,
2393        fidl::endpoints::ServerEnd<PrefixControlMarker>,
2394        PrefixProviderControlHandle,
2395    )> {
2396        if let PrefixProviderRequest::AcquirePrefix { config, prefix, control_handle } = self {
2397            Some((config, prefix, control_handle))
2398        } else {
2399            None
2400        }
2401    }
2402
2403    /// Name of the method defined in FIDL
2404    pub fn method_name(&self) -> &'static str {
2405        match *self {
2406            PrefixProviderRequest::AcquirePrefix { .. } => "acquire_prefix",
2407        }
2408    }
2409}
2410
2411#[derive(Debug, Clone)]
2412pub struct PrefixProviderControlHandle {
2413    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2414}
2415
2416impl fidl::endpoints::ControlHandle for PrefixProviderControlHandle {
2417    fn shutdown(&self) {
2418        self.inner.shutdown()
2419    }
2420    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2421        self.inner.shutdown_with_epitaph(status)
2422    }
2423
2424    fn is_closed(&self) -> bool {
2425        self.inner.channel().is_closed()
2426    }
2427    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2428        self.inner.channel().on_closed()
2429    }
2430
2431    #[cfg(target_os = "fuchsia")]
2432    fn signal_peer(
2433        &self,
2434        clear_mask: zx::Signals,
2435        set_mask: zx::Signals,
2436    ) -> Result<(), zx_status::Status> {
2437        use fidl::Peered;
2438        self.inner.channel().signal_peer(clear_mask, set_mask)
2439    }
2440}
2441
2442impl PrefixProviderControlHandle {}
2443
2444mod internal {
2445    use super::*;
2446
2447    impl fidl::encoding::ResourceTypeMarker for ClientProviderNewClientRequest {
2448        type Borrowed<'a> = &'a mut Self;
2449        fn take_or_borrow<'a>(
2450            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2451        ) -> Self::Borrowed<'a> {
2452            value
2453        }
2454    }
2455
2456    unsafe impl fidl::encoding::TypeMarker for ClientProviderNewClientRequest {
2457        type Owned = Self;
2458
2459        #[inline(always)]
2460        fn inline_align(_context: fidl::encoding::Context) -> usize {
2461            8
2462        }
2463
2464        #[inline(always)]
2465        fn inline_size(_context: fidl::encoding::Context) -> usize {
2466            24
2467        }
2468    }
2469
2470    unsafe impl
2471        fidl::encoding::Encode<
2472            ClientProviderNewClientRequest,
2473            fidl::encoding::DefaultFuchsiaResourceDialect,
2474        > for &mut ClientProviderNewClientRequest
2475    {
2476        #[inline]
2477        unsafe fn encode(
2478            self,
2479            encoder: &mut fidl::encoding::Encoder<
2480                '_,
2481                fidl::encoding::DefaultFuchsiaResourceDialect,
2482            >,
2483            offset: usize,
2484            _depth: fidl::encoding::Depth,
2485        ) -> fidl::Result<()> {
2486            encoder.debug_check_bounds::<ClientProviderNewClientRequest>(offset);
2487            // Delegate to tuple encoding.
2488            fidl::encoding::Encode::<ClientProviderNewClientRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2489                (
2490                    <NewClientParams as fidl::encoding::ValueTypeMarker>::borrow(&self.params),
2491                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
2492                ),
2493                encoder, offset, _depth
2494            )
2495        }
2496    }
2497    unsafe impl<
2498            T0: fidl::encoding::Encode<NewClientParams, fidl::encoding::DefaultFuchsiaResourceDialect>,
2499            T1: fidl::encoding::Encode<
2500                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientMarker>>,
2501                fidl::encoding::DefaultFuchsiaResourceDialect,
2502            >,
2503        >
2504        fidl::encoding::Encode<
2505            ClientProviderNewClientRequest,
2506            fidl::encoding::DefaultFuchsiaResourceDialect,
2507        > for (T0, T1)
2508    {
2509        #[inline]
2510        unsafe fn encode(
2511            self,
2512            encoder: &mut fidl::encoding::Encoder<
2513                '_,
2514                fidl::encoding::DefaultFuchsiaResourceDialect,
2515            >,
2516            offset: usize,
2517            depth: fidl::encoding::Depth,
2518        ) -> fidl::Result<()> {
2519            encoder.debug_check_bounds::<ClientProviderNewClientRequest>(offset);
2520            // Zero out padding regions. There's no need to apply masks
2521            // because the unmasked parts will be overwritten by fields.
2522            unsafe {
2523                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2524                (ptr as *mut u64).write_unaligned(0);
2525            }
2526            // Write the fields.
2527            self.0.encode(encoder, offset + 0, depth)?;
2528            self.1.encode(encoder, offset + 16, depth)?;
2529            Ok(())
2530        }
2531    }
2532
2533    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2534        for ClientProviderNewClientRequest
2535    {
2536        #[inline(always)]
2537        fn new_empty() -> Self {
2538            Self {
2539                params: fidl::new_empty!(
2540                    NewClientParams,
2541                    fidl::encoding::DefaultFuchsiaResourceDialect
2542                ),
2543                request: fidl::new_empty!(
2544                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientMarker>>,
2545                    fidl::encoding::DefaultFuchsiaResourceDialect
2546                ),
2547            }
2548        }
2549
2550        #[inline]
2551        unsafe fn decode(
2552            &mut self,
2553            decoder: &mut fidl::encoding::Decoder<
2554                '_,
2555                fidl::encoding::DefaultFuchsiaResourceDialect,
2556            >,
2557            offset: usize,
2558            _depth: fidl::encoding::Depth,
2559        ) -> fidl::Result<()> {
2560            decoder.debug_check_bounds::<Self>(offset);
2561            // Verify that padding bytes are zero.
2562            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2563            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2564            let mask = 0xffffffff00000000u64;
2565            let maskedval = padval & mask;
2566            if maskedval != 0 {
2567                return Err(fidl::Error::NonZeroPadding {
2568                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2569                });
2570            }
2571            fidl::decode!(
2572                NewClientParams,
2573                fidl::encoding::DefaultFuchsiaResourceDialect,
2574                &mut self.params,
2575                decoder,
2576                offset + 0,
2577                _depth
2578            )?;
2579            fidl::decode!(
2580                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientMarker>>,
2581                fidl::encoding::DefaultFuchsiaResourceDialect,
2582                &mut self.request,
2583                decoder,
2584                offset + 16,
2585                _depth
2586            )?;
2587            Ok(())
2588        }
2589    }
2590
2591    impl fidl::encoding::ResourceTypeMarker for ClientWatchAddressResponse {
2592        type Borrowed<'a> = &'a mut Self;
2593        fn take_or_borrow<'a>(
2594            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2595        ) -> Self::Borrowed<'a> {
2596            value
2597        }
2598    }
2599
2600    unsafe impl fidl::encoding::TypeMarker for ClientWatchAddressResponse {
2601        type Owned = Self;
2602
2603        #[inline(always)]
2604        fn inline_align(_context: fidl::encoding::Context) -> usize {
2605            8
2606        }
2607
2608        #[inline(always)]
2609        fn inline_size(_context: fidl::encoding::Context) -> usize {
2610            48
2611        }
2612    }
2613
2614    unsafe impl
2615        fidl::encoding::Encode<
2616            ClientWatchAddressResponse,
2617            fidl::encoding::DefaultFuchsiaResourceDialect,
2618        > for &mut ClientWatchAddressResponse
2619    {
2620        #[inline]
2621        unsafe fn encode(
2622            self,
2623            encoder: &mut fidl::encoding::Encoder<
2624                '_,
2625                fidl::encoding::DefaultFuchsiaResourceDialect,
2626            >,
2627            offset: usize,
2628            _depth: fidl::encoding::Depth,
2629        ) -> fidl::Result<()> {
2630            encoder.debug_check_bounds::<ClientWatchAddressResponse>(offset);
2631            // Delegate to tuple encoding.
2632            fidl::encoding::Encode::<ClientWatchAddressResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2633                (
2634                    <fidl_fuchsia_net::Subnet as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
2635                    <fidl_fuchsia_net_interfaces_admin::AddressParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.address_parameters),
2636                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.address_state_provider),
2637                ),
2638                encoder, offset, _depth
2639            )
2640        }
2641    }
2642    unsafe impl<
2643            T0: fidl::encoding::Encode<
2644                fidl_fuchsia_net::Subnet,
2645                fidl::encoding::DefaultFuchsiaResourceDialect,
2646            >,
2647            T1: fidl::encoding::Encode<
2648                fidl_fuchsia_net_interfaces_admin::AddressParameters,
2649                fidl::encoding::DefaultFuchsiaResourceDialect,
2650            >,
2651            T2: fidl::encoding::Encode<
2652                fidl::encoding::Endpoint<
2653                    fidl::endpoints::ServerEnd<
2654                        fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
2655                    >,
2656                >,
2657                fidl::encoding::DefaultFuchsiaResourceDialect,
2658            >,
2659        >
2660        fidl::encoding::Encode<
2661            ClientWatchAddressResponse,
2662            fidl::encoding::DefaultFuchsiaResourceDialect,
2663        > for (T0, T1, T2)
2664    {
2665        #[inline]
2666        unsafe fn encode(
2667            self,
2668            encoder: &mut fidl::encoding::Encoder<
2669                '_,
2670                fidl::encoding::DefaultFuchsiaResourceDialect,
2671            >,
2672            offset: usize,
2673            depth: fidl::encoding::Depth,
2674        ) -> fidl::Result<()> {
2675            encoder.debug_check_bounds::<ClientWatchAddressResponse>(offset);
2676            // Zero out padding regions. There's no need to apply masks
2677            // because the unmasked parts will be overwritten by fields.
2678            unsafe {
2679                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
2680                (ptr as *mut u64).write_unaligned(0);
2681            }
2682            // Write the fields.
2683            self.0.encode(encoder, offset + 0, depth)?;
2684            self.1.encode(encoder, offset + 24, depth)?;
2685            self.2.encode(encoder, offset + 40, depth)?;
2686            Ok(())
2687        }
2688    }
2689
2690    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2691        for ClientWatchAddressResponse
2692    {
2693        #[inline(always)]
2694        fn new_empty() -> Self {
2695            Self {
2696                address: fidl::new_empty!(
2697                    fidl_fuchsia_net::Subnet,
2698                    fidl::encoding::DefaultFuchsiaResourceDialect
2699                ),
2700                address_parameters: fidl::new_empty!(
2701                    fidl_fuchsia_net_interfaces_admin::AddressParameters,
2702                    fidl::encoding::DefaultFuchsiaResourceDialect
2703                ),
2704                address_state_provider: fidl::new_empty!(
2705                    fidl::encoding::Endpoint<
2706                        fidl::endpoints::ServerEnd<
2707                            fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
2708                        >,
2709                    >,
2710                    fidl::encoding::DefaultFuchsiaResourceDialect
2711                ),
2712            }
2713        }
2714
2715        #[inline]
2716        unsafe fn decode(
2717            &mut self,
2718            decoder: &mut fidl::encoding::Decoder<
2719                '_,
2720                fidl::encoding::DefaultFuchsiaResourceDialect,
2721            >,
2722            offset: usize,
2723            _depth: fidl::encoding::Depth,
2724        ) -> fidl::Result<()> {
2725            decoder.debug_check_bounds::<Self>(offset);
2726            // Verify that padding bytes are zero.
2727            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
2728            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2729            let mask = 0xffffffff00000000u64;
2730            let maskedval = padval & mask;
2731            if maskedval != 0 {
2732                return Err(fidl::Error::NonZeroPadding {
2733                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
2734                });
2735            }
2736            fidl::decode!(
2737                fidl_fuchsia_net::Subnet,
2738                fidl::encoding::DefaultFuchsiaResourceDialect,
2739                &mut self.address,
2740                decoder,
2741                offset + 0,
2742                _depth
2743            )?;
2744            fidl::decode!(
2745                fidl_fuchsia_net_interfaces_admin::AddressParameters,
2746                fidl::encoding::DefaultFuchsiaResourceDialect,
2747                &mut self.address_parameters,
2748                decoder,
2749                offset + 24,
2750                _depth
2751            )?;
2752            fidl::decode!(
2753                fidl::encoding::Endpoint<
2754                    fidl::endpoints::ServerEnd<
2755                        fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
2756                    >,
2757                >,
2758                fidl::encoding::DefaultFuchsiaResourceDialect,
2759                &mut self.address_state_provider,
2760                decoder,
2761                offset + 40,
2762                _depth
2763            )?;
2764            Ok(())
2765        }
2766    }
2767
2768    impl fidl::encoding::ResourceTypeMarker for PrefixProviderAcquirePrefixRequest {
2769        type Borrowed<'a> = &'a mut Self;
2770        fn take_or_borrow<'a>(
2771            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2772        ) -> Self::Borrowed<'a> {
2773            value
2774        }
2775    }
2776
2777    unsafe impl fidl::encoding::TypeMarker for PrefixProviderAcquirePrefixRequest {
2778        type Owned = Self;
2779
2780        #[inline(always)]
2781        fn inline_align(_context: fidl::encoding::Context) -> usize {
2782            8
2783        }
2784
2785        #[inline(always)]
2786        fn inline_size(_context: fidl::encoding::Context) -> usize {
2787            24
2788        }
2789    }
2790
2791    unsafe impl
2792        fidl::encoding::Encode<
2793            PrefixProviderAcquirePrefixRequest,
2794            fidl::encoding::DefaultFuchsiaResourceDialect,
2795        > for &mut PrefixProviderAcquirePrefixRequest
2796    {
2797        #[inline]
2798        unsafe fn encode(
2799            self,
2800            encoder: &mut fidl::encoding::Encoder<
2801                '_,
2802                fidl::encoding::DefaultFuchsiaResourceDialect,
2803            >,
2804            offset: usize,
2805            _depth: fidl::encoding::Depth,
2806        ) -> fidl::Result<()> {
2807            encoder.debug_check_bounds::<PrefixProviderAcquirePrefixRequest>(offset);
2808            // Delegate to tuple encoding.
2809            fidl::encoding::Encode::<PrefixProviderAcquirePrefixRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2810                (
2811                    <AcquirePrefixConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
2812                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrefixControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.prefix),
2813                ),
2814                encoder, offset, _depth
2815            )
2816        }
2817    }
2818    unsafe impl<
2819            T0: fidl::encoding::Encode<
2820                AcquirePrefixConfig,
2821                fidl::encoding::DefaultFuchsiaResourceDialect,
2822            >,
2823            T1: fidl::encoding::Encode<
2824                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrefixControlMarker>>,
2825                fidl::encoding::DefaultFuchsiaResourceDialect,
2826            >,
2827        >
2828        fidl::encoding::Encode<
2829            PrefixProviderAcquirePrefixRequest,
2830            fidl::encoding::DefaultFuchsiaResourceDialect,
2831        > for (T0, T1)
2832    {
2833        #[inline]
2834        unsafe fn encode(
2835            self,
2836            encoder: &mut fidl::encoding::Encoder<
2837                '_,
2838                fidl::encoding::DefaultFuchsiaResourceDialect,
2839            >,
2840            offset: usize,
2841            depth: fidl::encoding::Depth,
2842        ) -> fidl::Result<()> {
2843            encoder.debug_check_bounds::<PrefixProviderAcquirePrefixRequest>(offset);
2844            // Zero out padding regions. There's no need to apply masks
2845            // because the unmasked parts will be overwritten by fields.
2846            unsafe {
2847                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2848                (ptr as *mut u64).write_unaligned(0);
2849            }
2850            // Write the fields.
2851            self.0.encode(encoder, offset + 0, depth)?;
2852            self.1.encode(encoder, offset + 16, depth)?;
2853            Ok(())
2854        }
2855    }
2856
2857    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2858        for PrefixProviderAcquirePrefixRequest
2859    {
2860        #[inline(always)]
2861        fn new_empty() -> Self {
2862            Self {
2863                config: fidl::new_empty!(
2864                    AcquirePrefixConfig,
2865                    fidl::encoding::DefaultFuchsiaResourceDialect
2866                ),
2867                prefix: fidl::new_empty!(
2868                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrefixControlMarker>>,
2869                    fidl::encoding::DefaultFuchsiaResourceDialect
2870                ),
2871            }
2872        }
2873
2874        #[inline]
2875        unsafe fn decode(
2876            &mut self,
2877            decoder: &mut fidl::encoding::Decoder<
2878                '_,
2879                fidl::encoding::DefaultFuchsiaResourceDialect,
2880            >,
2881            offset: usize,
2882            _depth: fidl::encoding::Depth,
2883        ) -> fidl::Result<()> {
2884            decoder.debug_check_bounds::<Self>(offset);
2885            // Verify that padding bytes are zero.
2886            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2887            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2888            let mask = 0xffffffff00000000u64;
2889            let maskedval = padval & mask;
2890            if maskedval != 0 {
2891                return Err(fidl::Error::NonZeroPadding {
2892                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2893                });
2894            }
2895            fidl::decode!(
2896                AcquirePrefixConfig,
2897                fidl::encoding::DefaultFuchsiaResourceDialect,
2898                &mut self.config,
2899                decoder,
2900                offset + 0,
2901                _depth
2902            )?;
2903            fidl::decode!(
2904                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrefixControlMarker>>,
2905                fidl::encoding::DefaultFuchsiaResourceDialect,
2906                &mut self.prefix,
2907                decoder,
2908                offset + 16,
2909                _depth
2910            )?;
2911            Ok(())
2912        }
2913    }
2914}