fidl_fuchsia_net_test_realm/
fidl_fuchsia_net_test_realm.rs

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