Skip to main content

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