Skip to main content

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