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 { Some((responder)) } else { None }
770    }
771
772    #[allow(irrefutable_let_patterns)]
773    pub fn into_watch_address(self) -> Option<(ClientWatchAddressResponder)> {
774        if let ClientRequest::WatchAddress { responder } = self { Some((responder)) } else { None }
775    }
776
777    #[allow(irrefutable_let_patterns)]
778    pub fn into_watch_prefixes(self) -> Option<(ClientWatchPrefixesResponder)> {
779        if let ClientRequest::WatchPrefixes { responder } = self { Some((responder)) } else { None }
780    }
781
782    #[allow(irrefutable_let_patterns)]
783    pub fn into_shutdown(self) -> Option<(ClientShutdownResponder)> {
784        if let ClientRequest::Shutdown { responder } = self { Some((responder)) } else { None }
785    }
786
787    /// Name of the method defined in FIDL
788    pub fn method_name(&self) -> &'static str {
789        match *self {
790            ClientRequest::WatchServers { .. } => "watch_servers",
791            ClientRequest::WatchAddress { .. } => "watch_address",
792            ClientRequest::WatchPrefixes { .. } => "watch_prefixes",
793            ClientRequest::Shutdown { .. } => "shutdown",
794        }
795    }
796}
797
798#[derive(Debug, Clone)]
799pub struct ClientControlHandle {
800    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
801}
802
803impl fidl::endpoints::ControlHandle for ClientControlHandle {
804    fn shutdown(&self) {
805        self.inner.shutdown()
806    }
807    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
808        self.inner.shutdown_with_epitaph(status)
809    }
810
811    fn is_closed(&self) -> bool {
812        self.inner.channel().is_closed()
813    }
814    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
815        self.inner.channel().on_closed()
816    }
817
818    #[cfg(target_os = "fuchsia")]
819    fn signal_peer(
820        &self,
821        clear_mask: zx::Signals,
822        set_mask: zx::Signals,
823    ) -> Result<(), zx_status::Status> {
824        use fidl::Peered;
825        self.inner.channel().signal_peer(clear_mask, set_mask)
826    }
827}
828
829impl ClientControlHandle {}
830
831#[must_use = "FIDL methods require a response to be sent"]
832#[derive(Debug)]
833pub struct ClientWatchServersResponder {
834    control_handle: std::mem::ManuallyDrop<ClientControlHandle>,
835    tx_id: u32,
836}
837
838/// Set the the channel to be shutdown (see [`ClientControlHandle::shutdown`])
839/// if the responder is dropped without sending a response, so that the client
840/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
841impl std::ops::Drop for ClientWatchServersResponder {
842    fn drop(&mut self) {
843        self.control_handle.shutdown();
844        // Safety: drops once, never accessed again
845        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
846    }
847}
848
849impl fidl::endpoints::Responder for ClientWatchServersResponder {
850    type ControlHandle = ClientControlHandle;
851
852    fn control_handle(&self) -> &ClientControlHandle {
853        &self.control_handle
854    }
855
856    fn drop_without_shutdown(mut self) {
857        // Safety: drops once, never accessed again due to mem::forget
858        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
859        // Prevent Drop from running (which would shut down the channel)
860        std::mem::forget(self);
861    }
862}
863
864impl ClientWatchServersResponder {
865    /// Sends a response to the FIDL transaction.
866    ///
867    /// Sets the channel to shutdown if an error occurs.
868    pub fn send(
869        self,
870        mut servers: &[fidl_fuchsia_net_name::DnsServer_],
871    ) -> Result<(), fidl::Error> {
872        let _result = self.send_raw(servers);
873        if _result.is_err() {
874            self.control_handle.shutdown();
875        }
876        self.drop_without_shutdown();
877        _result
878    }
879
880    /// Similar to "send" but does not shutdown the channel if an error occurs.
881    pub fn send_no_shutdown_on_err(
882        self,
883        mut servers: &[fidl_fuchsia_net_name::DnsServer_],
884    ) -> Result<(), fidl::Error> {
885        let _result = self.send_raw(servers);
886        self.drop_without_shutdown();
887        _result
888    }
889
890    fn send_raw(
891        &self,
892        mut servers: &[fidl_fuchsia_net_name::DnsServer_],
893    ) -> Result<(), fidl::Error> {
894        self.control_handle
895            .inner
896            .send::<fidl_fuchsia_net_name::DnsServerWatcherWatchServersResponse>(
897                (servers,),
898                self.tx_id,
899                0x5748907e7f11b632,
900                fidl::encoding::DynamicFlags::empty(),
901            )
902    }
903}
904
905#[must_use = "FIDL methods require a response to be sent"]
906#[derive(Debug)]
907pub struct ClientWatchAddressResponder {
908    control_handle: std::mem::ManuallyDrop<ClientControlHandle>,
909    tx_id: u32,
910}
911
912/// Set the the channel to be shutdown (see [`ClientControlHandle::shutdown`])
913/// if the responder is dropped without sending a response, so that the client
914/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
915impl std::ops::Drop for ClientWatchAddressResponder {
916    fn drop(&mut self) {
917        self.control_handle.shutdown();
918        // Safety: drops once, never accessed again
919        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
920    }
921}
922
923impl fidl::endpoints::Responder for ClientWatchAddressResponder {
924    type ControlHandle = ClientControlHandle;
925
926    fn control_handle(&self) -> &ClientControlHandle {
927        &self.control_handle
928    }
929
930    fn drop_without_shutdown(mut self) {
931        // Safety: drops once, never accessed again due to mem::forget
932        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
933        // Prevent Drop from running (which would shut down the channel)
934        std::mem::forget(self);
935    }
936}
937
938impl ClientWatchAddressResponder {
939    /// Sends a response to the FIDL transaction.
940    ///
941    /// Sets the channel to shutdown if an error occurs.
942    pub fn send(
943        self,
944        mut address: &fidl_fuchsia_net::Subnet,
945        mut address_parameters: &fidl_fuchsia_net_interfaces_admin::AddressParameters,
946        mut address_state_provider: fidl::endpoints::ServerEnd<
947            fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
948        >,
949    ) -> Result<(), fidl::Error> {
950        let _result = self.send_raw(address, address_parameters, address_state_provider);
951        if _result.is_err() {
952            self.control_handle.shutdown();
953        }
954        self.drop_without_shutdown();
955        _result
956    }
957
958    /// Similar to "send" but does not shutdown the channel if an error occurs.
959    pub fn send_no_shutdown_on_err(
960        self,
961        mut address: &fidl_fuchsia_net::Subnet,
962        mut address_parameters: &fidl_fuchsia_net_interfaces_admin::AddressParameters,
963        mut address_state_provider: fidl::endpoints::ServerEnd<
964            fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
965        >,
966    ) -> Result<(), fidl::Error> {
967        let _result = self.send_raw(address, address_parameters, address_state_provider);
968        self.drop_without_shutdown();
969        _result
970    }
971
972    fn send_raw(
973        &self,
974        mut address: &fidl_fuchsia_net::Subnet,
975        mut address_parameters: &fidl_fuchsia_net_interfaces_admin::AddressParameters,
976        mut address_state_provider: fidl::endpoints::ServerEnd<
977            fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
978        >,
979    ) -> Result<(), fidl::Error> {
980        self.control_handle.inner.send::<ClientWatchAddressResponse>(
981            (address, address_parameters, address_state_provider),
982            self.tx_id,
983            0x942e6f66f63721c,
984            fidl::encoding::DynamicFlags::empty(),
985        )
986    }
987}
988
989#[must_use = "FIDL methods require a response to be sent"]
990#[derive(Debug)]
991pub struct ClientWatchPrefixesResponder {
992    control_handle: std::mem::ManuallyDrop<ClientControlHandle>,
993    tx_id: u32,
994}
995
996/// Set the the channel to be shutdown (see [`ClientControlHandle::shutdown`])
997/// if the responder is dropped without sending a response, so that the client
998/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
999impl std::ops::Drop for ClientWatchPrefixesResponder {
1000    fn drop(&mut self) {
1001        self.control_handle.shutdown();
1002        // Safety: drops once, never accessed again
1003        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1004    }
1005}
1006
1007impl fidl::endpoints::Responder for ClientWatchPrefixesResponder {
1008    type ControlHandle = ClientControlHandle;
1009
1010    fn control_handle(&self) -> &ClientControlHandle {
1011        &self.control_handle
1012    }
1013
1014    fn drop_without_shutdown(mut self) {
1015        // Safety: drops once, never accessed again due to mem::forget
1016        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1017        // Prevent Drop from running (which would shut down the channel)
1018        std::mem::forget(self);
1019    }
1020}
1021
1022impl ClientWatchPrefixesResponder {
1023    /// Sends a response to the FIDL transaction.
1024    ///
1025    /// Sets the channel to shutdown if an error occurs.
1026    pub fn send(self, mut prefixes: &[Prefix]) -> Result<(), fidl::Error> {
1027        let _result = self.send_raw(prefixes);
1028        if _result.is_err() {
1029            self.control_handle.shutdown();
1030        }
1031        self.drop_without_shutdown();
1032        _result
1033    }
1034
1035    /// Similar to "send" but does not shutdown the channel if an error occurs.
1036    pub fn send_no_shutdown_on_err(self, mut prefixes: &[Prefix]) -> Result<(), fidl::Error> {
1037        let _result = self.send_raw(prefixes);
1038        self.drop_without_shutdown();
1039        _result
1040    }
1041
1042    fn send_raw(&self, mut prefixes: &[Prefix]) -> Result<(), fidl::Error> {
1043        self.control_handle.inner.send::<ClientWatchPrefixesResponse>(
1044            (prefixes,),
1045            self.tx_id,
1046            0x3b7908cc71ae2a5e,
1047            fidl::encoding::DynamicFlags::empty(),
1048        )
1049    }
1050}
1051
1052#[must_use = "FIDL methods require a response to be sent"]
1053#[derive(Debug)]
1054pub struct ClientShutdownResponder {
1055    control_handle: std::mem::ManuallyDrop<ClientControlHandle>,
1056    tx_id: u32,
1057}
1058
1059/// Set the the channel to be shutdown (see [`ClientControlHandle::shutdown`])
1060/// if the responder is dropped without sending a response, so that the client
1061/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1062impl std::ops::Drop for ClientShutdownResponder {
1063    fn drop(&mut self) {
1064        self.control_handle.shutdown();
1065        // Safety: drops once, never accessed again
1066        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1067    }
1068}
1069
1070impl fidl::endpoints::Responder for ClientShutdownResponder {
1071    type ControlHandle = ClientControlHandle;
1072
1073    fn control_handle(&self) -> &ClientControlHandle {
1074        &self.control_handle
1075    }
1076
1077    fn drop_without_shutdown(mut self) {
1078        // Safety: drops once, never accessed again due to mem::forget
1079        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1080        // Prevent Drop from running (which would shut down the channel)
1081        std::mem::forget(self);
1082    }
1083}
1084
1085impl ClientShutdownResponder {
1086    /// Sends a response to the FIDL transaction.
1087    ///
1088    /// Sets the channel to shutdown if an error occurs.
1089    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1090        let _result = self.send_raw(result);
1091        if _result.is_err() {
1092            self.control_handle.shutdown();
1093        }
1094        self.drop_without_shutdown();
1095        _result
1096    }
1097
1098    /// Similar to "send" but does not shutdown the channel if an error occurs.
1099    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1100        let _result = self.send_raw(result);
1101        self.drop_without_shutdown();
1102        _result
1103    }
1104
1105    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1106        self.control_handle
1107            .inner
1108            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1109                result,
1110                self.tx_id,
1111                0x6da95f1bcd43fa11,
1112                fidl::encoding::DynamicFlags::empty(),
1113            )
1114    }
1115}
1116
1117#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1118pub struct ClientProviderMarker;
1119
1120impl fidl::endpoints::ProtocolMarker for ClientProviderMarker {
1121    type Proxy = ClientProviderProxy;
1122    type RequestStream = ClientProviderRequestStream;
1123    #[cfg(target_os = "fuchsia")]
1124    type SynchronousProxy = ClientProviderSynchronousProxy;
1125
1126    const DEBUG_NAME: &'static str = "fuchsia.net.dhcpv6.ClientProvider";
1127}
1128impl fidl::endpoints::DiscoverableProtocolMarker for ClientProviderMarker {}
1129
1130pub trait ClientProviderProxyInterface: Send + Sync {
1131    fn r#new_client(
1132        &self,
1133        params: &NewClientParams,
1134        request: fidl::endpoints::ServerEnd<ClientMarker>,
1135    ) -> Result<(), fidl::Error>;
1136}
1137#[derive(Debug)]
1138#[cfg(target_os = "fuchsia")]
1139pub struct ClientProviderSynchronousProxy {
1140    client: fidl::client::sync::Client,
1141}
1142
1143#[cfg(target_os = "fuchsia")]
1144impl fidl::endpoints::SynchronousProxy for ClientProviderSynchronousProxy {
1145    type Proxy = ClientProviderProxy;
1146    type Protocol = ClientProviderMarker;
1147
1148    fn from_channel(inner: fidl::Channel) -> Self {
1149        Self::new(inner)
1150    }
1151
1152    fn into_channel(self) -> fidl::Channel {
1153        self.client.into_channel()
1154    }
1155
1156    fn as_channel(&self) -> &fidl::Channel {
1157        self.client.as_channel()
1158    }
1159}
1160
1161#[cfg(target_os = "fuchsia")]
1162impl ClientProviderSynchronousProxy {
1163    pub fn new(channel: fidl::Channel) -> Self {
1164        let protocol_name = <ClientProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1165        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1166    }
1167
1168    pub fn into_channel(self) -> fidl::Channel {
1169        self.client.into_channel()
1170    }
1171
1172    /// Waits until an event arrives and returns it. It is safe for other
1173    /// threads to make concurrent requests while waiting for an event.
1174    pub fn wait_for_event(
1175        &self,
1176        deadline: zx::MonotonicInstant,
1177    ) -> Result<ClientProviderEvent, fidl::Error> {
1178        ClientProviderEvent::decode(self.client.wait_for_event(deadline)?)
1179    }
1180
1181    /// Provides a DHCPv6 client.
1182    ///
1183    /// + request `params` the parameters to create the client with.
1184    /// + request `request` grants control over the client. Closed with an
1185    ///     epitaph if the client cannot be created.
1186    pub fn r#new_client(
1187        &self,
1188        mut params: &NewClientParams,
1189        mut request: fidl::endpoints::ServerEnd<ClientMarker>,
1190    ) -> Result<(), fidl::Error> {
1191        self.client.send::<ClientProviderNewClientRequest>(
1192            (params, request),
1193            0x269268c97d062419,
1194            fidl::encoding::DynamicFlags::empty(),
1195        )
1196    }
1197}
1198
1199#[cfg(target_os = "fuchsia")]
1200impl From<ClientProviderSynchronousProxy> for zx::Handle {
1201    fn from(value: ClientProviderSynchronousProxy) -> Self {
1202        value.into_channel().into()
1203    }
1204}
1205
1206#[cfg(target_os = "fuchsia")]
1207impl From<fidl::Channel> for ClientProviderSynchronousProxy {
1208    fn from(value: fidl::Channel) -> Self {
1209        Self::new(value)
1210    }
1211}
1212
1213#[cfg(target_os = "fuchsia")]
1214impl fidl::endpoints::FromClient for ClientProviderSynchronousProxy {
1215    type Protocol = ClientProviderMarker;
1216
1217    fn from_client(value: fidl::endpoints::ClientEnd<ClientProviderMarker>) -> Self {
1218        Self::new(value.into_channel())
1219    }
1220}
1221
1222#[derive(Debug, Clone)]
1223pub struct ClientProviderProxy {
1224    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1225}
1226
1227impl fidl::endpoints::Proxy for ClientProviderProxy {
1228    type Protocol = ClientProviderMarker;
1229
1230    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1231        Self::new(inner)
1232    }
1233
1234    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1235        self.client.into_channel().map_err(|client| Self { client })
1236    }
1237
1238    fn as_channel(&self) -> &::fidl::AsyncChannel {
1239        self.client.as_channel()
1240    }
1241}
1242
1243impl ClientProviderProxy {
1244    /// Create a new Proxy for fuchsia.net.dhcpv6/ClientProvider.
1245    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1246        let protocol_name = <ClientProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1247        Self { client: fidl::client::Client::new(channel, protocol_name) }
1248    }
1249
1250    /// Get a Stream of events from the remote end of the protocol.
1251    ///
1252    /// # Panics
1253    ///
1254    /// Panics if the event stream was already taken.
1255    pub fn take_event_stream(&self) -> ClientProviderEventStream {
1256        ClientProviderEventStream { event_receiver: self.client.take_event_receiver() }
1257    }
1258
1259    /// Provides a DHCPv6 client.
1260    ///
1261    /// + request `params` the parameters to create the client with.
1262    /// + request `request` grants control over the client. Closed with an
1263    ///     epitaph if the client cannot be created.
1264    pub fn r#new_client(
1265        &self,
1266        mut params: &NewClientParams,
1267        mut request: fidl::endpoints::ServerEnd<ClientMarker>,
1268    ) -> Result<(), fidl::Error> {
1269        ClientProviderProxyInterface::r#new_client(self, params, request)
1270    }
1271}
1272
1273impl ClientProviderProxyInterface for ClientProviderProxy {
1274    fn r#new_client(
1275        &self,
1276        mut params: &NewClientParams,
1277        mut request: fidl::endpoints::ServerEnd<ClientMarker>,
1278    ) -> Result<(), fidl::Error> {
1279        self.client.send::<ClientProviderNewClientRequest>(
1280            (params, request),
1281            0x269268c97d062419,
1282            fidl::encoding::DynamicFlags::empty(),
1283        )
1284    }
1285}
1286
1287pub struct ClientProviderEventStream {
1288    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1289}
1290
1291impl std::marker::Unpin for ClientProviderEventStream {}
1292
1293impl futures::stream::FusedStream for ClientProviderEventStream {
1294    fn is_terminated(&self) -> bool {
1295        self.event_receiver.is_terminated()
1296    }
1297}
1298
1299impl futures::Stream for ClientProviderEventStream {
1300    type Item = Result<ClientProviderEvent, fidl::Error>;
1301
1302    fn poll_next(
1303        mut self: std::pin::Pin<&mut Self>,
1304        cx: &mut std::task::Context<'_>,
1305    ) -> std::task::Poll<Option<Self::Item>> {
1306        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1307            &mut self.event_receiver,
1308            cx
1309        )?) {
1310            Some(buf) => std::task::Poll::Ready(Some(ClientProviderEvent::decode(buf))),
1311            None => std::task::Poll::Ready(None),
1312        }
1313    }
1314}
1315
1316#[derive(Debug)]
1317pub enum ClientProviderEvent {}
1318
1319impl ClientProviderEvent {
1320    /// Decodes a message buffer as a [`ClientProviderEvent`].
1321    fn decode(
1322        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1323    ) -> Result<ClientProviderEvent, fidl::Error> {
1324        let (bytes, _handles) = buf.split_mut();
1325        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1326        debug_assert_eq!(tx_header.tx_id, 0);
1327        match tx_header.ordinal {
1328            _ => Err(fidl::Error::UnknownOrdinal {
1329                ordinal: tx_header.ordinal,
1330                protocol_name:
1331                    <ClientProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1332            }),
1333        }
1334    }
1335}
1336
1337/// A Stream of incoming requests for fuchsia.net.dhcpv6/ClientProvider.
1338pub struct ClientProviderRequestStream {
1339    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1340    is_terminated: bool,
1341}
1342
1343impl std::marker::Unpin for ClientProviderRequestStream {}
1344
1345impl futures::stream::FusedStream for ClientProviderRequestStream {
1346    fn is_terminated(&self) -> bool {
1347        self.is_terminated
1348    }
1349}
1350
1351impl fidl::endpoints::RequestStream for ClientProviderRequestStream {
1352    type Protocol = ClientProviderMarker;
1353    type ControlHandle = ClientProviderControlHandle;
1354
1355    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1356        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1357    }
1358
1359    fn control_handle(&self) -> Self::ControlHandle {
1360        ClientProviderControlHandle { inner: self.inner.clone() }
1361    }
1362
1363    fn into_inner(
1364        self,
1365    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1366    {
1367        (self.inner, self.is_terminated)
1368    }
1369
1370    fn from_inner(
1371        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1372        is_terminated: bool,
1373    ) -> Self {
1374        Self { inner, is_terminated }
1375    }
1376}
1377
1378impl futures::Stream for ClientProviderRequestStream {
1379    type Item = Result<ClientProviderRequest, fidl::Error>;
1380
1381    fn poll_next(
1382        mut self: std::pin::Pin<&mut Self>,
1383        cx: &mut std::task::Context<'_>,
1384    ) -> std::task::Poll<Option<Self::Item>> {
1385        let this = &mut *self;
1386        if this.inner.check_shutdown(cx) {
1387            this.is_terminated = true;
1388            return std::task::Poll::Ready(None);
1389        }
1390        if this.is_terminated {
1391            panic!("polled ClientProviderRequestStream after completion");
1392        }
1393        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1394            |bytes, handles| {
1395                match this.inner.channel().read_etc(cx, bytes, handles) {
1396                    std::task::Poll::Ready(Ok(())) => {}
1397                    std::task::Poll::Pending => return std::task::Poll::Pending,
1398                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1399                        this.is_terminated = true;
1400                        return std::task::Poll::Ready(None);
1401                    }
1402                    std::task::Poll::Ready(Err(e)) => {
1403                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1404                            e.into(),
1405                        ))));
1406                    }
1407                }
1408
1409                // A message has been received from the channel
1410                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1411
1412                std::task::Poll::Ready(Some(match header.ordinal {
1413                    0x269268c97d062419 => {
1414                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1415                        let mut req = fidl::new_empty!(
1416                            ClientProviderNewClientRequest,
1417                            fidl::encoding::DefaultFuchsiaResourceDialect
1418                        );
1419                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientProviderNewClientRequest>(&header, _body_bytes, handles, &mut req)?;
1420                        let control_handle =
1421                            ClientProviderControlHandle { inner: this.inner.clone() };
1422                        Ok(ClientProviderRequest::NewClient {
1423                            params: req.params,
1424                            request: req.request,
1425
1426                            control_handle,
1427                        })
1428                    }
1429                    _ => Err(fidl::Error::UnknownOrdinal {
1430                        ordinal: header.ordinal,
1431                        protocol_name:
1432                            <ClientProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1433                    }),
1434                }))
1435            },
1436        )
1437    }
1438}
1439
1440/// Provides a method to create new clients.
1441#[derive(Debug)]
1442pub enum ClientProviderRequest {
1443    /// Provides a DHCPv6 client.
1444    ///
1445    /// + request `params` the parameters to create the client with.
1446    /// + request `request` grants control over the client. Closed with an
1447    ///     epitaph if the client cannot be created.
1448    NewClient {
1449        params: NewClientParams,
1450        request: fidl::endpoints::ServerEnd<ClientMarker>,
1451        control_handle: ClientProviderControlHandle,
1452    },
1453}
1454
1455impl ClientProviderRequest {
1456    #[allow(irrefutable_let_patterns)]
1457    pub fn into_new_client(
1458        self,
1459    ) -> Option<(
1460        NewClientParams,
1461        fidl::endpoints::ServerEnd<ClientMarker>,
1462        ClientProviderControlHandle,
1463    )> {
1464        if let ClientProviderRequest::NewClient { params, request, control_handle } = self {
1465            Some((params, request, control_handle))
1466        } else {
1467            None
1468        }
1469    }
1470
1471    /// Name of the method defined in FIDL
1472    pub fn method_name(&self) -> &'static str {
1473        match *self {
1474            ClientProviderRequest::NewClient { .. } => "new_client",
1475        }
1476    }
1477}
1478
1479#[derive(Debug, Clone)]
1480pub struct ClientProviderControlHandle {
1481    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1482}
1483
1484impl fidl::endpoints::ControlHandle for ClientProviderControlHandle {
1485    fn shutdown(&self) {
1486        self.inner.shutdown()
1487    }
1488    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1489        self.inner.shutdown_with_epitaph(status)
1490    }
1491
1492    fn is_closed(&self) -> bool {
1493        self.inner.channel().is_closed()
1494    }
1495    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1496        self.inner.channel().on_closed()
1497    }
1498
1499    #[cfg(target_os = "fuchsia")]
1500    fn signal_peer(
1501        &self,
1502        clear_mask: zx::Signals,
1503        set_mask: zx::Signals,
1504    ) -> Result<(), zx_status::Status> {
1505        use fidl::Peered;
1506        self.inner.channel().signal_peer(clear_mask, set_mask)
1507    }
1508}
1509
1510impl ClientProviderControlHandle {}
1511
1512#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1513pub struct PrefixControlMarker;
1514
1515impl fidl::endpoints::ProtocolMarker for PrefixControlMarker {
1516    type Proxy = PrefixControlProxy;
1517    type RequestStream = PrefixControlRequestStream;
1518    #[cfg(target_os = "fuchsia")]
1519    type SynchronousProxy = PrefixControlSynchronousProxy;
1520
1521    const DEBUG_NAME: &'static str = "(anonymous) PrefixControl";
1522}
1523
1524pub trait PrefixControlProxyInterface: Send + Sync {
1525    type WatchPrefixResponseFut: std::future::Future<Output = Result<PrefixEvent, fidl::Error>>
1526        + Send;
1527    fn r#watch_prefix(&self) -> Self::WatchPrefixResponseFut;
1528}
1529#[derive(Debug)]
1530#[cfg(target_os = "fuchsia")]
1531pub struct PrefixControlSynchronousProxy {
1532    client: fidl::client::sync::Client,
1533}
1534
1535#[cfg(target_os = "fuchsia")]
1536impl fidl::endpoints::SynchronousProxy for PrefixControlSynchronousProxy {
1537    type Proxy = PrefixControlProxy;
1538    type Protocol = PrefixControlMarker;
1539
1540    fn from_channel(inner: fidl::Channel) -> Self {
1541        Self::new(inner)
1542    }
1543
1544    fn into_channel(self) -> fidl::Channel {
1545        self.client.into_channel()
1546    }
1547
1548    fn as_channel(&self) -> &fidl::Channel {
1549        self.client.as_channel()
1550    }
1551}
1552
1553#[cfg(target_os = "fuchsia")]
1554impl PrefixControlSynchronousProxy {
1555    pub fn new(channel: fidl::Channel) -> Self {
1556        let protocol_name = <PrefixControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1557        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1558    }
1559
1560    pub fn into_channel(self) -> fidl::Channel {
1561        self.client.into_channel()
1562    }
1563
1564    /// Waits until an event arrives and returns it. It is safe for other
1565    /// threads to make concurrent requests while waiting for an event.
1566    pub fn wait_for_event(
1567        &self,
1568        deadline: zx::MonotonicInstant,
1569    ) -> Result<PrefixControlEvent, fidl::Error> {
1570        PrefixControlEvent::decode(self.client.wait_for_event(deadline)?)
1571    }
1572
1573    /// Hanging get for the prefix and its lifetimes.
1574    ///
1575    /// The first call to this method is guaranteed to return
1576    /// [`PrefixEvent.assigned`], and will occur when there is a prefix
1577    /// to report. Subsequent calls will return immediately if there is a
1578    /// change to report, or block until a change occurs.
1579    ///
1580    /// It is invalid to call this method while a previous call is pending.
1581    /// Doing so will cause the server end of the protocol to be closed with
1582    /// the terminal event [`PrefixControlExitReason.DOUBLE_WATCH`].
1583    ///
1584    /// - response `event` an optional prefix.
1585    pub fn r#watch_prefix(
1586        &self,
1587        ___deadline: zx::MonotonicInstant,
1588    ) -> Result<PrefixEvent, fidl::Error> {
1589        let _response = self
1590            .client
1591            .send_query::<fidl::encoding::EmptyPayload, PrefixControlWatchPrefixResponse>(
1592                (),
1593                0x1f5c40d4d1e84d84,
1594                fidl::encoding::DynamicFlags::empty(),
1595                ___deadline,
1596            )?;
1597        Ok(_response.event)
1598    }
1599}
1600
1601#[cfg(target_os = "fuchsia")]
1602impl From<PrefixControlSynchronousProxy> for zx::Handle {
1603    fn from(value: PrefixControlSynchronousProxy) -> Self {
1604        value.into_channel().into()
1605    }
1606}
1607
1608#[cfg(target_os = "fuchsia")]
1609impl From<fidl::Channel> for PrefixControlSynchronousProxy {
1610    fn from(value: fidl::Channel) -> Self {
1611        Self::new(value)
1612    }
1613}
1614
1615#[cfg(target_os = "fuchsia")]
1616impl fidl::endpoints::FromClient for PrefixControlSynchronousProxy {
1617    type Protocol = PrefixControlMarker;
1618
1619    fn from_client(value: fidl::endpoints::ClientEnd<PrefixControlMarker>) -> Self {
1620        Self::new(value.into_channel())
1621    }
1622}
1623
1624#[derive(Debug, Clone)]
1625pub struct PrefixControlProxy {
1626    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1627}
1628
1629impl fidl::endpoints::Proxy for PrefixControlProxy {
1630    type Protocol = PrefixControlMarker;
1631
1632    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1633        Self::new(inner)
1634    }
1635
1636    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1637        self.client.into_channel().map_err(|client| Self { client })
1638    }
1639
1640    fn as_channel(&self) -> &::fidl::AsyncChannel {
1641        self.client.as_channel()
1642    }
1643}
1644
1645impl PrefixControlProxy {
1646    /// Create a new Proxy for fuchsia.net.dhcpv6/PrefixControl.
1647    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1648        let protocol_name = <PrefixControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1649        Self { client: fidl::client::Client::new(channel, protocol_name) }
1650    }
1651
1652    /// Get a Stream of events from the remote end of the protocol.
1653    ///
1654    /// # Panics
1655    ///
1656    /// Panics if the event stream was already taken.
1657    pub fn take_event_stream(&self) -> PrefixControlEventStream {
1658        PrefixControlEventStream { event_receiver: self.client.take_event_receiver() }
1659    }
1660
1661    /// Hanging get for the prefix and its lifetimes.
1662    ///
1663    /// The first call to this method is guaranteed to return
1664    /// [`PrefixEvent.assigned`], and will occur when there is a prefix
1665    /// to report. Subsequent calls will return immediately if there is a
1666    /// change to report, or block until a change occurs.
1667    ///
1668    /// It is invalid to call this method while a previous call is pending.
1669    /// Doing so will cause the server end of the protocol to be closed with
1670    /// the terminal event [`PrefixControlExitReason.DOUBLE_WATCH`].
1671    ///
1672    /// - response `event` an optional prefix.
1673    pub fn r#watch_prefix(
1674        &self,
1675    ) -> fidl::client::QueryResponseFut<PrefixEvent, fidl::encoding::DefaultFuchsiaResourceDialect>
1676    {
1677        PrefixControlProxyInterface::r#watch_prefix(self)
1678    }
1679}
1680
1681impl PrefixControlProxyInterface for PrefixControlProxy {
1682    type WatchPrefixResponseFut =
1683        fidl::client::QueryResponseFut<PrefixEvent, fidl::encoding::DefaultFuchsiaResourceDialect>;
1684    fn r#watch_prefix(&self) -> Self::WatchPrefixResponseFut {
1685        fn _decode(
1686            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1687        ) -> Result<PrefixEvent, fidl::Error> {
1688            let _response = fidl::client::decode_transaction_body::<
1689                PrefixControlWatchPrefixResponse,
1690                fidl::encoding::DefaultFuchsiaResourceDialect,
1691                0x1f5c40d4d1e84d84,
1692            >(_buf?)?;
1693            Ok(_response.event)
1694        }
1695        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, PrefixEvent>(
1696            (),
1697            0x1f5c40d4d1e84d84,
1698            fidl::encoding::DynamicFlags::empty(),
1699            _decode,
1700        )
1701    }
1702}
1703
1704pub struct PrefixControlEventStream {
1705    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1706}
1707
1708impl std::marker::Unpin for PrefixControlEventStream {}
1709
1710impl futures::stream::FusedStream for PrefixControlEventStream {
1711    fn is_terminated(&self) -> bool {
1712        self.event_receiver.is_terminated()
1713    }
1714}
1715
1716impl futures::Stream for PrefixControlEventStream {
1717    type Item = Result<PrefixControlEvent, fidl::Error>;
1718
1719    fn poll_next(
1720        mut self: std::pin::Pin<&mut Self>,
1721        cx: &mut std::task::Context<'_>,
1722    ) -> std::task::Poll<Option<Self::Item>> {
1723        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1724            &mut self.event_receiver,
1725            cx
1726        )?) {
1727            Some(buf) => std::task::Poll::Ready(Some(PrefixControlEvent::decode(buf))),
1728            None => std::task::Poll::Ready(None),
1729        }
1730    }
1731}
1732
1733#[derive(Debug)]
1734pub enum PrefixControlEvent {
1735    OnExit { reason: PrefixControlExitReason },
1736}
1737
1738impl PrefixControlEvent {
1739    #[allow(irrefutable_let_patterns)]
1740    pub fn into_on_exit(self) -> Option<PrefixControlExitReason> {
1741        if let PrefixControlEvent::OnExit { reason } = self { Some((reason)) } else { None }
1742    }
1743
1744    /// Decodes a message buffer as a [`PrefixControlEvent`].
1745    fn decode(
1746        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1747    ) -> Result<PrefixControlEvent, fidl::Error> {
1748        let (bytes, _handles) = buf.split_mut();
1749        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1750        debug_assert_eq!(tx_header.tx_id, 0);
1751        match tx_header.ordinal {
1752            0x353b8c435cbe08f9 => {
1753                let mut out = fidl::new_empty!(
1754                    PrefixControlOnExitRequest,
1755                    fidl::encoding::DefaultFuchsiaResourceDialect
1756                );
1757                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrefixControlOnExitRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1758                Ok((PrefixControlEvent::OnExit { reason: out.reason }))
1759            }
1760            _ => Err(fidl::Error::UnknownOrdinal {
1761                ordinal: tx_header.ordinal,
1762                protocol_name: <PrefixControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1763            }),
1764        }
1765    }
1766}
1767
1768/// A Stream of incoming requests for fuchsia.net.dhcpv6/PrefixControl.
1769pub struct PrefixControlRequestStream {
1770    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1771    is_terminated: bool,
1772}
1773
1774impl std::marker::Unpin for PrefixControlRequestStream {}
1775
1776impl futures::stream::FusedStream for PrefixControlRequestStream {
1777    fn is_terminated(&self) -> bool {
1778        self.is_terminated
1779    }
1780}
1781
1782impl fidl::endpoints::RequestStream for PrefixControlRequestStream {
1783    type Protocol = PrefixControlMarker;
1784    type ControlHandle = PrefixControlControlHandle;
1785
1786    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1787        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1788    }
1789
1790    fn control_handle(&self) -> Self::ControlHandle {
1791        PrefixControlControlHandle { inner: self.inner.clone() }
1792    }
1793
1794    fn into_inner(
1795        self,
1796    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1797    {
1798        (self.inner, self.is_terminated)
1799    }
1800
1801    fn from_inner(
1802        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1803        is_terminated: bool,
1804    ) -> Self {
1805        Self { inner, is_terminated }
1806    }
1807}
1808
1809impl futures::Stream for PrefixControlRequestStream {
1810    type Item = Result<PrefixControlRequest, fidl::Error>;
1811
1812    fn poll_next(
1813        mut self: std::pin::Pin<&mut Self>,
1814        cx: &mut std::task::Context<'_>,
1815    ) -> std::task::Poll<Option<Self::Item>> {
1816        let this = &mut *self;
1817        if this.inner.check_shutdown(cx) {
1818            this.is_terminated = true;
1819            return std::task::Poll::Ready(None);
1820        }
1821        if this.is_terminated {
1822            panic!("polled PrefixControlRequestStream after completion");
1823        }
1824        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1825            |bytes, handles| {
1826                match this.inner.channel().read_etc(cx, bytes, handles) {
1827                    std::task::Poll::Ready(Ok(())) => {}
1828                    std::task::Poll::Pending => return std::task::Poll::Pending,
1829                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1830                        this.is_terminated = true;
1831                        return std::task::Poll::Ready(None);
1832                    }
1833                    std::task::Poll::Ready(Err(e)) => {
1834                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1835                            e.into(),
1836                        ))));
1837                    }
1838                }
1839
1840                // A message has been received from the channel
1841                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1842
1843                std::task::Poll::Ready(Some(match header.ordinal {
1844                    0x1f5c40d4d1e84d84 => {
1845                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1846                        let mut req = fidl::new_empty!(
1847                            fidl::encoding::EmptyPayload,
1848                            fidl::encoding::DefaultFuchsiaResourceDialect
1849                        );
1850                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1851                        let control_handle =
1852                            PrefixControlControlHandle { inner: this.inner.clone() };
1853                        Ok(PrefixControlRequest::WatchPrefix {
1854                            responder: PrefixControlWatchPrefixResponder {
1855                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1856                                tx_id: header.tx_id,
1857                            },
1858                        })
1859                    }
1860                    _ => Err(fidl::Error::UnknownOrdinal {
1861                        ordinal: header.ordinal,
1862                        protocol_name:
1863                            <PrefixControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1864                    }),
1865                }))
1866            },
1867        )
1868    }
1869}
1870
1871/// Provides control over prefix acquisition.
1872///
1873/// If the client end is closed, prefix acquisition will stop. This means that
1874/// a best effort will be made to release leases back to the server, and no
1875/// further attempt will be made to acquire any of the prefixes this protocol
1876/// was configured to acquire.
1877#[derive(Debug)]
1878pub enum PrefixControlRequest {
1879    /// Hanging get for the prefix and its lifetimes.
1880    ///
1881    /// The first call to this method is guaranteed to return
1882    /// [`PrefixEvent.assigned`], and will occur when there is a prefix
1883    /// to report. Subsequent calls will return immediately if there is a
1884    /// change to report, or block until a change occurs.
1885    ///
1886    /// It is invalid to call this method while a previous call is pending.
1887    /// Doing so will cause the server end of the protocol to be closed with
1888    /// the terminal event [`PrefixControlExitReason.DOUBLE_WATCH`].
1889    ///
1890    /// - response `event` an optional prefix.
1891    WatchPrefix { responder: PrefixControlWatchPrefixResponder },
1892}
1893
1894impl PrefixControlRequest {
1895    #[allow(irrefutable_let_patterns)]
1896    pub fn into_watch_prefix(self) -> Option<(PrefixControlWatchPrefixResponder)> {
1897        if let PrefixControlRequest::WatchPrefix { responder } = self {
1898            Some((responder))
1899        } else {
1900            None
1901        }
1902    }
1903
1904    /// Name of the method defined in FIDL
1905    pub fn method_name(&self) -> &'static str {
1906        match *self {
1907            PrefixControlRequest::WatchPrefix { .. } => "watch_prefix",
1908        }
1909    }
1910}
1911
1912#[derive(Debug, Clone)]
1913pub struct PrefixControlControlHandle {
1914    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1915}
1916
1917impl fidl::endpoints::ControlHandle for PrefixControlControlHandle {
1918    fn shutdown(&self) {
1919        self.inner.shutdown()
1920    }
1921    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1922        self.inner.shutdown_with_epitaph(status)
1923    }
1924
1925    fn is_closed(&self) -> bool {
1926        self.inner.channel().is_closed()
1927    }
1928    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1929        self.inner.channel().on_closed()
1930    }
1931
1932    #[cfg(target_os = "fuchsia")]
1933    fn signal_peer(
1934        &self,
1935        clear_mask: zx::Signals,
1936        set_mask: zx::Signals,
1937    ) -> Result<(), zx_status::Status> {
1938        use fidl::Peered;
1939        self.inner.channel().signal_peer(clear_mask, set_mask)
1940    }
1941}
1942
1943impl PrefixControlControlHandle {
1944    pub fn send_on_exit(&self, mut reason: PrefixControlExitReason) -> Result<(), fidl::Error> {
1945        self.inner.send::<PrefixControlOnExitRequest>(
1946            (reason,),
1947            0,
1948            0x353b8c435cbe08f9,
1949            fidl::encoding::DynamicFlags::empty(),
1950        )
1951    }
1952}
1953
1954#[must_use = "FIDL methods require a response to be sent"]
1955#[derive(Debug)]
1956pub struct PrefixControlWatchPrefixResponder {
1957    control_handle: std::mem::ManuallyDrop<PrefixControlControlHandle>,
1958    tx_id: u32,
1959}
1960
1961/// Set the the channel to be shutdown (see [`PrefixControlControlHandle::shutdown`])
1962/// if the responder is dropped without sending a response, so that the client
1963/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1964impl std::ops::Drop for PrefixControlWatchPrefixResponder {
1965    fn drop(&mut self) {
1966        self.control_handle.shutdown();
1967        // Safety: drops once, never accessed again
1968        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1969    }
1970}
1971
1972impl fidl::endpoints::Responder for PrefixControlWatchPrefixResponder {
1973    type ControlHandle = PrefixControlControlHandle;
1974
1975    fn control_handle(&self) -> &PrefixControlControlHandle {
1976        &self.control_handle
1977    }
1978
1979    fn drop_without_shutdown(mut self) {
1980        // Safety: drops once, never accessed again due to mem::forget
1981        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1982        // Prevent Drop from running (which would shut down the channel)
1983        std::mem::forget(self);
1984    }
1985}
1986
1987impl PrefixControlWatchPrefixResponder {
1988    /// Sends a response to the FIDL transaction.
1989    ///
1990    /// Sets the channel to shutdown if an error occurs.
1991    pub fn send(self, mut event: &PrefixEvent) -> Result<(), fidl::Error> {
1992        let _result = self.send_raw(event);
1993        if _result.is_err() {
1994            self.control_handle.shutdown();
1995        }
1996        self.drop_without_shutdown();
1997        _result
1998    }
1999
2000    /// Similar to "send" but does not shutdown the channel if an error occurs.
2001    pub fn send_no_shutdown_on_err(self, mut event: &PrefixEvent) -> Result<(), fidl::Error> {
2002        let _result = self.send_raw(event);
2003        self.drop_without_shutdown();
2004        _result
2005    }
2006
2007    fn send_raw(&self, mut event: &PrefixEvent) -> Result<(), fidl::Error> {
2008        self.control_handle.inner.send::<PrefixControlWatchPrefixResponse>(
2009            (event,),
2010            self.tx_id,
2011            0x1f5c40d4d1e84d84,
2012            fidl::encoding::DynamicFlags::empty(),
2013        )
2014    }
2015}
2016
2017#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
2018pub struct PrefixProviderMarker;
2019
2020impl fidl::endpoints::ProtocolMarker for PrefixProviderMarker {
2021    type Proxy = PrefixProviderProxy;
2022    type RequestStream = PrefixProviderRequestStream;
2023    #[cfg(target_os = "fuchsia")]
2024    type SynchronousProxy = PrefixProviderSynchronousProxy;
2025
2026    const DEBUG_NAME: &'static str = "fuchsia.net.dhcpv6.PrefixProvider";
2027}
2028impl fidl::endpoints::DiscoverableProtocolMarker for PrefixProviderMarker {}
2029
2030pub trait PrefixProviderProxyInterface: Send + Sync {
2031    fn r#acquire_prefix(
2032        &self,
2033        config: &AcquirePrefixConfig,
2034        prefix: fidl::endpoints::ServerEnd<PrefixControlMarker>,
2035    ) -> Result<(), fidl::Error>;
2036}
2037#[derive(Debug)]
2038#[cfg(target_os = "fuchsia")]
2039pub struct PrefixProviderSynchronousProxy {
2040    client: fidl::client::sync::Client,
2041}
2042
2043#[cfg(target_os = "fuchsia")]
2044impl fidl::endpoints::SynchronousProxy for PrefixProviderSynchronousProxy {
2045    type Proxy = PrefixProviderProxy;
2046    type Protocol = PrefixProviderMarker;
2047
2048    fn from_channel(inner: fidl::Channel) -> Self {
2049        Self::new(inner)
2050    }
2051
2052    fn into_channel(self) -> fidl::Channel {
2053        self.client.into_channel()
2054    }
2055
2056    fn as_channel(&self) -> &fidl::Channel {
2057        self.client.as_channel()
2058    }
2059}
2060
2061#[cfg(target_os = "fuchsia")]
2062impl PrefixProviderSynchronousProxy {
2063    pub fn new(channel: fidl::Channel) -> Self {
2064        let protocol_name = <PrefixProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2065        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
2066    }
2067
2068    pub fn into_channel(self) -> fidl::Channel {
2069        self.client.into_channel()
2070    }
2071
2072    /// Waits until an event arrives and returns it. It is safe for other
2073    /// threads to make concurrent requests while waiting for an event.
2074    pub fn wait_for_event(
2075        &self,
2076        deadline: zx::MonotonicInstant,
2077    ) -> Result<PrefixProviderEvent, fidl::Error> {
2078        PrefixProviderEvent::decode(self.client.wait_for_event(deadline)?)
2079    }
2080
2081    /// Acquire an IPv6 prefix via Prefix Delegation.
2082    ///
2083    /// If this method is called with invalid parameters, a terminal event
2084    /// containing a reason detailing why will be sent via
2085    /// [`PrefixControl.OnExit`] and the server end of [`PrefixControl`]
2086    /// will be closed.
2087    ///
2088    /// + request `config` prefix acquisition configuration.
2089    /// + request `prefix` provides control over prefix acquisition.
2090    pub fn r#acquire_prefix(
2091        &self,
2092        mut config: &AcquirePrefixConfig,
2093        mut prefix: fidl::endpoints::ServerEnd<PrefixControlMarker>,
2094    ) -> Result<(), fidl::Error> {
2095        self.client.send::<PrefixProviderAcquirePrefixRequest>(
2096            (config, prefix),
2097            0x24eff9a5ce404cf8,
2098            fidl::encoding::DynamicFlags::empty(),
2099        )
2100    }
2101}
2102
2103#[cfg(target_os = "fuchsia")]
2104impl From<PrefixProviderSynchronousProxy> for zx::Handle {
2105    fn from(value: PrefixProviderSynchronousProxy) -> Self {
2106        value.into_channel().into()
2107    }
2108}
2109
2110#[cfg(target_os = "fuchsia")]
2111impl From<fidl::Channel> for PrefixProviderSynchronousProxy {
2112    fn from(value: fidl::Channel) -> Self {
2113        Self::new(value)
2114    }
2115}
2116
2117#[cfg(target_os = "fuchsia")]
2118impl fidl::endpoints::FromClient for PrefixProviderSynchronousProxy {
2119    type Protocol = PrefixProviderMarker;
2120
2121    fn from_client(value: fidl::endpoints::ClientEnd<PrefixProviderMarker>) -> Self {
2122        Self::new(value.into_channel())
2123    }
2124}
2125
2126#[derive(Debug, Clone)]
2127pub struct PrefixProviderProxy {
2128    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
2129}
2130
2131impl fidl::endpoints::Proxy for PrefixProviderProxy {
2132    type Protocol = PrefixProviderMarker;
2133
2134    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
2135        Self::new(inner)
2136    }
2137
2138    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
2139        self.client.into_channel().map_err(|client| Self { client })
2140    }
2141
2142    fn as_channel(&self) -> &::fidl::AsyncChannel {
2143        self.client.as_channel()
2144    }
2145}
2146
2147impl PrefixProviderProxy {
2148    /// Create a new Proxy for fuchsia.net.dhcpv6/PrefixProvider.
2149    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
2150        let protocol_name = <PrefixProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
2151        Self { client: fidl::client::Client::new(channel, protocol_name) }
2152    }
2153
2154    /// Get a Stream of events from the remote end of the protocol.
2155    ///
2156    /// # Panics
2157    ///
2158    /// Panics if the event stream was already taken.
2159    pub fn take_event_stream(&self) -> PrefixProviderEventStream {
2160        PrefixProviderEventStream { event_receiver: self.client.take_event_receiver() }
2161    }
2162
2163    /// Acquire an IPv6 prefix via Prefix Delegation.
2164    ///
2165    /// If this method is called with invalid parameters, a terminal event
2166    /// containing a reason detailing why will be sent via
2167    /// [`PrefixControl.OnExit`] and the server end of [`PrefixControl`]
2168    /// will be closed.
2169    ///
2170    /// + request `config` prefix acquisition configuration.
2171    /// + request `prefix` provides control over prefix acquisition.
2172    pub fn r#acquire_prefix(
2173        &self,
2174        mut config: &AcquirePrefixConfig,
2175        mut prefix: fidl::endpoints::ServerEnd<PrefixControlMarker>,
2176    ) -> Result<(), fidl::Error> {
2177        PrefixProviderProxyInterface::r#acquire_prefix(self, config, prefix)
2178    }
2179}
2180
2181impl PrefixProviderProxyInterface for PrefixProviderProxy {
2182    fn r#acquire_prefix(
2183        &self,
2184        mut config: &AcquirePrefixConfig,
2185        mut prefix: fidl::endpoints::ServerEnd<PrefixControlMarker>,
2186    ) -> Result<(), fidl::Error> {
2187        self.client.send::<PrefixProviderAcquirePrefixRequest>(
2188            (config, prefix),
2189            0x24eff9a5ce404cf8,
2190            fidl::encoding::DynamicFlags::empty(),
2191        )
2192    }
2193}
2194
2195pub struct PrefixProviderEventStream {
2196    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2197}
2198
2199impl std::marker::Unpin for PrefixProviderEventStream {}
2200
2201impl futures::stream::FusedStream for PrefixProviderEventStream {
2202    fn is_terminated(&self) -> bool {
2203        self.event_receiver.is_terminated()
2204    }
2205}
2206
2207impl futures::Stream for PrefixProviderEventStream {
2208    type Item = Result<PrefixProviderEvent, fidl::Error>;
2209
2210    fn poll_next(
2211        mut self: std::pin::Pin<&mut Self>,
2212        cx: &mut std::task::Context<'_>,
2213    ) -> std::task::Poll<Option<Self::Item>> {
2214        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2215            &mut self.event_receiver,
2216            cx
2217        )?) {
2218            Some(buf) => std::task::Poll::Ready(Some(PrefixProviderEvent::decode(buf))),
2219            None => std::task::Poll::Ready(None),
2220        }
2221    }
2222}
2223
2224#[derive(Debug)]
2225pub enum PrefixProviderEvent {}
2226
2227impl PrefixProviderEvent {
2228    /// Decodes a message buffer as a [`PrefixProviderEvent`].
2229    fn decode(
2230        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2231    ) -> Result<PrefixProviderEvent, fidl::Error> {
2232        let (bytes, _handles) = buf.split_mut();
2233        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2234        debug_assert_eq!(tx_header.tx_id, 0);
2235        match tx_header.ordinal {
2236            _ => Err(fidl::Error::UnknownOrdinal {
2237                ordinal: tx_header.ordinal,
2238                protocol_name:
2239                    <PrefixProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2240            }),
2241        }
2242    }
2243}
2244
2245/// A Stream of incoming requests for fuchsia.net.dhcpv6/PrefixProvider.
2246pub struct PrefixProviderRequestStream {
2247    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2248    is_terminated: bool,
2249}
2250
2251impl std::marker::Unpin for PrefixProviderRequestStream {}
2252
2253impl futures::stream::FusedStream for PrefixProviderRequestStream {
2254    fn is_terminated(&self) -> bool {
2255        self.is_terminated
2256    }
2257}
2258
2259impl fidl::endpoints::RequestStream for PrefixProviderRequestStream {
2260    type Protocol = PrefixProviderMarker;
2261    type ControlHandle = PrefixProviderControlHandle;
2262
2263    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2264        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2265    }
2266
2267    fn control_handle(&self) -> Self::ControlHandle {
2268        PrefixProviderControlHandle { inner: self.inner.clone() }
2269    }
2270
2271    fn into_inner(
2272        self,
2273    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2274    {
2275        (self.inner, self.is_terminated)
2276    }
2277
2278    fn from_inner(
2279        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2280        is_terminated: bool,
2281    ) -> Self {
2282        Self { inner, is_terminated }
2283    }
2284}
2285
2286impl futures::Stream for PrefixProviderRequestStream {
2287    type Item = Result<PrefixProviderRequest, fidl::Error>;
2288
2289    fn poll_next(
2290        mut self: std::pin::Pin<&mut Self>,
2291        cx: &mut std::task::Context<'_>,
2292    ) -> std::task::Poll<Option<Self::Item>> {
2293        let this = &mut *self;
2294        if this.inner.check_shutdown(cx) {
2295            this.is_terminated = true;
2296            return std::task::Poll::Ready(None);
2297        }
2298        if this.is_terminated {
2299            panic!("polled PrefixProviderRequestStream after completion");
2300        }
2301        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2302            |bytes, handles| {
2303                match this.inner.channel().read_etc(cx, bytes, handles) {
2304                    std::task::Poll::Ready(Ok(())) => {}
2305                    std::task::Poll::Pending => return std::task::Poll::Pending,
2306                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2307                        this.is_terminated = true;
2308                        return std::task::Poll::Ready(None);
2309                    }
2310                    std::task::Poll::Ready(Err(e)) => {
2311                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2312                            e.into(),
2313                        ))));
2314                    }
2315                }
2316
2317                // A message has been received from the channel
2318                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2319
2320                std::task::Poll::Ready(Some(match header.ordinal {
2321                    0x24eff9a5ce404cf8 => {
2322                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
2323                        let mut req = fidl::new_empty!(
2324                            PrefixProviderAcquirePrefixRequest,
2325                            fidl::encoding::DefaultFuchsiaResourceDialect
2326                        );
2327                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<PrefixProviderAcquirePrefixRequest>(&header, _body_bytes, handles, &mut req)?;
2328                        let control_handle =
2329                            PrefixProviderControlHandle { inner: this.inner.clone() };
2330                        Ok(PrefixProviderRequest::AcquirePrefix {
2331                            config: req.config,
2332                            prefix: req.prefix,
2333
2334                            control_handle,
2335                        })
2336                    }
2337                    _ => Err(fidl::Error::UnknownOrdinal {
2338                        ordinal: header.ordinal,
2339                        protocol_name:
2340                            <PrefixProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2341                    }),
2342                }))
2343            },
2344        )
2345    }
2346}
2347
2348/// Provides IPv6 prefixes acquired via Prefix delegation.
2349#[derive(Debug)]
2350pub enum PrefixProviderRequest {
2351    /// Acquire an IPv6 prefix via Prefix Delegation.
2352    ///
2353    /// If this method is called with invalid parameters, a terminal event
2354    /// containing a reason detailing why will be sent via
2355    /// [`PrefixControl.OnExit`] and the server end of [`PrefixControl`]
2356    /// will be closed.
2357    ///
2358    /// + request `config` prefix acquisition configuration.
2359    /// + request `prefix` provides control over prefix acquisition.
2360    AcquirePrefix {
2361        config: AcquirePrefixConfig,
2362        prefix: fidl::endpoints::ServerEnd<PrefixControlMarker>,
2363        control_handle: PrefixProviderControlHandle,
2364    },
2365}
2366
2367impl PrefixProviderRequest {
2368    #[allow(irrefutable_let_patterns)]
2369    pub fn into_acquire_prefix(
2370        self,
2371    ) -> Option<(
2372        AcquirePrefixConfig,
2373        fidl::endpoints::ServerEnd<PrefixControlMarker>,
2374        PrefixProviderControlHandle,
2375    )> {
2376        if let PrefixProviderRequest::AcquirePrefix { config, prefix, control_handle } = self {
2377            Some((config, prefix, control_handle))
2378        } else {
2379            None
2380        }
2381    }
2382
2383    /// Name of the method defined in FIDL
2384    pub fn method_name(&self) -> &'static str {
2385        match *self {
2386            PrefixProviderRequest::AcquirePrefix { .. } => "acquire_prefix",
2387        }
2388    }
2389}
2390
2391#[derive(Debug, Clone)]
2392pub struct PrefixProviderControlHandle {
2393    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2394}
2395
2396impl fidl::endpoints::ControlHandle for PrefixProviderControlHandle {
2397    fn shutdown(&self) {
2398        self.inner.shutdown()
2399    }
2400    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2401        self.inner.shutdown_with_epitaph(status)
2402    }
2403
2404    fn is_closed(&self) -> bool {
2405        self.inner.channel().is_closed()
2406    }
2407    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2408        self.inner.channel().on_closed()
2409    }
2410
2411    #[cfg(target_os = "fuchsia")]
2412    fn signal_peer(
2413        &self,
2414        clear_mask: zx::Signals,
2415        set_mask: zx::Signals,
2416    ) -> Result<(), zx_status::Status> {
2417        use fidl::Peered;
2418        self.inner.channel().signal_peer(clear_mask, set_mask)
2419    }
2420}
2421
2422impl PrefixProviderControlHandle {}
2423
2424mod internal {
2425    use super::*;
2426
2427    impl fidl::encoding::ResourceTypeMarker for ClientProviderNewClientRequest {
2428        type Borrowed<'a> = &'a mut Self;
2429        fn take_or_borrow<'a>(
2430            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2431        ) -> Self::Borrowed<'a> {
2432            value
2433        }
2434    }
2435
2436    unsafe impl fidl::encoding::TypeMarker for ClientProviderNewClientRequest {
2437        type Owned = Self;
2438
2439        #[inline(always)]
2440        fn inline_align(_context: fidl::encoding::Context) -> usize {
2441            8
2442        }
2443
2444        #[inline(always)]
2445        fn inline_size(_context: fidl::encoding::Context) -> usize {
2446            24
2447        }
2448    }
2449
2450    unsafe impl
2451        fidl::encoding::Encode<
2452            ClientProviderNewClientRequest,
2453            fidl::encoding::DefaultFuchsiaResourceDialect,
2454        > for &mut ClientProviderNewClientRequest
2455    {
2456        #[inline]
2457        unsafe fn encode(
2458            self,
2459            encoder: &mut fidl::encoding::Encoder<
2460                '_,
2461                fidl::encoding::DefaultFuchsiaResourceDialect,
2462            >,
2463            offset: usize,
2464            _depth: fidl::encoding::Depth,
2465        ) -> fidl::Result<()> {
2466            encoder.debug_check_bounds::<ClientProviderNewClientRequest>(offset);
2467            // Delegate to tuple encoding.
2468            fidl::encoding::Encode::<ClientProviderNewClientRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2469                (
2470                    <NewClientParams as fidl::encoding::ValueTypeMarker>::borrow(&self.params),
2471                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
2472                ),
2473                encoder, offset, _depth
2474            )
2475        }
2476    }
2477    unsafe impl<
2478        T0: fidl::encoding::Encode<NewClientParams, fidl::encoding::DefaultFuchsiaResourceDialect>,
2479        T1: fidl::encoding::Encode<
2480                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientMarker>>,
2481                fidl::encoding::DefaultFuchsiaResourceDialect,
2482            >,
2483    >
2484        fidl::encoding::Encode<
2485            ClientProviderNewClientRequest,
2486            fidl::encoding::DefaultFuchsiaResourceDialect,
2487        > for (T0, T1)
2488    {
2489        #[inline]
2490        unsafe fn encode(
2491            self,
2492            encoder: &mut fidl::encoding::Encoder<
2493                '_,
2494                fidl::encoding::DefaultFuchsiaResourceDialect,
2495            >,
2496            offset: usize,
2497            depth: fidl::encoding::Depth,
2498        ) -> fidl::Result<()> {
2499            encoder.debug_check_bounds::<ClientProviderNewClientRequest>(offset);
2500            // Zero out padding regions. There's no need to apply masks
2501            // because the unmasked parts will be overwritten by fields.
2502            unsafe {
2503                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2504                (ptr as *mut u64).write_unaligned(0);
2505            }
2506            // Write the fields.
2507            self.0.encode(encoder, offset + 0, depth)?;
2508            self.1.encode(encoder, offset + 16, depth)?;
2509            Ok(())
2510        }
2511    }
2512
2513    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2514        for ClientProviderNewClientRequest
2515    {
2516        #[inline(always)]
2517        fn new_empty() -> Self {
2518            Self {
2519                params: fidl::new_empty!(
2520                    NewClientParams,
2521                    fidl::encoding::DefaultFuchsiaResourceDialect
2522                ),
2523                request: fidl::new_empty!(
2524                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientMarker>>,
2525                    fidl::encoding::DefaultFuchsiaResourceDialect
2526                ),
2527            }
2528        }
2529
2530        #[inline]
2531        unsafe fn decode(
2532            &mut self,
2533            decoder: &mut fidl::encoding::Decoder<
2534                '_,
2535                fidl::encoding::DefaultFuchsiaResourceDialect,
2536            >,
2537            offset: usize,
2538            _depth: fidl::encoding::Depth,
2539        ) -> fidl::Result<()> {
2540            decoder.debug_check_bounds::<Self>(offset);
2541            // Verify that padding bytes are zero.
2542            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2543            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2544            let mask = 0xffffffff00000000u64;
2545            let maskedval = padval & mask;
2546            if maskedval != 0 {
2547                return Err(fidl::Error::NonZeroPadding {
2548                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2549                });
2550            }
2551            fidl::decode!(
2552                NewClientParams,
2553                fidl::encoding::DefaultFuchsiaResourceDialect,
2554                &mut self.params,
2555                decoder,
2556                offset + 0,
2557                _depth
2558            )?;
2559            fidl::decode!(
2560                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientMarker>>,
2561                fidl::encoding::DefaultFuchsiaResourceDialect,
2562                &mut self.request,
2563                decoder,
2564                offset + 16,
2565                _depth
2566            )?;
2567            Ok(())
2568        }
2569    }
2570
2571    impl fidl::encoding::ResourceTypeMarker for ClientWatchAddressResponse {
2572        type Borrowed<'a> = &'a mut Self;
2573        fn take_or_borrow<'a>(
2574            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2575        ) -> Self::Borrowed<'a> {
2576            value
2577        }
2578    }
2579
2580    unsafe impl fidl::encoding::TypeMarker for ClientWatchAddressResponse {
2581        type Owned = Self;
2582
2583        #[inline(always)]
2584        fn inline_align(_context: fidl::encoding::Context) -> usize {
2585            8
2586        }
2587
2588        #[inline(always)]
2589        fn inline_size(_context: fidl::encoding::Context) -> usize {
2590            48
2591        }
2592    }
2593
2594    unsafe impl
2595        fidl::encoding::Encode<
2596            ClientWatchAddressResponse,
2597            fidl::encoding::DefaultFuchsiaResourceDialect,
2598        > for &mut ClientWatchAddressResponse
2599    {
2600        #[inline]
2601        unsafe fn encode(
2602            self,
2603            encoder: &mut fidl::encoding::Encoder<
2604                '_,
2605                fidl::encoding::DefaultFuchsiaResourceDialect,
2606            >,
2607            offset: usize,
2608            _depth: fidl::encoding::Depth,
2609        ) -> fidl::Result<()> {
2610            encoder.debug_check_bounds::<ClientWatchAddressResponse>(offset);
2611            // Delegate to tuple encoding.
2612            fidl::encoding::Encode::<ClientWatchAddressResponse, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2613                (
2614                    <fidl_fuchsia_net::Subnet as fidl::encoding::ValueTypeMarker>::borrow(&self.address),
2615                    <fidl_fuchsia_net_interfaces_admin::AddressParameters as fidl::encoding::ValueTypeMarker>::borrow(&self.address_parameters),
2616                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.address_state_provider),
2617                ),
2618                encoder, offset, _depth
2619            )
2620        }
2621    }
2622    unsafe impl<
2623        T0: fidl::encoding::Encode<
2624                fidl_fuchsia_net::Subnet,
2625                fidl::encoding::DefaultFuchsiaResourceDialect,
2626            >,
2627        T1: fidl::encoding::Encode<
2628                fidl_fuchsia_net_interfaces_admin::AddressParameters,
2629                fidl::encoding::DefaultFuchsiaResourceDialect,
2630            >,
2631        T2: fidl::encoding::Encode<
2632                fidl::encoding::Endpoint<
2633                    fidl::endpoints::ServerEnd<
2634                        fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
2635                    >,
2636                >,
2637                fidl::encoding::DefaultFuchsiaResourceDialect,
2638            >,
2639    >
2640        fidl::encoding::Encode<
2641            ClientWatchAddressResponse,
2642            fidl::encoding::DefaultFuchsiaResourceDialect,
2643        > for (T0, T1, T2)
2644    {
2645        #[inline]
2646        unsafe fn encode(
2647            self,
2648            encoder: &mut fidl::encoding::Encoder<
2649                '_,
2650                fidl::encoding::DefaultFuchsiaResourceDialect,
2651            >,
2652            offset: usize,
2653            depth: fidl::encoding::Depth,
2654        ) -> fidl::Result<()> {
2655            encoder.debug_check_bounds::<ClientWatchAddressResponse>(offset);
2656            // Zero out padding regions. There's no need to apply masks
2657            // because the unmasked parts will be overwritten by fields.
2658            unsafe {
2659                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(40);
2660                (ptr as *mut u64).write_unaligned(0);
2661            }
2662            // Write the fields.
2663            self.0.encode(encoder, offset + 0, depth)?;
2664            self.1.encode(encoder, offset + 24, depth)?;
2665            self.2.encode(encoder, offset + 40, depth)?;
2666            Ok(())
2667        }
2668    }
2669
2670    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2671        for ClientWatchAddressResponse
2672    {
2673        #[inline(always)]
2674        fn new_empty() -> Self {
2675            Self {
2676                address: fidl::new_empty!(
2677                    fidl_fuchsia_net::Subnet,
2678                    fidl::encoding::DefaultFuchsiaResourceDialect
2679                ),
2680                address_parameters: fidl::new_empty!(
2681                    fidl_fuchsia_net_interfaces_admin::AddressParameters,
2682                    fidl::encoding::DefaultFuchsiaResourceDialect
2683                ),
2684                address_state_provider: fidl::new_empty!(
2685                    fidl::encoding::Endpoint<
2686                        fidl::endpoints::ServerEnd<
2687                            fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
2688                        >,
2689                    >,
2690                    fidl::encoding::DefaultFuchsiaResourceDialect
2691                ),
2692            }
2693        }
2694
2695        #[inline]
2696        unsafe fn decode(
2697            &mut self,
2698            decoder: &mut fidl::encoding::Decoder<
2699                '_,
2700                fidl::encoding::DefaultFuchsiaResourceDialect,
2701            >,
2702            offset: usize,
2703            _depth: fidl::encoding::Depth,
2704        ) -> fidl::Result<()> {
2705            decoder.debug_check_bounds::<Self>(offset);
2706            // Verify that padding bytes are zero.
2707            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(40) };
2708            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2709            let mask = 0xffffffff00000000u64;
2710            let maskedval = padval & mask;
2711            if maskedval != 0 {
2712                return Err(fidl::Error::NonZeroPadding {
2713                    padding_start: offset + 40 + ((mask as u64).trailing_zeros() / 8) as usize,
2714                });
2715            }
2716            fidl::decode!(
2717                fidl_fuchsia_net::Subnet,
2718                fidl::encoding::DefaultFuchsiaResourceDialect,
2719                &mut self.address,
2720                decoder,
2721                offset + 0,
2722                _depth
2723            )?;
2724            fidl::decode!(
2725                fidl_fuchsia_net_interfaces_admin::AddressParameters,
2726                fidl::encoding::DefaultFuchsiaResourceDialect,
2727                &mut self.address_parameters,
2728                decoder,
2729                offset + 24,
2730                _depth
2731            )?;
2732            fidl::decode!(
2733                fidl::encoding::Endpoint<
2734                    fidl::endpoints::ServerEnd<
2735                        fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
2736                    >,
2737                >,
2738                fidl::encoding::DefaultFuchsiaResourceDialect,
2739                &mut self.address_state_provider,
2740                decoder,
2741                offset + 40,
2742                _depth
2743            )?;
2744            Ok(())
2745        }
2746    }
2747
2748    impl fidl::encoding::ResourceTypeMarker for PrefixProviderAcquirePrefixRequest {
2749        type Borrowed<'a> = &'a mut Self;
2750        fn take_or_borrow<'a>(
2751            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
2752        ) -> Self::Borrowed<'a> {
2753            value
2754        }
2755    }
2756
2757    unsafe impl fidl::encoding::TypeMarker for PrefixProviderAcquirePrefixRequest {
2758        type Owned = Self;
2759
2760        #[inline(always)]
2761        fn inline_align(_context: fidl::encoding::Context) -> usize {
2762            8
2763        }
2764
2765        #[inline(always)]
2766        fn inline_size(_context: fidl::encoding::Context) -> usize {
2767            24
2768        }
2769    }
2770
2771    unsafe impl
2772        fidl::encoding::Encode<
2773            PrefixProviderAcquirePrefixRequest,
2774            fidl::encoding::DefaultFuchsiaResourceDialect,
2775        > for &mut PrefixProviderAcquirePrefixRequest
2776    {
2777        #[inline]
2778        unsafe fn encode(
2779            self,
2780            encoder: &mut fidl::encoding::Encoder<
2781                '_,
2782                fidl::encoding::DefaultFuchsiaResourceDialect,
2783            >,
2784            offset: usize,
2785            _depth: fidl::encoding::Depth,
2786        ) -> fidl::Result<()> {
2787            encoder.debug_check_bounds::<PrefixProviderAcquirePrefixRequest>(offset);
2788            // Delegate to tuple encoding.
2789            fidl::encoding::Encode::<PrefixProviderAcquirePrefixRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
2790                (
2791                    <AcquirePrefixConfig as fidl::encoding::ValueTypeMarker>::borrow(&self.config),
2792                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrefixControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.prefix),
2793                ),
2794                encoder, offset, _depth
2795            )
2796        }
2797    }
2798    unsafe impl<
2799        T0: fidl::encoding::Encode<AcquirePrefixConfig, fidl::encoding::DefaultFuchsiaResourceDialect>,
2800        T1: fidl::encoding::Encode<
2801                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrefixControlMarker>>,
2802                fidl::encoding::DefaultFuchsiaResourceDialect,
2803            >,
2804    >
2805        fidl::encoding::Encode<
2806            PrefixProviderAcquirePrefixRequest,
2807            fidl::encoding::DefaultFuchsiaResourceDialect,
2808        > for (T0, T1)
2809    {
2810        #[inline]
2811        unsafe fn encode(
2812            self,
2813            encoder: &mut fidl::encoding::Encoder<
2814                '_,
2815                fidl::encoding::DefaultFuchsiaResourceDialect,
2816            >,
2817            offset: usize,
2818            depth: fidl::encoding::Depth,
2819        ) -> fidl::Result<()> {
2820            encoder.debug_check_bounds::<PrefixProviderAcquirePrefixRequest>(offset);
2821            // Zero out padding regions. There's no need to apply masks
2822            // because the unmasked parts will be overwritten by fields.
2823            unsafe {
2824                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
2825                (ptr as *mut u64).write_unaligned(0);
2826            }
2827            // Write the fields.
2828            self.0.encode(encoder, offset + 0, depth)?;
2829            self.1.encode(encoder, offset + 16, depth)?;
2830            Ok(())
2831        }
2832    }
2833
2834    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
2835        for PrefixProviderAcquirePrefixRequest
2836    {
2837        #[inline(always)]
2838        fn new_empty() -> Self {
2839            Self {
2840                config: fidl::new_empty!(
2841                    AcquirePrefixConfig,
2842                    fidl::encoding::DefaultFuchsiaResourceDialect
2843                ),
2844                prefix: fidl::new_empty!(
2845                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrefixControlMarker>>,
2846                    fidl::encoding::DefaultFuchsiaResourceDialect
2847                ),
2848            }
2849        }
2850
2851        #[inline]
2852        unsafe fn decode(
2853            &mut self,
2854            decoder: &mut fidl::encoding::Decoder<
2855                '_,
2856                fidl::encoding::DefaultFuchsiaResourceDialect,
2857            >,
2858            offset: usize,
2859            _depth: fidl::encoding::Depth,
2860        ) -> fidl::Result<()> {
2861            decoder.debug_check_bounds::<Self>(offset);
2862            // Verify that padding bytes are zero.
2863            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
2864            let padval = unsafe { (ptr as *const u64).read_unaligned() };
2865            let mask = 0xffffffff00000000u64;
2866            let maskedval = padval & mask;
2867            if maskedval != 0 {
2868                return Err(fidl::Error::NonZeroPadding {
2869                    padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
2870                });
2871            }
2872            fidl::decode!(
2873                AcquirePrefixConfig,
2874                fidl::encoding::DefaultFuchsiaResourceDialect,
2875                &mut self.config,
2876                decoder,
2877                offset + 0,
2878                _depth
2879            )?;
2880            fidl::decode!(
2881                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<PrefixControlMarker>>,
2882                fidl::encoding::DefaultFuchsiaResourceDialect,
2883                &mut self.prefix,
2884                decoder,
2885                offset + 16,
2886                _depth
2887            )?;
2888            Ok(())
2889        }
2890    }
2891}