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