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