fidl_fuchsia_net_test_realm/
fidl_fuchsia_net_test_realm.rs

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