Skip to main content

fidl_fuchsia_net_test_realm/
fidl_fuchsia_net_test_realm.rs

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