fidl_fuchsia_net_dhcp/
fidl_fuchsia_net_dhcp.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_dhcp__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct ClientProviderNewClientRequest {
16    /// The ID of the interface the client runs on.
17    pub interface_id: u64,
18    /// The parameters with which to create the DHCP client.
19    /// If `configuration_to_request` is unset and `request_ip_address` is
20    /// false, `request` is closed with terminal event `INVALID_PARAMS`.
21    pub params: NewClientParams,
22    pub request: fidl::endpoints::ServerEnd<ClientMarker>,
23}
24
25impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
26    for ClientProviderNewClientRequest
27{
28}
29
30#[derive(Debug, Default, PartialEq)]
31pub struct Address {
32    /// The assigned address and prefix length.
33    pub address: Option<fidl_fuchsia_net::Ipv4AddressWithPrefix>,
34    /// The parameters of the address.
35    pub address_parameters: Option<fidl_fuchsia_net_interfaces_admin::AddressParameters>,
36    /// Provides address assignment state and enables updating address
37    /// properties; the DHCP client closes the client end if the address
38    /// becomes invalid (its valid lifetime expires and Renew and Rebind
39    /// have not succeeded).
40    /// The server end can be closed with a terminal OnAddressRemoved
41    /// value in order to signal to the DHCP client that an address is
42    /// rejected (e.g. due to failing duplicate address detection).
43    pub address_state_provider: Option<
44        fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker>,
45    >,
46    #[doc(hidden)]
47    pub __source_breaking: fidl::marker::SourceBreaking,
48}
49
50impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect> for Address {}
51
52#[derive(Debug, Default, PartialEq)]
53pub struct ClientWatchConfigurationResponse {
54    pub address: Option<Address>,
55    pub dns_servers: Option<Vec<fidl_fuchsia_net::Ipv4Address>>,
56    pub routers: Option<Vec<fidl_fuchsia_net::Ipv4Address>>,
57    #[doc(hidden)]
58    pub __source_breaking: fidl::marker::SourceBreaking,
59}
60
61impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
62    for ClientWatchConfigurationResponse
63{
64}
65
66#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
67pub struct ClientMarker;
68
69impl fidl::endpoints::ProtocolMarker for ClientMarker {
70    type Proxy = ClientProxy;
71    type RequestStream = ClientRequestStream;
72    #[cfg(target_os = "fuchsia")]
73    type SynchronousProxy = ClientSynchronousProxy;
74
75    const DEBUG_NAME: &'static str = "(anonymous) Client";
76}
77
78pub trait ClientProxyInterface: Send + Sync {
79    type WatchConfigurationResponseFut: std::future::Future<Output = Result<ClientWatchConfigurationResponse, fidl::Error>>
80        + Send;
81    fn r#watch_configuration(&self) -> Self::WatchConfigurationResponseFut;
82    fn r#shutdown(&self) -> Result<(), fidl::Error>;
83}
84#[derive(Debug)]
85#[cfg(target_os = "fuchsia")]
86pub struct ClientSynchronousProxy {
87    client: fidl::client::sync::Client,
88}
89
90#[cfg(target_os = "fuchsia")]
91impl fidl::endpoints::SynchronousProxy for ClientSynchronousProxy {
92    type Proxy = ClientProxy;
93    type Protocol = ClientMarker;
94
95    fn from_channel(inner: fidl::Channel) -> Self {
96        Self::new(inner)
97    }
98
99    fn into_channel(self) -> fidl::Channel {
100        self.client.into_channel()
101    }
102
103    fn as_channel(&self) -> &fidl::Channel {
104        self.client.as_channel()
105    }
106}
107
108#[cfg(target_os = "fuchsia")]
109impl ClientSynchronousProxy {
110    pub fn new(channel: fidl::Channel) -> Self {
111        let protocol_name = <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
112        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
113    }
114
115    pub fn into_channel(self) -> fidl::Channel {
116        self.client.into_channel()
117    }
118
119    /// Waits until an event arrives and returns it. It is safe for other
120    /// threads to make concurrent requests while waiting for an event.
121    pub fn wait_for_event(
122        &self,
123        deadline: zx::MonotonicInstant,
124    ) -> Result<ClientEvent, fidl::Error> {
125        ClientEvent::decode(self.client.wait_for_event(deadline)?)
126    }
127
128    /// Returns acquired DHCP configuration.
129    ///
130    /// Yields a value whenever the client acquires new configuration. Notably,
131    /// does not yield a value upon DHCP lease expiry; instead, expiry of the IP
132    /// address is communicated via the `AddressStateProvider` (refer to
133    /// documentation of `fuchsia.net.interfaces.admin/AddressStateProvider` for
134    /// details). Non-address configuration does not expire, but is replaced by
135    /// new configuration once a new DHCP lease is obtained.
136    ///
137    /// It is invalid to call this method while a previous call is pending.
138    /// Doing so causes the server end of the protocol to be closed.
139    ///
140    /// - response `address` the assigned address. If set, the client has
141    ///     acquired a new lease on an IP address. If not set, then either the
142    ///     client has not requested an IP address (in which case this `Client`
143    ///     instance has never yielded an address), or the client continues to
144    ///     hold a lease on a previously-acquired IP address (whose lifetime is
145    ///     updated via `AddressStateProvider`).
146    /// - response `dns_servers` addresses of discovered DNS servers. If absent,
147    ///     must be interpreted as empty (the client's configuration indicates
148    ///     no DNS servers, even if previously-yielded configuration included
149    ///     DNS servers).
150    /// - response `routers` addresses of discovered routers on the client's
151    ///     subnet, in descending order of preference according to the DHCP
152    ///     server. If absent, must be interpreted as empty (the client's
153    ///     configuration indicates no routers, even if previously-yielded
154    ///     configuration included routers).
155    pub fn r#watch_configuration(
156        &self,
157        ___deadline: zx::MonotonicInstant,
158    ) -> Result<ClientWatchConfigurationResponse, fidl::Error> {
159        let _response = self
160            .client
161            .send_query::<fidl::encoding::EmptyPayload, ClientWatchConfigurationResponse>(
162                (),
163                0x2b6f7c7d3bcc6682,
164                fidl::encoding::DynamicFlags::empty(),
165                ___deadline,
166            )?;
167        Ok(_response)
168    }
169
170    /// Instructs the client to shut down gracefully (releasing any DHCP lease
171    /// currently held). When the client is finished shutting down, it yields
172    /// the `ClientExitReason::GRACEFUL_SHUTDOWN` `OnExit` event.
173    pub fn r#shutdown(&self) -> Result<(), fidl::Error> {
174        self.client.send::<fidl::encoding::EmptyPayload>(
175            (),
176            0x265a3213e9a8abde,
177            fidl::encoding::DynamicFlags::empty(),
178        )
179    }
180}
181
182#[cfg(target_os = "fuchsia")]
183impl From<ClientSynchronousProxy> for zx::Handle {
184    fn from(value: ClientSynchronousProxy) -> Self {
185        value.into_channel().into()
186    }
187}
188
189#[cfg(target_os = "fuchsia")]
190impl From<fidl::Channel> for ClientSynchronousProxy {
191    fn from(value: fidl::Channel) -> Self {
192        Self::new(value)
193    }
194}
195
196#[cfg(target_os = "fuchsia")]
197impl fidl::endpoints::FromClient for ClientSynchronousProxy {
198    type Protocol = ClientMarker;
199
200    fn from_client(value: fidl::endpoints::ClientEnd<ClientMarker>) -> Self {
201        Self::new(value.into_channel())
202    }
203}
204
205#[derive(Debug, Clone)]
206pub struct ClientProxy {
207    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
208}
209
210impl fidl::endpoints::Proxy for ClientProxy {
211    type Protocol = ClientMarker;
212
213    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
214        Self::new(inner)
215    }
216
217    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
218        self.client.into_channel().map_err(|client| Self { client })
219    }
220
221    fn as_channel(&self) -> &::fidl::AsyncChannel {
222        self.client.as_channel()
223    }
224}
225
226impl ClientProxy {
227    /// Create a new Proxy for fuchsia.net.dhcp/Client.
228    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
229        let protocol_name = <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
230        Self { client: fidl::client::Client::new(channel, protocol_name) }
231    }
232
233    /// Get a Stream of events from the remote end of the protocol.
234    ///
235    /// # Panics
236    ///
237    /// Panics if the event stream was already taken.
238    pub fn take_event_stream(&self) -> ClientEventStream {
239        ClientEventStream { event_receiver: self.client.take_event_receiver() }
240    }
241
242    /// Returns acquired DHCP configuration.
243    ///
244    /// Yields a value whenever the client acquires new configuration. Notably,
245    /// does not yield a value upon DHCP lease expiry; instead, expiry of the IP
246    /// address is communicated via the `AddressStateProvider` (refer to
247    /// documentation of `fuchsia.net.interfaces.admin/AddressStateProvider` for
248    /// details). Non-address configuration does not expire, but is replaced by
249    /// new configuration once a new DHCP lease is obtained.
250    ///
251    /// It is invalid to call this method while a previous call is pending.
252    /// Doing so causes the server end of the protocol to be closed.
253    ///
254    /// - response `address` the assigned address. If set, the client has
255    ///     acquired a new lease on an IP address. If not set, then either the
256    ///     client has not requested an IP address (in which case this `Client`
257    ///     instance has never yielded an address), or the client continues to
258    ///     hold a lease on a previously-acquired IP address (whose lifetime is
259    ///     updated via `AddressStateProvider`).
260    /// - response `dns_servers` addresses of discovered DNS servers. If absent,
261    ///     must be interpreted as empty (the client's configuration indicates
262    ///     no DNS servers, even if previously-yielded configuration included
263    ///     DNS servers).
264    /// - response `routers` addresses of discovered routers on the client's
265    ///     subnet, in descending order of preference according to the DHCP
266    ///     server. If absent, must be interpreted as empty (the client's
267    ///     configuration indicates no routers, even if previously-yielded
268    ///     configuration included routers).
269    pub fn r#watch_configuration(
270        &self,
271    ) -> fidl::client::QueryResponseFut<
272        ClientWatchConfigurationResponse,
273        fidl::encoding::DefaultFuchsiaResourceDialect,
274    > {
275        ClientProxyInterface::r#watch_configuration(self)
276    }
277
278    /// Instructs the client to shut down gracefully (releasing any DHCP lease
279    /// currently held). When the client is finished shutting down, it yields
280    /// the `ClientExitReason::GRACEFUL_SHUTDOWN` `OnExit` event.
281    pub fn r#shutdown(&self) -> Result<(), fidl::Error> {
282        ClientProxyInterface::r#shutdown(self)
283    }
284}
285
286impl ClientProxyInterface for ClientProxy {
287    type WatchConfigurationResponseFut = fidl::client::QueryResponseFut<
288        ClientWatchConfigurationResponse,
289        fidl::encoding::DefaultFuchsiaResourceDialect,
290    >;
291    fn r#watch_configuration(&self) -> Self::WatchConfigurationResponseFut {
292        fn _decode(
293            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
294        ) -> Result<ClientWatchConfigurationResponse, fidl::Error> {
295            let _response = fidl::client::decode_transaction_body::<
296                ClientWatchConfigurationResponse,
297                fidl::encoding::DefaultFuchsiaResourceDialect,
298                0x2b6f7c7d3bcc6682,
299            >(_buf?)?;
300            Ok(_response)
301        }
302        self.client.send_query_and_decode::<
303            fidl::encoding::EmptyPayload,
304            ClientWatchConfigurationResponse,
305        >(
306            (),
307            0x2b6f7c7d3bcc6682,
308            fidl::encoding::DynamicFlags::empty(),
309            _decode,
310        )
311    }
312
313    fn r#shutdown(&self) -> Result<(), fidl::Error> {
314        self.client.send::<fidl::encoding::EmptyPayload>(
315            (),
316            0x265a3213e9a8abde,
317            fidl::encoding::DynamicFlags::empty(),
318        )
319    }
320}
321
322pub struct ClientEventStream {
323    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
324}
325
326impl std::marker::Unpin for ClientEventStream {}
327
328impl futures::stream::FusedStream for ClientEventStream {
329    fn is_terminated(&self) -> bool {
330        self.event_receiver.is_terminated()
331    }
332}
333
334impl futures::Stream for ClientEventStream {
335    type Item = Result<ClientEvent, fidl::Error>;
336
337    fn poll_next(
338        mut self: std::pin::Pin<&mut Self>,
339        cx: &mut std::task::Context<'_>,
340    ) -> std::task::Poll<Option<Self::Item>> {
341        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
342            &mut self.event_receiver,
343            cx
344        )?) {
345            Some(buf) => std::task::Poll::Ready(Some(ClientEvent::decode(buf))),
346            None => std::task::Poll::Ready(None),
347        }
348    }
349}
350
351#[derive(Debug)]
352pub enum ClientEvent {
353    OnExit { reason: ClientExitReason },
354}
355
356impl ClientEvent {
357    #[allow(irrefutable_let_patterns)]
358    pub fn into_on_exit(self) -> Option<ClientExitReason> {
359        if let ClientEvent::OnExit { reason } = self { Some((reason)) } else { None }
360    }
361
362    /// Decodes a message buffer as a [`ClientEvent`].
363    fn decode(
364        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
365    ) -> Result<ClientEvent, fidl::Error> {
366        let (bytes, _handles) = buf.split_mut();
367        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
368        debug_assert_eq!(tx_header.tx_id, 0);
369        match tx_header.ordinal {
370            0x2a2a052260f657c0 => {
371                let mut out = fidl::new_empty!(
372                    ClientOnExitRequest,
373                    fidl::encoding::DefaultFuchsiaResourceDialect
374                );
375                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientOnExitRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
376                Ok((ClientEvent::OnExit { reason: out.reason }))
377            }
378            _ => Err(fidl::Error::UnknownOrdinal {
379                ordinal: tx_header.ordinal,
380                protocol_name: <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
381            }),
382        }
383    }
384}
385
386/// A Stream of incoming requests for fuchsia.net.dhcp/Client.
387pub struct ClientRequestStream {
388    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
389    is_terminated: bool,
390}
391
392impl std::marker::Unpin for ClientRequestStream {}
393
394impl futures::stream::FusedStream for ClientRequestStream {
395    fn is_terminated(&self) -> bool {
396        self.is_terminated
397    }
398}
399
400impl fidl::endpoints::RequestStream for ClientRequestStream {
401    type Protocol = ClientMarker;
402    type ControlHandle = ClientControlHandle;
403
404    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
405        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
406    }
407
408    fn control_handle(&self) -> Self::ControlHandle {
409        ClientControlHandle { inner: self.inner.clone() }
410    }
411
412    fn into_inner(
413        self,
414    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
415    {
416        (self.inner, self.is_terminated)
417    }
418
419    fn from_inner(
420        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
421        is_terminated: bool,
422    ) -> Self {
423        Self { inner, is_terminated }
424    }
425}
426
427impl futures::Stream for ClientRequestStream {
428    type Item = Result<ClientRequest, fidl::Error>;
429
430    fn poll_next(
431        mut self: std::pin::Pin<&mut Self>,
432        cx: &mut std::task::Context<'_>,
433    ) -> std::task::Poll<Option<Self::Item>> {
434        let this = &mut *self;
435        if this.inner.check_shutdown(cx) {
436            this.is_terminated = true;
437            return std::task::Poll::Ready(None);
438        }
439        if this.is_terminated {
440            panic!("polled ClientRequestStream after completion");
441        }
442        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
443            |bytes, handles| {
444                match this.inner.channel().read_etc(cx, bytes, handles) {
445                    std::task::Poll::Ready(Ok(())) => {}
446                    std::task::Poll::Pending => return std::task::Poll::Pending,
447                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
448                        this.is_terminated = true;
449                        return std::task::Poll::Ready(None);
450                    }
451                    std::task::Poll::Ready(Err(e)) => {
452                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
453                            e.into(),
454                        ))));
455                    }
456                }
457
458                // A message has been received from the channel
459                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
460
461                std::task::Poll::Ready(Some(match header.ordinal {
462                    0x2b6f7c7d3bcc6682 => {
463                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
464                        let mut req = fidl::new_empty!(
465                            fidl::encoding::EmptyPayload,
466                            fidl::encoding::DefaultFuchsiaResourceDialect
467                        );
468                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
469                        let control_handle = ClientControlHandle { inner: this.inner.clone() };
470                        Ok(ClientRequest::WatchConfiguration {
471                            responder: ClientWatchConfigurationResponder {
472                                control_handle: std::mem::ManuallyDrop::new(control_handle),
473                                tx_id: header.tx_id,
474                            },
475                        })
476                    }
477                    0x265a3213e9a8abde => {
478                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
479                        let mut req = fidl::new_empty!(
480                            fidl::encoding::EmptyPayload,
481                            fidl::encoding::DefaultFuchsiaResourceDialect
482                        );
483                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
484                        let control_handle = ClientControlHandle { inner: this.inner.clone() };
485                        Ok(ClientRequest::Shutdown { control_handle })
486                    }
487                    _ => Err(fidl::Error::UnknownOrdinal {
488                        ordinal: header.ordinal,
489                        protocol_name:
490                            <ClientMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
491                    }),
492                }))
493            },
494        )
495    }
496}
497
498/// Provides methods to watch for discovered network configurations and control
499/// the DHCP client discovering them.
500///
501/// This protocol encodes the DHCP client's lifetime in both directions;
502/// the DHCP client remains alive iff both ends of the protocol are open. That
503/// is:
504///
505/// - Closing the client end causes the DHCP client to be destroyed.
506/// - Observing a closure of the server end indicates the DHCP client no longer
507///   exists.
508#[derive(Debug)]
509pub enum ClientRequest {
510    /// Returns acquired DHCP configuration.
511    ///
512    /// Yields a value whenever the client acquires new configuration. Notably,
513    /// does not yield a value upon DHCP lease expiry; instead, expiry of the IP
514    /// address is communicated via the `AddressStateProvider` (refer to
515    /// documentation of `fuchsia.net.interfaces.admin/AddressStateProvider` for
516    /// details). Non-address configuration does not expire, but is replaced by
517    /// new configuration once a new DHCP lease is obtained.
518    ///
519    /// It is invalid to call this method while a previous call is pending.
520    /// Doing so causes the server end of the protocol to be closed.
521    ///
522    /// - response `address` the assigned address. If set, the client has
523    ///     acquired a new lease on an IP address. If not set, then either the
524    ///     client has not requested an IP address (in which case this `Client`
525    ///     instance has never yielded an address), or the client continues to
526    ///     hold a lease on a previously-acquired IP address (whose lifetime is
527    ///     updated via `AddressStateProvider`).
528    /// - response `dns_servers` addresses of discovered DNS servers. If absent,
529    ///     must be interpreted as empty (the client's configuration indicates
530    ///     no DNS servers, even if previously-yielded configuration included
531    ///     DNS servers).
532    /// - response `routers` addresses of discovered routers on the client's
533    ///     subnet, in descending order of preference according to the DHCP
534    ///     server. If absent, must be interpreted as empty (the client's
535    ///     configuration indicates no routers, even if previously-yielded
536    ///     configuration included routers).
537    WatchConfiguration { responder: ClientWatchConfigurationResponder },
538    /// Instructs the client to shut down gracefully (releasing any DHCP lease
539    /// currently held). When the client is finished shutting down, it yields
540    /// the `ClientExitReason::GRACEFUL_SHUTDOWN` `OnExit` event.
541    Shutdown { control_handle: ClientControlHandle },
542}
543
544impl ClientRequest {
545    #[allow(irrefutable_let_patterns)]
546    pub fn into_watch_configuration(self) -> Option<(ClientWatchConfigurationResponder)> {
547        if let ClientRequest::WatchConfiguration { responder } = self {
548            Some((responder))
549        } else {
550            None
551        }
552    }
553
554    #[allow(irrefutable_let_patterns)]
555    pub fn into_shutdown(self) -> Option<(ClientControlHandle)> {
556        if let ClientRequest::Shutdown { control_handle } = self {
557            Some((control_handle))
558        } else {
559            None
560        }
561    }
562
563    /// Name of the method defined in FIDL
564    pub fn method_name(&self) -> &'static str {
565        match *self {
566            ClientRequest::WatchConfiguration { .. } => "watch_configuration",
567            ClientRequest::Shutdown { .. } => "shutdown",
568        }
569    }
570}
571
572#[derive(Debug, Clone)]
573pub struct ClientControlHandle {
574    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
575}
576
577impl fidl::endpoints::ControlHandle for ClientControlHandle {
578    fn shutdown(&self) {
579        self.inner.shutdown()
580    }
581    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
582        self.inner.shutdown_with_epitaph(status)
583    }
584
585    fn is_closed(&self) -> bool {
586        self.inner.channel().is_closed()
587    }
588    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
589        self.inner.channel().on_closed()
590    }
591
592    #[cfg(target_os = "fuchsia")]
593    fn signal_peer(
594        &self,
595        clear_mask: zx::Signals,
596        set_mask: zx::Signals,
597    ) -> Result<(), zx_status::Status> {
598        use fidl::Peered;
599        self.inner.channel().signal_peer(clear_mask, set_mask)
600    }
601}
602
603impl ClientControlHandle {
604    pub fn send_on_exit(&self, mut reason: ClientExitReason) -> Result<(), fidl::Error> {
605        self.inner.send::<ClientOnExitRequest>(
606            (reason,),
607            0,
608            0x2a2a052260f657c0,
609            fidl::encoding::DynamicFlags::empty(),
610        )
611    }
612}
613
614#[must_use = "FIDL methods require a response to be sent"]
615#[derive(Debug)]
616pub struct ClientWatchConfigurationResponder {
617    control_handle: std::mem::ManuallyDrop<ClientControlHandle>,
618    tx_id: u32,
619}
620
621/// Set the the channel to be shutdown (see [`ClientControlHandle::shutdown`])
622/// if the responder is dropped without sending a response, so that the client
623/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
624impl std::ops::Drop for ClientWatchConfigurationResponder {
625    fn drop(&mut self) {
626        self.control_handle.shutdown();
627        // Safety: drops once, never accessed again
628        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
629    }
630}
631
632impl fidl::endpoints::Responder for ClientWatchConfigurationResponder {
633    type ControlHandle = ClientControlHandle;
634
635    fn control_handle(&self) -> &ClientControlHandle {
636        &self.control_handle
637    }
638
639    fn drop_without_shutdown(mut self) {
640        // Safety: drops once, never accessed again due to mem::forget
641        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
642        // Prevent Drop from running (which would shut down the channel)
643        std::mem::forget(self);
644    }
645}
646
647impl ClientWatchConfigurationResponder {
648    /// Sends a response to the FIDL transaction.
649    ///
650    /// Sets the channel to shutdown if an error occurs.
651    pub fn send(self, mut payload: ClientWatchConfigurationResponse) -> Result<(), fidl::Error> {
652        let _result = self.send_raw(payload);
653        if _result.is_err() {
654            self.control_handle.shutdown();
655        }
656        self.drop_without_shutdown();
657        _result
658    }
659
660    /// Similar to "send" but does not shutdown the channel if an error occurs.
661    pub fn send_no_shutdown_on_err(
662        self,
663        mut payload: ClientWatchConfigurationResponse,
664    ) -> Result<(), fidl::Error> {
665        let _result = self.send_raw(payload);
666        self.drop_without_shutdown();
667        _result
668    }
669
670    fn send_raw(&self, mut payload: ClientWatchConfigurationResponse) -> Result<(), fidl::Error> {
671        self.control_handle.inner.send::<ClientWatchConfigurationResponse>(
672            &mut payload,
673            self.tx_id,
674            0x2b6f7c7d3bcc6682,
675            fidl::encoding::DynamicFlags::empty(),
676        )
677    }
678}
679
680#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
681pub struct ClientProviderMarker;
682
683impl fidl::endpoints::ProtocolMarker for ClientProviderMarker {
684    type Proxy = ClientProviderProxy;
685    type RequestStream = ClientProviderRequestStream;
686    #[cfg(target_os = "fuchsia")]
687    type SynchronousProxy = ClientProviderSynchronousProxy;
688
689    const DEBUG_NAME: &'static str = "fuchsia.net.dhcp.ClientProvider";
690}
691impl fidl::endpoints::DiscoverableProtocolMarker for ClientProviderMarker {}
692
693pub trait ClientProviderProxyInterface: Send + Sync {
694    fn r#new_client(
695        &self,
696        interface_id: u64,
697        params: &NewClientParams,
698        request: fidl::endpoints::ServerEnd<ClientMarker>,
699    ) -> Result<(), fidl::Error>;
700    type CheckPresenceResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
701    fn r#check_presence(&self) -> Self::CheckPresenceResponseFut;
702}
703#[derive(Debug)]
704#[cfg(target_os = "fuchsia")]
705pub struct ClientProviderSynchronousProxy {
706    client: fidl::client::sync::Client,
707}
708
709#[cfg(target_os = "fuchsia")]
710impl fidl::endpoints::SynchronousProxy for ClientProviderSynchronousProxy {
711    type Proxy = ClientProviderProxy;
712    type Protocol = ClientProviderMarker;
713
714    fn from_channel(inner: fidl::Channel) -> Self {
715        Self::new(inner)
716    }
717
718    fn into_channel(self) -> fidl::Channel {
719        self.client.into_channel()
720    }
721
722    fn as_channel(&self) -> &fidl::Channel {
723        self.client.as_channel()
724    }
725}
726
727#[cfg(target_os = "fuchsia")]
728impl ClientProviderSynchronousProxy {
729    pub fn new(channel: fidl::Channel) -> Self {
730        let protocol_name = <ClientProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
731        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
732    }
733
734    pub fn into_channel(self) -> fidl::Channel {
735        self.client.into_channel()
736    }
737
738    /// Waits until an event arrives and returns it. It is safe for other
739    /// threads to make concurrent requests while waiting for an event.
740    pub fn wait_for_event(
741        &self,
742        deadline: zx::MonotonicInstant,
743    ) -> Result<ClientProviderEvent, fidl::Error> {
744        ClientProviderEvent::decode(self.client.wait_for_event(deadline)?)
745    }
746
747    /// Provides a DHCPv4 client.
748    ///
749    /// + request `params` the parameters to create the client with.
750    /// + request `request` grants control over the client.
751    pub fn r#new_client(
752        &self,
753        mut interface_id: u64,
754        mut params: &NewClientParams,
755        mut request: fidl::endpoints::ServerEnd<ClientMarker>,
756    ) -> Result<(), fidl::Error> {
757        self.client.send::<ClientProviderNewClientRequest>(
758            (interface_id, params, request),
759            0x317e9af2e462cbcd,
760            fidl::encoding::DynamicFlags::empty(),
761        )
762    }
763
764    /// No-op method that allows checking for presence.
765    ///
766    /// TODO(https://fxbug.dev/296283299): It's not currently possible for a
767    /// client with an optionally-provided protocol to check whether there's
768    /// someone on the other end without making a FIDL call . This method
769    /// provides a workaround by giving a client a method that it can call to
770    /// check for liveness.
771    ///
772    /// TODO(https://fxbug.dev/42076541): Remove this once the DHCP out-of-stack
773    /// client is always being used.
774    pub fn r#check_presence(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
775        let _response =
776            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
777                (),
778                0x7ba657cd730bbf60,
779                fidl::encoding::DynamicFlags::empty(),
780                ___deadline,
781            )?;
782        Ok(_response)
783    }
784}
785
786#[cfg(target_os = "fuchsia")]
787impl From<ClientProviderSynchronousProxy> for zx::Handle {
788    fn from(value: ClientProviderSynchronousProxy) -> Self {
789        value.into_channel().into()
790    }
791}
792
793#[cfg(target_os = "fuchsia")]
794impl From<fidl::Channel> for ClientProviderSynchronousProxy {
795    fn from(value: fidl::Channel) -> Self {
796        Self::new(value)
797    }
798}
799
800#[cfg(target_os = "fuchsia")]
801impl fidl::endpoints::FromClient for ClientProviderSynchronousProxy {
802    type Protocol = ClientProviderMarker;
803
804    fn from_client(value: fidl::endpoints::ClientEnd<ClientProviderMarker>) -> Self {
805        Self::new(value.into_channel())
806    }
807}
808
809#[derive(Debug, Clone)]
810pub struct ClientProviderProxy {
811    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
812}
813
814impl fidl::endpoints::Proxy for ClientProviderProxy {
815    type Protocol = ClientProviderMarker;
816
817    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
818        Self::new(inner)
819    }
820
821    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
822        self.client.into_channel().map_err(|client| Self { client })
823    }
824
825    fn as_channel(&self) -> &::fidl::AsyncChannel {
826        self.client.as_channel()
827    }
828}
829
830impl ClientProviderProxy {
831    /// Create a new Proxy for fuchsia.net.dhcp/ClientProvider.
832    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
833        let protocol_name = <ClientProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
834        Self { client: fidl::client::Client::new(channel, protocol_name) }
835    }
836
837    /// Get a Stream of events from the remote end of the protocol.
838    ///
839    /// # Panics
840    ///
841    /// Panics if the event stream was already taken.
842    pub fn take_event_stream(&self) -> ClientProviderEventStream {
843        ClientProviderEventStream { event_receiver: self.client.take_event_receiver() }
844    }
845
846    /// Provides a DHCPv4 client.
847    ///
848    /// + request `params` the parameters to create the client with.
849    /// + request `request` grants control over the client.
850    pub fn r#new_client(
851        &self,
852        mut interface_id: u64,
853        mut params: &NewClientParams,
854        mut request: fidl::endpoints::ServerEnd<ClientMarker>,
855    ) -> Result<(), fidl::Error> {
856        ClientProviderProxyInterface::r#new_client(self, interface_id, params, request)
857    }
858
859    /// No-op method that allows checking for presence.
860    ///
861    /// TODO(https://fxbug.dev/296283299): It's not currently possible for a
862    /// client with an optionally-provided protocol to check whether there's
863    /// someone on the other end without making a FIDL call . This method
864    /// provides a workaround by giving a client a method that it can call to
865    /// check for liveness.
866    ///
867    /// TODO(https://fxbug.dev/42076541): Remove this once the DHCP out-of-stack
868    /// client is always being used.
869    pub fn r#check_presence(
870        &self,
871    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
872        ClientProviderProxyInterface::r#check_presence(self)
873    }
874}
875
876impl ClientProviderProxyInterface for ClientProviderProxy {
877    fn r#new_client(
878        &self,
879        mut interface_id: u64,
880        mut params: &NewClientParams,
881        mut request: fidl::endpoints::ServerEnd<ClientMarker>,
882    ) -> Result<(), fidl::Error> {
883        self.client.send::<ClientProviderNewClientRequest>(
884            (interface_id, params, request),
885            0x317e9af2e462cbcd,
886            fidl::encoding::DynamicFlags::empty(),
887        )
888    }
889
890    type CheckPresenceResponseFut =
891        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
892    fn r#check_presence(&self) -> Self::CheckPresenceResponseFut {
893        fn _decode(
894            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
895        ) -> Result<(), fidl::Error> {
896            let _response = fidl::client::decode_transaction_body::<
897                fidl::encoding::EmptyPayload,
898                fidl::encoding::DefaultFuchsiaResourceDialect,
899                0x7ba657cd730bbf60,
900            >(_buf?)?;
901            Ok(_response)
902        }
903        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
904            (),
905            0x7ba657cd730bbf60,
906            fidl::encoding::DynamicFlags::empty(),
907            _decode,
908        )
909    }
910}
911
912pub struct ClientProviderEventStream {
913    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
914}
915
916impl std::marker::Unpin for ClientProviderEventStream {}
917
918impl futures::stream::FusedStream for ClientProviderEventStream {
919    fn is_terminated(&self) -> bool {
920        self.event_receiver.is_terminated()
921    }
922}
923
924impl futures::Stream for ClientProviderEventStream {
925    type Item = Result<ClientProviderEvent, fidl::Error>;
926
927    fn poll_next(
928        mut self: std::pin::Pin<&mut Self>,
929        cx: &mut std::task::Context<'_>,
930    ) -> std::task::Poll<Option<Self::Item>> {
931        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
932            &mut self.event_receiver,
933            cx
934        )?) {
935            Some(buf) => std::task::Poll::Ready(Some(ClientProviderEvent::decode(buf))),
936            None => std::task::Poll::Ready(None),
937        }
938    }
939}
940
941#[derive(Debug)]
942pub enum ClientProviderEvent {}
943
944impl ClientProviderEvent {
945    /// Decodes a message buffer as a [`ClientProviderEvent`].
946    fn decode(
947        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
948    ) -> Result<ClientProviderEvent, fidl::Error> {
949        let (bytes, _handles) = buf.split_mut();
950        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
951        debug_assert_eq!(tx_header.tx_id, 0);
952        match tx_header.ordinal {
953            _ => Err(fidl::Error::UnknownOrdinal {
954                ordinal: tx_header.ordinal,
955                protocol_name:
956                    <ClientProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
957            }),
958        }
959    }
960}
961
962/// A Stream of incoming requests for fuchsia.net.dhcp/ClientProvider.
963pub struct ClientProviderRequestStream {
964    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
965    is_terminated: bool,
966}
967
968impl std::marker::Unpin for ClientProviderRequestStream {}
969
970impl futures::stream::FusedStream for ClientProviderRequestStream {
971    fn is_terminated(&self) -> bool {
972        self.is_terminated
973    }
974}
975
976impl fidl::endpoints::RequestStream for ClientProviderRequestStream {
977    type Protocol = ClientProviderMarker;
978    type ControlHandle = ClientProviderControlHandle;
979
980    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
981        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
982    }
983
984    fn control_handle(&self) -> Self::ControlHandle {
985        ClientProviderControlHandle { inner: self.inner.clone() }
986    }
987
988    fn into_inner(
989        self,
990    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
991    {
992        (self.inner, self.is_terminated)
993    }
994
995    fn from_inner(
996        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
997        is_terminated: bool,
998    ) -> Self {
999        Self { inner, is_terminated }
1000    }
1001}
1002
1003impl futures::Stream for ClientProviderRequestStream {
1004    type Item = Result<ClientProviderRequest, fidl::Error>;
1005
1006    fn poll_next(
1007        mut self: std::pin::Pin<&mut Self>,
1008        cx: &mut std::task::Context<'_>,
1009    ) -> std::task::Poll<Option<Self::Item>> {
1010        let this = &mut *self;
1011        if this.inner.check_shutdown(cx) {
1012            this.is_terminated = true;
1013            return std::task::Poll::Ready(None);
1014        }
1015        if this.is_terminated {
1016            panic!("polled ClientProviderRequestStream after completion");
1017        }
1018        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1019            |bytes, handles| {
1020                match this.inner.channel().read_etc(cx, bytes, handles) {
1021                    std::task::Poll::Ready(Ok(())) => {}
1022                    std::task::Poll::Pending => return std::task::Poll::Pending,
1023                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1024                        this.is_terminated = true;
1025                        return std::task::Poll::Ready(None);
1026                    }
1027                    std::task::Poll::Ready(Err(e)) => {
1028                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1029                            e.into(),
1030                        ))));
1031                    }
1032                }
1033
1034                // A message has been received from the channel
1035                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1036
1037                std::task::Poll::Ready(Some(match header.ordinal {
1038                    0x317e9af2e462cbcd => {
1039                        header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1040                        let mut req = fidl::new_empty!(
1041                            ClientProviderNewClientRequest,
1042                            fidl::encoding::DefaultFuchsiaResourceDialect
1043                        );
1044                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ClientProviderNewClientRequest>(&header, _body_bytes, handles, &mut req)?;
1045                        let control_handle =
1046                            ClientProviderControlHandle { inner: this.inner.clone() };
1047                        Ok(ClientProviderRequest::NewClient {
1048                            interface_id: req.interface_id,
1049                            params: req.params,
1050                            request: req.request,
1051
1052                            control_handle,
1053                        })
1054                    }
1055                    0x7ba657cd730bbf60 => {
1056                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1057                        let mut req = fidl::new_empty!(
1058                            fidl::encoding::EmptyPayload,
1059                            fidl::encoding::DefaultFuchsiaResourceDialect
1060                        );
1061                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1062                        let control_handle =
1063                            ClientProviderControlHandle { inner: this.inner.clone() };
1064                        Ok(ClientProviderRequest::CheckPresence {
1065                            responder: ClientProviderCheckPresenceResponder {
1066                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1067                                tx_id: header.tx_id,
1068                            },
1069                        })
1070                    }
1071                    _ => Err(fidl::Error::UnknownOrdinal {
1072                        ordinal: header.ordinal,
1073                        protocol_name:
1074                            <ClientProviderMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1075                    }),
1076                }))
1077            },
1078        )
1079    }
1080}
1081
1082/// Provides a method to create new DHCP clients.
1083#[derive(Debug)]
1084pub enum ClientProviderRequest {
1085    /// Provides a DHCPv4 client.
1086    ///
1087    /// + request `params` the parameters to create the client with.
1088    /// + request `request` grants control over the client.
1089    NewClient {
1090        interface_id: u64,
1091        params: NewClientParams,
1092        request: fidl::endpoints::ServerEnd<ClientMarker>,
1093        control_handle: ClientProviderControlHandle,
1094    },
1095    /// No-op method that allows checking for presence.
1096    ///
1097    /// TODO(https://fxbug.dev/296283299): It's not currently possible for a
1098    /// client with an optionally-provided protocol to check whether there's
1099    /// someone on the other end without making a FIDL call . This method
1100    /// provides a workaround by giving a client a method that it can call to
1101    /// check for liveness.
1102    ///
1103    /// TODO(https://fxbug.dev/42076541): Remove this once the DHCP out-of-stack
1104    /// client is always being used.
1105    CheckPresence { responder: ClientProviderCheckPresenceResponder },
1106}
1107
1108impl ClientProviderRequest {
1109    #[allow(irrefutable_let_patterns)]
1110    pub fn into_new_client(
1111        self,
1112    ) -> Option<(
1113        u64,
1114        NewClientParams,
1115        fidl::endpoints::ServerEnd<ClientMarker>,
1116        ClientProviderControlHandle,
1117    )> {
1118        if let ClientProviderRequest::NewClient { interface_id, params, request, control_handle } =
1119            self
1120        {
1121            Some((interface_id, params, request, control_handle))
1122        } else {
1123            None
1124        }
1125    }
1126
1127    #[allow(irrefutable_let_patterns)]
1128    pub fn into_check_presence(self) -> Option<(ClientProviderCheckPresenceResponder)> {
1129        if let ClientProviderRequest::CheckPresence { responder } = self {
1130            Some((responder))
1131        } else {
1132            None
1133        }
1134    }
1135
1136    /// Name of the method defined in FIDL
1137    pub fn method_name(&self) -> &'static str {
1138        match *self {
1139            ClientProviderRequest::NewClient { .. } => "new_client",
1140            ClientProviderRequest::CheckPresence { .. } => "check_presence",
1141        }
1142    }
1143}
1144
1145#[derive(Debug, Clone)]
1146pub struct ClientProviderControlHandle {
1147    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1148}
1149
1150impl fidl::endpoints::ControlHandle for ClientProviderControlHandle {
1151    fn shutdown(&self) {
1152        self.inner.shutdown()
1153    }
1154    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1155        self.inner.shutdown_with_epitaph(status)
1156    }
1157
1158    fn is_closed(&self) -> bool {
1159        self.inner.channel().is_closed()
1160    }
1161    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1162        self.inner.channel().on_closed()
1163    }
1164
1165    #[cfg(target_os = "fuchsia")]
1166    fn signal_peer(
1167        &self,
1168        clear_mask: zx::Signals,
1169        set_mask: zx::Signals,
1170    ) -> Result<(), zx_status::Status> {
1171        use fidl::Peered;
1172        self.inner.channel().signal_peer(clear_mask, set_mask)
1173    }
1174}
1175
1176impl ClientProviderControlHandle {}
1177
1178#[must_use = "FIDL methods require a response to be sent"]
1179#[derive(Debug)]
1180pub struct ClientProviderCheckPresenceResponder {
1181    control_handle: std::mem::ManuallyDrop<ClientProviderControlHandle>,
1182    tx_id: u32,
1183}
1184
1185/// Set the the channel to be shutdown (see [`ClientProviderControlHandle::shutdown`])
1186/// if the responder is dropped without sending a response, so that the client
1187/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1188impl std::ops::Drop for ClientProviderCheckPresenceResponder {
1189    fn drop(&mut self) {
1190        self.control_handle.shutdown();
1191        // Safety: drops once, never accessed again
1192        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1193    }
1194}
1195
1196impl fidl::endpoints::Responder for ClientProviderCheckPresenceResponder {
1197    type ControlHandle = ClientProviderControlHandle;
1198
1199    fn control_handle(&self) -> &ClientProviderControlHandle {
1200        &self.control_handle
1201    }
1202
1203    fn drop_without_shutdown(mut self) {
1204        // Safety: drops once, never accessed again due to mem::forget
1205        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1206        // Prevent Drop from running (which would shut down the channel)
1207        std::mem::forget(self);
1208    }
1209}
1210
1211impl ClientProviderCheckPresenceResponder {
1212    /// Sends a response to the FIDL transaction.
1213    ///
1214    /// Sets the channel to shutdown if an error occurs.
1215    pub fn send(self) -> Result<(), fidl::Error> {
1216        let _result = self.send_raw();
1217        if _result.is_err() {
1218            self.control_handle.shutdown();
1219        }
1220        self.drop_without_shutdown();
1221        _result
1222    }
1223
1224    /// Similar to "send" but does not shutdown the channel if an error occurs.
1225    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
1226        let _result = self.send_raw();
1227        self.drop_without_shutdown();
1228        _result
1229    }
1230
1231    fn send_raw(&self) -> Result<(), fidl::Error> {
1232        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
1233            (),
1234            self.tx_id,
1235            0x7ba657cd730bbf60,
1236            fidl::encoding::DynamicFlags::empty(),
1237        )
1238    }
1239}
1240
1241#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1242pub struct Server_Marker;
1243
1244impl fidl::endpoints::ProtocolMarker for Server_Marker {
1245    type Proxy = Server_Proxy;
1246    type RequestStream = Server_RequestStream;
1247    #[cfg(target_os = "fuchsia")]
1248    type SynchronousProxy = Server_SynchronousProxy;
1249
1250    const DEBUG_NAME: &'static str = "fuchsia.net.dhcp.Server";
1251}
1252impl fidl::endpoints::DiscoverableProtocolMarker for Server_Marker {}
1253pub type ServerStartServingResult = Result<(), i32>;
1254pub type ServerGetOptionResult = Result<Option_, i32>;
1255pub type ServerGetParameterResult = Result<Parameter, i32>;
1256pub type ServerSetOptionResult = Result<(), i32>;
1257pub type ServerSetParameterResult = Result<(), i32>;
1258pub type ServerListOptionsResult = Result<Vec<Option_>, i32>;
1259pub type ServerListParametersResult = Result<Vec<Parameter>, i32>;
1260pub type ServerResetOptionsResult = Result<(), i32>;
1261pub type ServerResetParametersResult = Result<(), i32>;
1262pub type ServerClearLeasesResult = Result<(), i32>;
1263
1264pub trait Server_ProxyInterface: Send + Sync {
1265    type StartServingResponseFut: std::future::Future<Output = Result<ServerStartServingResult, fidl::Error>>
1266        + Send;
1267    fn r#start_serving(&self) -> Self::StartServingResponseFut;
1268    type StopServingResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
1269    fn r#stop_serving(&self) -> Self::StopServingResponseFut;
1270    type IsServingResponseFut: std::future::Future<Output = Result<bool, fidl::Error>> + Send;
1271    fn r#is_serving(&self) -> Self::IsServingResponseFut;
1272    type GetOptionResponseFut: std::future::Future<Output = Result<ServerGetOptionResult, fidl::Error>>
1273        + Send;
1274    fn r#get_option(&self, code: OptionCode) -> Self::GetOptionResponseFut;
1275    type GetParameterResponseFut: std::future::Future<Output = Result<ServerGetParameterResult, fidl::Error>>
1276        + Send;
1277    fn r#get_parameter(&self, name: ParameterName) -> Self::GetParameterResponseFut;
1278    type SetOptionResponseFut: std::future::Future<Output = Result<ServerSetOptionResult, fidl::Error>>
1279        + Send;
1280    fn r#set_option(&self, value: &Option_) -> Self::SetOptionResponseFut;
1281    type SetParameterResponseFut: std::future::Future<Output = Result<ServerSetParameterResult, fidl::Error>>
1282        + Send;
1283    fn r#set_parameter(&self, value: &Parameter) -> Self::SetParameterResponseFut;
1284    type ListOptionsResponseFut: std::future::Future<Output = Result<ServerListOptionsResult, fidl::Error>>
1285        + Send;
1286    fn r#list_options(&self) -> Self::ListOptionsResponseFut;
1287    type ListParametersResponseFut: std::future::Future<Output = Result<ServerListParametersResult, fidl::Error>>
1288        + Send;
1289    fn r#list_parameters(&self) -> Self::ListParametersResponseFut;
1290    type ResetOptionsResponseFut: std::future::Future<Output = Result<ServerResetOptionsResult, fidl::Error>>
1291        + Send;
1292    fn r#reset_options(&self) -> Self::ResetOptionsResponseFut;
1293    type ResetParametersResponseFut: std::future::Future<Output = Result<ServerResetParametersResult, fidl::Error>>
1294        + Send;
1295    fn r#reset_parameters(&self) -> Self::ResetParametersResponseFut;
1296    type ClearLeasesResponseFut: std::future::Future<Output = Result<ServerClearLeasesResult, fidl::Error>>
1297        + Send;
1298    fn r#clear_leases(&self) -> Self::ClearLeasesResponseFut;
1299}
1300#[derive(Debug)]
1301#[cfg(target_os = "fuchsia")]
1302pub struct Server_SynchronousProxy {
1303    client: fidl::client::sync::Client,
1304}
1305
1306#[cfg(target_os = "fuchsia")]
1307impl fidl::endpoints::SynchronousProxy for Server_SynchronousProxy {
1308    type Proxy = Server_Proxy;
1309    type Protocol = Server_Marker;
1310
1311    fn from_channel(inner: fidl::Channel) -> Self {
1312        Self::new(inner)
1313    }
1314
1315    fn into_channel(self) -> fidl::Channel {
1316        self.client.into_channel()
1317    }
1318
1319    fn as_channel(&self) -> &fidl::Channel {
1320        self.client.as_channel()
1321    }
1322}
1323
1324#[cfg(target_os = "fuchsia")]
1325impl Server_SynchronousProxy {
1326    pub fn new(channel: fidl::Channel) -> Self {
1327        let protocol_name = <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1328        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1329    }
1330
1331    pub fn into_channel(self) -> fidl::Channel {
1332        self.client.into_channel()
1333    }
1334
1335    /// Waits until an event arrives and returns it. It is safe for other
1336    /// threads to make concurrent requests while waiting for an event.
1337    pub fn wait_for_event(
1338        &self,
1339        deadline: zx::MonotonicInstant,
1340    ) -> Result<Server_Event, fidl::Error> {
1341        Server_Event::decode(self.client.wait_for_event(deadline)?)
1342    }
1343
1344    /// Starts serving DHCP leases.
1345    ///
1346    /// Starts the DHCP server with the current set of parameters.
1347    ///
1348    /// On error the server remains in the stopped state. If the server is
1349    /// already serving, `StartServing` is a no-op.
1350    ///
1351    /// *error a zx.Status indicating why the server could not be started.
1352    pub fn r#start_serving(
1353        &self,
1354        ___deadline: zx::MonotonicInstant,
1355    ) -> Result<ServerStartServingResult, fidl::Error> {
1356        let _response = self.client.send_query::<
1357            fidl::encoding::EmptyPayload,
1358            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1359        >(
1360            (),
1361            0x10990e324ac53cd1,
1362            fidl::encoding::DynamicFlags::empty(),
1363            ___deadline,
1364        )?;
1365        Ok(_response.map(|x| x))
1366    }
1367
1368    /// Stops serving DHCP leases.
1369    ///
1370    /// Stopping causes all the listening ports to be closed.
1371    ///
1372    /// Configuring parameters on the DHCP server is only allowed when the
1373    /// server is stopped.
1374    ///
1375    /// If the server is not currently serving, `StopServing` is a no-op.
1376    pub fn r#stop_serving(&self, ___deadline: zx::MonotonicInstant) -> Result<(), fidl::Error> {
1377        let _response =
1378            self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::EmptyPayload>(
1379                (),
1380                0x7776cfe9f68a0dbe,
1381                fidl::encoding::DynamicFlags::empty(),
1382                ___deadline,
1383            )?;
1384        Ok(_response)
1385    }
1386
1387    /// Returns whether or not the server is serving DHCP leases.
1388    pub fn r#is_serving(&self, ___deadline: zx::MonotonicInstant) -> Result<bool, fidl::Error> {
1389        let _response =
1390            self.client.send_query::<fidl::encoding::EmptyPayload, ServerIsServingResponse>(
1391                (),
1392                0x45aadc35fcbe3826,
1393                fidl::encoding::DynamicFlags::empty(),
1394                ___deadline,
1395            )?;
1396        Ok(_response.enabled)
1397    }
1398
1399    /// Returns the requested Option if it is supported.
1400    ///
1401    /// + request `code` the code of an Option whose value has been requested.
1402    /// - response `value` the value of the requested Option.
1403    /// * error a zx.Status indicating why the value could not be retrieved.
1404    pub fn r#get_option(
1405        &self,
1406        mut code: OptionCode,
1407        ___deadline: zx::MonotonicInstant,
1408    ) -> Result<ServerGetOptionResult, fidl::Error> {
1409        let _response = self.client.send_query::<
1410            ServerGetOptionRequest,
1411            fidl::encoding::ResultType<ServerGetOptionResponse, i32>,
1412        >(
1413            (code,),
1414            0x5305ee2c593f68a,
1415            fidl::encoding::DynamicFlags::empty(),
1416            ___deadline,
1417        )?;
1418        Ok(_response.map(|x| x.value))
1419    }
1420
1421    /// Returns the requested Parameter if it is supported.
1422    ///
1423    /// + request `name` the name of a Parameter whose value has been requested.
1424    /// - response `value` the value of the requested Parameter.
1425    /// * error a zx.Status indicating why the value could not be retrieved.
1426    pub fn r#get_parameter(
1427        &self,
1428        mut name: ParameterName,
1429        ___deadline: zx::MonotonicInstant,
1430    ) -> Result<ServerGetParameterResult, fidl::Error> {
1431        let _response = self.client.send_query::<
1432            ServerGetParameterRequest,
1433            fidl::encoding::ResultType<ServerGetParameterResponse, i32>,
1434        >(
1435            (name,),
1436            0x1e8c98758fb82714,
1437            fidl::encoding::DynamicFlags::empty(),
1438            ___deadline,
1439        )?;
1440        Ok(_response.map(|x| x.value))
1441    }
1442
1443    /// Sets the Option to the argument. On success, a SetOption will take
1444    /// effect immediately.
1445    ///
1446    /// + request `value` an Option whose value will be set to the value of this
1447    /// argument.
1448    /// * error a zx.Status indicating the cause of failure.
1449    pub fn r#set_option(
1450        &self,
1451        mut value: &Option_,
1452        ___deadline: zx::MonotonicInstant,
1453    ) -> Result<ServerSetOptionResult, fidl::Error> {
1454        let _response = self.client.send_query::<
1455            ServerSetOptionRequest,
1456            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1457        >(
1458            (value,),
1459            0x63c98b670db8d96a,
1460            fidl::encoding::DynamicFlags::empty(),
1461            ___deadline,
1462        )?;
1463        Ok(_response.map(|x| x))
1464    }
1465
1466    /// Sets the Parameter to the argument. On success, the new parameter value
1467    /// can be queried by GetParameter or ListParameter immediately. However,
1468    /// the server may require a restart in order for the new Parameter value to
1469    /// take effect.
1470    ///
1471    /// Setting parameters is only allowed if the server is stopped.
1472    /// `ZX_ERR_BAD_STATE` is returned otherwise.
1473    ///
1474    /// + request `value` a Parameter whose value will be set to the value of
1475    /// this argument.
1476    /// * error a zx.Status indicating the cause of failure.
1477    pub fn r#set_parameter(
1478        &self,
1479        mut value: &Parameter,
1480        ___deadline: zx::MonotonicInstant,
1481    ) -> Result<ServerSetParameterResult, fidl::Error> {
1482        let _response = self.client.send_query::<
1483            ServerSetParameterRequest,
1484            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1485        >(
1486            (value,),
1487            0x3002d0d956eb4bdc,
1488            fidl::encoding::DynamicFlags::empty(),
1489            ___deadline,
1490        )?;
1491        Ok(_response.map(|x| x))
1492    }
1493
1494    /// Lists all DHCP options for which the Server has a value. Any option
1495    /// which does not have a value will be omitted from the returned list.
1496    /// ListOptions provides administrators a means to print a server's
1497    /// configuration as opposed to querying the value of a single Option.
1498    ///
1499    /// - response `options` a vector containing all of the options for which
1500    /// the Server has a value. Bounded to 256 as options are identified by a 1
1501    /// octet code and 256 is the maximum number of such codes.
1502    /// * error a zx.Status indicating the cause of failure.
1503    pub fn r#list_options(
1504        &self,
1505        ___deadline: zx::MonotonicInstant,
1506    ) -> Result<ServerListOptionsResult, fidl::Error> {
1507        let _response = self.client.send_query::<
1508            fidl::encoding::EmptyPayload,
1509            fidl::encoding::ResultType<ServerListOptionsResponse, i32>,
1510        >(
1511            (),
1512            0x72c8161c69ca67b,
1513            fidl::encoding::DynamicFlags::empty(),
1514            ___deadline,
1515        )?;
1516        Ok(_response.map(|x| x.options))
1517    }
1518
1519    /// Lists all DHCP server parameters. ListParameters provides administrators
1520    /// a means to print a server's configuration as opposed to querying the
1521    /// value of a single Parameter.
1522    ///
1523    /// - response `parameter` a vector containing the values of all of the
1524    /// Server's parameters. Bounded to 256 to provide a generous upper limit
1525    /// on the number of server parameters while being of the same size as
1526    /// ListOptions.
1527    /// * error a zx.Status indicating the cause of failure.
1528    pub fn r#list_parameters(
1529        &self,
1530        ___deadline: zx::MonotonicInstant,
1531    ) -> Result<ServerListParametersResult, fidl::Error> {
1532        let _response = self.client.send_query::<
1533            fidl::encoding::EmptyPayload,
1534            fidl::encoding::ResultType<ServerListParametersResponse, i32>,
1535        >(
1536            (),
1537            0xa201b1d6d121c59,
1538            fidl::encoding::DynamicFlags::empty(),
1539            ___deadline,
1540        )?;
1541        Ok(_response.map(|x| x.parameters))
1542    }
1543
1544    /// Resets all DHCP options to have no value. On success, ResetOptions will
1545    /// take effect immediately.
1546    ///
1547    /// * error a zx.Status indicating the cause of failure.
1548    pub fn r#reset_options(
1549        &self,
1550        ___deadline: zx::MonotonicInstant,
1551    ) -> Result<ServerResetOptionsResult, fidl::Error> {
1552        let _response = self.client.send_query::<
1553            fidl::encoding::EmptyPayload,
1554            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1555        >(
1556            (),
1557            0x31014911fd21cc13,
1558            fidl::encoding::DynamicFlags::empty(),
1559            ___deadline,
1560        )?;
1561        Ok(_response.map(|x| x))
1562    }
1563
1564    /// Resets all DHCP server parameters to their default value. On success,
1565    /// the reset parameter values can be queried immediately with GetParameter
1566    /// or ListParameters. However, the server must be restarted before all new
1567    /// parameter values take effect.
1568    ///
1569    /// Setting parameters is only allowed if the server is stopped.
1570    /// `ZX_ERR_BAD_STATE` is returned otherwise.
1571    ///
1572    /// * error a zx.Status indicating the cause of failure.
1573    pub fn r#reset_parameters(
1574        &self,
1575        ___deadline: zx::MonotonicInstant,
1576    ) -> Result<ServerResetParametersResult, fidl::Error> {
1577        let _response = self.client.send_query::<
1578            fidl::encoding::EmptyPayload,
1579            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1580        >(
1581            (),
1582            0x353fba50bcf4ecec,
1583            fidl::encoding::DynamicFlags::empty(),
1584            ___deadline,
1585        )?;
1586        Ok(_response.map(|x| x))
1587    }
1588
1589    /// Clears all leases maintained by the Server. On success, ClearLeases will
1590    /// take effect immediately. Server administrators should take care when
1591    /// calling this method as the DHCP protocol does not provide a mechanism by
1592    /// which a Server can notify a client that its lease has been cleared.
1593    ///
1594    /// * error a zx.Status indicating the cause of failure.
1595    pub fn r#clear_leases(
1596        &self,
1597        ___deadline: zx::MonotonicInstant,
1598    ) -> Result<ServerClearLeasesResult, fidl::Error> {
1599        let _response = self.client.send_query::<
1600            fidl::encoding::EmptyPayload,
1601            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1602        >(
1603            (),
1604            0xe39e35cda85a04d,
1605            fidl::encoding::DynamicFlags::empty(),
1606            ___deadline,
1607        )?;
1608        Ok(_response.map(|x| x))
1609    }
1610}
1611
1612#[cfg(target_os = "fuchsia")]
1613impl From<Server_SynchronousProxy> for zx::Handle {
1614    fn from(value: Server_SynchronousProxy) -> Self {
1615        value.into_channel().into()
1616    }
1617}
1618
1619#[cfg(target_os = "fuchsia")]
1620impl From<fidl::Channel> for Server_SynchronousProxy {
1621    fn from(value: fidl::Channel) -> Self {
1622        Self::new(value)
1623    }
1624}
1625
1626#[cfg(target_os = "fuchsia")]
1627impl fidl::endpoints::FromClient for Server_SynchronousProxy {
1628    type Protocol = Server_Marker;
1629
1630    fn from_client(value: fidl::endpoints::ClientEnd<Server_Marker>) -> Self {
1631        Self::new(value.into_channel())
1632    }
1633}
1634
1635#[derive(Debug, Clone)]
1636pub struct Server_Proxy {
1637    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1638}
1639
1640impl fidl::endpoints::Proxy for Server_Proxy {
1641    type Protocol = Server_Marker;
1642
1643    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1644        Self::new(inner)
1645    }
1646
1647    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1648        self.client.into_channel().map_err(|client| Self { client })
1649    }
1650
1651    fn as_channel(&self) -> &::fidl::AsyncChannel {
1652        self.client.as_channel()
1653    }
1654}
1655
1656impl Server_Proxy {
1657    /// Create a new Proxy for fuchsia.net.dhcp/Server.
1658    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1659        let protocol_name = <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1660        Self { client: fidl::client::Client::new(channel, protocol_name) }
1661    }
1662
1663    /// Get a Stream of events from the remote end of the protocol.
1664    ///
1665    /// # Panics
1666    ///
1667    /// Panics if the event stream was already taken.
1668    pub fn take_event_stream(&self) -> Server_EventStream {
1669        Server_EventStream { event_receiver: self.client.take_event_receiver() }
1670    }
1671
1672    /// Starts serving DHCP leases.
1673    ///
1674    /// Starts the DHCP server with the current set of parameters.
1675    ///
1676    /// On error the server remains in the stopped state. If the server is
1677    /// already serving, `StartServing` is a no-op.
1678    ///
1679    /// *error a zx.Status indicating why the server could not be started.
1680    pub fn r#start_serving(
1681        &self,
1682    ) -> fidl::client::QueryResponseFut<
1683        ServerStartServingResult,
1684        fidl::encoding::DefaultFuchsiaResourceDialect,
1685    > {
1686        Server_ProxyInterface::r#start_serving(self)
1687    }
1688
1689    /// Stops serving DHCP leases.
1690    ///
1691    /// Stopping causes all the listening ports to be closed.
1692    ///
1693    /// Configuring parameters on the DHCP server is only allowed when the
1694    /// server is stopped.
1695    ///
1696    /// If the server is not currently serving, `StopServing` is a no-op.
1697    pub fn r#stop_serving(
1698        &self,
1699    ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
1700        Server_ProxyInterface::r#stop_serving(self)
1701    }
1702
1703    /// Returns whether or not the server is serving DHCP leases.
1704    pub fn r#is_serving(
1705        &self,
1706    ) -> fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect> {
1707        Server_ProxyInterface::r#is_serving(self)
1708    }
1709
1710    /// Returns the requested Option if it is supported.
1711    ///
1712    /// + request `code` the code of an Option whose value has been requested.
1713    /// - response `value` the value of the requested Option.
1714    /// * error a zx.Status indicating why the value could not be retrieved.
1715    pub fn r#get_option(
1716        &self,
1717        mut code: OptionCode,
1718    ) -> fidl::client::QueryResponseFut<
1719        ServerGetOptionResult,
1720        fidl::encoding::DefaultFuchsiaResourceDialect,
1721    > {
1722        Server_ProxyInterface::r#get_option(self, code)
1723    }
1724
1725    /// Returns the requested Parameter if it is supported.
1726    ///
1727    /// + request `name` the name of a Parameter whose value has been requested.
1728    /// - response `value` the value of the requested Parameter.
1729    /// * error a zx.Status indicating why the value could not be retrieved.
1730    pub fn r#get_parameter(
1731        &self,
1732        mut name: ParameterName,
1733    ) -> fidl::client::QueryResponseFut<
1734        ServerGetParameterResult,
1735        fidl::encoding::DefaultFuchsiaResourceDialect,
1736    > {
1737        Server_ProxyInterface::r#get_parameter(self, name)
1738    }
1739
1740    /// Sets the Option to the argument. On success, a SetOption will take
1741    /// effect immediately.
1742    ///
1743    /// + request `value` an Option whose value will be set to the value of this
1744    /// argument.
1745    /// * error a zx.Status indicating the cause of failure.
1746    pub fn r#set_option(
1747        &self,
1748        mut value: &Option_,
1749    ) -> fidl::client::QueryResponseFut<
1750        ServerSetOptionResult,
1751        fidl::encoding::DefaultFuchsiaResourceDialect,
1752    > {
1753        Server_ProxyInterface::r#set_option(self, value)
1754    }
1755
1756    /// Sets the Parameter to the argument. On success, the new parameter value
1757    /// can be queried by GetParameter or ListParameter immediately. However,
1758    /// the server may require a restart in order for the new Parameter value to
1759    /// take effect.
1760    ///
1761    /// Setting parameters is only allowed if the server is stopped.
1762    /// `ZX_ERR_BAD_STATE` is returned otherwise.
1763    ///
1764    /// + request `value` a Parameter whose value will be set to the value of
1765    /// this argument.
1766    /// * error a zx.Status indicating the cause of failure.
1767    pub fn r#set_parameter(
1768        &self,
1769        mut value: &Parameter,
1770    ) -> fidl::client::QueryResponseFut<
1771        ServerSetParameterResult,
1772        fidl::encoding::DefaultFuchsiaResourceDialect,
1773    > {
1774        Server_ProxyInterface::r#set_parameter(self, value)
1775    }
1776
1777    /// Lists all DHCP options for which the Server has a value. Any option
1778    /// which does not have a value will be omitted from the returned list.
1779    /// ListOptions provides administrators a means to print a server's
1780    /// configuration as opposed to querying the value of a single Option.
1781    ///
1782    /// - response `options` a vector containing all of the options for which
1783    /// the Server has a value. Bounded to 256 as options are identified by a 1
1784    /// octet code and 256 is the maximum number of such codes.
1785    /// * error a zx.Status indicating the cause of failure.
1786    pub fn r#list_options(
1787        &self,
1788    ) -> fidl::client::QueryResponseFut<
1789        ServerListOptionsResult,
1790        fidl::encoding::DefaultFuchsiaResourceDialect,
1791    > {
1792        Server_ProxyInterface::r#list_options(self)
1793    }
1794
1795    /// Lists all DHCP server parameters. ListParameters provides administrators
1796    /// a means to print a server's configuration as opposed to querying the
1797    /// value of a single Parameter.
1798    ///
1799    /// - response `parameter` a vector containing the values of all of the
1800    /// Server's parameters. Bounded to 256 to provide a generous upper limit
1801    /// on the number of server parameters while being of the same size as
1802    /// ListOptions.
1803    /// * error a zx.Status indicating the cause of failure.
1804    pub fn r#list_parameters(
1805        &self,
1806    ) -> fidl::client::QueryResponseFut<
1807        ServerListParametersResult,
1808        fidl::encoding::DefaultFuchsiaResourceDialect,
1809    > {
1810        Server_ProxyInterface::r#list_parameters(self)
1811    }
1812
1813    /// Resets all DHCP options to have no value. On success, ResetOptions will
1814    /// take effect immediately.
1815    ///
1816    /// * error a zx.Status indicating the cause of failure.
1817    pub fn r#reset_options(
1818        &self,
1819    ) -> fidl::client::QueryResponseFut<
1820        ServerResetOptionsResult,
1821        fidl::encoding::DefaultFuchsiaResourceDialect,
1822    > {
1823        Server_ProxyInterface::r#reset_options(self)
1824    }
1825
1826    /// Resets all DHCP server parameters to their default value. On success,
1827    /// the reset parameter values can be queried immediately with GetParameter
1828    /// or ListParameters. However, the server must be restarted before all new
1829    /// parameter values take effect.
1830    ///
1831    /// Setting parameters is only allowed if the server is stopped.
1832    /// `ZX_ERR_BAD_STATE` is returned otherwise.
1833    ///
1834    /// * error a zx.Status indicating the cause of failure.
1835    pub fn r#reset_parameters(
1836        &self,
1837    ) -> fidl::client::QueryResponseFut<
1838        ServerResetParametersResult,
1839        fidl::encoding::DefaultFuchsiaResourceDialect,
1840    > {
1841        Server_ProxyInterface::r#reset_parameters(self)
1842    }
1843
1844    /// Clears all leases maintained by the Server. On success, ClearLeases will
1845    /// take effect immediately. Server administrators should take care when
1846    /// calling this method as the DHCP protocol does not provide a mechanism by
1847    /// which a Server can notify a client that its lease has been cleared.
1848    ///
1849    /// * error a zx.Status indicating the cause of failure.
1850    pub fn r#clear_leases(
1851        &self,
1852    ) -> fidl::client::QueryResponseFut<
1853        ServerClearLeasesResult,
1854        fidl::encoding::DefaultFuchsiaResourceDialect,
1855    > {
1856        Server_ProxyInterface::r#clear_leases(self)
1857    }
1858}
1859
1860impl Server_ProxyInterface for Server_Proxy {
1861    type StartServingResponseFut = fidl::client::QueryResponseFut<
1862        ServerStartServingResult,
1863        fidl::encoding::DefaultFuchsiaResourceDialect,
1864    >;
1865    fn r#start_serving(&self) -> Self::StartServingResponseFut {
1866        fn _decode(
1867            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1868        ) -> Result<ServerStartServingResult, fidl::Error> {
1869            let _response = fidl::client::decode_transaction_body::<
1870                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1871                fidl::encoding::DefaultFuchsiaResourceDialect,
1872                0x10990e324ac53cd1,
1873            >(_buf?)?;
1874            Ok(_response.map(|x| x))
1875        }
1876        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ServerStartServingResult>(
1877            (),
1878            0x10990e324ac53cd1,
1879            fidl::encoding::DynamicFlags::empty(),
1880            _decode,
1881        )
1882    }
1883
1884    type StopServingResponseFut =
1885        fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
1886    fn r#stop_serving(&self) -> Self::StopServingResponseFut {
1887        fn _decode(
1888            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1889        ) -> Result<(), fidl::Error> {
1890            let _response = fidl::client::decode_transaction_body::<
1891                fidl::encoding::EmptyPayload,
1892                fidl::encoding::DefaultFuchsiaResourceDialect,
1893                0x7776cfe9f68a0dbe,
1894            >(_buf?)?;
1895            Ok(_response)
1896        }
1897        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ()>(
1898            (),
1899            0x7776cfe9f68a0dbe,
1900            fidl::encoding::DynamicFlags::empty(),
1901            _decode,
1902        )
1903    }
1904
1905    type IsServingResponseFut =
1906        fidl::client::QueryResponseFut<bool, fidl::encoding::DefaultFuchsiaResourceDialect>;
1907    fn r#is_serving(&self) -> Self::IsServingResponseFut {
1908        fn _decode(
1909            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1910        ) -> Result<bool, fidl::Error> {
1911            let _response = fidl::client::decode_transaction_body::<
1912                ServerIsServingResponse,
1913                fidl::encoding::DefaultFuchsiaResourceDialect,
1914                0x45aadc35fcbe3826,
1915            >(_buf?)?;
1916            Ok(_response.enabled)
1917        }
1918        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, bool>(
1919            (),
1920            0x45aadc35fcbe3826,
1921            fidl::encoding::DynamicFlags::empty(),
1922            _decode,
1923        )
1924    }
1925
1926    type GetOptionResponseFut = fidl::client::QueryResponseFut<
1927        ServerGetOptionResult,
1928        fidl::encoding::DefaultFuchsiaResourceDialect,
1929    >;
1930    fn r#get_option(&self, mut code: OptionCode) -> Self::GetOptionResponseFut {
1931        fn _decode(
1932            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1933        ) -> Result<ServerGetOptionResult, fidl::Error> {
1934            let _response = fidl::client::decode_transaction_body::<
1935                fidl::encoding::ResultType<ServerGetOptionResponse, i32>,
1936                fidl::encoding::DefaultFuchsiaResourceDialect,
1937                0x5305ee2c593f68a,
1938            >(_buf?)?;
1939            Ok(_response.map(|x| x.value))
1940        }
1941        self.client.send_query_and_decode::<ServerGetOptionRequest, ServerGetOptionResult>(
1942            (code,),
1943            0x5305ee2c593f68a,
1944            fidl::encoding::DynamicFlags::empty(),
1945            _decode,
1946        )
1947    }
1948
1949    type GetParameterResponseFut = fidl::client::QueryResponseFut<
1950        ServerGetParameterResult,
1951        fidl::encoding::DefaultFuchsiaResourceDialect,
1952    >;
1953    fn r#get_parameter(&self, mut name: ParameterName) -> Self::GetParameterResponseFut {
1954        fn _decode(
1955            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1956        ) -> Result<ServerGetParameterResult, fidl::Error> {
1957            let _response = fidl::client::decode_transaction_body::<
1958                fidl::encoding::ResultType<ServerGetParameterResponse, i32>,
1959                fidl::encoding::DefaultFuchsiaResourceDialect,
1960                0x1e8c98758fb82714,
1961            >(_buf?)?;
1962            Ok(_response.map(|x| x.value))
1963        }
1964        self.client.send_query_and_decode::<ServerGetParameterRequest, ServerGetParameterResult>(
1965            (name,),
1966            0x1e8c98758fb82714,
1967            fidl::encoding::DynamicFlags::empty(),
1968            _decode,
1969        )
1970    }
1971
1972    type SetOptionResponseFut = fidl::client::QueryResponseFut<
1973        ServerSetOptionResult,
1974        fidl::encoding::DefaultFuchsiaResourceDialect,
1975    >;
1976    fn r#set_option(&self, mut value: &Option_) -> Self::SetOptionResponseFut {
1977        fn _decode(
1978            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1979        ) -> Result<ServerSetOptionResult, fidl::Error> {
1980            let _response = fidl::client::decode_transaction_body::<
1981                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1982                fidl::encoding::DefaultFuchsiaResourceDialect,
1983                0x63c98b670db8d96a,
1984            >(_buf?)?;
1985            Ok(_response.map(|x| x))
1986        }
1987        self.client.send_query_and_decode::<ServerSetOptionRequest, ServerSetOptionResult>(
1988            (value,),
1989            0x63c98b670db8d96a,
1990            fidl::encoding::DynamicFlags::empty(),
1991            _decode,
1992        )
1993    }
1994
1995    type SetParameterResponseFut = fidl::client::QueryResponseFut<
1996        ServerSetParameterResult,
1997        fidl::encoding::DefaultFuchsiaResourceDialect,
1998    >;
1999    fn r#set_parameter(&self, mut value: &Parameter) -> Self::SetParameterResponseFut {
2000        fn _decode(
2001            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2002        ) -> Result<ServerSetParameterResult, fidl::Error> {
2003            let _response = fidl::client::decode_transaction_body::<
2004                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2005                fidl::encoding::DefaultFuchsiaResourceDialect,
2006                0x3002d0d956eb4bdc,
2007            >(_buf?)?;
2008            Ok(_response.map(|x| x))
2009        }
2010        self.client.send_query_and_decode::<ServerSetParameterRequest, ServerSetParameterResult>(
2011            (value,),
2012            0x3002d0d956eb4bdc,
2013            fidl::encoding::DynamicFlags::empty(),
2014            _decode,
2015        )
2016    }
2017
2018    type ListOptionsResponseFut = fidl::client::QueryResponseFut<
2019        ServerListOptionsResult,
2020        fidl::encoding::DefaultFuchsiaResourceDialect,
2021    >;
2022    fn r#list_options(&self) -> Self::ListOptionsResponseFut {
2023        fn _decode(
2024            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2025        ) -> Result<ServerListOptionsResult, fidl::Error> {
2026            let _response = fidl::client::decode_transaction_body::<
2027                fidl::encoding::ResultType<ServerListOptionsResponse, i32>,
2028                fidl::encoding::DefaultFuchsiaResourceDialect,
2029                0x72c8161c69ca67b,
2030            >(_buf?)?;
2031            Ok(_response.map(|x| x.options))
2032        }
2033        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ServerListOptionsResult>(
2034            (),
2035            0x72c8161c69ca67b,
2036            fidl::encoding::DynamicFlags::empty(),
2037            _decode,
2038        )
2039    }
2040
2041    type ListParametersResponseFut = fidl::client::QueryResponseFut<
2042        ServerListParametersResult,
2043        fidl::encoding::DefaultFuchsiaResourceDialect,
2044    >;
2045    fn r#list_parameters(&self) -> Self::ListParametersResponseFut {
2046        fn _decode(
2047            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2048        ) -> Result<ServerListParametersResult, fidl::Error> {
2049            let _response = fidl::client::decode_transaction_body::<
2050                fidl::encoding::ResultType<ServerListParametersResponse, i32>,
2051                fidl::encoding::DefaultFuchsiaResourceDialect,
2052                0xa201b1d6d121c59,
2053            >(_buf?)?;
2054            Ok(_response.map(|x| x.parameters))
2055        }
2056        self.client
2057            .send_query_and_decode::<fidl::encoding::EmptyPayload, ServerListParametersResult>(
2058                (),
2059                0xa201b1d6d121c59,
2060                fidl::encoding::DynamicFlags::empty(),
2061                _decode,
2062            )
2063    }
2064
2065    type ResetOptionsResponseFut = fidl::client::QueryResponseFut<
2066        ServerResetOptionsResult,
2067        fidl::encoding::DefaultFuchsiaResourceDialect,
2068    >;
2069    fn r#reset_options(&self) -> Self::ResetOptionsResponseFut {
2070        fn _decode(
2071            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2072        ) -> Result<ServerResetOptionsResult, fidl::Error> {
2073            let _response = fidl::client::decode_transaction_body::<
2074                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2075                fidl::encoding::DefaultFuchsiaResourceDialect,
2076                0x31014911fd21cc13,
2077            >(_buf?)?;
2078            Ok(_response.map(|x| x))
2079        }
2080        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ServerResetOptionsResult>(
2081            (),
2082            0x31014911fd21cc13,
2083            fidl::encoding::DynamicFlags::empty(),
2084            _decode,
2085        )
2086    }
2087
2088    type ResetParametersResponseFut = fidl::client::QueryResponseFut<
2089        ServerResetParametersResult,
2090        fidl::encoding::DefaultFuchsiaResourceDialect,
2091    >;
2092    fn r#reset_parameters(&self) -> Self::ResetParametersResponseFut {
2093        fn _decode(
2094            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2095        ) -> Result<ServerResetParametersResult, fidl::Error> {
2096            let _response = fidl::client::decode_transaction_body::<
2097                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2098                fidl::encoding::DefaultFuchsiaResourceDialect,
2099                0x353fba50bcf4ecec,
2100            >(_buf?)?;
2101            Ok(_response.map(|x| x))
2102        }
2103        self.client
2104            .send_query_and_decode::<fidl::encoding::EmptyPayload, ServerResetParametersResult>(
2105                (),
2106                0x353fba50bcf4ecec,
2107                fidl::encoding::DynamicFlags::empty(),
2108                _decode,
2109            )
2110    }
2111
2112    type ClearLeasesResponseFut = fidl::client::QueryResponseFut<
2113        ServerClearLeasesResult,
2114        fidl::encoding::DefaultFuchsiaResourceDialect,
2115    >;
2116    fn r#clear_leases(&self) -> Self::ClearLeasesResponseFut {
2117        fn _decode(
2118            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
2119        ) -> Result<ServerClearLeasesResult, fidl::Error> {
2120            let _response = fidl::client::decode_transaction_body::<
2121                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
2122                fidl::encoding::DefaultFuchsiaResourceDialect,
2123                0xe39e35cda85a04d,
2124            >(_buf?)?;
2125            Ok(_response.map(|x| x))
2126        }
2127        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ServerClearLeasesResult>(
2128            (),
2129            0xe39e35cda85a04d,
2130            fidl::encoding::DynamicFlags::empty(),
2131            _decode,
2132        )
2133    }
2134}
2135
2136pub struct Server_EventStream {
2137    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
2138}
2139
2140impl std::marker::Unpin for Server_EventStream {}
2141
2142impl futures::stream::FusedStream for Server_EventStream {
2143    fn is_terminated(&self) -> bool {
2144        self.event_receiver.is_terminated()
2145    }
2146}
2147
2148impl futures::Stream for Server_EventStream {
2149    type Item = Result<Server_Event, fidl::Error>;
2150
2151    fn poll_next(
2152        mut self: std::pin::Pin<&mut Self>,
2153        cx: &mut std::task::Context<'_>,
2154    ) -> std::task::Poll<Option<Self::Item>> {
2155        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
2156            &mut self.event_receiver,
2157            cx
2158        )?) {
2159            Some(buf) => std::task::Poll::Ready(Some(Server_Event::decode(buf))),
2160            None => std::task::Poll::Ready(None),
2161        }
2162    }
2163}
2164
2165#[derive(Debug)]
2166pub enum Server_Event {}
2167
2168impl Server_Event {
2169    /// Decodes a message buffer as a [`Server_Event`].
2170    fn decode(
2171        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
2172    ) -> Result<Server_Event, fidl::Error> {
2173        let (bytes, _handles) = buf.split_mut();
2174        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2175        debug_assert_eq!(tx_header.tx_id, 0);
2176        match tx_header.ordinal {
2177            _ => Err(fidl::Error::UnknownOrdinal {
2178                ordinal: tx_header.ordinal,
2179                protocol_name: <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2180            }),
2181        }
2182    }
2183}
2184
2185/// A Stream of incoming requests for fuchsia.net.dhcp/Server.
2186pub struct Server_RequestStream {
2187    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2188    is_terminated: bool,
2189}
2190
2191impl std::marker::Unpin for Server_RequestStream {}
2192
2193impl futures::stream::FusedStream for Server_RequestStream {
2194    fn is_terminated(&self) -> bool {
2195        self.is_terminated
2196    }
2197}
2198
2199impl fidl::endpoints::RequestStream for Server_RequestStream {
2200    type Protocol = Server_Marker;
2201    type ControlHandle = Server_ControlHandle;
2202
2203    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
2204        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
2205    }
2206
2207    fn control_handle(&self) -> Self::ControlHandle {
2208        Server_ControlHandle { inner: self.inner.clone() }
2209    }
2210
2211    fn into_inner(
2212        self,
2213    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
2214    {
2215        (self.inner, self.is_terminated)
2216    }
2217
2218    fn from_inner(
2219        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2220        is_terminated: bool,
2221    ) -> Self {
2222        Self { inner, is_terminated }
2223    }
2224}
2225
2226impl futures::Stream for Server_RequestStream {
2227    type Item = Result<Server_Request, fidl::Error>;
2228
2229    fn poll_next(
2230        mut self: std::pin::Pin<&mut Self>,
2231        cx: &mut std::task::Context<'_>,
2232    ) -> std::task::Poll<Option<Self::Item>> {
2233        let this = &mut *self;
2234        if this.inner.check_shutdown(cx) {
2235            this.is_terminated = true;
2236            return std::task::Poll::Ready(None);
2237        }
2238        if this.is_terminated {
2239            panic!("polled Server_RequestStream after completion");
2240        }
2241        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
2242            |bytes, handles| {
2243                match this.inner.channel().read_etc(cx, bytes, handles) {
2244                    std::task::Poll::Ready(Ok(())) => {}
2245                    std::task::Poll::Pending => return std::task::Poll::Pending,
2246                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
2247                        this.is_terminated = true;
2248                        return std::task::Poll::Ready(None);
2249                    }
2250                    std::task::Poll::Ready(Err(e)) => {
2251                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
2252                            e.into(),
2253                        ))));
2254                    }
2255                }
2256
2257                // A message has been received from the channel
2258                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
2259
2260                std::task::Poll::Ready(Some(match header.ordinal {
2261                    0x10990e324ac53cd1 => {
2262                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2263                        let mut req = fidl::new_empty!(
2264                            fidl::encoding::EmptyPayload,
2265                            fidl::encoding::DefaultFuchsiaResourceDialect
2266                        );
2267                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2268                        let control_handle = Server_ControlHandle { inner: this.inner.clone() };
2269                        Ok(Server_Request::StartServing {
2270                            responder: Server_StartServingResponder {
2271                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2272                                tx_id: header.tx_id,
2273                            },
2274                        })
2275                    }
2276                    0x7776cfe9f68a0dbe => {
2277                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2278                        let mut req = fidl::new_empty!(
2279                            fidl::encoding::EmptyPayload,
2280                            fidl::encoding::DefaultFuchsiaResourceDialect
2281                        );
2282                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2283                        let control_handle = Server_ControlHandle { inner: this.inner.clone() };
2284                        Ok(Server_Request::StopServing {
2285                            responder: Server_StopServingResponder {
2286                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2287                                tx_id: header.tx_id,
2288                            },
2289                        })
2290                    }
2291                    0x45aadc35fcbe3826 => {
2292                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2293                        let mut req = fidl::new_empty!(
2294                            fidl::encoding::EmptyPayload,
2295                            fidl::encoding::DefaultFuchsiaResourceDialect
2296                        );
2297                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2298                        let control_handle = Server_ControlHandle { inner: this.inner.clone() };
2299                        Ok(Server_Request::IsServing {
2300                            responder: Server_IsServingResponder {
2301                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2302                                tx_id: header.tx_id,
2303                            },
2304                        })
2305                    }
2306                    0x5305ee2c593f68a => {
2307                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2308                        let mut req = fidl::new_empty!(
2309                            ServerGetOptionRequest,
2310                            fidl::encoding::DefaultFuchsiaResourceDialect
2311                        );
2312                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServerGetOptionRequest>(&header, _body_bytes, handles, &mut req)?;
2313                        let control_handle = Server_ControlHandle { inner: this.inner.clone() };
2314                        Ok(Server_Request::GetOption {
2315                            code: req.code,
2316
2317                            responder: Server_GetOptionResponder {
2318                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2319                                tx_id: header.tx_id,
2320                            },
2321                        })
2322                    }
2323                    0x1e8c98758fb82714 => {
2324                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2325                        let mut req = fidl::new_empty!(
2326                            ServerGetParameterRequest,
2327                            fidl::encoding::DefaultFuchsiaResourceDialect
2328                        );
2329                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServerGetParameterRequest>(&header, _body_bytes, handles, &mut req)?;
2330                        let control_handle = Server_ControlHandle { inner: this.inner.clone() };
2331                        Ok(Server_Request::GetParameter {
2332                            name: req.name,
2333
2334                            responder: Server_GetParameterResponder {
2335                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2336                                tx_id: header.tx_id,
2337                            },
2338                        })
2339                    }
2340                    0x63c98b670db8d96a => {
2341                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2342                        let mut req = fidl::new_empty!(
2343                            ServerSetOptionRequest,
2344                            fidl::encoding::DefaultFuchsiaResourceDialect
2345                        );
2346                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServerSetOptionRequest>(&header, _body_bytes, handles, &mut req)?;
2347                        let control_handle = Server_ControlHandle { inner: this.inner.clone() };
2348                        Ok(Server_Request::SetOption {
2349                            value: req.value,
2350
2351                            responder: Server_SetOptionResponder {
2352                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2353                                tx_id: header.tx_id,
2354                            },
2355                        })
2356                    }
2357                    0x3002d0d956eb4bdc => {
2358                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2359                        let mut req = fidl::new_empty!(
2360                            ServerSetParameterRequest,
2361                            fidl::encoding::DefaultFuchsiaResourceDialect
2362                        );
2363                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ServerSetParameterRequest>(&header, _body_bytes, handles, &mut req)?;
2364                        let control_handle = Server_ControlHandle { inner: this.inner.clone() };
2365                        Ok(Server_Request::SetParameter {
2366                            value: req.value,
2367
2368                            responder: Server_SetParameterResponder {
2369                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2370                                tx_id: header.tx_id,
2371                            },
2372                        })
2373                    }
2374                    0x72c8161c69ca67b => {
2375                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2376                        let mut req = fidl::new_empty!(
2377                            fidl::encoding::EmptyPayload,
2378                            fidl::encoding::DefaultFuchsiaResourceDialect
2379                        );
2380                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2381                        let control_handle = Server_ControlHandle { inner: this.inner.clone() };
2382                        Ok(Server_Request::ListOptions {
2383                            responder: Server_ListOptionsResponder {
2384                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2385                                tx_id: header.tx_id,
2386                            },
2387                        })
2388                    }
2389                    0xa201b1d6d121c59 => {
2390                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2391                        let mut req = fidl::new_empty!(
2392                            fidl::encoding::EmptyPayload,
2393                            fidl::encoding::DefaultFuchsiaResourceDialect
2394                        );
2395                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2396                        let control_handle = Server_ControlHandle { inner: this.inner.clone() };
2397                        Ok(Server_Request::ListParameters {
2398                            responder: Server_ListParametersResponder {
2399                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2400                                tx_id: header.tx_id,
2401                            },
2402                        })
2403                    }
2404                    0x31014911fd21cc13 => {
2405                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2406                        let mut req = fidl::new_empty!(
2407                            fidl::encoding::EmptyPayload,
2408                            fidl::encoding::DefaultFuchsiaResourceDialect
2409                        );
2410                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2411                        let control_handle = Server_ControlHandle { inner: this.inner.clone() };
2412                        Ok(Server_Request::ResetOptions {
2413                            responder: Server_ResetOptionsResponder {
2414                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2415                                tx_id: header.tx_id,
2416                            },
2417                        })
2418                    }
2419                    0x353fba50bcf4ecec => {
2420                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2421                        let mut req = fidl::new_empty!(
2422                            fidl::encoding::EmptyPayload,
2423                            fidl::encoding::DefaultFuchsiaResourceDialect
2424                        );
2425                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2426                        let control_handle = Server_ControlHandle { inner: this.inner.clone() };
2427                        Ok(Server_Request::ResetParameters {
2428                            responder: Server_ResetParametersResponder {
2429                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2430                                tx_id: header.tx_id,
2431                            },
2432                        })
2433                    }
2434                    0xe39e35cda85a04d => {
2435                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
2436                        let mut req = fidl::new_empty!(
2437                            fidl::encoding::EmptyPayload,
2438                            fidl::encoding::DefaultFuchsiaResourceDialect
2439                        );
2440                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
2441                        let control_handle = Server_ControlHandle { inner: this.inner.clone() };
2442                        Ok(Server_Request::ClearLeases {
2443                            responder: Server_ClearLeasesResponder {
2444                                control_handle: std::mem::ManuallyDrop::new(control_handle),
2445                                tx_id: header.tx_id,
2446                            },
2447                        })
2448                    }
2449                    _ => Err(fidl::Error::UnknownOrdinal {
2450                        ordinal: header.ordinal,
2451                        protocol_name:
2452                            <Server_Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
2453                    }),
2454                }))
2455            },
2456        )
2457    }
2458}
2459
2460/// Provides methods for DHCP Server configuration.
2461#[derive(Debug)]
2462pub enum Server_Request {
2463    /// Starts serving DHCP leases.
2464    ///
2465    /// Starts the DHCP server with the current set of parameters.
2466    ///
2467    /// On error the server remains in the stopped state. If the server is
2468    /// already serving, `StartServing` is a no-op.
2469    ///
2470    /// *error a zx.Status indicating why the server could not be started.
2471    StartServing { responder: Server_StartServingResponder },
2472    /// Stops serving DHCP leases.
2473    ///
2474    /// Stopping causes all the listening ports to be closed.
2475    ///
2476    /// Configuring parameters on the DHCP server is only allowed when the
2477    /// server is stopped.
2478    ///
2479    /// If the server is not currently serving, `StopServing` is a no-op.
2480    StopServing { responder: Server_StopServingResponder },
2481    /// Returns whether or not the server is serving DHCP leases.
2482    IsServing { responder: Server_IsServingResponder },
2483    /// Returns the requested Option if it is supported.
2484    ///
2485    /// + request `code` the code of an Option whose value has been requested.
2486    /// - response `value` the value of the requested Option.
2487    /// * error a zx.Status indicating why the value could not be retrieved.
2488    GetOption { code: OptionCode, responder: Server_GetOptionResponder },
2489    /// Returns the requested Parameter if it is supported.
2490    ///
2491    /// + request `name` the name of a Parameter whose value has been requested.
2492    /// - response `value` the value of the requested Parameter.
2493    /// * error a zx.Status indicating why the value could not be retrieved.
2494    GetParameter { name: ParameterName, responder: Server_GetParameterResponder },
2495    /// Sets the Option to the argument. On success, a SetOption will take
2496    /// effect immediately.
2497    ///
2498    /// + request `value` an Option whose value will be set to the value of this
2499    /// argument.
2500    /// * error a zx.Status indicating the cause of failure.
2501    SetOption { value: Option_, responder: Server_SetOptionResponder },
2502    /// Sets the Parameter to the argument. On success, the new parameter value
2503    /// can be queried by GetParameter or ListParameter immediately. However,
2504    /// the server may require a restart in order for the new Parameter value to
2505    /// take effect.
2506    ///
2507    /// Setting parameters is only allowed if the server is stopped.
2508    /// `ZX_ERR_BAD_STATE` is returned otherwise.
2509    ///
2510    /// + request `value` a Parameter whose value will be set to the value of
2511    /// this argument.
2512    /// * error a zx.Status indicating the cause of failure.
2513    SetParameter { value: Parameter, responder: Server_SetParameterResponder },
2514    /// Lists all DHCP options for which the Server has a value. Any option
2515    /// which does not have a value will be omitted from the returned list.
2516    /// ListOptions provides administrators a means to print a server's
2517    /// configuration as opposed to querying the value of a single Option.
2518    ///
2519    /// - response `options` a vector containing all of the options for which
2520    /// the Server has a value. Bounded to 256 as options are identified by a 1
2521    /// octet code and 256 is the maximum number of such codes.
2522    /// * error a zx.Status indicating the cause of failure.
2523    ListOptions { responder: Server_ListOptionsResponder },
2524    /// Lists all DHCP server parameters. ListParameters provides administrators
2525    /// a means to print a server's configuration as opposed to querying the
2526    /// value of a single Parameter.
2527    ///
2528    /// - response `parameter` a vector containing the values of all of the
2529    /// Server's parameters. Bounded to 256 to provide a generous upper limit
2530    /// on the number of server parameters while being of the same size as
2531    /// ListOptions.
2532    /// * error a zx.Status indicating the cause of failure.
2533    ListParameters { responder: Server_ListParametersResponder },
2534    /// Resets all DHCP options to have no value. On success, ResetOptions will
2535    /// take effect immediately.
2536    ///
2537    /// * error a zx.Status indicating the cause of failure.
2538    ResetOptions { responder: Server_ResetOptionsResponder },
2539    /// Resets all DHCP server parameters to their default value. On success,
2540    /// the reset parameter values can be queried immediately with GetParameter
2541    /// or ListParameters. However, the server must be restarted before all new
2542    /// parameter values take effect.
2543    ///
2544    /// Setting parameters is only allowed if the server is stopped.
2545    /// `ZX_ERR_BAD_STATE` is returned otherwise.
2546    ///
2547    /// * error a zx.Status indicating the cause of failure.
2548    ResetParameters { responder: Server_ResetParametersResponder },
2549    /// Clears all leases maintained by the Server. On success, ClearLeases will
2550    /// take effect immediately. Server administrators should take care when
2551    /// calling this method as the DHCP protocol does not provide a mechanism by
2552    /// which a Server can notify a client that its lease has been cleared.
2553    ///
2554    /// * error a zx.Status indicating the cause of failure.
2555    ClearLeases { responder: Server_ClearLeasesResponder },
2556}
2557
2558impl Server_Request {
2559    #[allow(irrefutable_let_patterns)]
2560    pub fn into_start_serving(self) -> Option<(Server_StartServingResponder)> {
2561        if let Server_Request::StartServing { responder } = self { Some((responder)) } else { None }
2562    }
2563
2564    #[allow(irrefutable_let_patterns)]
2565    pub fn into_stop_serving(self) -> Option<(Server_StopServingResponder)> {
2566        if let Server_Request::StopServing { responder } = self { Some((responder)) } else { None }
2567    }
2568
2569    #[allow(irrefutable_let_patterns)]
2570    pub fn into_is_serving(self) -> Option<(Server_IsServingResponder)> {
2571        if let Server_Request::IsServing { responder } = self { Some((responder)) } else { None }
2572    }
2573
2574    #[allow(irrefutable_let_patterns)]
2575    pub fn into_get_option(self) -> Option<(OptionCode, Server_GetOptionResponder)> {
2576        if let Server_Request::GetOption { code, responder } = self {
2577            Some((code, responder))
2578        } else {
2579            None
2580        }
2581    }
2582
2583    #[allow(irrefutable_let_patterns)]
2584    pub fn into_get_parameter(self) -> Option<(ParameterName, Server_GetParameterResponder)> {
2585        if let Server_Request::GetParameter { name, responder } = self {
2586            Some((name, responder))
2587        } else {
2588            None
2589        }
2590    }
2591
2592    #[allow(irrefutable_let_patterns)]
2593    pub fn into_set_option(self) -> Option<(Option_, Server_SetOptionResponder)> {
2594        if let Server_Request::SetOption { value, responder } = self {
2595            Some((value, responder))
2596        } else {
2597            None
2598        }
2599    }
2600
2601    #[allow(irrefutable_let_patterns)]
2602    pub fn into_set_parameter(self) -> Option<(Parameter, Server_SetParameterResponder)> {
2603        if let Server_Request::SetParameter { value, responder } = self {
2604            Some((value, responder))
2605        } else {
2606            None
2607        }
2608    }
2609
2610    #[allow(irrefutable_let_patterns)]
2611    pub fn into_list_options(self) -> Option<(Server_ListOptionsResponder)> {
2612        if let Server_Request::ListOptions { responder } = self { Some((responder)) } else { None }
2613    }
2614
2615    #[allow(irrefutable_let_patterns)]
2616    pub fn into_list_parameters(self) -> Option<(Server_ListParametersResponder)> {
2617        if let Server_Request::ListParameters { responder } = self {
2618            Some((responder))
2619        } else {
2620            None
2621        }
2622    }
2623
2624    #[allow(irrefutable_let_patterns)]
2625    pub fn into_reset_options(self) -> Option<(Server_ResetOptionsResponder)> {
2626        if let Server_Request::ResetOptions { responder } = self { Some((responder)) } else { None }
2627    }
2628
2629    #[allow(irrefutable_let_patterns)]
2630    pub fn into_reset_parameters(self) -> Option<(Server_ResetParametersResponder)> {
2631        if let Server_Request::ResetParameters { responder } = self {
2632            Some((responder))
2633        } else {
2634            None
2635        }
2636    }
2637
2638    #[allow(irrefutable_let_patterns)]
2639    pub fn into_clear_leases(self) -> Option<(Server_ClearLeasesResponder)> {
2640        if let Server_Request::ClearLeases { responder } = self { Some((responder)) } else { None }
2641    }
2642
2643    /// Name of the method defined in FIDL
2644    pub fn method_name(&self) -> &'static str {
2645        match *self {
2646            Server_Request::StartServing { .. } => "start_serving",
2647            Server_Request::StopServing { .. } => "stop_serving",
2648            Server_Request::IsServing { .. } => "is_serving",
2649            Server_Request::GetOption { .. } => "get_option",
2650            Server_Request::GetParameter { .. } => "get_parameter",
2651            Server_Request::SetOption { .. } => "set_option",
2652            Server_Request::SetParameter { .. } => "set_parameter",
2653            Server_Request::ListOptions { .. } => "list_options",
2654            Server_Request::ListParameters { .. } => "list_parameters",
2655            Server_Request::ResetOptions { .. } => "reset_options",
2656            Server_Request::ResetParameters { .. } => "reset_parameters",
2657            Server_Request::ClearLeases { .. } => "clear_leases",
2658        }
2659    }
2660}
2661
2662#[derive(Debug, Clone)]
2663pub struct Server_ControlHandle {
2664    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2665}
2666
2667impl fidl::endpoints::ControlHandle for Server_ControlHandle {
2668    fn shutdown(&self) {
2669        self.inner.shutdown()
2670    }
2671    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2672        self.inner.shutdown_with_epitaph(status)
2673    }
2674
2675    fn is_closed(&self) -> bool {
2676        self.inner.channel().is_closed()
2677    }
2678    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2679        self.inner.channel().on_closed()
2680    }
2681
2682    #[cfg(target_os = "fuchsia")]
2683    fn signal_peer(
2684        &self,
2685        clear_mask: zx::Signals,
2686        set_mask: zx::Signals,
2687    ) -> Result<(), zx_status::Status> {
2688        use fidl::Peered;
2689        self.inner.channel().signal_peer(clear_mask, set_mask)
2690    }
2691}
2692
2693impl Server_ControlHandle {}
2694
2695#[must_use = "FIDL methods require a response to be sent"]
2696#[derive(Debug)]
2697pub struct Server_StartServingResponder {
2698    control_handle: std::mem::ManuallyDrop<Server_ControlHandle>,
2699    tx_id: u32,
2700}
2701
2702/// Set the the channel to be shutdown (see [`Server_ControlHandle::shutdown`])
2703/// if the responder is dropped without sending a response, so that the client
2704/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2705impl std::ops::Drop for Server_StartServingResponder {
2706    fn drop(&mut self) {
2707        self.control_handle.shutdown();
2708        // Safety: drops once, never accessed again
2709        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2710    }
2711}
2712
2713impl fidl::endpoints::Responder for Server_StartServingResponder {
2714    type ControlHandle = Server_ControlHandle;
2715
2716    fn control_handle(&self) -> &Server_ControlHandle {
2717        &self.control_handle
2718    }
2719
2720    fn drop_without_shutdown(mut self) {
2721        // Safety: drops once, never accessed again due to mem::forget
2722        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2723        // Prevent Drop from running (which would shut down the channel)
2724        std::mem::forget(self);
2725    }
2726}
2727
2728impl Server_StartServingResponder {
2729    /// Sends a response to the FIDL transaction.
2730    ///
2731    /// Sets the channel to shutdown if an error occurs.
2732    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2733        let _result = self.send_raw(result);
2734        if _result.is_err() {
2735            self.control_handle.shutdown();
2736        }
2737        self.drop_without_shutdown();
2738        _result
2739    }
2740
2741    /// Similar to "send" but does not shutdown the channel if an error occurs.
2742    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2743        let _result = self.send_raw(result);
2744        self.drop_without_shutdown();
2745        _result
2746    }
2747
2748    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
2749        self.control_handle
2750            .inner
2751            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
2752                result,
2753                self.tx_id,
2754                0x10990e324ac53cd1,
2755                fidl::encoding::DynamicFlags::empty(),
2756            )
2757    }
2758}
2759
2760#[must_use = "FIDL methods require a response to be sent"]
2761#[derive(Debug)]
2762pub struct Server_StopServingResponder {
2763    control_handle: std::mem::ManuallyDrop<Server_ControlHandle>,
2764    tx_id: u32,
2765}
2766
2767/// Set the the channel to be shutdown (see [`Server_ControlHandle::shutdown`])
2768/// if the responder is dropped without sending a response, so that the client
2769/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2770impl std::ops::Drop for Server_StopServingResponder {
2771    fn drop(&mut self) {
2772        self.control_handle.shutdown();
2773        // Safety: drops once, never accessed again
2774        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2775    }
2776}
2777
2778impl fidl::endpoints::Responder for Server_StopServingResponder {
2779    type ControlHandle = Server_ControlHandle;
2780
2781    fn control_handle(&self) -> &Server_ControlHandle {
2782        &self.control_handle
2783    }
2784
2785    fn drop_without_shutdown(mut self) {
2786        // Safety: drops once, never accessed again due to mem::forget
2787        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2788        // Prevent Drop from running (which would shut down the channel)
2789        std::mem::forget(self);
2790    }
2791}
2792
2793impl Server_StopServingResponder {
2794    /// Sends a response to the FIDL transaction.
2795    ///
2796    /// Sets the channel to shutdown if an error occurs.
2797    pub fn send(self) -> Result<(), fidl::Error> {
2798        let _result = self.send_raw();
2799        if _result.is_err() {
2800            self.control_handle.shutdown();
2801        }
2802        self.drop_without_shutdown();
2803        _result
2804    }
2805
2806    /// Similar to "send" but does not shutdown the channel if an error occurs.
2807    pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
2808        let _result = self.send_raw();
2809        self.drop_without_shutdown();
2810        _result
2811    }
2812
2813    fn send_raw(&self) -> Result<(), fidl::Error> {
2814        self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
2815            (),
2816            self.tx_id,
2817            0x7776cfe9f68a0dbe,
2818            fidl::encoding::DynamicFlags::empty(),
2819        )
2820    }
2821}
2822
2823#[must_use = "FIDL methods require a response to be sent"]
2824#[derive(Debug)]
2825pub struct Server_IsServingResponder {
2826    control_handle: std::mem::ManuallyDrop<Server_ControlHandle>,
2827    tx_id: u32,
2828}
2829
2830/// Set the the channel to be shutdown (see [`Server_ControlHandle::shutdown`])
2831/// if the responder is dropped without sending a response, so that the client
2832/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2833impl std::ops::Drop for Server_IsServingResponder {
2834    fn drop(&mut self) {
2835        self.control_handle.shutdown();
2836        // Safety: drops once, never accessed again
2837        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2838    }
2839}
2840
2841impl fidl::endpoints::Responder for Server_IsServingResponder {
2842    type ControlHandle = Server_ControlHandle;
2843
2844    fn control_handle(&self) -> &Server_ControlHandle {
2845        &self.control_handle
2846    }
2847
2848    fn drop_without_shutdown(mut self) {
2849        // Safety: drops once, never accessed again due to mem::forget
2850        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2851        // Prevent Drop from running (which would shut down the channel)
2852        std::mem::forget(self);
2853    }
2854}
2855
2856impl Server_IsServingResponder {
2857    /// Sends a response to the FIDL transaction.
2858    ///
2859    /// Sets the channel to shutdown if an error occurs.
2860    pub fn send(self, mut enabled: bool) -> Result<(), fidl::Error> {
2861        let _result = self.send_raw(enabled);
2862        if _result.is_err() {
2863            self.control_handle.shutdown();
2864        }
2865        self.drop_without_shutdown();
2866        _result
2867    }
2868
2869    /// Similar to "send" but does not shutdown the channel if an error occurs.
2870    pub fn send_no_shutdown_on_err(self, mut enabled: bool) -> Result<(), fidl::Error> {
2871        let _result = self.send_raw(enabled);
2872        self.drop_without_shutdown();
2873        _result
2874    }
2875
2876    fn send_raw(&self, mut enabled: bool) -> Result<(), fidl::Error> {
2877        self.control_handle.inner.send::<ServerIsServingResponse>(
2878            (enabled,),
2879            self.tx_id,
2880            0x45aadc35fcbe3826,
2881            fidl::encoding::DynamicFlags::empty(),
2882        )
2883    }
2884}
2885
2886#[must_use = "FIDL methods require a response to be sent"]
2887#[derive(Debug)]
2888pub struct Server_GetOptionResponder {
2889    control_handle: std::mem::ManuallyDrop<Server_ControlHandle>,
2890    tx_id: u32,
2891}
2892
2893/// Set the the channel to be shutdown (see [`Server_ControlHandle::shutdown`])
2894/// if the responder is dropped without sending a response, so that the client
2895/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2896impl std::ops::Drop for Server_GetOptionResponder {
2897    fn drop(&mut self) {
2898        self.control_handle.shutdown();
2899        // Safety: drops once, never accessed again
2900        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2901    }
2902}
2903
2904impl fidl::endpoints::Responder for Server_GetOptionResponder {
2905    type ControlHandle = Server_ControlHandle;
2906
2907    fn control_handle(&self) -> &Server_ControlHandle {
2908        &self.control_handle
2909    }
2910
2911    fn drop_without_shutdown(mut self) {
2912        // Safety: drops once, never accessed again due to mem::forget
2913        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2914        // Prevent Drop from running (which would shut down the channel)
2915        std::mem::forget(self);
2916    }
2917}
2918
2919impl Server_GetOptionResponder {
2920    /// Sends a response to the FIDL transaction.
2921    ///
2922    /// Sets the channel to shutdown if an error occurs.
2923    pub fn send(self, mut result: Result<&Option_, i32>) -> Result<(), fidl::Error> {
2924        let _result = self.send_raw(result);
2925        if _result.is_err() {
2926            self.control_handle.shutdown();
2927        }
2928        self.drop_without_shutdown();
2929        _result
2930    }
2931
2932    /// Similar to "send" but does not shutdown the channel if an error occurs.
2933    pub fn send_no_shutdown_on_err(
2934        self,
2935        mut result: Result<&Option_, i32>,
2936    ) -> Result<(), fidl::Error> {
2937        let _result = self.send_raw(result);
2938        self.drop_without_shutdown();
2939        _result
2940    }
2941
2942    fn send_raw(&self, mut result: Result<&Option_, i32>) -> Result<(), fidl::Error> {
2943        self.control_handle.inner.send::<fidl::encoding::ResultType<ServerGetOptionResponse, i32>>(
2944            result.map(|value| (value,)),
2945            self.tx_id,
2946            0x5305ee2c593f68a,
2947            fidl::encoding::DynamicFlags::empty(),
2948        )
2949    }
2950}
2951
2952#[must_use = "FIDL methods require a response to be sent"]
2953#[derive(Debug)]
2954pub struct Server_GetParameterResponder {
2955    control_handle: std::mem::ManuallyDrop<Server_ControlHandle>,
2956    tx_id: u32,
2957}
2958
2959/// Set the the channel to be shutdown (see [`Server_ControlHandle::shutdown`])
2960/// if the responder is dropped without sending a response, so that the client
2961/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2962impl std::ops::Drop for Server_GetParameterResponder {
2963    fn drop(&mut self) {
2964        self.control_handle.shutdown();
2965        // Safety: drops once, never accessed again
2966        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2967    }
2968}
2969
2970impl fidl::endpoints::Responder for Server_GetParameterResponder {
2971    type ControlHandle = Server_ControlHandle;
2972
2973    fn control_handle(&self) -> &Server_ControlHandle {
2974        &self.control_handle
2975    }
2976
2977    fn drop_without_shutdown(mut self) {
2978        // Safety: drops once, never accessed again due to mem::forget
2979        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2980        // Prevent Drop from running (which would shut down the channel)
2981        std::mem::forget(self);
2982    }
2983}
2984
2985impl Server_GetParameterResponder {
2986    /// Sends a response to the FIDL transaction.
2987    ///
2988    /// Sets the channel to shutdown if an error occurs.
2989    pub fn send(self, mut result: Result<&Parameter, i32>) -> Result<(), fidl::Error> {
2990        let _result = self.send_raw(result);
2991        if _result.is_err() {
2992            self.control_handle.shutdown();
2993        }
2994        self.drop_without_shutdown();
2995        _result
2996    }
2997
2998    /// Similar to "send" but does not shutdown the channel if an error occurs.
2999    pub fn send_no_shutdown_on_err(
3000        self,
3001        mut result: Result<&Parameter, i32>,
3002    ) -> Result<(), fidl::Error> {
3003        let _result = self.send_raw(result);
3004        self.drop_without_shutdown();
3005        _result
3006    }
3007
3008    fn send_raw(&self, mut result: Result<&Parameter, i32>) -> Result<(), fidl::Error> {
3009        self.control_handle
3010            .inner
3011            .send::<fidl::encoding::ResultType<ServerGetParameterResponse, i32>>(
3012                result.map(|value| (value,)),
3013                self.tx_id,
3014                0x1e8c98758fb82714,
3015                fidl::encoding::DynamicFlags::empty(),
3016            )
3017    }
3018}
3019
3020#[must_use = "FIDL methods require a response to be sent"]
3021#[derive(Debug)]
3022pub struct Server_SetOptionResponder {
3023    control_handle: std::mem::ManuallyDrop<Server_ControlHandle>,
3024    tx_id: u32,
3025}
3026
3027/// Set the the channel to be shutdown (see [`Server_ControlHandle::shutdown`])
3028/// if the responder is dropped without sending a response, so that the client
3029/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3030impl std::ops::Drop for Server_SetOptionResponder {
3031    fn drop(&mut self) {
3032        self.control_handle.shutdown();
3033        // Safety: drops once, never accessed again
3034        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3035    }
3036}
3037
3038impl fidl::endpoints::Responder for Server_SetOptionResponder {
3039    type ControlHandle = Server_ControlHandle;
3040
3041    fn control_handle(&self) -> &Server_ControlHandle {
3042        &self.control_handle
3043    }
3044
3045    fn drop_without_shutdown(mut self) {
3046        // Safety: drops once, never accessed again due to mem::forget
3047        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3048        // Prevent Drop from running (which would shut down the channel)
3049        std::mem::forget(self);
3050    }
3051}
3052
3053impl Server_SetOptionResponder {
3054    /// Sends a response to the FIDL transaction.
3055    ///
3056    /// Sets the channel to shutdown if an error occurs.
3057    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3058        let _result = self.send_raw(result);
3059        if _result.is_err() {
3060            self.control_handle.shutdown();
3061        }
3062        self.drop_without_shutdown();
3063        _result
3064    }
3065
3066    /// Similar to "send" but does not shutdown the channel if an error occurs.
3067    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3068        let _result = self.send_raw(result);
3069        self.drop_without_shutdown();
3070        _result
3071    }
3072
3073    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3074        self.control_handle
3075            .inner
3076            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3077                result,
3078                self.tx_id,
3079                0x63c98b670db8d96a,
3080                fidl::encoding::DynamicFlags::empty(),
3081            )
3082    }
3083}
3084
3085#[must_use = "FIDL methods require a response to be sent"]
3086#[derive(Debug)]
3087pub struct Server_SetParameterResponder {
3088    control_handle: std::mem::ManuallyDrop<Server_ControlHandle>,
3089    tx_id: u32,
3090}
3091
3092/// Set the the channel to be shutdown (see [`Server_ControlHandle::shutdown`])
3093/// if the responder is dropped without sending a response, so that the client
3094/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3095impl std::ops::Drop for Server_SetParameterResponder {
3096    fn drop(&mut self) {
3097        self.control_handle.shutdown();
3098        // Safety: drops once, never accessed again
3099        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3100    }
3101}
3102
3103impl fidl::endpoints::Responder for Server_SetParameterResponder {
3104    type ControlHandle = Server_ControlHandle;
3105
3106    fn control_handle(&self) -> &Server_ControlHandle {
3107        &self.control_handle
3108    }
3109
3110    fn drop_without_shutdown(mut self) {
3111        // Safety: drops once, never accessed again due to mem::forget
3112        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3113        // Prevent Drop from running (which would shut down the channel)
3114        std::mem::forget(self);
3115    }
3116}
3117
3118impl Server_SetParameterResponder {
3119    /// Sends a response to the FIDL transaction.
3120    ///
3121    /// Sets the channel to shutdown if an error occurs.
3122    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3123        let _result = self.send_raw(result);
3124        if _result.is_err() {
3125            self.control_handle.shutdown();
3126        }
3127        self.drop_without_shutdown();
3128        _result
3129    }
3130
3131    /// Similar to "send" but does not shutdown the channel if an error occurs.
3132    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3133        let _result = self.send_raw(result);
3134        self.drop_without_shutdown();
3135        _result
3136    }
3137
3138    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3139        self.control_handle
3140            .inner
3141            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3142                result,
3143                self.tx_id,
3144                0x3002d0d956eb4bdc,
3145                fidl::encoding::DynamicFlags::empty(),
3146            )
3147    }
3148}
3149
3150#[must_use = "FIDL methods require a response to be sent"]
3151#[derive(Debug)]
3152pub struct Server_ListOptionsResponder {
3153    control_handle: std::mem::ManuallyDrop<Server_ControlHandle>,
3154    tx_id: u32,
3155}
3156
3157/// Set the the channel to be shutdown (see [`Server_ControlHandle::shutdown`])
3158/// if the responder is dropped without sending a response, so that the client
3159/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3160impl std::ops::Drop for Server_ListOptionsResponder {
3161    fn drop(&mut self) {
3162        self.control_handle.shutdown();
3163        // Safety: drops once, never accessed again
3164        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3165    }
3166}
3167
3168impl fidl::endpoints::Responder for Server_ListOptionsResponder {
3169    type ControlHandle = Server_ControlHandle;
3170
3171    fn control_handle(&self) -> &Server_ControlHandle {
3172        &self.control_handle
3173    }
3174
3175    fn drop_without_shutdown(mut self) {
3176        // Safety: drops once, never accessed again due to mem::forget
3177        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3178        // Prevent Drop from running (which would shut down the channel)
3179        std::mem::forget(self);
3180    }
3181}
3182
3183impl Server_ListOptionsResponder {
3184    /// Sends a response to the FIDL transaction.
3185    ///
3186    /// Sets the channel to shutdown if an error occurs.
3187    pub fn send(self, mut result: Result<&[Option_], i32>) -> Result<(), fidl::Error> {
3188        let _result = self.send_raw(result);
3189        if _result.is_err() {
3190            self.control_handle.shutdown();
3191        }
3192        self.drop_without_shutdown();
3193        _result
3194    }
3195
3196    /// Similar to "send" but does not shutdown the channel if an error occurs.
3197    pub fn send_no_shutdown_on_err(
3198        self,
3199        mut result: Result<&[Option_], i32>,
3200    ) -> Result<(), fidl::Error> {
3201        let _result = self.send_raw(result);
3202        self.drop_without_shutdown();
3203        _result
3204    }
3205
3206    fn send_raw(&self, mut result: Result<&[Option_], i32>) -> Result<(), fidl::Error> {
3207        self.control_handle
3208            .inner
3209            .send::<fidl::encoding::ResultType<ServerListOptionsResponse, i32>>(
3210                result.map(|options| (options,)),
3211                self.tx_id,
3212                0x72c8161c69ca67b,
3213                fidl::encoding::DynamicFlags::empty(),
3214            )
3215    }
3216}
3217
3218#[must_use = "FIDL methods require a response to be sent"]
3219#[derive(Debug)]
3220pub struct Server_ListParametersResponder {
3221    control_handle: std::mem::ManuallyDrop<Server_ControlHandle>,
3222    tx_id: u32,
3223}
3224
3225/// Set the the channel to be shutdown (see [`Server_ControlHandle::shutdown`])
3226/// if the responder is dropped without sending a response, so that the client
3227/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3228impl std::ops::Drop for Server_ListParametersResponder {
3229    fn drop(&mut self) {
3230        self.control_handle.shutdown();
3231        // Safety: drops once, never accessed again
3232        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3233    }
3234}
3235
3236impl fidl::endpoints::Responder for Server_ListParametersResponder {
3237    type ControlHandle = Server_ControlHandle;
3238
3239    fn control_handle(&self) -> &Server_ControlHandle {
3240        &self.control_handle
3241    }
3242
3243    fn drop_without_shutdown(mut self) {
3244        // Safety: drops once, never accessed again due to mem::forget
3245        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3246        // Prevent Drop from running (which would shut down the channel)
3247        std::mem::forget(self);
3248    }
3249}
3250
3251impl Server_ListParametersResponder {
3252    /// Sends a response to the FIDL transaction.
3253    ///
3254    /// Sets the channel to shutdown if an error occurs.
3255    pub fn send(self, mut result: Result<&[Parameter], i32>) -> Result<(), fidl::Error> {
3256        let _result = self.send_raw(result);
3257        if _result.is_err() {
3258            self.control_handle.shutdown();
3259        }
3260        self.drop_without_shutdown();
3261        _result
3262    }
3263
3264    /// Similar to "send" but does not shutdown the channel if an error occurs.
3265    pub fn send_no_shutdown_on_err(
3266        self,
3267        mut result: Result<&[Parameter], i32>,
3268    ) -> Result<(), fidl::Error> {
3269        let _result = self.send_raw(result);
3270        self.drop_without_shutdown();
3271        _result
3272    }
3273
3274    fn send_raw(&self, mut result: Result<&[Parameter], i32>) -> Result<(), fidl::Error> {
3275        self.control_handle
3276            .inner
3277            .send::<fidl::encoding::ResultType<ServerListParametersResponse, i32>>(
3278                result.map(|parameters| (parameters,)),
3279                self.tx_id,
3280                0xa201b1d6d121c59,
3281                fidl::encoding::DynamicFlags::empty(),
3282            )
3283    }
3284}
3285
3286#[must_use = "FIDL methods require a response to be sent"]
3287#[derive(Debug)]
3288pub struct Server_ResetOptionsResponder {
3289    control_handle: std::mem::ManuallyDrop<Server_ControlHandle>,
3290    tx_id: u32,
3291}
3292
3293/// Set the the channel to be shutdown (see [`Server_ControlHandle::shutdown`])
3294/// if the responder is dropped without sending a response, so that the client
3295/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3296impl std::ops::Drop for Server_ResetOptionsResponder {
3297    fn drop(&mut self) {
3298        self.control_handle.shutdown();
3299        // Safety: drops once, never accessed again
3300        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3301    }
3302}
3303
3304impl fidl::endpoints::Responder for Server_ResetOptionsResponder {
3305    type ControlHandle = Server_ControlHandle;
3306
3307    fn control_handle(&self) -> &Server_ControlHandle {
3308        &self.control_handle
3309    }
3310
3311    fn drop_without_shutdown(mut self) {
3312        // Safety: drops once, never accessed again due to mem::forget
3313        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3314        // Prevent Drop from running (which would shut down the channel)
3315        std::mem::forget(self);
3316    }
3317}
3318
3319impl Server_ResetOptionsResponder {
3320    /// Sends a response to the FIDL transaction.
3321    ///
3322    /// Sets the channel to shutdown if an error occurs.
3323    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3324        let _result = self.send_raw(result);
3325        if _result.is_err() {
3326            self.control_handle.shutdown();
3327        }
3328        self.drop_without_shutdown();
3329        _result
3330    }
3331
3332    /// Similar to "send" but does not shutdown the channel if an error occurs.
3333    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3334        let _result = self.send_raw(result);
3335        self.drop_without_shutdown();
3336        _result
3337    }
3338
3339    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3340        self.control_handle
3341            .inner
3342            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3343                result,
3344                self.tx_id,
3345                0x31014911fd21cc13,
3346                fidl::encoding::DynamicFlags::empty(),
3347            )
3348    }
3349}
3350
3351#[must_use = "FIDL methods require a response to be sent"]
3352#[derive(Debug)]
3353pub struct Server_ResetParametersResponder {
3354    control_handle: std::mem::ManuallyDrop<Server_ControlHandle>,
3355    tx_id: u32,
3356}
3357
3358/// Set the the channel to be shutdown (see [`Server_ControlHandle::shutdown`])
3359/// if the responder is dropped without sending a response, so that the client
3360/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3361impl std::ops::Drop for Server_ResetParametersResponder {
3362    fn drop(&mut self) {
3363        self.control_handle.shutdown();
3364        // Safety: drops once, never accessed again
3365        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3366    }
3367}
3368
3369impl fidl::endpoints::Responder for Server_ResetParametersResponder {
3370    type ControlHandle = Server_ControlHandle;
3371
3372    fn control_handle(&self) -> &Server_ControlHandle {
3373        &self.control_handle
3374    }
3375
3376    fn drop_without_shutdown(mut self) {
3377        // Safety: drops once, never accessed again due to mem::forget
3378        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3379        // Prevent Drop from running (which would shut down the channel)
3380        std::mem::forget(self);
3381    }
3382}
3383
3384impl Server_ResetParametersResponder {
3385    /// Sends a response to the FIDL transaction.
3386    ///
3387    /// Sets the channel to shutdown if an error occurs.
3388    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3389        let _result = self.send_raw(result);
3390        if _result.is_err() {
3391            self.control_handle.shutdown();
3392        }
3393        self.drop_without_shutdown();
3394        _result
3395    }
3396
3397    /// Similar to "send" but does not shutdown the channel if an error occurs.
3398    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3399        let _result = self.send_raw(result);
3400        self.drop_without_shutdown();
3401        _result
3402    }
3403
3404    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3405        self.control_handle
3406            .inner
3407            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3408                result,
3409                self.tx_id,
3410                0x353fba50bcf4ecec,
3411                fidl::encoding::DynamicFlags::empty(),
3412            )
3413    }
3414}
3415
3416#[must_use = "FIDL methods require a response to be sent"]
3417#[derive(Debug)]
3418pub struct Server_ClearLeasesResponder {
3419    control_handle: std::mem::ManuallyDrop<Server_ControlHandle>,
3420    tx_id: u32,
3421}
3422
3423/// Set the the channel to be shutdown (see [`Server_ControlHandle::shutdown`])
3424/// if the responder is dropped without sending a response, so that the client
3425/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
3426impl std::ops::Drop for Server_ClearLeasesResponder {
3427    fn drop(&mut self) {
3428        self.control_handle.shutdown();
3429        // Safety: drops once, never accessed again
3430        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3431    }
3432}
3433
3434impl fidl::endpoints::Responder for Server_ClearLeasesResponder {
3435    type ControlHandle = Server_ControlHandle;
3436
3437    fn control_handle(&self) -> &Server_ControlHandle {
3438        &self.control_handle
3439    }
3440
3441    fn drop_without_shutdown(mut self) {
3442        // Safety: drops once, never accessed again due to mem::forget
3443        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
3444        // Prevent Drop from running (which would shut down the channel)
3445        std::mem::forget(self);
3446    }
3447}
3448
3449impl Server_ClearLeasesResponder {
3450    /// Sends a response to the FIDL transaction.
3451    ///
3452    /// Sets the channel to shutdown if an error occurs.
3453    pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3454        let _result = self.send_raw(result);
3455        if _result.is_err() {
3456            self.control_handle.shutdown();
3457        }
3458        self.drop_without_shutdown();
3459        _result
3460    }
3461
3462    /// Similar to "send" but does not shutdown the channel if an error occurs.
3463    pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3464        let _result = self.send_raw(result);
3465        self.drop_without_shutdown();
3466        _result
3467    }
3468
3469    fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
3470        self.control_handle
3471            .inner
3472            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
3473                result,
3474                self.tx_id,
3475                0xe39e35cda85a04d,
3476                fidl::encoding::DynamicFlags::empty(),
3477            )
3478    }
3479}
3480
3481mod internal {
3482    use super::*;
3483
3484    impl fidl::encoding::ResourceTypeMarker for ClientProviderNewClientRequest {
3485        type Borrowed<'a> = &'a mut Self;
3486        fn take_or_borrow<'a>(
3487            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3488        ) -> Self::Borrowed<'a> {
3489            value
3490        }
3491    }
3492
3493    unsafe impl fidl::encoding::TypeMarker for ClientProviderNewClientRequest {
3494        type Owned = Self;
3495
3496        #[inline(always)]
3497        fn inline_align(_context: fidl::encoding::Context) -> usize {
3498            8
3499        }
3500
3501        #[inline(always)]
3502        fn inline_size(_context: fidl::encoding::Context) -> usize {
3503            32
3504        }
3505    }
3506
3507    unsafe impl
3508        fidl::encoding::Encode<
3509            ClientProviderNewClientRequest,
3510            fidl::encoding::DefaultFuchsiaResourceDialect,
3511        > for &mut ClientProviderNewClientRequest
3512    {
3513        #[inline]
3514        unsafe fn encode(
3515            self,
3516            encoder: &mut fidl::encoding::Encoder<
3517                '_,
3518                fidl::encoding::DefaultFuchsiaResourceDialect,
3519            >,
3520            offset: usize,
3521            _depth: fidl::encoding::Depth,
3522        ) -> fidl::Result<()> {
3523            encoder.debug_check_bounds::<ClientProviderNewClientRequest>(offset);
3524            // Delegate to tuple encoding.
3525            fidl::encoding::Encode::<ClientProviderNewClientRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
3526                (
3527                    <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.interface_id),
3528                    <NewClientParams as fidl::encoding::ValueTypeMarker>::borrow(&self.params),
3529                    <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.request),
3530                ),
3531                encoder, offset, _depth
3532            )
3533        }
3534    }
3535    unsafe impl<
3536        T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
3537        T1: fidl::encoding::Encode<NewClientParams, fidl::encoding::DefaultFuchsiaResourceDialect>,
3538        T2: fidl::encoding::Encode<
3539                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientMarker>>,
3540                fidl::encoding::DefaultFuchsiaResourceDialect,
3541            >,
3542    >
3543        fidl::encoding::Encode<
3544            ClientProviderNewClientRequest,
3545            fidl::encoding::DefaultFuchsiaResourceDialect,
3546        > for (T0, T1, T2)
3547    {
3548        #[inline]
3549        unsafe fn encode(
3550            self,
3551            encoder: &mut fidl::encoding::Encoder<
3552                '_,
3553                fidl::encoding::DefaultFuchsiaResourceDialect,
3554            >,
3555            offset: usize,
3556            depth: fidl::encoding::Depth,
3557        ) -> fidl::Result<()> {
3558            encoder.debug_check_bounds::<ClientProviderNewClientRequest>(offset);
3559            // Zero out padding regions. There's no need to apply masks
3560            // because the unmasked parts will be overwritten by fields.
3561            unsafe {
3562                let ptr = encoder.buf.as_mut_ptr().add(offset).offset(24);
3563                (ptr as *mut u64).write_unaligned(0);
3564            }
3565            // Write the fields.
3566            self.0.encode(encoder, offset + 0, depth)?;
3567            self.1.encode(encoder, offset + 8, depth)?;
3568            self.2.encode(encoder, offset + 24, depth)?;
3569            Ok(())
3570        }
3571    }
3572
3573    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
3574        for ClientProviderNewClientRequest
3575    {
3576        #[inline(always)]
3577        fn new_empty() -> Self {
3578            Self {
3579                interface_id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
3580                params: fidl::new_empty!(
3581                    NewClientParams,
3582                    fidl::encoding::DefaultFuchsiaResourceDialect
3583                ),
3584                request: fidl::new_empty!(
3585                    fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientMarker>>,
3586                    fidl::encoding::DefaultFuchsiaResourceDialect
3587                ),
3588            }
3589        }
3590
3591        #[inline]
3592        unsafe fn decode(
3593            &mut self,
3594            decoder: &mut fidl::encoding::Decoder<
3595                '_,
3596                fidl::encoding::DefaultFuchsiaResourceDialect,
3597            >,
3598            offset: usize,
3599            _depth: fidl::encoding::Depth,
3600        ) -> fidl::Result<()> {
3601            decoder.debug_check_bounds::<Self>(offset);
3602            // Verify that padding bytes are zero.
3603            let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(24) };
3604            let padval = unsafe { (ptr as *const u64).read_unaligned() };
3605            let mask = 0xffffffff00000000u64;
3606            let maskedval = padval & mask;
3607            if maskedval != 0 {
3608                return Err(fidl::Error::NonZeroPadding {
3609                    padding_start: offset + 24 + ((mask as u64).trailing_zeros() / 8) as usize,
3610                });
3611            }
3612            fidl::decode!(
3613                u64,
3614                fidl::encoding::DefaultFuchsiaResourceDialect,
3615                &mut self.interface_id,
3616                decoder,
3617                offset + 0,
3618                _depth
3619            )?;
3620            fidl::decode!(
3621                NewClientParams,
3622                fidl::encoding::DefaultFuchsiaResourceDialect,
3623                &mut self.params,
3624                decoder,
3625                offset + 8,
3626                _depth
3627            )?;
3628            fidl::decode!(
3629                fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<ClientMarker>>,
3630                fidl::encoding::DefaultFuchsiaResourceDialect,
3631                &mut self.request,
3632                decoder,
3633                offset + 24,
3634                _depth
3635            )?;
3636            Ok(())
3637        }
3638    }
3639
3640    impl Address {
3641        #[inline(always)]
3642        fn max_ordinal_present(&self) -> u64 {
3643            if let Some(_) = self.address_state_provider {
3644                return 3;
3645            }
3646            if let Some(_) = self.address_parameters {
3647                return 2;
3648            }
3649            if let Some(_) = self.address {
3650                return 1;
3651            }
3652            0
3653        }
3654    }
3655
3656    impl fidl::encoding::ResourceTypeMarker for Address {
3657        type Borrowed<'a> = &'a mut Self;
3658        fn take_or_borrow<'a>(
3659            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
3660        ) -> Self::Borrowed<'a> {
3661            value
3662        }
3663    }
3664
3665    unsafe impl fidl::encoding::TypeMarker for Address {
3666        type Owned = Self;
3667
3668        #[inline(always)]
3669        fn inline_align(_context: fidl::encoding::Context) -> usize {
3670            8
3671        }
3672
3673        #[inline(always)]
3674        fn inline_size(_context: fidl::encoding::Context) -> usize {
3675            16
3676        }
3677    }
3678
3679    unsafe impl fidl::encoding::Encode<Address, fidl::encoding::DefaultFuchsiaResourceDialect>
3680        for &mut Address
3681    {
3682        unsafe fn encode(
3683            self,
3684            encoder: &mut fidl::encoding::Encoder<
3685                '_,
3686                fidl::encoding::DefaultFuchsiaResourceDialect,
3687            >,
3688            offset: usize,
3689            mut depth: fidl::encoding::Depth,
3690        ) -> fidl::Result<()> {
3691            encoder.debug_check_bounds::<Address>(offset);
3692            // Vector header
3693            let max_ordinal: u64 = self.max_ordinal_present();
3694            encoder.write_num(max_ordinal, offset);
3695            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
3696            // Calling encoder.out_of_line_offset(0) is not allowed.
3697            if max_ordinal == 0 {
3698                return Ok(());
3699            }
3700            depth.increment()?;
3701            let envelope_size = 8;
3702            let bytes_len = max_ordinal as usize * envelope_size;
3703            #[allow(unused_variables)]
3704            let offset = encoder.out_of_line_offset(bytes_len);
3705            let mut _prev_end_offset: usize = 0;
3706            if 1 > max_ordinal {
3707                return Ok(());
3708            }
3709
3710            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3711            // are envelope_size bytes.
3712            let cur_offset: usize = (1 - 1) * envelope_size;
3713
3714            // Zero reserved fields.
3715            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3716
3717            // Safety:
3718            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3719            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3720            //   envelope_size bytes, there is always sufficient room.
3721            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net::Ipv4AddressWithPrefix, fidl::encoding::DefaultFuchsiaResourceDialect>(
3722            self.address.as_ref().map(<fidl_fuchsia_net::Ipv4AddressWithPrefix as fidl::encoding::ValueTypeMarker>::borrow),
3723            encoder, offset + cur_offset, depth
3724        )?;
3725
3726            _prev_end_offset = cur_offset + envelope_size;
3727            if 2 > max_ordinal {
3728                return Ok(());
3729            }
3730
3731            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3732            // are envelope_size bytes.
3733            let cur_offset: usize = (2 - 1) * envelope_size;
3734
3735            // Zero reserved fields.
3736            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3737
3738            // Safety:
3739            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3740            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3741            //   envelope_size bytes, there is always sufficient room.
3742            fidl::encoding::encode_in_envelope_optional::<fidl_fuchsia_net_interfaces_admin::AddressParameters, fidl::encoding::DefaultFuchsiaResourceDialect>(
3743            self.address_parameters.as_ref().map(<fidl_fuchsia_net_interfaces_admin::AddressParameters as fidl::encoding::ValueTypeMarker>::borrow),
3744            encoder, offset + cur_offset, depth
3745        )?;
3746
3747            _prev_end_offset = cur_offset + envelope_size;
3748            if 3 > max_ordinal {
3749                return Ok(());
3750            }
3751
3752            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
3753            // are envelope_size bytes.
3754            let cur_offset: usize = (3 - 1) * envelope_size;
3755
3756            // Zero reserved fields.
3757            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
3758
3759            // Safety:
3760            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
3761            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
3762            //   envelope_size bytes, there is always sufficient room.
3763            fidl::encoding::encode_in_envelope_optional::<
3764                fidl::encoding::Endpoint<
3765                    fidl::endpoints::ServerEnd<
3766                        fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
3767                    >,
3768                >,
3769                fidl::encoding::DefaultFuchsiaResourceDialect,
3770            >(
3771                self.address_state_provider.as_mut().map(
3772                    <fidl::encoding::Endpoint<
3773                        fidl::endpoints::ServerEnd<
3774                            fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
3775                        >,
3776                    > as fidl::encoding::ResourceTypeMarker>::take_or_borrow,
3777                ),
3778                encoder,
3779                offset + cur_offset,
3780                depth,
3781            )?;
3782
3783            _prev_end_offset = cur_offset + envelope_size;
3784
3785            Ok(())
3786        }
3787    }
3788
3789    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect> for Address {
3790        #[inline(always)]
3791        fn new_empty() -> Self {
3792            Self::default()
3793        }
3794
3795        unsafe fn decode(
3796            &mut self,
3797            decoder: &mut fidl::encoding::Decoder<
3798                '_,
3799                fidl::encoding::DefaultFuchsiaResourceDialect,
3800            >,
3801            offset: usize,
3802            mut depth: fidl::encoding::Depth,
3803        ) -> fidl::Result<()> {
3804            decoder.debug_check_bounds::<Self>(offset);
3805            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
3806                None => return Err(fidl::Error::NotNullable),
3807                Some(len) => len,
3808            };
3809            // Calling decoder.out_of_line_offset(0) is not allowed.
3810            if len == 0 {
3811                return Ok(());
3812            };
3813            depth.increment()?;
3814            let envelope_size = 8;
3815            let bytes_len = len * envelope_size;
3816            let offset = decoder.out_of_line_offset(bytes_len)?;
3817            // Decode the envelope for each type.
3818            let mut _next_ordinal_to_read = 0;
3819            let mut next_offset = offset;
3820            let end_offset = offset + bytes_len;
3821            _next_ordinal_to_read += 1;
3822            if next_offset >= end_offset {
3823                return Ok(());
3824            }
3825
3826            // Decode unknown envelopes for gaps in ordinals.
3827            while _next_ordinal_to_read < 1 {
3828                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3829                _next_ordinal_to_read += 1;
3830                next_offset += envelope_size;
3831            }
3832
3833            let next_out_of_line = decoder.next_out_of_line();
3834            let handles_before = decoder.remaining_handles();
3835            if let Some((inlined, num_bytes, num_handles)) =
3836                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3837            {
3838                let member_inline_size = <fidl_fuchsia_net::Ipv4AddressWithPrefix as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3839                if inlined != (member_inline_size <= 4) {
3840                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3841                }
3842                let inner_offset;
3843                let mut inner_depth = depth.clone();
3844                if inlined {
3845                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3846                    inner_offset = next_offset;
3847                } else {
3848                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3849                    inner_depth.increment()?;
3850                }
3851                let val_ref = self.address.get_or_insert_with(|| {
3852                    fidl::new_empty!(
3853                        fidl_fuchsia_net::Ipv4AddressWithPrefix,
3854                        fidl::encoding::DefaultFuchsiaResourceDialect
3855                    )
3856                });
3857                fidl::decode!(
3858                    fidl_fuchsia_net::Ipv4AddressWithPrefix,
3859                    fidl::encoding::DefaultFuchsiaResourceDialect,
3860                    val_ref,
3861                    decoder,
3862                    inner_offset,
3863                    inner_depth
3864                )?;
3865                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3866                {
3867                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3868                }
3869                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3870                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3871                }
3872            }
3873
3874            next_offset += envelope_size;
3875            _next_ordinal_to_read += 1;
3876            if next_offset >= end_offset {
3877                return Ok(());
3878            }
3879
3880            // Decode unknown envelopes for gaps in ordinals.
3881            while _next_ordinal_to_read < 2 {
3882                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3883                _next_ordinal_to_read += 1;
3884                next_offset += envelope_size;
3885            }
3886
3887            let next_out_of_line = decoder.next_out_of_line();
3888            let handles_before = decoder.remaining_handles();
3889            if let Some((inlined, num_bytes, num_handles)) =
3890                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3891            {
3892                let member_inline_size = <fidl_fuchsia_net_interfaces_admin::AddressParameters as fidl::encoding::TypeMarker>::inline_size(decoder.context);
3893                if inlined != (member_inline_size <= 4) {
3894                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3895                }
3896                let inner_offset;
3897                let mut inner_depth = depth.clone();
3898                if inlined {
3899                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3900                    inner_offset = next_offset;
3901                } else {
3902                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3903                    inner_depth.increment()?;
3904                }
3905                let val_ref = self.address_parameters.get_or_insert_with(|| {
3906                    fidl::new_empty!(
3907                        fidl_fuchsia_net_interfaces_admin::AddressParameters,
3908                        fidl::encoding::DefaultFuchsiaResourceDialect
3909                    )
3910                });
3911                fidl::decode!(
3912                    fidl_fuchsia_net_interfaces_admin::AddressParameters,
3913                    fidl::encoding::DefaultFuchsiaResourceDialect,
3914                    val_ref,
3915                    decoder,
3916                    inner_offset,
3917                    inner_depth
3918                )?;
3919                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3920                {
3921                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3922                }
3923                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3924                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3925                }
3926            }
3927
3928            next_offset += envelope_size;
3929            _next_ordinal_to_read += 1;
3930            if next_offset >= end_offset {
3931                return Ok(());
3932            }
3933
3934            // Decode unknown envelopes for gaps in ordinals.
3935            while _next_ordinal_to_read < 3 {
3936                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
3937                _next_ordinal_to_read += 1;
3938                next_offset += envelope_size;
3939            }
3940
3941            let next_out_of_line = decoder.next_out_of_line();
3942            let handles_before = decoder.remaining_handles();
3943            if let Some((inlined, num_bytes, num_handles)) =
3944                fidl::encoding::decode_envelope_header(decoder, next_offset)?
3945            {
3946                let member_inline_size = <fidl::encoding::Endpoint<
3947                    fidl::endpoints::ServerEnd<
3948                        fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
3949                    >,
3950                > as fidl::encoding::TypeMarker>::inline_size(
3951                    decoder.context
3952                );
3953                if inlined != (member_inline_size <= 4) {
3954                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
3955                }
3956                let inner_offset;
3957                let mut inner_depth = depth.clone();
3958                if inlined {
3959                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
3960                    inner_offset = next_offset;
3961                } else {
3962                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
3963                    inner_depth.increment()?;
3964                }
3965                let val_ref = self.address_state_provider.get_or_insert_with(|| {
3966                    fidl::new_empty!(
3967                        fidl::encoding::Endpoint<
3968                            fidl::endpoints::ServerEnd<
3969                                fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
3970                            >,
3971                        >,
3972                        fidl::encoding::DefaultFuchsiaResourceDialect
3973                    )
3974                });
3975                fidl::decode!(
3976                    fidl::encoding::Endpoint<
3977                        fidl::endpoints::ServerEnd<
3978                            fidl_fuchsia_net_interfaces_admin::AddressStateProviderMarker,
3979                        >,
3980                    >,
3981                    fidl::encoding::DefaultFuchsiaResourceDialect,
3982                    val_ref,
3983                    decoder,
3984                    inner_offset,
3985                    inner_depth
3986                )?;
3987                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
3988                {
3989                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
3990                }
3991                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
3992                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
3993                }
3994            }
3995
3996            next_offset += envelope_size;
3997
3998            // Decode the remaining unknown envelopes.
3999            while next_offset < end_offset {
4000                _next_ordinal_to_read += 1;
4001                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4002                next_offset += envelope_size;
4003            }
4004
4005            Ok(())
4006        }
4007    }
4008
4009    impl ClientWatchConfigurationResponse {
4010        #[inline(always)]
4011        fn max_ordinal_present(&self) -> u64 {
4012            if let Some(_) = self.routers {
4013                return 3;
4014            }
4015            if let Some(_) = self.dns_servers {
4016                return 2;
4017            }
4018            if let Some(_) = self.address {
4019                return 1;
4020            }
4021            0
4022        }
4023    }
4024
4025    impl fidl::encoding::ResourceTypeMarker for ClientWatchConfigurationResponse {
4026        type Borrowed<'a> = &'a mut Self;
4027        fn take_or_borrow<'a>(
4028            value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
4029        ) -> Self::Borrowed<'a> {
4030            value
4031        }
4032    }
4033
4034    unsafe impl fidl::encoding::TypeMarker for ClientWatchConfigurationResponse {
4035        type Owned = Self;
4036
4037        #[inline(always)]
4038        fn inline_align(_context: fidl::encoding::Context) -> usize {
4039            8
4040        }
4041
4042        #[inline(always)]
4043        fn inline_size(_context: fidl::encoding::Context) -> usize {
4044            16
4045        }
4046    }
4047
4048    unsafe impl
4049        fidl::encoding::Encode<
4050            ClientWatchConfigurationResponse,
4051            fidl::encoding::DefaultFuchsiaResourceDialect,
4052        > for &mut ClientWatchConfigurationResponse
4053    {
4054        unsafe fn encode(
4055            self,
4056            encoder: &mut fidl::encoding::Encoder<
4057                '_,
4058                fidl::encoding::DefaultFuchsiaResourceDialect,
4059            >,
4060            offset: usize,
4061            mut depth: fidl::encoding::Depth,
4062        ) -> fidl::Result<()> {
4063            encoder.debug_check_bounds::<ClientWatchConfigurationResponse>(offset);
4064            // Vector header
4065            let max_ordinal: u64 = self.max_ordinal_present();
4066            encoder.write_num(max_ordinal, offset);
4067            encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
4068            // Calling encoder.out_of_line_offset(0) is not allowed.
4069            if max_ordinal == 0 {
4070                return Ok(());
4071            }
4072            depth.increment()?;
4073            let envelope_size = 8;
4074            let bytes_len = max_ordinal as usize * envelope_size;
4075            #[allow(unused_variables)]
4076            let offset = encoder.out_of_line_offset(bytes_len);
4077            let mut _prev_end_offset: usize = 0;
4078            if 1 > max_ordinal {
4079                return Ok(());
4080            }
4081
4082            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4083            // are envelope_size bytes.
4084            let cur_offset: usize = (1 - 1) * envelope_size;
4085
4086            // Zero reserved fields.
4087            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4088
4089            // Safety:
4090            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4091            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4092            //   envelope_size bytes, there is always sufficient room.
4093            fidl::encoding::encode_in_envelope_optional::<
4094                Address,
4095                fidl::encoding::DefaultFuchsiaResourceDialect,
4096            >(
4097                self.address
4098                    .as_mut()
4099                    .map(<Address as fidl::encoding::ResourceTypeMarker>::take_or_borrow),
4100                encoder,
4101                offset + cur_offset,
4102                depth,
4103            )?;
4104
4105            _prev_end_offset = cur_offset + envelope_size;
4106            if 2 > max_ordinal {
4107                return Ok(());
4108            }
4109
4110            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4111            // are envelope_size bytes.
4112            let cur_offset: usize = (2 - 1) * envelope_size;
4113
4114            // Zero reserved fields.
4115            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4116
4117            // Safety:
4118            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4119            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4120            //   envelope_size bytes, there is always sufficient room.
4121            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_net::Ipv4Address, 64>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4122            self.dns_servers.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_net::Ipv4Address, 64> as fidl::encoding::ValueTypeMarker>::borrow),
4123            encoder, offset + cur_offset, depth
4124        )?;
4125
4126            _prev_end_offset = cur_offset + envelope_size;
4127            if 3 > max_ordinal {
4128                return Ok(());
4129            }
4130
4131            // Write at offset+(ordinal-1)*envelope_size, since ordinals are one-based and envelopes
4132            // are envelope_size bytes.
4133            let cur_offset: usize = (3 - 1) * envelope_size;
4134
4135            // Zero reserved fields.
4136            encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
4137
4138            // Safety:
4139            // - bytes_len is calculated to fit envelope_size*max(member.ordinal).
4140            // - Since cur_offset is envelope_size*(member.ordinal - 1) and the envelope takes
4141            //   envelope_size bytes, there is always sufficient room.
4142            fidl::encoding::encode_in_envelope_optional::<fidl::encoding::Vector<fidl_fuchsia_net::Ipv4Address, 64>, fidl::encoding::DefaultFuchsiaResourceDialect>(
4143            self.routers.as_ref().map(<fidl::encoding::Vector<fidl_fuchsia_net::Ipv4Address, 64> as fidl::encoding::ValueTypeMarker>::borrow),
4144            encoder, offset + cur_offset, depth
4145        )?;
4146
4147            _prev_end_offset = cur_offset + envelope_size;
4148
4149            Ok(())
4150        }
4151    }
4152
4153    impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
4154        for ClientWatchConfigurationResponse
4155    {
4156        #[inline(always)]
4157        fn new_empty() -> Self {
4158            Self::default()
4159        }
4160
4161        unsafe fn decode(
4162            &mut self,
4163            decoder: &mut fidl::encoding::Decoder<
4164                '_,
4165                fidl::encoding::DefaultFuchsiaResourceDialect,
4166            >,
4167            offset: usize,
4168            mut depth: fidl::encoding::Depth,
4169        ) -> fidl::Result<()> {
4170            decoder.debug_check_bounds::<Self>(offset);
4171            let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
4172                None => return Err(fidl::Error::NotNullable),
4173                Some(len) => len,
4174            };
4175            // Calling decoder.out_of_line_offset(0) is not allowed.
4176            if len == 0 {
4177                return Ok(());
4178            };
4179            depth.increment()?;
4180            let envelope_size = 8;
4181            let bytes_len = len * envelope_size;
4182            let offset = decoder.out_of_line_offset(bytes_len)?;
4183            // Decode the envelope for each type.
4184            let mut _next_ordinal_to_read = 0;
4185            let mut next_offset = offset;
4186            let end_offset = offset + bytes_len;
4187            _next_ordinal_to_read += 1;
4188            if next_offset >= end_offset {
4189                return Ok(());
4190            }
4191
4192            // Decode unknown envelopes for gaps in ordinals.
4193            while _next_ordinal_to_read < 1 {
4194                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4195                _next_ordinal_to_read += 1;
4196                next_offset += envelope_size;
4197            }
4198
4199            let next_out_of_line = decoder.next_out_of_line();
4200            let handles_before = decoder.remaining_handles();
4201            if let Some((inlined, num_bytes, num_handles)) =
4202                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4203            {
4204                let member_inline_size =
4205                    <Address as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4206                if inlined != (member_inline_size <= 4) {
4207                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4208                }
4209                let inner_offset;
4210                let mut inner_depth = depth.clone();
4211                if inlined {
4212                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4213                    inner_offset = next_offset;
4214                } else {
4215                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4216                    inner_depth.increment()?;
4217                }
4218                let val_ref = self.address.get_or_insert_with(|| {
4219                    fidl::new_empty!(Address, fidl::encoding::DefaultFuchsiaResourceDialect)
4220                });
4221                fidl::decode!(
4222                    Address,
4223                    fidl::encoding::DefaultFuchsiaResourceDialect,
4224                    val_ref,
4225                    decoder,
4226                    inner_offset,
4227                    inner_depth
4228                )?;
4229                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4230                {
4231                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4232                }
4233                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4234                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4235                }
4236            }
4237
4238            next_offset += envelope_size;
4239            _next_ordinal_to_read += 1;
4240            if next_offset >= end_offset {
4241                return Ok(());
4242            }
4243
4244            // Decode unknown envelopes for gaps in ordinals.
4245            while _next_ordinal_to_read < 2 {
4246                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4247                _next_ordinal_to_read += 1;
4248                next_offset += envelope_size;
4249            }
4250
4251            let next_out_of_line = decoder.next_out_of_line();
4252            let handles_before = decoder.remaining_handles();
4253            if let Some((inlined, num_bytes, num_handles)) =
4254                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4255            {
4256                let member_inline_size = <fidl::encoding::Vector<fidl_fuchsia_net::Ipv4Address, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4257                if inlined != (member_inline_size <= 4) {
4258                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4259                }
4260                let inner_offset;
4261                let mut inner_depth = depth.clone();
4262                if inlined {
4263                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4264                    inner_offset = next_offset;
4265                } else {
4266                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4267                    inner_depth.increment()?;
4268                }
4269                let val_ref =
4270                self.dns_servers.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_net::Ipv4Address, 64>, fidl::encoding::DefaultFuchsiaResourceDialect));
4271                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_net::Ipv4Address, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4272                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4273                {
4274                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4275                }
4276                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4277                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4278                }
4279            }
4280
4281            next_offset += envelope_size;
4282            _next_ordinal_to_read += 1;
4283            if next_offset >= end_offset {
4284                return Ok(());
4285            }
4286
4287            // Decode unknown envelopes for gaps in ordinals.
4288            while _next_ordinal_to_read < 3 {
4289                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4290                _next_ordinal_to_read += 1;
4291                next_offset += envelope_size;
4292            }
4293
4294            let next_out_of_line = decoder.next_out_of_line();
4295            let handles_before = decoder.remaining_handles();
4296            if let Some((inlined, num_bytes, num_handles)) =
4297                fidl::encoding::decode_envelope_header(decoder, next_offset)?
4298            {
4299                let member_inline_size = <fidl::encoding::Vector<fidl_fuchsia_net::Ipv4Address, 64> as fidl::encoding::TypeMarker>::inline_size(decoder.context);
4300                if inlined != (member_inline_size <= 4) {
4301                    return Err(fidl::Error::InvalidInlineBitInEnvelope);
4302                }
4303                let inner_offset;
4304                let mut inner_depth = depth.clone();
4305                if inlined {
4306                    decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
4307                    inner_offset = next_offset;
4308                } else {
4309                    inner_offset = decoder.out_of_line_offset(member_inline_size)?;
4310                    inner_depth.increment()?;
4311                }
4312                let val_ref =
4313                self.routers.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::Vector<fidl_fuchsia_net::Ipv4Address, 64>, fidl::encoding::DefaultFuchsiaResourceDialect));
4314                fidl::decode!(fidl::encoding::Vector<fidl_fuchsia_net::Ipv4Address, 64>, fidl::encoding::DefaultFuchsiaResourceDialect, val_ref, decoder, inner_offset, inner_depth)?;
4315                if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
4316                {
4317                    return Err(fidl::Error::InvalidNumBytesInEnvelope);
4318                }
4319                if handles_before != decoder.remaining_handles() + (num_handles as usize) {
4320                    return Err(fidl::Error::InvalidNumHandlesInEnvelope);
4321                }
4322            }
4323
4324            next_offset += envelope_size;
4325
4326            // Decode the remaining unknown envelopes.
4327            while next_offset < end_offset {
4328                _next_ordinal_to_read += 1;
4329                fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
4330                next_offset += envelope_size;
4331            }
4332
4333            Ok(())
4334        }
4335    }
4336}