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