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