Skip to main content

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