fidl_fuchsia_net_test_realm/
fidl_fuchsia_net_test_realm.rs

1// WARNING: This file is machine generated by fidlgen.
2
3#![warn(clippy::all)]
4#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
5
6use bitflags::bitflags;
7use fidl::client::QueryResponseFut;
8use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
9use fidl::endpoints::{ControlHandle as _, Responder as _};
10pub use fidl_fuchsia_net_test_realm__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct ControllerMarker;
16
17impl fidl::endpoints::ProtocolMarker for ControllerMarker {
18    type Proxy = ControllerProxy;
19    type RequestStream = ControllerRequestStream;
20    #[cfg(target_os = "fuchsia")]
21    type SynchronousProxy = ControllerSynchronousProxy;
22
23    const DEBUG_NAME: &'static str = "fuchsia.net.test.realm.Controller";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for ControllerMarker {}
26pub type ControllerStartHermeticNetworkRealmResult = Result<(), Error>;
27pub type ControllerStopHermeticNetworkRealmResult = Result<(), Error>;
28pub type ControllerAddInterfaceResult = Result<(), Error>;
29pub type ControllerStartStubResult = Result<(), Error>;
30pub type ControllerStopStubResult = Result<(), Error>;
31pub type ControllerPingResult = Result<(), Error>;
32pub type ControllerPollUdpResult = Result<Vec<u8>, Error>;
33pub type ControllerJoinMulticastGroupResult = Result<(), Error>;
34pub type ControllerLeaveMulticastGroupResult = Result<(), Error>;
35pub type ControllerStartDhcpv6ClientResult = Result<(), Error>;
36pub type ControllerStopDhcpv6ClientResult = Result<(), Error>;
37pub type ControllerStartOutOfStackDhcpv4ClientResult = Result<(), Error>;
38pub type ControllerStopOutOfStackDhcpv4ClientResult = Result<(), Error>;
39
40pub trait ControllerProxyInterface: Send + Sync {
41    type StartHermeticNetworkRealmResponseFut: std::future::Future<Output = Result<ControllerStartHermeticNetworkRealmResult, fidl::Error>>
42        + Send;
43    fn r#start_hermetic_network_realm(
44        &self,
45        netstack: Netstack,
46    ) -> Self::StartHermeticNetworkRealmResponseFut;
47    type StopHermeticNetworkRealmResponseFut: std::future::Future<Output = Result<ControllerStopHermeticNetworkRealmResult, fidl::Error>>
48        + Send;
49    fn r#stop_hermetic_network_realm(&self) -> Self::StopHermeticNetworkRealmResponseFut;
50    type AddInterfaceResponseFut: std::future::Future<Output = Result<ControllerAddInterfaceResult, fidl::Error>>
51        + Send;
52    fn r#add_interface(
53        &self,
54        mac_address: &fidl_fuchsia_net::MacAddress,
55        name: &str,
56        wait_any_ip_address: bool,
57    ) -> Self::AddInterfaceResponseFut;
58    type StartStubResponseFut: std::future::Future<Output = Result<ControllerStartStubResult, fidl::Error>>
59        + Send;
60    fn r#start_stub(&self, component_url: &str) -> Self::StartStubResponseFut;
61    type StopStubResponseFut: std::future::Future<Output = Result<ControllerStopStubResult, fidl::Error>>
62        + Send;
63    fn r#stop_stub(&self) -> Self::StopStubResponseFut;
64    type PingResponseFut: std::future::Future<Output = Result<ControllerPingResult, fidl::Error>>
65        + Send;
66    fn r#ping(
67        &self,
68        target: &fidl_fuchsia_net::IpAddress,
69        payload_length: u16,
70        interface_name: Option<&str>,
71        timeout: i64,
72    ) -> Self::PingResponseFut;
73    type PollUdpResponseFut: std::future::Future<Output = Result<ControllerPollUdpResult, fidl::Error>>
74        + Send;
75    fn r#poll_udp(
76        &self,
77        target: &fidl_fuchsia_net::SocketAddress,
78        payload: &[u8],
79        timeout: i64,
80        num_retries: u16,
81    ) -> Self::PollUdpResponseFut;
82    type JoinMulticastGroupResponseFut: std::future::Future<Output = Result<ControllerJoinMulticastGroupResult, fidl::Error>>
83        + Send;
84    fn r#join_multicast_group(
85        &self,
86        address: &fidl_fuchsia_net::IpAddress,
87        interface_id: u64,
88    ) -> Self::JoinMulticastGroupResponseFut;
89    type LeaveMulticastGroupResponseFut: std::future::Future<Output = Result<ControllerLeaveMulticastGroupResult, fidl::Error>>
90        + Send;
91    fn r#leave_multicast_group(
92        &self,
93        address: &fidl_fuchsia_net::IpAddress,
94        interface_id: u64,
95    ) -> Self::LeaveMulticastGroupResponseFut;
96    type StartDhcpv6ClientResponseFut: std::future::Future<Output = Result<ControllerStartDhcpv6ClientResult, fidl::Error>>
97        + Send;
98    fn r#start_dhcpv6_client(
99        &self,
100        params: &fidl_fuchsia_net_dhcpv6::NewClientParams,
101    ) -> Self::StartDhcpv6ClientResponseFut;
102    type StopDhcpv6ClientResponseFut: std::future::Future<Output = Result<ControllerStopDhcpv6ClientResult, fidl::Error>>
103        + Send;
104    fn r#stop_dhcpv6_client(&self) -> Self::StopDhcpv6ClientResponseFut;
105    type StartOutOfStackDhcpv4ClientResponseFut: std::future::Future<
106            Output = Result<ControllerStartOutOfStackDhcpv4ClientResult, fidl::Error>,
107        > + Send;
108    fn r#start_out_of_stack_dhcpv4_client(
109        &self,
110        payload: &ControllerStartOutOfStackDhcpv4ClientRequest,
111    ) -> Self::StartOutOfStackDhcpv4ClientResponseFut;
112    type StopOutOfStackDhcpv4ClientResponseFut: std::future::Future<
113            Output = Result<ControllerStopOutOfStackDhcpv4ClientResult, fidl::Error>,
114        > + Send;
115    fn r#stop_out_of_stack_dhcpv4_client(
116        &self,
117        payload: &ControllerStopOutOfStackDhcpv4ClientRequest,
118    ) -> Self::StopOutOfStackDhcpv4ClientResponseFut;
119}
120#[derive(Debug)]
121#[cfg(target_os = "fuchsia")]
122pub struct ControllerSynchronousProxy {
123    client: fidl::client::sync::Client,
124}
125
126#[cfg(target_os = "fuchsia")]
127impl fidl::endpoints::SynchronousProxy for ControllerSynchronousProxy {
128    type Proxy = ControllerProxy;
129    type Protocol = ControllerMarker;
130
131    fn from_channel(inner: fidl::Channel) -> Self {
132        Self::new(inner)
133    }
134
135    fn into_channel(self) -> fidl::Channel {
136        self.client.into_channel()
137    }
138
139    fn as_channel(&self) -> &fidl::Channel {
140        self.client.as_channel()
141    }
142}
143
144#[cfg(target_os = "fuchsia")]
145impl ControllerSynchronousProxy {
146    pub fn new(channel: fidl::Channel) -> Self {
147        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
148        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
149    }
150
151    pub fn into_channel(self) -> fidl::Channel {
152        self.client.into_channel()
153    }
154
155    /// Waits until an event arrives and returns it. It is safe for other
156    /// threads to make concurrent requests while waiting for an event.
157    pub fn wait_for_event(
158        &self,
159        deadline: zx::MonotonicInstant,
160    ) -> Result<ControllerEvent, fidl::Error> {
161        ControllerEvent::decode(self.client.wait_for_event(deadline)?)
162    }
163
164    /// Starts a hermetic network realm corresponding to `netstack`.
165    ///
166    /// Any previously running hermetic network realm will be terminated before
167    /// the new realm is started. The configured realm will contain a subset of
168    /// the components in the standard network realm. In particular, it will
169    /// contain:
170    ///
171    ///  * A Netstack instance that corresponds to the provided `netstack`
172    ///  * A DHCP server
173    ///  * A DHCPv6 client
174    ///  * A DNS resolver
175    ///
176    /// + request `netstack` the type of Netstack that will be run.
177    /// * error `INTERNAL` for internal errors, including failure to start the
178    ///     specified `netstack`.
179    pub fn r#start_hermetic_network_realm(
180        &self,
181        mut netstack: Netstack,
182        ___deadline: zx::MonotonicInstant,
183    ) -> Result<ControllerStartHermeticNetworkRealmResult, fidl::Error> {
184        let _response = self.client.send_query::<
185            ControllerStartHermeticNetworkRealmRequest,
186            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
187        >(
188            (netstack,),
189            0x58c1fa7335d4c5c2,
190            fidl::encoding::DynamicFlags::empty(),
191            ___deadline,
192        )?;
193        Ok(_response.map(|x| x))
194    }
195
196    /// Stops any running hermetic network realm.
197    ///
198    /// All components in the hermetic network realm will be stopped. Similarly,
199    /// any interfaces that were previously disabled on the system's Netstack
200    /// will be re-enabled on a best-effort basis. That is, a failure to
201    /// re-enable an interface will not result in this method returning an
202    /// error.
203    ///
204    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if a hermetic network realm
205    ///     is not running.
206    /// * error `INTERNAL` for internal errors, including failure to destroy the
207    ///     realm.
208    pub fn r#stop_hermetic_network_realm(
209        &self,
210        ___deadline: zx::MonotonicInstant,
211    ) -> Result<ControllerStopHermeticNetworkRealmResult, fidl::Error> {
212        let _response = self.client.send_query::<
213            fidl::encoding::EmptyPayload,
214            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
215        >(
216            (),
217            0x49d3c2501cd2f635,
218            fidl::encoding::DynamicFlags::empty(),
219            ___deadline,
220        )?;
221        Ok(_response.map(|x| x))
222    }
223
224    /// Attaches an interface to the hermetic Netstack.
225    ///
226    /// The interface that corresponds to `mac_address` will disabled on the
227    /// system's Netstack, but enabled on the hermetic Netstack.
228    ///
229    /// + request `mac_address` address of the interface to be added to the
230    ///     hermetic Netstack.
231    /// + request `name` the name to assign to the new interface.
232    /// + request `wait_any_ip_address` whether to wait for any IP address to be
233    ///     assigned to the interface before returning. This is helpful for
234    ///     tests that want to ensure the autoconfigured IP address is assigned
235    ///     and has completed duplicate address detection before proceeding.
236    /// * error `ALREADY_EXISTS` if an interface with `name` already exists on
237    ///     the hermetic Netstack.
238    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
239    ///     hermetic network realm.
240    /// * error `INTERFACE_NOT_FOUND` if an interface with `mac_address` could
241    ///     not be found on the system.
242    /// * error `INTERNAL` for internal errors, including failure to read the
243    ///     system's interfaces or configure an interface.
244    pub fn r#add_interface(
245        &self,
246        mut mac_address: &fidl_fuchsia_net::MacAddress,
247        mut name: &str,
248        mut wait_any_ip_address: bool,
249        ___deadline: zx::MonotonicInstant,
250    ) -> Result<ControllerAddInterfaceResult, fidl::Error> {
251        let _response = self.client.send_query::<
252            ControllerAddInterfaceRequest,
253            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
254        >(
255            (mac_address, name, wait_any_ip_address,),
256            0x668ded2d2b619c15,
257            fidl::encoding::DynamicFlags::empty(),
258            ___deadline,
259        )?;
260        Ok(_response.map(|x| x))
261    }
262
263    /// Starts a test stub.
264    ///
265    /// Any previously running stub will be terminated before the provided
266    /// stub corresponding to `component_url` is started.
267    ///
268    /// + request `component_url` the URL of the component to run.
269    /// * error `COMPONENT_NOT_FOUND` if a component correspodning to
270    ///     `component_url` could not be resolved.
271    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
272    ///     hermetic network realm.
273    /// * error `INTERNAL` for internal errors, including failure to add the
274    ///     desired stub within the hermetic network realm.
275    /// * error `INVALID_ARGUMENTS` if the `component_url` is malformed.
276    pub fn r#start_stub(
277        &self,
278        mut component_url: &str,
279        ___deadline: zx::MonotonicInstant,
280    ) -> Result<ControllerStartStubResult, fidl::Error> {
281        let _response = self.client.send_query::<
282            ControllerStartStubRequest,
283            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
284        >(
285            (component_url,),
286            0x6523a401f22bf664,
287            fidl::encoding::DynamicFlags::empty(),
288            ___deadline,
289        )?;
290        Ok(_response.map(|x| x))
291    }
292
293    /// Stops the currently running stub.
294    ///
295    /// Other existing hermetic network realm components will continue to be run
296    /// after this is invoked.
297    ///
298    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
299    ///     hermetic network realm.
300    /// * error `STUB_NOT_RUNNING` if there is no running stub.
301    /// * error `INTERNAL` for internal errors, including failure to destroy the
302    ///     stub component.
303    pub fn r#stop_stub(
304        &self,
305        ___deadline: zx::MonotonicInstant,
306    ) -> Result<ControllerStopStubResult, fidl::Error> {
307        let _response = self.client.send_query::<
308            fidl::encoding::EmptyPayload,
309            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
310        >(
311            (),
312            0x582c32b564ff4bb4,
313            fidl::encoding::DynamicFlags::empty(),
314            ___deadline,
315        )?;
316        Ok(_response.map(|x| x))
317    }
318
319    /// Sends an ICMP echo request to the `target` using a socket provided by
320    /// the hermetic Netstack.
321    ///
322    /// + request `target` the address to ping.
323    /// + request `payload_length` the body size of the ICMP packet.
324    ///     Specifically, the packet body will be filled with zeros of
325    ///     `payload_length`.
326    /// + request `interface_name` an optional interface to bind the socket to.
327    /// + request `timeout` a timeout in nanoseconds to wait for a reply. If
328    ///     less than or equal to 0, then returns success immediately after the
329    ///     ping is sent.
330    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
331    ///     hermetic network realm.
332    /// * error `INTERFACE_NOT_FOUND` if `interface_name` does not exist in the
333    ///     hermetic Netstack.
334    /// * error `INTERNAL` for internal errors, including failure to create a
335    ///     socket or generate the ping request and response.
336    /// * error `INVALID_ARGUMENTS` if `target` corresponds to a link-local
337    ///     address and an `interface_name` is not specified or the
338    ///     `payload_length` exceeds the maximum allowable size.
339    /// * error `PING_FAILED` if there was an error sending or receiving the
340    ///     ping.
341    /// * error `TIMEOUT_EXCEEDED` if the ping reply is not received before the
342    ///     specifed `timeout`.
343    pub fn r#ping(
344        &self,
345        mut target: &fidl_fuchsia_net::IpAddress,
346        mut payload_length: u16,
347        mut interface_name: Option<&str>,
348        mut timeout: i64,
349        ___deadline: zx::MonotonicInstant,
350    ) -> Result<ControllerPingResult, fidl::Error> {
351        let _response = self.client.send_query::<
352            ControllerPingRequest,
353            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
354        >(
355            (target, payload_length, interface_name, timeout,),
356            0x60c9b6cf952fa4d1,
357            fidl::encoding::DynamicFlags::empty(),
358            ___deadline,
359        )?;
360        Ok(_response.map(|x| x))
361    }
362
363    /// Polls the specified socket address with UDP datagrams containing the specified payload
364    /// using a socket provided by the hermetic Netstack.
365    ///
366    /// Waits for a single reply from the target address and returns it.
367    ///
368    /// + request `target` the socket address to poll.
369    /// + request `payload` the content to place in the UDP datagram.
370    /// + request `timeout` a timeout in nanoseconds to wait for a reply, per retry.
371    /// + request `num_retries` the number of poll attempts to make before giving up and returning
372    ///     an error.
373    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
374    ///     hermetic network realm.
375    /// * error `ADDRESS_UNREACHABLE` if all poll attempts expire without successfully receiving
376    ///     a reply from the target address, and no route was found to the target address.
377    /// * error `TIMEOUT_EXCEEDED` if the target address was routable, but all of the retry
378    ///     attempts expire without successfully receiving a reply from the target address.
379    /// * error `INTERNAL` for internal errors, including failure to create a socket or other
380    ///     failures to send/receive datagrams from the target address.
381    pub fn r#poll_udp(
382        &self,
383        mut target: &fidl_fuchsia_net::SocketAddress,
384        mut payload: &[u8],
385        mut timeout: i64,
386        mut num_retries: u16,
387        ___deadline: zx::MonotonicInstant,
388    ) -> Result<ControllerPollUdpResult, fidl::Error> {
389        let _response = self.client.send_query::<
390            ControllerPollUdpRequest,
391            fidl::encoding::ResultType<ControllerPollUdpResponse, Error>,
392        >(
393            (target, payload, timeout, num_retries,),
394            0x333fb354db30f664,
395            fidl::encoding::DynamicFlags::empty(),
396            ___deadline,
397        )?;
398        Ok(_response.map(|x| x.payload))
399    }
400
401    /// Joins a multicast group.
402    ///
403    /// Membership will be maintained until `LeaveMulticastGroup` or
404    /// `StopHermeticNetworkRealm` is invoked.
405    ///
406    /// + request `address` the group address to join.
407    /// + request `interface_id` the interface that should be used to join the
408    ///     group. A value of 0 indicates that any interface may be used.
409    /// * error `ADDRESS_IN_USE` if the provided `address` was previously
410    ///     joined.
411    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
412    ///     hermetic network realm.
413    /// * error `INTERNAL` for internal errors.
414    /// * error `INVALID_ARGUMENTS` if the specified `interface_id` does not
415    ///     exist or the `address` does not correspond to a valid multicast
416    ///     address.
417    pub fn r#join_multicast_group(
418        &self,
419        mut address: &fidl_fuchsia_net::IpAddress,
420        mut interface_id: u64,
421        ___deadline: zx::MonotonicInstant,
422    ) -> Result<ControllerJoinMulticastGroupResult, fidl::Error> {
423        let _response = self.client.send_query::<
424            ControllerJoinMulticastGroupRequest,
425            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
426        >(
427            (address, interface_id,),
428            0xbdbb4095640a3f4,
429            fidl::encoding::DynamicFlags::empty(),
430            ___deadline,
431        )?;
432        Ok(_response.map(|x| x))
433    }
434
435    /// Leaves a multicast group that was previously joined using the
436    /// `JoinMulticastGroup` method.
437    ///
438    /// + request `address` the group address to leave.
439    /// + request `interface_id` the interface that was previously used to join
440    ///     the multicast group.
441    /// * error `ADDRESS_NOT_AVAILABLE` if the provided `address` was not
442    ///     previously joined.
443    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
444    ///     hermetic network realm.
445    /// * error `INTERNAL` for internal errors, including failure to connect
446    ///     to hermetic network realm services.
447    /// * error `INVALID_ARGUMENTS` if the specified `interface_id` does not
448    ///     exist or the `address` does not correspond to a valid multicast
449    ///     address.
450    pub fn r#leave_multicast_group(
451        &self,
452        mut address: &fidl_fuchsia_net::IpAddress,
453        mut interface_id: u64,
454        ___deadline: zx::MonotonicInstant,
455    ) -> Result<ControllerLeaveMulticastGroupResult, fidl::Error> {
456        let _response = self.client.send_query::<
457            ControllerLeaveMulticastGroupRequest,
458            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
459        >(
460            (address, interface_id,),
461            0x32ecf4e40124a29a,
462            fidl::encoding::DynamicFlags::empty(),
463            ___deadline,
464        )?;
465        Ok(_response.map(|x| x))
466    }
467
468    /// Starts a DHCPv6 client with the provided parameters.
469    ///
470    /// + request `params` parameters to start this DHCPv6 client with.
471    ///     Required.
472    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
473    ///     hermetic network realm.
474    /// * error `INTERNAL` for internal errors, including failure to connect
475    ///     to hermetic network realm services.
476    /// * error `INVALID_ARGUMENTS` if any required parameters are omitted.
477    /// * error `ALREADY_EXISTS` if there is a client running on the interface
478    ///     identified by `params.interface_id` already.
479    pub fn r#start_dhcpv6_client(
480        &self,
481        mut params: &fidl_fuchsia_net_dhcpv6::NewClientParams,
482        ___deadline: zx::MonotonicInstant,
483    ) -> Result<ControllerStartDhcpv6ClientResult, fidl::Error> {
484        let _response = self.client.send_query::<
485            ControllerStartDhcpv6ClientRequest,
486            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
487        >(
488            (params,),
489            0x756c9b70864b7744,
490            fidl::encoding::DynamicFlags::empty(),
491            ___deadline,
492        )?;
493        Ok(_response.map(|x| x))
494    }
495
496    /// Stops all DHCPv6 clients.
497    ///
498    /// * error `DHCPV6_CLIENT_NOT_RUNNING` if no DHCPv6 client is running.
499    pub fn r#stop_dhcpv6_client(
500        &self,
501        ___deadline: zx::MonotonicInstant,
502    ) -> Result<ControllerStopDhcpv6ClientResult, fidl::Error> {
503        let _response = self.client.send_query::<
504            fidl::encoding::EmptyPayload,
505            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
506        >(
507            (),
508            0x16e93478e663d523,
509            fidl::encoding::DynamicFlags::empty(),
510            ___deadline,
511        )?;
512        Ok(_response.map(|x| x))
513    }
514
515    /// Starts a DHCPv4 client on the provided interface.
516    ///
517    /// + request `interface_id` the interface to start a DHCPv4 client on.
518    ///     Required.
519    pub fn r#start_out_of_stack_dhcpv4_client(
520        &self,
521        mut payload: &ControllerStartOutOfStackDhcpv4ClientRequest,
522        ___deadline: zx::MonotonicInstant,
523    ) -> Result<ControllerStartOutOfStackDhcpv4ClientResult, fidl::Error> {
524        let _response = self.client.send_query::<
525            ControllerStartOutOfStackDhcpv4ClientRequest,
526            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
527        >(
528            payload,
529            0x37eeec41c0077625,
530            fidl::encoding::DynamicFlags::empty(),
531            ___deadline,
532        )?;
533        Ok(_response.map(|x| x))
534    }
535
536    /// Stops the DHCPv4 client on the provided interface.
537    ///
538    /// + request `interface_id` the interface to stop a DHCPv4 client client on.
539    ///     Required.
540    /// * error `DHCPV4_CLIENT_NOT_RUNNING` if no DHCPv4 client is running.
541    /// * error `DHCPV4_CLIENT_SHUTDOWN_FAILED` if shutting down the DHCPv4 client
542    ///   failed.
543    pub fn r#stop_out_of_stack_dhcpv4_client(
544        &self,
545        mut payload: &ControllerStopOutOfStackDhcpv4ClientRequest,
546        ___deadline: zx::MonotonicInstant,
547    ) -> Result<ControllerStopOutOfStackDhcpv4ClientResult, fidl::Error> {
548        let _response = self.client.send_query::<
549            ControllerStopOutOfStackDhcpv4ClientRequest,
550            fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
551        >(
552            payload,
553            0x5d47aa5213164364,
554            fidl::encoding::DynamicFlags::empty(),
555            ___deadline,
556        )?;
557        Ok(_response.map(|x| x))
558    }
559}
560
561#[cfg(target_os = "fuchsia")]
562impl From<ControllerSynchronousProxy> for zx::Handle {
563    fn from(value: ControllerSynchronousProxy) -> Self {
564        value.into_channel().into()
565    }
566}
567
568#[cfg(target_os = "fuchsia")]
569impl From<fidl::Channel> for ControllerSynchronousProxy {
570    fn from(value: fidl::Channel) -> Self {
571        Self::new(value)
572    }
573}
574
575#[cfg(target_os = "fuchsia")]
576impl fidl::endpoints::FromClient for ControllerSynchronousProxy {
577    type Protocol = ControllerMarker;
578
579    fn from_client(value: fidl::endpoints::ClientEnd<ControllerMarker>) -> Self {
580        Self::new(value.into_channel())
581    }
582}
583
584#[derive(Debug, Clone)]
585pub struct ControllerProxy {
586    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
587}
588
589impl fidl::endpoints::Proxy for ControllerProxy {
590    type Protocol = ControllerMarker;
591
592    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
593        Self::new(inner)
594    }
595
596    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
597        self.client.into_channel().map_err(|client| Self { client })
598    }
599
600    fn as_channel(&self) -> &::fidl::AsyncChannel {
601        self.client.as_channel()
602    }
603}
604
605impl ControllerProxy {
606    /// Create a new Proxy for fuchsia.net.test.realm/Controller.
607    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
608        let protocol_name = <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
609        Self { client: fidl::client::Client::new(channel, protocol_name) }
610    }
611
612    /// Get a Stream of events from the remote end of the protocol.
613    ///
614    /// # Panics
615    ///
616    /// Panics if the event stream was already taken.
617    pub fn take_event_stream(&self) -> ControllerEventStream {
618        ControllerEventStream { event_receiver: self.client.take_event_receiver() }
619    }
620
621    /// Starts a hermetic network realm corresponding to `netstack`.
622    ///
623    /// Any previously running hermetic network realm will be terminated before
624    /// the new realm is started. The configured realm will contain a subset of
625    /// the components in the standard network realm. In particular, it will
626    /// contain:
627    ///
628    ///  * A Netstack instance that corresponds to the provided `netstack`
629    ///  * A DHCP server
630    ///  * A DHCPv6 client
631    ///  * A DNS resolver
632    ///
633    /// + request `netstack` the type of Netstack that will be run.
634    /// * error `INTERNAL` for internal errors, including failure to start the
635    ///     specified `netstack`.
636    pub fn r#start_hermetic_network_realm(
637        &self,
638        mut netstack: Netstack,
639    ) -> fidl::client::QueryResponseFut<
640        ControllerStartHermeticNetworkRealmResult,
641        fidl::encoding::DefaultFuchsiaResourceDialect,
642    > {
643        ControllerProxyInterface::r#start_hermetic_network_realm(self, netstack)
644    }
645
646    /// Stops any running hermetic network realm.
647    ///
648    /// All components in the hermetic network realm will be stopped. Similarly,
649    /// any interfaces that were previously disabled on the system's Netstack
650    /// will be re-enabled on a best-effort basis. That is, a failure to
651    /// re-enable an interface will not result in this method returning an
652    /// error.
653    ///
654    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if a hermetic network realm
655    ///     is not running.
656    /// * error `INTERNAL` for internal errors, including failure to destroy the
657    ///     realm.
658    pub fn r#stop_hermetic_network_realm(
659        &self,
660    ) -> fidl::client::QueryResponseFut<
661        ControllerStopHermeticNetworkRealmResult,
662        fidl::encoding::DefaultFuchsiaResourceDialect,
663    > {
664        ControllerProxyInterface::r#stop_hermetic_network_realm(self)
665    }
666
667    /// Attaches an interface to the hermetic Netstack.
668    ///
669    /// The interface that corresponds to `mac_address` will disabled on the
670    /// system's Netstack, but enabled on the hermetic Netstack.
671    ///
672    /// + request `mac_address` address of the interface to be added to the
673    ///     hermetic Netstack.
674    /// + request `name` the name to assign to the new interface.
675    /// + request `wait_any_ip_address` whether to wait for any IP address to be
676    ///     assigned to the interface before returning. This is helpful for
677    ///     tests that want to ensure the autoconfigured IP address is assigned
678    ///     and has completed duplicate address detection before proceeding.
679    /// * error `ALREADY_EXISTS` if an interface with `name` already exists on
680    ///     the hermetic Netstack.
681    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
682    ///     hermetic network realm.
683    /// * error `INTERFACE_NOT_FOUND` if an interface with `mac_address` could
684    ///     not be found on the system.
685    /// * error `INTERNAL` for internal errors, including failure to read the
686    ///     system's interfaces or configure an interface.
687    pub fn r#add_interface(
688        &self,
689        mut mac_address: &fidl_fuchsia_net::MacAddress,
690        mut name: &str,
691        mut wait_any_ip_address: bool,
692    ) -> fidl::client::QueryResponseFut<
693        ControllerAddInterfaceResult,
694        fidl::encoding::DefaultFuchsiaResourceDialect,
695    > {
696        ControllerProxyInterface::r#add_interface(self, mac_address, name, wait_any_ip_address)
697    }
698
699    /// Starts a test stub.
700    ///
701    /// Any previously running stub will be terminated before the provided
702    /// stub corresponding to `component_url` is started.
703    ///
704    /// + request `component_url` the URL of the component to run.
705    /// * error `COMPONENT_NOT_FOUND` if a component correspodning to
706    ///     `component_url` could not be resolved.
707    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
708    ///     hermetic network realm.
709    /// * error `INTERNAL` for internal errors, including failure to add the
710    ///     desired stub within the hermetic network realm.
711    /// * error `INVALID_ARGUMENTS` if the `component_url` is malformed.
712    pub fn r#start_stub(
713        &self,
714        mut component_url: &str,
715    ) -> fidl::client::QueryResponseFut<
716        ControllerStartStubResult,
717        fidl::encoding::DefaultFuchsiaResourceDialect,
718    > {
719        ControllerProxyInterface::r#start_stub(self, component_url)
720    }
721
722    /// Stops the currently running stub.
723    ///
724    /// Other existing hermetic network realm components will continue to be run
725    /// after this is invoked.
726    ///
727    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
728    ///     hermetic network realm.
729    /// * error `STUB_NOT_RUNNING` if there is no running stub.
730    /// * error `INTERNAL` for internal errors, including failure to destroy the
731    ///     stub component.
732    pub fn r#stop_stub(
733        &self,
734    ) -> fidl::client::QueryResponseFut<
735        ControllerStopStubResult,
736        fidl::encoding::DefaultFuchsiaResourceDialect,
737    > {
738        ControllerProxyInterface::r#stop_stub(self)
739    }
740
741    /// Sends an ICMP echo request to the `target` using a socket provided by
742    /// the hermetic Netstack.
743    ///
744    /// + request `target` the address to ping.
745    /// + request `payload_length` the body size of the ICMP packet.
746    ///     Specifically, the packet body will be filled with zeros of
747    ///     `payload_length`.
748    /// + request `interface_name` an optional interface to bind the socket to.
749    /// + request `timeout` a timeout in nanoseconds to wait for a reply. If
750    ///     less than or equal to 0, then returns success immediately after the
751    ///     ping is sent.
752    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
753    ///     hermetic network realm.
754    /// * error `INTERFACE_NOT_FOUND` if `interface_name` does not exist in the
755    ///     hermetic Netstack.
756    /// * error `INTERNAL` for internal errors, including failure to create a
757    ///     socket or generate the ping request and response.
758    /// * error `INVALID_ARGUMENTS` if `target` corresponds to a link-local
759    ///     address and an `interface_name` is not specified or the
760    ///     `payload_length` exceeds the maximum allowable size.
761    /// * error `PING_FAILED` if there was an error sending or receiving the
762    ///     ping.
763    /// * error `TIMEOUT_EXCEEDED` if the ping reply is not received before the
764    ///     specifed `timeout`.
765    pub fn r#ping(
766        &self,
767        mut target: &fidl_fuchsia_net::IpAddress,
768        mut payload_length: u16,
769        mut interface_name: Option<&str>,
770        mut timeout: i64,
771    ) -> fidl::client::QueryResponseFut<
772        ControllerPingResult,
773        fidl::encoding::DefaultFuchsiaResourceDialect,
774    > {
775        ControllerProxyInterface::r#ping(self, target, payload_length, interface_name, timeout)
776    }
777
778    /// Polls the specified socket address with UDP datagrams containing the specified payload
779    /// using a socket provided by the hermetic Netstack.
780    ///
781    /// Waits for a single reply from the target address and returns it.
782    ///
783    /// + request `target` the socket address to poll.
784    /// + request `payload` the content to place in the UDP datagram.
785    /// + request `timeout` a timeout in nanoseconds to wait for a reply, per retry.
786    /// + request `num_retries` the number of poll attempts to make before giving up and returning
787    ///     an error.
788    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
789    ///     hermetic network realm.
790    /// * error `ADDRESS_UNREACHABLE` if all poll attempts expire without successfully receiving
791    ///     a reply from the target address, and no route was found to the target address.
792    /// * error `TIMEOUT_EXCEEDED` if the target address was routable, but all of the retry
793    ///     attempts expire without successfully receiving a reply from the target address.
794    /// * error `INTERNAL` for internal errors, including failure to create a socket or other
795    ///     failures to send/receive datagrams from the target address.
796    pub fn r#poll_udp(
797        &self,
798        mut target: &fidl_fuchsia_net::SocketAddress,
799        mut payload: &[u8],
800        mut timeout: i64,
801        mut num_retries: u16,
802    ) -> fidl::client::QueryResponseFut<
803        ControllerPollUdpResult,
804        fidl::encoding::DefaultFuchsiaResourceDialect,
805    > {
806        ControllerProxyInterface::r#poll_udp(self, target, payload, timeout, num_retries)
807    }
808
809    /// Joins a multicast group.
810    ///
811    /// Membership will be maintained until `LeaveMulticastGroup` or
812    /// `StopHermeticNetworkRealm` is invoked.
813    ///
814    /// + request `address` the group address to join.
815    /// + request `interface_id` the interface that should be used to join the
816    ///     group. A value of 0 indicates that any interface may be used.
817    /// * error `ADDRESS_IN_USE` if the provided `address` was previously
818    ///     joined.
819    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
820    ///     hermetic network realm.
821    /// * error `INTERNAL` for internal errors.
822    /// * error `INVALID_ARGUMENTS` if the specified `interface_id` does not
823    ///     exist or the `address` does not correspond to a valid multicast
824    ///     address.
825    pub fn r#join_multicast_group(
826        &self,
827        mut address: &fidl_fuchsia_net::IpAddress,
828        mut interface_id: u64,
829    ) -> fidl::client::QueryResponseFut<
830        ControllerJoinMulticastGroupResult,
831        fidl::encoding::DefaultFuchsiaResourceDialect,
832    > {
833        ControllerProxyInterface::r#join_multicast_group(self, address, interface_id)
834    }
835
836    /// Leaves a multicast group that was previously joined using the
837    /// `JoinMulticastGroup` method.
838    ///
839    /// + request `address` the group address to leave.
840    /// + request `interface_id` the interface that was previously used to join
841    ///     the multicast group.
842    /// * error `ADDRESS_NOT_AVAILABLE` if the provided `address` was not
843    ///     previously joined.
844    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
845    ///     hermetic network realm.
846    /// * error `INTERNAL` for internal errors, including failure to connect
847    ///     to hermetic network realm services.
848    /// * error `INVALID_ARGUMENTS` if the specified `interface_id` does not
849    ///     exist or the `address` does not correspond to a valid multicast
850    ///     address.
851    pub fn r#leave_multicast_group(
852        &self,
853        mut address: &fidl_fuchsia_net::IpAddress,
854        mut interface_id: u64,
855    ) -> fidl::client::QueryResponseFut<
856        ControllerLeaveMulticastGroupResult,
857        fidl::encoding::DefaultFuchsiaResourceDialect,
858    > {
859        ControllerProxyInterface::r#leave_multicast_group(self, address, interface_id)
860    }
861
862    /// Starts a DHCPv6 client with the provided parameters.
863    ///
864    /// + request `params` parameters to start this DHCPv6 client with.
865    ///     Required.
866    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
867    ///     hermetic network realm.
868    /// * error `INTERNAL` for internal errors, including failure to connect
869    ///     to hermetic network realm services.
870    /// * error `INVALID_ARGUMENTS` if any required parameters are omitted.
871    /// * error `ALREADY_EXISTS` if there is a client running on the interface
872    ///     identified by `params.interface_id` already.
873    pub fn r#start_dhcpv6_client(
874        &self,
875        mut params: &fidl_fuchsia_net_dhcpv6::NewClientParams,
876    ) -> fidl::client::QueryResponseFut<
877        ControllerStartDhcpv6ClientResult,
878        fidl::encoding::DefaultFuchsiaResourceDialect,
879    > {
880        ControllerProxyInterface::r#start_dhcpv6_client(self, params)
881    }
882
883    /// Stops all DHCPv6 clients.
884    ///
885    /// * error `DHCPV6_CLIENT_NOT_RUNNING` if no DHCPv6 client is running.
886    pub fn r#stop_dhcpv6_client(
887        &self,
888    ) -> fidl::client::QueryResponseFut<
889        ControllerStopDhcpv6ClientResult,
890        fidl::encoding::DefaultFuchsiaResourceDialect,
891    > {
892        ControllerProxyInterface::r#stop_dhcpv6_client(self)
893    }
894
895    /// Starts a DHCPv4 client on the provided interface.
896    ///
897    /// + request `interface_id` the interface to start a DHCPv4 client on.
898    ///     Required.
899    pub fn r#start_out_of_stack_dhcpv4_client(
900        &self,
901        mut payload: &ControllerStartOutOfStackDhcpv4ClientRequest,
902    ) -> fidl::client::QueryResponseFut<
903        ControllerStartOutOfStackDhcpv4ClientResult,
904        fidl::encoding::DefaultFuchsiaResourceDialect,
905    > {
906        ControllerProxyInterface::r#start_out_of_stack_dhcpv4_client(self, payload)
907    }
908
909    /// Stops the DHCPv4 client on the provided interface.
910    ///
911    /// + request `interface_id` the interface to stop a DHCPv4 client client on.
912    ///     Required.
913    /// * error `DHCPV4_CLIENT_NOT_RUNNING` if no DHCPv4 client is running.
914    /// * error `DHCPV4_CLIENT_SHUTDOWN_FAILED` if shutting down the DHCPv4 client
915    ///   failed.
916    pub fn r#stop_out_of_stack_dhcpv4_client(
917        &self,
918        mut payload: &ControllerStopOutOfStackDhcpv4ClientRequest,
919    ) -> fidl::client::QueryResponseFut<
920        ControllerStopOutOfStackDhcpv4ClientResult,
921        fidl::encoding::DefaultFuchsiaResourceDialect,
922    > {
923        ControllerProxyInterface::r#stop_out_of_stack_dhcpv4_client(self, payload)
924    }
925}
926
927impl ControllerProxyInterface for ControllerProxy {
928    type StartHermeticNetworkRealmResponseFut = fidl::client::QueryResponseFut<
929        ControllerStartHermeticNetworkRealmResult,
930        fidl::encoding::DefaultFuchsiaResourceDialect,
931    >;
932    fn r#start_hermetic_network_realm(
933        &self,
934        mut netstack: Netstack,
935    ) -> Self::StartHermeticNetworkRealmResponseFut {
936        fn _decode(
937            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
938        ) -> Result<ControllerStartHermeticNetworkRealmResult, fidl::Error> {
939            let _response = fidl::client::decode_transaction_body::<
940                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
941                fidl::encoding::DefaultFuchsiaResourceDialect,
942                0x58c1fa7335d4c5c2,
943            >(_buf?)?;
944            Ok(_response.map(|x| x))
945        }
946        self.client.send_query_and_decode::<
947            ControllerStartHermeticNetworkRealmRequest,
948            ControllerStartHermeticNetworkRealmResult,
949        >(
950            (netstack,),
951            0x58c1fa7335d4c5c2,
952            fidl::encoding::DynamicFlags::empty(),
953            _decode,
954        )
955    }
956
957    type StopHermeticNetworkRealmResponseFut = fidl::client::QueryResponseFut<
958        ControllerStopHermeticNetworkRealmResult,
959        fidl::encoding::DefaultFuchsiaResourceDialect,
960    >;
961    fn r#stop_hermetic_network_realm(&self) -> Self::StopHermeticNetworkRealmResponseFut {
962        fn _decode(
963            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
964        ) -> Result<ControllerStopHermeticNetworkRealmResult, fidl::Error> {
965            let _response = fidl::client::decode_transaction_body::<
966                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
967                fidl::encoding::DefaultFuchsiaResourceDialect,
968                0x49d3c2501cd2f635,
969            >(_buf?)?;
970            Ok(_response.map(|x| x))
971        }
972        self.client.send_query_and_decode::<
973            fidl::encoding::EmptyPayload,
974            ControllerStopHermeticNetworkRealmResult,
975        >(
976            (),
977            0x49d3c2501cd2f635,
978            fidl::encoding::DynamicFlags::empty(),
979            _decode,
980        )
981    }
982
983    type AddInterfaceResponseFut = fidl::client::QueryResponseFut<
984        ControllerAddInterfaceResult,
985        fidl::encoding::DefaultFuchsiaResourceDialect,
986    >;
987    fn r#add_interface(
988        &self,
989        mut mac_address: &fidl_fuchsia_net::MacAddress,
990        mut name: &str,
991        mut wait_any_ip_address: bool,
992    ) -> Self::AddInterfaceResponseFut {
993        fn _decode(
994            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
995        ) -> Result<ControllerAddInterfaceResult, fidl::Error> {
996            let _response = fidl::client::decode_transaction_body::<
997                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
998                fidl::encoding::DefaultFuchsiaResourceDialect,
999                0x668ded2d2b619c15,
1000            >(_buf?)?;
1001            Ok(_response.map(|x| x))
1002        }
1003        self.client
1004            .send_query_and_decode::<ControllerAddInterfaceRequest, ControllerAddInterfaceResult>(
1005                (mac_address, name, wait_any_ip_address),
1006                0x668ded2d2b619c15,
1007                fidl::encoding::DynamicFlags::empty(),
1008                _decode,
1009            )
1010    }
1011
1012    type StartStubResponseFut = fidl::client::QueryResponseFut<
1013        ControllerStartStubResult,
1014        fidl::encoding::DefaultFuchsiaResourceDialect,
1015    >;
1016    fn r#start_stub(&self, mut component_url: &str) -> Self::StartStubResponseFut {
1017        fn _decode(
1018            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1019        ) -> Result<ControllerStartStubResult, fidl::Error> {
1020            let _response = fidl::client::decode_transaction_body::<
1021                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1022                fidl::encoding::DefaultFuchsiaResourceDialect,
1023                0x6523a401f22bf664,
1024            >(_buf?)?;
1025            Ok(_response.map(|x| x))
1026        }
1027        self.client.send_query_and_decode::<ControllerStartStubRequest, ControllerStartStubResult>(
1028            (component_url,),
1029            0x6523a401f22bf664,
1030            fidl::encoding::DynamicFlags::empty(),
1031            _decode,
1032        )
1033    }
1034
1035    type StopStubResponseFut = fidl::client::QueryResponseFut<
1036        ControllerStopStubResult,
1037        fidl::encoding::DefaultFuchsiaResourceDialect,
1038    >;
1039    fn r#stop_stub(&self) -> Self::StopStubResponseFut {
1040        fn _decode(
1041            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1042        ) -> Result<ControllerStopStubResult, fidl::Error> {
1043            let _response = fidl::client::decode_transaction_body::<
1044                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1045                fidl::encoding::DefaultFuchsiaResourceDialect,
1046                0x582c32b564ff4bb4,
1047            >(_buf?)?;
1048            Ok(_response.map(|x| x))
1049        }
1050        self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ControllerStopStubResult>(
1051            (),
1052            0x582c32b564ff4bb4,
1053            fidl::encoding::DynamicFlags::empty(),
1054            _decode,
1055        )
1056    }
1057
1058    type PingResponseFut = fidl::client::QueryResponseFut<
1059        ControllerPingResult,
1060        fidl::encoding::DefaultFuchsiaResourceDialect,
1061    >;
1062    fn r#ping(
1063        &self,
1064        mut target: &fidl_fuchsia_net::IpAddress,
1065        mut payload_length: u16,
1066        mut interface_name: Option<&str>,
1067        mut timeout: i64,
1068    ) -> Self::PingResponseFut {
1069        fn _decode(
1070            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1071        ) -> Result<ControllerPingResult, fidl::Error> {
1072            let _response = fidl::client::decode_transaction_body::<
1073                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1074                fidl::encoding::DefaultFuchsiaResourceDialect,
1075                0x60c9b6cf952fa4d1,
1076            >(_buf?)?;
1077            Ok(_response.map(|x| x))
1078        }
1079        self.client.send_query_and_decode::<ControllerPingRequest, ControllerPingResult>(
1080            (target, payload_length, interface_name, timeout),
1081            0x60c9b6cf952fa4d1,
1082            fidl::encoding::DynamicFlags::empty(),
1083            _decode,
1084        )
1085    }
1086
1087    type PollUdpResponseFut = fidl::client::QueryResponseFut<
1088        ControllerPollUdpResult,
1089        fidl::encoding::DefaultFuchsiaResourceDialect,
1090    >;
1091    fn r#poll_udp(
1092        &self,
1093        mut target: &fidl_fuchsia_net::SocketAddress,
1094        mut payload: &[u8],
1095        mut timeout: i64,
1096        mut num_retries: u16,
1097    ) -> Self::PollUdpResponseFut {
1098        fn _decode(
1099            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1100        ) -> Result<ControllerPollUdpResult, fidl::Error> {
1101            let _response = fidl::client::decode_transaction_body::<
1102                fidl::encoding::ResultType<ControllerPollUdpResponse, Error>,
1103                fidl::encoding::DefaultFuchsiaResourceDialect,
1104                0x333fb354db30f664,
1105            >(_buf?)?;
1106            Ok(_response.map(|x| x.payload))
1107        }
1108        self.client.send_query_and_decode::<ControllerPollUdpRequest, ControllerPollUdpResult>(
1109            (target, payload, timeout, num_retries),
1110            0x333fb354db30f664,
1111            fidl::encoding::DynamicFlags::empty(),
1112            _decode,
1113        )
1114    }
1115
1116    type JoinMulticastGroupResponseFut = fidl::client::QueryResponseFut<
1117        ControllerJoinMulticastGroupResult,
1118        fidl::encoding::DefaultFuchsiaResourceDialect,
1119    >;
1120    fn r#join_multicast_group(
1121        &self,
1122        mut address: &fidl_fuchsia_net::IpAddress,
1123        mut interface_id: u64,
1124    ) -> Self::JoinMulticastGroupResponseFut {
1125        fn _decode(
1126            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1127        ) -> Result<ControllerJoinMulticastGroupResult, fidl::Error> {
1128            let _response = fidl::client::decode_transaction_body::<
1129                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1130                fidl::encoding::DefaultFuchsiaResourceDialect,
1131                0xbdbb4095640a3f4,
1132            >(_buf?)?;
1133            Ok(_response.map(|x| x))
1134        }
1135        self.client.send_query_and_decode::<
1136            ControllerJoinMulticastGroupRequest,
1137            ControllerJoinMulticastGroupResult,
1138        >(
1139            (address, interface_id,),
1140            0xbdbb4095640a3f4,
1141            fidl::encoding::DynamicFlags::empty(),
1142            _decode,
1143        )
1144    }
1145
1146    type LeaveMulticastGroupResponseFut = fidl::client::QueryResponseFut<
1147        ControllerLeaveMulticastGroupResult,
1148        fidl::encoding::DefaultFuchsiaResourceDialect,
1149    >;
1150    fn r#leave_multicast_group(
1151        &self,
1152        mut address: &fidl_fuchsia_net::IpAddress,
1153        mut interface_id: u64,
1154    ) -> Self::LeaveMulticastGroupResponseFut {
1155        fn _decode(
1156            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1157        ) -> Result<ControllerLeaveMulticastGroupResult, fidl::Error> {
1158            let _response = fidl::client::decode_transaction_body::<
1159                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1160                fidl::encoding::DefaultFuchsiaResourceDialect,
1161                0x32ecf4e40124a29a,
1162            >(_buf?)?;
1163            Ok(_response.map(|x| x))
1164        }
1165        self.client.send_query_and_decode::<
1166            ControllerLeaveMulticastGroupRequest,
1167            ControllerLeaveMulticastGroupResult,
1168        >(
1169            (address, interface_id,),
1170            0x32ecf4e40124a29a,
1171            fidl::encoding::DynamicFlags::empty(),
1172            _decode,
1173        )
1174    }
1175
1176    type StartDhcpv6ClientResponseFut = fidl::client::QueryResponseFut<
1177        ControllerStartDhcpv6ClientResult,
1178        fidl::encoding::DefaultFuchsiaResourceDialect,
1179    >;
1180    fn r#start_dhcpv6_client(
1181        &self,
1182        mut params: &fidl_fuchsia_net_dhcpv6::NewClientParams,
1183    ) -> Self::StartDhcpv6ClientResponseFut {
1184        fn _decode(
1185            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1186        ) -> Result<ControllerStartDhcpv6ClientResult, fidl::Error> {
1187            let _response = fidl::client::decode_transaction_body::<
1188                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1189                fidl::encoding::DefaultFuchsiaResourceDialect,
1190                0x756c9b70864b7744,
1191            >(_buf?)?;
1192            Ok(_response.map(|x| x))
1193        }
1194        self.client.send_query_and_decode::<
1195            ControllerStartDhcpv6ClientRequest,
1196            ControllerStartDhcpv6ClientResult,
1197        >(
1198            (params,),
1199            0x756c9b70864b7744,
1200            fidl::encoding::DynamicFlags::empty(),
1201            _decode,
1202        )
1203    }
1204
1205    type StopDhcpv6ClientResponseFut = fidl::client::QueryResponseFut<
1206        ControllerStopDhcpv6ClientResult,
1207        fidl::encoding::DefaultFuchsiaResourceDialect,
1208    >;
1209    fn r#stop_dhcpv6_client(&self) -> Self::StopDhcpv6ClientResponseFut {
1210        fn _decode(
1211            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1212        ) -> Result<ControllerStopDhcpv6ClientResult, fidl::Error> {
1213            let _response = fidl::client::decode_transaction_body::<
1214                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1215                fidl::encoding::DefaultFuchsiaResourceDialect,
1216                0x16e93478e663d523,
1217            >(_buf?)?;
1218            Ok(_response.map(|x| x))
1219        }
1220        self.client.send_query_and_decode::<
1221            fidl::encoding::EmptyPayload,
1222            ControllerStopDhcpv6ClientResult,
1223        >(
1224            (),
1225            0x16e93478e663d523,
1226            fidl::encoding::DynamicFlags::empty(),
1227            _decode,
1228        )
1229    }
1230
1231    type StartOutOfStackDhcpv4ClientResponseFut = fidl::client::QueryResponseFut<
1232        ControllerStartOutOfStackDhcpv4ClientResult,
1233        fidl::encoding::DefaultFuchsiaResourceDialect,
1234    >;
1235    fn r#start_out_of_stack_dhcpv4_client(
1236        &self,
1237        mut payload: &ControllerStartOutOfStackDhcpv4ClientRequest,
1238    ) -> Self::StartOutOfStackDhcpv4ClientResponseFut {
1239        fn _decode(
1240            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1241        ) -> Result<ControllerStartOutOfStackDhcpv4ClientResult, fidl::Error> {
1242            let _response = fidl::client::decode_transaction_body::<
1243                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1244                fidl::encoding::DefaultFuchsiaResourceDialect,
1245                0x37eeec41c0077625,
1246            >(_buf?)?;
1247            Ok(_response.map(|x| x))
1248        }
1249        self.client.send_query_and_decode::<
1250            ControllerStartOutOfStackDhcpv4ClientRequest,
1251            ControllerStartOutOfStackDhcpv4ClientResult,
1252        >(
1253            payload,
1254            0x37eeec41c0077625,
1255            fidl::encoding::DynamicFlags::empty(),
1256            _decode,
1257        )
1258    }
1259
1260    type StopOutOfStackDhcpv4ClientResponseFut = fidl::client::QueryResponseFut<
1261        ControllerStopOutOfStackDhcpv4ClientResult,
1262        fidl::encoding::DefaultFuchsiaResourceDialect,
1263    >;
1264    fn r#stop_out_of_stack_dhcpv4_client(
1265        &self,
1266        mut payload: &ControllerStopOutOfStackDhcpv4ClientRequest,
1267    ) -> Self::StopOutOfStackDhcpv4ClientResponseFut {
1268        fn _decode(
1269            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1270        ) -> Result<ControllerStopOutOfStackDhcpv4ClientResult, fidl::Error> {
1271            let _response = fidl::client::decode_transaction_body::<
1272                fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
1273                fidl::encoding::DefaultFuchsiaResourceDialect,
1274                0x5d47aa5213164364,
1275            >(_buf?)?;
1276            Ok(_response.map(|x| x))
1277        }
1278        self.client.send_query_and_decode::<
1279            ControllerStopOutOfStackDhcpv4ClientRequest,
1280            ControllerStopOutOfStackDhcpv4ClientResult,
1281        >(
1282            payload,
1283            0x5d47aa5213164364,
1284            fidl::encoding::DynamicFlags::empty(),
1285            _decode,
1286        )
1287    }
1288}
1289
1290pub struct ControllerEventStream {
1291    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1292}
1293
1294impl std::marker::Unpin for ControllerEventStream {}
1295
1296impl futures::stream::FusedStream for ControllerEventStream {
1297    fn is_terminated(&self) -> bool {
1298        self.event_receiver.is_terminated()
1299    }
1300}
1301
1302impl futures::Stream for ControllerEventStream {
1303    type Item = Result<ControllerEvent, fidl::Error>;
1304
1305    fn poll_next(
1306        mut self: std::pin::Pin<&mut Self>,
1307        cx: &mut std::task::Context<'_>,
1308    ) -> std::task::Poll<Option<Self::Item>> {
1309        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1310            &mut self.event_receiver,
1311            cx
1312        )?) {
1313            Some(buf) => std::task::Poll::Ready(Some(ControllerEvent::decode(buf))),
1314            None => std::task::Poll::Ready(None),
1315        }
1316    }
1317}
1318
1319#[derive(Debug)]
1320pub enum ControllerEvent {}
1321
1322impl ControllerEvent {
1323    /// Decodes a message buffer as a [`ControllerEvent`].
1324    fn decode(
1325        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1326    ) -> Result<ControllerEvent, fidl::Error> {
1327        let (bytes, _handles) = buf.split_mut();
1328        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1329        debug_assert_eq!(tx_header.tx_id, 0);
1330        match tx_header.ordinal {
1331            _ => Err(fidl::Error::UnknownOrdinal {
1332                ordinal: tx_header.ordinal,
1333                protocol_name: <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1334            }),
1335        }
1336    }
1337}
1338
1339/// A Stream of incoming requests for fuchsia.net.test.realm/Controller.
1340pub struct ControllerRequestStream {
1341    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1342    is_terminated: bool,
1343}
1344
1345impl std::marker::Unpin for ControllerRequestStream {}
1346
1347impl futures::stream::FusedStream for ControllerRequestStream {
1348    fn is_terminated(&self) -> bool {
1349        self.is_terminated
1350    }
1351}
1352
1353impl fidl::endpoints::RequestStream for ControllerRequestStream {
1354    type Protocol = ControllerMarker;
1355    type ControlHandle = ControllerControlHandle;
1356
1357    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1358        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1359    }
1360
1361    fn control_handle(&self) -> Self::ControlHandle {
1362        ControllerControlHandle { inner: self.inner.clone() }
1363    }
1364
1365    fn into_inner(
1366        self,
1367    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1368    {
1369        (self.inner, self.is_terminated)
1370    }
1371
1372    fn from_inner(
1373        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1374        is_terminated: bool,
1375    ) -> Self {
1376        Self { inner, is_terminated }
1377    }
1378}
1379
1380impl futures::Stream for ControllerRequestStream {
1381    type Item = Result<ControllerRequest, fidl::Error>;
1382
1383    fn poll_next(
1384        mut self: std::pin::Pin<&mut Self>,
1385        cx: &mut std::task::Context<'_>,
1386    ) -> std::task::Poll<Option<Self::Item>> {
1387        let this = &mut *self;
1388        if this.inner.check_shutdown(cx) {
1389            this.is_terminated = true;
1390            return std::task::Poll::Ready(None);
1391        }
1392        if this.is_terminated {
1393            panic!("polled ControllerRequestStream after completion");
1394        }
1395        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1396            |bytes, handles| {
1397                match this.inner.channel().read_etc(cx, bytes, handles) {
1398                    std::task::Poll::Ready(Ok(())) => {}
1399                    std::task::Poll::Pending => return std::task::Poll::Pending,
1400                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1401                        this.is_terminated = true;
1402                        return std::task::Poll::Ready(None);
1403                    }
1404                    std::task::Poll::Ready(Err(e)) => {
1405                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1406                            e.into(),
1407                        ))))
1408                    }
1409                }
1410
1411                // A message has been received from the channel
1412                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1413
1414                std::task::Poll::Ready(Some(match header.ordinal {
1415                    0x58c1fa7335d4c5c2 => {
1416                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1417                        let mut req = fidl::new_empty!(
1418                            ControllerStartHermeticNetworkRealmRequest,
1419                            fidl::encoding::DefaultFuchsiaResourceDialect
1420                        );
1421                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerStartHermeticNetworkRealmRequest>(&header, _body_bytes, handles, &mut req)?;
1422                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1423                        Ok(ControllerRequest::StartHermeticNetworkRealm {
1424                            netstack: req.netstack,
1425
1426                            responder: ControllerStartHermeticNetworkRealmResponder {
1427                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1428                                tx_id: header.tx_id,
1429                            },
1430                        })
1431                    }
1432                    0x49d3c2501cd2f635 => {
1433                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1434                        let mut req = fidl::new_empty!(
1435                            fidl::encoding::EmptyPayload,
1436                            fidl::encoding::DefaultFuchsiaResourceDialect
1437                        );
1438                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1439                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1440                        Ok(ControllerRequest::StopHermeticNetworkRealm {
1441                            responder: ControllerStopHermeticNetworkRealmResponder {
1442                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1443                                tx_id: header.tx_id,
1444                            },
1445                        })
1446                    }
1447                    0x668ded2d2b619c15 => {
1448                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1449                        let mut req = fidl::new_empty!(
1450                            ControllerAddInterfaceRequest,
1451                            fidl::encoding::DefaultFuchsiaResourceDialect
1452                        );
1453                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerAddInterfaceRequest>(&header, _body_bytes, handles, &mut req)?;
1454                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1455                        Ok(ControllerRequest::AddInterface {
1456                            mac_address: req.mac_address,
1457                            name: req.name,
1458                            wait_any_ip_address: req.wait_any_ip_address,
1459
1460                            responder: ControllerAddInterfaceResponder {
1461                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1462                                tx_id: header.tx_id,
1463                            },
1464                        })
1465                    }
1466                    0x6523a401f22bf664 => {
1467                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1468                        let mut req = fidl::new_empty!(
1469                            ControllerStartStubRequest,
1470                            fidl::encoding::DefaultFuchsiaResourceDialect
1471                        );
1472                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerStartStubRequest>(&header, _body_bytes, handles, &mut req)?;
1473                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1474                        Ok(ControllerRequest::StartStub {
1475                            component_url: req.component_url,
1476
1477                            responder: ControllerStartStubResponder {
1478                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1479                                tx_id: header.tx_id,
1480                            },
1481                        })
1482                    }
1483                    0x582c32b564ff4bb4 => {
1484                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1485                        let mut req = fidl::new_empty!(
1486                            fidl::encoding::EmptyPayload,
1487                            fidl::encoding::DefaultFuchsiaResourceDialect
1488                        );
1489                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1490                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1491                        Ok(ControllerRequest::StopStub {
1492                            responder: ControllerStopStubResponder {
1493                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1494                                tx_id: header.tx_id,
1495                            },
1496                        })
1497                    }
1498                    0x60c9b6cf952fa4d1 => {
1499                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1500                        let mut req = fidl::new_empty!(
1501                            ControllerPingRequest,
1502                            fidl::encoding::DefaultFuchsiaResourceDialect
1503                        );
1504                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerPingRequest>(&header, _body_bytes, handles, &mut req)?;
1505                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1506                        Ok(ControllerRequest::Ping {
1507                            target: req.target,
1508                            payload_length: req.payload_length,
1509                            interface_name: req.interface_name,
1510                            timeout: req.timeout,
1511
1512                            responder: ControllerPingResponder {
1513                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1514                                tx_id: header.tx_id,
1515                            },
1516                        })
1517                    }
1518                    0x333fb354db30f664 => {
1519                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1520                        let mut req = fidl::new_empty!(
1521                            ControllerPollUdpRequest,
1522                            fidl::encoding::DefaultFuchsiaResourceDialect
1523                        );
1524                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerPollUdpRequest>(&header, _body_bytes, handles, &mut req)?;
1525                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1526                        Ok(ControllerRequest::PollUdp {
1527                            target: req.target,
1528                            payload: req.payload,
1529                            timeout: req.timeout,
1530                            num_retries: req.num_retries,
1531
1532                            responder: ControllerPollUdpResponder {
1533                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1534                                tx_id: header.tx_id,
1535                            },
1536                        })
1537                    }
1538                    0xbdbb4095640a3f4 => {
1539                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1540                        let mut req = fidl::new_empty!(
1541                            ControllerJoinMulticastGroupRequest,
1542                            fidl::encoding::DefaultFuchsiaResourceDialect
1543                        );
1544                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerJoinMulticastGroupRequest>(&header, _body_bytes, handles, &mut req)?;
1545                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1546                        Ok(ControllerRequest::JoinMulticastGroup {
1547                            address: req.address,
1548                            interface_id: req.interface_id,
1549
1550                            responder: ControllerJoinMulticastGroupResponder {
1551                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1552                                tx_id: header.tx_id,
1553                            },
1554                        })
1555                    }
1556                    0x32ecf4e40124a29a => {
1557                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1558                        let mut req = fidl::new_empty!(
1559                            ControllerLeaveMulticastGroupRequest,
1560                            fidl::encoding::DefaultFuchsiaResourceDialect
1561                        );
1562                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerLeaveMulticastGroupRequest>(&header, _body_bytes, handles, &mut req)?;
1563                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1564                        Ok(ControllerRequest::LeaveMulticastGroup {
1565                            address: req.address,
1566                            interface_id: req.interface_id,
1567
1568                            responder: ControllerLeaveMulticastGroupResponder {
1569                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1570                                tx_id: header.tx_id,
1571                            },
1572                        })
1573                    }
1574                    0x756c9b70864b7744 => {
1575                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1576                        let mut req = fidl::new_empty!(
1577                            ControllerStartDhcpv6ClientRequest,
1578                            fidl::encoding::DefaultFuchsiaResourceDialect
1579                        );
1580                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerStartDhcpv6ClientRequest>(&header, _body_bytes, handles, &mut req)?;
1581                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1582                        Ok(ControllerRequest::StartDhcpv6Client {
1583                            params: req.params,
1584
1585                            responder: ControllerStartDhcpv6ClientResponder {
1586                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1587                                tx_id: header.tx_id,
1588                            },
1589                        })
1590                    }
1591                    0x16e93478e663d523 => {
1592                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1593                        let mut req = fidl::new_empty!(
1594                            fidl::encoding::EmptyPayload,
1595                            fidl::encoding::DefaultFuchsiaResourceDialect
1596                        );
1597                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1598                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1599                        Ok(ControllerRequest::StopDhcpv6Client {
1600                            responder: ControllerStopDhcpv6ClientResponder {
1601                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1602                                tx_id: header.tx_id,
1603                            },
1604                        })
1605                    }
1606                    0x37eeec41c0077625 => {
1607                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1608                        let mut req = fidl::new_empty!(
1609                            ControllerStartOutOfStackDhcpv4ClientRequest,
1610                            fidl::encoding::DefaultFuchsiaResourceDialect
1611                        );
1612                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerStartOutOfStackDhcpv4ClientRequest>(&header, _body_bytes, handles, &mut req)?;
1613                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1614                        Ok(ControllerRequest::StartOutOfStackDhcpv4Client {
1615                            payload: req,
1616                            responder: ControllerStartOutOfStackDhcpv4ClientResponder {
1617                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1618                                tx_id: header.tx_id,
1619                            },
1620                        })
1621                    }
1622                    0x5d47aa5213164364 => {
1623                        header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1624                        let mut req = fidl::new_empty!(
1625                            ControllerStopOutOfStackDhcpv4ClientRequest,
1626                            fidl::encoding::DefaultFuchsiaResourceDialect
1627                        );
1628                        fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControllerStopOutOfStackDhcpv4ClientRequest>(&header, _body_bytes, handles, &mut req)?;
1629                        let control_handle = ControllerControlHandle { inner: this.inner.clone() };
1630                        Ok(ControllerRequest::StopOutOfStackDhcpv4Client {
1631                            payload: req,
1632                            responder: ControllerStopOutOfStackDhcpv4ClientResponder {
1633                                control_handle: std::mem::ManuallyDrop::new(control_handle),
1634                                tx_id: header.tx_id,
1635                            },
1636                        })
1637                    }
1638                    _ => Err(fidl::Error::UnknownOrdinal {
1639                        ordinal: header.ordinal,
1640                        protocol_name:
1641                            <ControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1642                    }),
1643                }))
1644            },
1645        )
1646    }
1647}
1648
1649/// A controller for creating and manipulating the Network Test Realm.
1650///
1651/// The Network Test Realm corresponds to a hermetic network realm with a
1652/// Netstack under test. The `Controller` protocol is responsible for:
1653///
1654///  * Configuring the Network Test Realm and its child components. This
1655///    includes the Netstack under test and the other relevant network
1656///    components (e.g. a DHCP server).
1657///  * Coordinating interactions with the system's Netstack. This includes
1658///    temporarily taking over and mutating system interfaces.
1659#[derive(Debug)]
1660pub enum ControllerRequest {
1661    /// Starts a hermetic network realm corresponding to `netstack`.
1662    ///
1663    /// Any previously running hermetic network realm will be terminated before
1664    /// the new realm is started. The configured realm will contain a subset of
1665    /// the components in the standard network realm. In particular, it will
1666    /// contain:
1667    ///
1668    ///  * A Netstack instance that corresponds to the provided `netstack`
1669    ///  * A DHCP server
1670    ///  * A DHCPv6 client
1671    ///  * A DNS resolver
1672    ///
1673    /// + request `netstack` the type of Netstack that will be run.
1674    /// * error `INTERNAL` for internal errors, including failure to start the
1675    ///     specified `netstack`.
1676    StartHermeticNetworkRealm {
1677        netstack: Netstack,
1678        responder: ControllerStartHermeticNetworkRealmResponder,
1679    },
1680    /// Stops any running hermetic network realm.
1681    ///
1682    /// All components in the hermetic network realm will be stopped. Similarly,
1683    /// any interfaces that were previously disabled on the system's Netstack
1684    /// will be re-enabled on a best-effort basis. That is, a failure to
1685    /// re-enable an interface will not result in this method returning an
1686    /// error.
1687    ///
1688    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if a hermetic network realm
1689    ///     is not running.
1690    /// * error `INTERNAL` for internal errors, including failure to destroy the
1691    ///     realm.
1692    StopHermeticNetworkRealm { responder: ControllerStopHermeticNetworkRealmResponder },
1693    /// Attaches an interface to the hermetic Netstack.
1694    ///
1695    /// The interface that corresponds to `mac_address` will disabled on the
1696    /// system's Netstack, but enabled on the hermetic Netstack.
1697    ///
1698    /// + request `mac_address` address of the interface to be added to the
1699    ///     hermetic Netstack.
1700    /// + request `name` the name to assign to the new interface.
1701    /// + request `wait_any_ip_address` whether to wait for any IP address to be
1702    ///     assigned to the interface before returning. This is helpful for
1703    ///     tests that want to ensure the autoconfigured IP address is assigned
1704    ///     and has completed duplicate address detection before proceeding.
1705    /// * error `ALREADY_EXISTS` if an interface with `name` already exists on
1706    ///     the hermetic Netstack.
1707    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
1708    ///     hermetic network realm.
1709    /// * error `INTERFACE_NOT_FOUND` if an interface with `mac_address` could
1710    ///     not be found on the system.
1711    /// * error `INTERNAL` for internal errors, including failure to read the
1712    ///     system's interfaces or configure an interface.
1713    AddInterface {
1714        mac_address: fidl_fuchsia_net::MacAddress,
1715        name: String,
1716        wait_any_ip_address: bool,
1717        responder: ControllerAddInterfaceResponder,
1718    },
1719    /// Starts a test stub.
1720    ///
1721    /// Any previously running stub will be terminated before the provided
1722    /// stub corresponding to `component_url` is started.
1723    ///
1724    /// + request `component_url` the URL of the component to run.
1725    /// * error `COMPONENT_NOT_FOUND` if a component correspodning to
1726    ///     `component_url` could not be resolved.
1727    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
1728    ///     hermetic network realm.
1729    /// * error `INTERNAL` for internal errors, including failure to add the
1730    ///     desired stub within the hermetic network realm.
1731    /// * error `INVALID_ARGUMENTS` if the `component_url` is malformed.
1732    StartStub { component_url: String, responder: ControllerStartStubResponder },
1733    /// Stops the currently running stub.
1734    ///
1735    /// Other existing hermetic network realm components will continue to be run
1736    /// after this is invoked.
1737    ///
1738    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
1739    ///     hermetic network realm.
1740    /// * error `STUB_NOT_RUNNING` if there is no running stub.
1741    /// * error `INTERNAL` for internal errors, including failure to destroy the
1742    ///     stub component.
1743    StopStub { responder: ControllerStopStubResponder },
1744    /// Sends an ICMP echo request to the `target` using a socket provided by
1745    /// the hermetic Netstack.
1746    ///
1747    /// + request `target` the address to ping.
1748    /// + request `payload_length` the body size of the ICMP packet.
1749    ///     Specifically, the packet body will be filled with zeros of
1750    ///     `payload_length`.
1751    /// + request `interface_name` an optional interface to bind the socket to.
1752    /// + request `timeout` a timeout in nanoseconds to wait for a reply. If
1753    ///     less than or equal to 0, then returns success immediately after the
1754    ///     ping is sent.
1755    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
1756    ///     hermetic network realm.
1757    /// * error `INTERFACE_NOT_FOUND` if `interface_name` does not exist in the
1758    ///     hermetic Netstack.
1759    /// * error `INTERNAL` for internal errors, including failure to create a
1760    ///     socket or generate the ping request and response.
1761    /// * error `INVALID_ARGUMENTS` if `target` corresponds to a link-local
1762    ///     address and an `interface_name` is not specified or the
1763    ///     `payload_length` exceeds the maximum allowable size.
1764    /// * error `PING_FAILED` if there was an error sending or receiving the
1765    ///     ping.
1766    /// * error `TIMEOUT_EXCEEDED` if the ping reply is not received before the
1767    ///     specifed `timeout`.
1768    Ping {
1769        target: fidl_fuchsia_net::IpAddress,
1770        payload_length: u16,
1771        interface_name: Option<String>,
1772        timeout: i64,
1773        responder: ControllerPingResponder,
1774    },
1775    /// Polls the specified socket address with UDP datagrams containing the specified payload
1776    /// using a socket provided by the hermetic Netstack.
1777    ///
1778    /// Waits for a single reply from the target address and returns it.
1779    ///
1780    /// + request `target` the socket address to poll.
1781    /// + request `payload` the content to place in the UDP datagram.
1782    /// + request `timeout` a timeout in nanoseconds to wait for a reply, per retry.
1783    /// + request `num_retries` the number of poll attempts to make before giving up and returning
1784    ///     an error.
1785    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
1786    ///     hermetic network realm.
1787    /// * error `ADDRESS_UNREACHABLE` if all poll attempts expire without successfully receiving
1788    ///     a reply from the target address, and no route was found to the target address.
1789    /// * error `TIMEOUT_EXCEEDED` if the target address was routable, but all of the retry
1790    ///     attempts expire without successfully receiving a reply from the target address.
1791    /// * error `INTERNAL` for internal errors, including failure to create a socket or other
1792    ///     failures to send/receive datagrams from the target address.
1793    PollUdp {
1794        target: fidl_fuchsia_net::SocketAddress,
1795        payload: Vec<u8>,
1796        timeout: i64,
1797        num_retries: u16,
1798        responder: ControllerPollUdpResponder,
1799    },
1800    /// Joins a multicast group.
1801    ///
1802    /// Membership will be maintained until `LeaveMulticastGroup` or
1803    /// `StopHermeticNetworkRealm` is invoked.
1804    ///
1805    /// + request `address` the group address to join.
1806    /// + request `interface_id` the interface that should be used to join the
1807    ///     group. A value of 0 indicates that any interface may be used.
1808    /// * error `ADDRESS_IN_USE` if the provided `address` was previously
1809    ///     joined.
1810    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
1811    ///     hermetic network realm.
1812    /// * error `INTERNAL` for internal errors.
1813    /// * error `INVALID_ARGUMENTS` if the specified `interface_id` does not
1814    ///     exist or the `address` does not correspond to a valid multicast
1815    ///     address.
1816    JoinMulticastGroup {
1817        address: fidl_fuchsia_net::IpAddress,
1818        interface_id: u64,
1819        responder: ControllerJoinMulticastGroupResponder,
1820    },
1821    /// Leaves a multicast group that was previously joined using the
1822    /// `JoinMulticastGroup` method.
1823    ///
1824    /// + request `address` the group address to leave.
1825    /// + request `interface_id` the interface that was previously used to join
1826    ///     the multicast group.
1827    /// * error `ADDRESS_NOT_AVAILABLE` if the provided `address` was not
1828    ///     previously joined.
1829    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
1830    ///     hermetic network realm.
1831    /// * error `INTERNAL` for internal errors, including failure to connect
1832    ///     to hermetic network realm services.
1833    /// * error `INVALID_ARGUMENTS` if the specified `interface_id` does not
1834    ///     exist or the `address` does not correspond to a valid multicast
1835    ///     address.
1836    LeaveMulticastGroup {
1837        address: fidl_fuchsia_net::IpAddress,
1838        interface_id: u64,
1839        responder: ControllerLeaveMulticastGroupResponder,
1840    },
1841    /// Starts a DHCPv6 client with the provided parameters.
1842    ///
1843    /// + request `params` parameters to start this DHCPv6 client with.
1844    ///     Required.
1845    /// * error `HERMETIC_NETWORK_REALM_NOT_RUNNING` if there is no running
1846    ///     hermetic network realm.
1847    /// * error `INTERNAL` for internal errors, including failure to connect
1848    ///     to hermetic network realm services.
1849    /// * error `INVALID_ARGUMENTS` if any required parameters are omitted.
1850    /// * error `ALREADY_EXISTS` if there is a client running on the interface
1851    ///     identified by `params.interface_id` already.
1852    StartDhcpv6Client {
1853        params: fidl_fuchsia_net_dhcpv6::NewClientParams,
1854        responder: ControllerStartDhcpv6ClientResponder,
1855    },
1856    /// Stops all DHCPv6 clients.
1857    ///
1858    /// * error `DHCPV6_CLIENT_NOT_RUNNING` if no DHCPv6 client is running.
1859    StopDhcpv6Client { responder: ControllerStopDhcpv6ClientResponder },
1860    /// Starts a DHCPv4 client on the provided interface.
1861    ///
1862    /// + request `interface_id` the interface to start a DHCPv4 client on.
1863    ///     Required.
1864    StartOutOfStackDhcpv4Client {
1865        payload: ControllerStartOutOfStackDhcpv4ClientRequest,
1866        responder: ControllerStartOutOfStackDhcpv4ClientResponder,
1867    },
1868    /// Stops the DHCPv4 client on the provided interface.
1869    ///
1870    /// + request `interface_id` the interface to stop a DHCPv4 client client on.
1871    ///     Required.
1872    /// * error `DHCPV4_CLIENT_NOT_RUNNING` if no DHCPv4 client is running.
1873    /// * error `DHCPV4_CLIENT_SHUTDOWN_FAILED` if shutting down the DHCPv4 client
1874    ///   failed.
1875    StopOutOfStackDhcpv4Client {
1876        payload: ControllerStopOutOfStackDhcpv4ClientRequest,
1877        responder: ControllerStopOutOfStackDhcpv4ClientResponder,
1878    },
1879}
1880
1881impl ControllerRequest {
1882    #[allow(irrefutable_let_patterns)]
1883    pub fn into_start_hermetic_network_realm(
1884        self,
1885    ) -> Option<(Netstack, ControllerStartHermeticNetworkRealmResponder)> {
1886        if let ControllerRequest::StartHermeticNetworkRealm { netstack, responder } = self {
1887            Some((netstack, responder))
1888        } else {
1889            None
1890        }
1891    }
1892
1893    #[allow(irrefutable_let_patterns)]
1894    pub fn into_stop_hermetic_network_realm(
1895        self,
1896    ) -> Option<(ControllerStopHermeticNetworkRealmResponder)> {
1897        if let ControllerRequest::StopHermeticNetworkRealm { responder } = self {
1898            Some((responder))
1899        } else {
1900            None
1901        }
1902    }
1903
1904    #[allow(irrefutable_let_patterns)]
1905    pub fn into_add_interface(
1906        self,
1907    ) -> Option<(fidl_fuchsia_net::MacAddress, String, bool, ControllerAddInterfaceResponder)> {
1908        if let ControllerRequest::AddInterface {
1909            mac_address,
1910            name,
1911            wait_any_ip_address,
1912            responder,
1913        } = self
1914        {
1915            Some((mac_address, name, wait_any_ip_address, responder))
1916        } else {
1917            None
1918        }
1919    }
1920
1921    #[allow(irrefutable_let_patterns)]
1922    pub fn into_start_stub(self) -> Option<(String, ControllerStartStubResponder)> {
1923        if let ControllerRequest::StartStub { component_url, responder } = self {
1924            Some((component_url, responder))
1925        } else {
1926            None
1927        }
1928    }
1929
1930    #[allow(irrefutable_let_patterns)]
1931    pub fn into_stop_stub(self) -> Option<(ControllerStopStubResponder)> {
1932        if let ControllerRequest::StopStub { responder } = self {
1933            Some((responder))
1934        } else {
1935            None
1936        }
1937    }
1938
1939    #[allow(irrefutable_let_patterns)]
1940    pub fn into_ping(
1941        self,
1942    ) -> Option<(fidl_fuchsia_net::IpAddress, u16, Option<String>, i64, ControllerPingResponder)>
1943    {
1944        if let ControllerRequest::Ping {
1945            target,
1946            payload_length,
1947            interface_name,
1948            timeout,
1949            responder,
1950        } = self
1951        {
1952            Some((target, payload_length, interface_name, timeout, responder))
1953        } else {
1954            None
1955        }
1956    }
1957
1958    #[allow(irrefutable_let_patterns)]
1959    pub fn into_poll_udp(
1960        self,
1961    ) -> Option<(fidl_fuchsia_net::SocketAddress, Vec<u8>, i64, u16, ControllerPollUdpResponder)>
1962    {
1963        if let ControllerRequest::PollUdp { target, payload, timeout, num_retries, responder } =
1964            self
1965        {
1966            Some((target, payload, timeout, num_retries, responder))
1967        } else {
1968            None
1969        }
1970    }
1971
1972    #[allow(irrefutable_let_patterns)]
1973    pub fn into_join_multicast_group(
1974        self,
1975    ) -> Option<(fidl_fuchsia_net::IpAddress, u64, ControllerJoinMulticastGroupResponder)> {
1976        if let ControllerRequest::JoinMulticastGroup { address, interface_id, responder } = self {
1977            Some((address, interface_id, responder))
1978        } else {
1979            None
1980        }
1981    }
1982
1983    #[allow(irrefutable_let_patterns)]
1984    pub fn into_leave_multicast_group(
1985        self,
1986    ) -> Option<(fidl_fuchsia_net::IpAddress, u64, ControllerLeaveMulticastGroupResponder)> {
1987        if let ControllerRequest::LeaveMulticastGroup { address, interface_id, responder } = self {
1988            Some((address, interface_id, responder))
1989        } else {
1990            None
1991        }
1992    }
1993
1994    #[allow(irrefutable_let_patterns)]
1995    pub fn into_start_dhcpv6_client(
1996        self,
1997    ) -> Option<(fidl_fuchsia_net_dhcpv6::NewClientParams, ControllerStartDhcpv6ClientResponder)>
1998    {
1999        if let ControllerRequest::StartDhcpv6Client { params, responder } = self {
2000            Some((params, responder))
2001        } else {
2002            None
2003        }
2004    }
2005
2006    #[allow(irrefutable_let_patterns)]
2007    pub fn into_stop_dhcpv6_client(self) -> Option<(ControllerStopDhcpv6ClientResponder)> {
2008        if let ControllerRequest::StopDhcpv6Client { responder } = self {
2009            Some((responder))
2010        } else {
2011            None
2012        }
2013    }
2014
2015    #[allow(irrefutable_let_patterns)]
2016    pub fn into_start_out_of_stack_dhcpv4_client(
2017        self,
2018    ) -> Option<(
2019        ControllerStartOutOfStackDhcpv4ClientRequest,
2020        ControllerStartOutOfStackDhcpv4ClientResponder,
2021    )> {
2022        if let ControllerRequest::StartOutOfStackDhcpv4Client { payload, responder } = self {
2023            Some((payload, responder))
2024        } else {
2025            None
2026        }
2027    }
2028
2029    #[allow(irrefutable_let_patterns)]
2030    pub fn into_stop_out_of_stack_dhcpv4_client(
2031        self,
2032    ) -> Option<(
2033        ControllerStopOutOfStackDhcpv4ClientRequest,
2034        ControllerStopOutOfStackDhcpv4ClientResponder,
2035    )> {
2036        if let ControllerRequest::StopOutOfStackDhcpv4Client { payload, responder } = self {
2037            Some((payload, responder))
2038        } else {
2039            None
2040        }
2041    }
2042
2043    /// Name of the method defined in FIDL
2044    pub fn method_name(&self) -> &'static str {
2045        match *self {
2046            ControllerRequest::StartHermeticNetworkRealm { .. } => "start_hermetic_network_realm",
2047            ControllerRequest::StopHermeticNetworkRealm { .. } => "stop_hermetic_network_realm",
2048            ControllerRequest::AddInterface { .. } => "add_interface",
2049            ControllerRequest::StartStub { .. } => "start_stub",
2050            ControllerRequest::StopStub { .. } => "stop_stub",
2051            ControllerRequest::Ping { .. } => "ping",
2052            ControllerRequest::PollUdp { .. } => "poll_udp",
2053            ControllerRequest::JoinMulticastGroup { .. } => "join_multicast_group",
2054            ControllerRequest::LeaveMulticastGroup { .. } => "leave_multicast_group",
2055            ControllerRequest::StartDhcpv6Client { .. } => "start_dhcpv6_client",
2056            ControllerRequest::StopDhcpv6Client { .. } => "stop_dhcpv6_client",
2057            ControllerRequest::StartOutOfStackDhcpv4Client { .. } => {
2058                "start_out_of_stack_dhcpv4_client"
2059            }
2060            ControllerRequest::StopOutOfStackDhcpv4Client { .. } => {
2061                "stop_out_of_stack_dhcpv4_client"
2062            }
2063        }
2064    }
2065}
2066
2067#[derive(Debug, Clone)]
2068pub struct ControllerControlHandle {
2069    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2070}
2071
2072impl fidl::endpoints::ControlHandle for ControllerControlHandle {
2073    fn shutdown(&self) {
2074        self.inner.shutdown()
2075    }
2076    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2077        self.inner.shutdown_with_epitaph(status)
2078    }
2079
2080    fn is_closed(&self) -> bool {
2081        self.inner.channel().is_closed()
2082    }
2083    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2084        self.inner.channel().on_closed()
2085    }
2086
2087    #[cfg(target_os = "fuchsia")]
2088    fn signal_peer(
2089        &self,
2090        clear_mask: zx::Signals,
2091        set_mask: zx::Signals,
2092    ) -> Result<(), zx_status::Status> {
2093        use fidl::Peered;
2094        self.inner.channel().signal_peer(clear_mask, set_mask)
2095    }
2096}
2097
2098impl ControllerControlHandle {}
2099
2100#[must_use = "FIDL methods require a response to be sent"]
2101#[derive(Debug)]
2102pub struct ControllerStartHermeticNetworkRealmResponder {
2103    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2104    tx_id: u32,
2105}
2106
2107/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2108/// if the responder is dropped without sending a response, so that the client
2109/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2110impl std::ops::Drop for ControllerStartHermeticNetworkRealmResponder {
2111    fn drop(&mut self) {
2112        self.control_handle.shutdown();
2113        // Safety: drops once, never accessed again
2114        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2115    }
2116}
2117
2118impl fidl::endpoints::Responder for ControllerStartHermeticNetworkRealmResponder {
2119    type ControlHandle = ControllerControlHandle;
2120
2121    fn control_handle(&self) -> &ControllerControlHandle {
2122        &self.control_handle
2123    }
2124
2125    fn drop_without_shutdown(mut self) {
2126        // Safety: drops once, never accessed again due to mem::forget
2127        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2128        // Prevent Drop from running (which would shut down the channel)
2129        std::mem::forget(self);
2130    }
2131}
2132
2133impl ControllerStartHermeticNetworkRealmResponder {
2134    /// Sends a response to the FIDL transaction.
2135    ///
2136    /// Sets the channel to shutdown if an error occurs.
2137    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2138        let _result = self.send_raw(result);
2139        if _result.is_err() {
2140            self.control_handle.shutdown();
2141        }
2142        self.drop_without_shutdown();
2143        _result
2144    }
2145
2146    /// Similar to "send" but does not shutdown the channel if an error occurs.
2147    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2148        let _result = self.send_raw(result);
2149        self.drop_without_shutdown();
2150        _result
2151    }
2152
2153    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2154        self.control_handle
2155            .inner
2156            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2157                result,
2158                self.tx_id,
2159                0x58c1fa7335d4c5c2,
2160                fidl::encoding::DynamicFlags::empty(),
2161            )
2162    }
2163}
2164
2165#[must_use = "FIDL methods require a response to be sent"]
2166#[derive(Debug)]
2167pub struct ControllerStopHermeticNetworkRealmResponder {
2168    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2169    tx_id: u32,
2170}
2171
2172/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2173/// if the responder is dropped without sending a response, so that the client
2174/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2175impl std::ops::Drop for ControllerStopHermeticNetworkRealmResponder {
2176    fn drop(&mut self) {
2177        self.control_handle.shutdown();
2178        // Safety: drops once, never accessed again
2179        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2180    }
2181}
2182
2183impl fidl::endpoints::Responder for ControllerStopHermeticNetworkRealmResponder {
2184    type ControlHandle = ControllerControlHandle;
2185
2186    fn control_handle(&self) -> &ControllerControlHandle {
2187        &self.control_handle
2188    }
2189
2190    fn drop_without_shutdown(mut self) {
2191        // Safety: drops once, never accessed again due to mem::forget
2192        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2193        // Prevent Drop from running (which would shut down the channel)
2194        std::mem::forget(self);
2195    }
2196}
2197
2198impl ControllerStopHermeticNetworkRealmResponder {
2199    /// Sends a response to the FIDL transaction.
2200    ///
2201    /// Sets the channel to shutdown if an error occurs.
2202    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2203        let _result = self.send_raw(result);
2204        if _result.is_err() {
2205            self.control_handle.shutdown();
2206        }
2207        self.drop_without_shutdown();
2208        _result
2209    }
2210
2211    /// Similar to "send" but does not shutdown the channel if an error occurs.
2212    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2213        let _result = self.send_raw(result);
2214        self.drop_without_shutdown();
2215        _result
2216    }
2217
2218    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2219        self.control_handle
2220            .inner
2221            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2222                result,
2223                self.tx_id,
2224                0x49d3c2501cd2f635,
2225                fidl::encoding::DynamicFlags::empty(),
2226            )
2227    }
2228}
2229
2230#[must_use = "FIDL methods require a response to be sent"]
2231#[derive(Debug)]
2232pub struct ControllerAddInterfaceResponder {
2233    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2234    tx_id: u32,
2235}
2236
2237/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2238/// if the responder is dropped without sending a response, so that the client
2239/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2240impl std::ops::Drop for ControllerAddInterfaceResponder {
2241    fn drop(&mut self) {
2242        self.control_handle.shutdown();
2243        // Safety: drops once, never accessed again
2244        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2245    }
2246}
2247
2248impl fidl::endpoints::Responder for ControllerAddInterfaceResponder {
2249    type ControlHandle = ControllerControlHandle;
2250
2251    fn control_handle(&self) -> &ControllerControlHandle {
2252        &self.control_handle
2253    }
2254
2255    fn drop_without_shutdown(mut self) {
2256        // Safety: drops once, never accessed again due to mem::forget
2257        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2258        // Prevent Drop from running (which would shut down the channel)
2259        std::mem::forget(self);
2260    }
2261}
2262
2263impl ControllerAddInterfaceResponder {
2264    /// Sends a response to the FIDL transaction.
2265    ///
2266    /// Sets the channel to shutdown if an error occurs.
2267    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2268        let _result = self.send_raw(result);
2269        if _result.is_err() {
2270            self.control_handle.shutdown();
2271        }
2272        self.drop_without_shutdown();
2273        _result
2274    }
2275
2276    /// Similar to "send" but does not shutdown the channel if an error occurs.
2277    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2278        let _result = self.send_raw(result);
2279        self.drop_without_shutdown();
2280        _result
2281    }
2282
2283    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2284        self.control_handle
2285            .inner
2286            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2287                result,
2288                self.tx_id,
2289                0x668ded2d2b619c15,
2290                fidl::encoding::DynamicFlags::empty(),
2291            )
2292    }
2293}
2294
2295#[must_use = "FIDL methods require a response to be sent"]
2296#[derive(Debug)]
2297pub struct ControllerStartStubResponder {
2298    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2299    tx_id: u32,
2300}
2301
2302/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2303/// if the responder is dropped without sending a response, so that the client
2304/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2305impl std::ops::Drop for ControllerStartStubResponder {
2306    fn drop(&mut self) {
2307        self.control_handle.shutdown();
2308        // Safety: drops once, never accessed again
2309        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2310    }
2311}
2312
2313impl fidl::endpoints::Responder for ControllerStartStubResponder {
2314    type ControlHandle = ControllerControlHandle;
2315
2316    fn control_handle(&self) -> &ControllerControlHandle {
2317        &self.control_handle
2318    }
2319
2320    fn drop_without_shutdown(mut self) {
2321        // Safety: drops once, never accessed again due to mem::forget
2322        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2323        // Prevent Drop from running (which would shut down the channel)
2324        std::mem::forget(self);
2325    }
2326}
2327
2328impl ControllerStartStubResponder {
2329    /// Sends a response to the FIDL transaction.
2330    ///
2331    /// Sets the channel to shutdown if an error occurs.
2332    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2333        let _result = self.send_raw(result);
2334        if _result.is_err() {
2335            self.control_handle.shutdown();
2336        }
2337        self.drop_without_shutdown();
2338        _result
2339    }
2340
2341    /// Similar to "send" but does not shutdown the channel if an error occurs.
2342    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2343        let _result = self.send_raw(result);
2344        self.drop_without_shutdown();
2345        _result
2346    }
2347
2348    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2349        self.control_handle
2350            .inner
2351            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2352                result,
2353                self.tx_id,
2354                0x6523a401f22bf664,
2355                fidl::encoding::DynamicFlags::empty(),
2356            )
2357    }
2358}
2359
2360#[must_use = "FIDL methods require a response to be sent"]
2361#[derive(Debug)]
2362pub struct ControllerStopStubResponder {
2363    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2364    tx_id: u32,
2365}
2366
2367/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2368/// if the responder is dropped without sending a response, so that the client
2369/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2370impl std::ops::Drop for ControllerStopStubResponder {
2371    fn drop(&mut self) {
2372        self.control_handle.shutdown();
2373        // Safety: drops once, never accessed again
2374        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2375    }
2376}
2377
2378impl fidl::endpoints::Responder for ControllerStopStubResponder {
2379    type ControlHandle = ControllerControlHandle;
2380
2381    fn control_handle(&self) -> &ControllerControlHandle {
2382        &self.control_handle
2383    }
2384
2385    fn drop_without_shutdown(mut self) {
2386        // Safety: drops once, never accessed again due to mem::forget
2387        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2388        // Prevent Drop from running (which would shut down the channel)
2389        std::mem::forget(self);
2390    }
2391}
2392
2393impl ControllerStopStubResponder {
2394    /// Sends a response to the FIDL transaction.
2395    ///
2396    /// Sets the channel to shutdown if an error occurs.
2397    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2398        let _result = self.send_raw(result);
2399        if _result.is_err() {
2400            self.control_handle.shutdown();
2401        }
2402        self.drop_without_shutdown();
2403        _result
2404    }
2405
2406    /// Similar to "send" but does not shutdown the channel if an error occurs.
2407    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2408        let _result = self.send_raw(result);
2409        self.drop_without_shutdown();
2410        _result
2411    }
2412
2413    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2414        self.control_handle
2415            .inner
2416            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2417                result,
2418                self.tx_id,
2419                0x582c32b564ff4bb4,
2420                fidl::encoding::DynamicFlags::empty(),
2421            )
2422    }
2423}
2424
2425#[must_use = "FIDL methods require a response to be sent"]
2426#[derive(Debug)]
2427pub struct ControllerPingResponder {
2428    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2429    tx_id: u32,
2430}
2431
2432/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2433/// if the responder is dropped without sending a response, so that the client
2434/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2435impl std::ops::Drop for ControllerPingResponder {
2436    fn drop(&mut self) {
2437        self.control_handle.shutdown();
2438        // Safety: drops once, never accessed again
2439        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2440    }
2441}
2442
2443impl fidl::endpoints::Responder for ControllerPingResponder {
2444    type ControlHandle = ControllerControlHandle;
2445
2446    fn control_handle(&self) -> &ControllerControlHandle {
2447        &self.control_handle
2448    }
2449
2450    fn drop_without_shutdown(mut self) {
2451        // Safety: drops once, never accessed again due to mem::forget
2452        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2453        // Prevent Drop from running (which would shut down the channel)
2454        std::mem::forget(self);
2455    }
2456}
2457
2458impl ControllerPingResponder {
2459    /// Sends a response to the FIDL transaction.
2460    ///
2461    /// Sets the channel to shutdown if an error occurs.
2462    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2463        let _result = self.send_raw(result);
2464        if _result.is_err() {
2465            self.control_handle.shutdown();
2466        }
2467        self.drop_without_shutdown();
2468        _result
2469    }
2470
2471    /// Similar to "send" but does not shutdown the channel if an error occurs.
2472    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2473        let _result = self.send_raw(result);
2474        self.drop_without_shutdown();
2475        _result
2476    }
2477
2478    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2479        self.control_handle
2480            .inner
2481            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2482                result,
2483                self.tx_id,
2484                0x60c9b6cf952fa4d1,
2485                fidl::encoding::DynamicFlags::empty(),
2486            )
2487    }
2488}
2489
2490#[must_use = "FIDL methods require a response to be sent"]
2491#[derive(Debug)]
2492pub struct ControllerPollUdpResponder {
2493    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2494    tx_id: u32,
2495}
2496
2497/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2498/// if the responder is dropped without sending a response, so that the client
2499/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2500impl std::ops::Drop for ControllerPollUdpResponder {
2501    fn drop(&mut self) {
2502        self.control_handle.shutdown();
2503        // Safety: drops once, never accessed again
2504        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2505    }
2506}
2507
2508impl fidl::endpoints::Responder for ControllerPollUdpResponder {
2509    type ControlHandle = ControllerControlHandle;
2510
2511    fn control_handle(&self) -> &ControllerControlHandle {
2512        &self.control_handle
2513    }
2514
2515    fn drop_without_shutdown(mut self) {
2516        // Safety: drops once, never accessed again due to mem::forget
2517        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2518        // Prevent Drop from running (which would shut down the channel)
2519        std::mem::forget(self);
2520    }
2521}
2522
2523impl ControllerPollUdpResponder {
2524    /// Sends a response to the FIDL transaction.
2525    ///
2526    /// Sets the channel to shutdown if an error occurs.
2527    pub fn send(self, mut result: Result<&[u8], Error>) -> Result<(), fidl::Error> {
2528        let _result = self.send_raw(result);
2529        if _result.is_err() {
2530            self.control_handle.shutdown();
2531        }
2532        self.drop_without_shutdown();
2533        _result
2534    }
2535
2536    /// Similar to "send" but does not shutdown the channel if an error occurs.
2537    pub fn send_no_shutdown_on_err(
2538        self,
2539        mut result: Result<&[u8], Error>,
2540    ) -> Result<(), fidl::Error> {
2541        let _result = self.send_raw(result);
2542        self.drop_without_shutdown();
2543        _result
2544    }
2545
2546    fn send_raw(&self, mut result: Result<&[u8], Error>) -> Result<(), fidl::Error> {
2547        self.control_handle
2548            .inner
2549            .send::<fidl::encoding::ResultType<ControllerPollUdpResponse, Error>>(
2550                result.map(|payload| (payload,)),
2551                self.tx_id,
2552                0x333fb354db30f664,
2553                fidl::encoding::DynamicFlags::empty(),
2554            )
2555    }
2556}
2557
2558#[must_use = "FIDL methods require a response to be sent"]
2559#[derive(Debug)]
2560pub struct ControllerJoinMulticastGroupResponder {
2561    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2562    tx_id: u32,
2563}
2564
2565/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2566/// if the responder is dropped without sending a response, so that the client
2567/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2568impl std::ops::Drop for ControllerJoinMulticastGroupResponder {
2569    fn drop(&mut self) {
2570        self.control_handle.shutdown();
2571        // Safety: drops once, never accessed again
2572        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2573    }
2574}
2575
2576impl fidl::endpoints::Responder for ControllerJoinMulticastGroupResponder {
2577    type ControlHandle = ControllerControlHandle;
2578
2579    fn control_handle(&self) -> &ControllerControlHandle {
2580        &self.control_handle
2581    }
2582
2583    fn drop_without_shutdown(mut self) {
2584        // Safety: drops once, never accessed again due to mem::forget
2585        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2586        // Prevent Drop from running (which would shut down the channel)
2587        std::mem::forget(self);
2588    }
2589}
2590
2591impl ControllerJoinMulticastGroupResponder {
2592    /// Sends a response to the FIDL transaction.
2593    ///
2594    /// Sets the channel to shutdown if an error occurs.
2595    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2596        let _result = self.send_raw(result);
2597        if _result.is_err() {
2598            self.control_handle.shutdown();
2599        }
2600        self.drop_without_shutdown();
2601        _result
2602    }
2603
2604    /// Similar to "send" but does not shutdown the channel if an error occurs.
2605    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2606        let _result = self.send_raw(result);
2607        self.drop_without_shutdown();
2608        _result
2609    }
2610
2611    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2612        self.control_handle
2613            .inner
2614            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2615                result,
2616                self.tx_id,
2617                0xbdbb4095640a3f4,
2618                fidl::encoding::DynamicFlags::empty(),
2619            )
2620    }
2621}
2622
2623#[must_use = "FIDL methods require a response to be sent"]
2624#[derive(Debug)]
2625pub struct ControllerLeaveMulticastGroupResponder {
2626    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2627    tx_id: u32,
2628}
2629
2630/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2631/// if the responder is dropped without sending a response, so that the client
2632/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2633impl std::ops::Drop for ControllerLeaveMulticastGroupResponder {
2634    fn drop(&mut self) {
2635        self.control_handle.shutdown();
2636        // Safety: drops once, never accessed again
2637        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2638    }
2639}
2640
2641impl fidl::endpoints::Responder for ControllerLeaveMulticastGroupResponder {
2642    type ControlHandle = ControllerControlHandle;
2643
2644    fn control_handle(&self) -> &ControllerControlHandle {
2645        &self.control_handle
2646    }
2647
2648    fn drop_without_shutdown(mut self) {
2649        // Safety: drops once, never accessed again due to mem::forget
2650        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2651        // Prevent Drop from running (which would shut down the channel)
2652        std::mem::forget(self);
2653    }
2654}
2655
2656impl ControllerLeaveMulticastGroupResponder {
2657    /// Sends a response to the FIDL transaction.
2658    ///
2659    /// Sets the channel to shutdown if an error occurs.
2660    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2661        let _result = self.send_raw(result);
2662        if _result.is_err() {
2663            self.control_handle.shutdown();
2664        }
2665        self.drop_without_shutdown();
2666        _result
2667    }
2668
2669    /// Similar to "send" but does not shutdown the channel if an error occurs.
2670    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2671        let _result = self.send_raw(result);
2672        self.drop_without_shutdown();
2673        _result
2674    }
2675
2676    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2677        self.control_handle
2678            .inner
2679            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2680                result,
2681                self.tx_id,
2682                0x32ecf4e40124a29a,
2683                fidl::encoding::DynamicFlags::empty(),
2684            )
2685    }
2686}
2687
2688#[must_use = "FIDL methods require a response to be sent"]
2689#[derive(Debug)]
2690pub struct ControllerStartDhcpv6ClientResponder {
2691    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2692    tx_id: u32,
2693}
2694
2695/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2696/// if the responder is dropped without sending a response, so that the client
2697/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2698impl std::ops::Drop for ControllerStartDhcpv6ClientResponder {
2699    fn drop(&mut self) {
2700        self.control_handle.shutdown();
2701        // Safety: drops once, never accessed again
2702        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2703    }
2704}
2705
2706impl fidl::endpoints::Responder for ControllerStartDhcpv6ClientResponder {
2707    type ControlHandle = ControllerControlHandle;
2708
2709    fn control_handle(&self) -> &ControllerControlHandle {
2710        &self.control_handle
2711    }
2712
2713    fn drop_without_shutdown(mut self) {
2714        // Safety: drops once, never accessed again due to mem::forget
2715        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2716        // Prevent Drop from running (which would shut down the channel)
2717        std::mem::forget(self);
2718    }
2719}
2720
2721impl ControllerStartDhcpv6ClientResponder {
2722    /// Sends a response to the FIDL transaction.
2723    ///
2724    /// Sets the channel to shutdown if an error occurs.
2725    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2726        let _result = self.send_raw(result);
2727        if _result.is_err() {
2728            self.control_handle.shutdown();
2729        }
2730        self.drop_without_shutdown();
2731        _result
2732    }
2733
2734    /// Similar to "send" but does not shutdown the channel if an error occurs.
2735    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2736        let _result = self.send_raw(result);
2737        self.drop_without_shutdown();
2738        _result
2739    }
2740
2741    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2742        self.control_handle
2743            .inner
2744            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2745                result,
2746                self.tx_id,
2747                0x756c9b70864b7744,
2748                fidl::encoding::DynamicFlags::empty(),
2749            )
2750    }
2751}
2752
2753#[must_use = "FIDL methods require a response to be sent"]
2754#[derive(Debug)]
2755pub struct ControllerStopDhcpv6ClientResponder {
2756    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2757    tx_id: u32,
2758}
2759
2760/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2761/// if the responder is dropped without sending a response, so that the client
2762/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2763impl std::ops::Drop for ControllerStopDhcpv6ClientResponder {
2764    fn drop(&mut self) {
2765        self.control_handle.shutdown();
2766        // Safety: drops once, never accessed again
2767        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2768    }
2769}
2770
2771impl fidl::endpoints::Responder for ControllerStopDhcpv6ClientResponder {
2772    type ControlHandle = ControllerControlHandle;
2773
2774    fn control_handle(&self) -> &ControllerControlHandle {
2775        &self.control_handle
2776    }
2777
2778    fn drop_without_shutdown(mut self) {
2779        // Safety: drops once, never accessed again due to mem::forget
2780        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2781        // Prevent Drop from running (which would shut down the channel)
2782        std::mem::forget(self);
2783    }
2784}
2785
2786impl ControllerStopDhcpv6ClientResponder {
2787    /// Sends a response to the FIDL transaction.
2788    ///
2789    /// Sets the channel to shutdown if an error occurs.
2790    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2791        let _result = self.send_raw(result);
2792        if _result.is_err() {
2793            self.control_handle.shutdown();
2794        }
2795        self.drop_without_shutdown();
2796        _result
2797    }
2798
2799    /// Similar to "send" but does not shutdown the channel if an error occurs.
2800    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2801        let _result = self.send_raw(result);
2802        self.drop_without_shutdown();
2803        _result
2804    }
2805
2806    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2807        self.control_handle
2808            .inner
2809            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2810                result,
2811                self.tx_id,
2812                0x16e93478e663d523,
2813                fidl::encoding::DynamicFlags::empty(),
2814            )
2815    }
2816}
2817
2818#[must_use = "FIDL methods require a response to be sent"]
2819#[derive(Debug)]
2820pub struct ControllerStartOutOfStackDhcpv4ClientResponder {
2821    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2822    tx_id: u32,
2823}
2824
2825/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2826/// if the responder is dropped without sending a response, so that the client
2827/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2828impl std::ops::Drop for ControllerStartOutOfStackDhcpv4ClientResponder {
2829    fn drop(&mut self) {
2830        self.control_handle.shutdown();
2831        // Safety: drops once, never accessed again
2832        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2833    }
2834}
2835
2836impl fidl::endpoints::Responder for ControllerStartOutOfStackDhcpv4ClientResponder {
2837    type ControlHandle = ControllerControlHandle;
2838
2839    fn control_handle(&self) -> &ControllerControlHandle {
2840        &self.control_handle
2841    }
2842
2843    fn drop_without_shutdown(mut self) {
2844        // Safety: drops once, never accessed again due to mem::forget
2845        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2846        // Prevent Drop from running (which would shut down the channel)
2847        std::mem::forget(self);
2848    }
2849}
2850
2851impl ControllerStartOutOfStackDhcpv4ClientResponder {
2852    /// Sends a response to the FIDL transaction.
2853    ///
2854    /// Sets the channel to shutdown if an error occurs.
2855    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2856        let _result = self.send_raw(result);
2857        if _result.is_err() {
2858            self.control_handle.shutdown();
2859        }
2860        self.drop_without_shutdown();
2861        _result
2862    }
2863
2864    /// Similar to "send" but does not shutdown the channel if an error occurs.
2865    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2866        let _result = self.send_raw(result);
2867        self.drop_without_shutdown();
2868        _result
2869    }
2870
2871    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2872        self.control_handle
2873            .inner
2874            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2875                result,
2876                self.tx_id,
2877                0x37eeec41c0077625,
2878                fidl::encoding::DynamicFlags::empty(),
2879            )
2880    }
2881}
2882
2883#[must_use = "FIDL methods require a response to be sent"]
2884#[derive(Debug)]
2885pub struct ControllerStopOutOfStackDhcpv4ClientResponder {
2886    control_handle: std::mem::ManuallyDrop<ControllerControlHandle>,
2887    tx_id: u32,
2888}
2889
2890/// Set the the channel to be shutdown (see [`ControllerControlHandle::shutdown`])
2891/// if the responder is dropped without sending a response, so that the client
2892/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2893impl std::ops::Drop for ControllerStopOutOfStackDhcpv4ClientResponder {
2894    fn drop(&mut self) {
2895        self.control_handle.shutdown();
2896        // Safety: drops once, never accessed again
2897        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2898    }
2899}
2900
2901impl fidl::endpoints::Responder for ControllerStopOutOfStackDhcpv4ClientResponder {
2902    type ControlHandle = ControllerControlHandle;
2903
2904    fn control_handle(&self) -> &ControllerControlHandle {
2905        &self.control_handle
2906    }
2907
2908    fn drop_without_shutdown(mut self) {
2909        // Safety: drops once, never accessed again due to mem::forget
2910        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2911        // Prevent Drop from running (which would shut down the channel)
2912        std::mem::forget(self);
2913    }
2914}
2915
2916impl ControllerStopOutOfStackDhcpv4ClientResponder {
2917    /// Sends a response to the FIDL transaction.
2918    ///
2919    /// Sets the channel to shutdown if an error occurs.
2920    pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2921        let _result = self.send_raw(result);
2922        if _result.is_err() {
2923            self.control_handle.shutdown();
2924        }
2925        self.drop_without_shutdown();
2926        _result
2927    }
2928
2929    /// Similar to "send" but does not shutdown the channel if an error occurs.
2930    pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2931        let _result = self.send_raw(result);
2932        self.drop_without_shutdown();
2933        _result
2934    }
2935
2936    fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
2937        self.control_handle
2938            .inner
2939            .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
2940                result,
2941                self.tx_id,
2942                0x5d47aa5213164364,
2943                fidl::encoding::DynamicFlags::empty(),
2944            )
2945    }
2946}
2947
2948mod internal {
2949    use super::*;
2950}