Skip to main content

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