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