fidl_fuchsia_net_multicast_admin/
fidl_fuchsia_net_multicast_admin.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_multicast_admin__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct Ipv4RoutingTableControllerMarker;
16
17impl fidl::endpoints::ProtocolMarker for Ipv4RoutingTableControllerMarker {
18    type Proxy = Ipv4RoutingTableControllerProxy;
19    type RequestStream = Ipv4RoutingTableControllerRequestStream;
20    #[cfg(target_os = "fuchsia")]
21    type SynchronousProxy = Ipv4RoutingTableControllerSynchronousProxy;
22
23    const DEBUG_NAME: &'static str = "fuchsia.net.multicast.admin.Ipv4RoutingTableController";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for Ipv4RoutingTableControllerMarker {}
26pub type Ipv4RoutingTableControllerAddRouteResult =
27    Result<(), Ipv4RoutingTableControllerAddRouteError>;
28pub type Ipv4RoutingTableControllerDelRouteResult =
29    Result<(), Ipv4RoutingTableControllerDelRouteError>;
30pub type Ipv4RoutingTableControllerGetRouteStatsResult =
31    Result<RouteStats, Ipv4RoutingTableControllerGetRouteStatsError>;
32
33pub trait Ipv4RoutingTableControllerProxyInterface: Send + Sync {
34    type AddRouteResponseFut: std::future::Future<Output = Result<Ipv4RoutingTableControllerAddRouteResult, fidl::Error>>
35        + Send;
36    fn r#add_route(
37        &self,
38        addresses: &Ipv4UnicastSourceAndMulticastDestination,
39        route: &Route,
40    ) -> Self::AddRouteResponseFut;
41    type DelRouteResponseFut: std::future::Future<Output = Result<Ipv4RoutingTableControllerDelRouteResult, fidl::Error>>
42        + Send;
43    fn r#del_route(
44        &self,
45        addresses: &Ipv4UnicastSourceAndMulticastDestination,
46    ) -> Self::DelRouteResponseFut;
47    type GetRouteStatsResponseFut: std::future::Future<
48            Output = Result<Ipv4RoutingTableControllerGetRouteStatsResult, fidl::Error>,
49        > + Send;
50    fn r#get_route_stats(
51        &self,
52        addresses: &Ipv4UnicastSourceAndMulticastDestination,
53    ) -> Self::GetRouteStatsResponseFut;
54    type WatchRoutingEventsResponseFut: std::future::Future<
55            Output = Result<
56                (u64, Ipv4UnicastSourceAndMulticastDestination, u64, RoutingEvent),
57                fidl::Error,
58            >,
59        > + Send;
60    fn r#watch_routing_events(&self) -> Self::WatchRoutingEventsResponseFut;
61}
62#[derive(Debug)]
63#[cfg(target_os = "fuchsia")]
64pub struct Ipv4RoutingTableControllerSynchronousProxy {
65    client: fidl::client::sync::Client,
66}
67
68#[cfg(target_os = "fuchsia")]
69impl fidl::endpoints::SynchronousProxy for Ipv4RoutingTableControllerSynchronousProxy {
70    type Proxy = Ipv4RoutingTableControllerProxy;
71    type Protocol = Ipv4RoutingTableControllerMarker;
72
73    fn from_channel(inner: fidl::Channel) -> Self {
74        Self::new(inner)
75    }
76
77    fn into_channel(self) -> fidl::Channel {
78        self.client.into_channel()
79    }
80
81    fn as_channel(&self) -> &fidl::Channel {
82        self.client.as_channel()
83    }
84}
85
86#[cfg(target_os = "fuchsia")]
87impl Ipv4RoutingTableControllerSynchronousProxy {
88    pub fn new(channel: fidl::Channel) -> Self {
89        let protocol_name =
90            <Ipv4RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
91        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
92    }
93
94    pub fn into_channel(self) -> fidl::Channel {
95        self.client.into_channel()
96    }
97
98    /// Waits until an event arrives and returns it. It is safe for other
99    /// threads to make concurrent requests while waiting for an event.
100    pub fn wait_for_event(
101        &self,
102        deadline: zx::MonotonicInstant,
103    ) -> Result<Ipv4RoutingTableControllerEvent, fidl::Error> {
104        Ipv4RoutingTableControllerEvent::decode(self.client.wait_for_event(deadline)?)
105    }
106
107    /// Adds a route such that packets matching the addresses will be forwarded
108    /// accordingly.
109    ///
110    /// The provided addresses act as the key for the route; any existing route
111    /// with the same addresses will be overwritten when this route is
112    /// installed.
113    ///
114    /// If a packet arrives at an interface different from the expected input
115    /// interface set in the route, the packet will not be forwarded and a
116    /// [`RoutingEvent.wrong_input_interface`] event will be sent to the client.
117    /// See [`WatchRoutingEvents`] for more details.
118    ///
119    /// + request `addresses` the addresses used to identify a route.
120    /// + request `route` the multicast route.
121    pub fn r#add_route(
122        &self,
123        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
124        mut route: &Route,
125        ___deadline: zx::MonotonicInstant,
126    ) -> Result<Ipv4RoutingTableControllerAddRouteResult, fidl::Error> {
127        let _response = self
128            .client
129            .send_query::<Ipv4RoutingTableControllerAddRouteRequest, fidl::encoding::ResultType<
130                fidl::encoding::EmptyStruct,
131                Ipv4RoutingTableControllerAddRouteError,
132            >>(
133                (addresses, route),
134                0x6098a90553ef1aed,
135                fidl::encoding::DynamicFlags::empty(),
136                ___deadline,
137            )?;
138        Ok(_response.map(|x| x))
139    }
140
141    /// Delete a route.
142    ///
143    /// + request `addresses` the addresses used to identify a route.
144    pub fn r#del_route(
145        &self,
146        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
147        ___deadline: zx::MonotonicInstant,
148    ) -> Result<Ipv4RoutingTableControllerDelRouteResult, fidl::Error> {
149        let _response = self
150            .client
151            .send_query::<Ipv4RoutingTableControllerDelRouteRequest, fidl::encoding::ResultType<
152                fidl::encoding::EmptyStruct,
153                Ipv4RoutingTableControllerDelRouteError,
154            >>(
155                (addresses,),
156                0x14a0727b797aff74,
157                fidl::encoding::DynamicFlags::empty(),
158                ___deadline,
159            )?;
160        Ok(_response.map(|x| x))
161    }
162
163    /// Get a snapshot of statistics about a specific route.
164    ///
165    /// + request `addresses` the addresses used to identify a route.
166    pub fn r#get_route_stats(
167        &self,
168        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
169        ___deadline: zx::MonotonicInstant,
170    ) -> Result<Ipv4RoutingTableControllerGetRouteStatsResult, fidl::Error> {
171        let _response = self.client.send_query::<
172            Ipv4RoutingTableControllerGetRouteStatsRequest,
173            fidl::encoding::ResultType<Ipv4RoutingTableControllerGetRouteStatsResponse, Ipv4RoutingTableControllerGetRouteStatsError>,
174        >(
175            (addresses,),
176            0x176ad8488370c1e9,
177            fidl::encoding::DynamicFlags::empty(),
178            ___deadline,
179        )?;
180        Ok(_response.map(|x| x.stats))
181    }
182
183    /// Watch for events triggered by multicast packets.
184    ///
185    /// The server will queue events to return when this method is called. If no
186    /// events are ready, the call will block until an event is ready. The
187    /// server will drop new events if the client is not consuming them fast
188    /// enough and return the number of events dropped in-between events.
189    ///
190    /// It is invalid to call this method while a previous call is pending.
191    /// Doing so will cause the server end of the protocol to be closed.
192    ///
193    /// - response `dropped_events` the number of events that were dropped
194    ///   _immediately before_ the returned event was queued.
195    ///   returned event.
196    /// - response `addresses` the addresses in the multicast packet triggering
197    ///   the event.
198    /// - response `input_interface` the interface the multicast packet
199    ///   triggering the event arrived at.
200    /// - response `event` the event.
201    pub fn r#watch_routing_events(
202        &self,
203        ___deadline: zx::MonotonicInstant,
204    ) -> Result<(u64, Ipv4UnicastSourceAndMulticastDestination, u64, RoutingEvent), fidl::Error>
205    {
206        let _response = self.client.send_query::<
207            fidl::encoding::EmptyPayload,
208            Ipv4RoutingTableControllerWatchRoutingEventsResponse,
209        >(
210            (),
211            0x3e4336c50718d7f9,
212            fidl::encoding::DynamicFlags::empty(),
213            ___deadline,
214        )?;
215        Ok((
216            _response.dropped_events,
217            _response.addresses,
218            _response.input_interface,
219            _response.event,
220        ))
221    }
222}
223
224#[cfg(target_os = "fuchsia")]
225impl From<Ipv4RoutingTableControllerSynchronousProxy> for zx::Handle {
226    fn from(value: Ipv4RoutingTableControllerSynchronousProxy) -> Self {
227        value.into_channel().into()
228    }
229}
230
231#[cfg(target_os = "fuchsia")]
232impl From<fidl::Channel> for Ipv4RoutingTableControllerSynchronousProxy {
233    fn from(value: fidl::Channel) -> Self {
234        Self::new(value)
235    }
236}
237
238#[cfg(target_os = "fuchsia")]
239impl fidl::endpoints::FromClient for Ipv4RoutingTableControllerSynchronousProxy {
240    type Protocol = Ipv4RoutingTableControllerMarker;
241
242    fn from_client(value: fidl::endpoints::ClientEnd<Ipv4RoutingTableControllerMarker>) -> Self {
243        Self::new(value.into_channel())
244    }
245}
246
247#[derive(Debug, Clone)]
248pub struct Ipv4RoutingTableControllerProxy {
249    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
250}
251
252impl fidl::endpoints::Proxy for Ipv4RoutingTableControllerProxy {
253    type Protocol = Ipv4RoutingTableControllerMarker;
254
255    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
256        Self::new(inner)
257    }
258
259    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
260        self.client.into_channel().map_err(|client| Self { client })
261    }
262
263    fn as_channel(&self) -> &::fidl::AsyncChannel {
264        self.client.as_channel()
265    }
266}
267
268impl Ipv4RoutingTableControllerProxy {
269    /// Create a new Proxy for fuchsia.net.multicast.admin/Ipv4RoutingTableController.
270    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
271        let protocol_name =
272            <Ipv4RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
273        Self { client: fidl::client::Client::new(channel, protocol_name) }
274    }
275
276    /// Get a Stream of events from the remote end of the protocol.
277    ///
278    /// # Panics
279    ///
280    /// Panics if the event stream was already taken.
281    pub fn take_event_stream(&self) -> Ipv4RoutingTableControllerEventStream {
282        Ipv4RoutingTableControllerEventStream { event_receiver: self.client.take_event_receiver() }
283    }
284
285    /// Adds a route such that packets matching the addresses will be forwarded
286    /// accordingly.
287    ///
288    /// The provided addresses act as the key for the route; any existing route
289    /// with the same addresses will be overwritten when this route is
290    /// installed.
291    ///
292    /// If a packet arrives at an interface different from the expected input
293    /// interface set in the route, the packet will not be forwarded and a
294    /// [`RoutingEvent.wrong_input_interface`] event will be sent to the client.
295    /// See [`WatchRoutingEvents`] for more details.
296    ///
297    /// + request `addresses` the addresses used to identify a route.
298    /// + request `route` the multicast route.
299    pub fn r#add_route(
300        &self,
301        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
302        mut route: &Route,
303    ) -> fidl::client::QueryResponseFut<
304        Ipv4RoutingTableControllerAddRouteResult,
305        fidl::encoding::DefaultFuchsiaResourceDialect,
306    > {
307        Ipv4RoutingTableControllerProxyInterface::r#add_route(self, addresses, route)
308    }
309
310    /// Delete a route.
311    ///
312    /// + request `addresses` the addresses used to identify a route.
313    pub fn r#del_route(
314        &self,
315        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
316    ) -> fidl::client::QueryResponseFut<
317        Ipv4RoutingTableControllerDelRouteResult,
318        fidl::encoding::DefaultFuchsiaResourceDialect,
319    > {
320        Ipv4RoutingTableControllerProxyInterface::r#del_route(self, addresses)
321    }
322
323    /// Get a snapshot of statistics about a specific route.
324    ///
325    /// + request `addresses` the addresses used to identify a route.
326    pub fn r#get_route_stats(
327        &self,
328        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
329    ) -> fidl::client::QueryResponseFut<
330        Ipv4RoutingTableControllerGetRouteStatsResult,
331        fidl::encoding::DefaultFuchsiaResourceDialect,
332    > {
333        Ipv4RoutingTableControllerProxyInterface::r#get_route_stats(self, addresses)
334    }
335
336    /// Watch for events triggered by multicast packets.
337    ///
338    /// The server will queue events to return when this method is called. If no
339    /// events are ready, the call will block until an event is ready. The
340    /// server will drop new events if the client is not consuming them fast
341    /// enough and return the number of events dropped in-between events.
342    ///
343    /// It is invalid to call this method while a previous call is pending.
344    /// Doing so will cause the server end of the protocol to be closed.
345    ///
346    /// - response `dropped_events` the number of events that were dropped
347    ///   _immediately before_ the returned event was queued.
348    ///   returned event.
349    /// - response `addresses` the addresses in the multicast packet triggering
350    ///   the event.
351    /// - response `input_interface` the interface the multicast packet
352    ///   triggering the event arrived at.
353    /// - response `event` the event.
354    pub fn r#watch_routing_events(
355        &self,
356    ) -> fidl::client::QueryResponseFut<
357        (u64, Ipv4UnicastSourceAndMulticastDestination, u64, RoutingEvent),
358        fidl::encoding::DefaultFuchsiaResourceDialect,
359    > {
360        Ipv4RoutingTableControllerProxyInterface::r#watch_routing_events(self)
361    }
362}
363
364impl Ipv4RoutingTableControllerProxyInterface for Ipv4RoutingTableControllerProxy {
365    type AddRouteResponseFut = fidl::client::QueryResponseFut<
366        Ipv4RoutingTableControllerAddRouteResult,
367        fidl::encoding::DefaultFuchsiaResourceDialect,
368    >;
369    fn r#add_route(
370        &self,
371        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
372        mut route: &Route,
373    ) -> Self::AddRouteResponseFut {
374        fn _decode(
375            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
376        ) -> Result<Ipv4RoutingTableControllerAddRouteResult, fidl::Error> {
377            let _response = fidl::client::decode_transaction_body::<
378                fidl::encoding::ResultType<
379                    fidl::encoding::EmptyStruct,
380                    Ipv4RoutingTableControllerAddRouteError,
381                >,
382                fidl::encoding::DefaultFuchsiaResourceDialect,
383                0x6098a90553ef1aed,
384            >(_buf?)?;
385            Ok(_response.map(|x| x))
386        }
387        self.client.send_query_and_decode::<
388            Ipv4RoutingTableControllerAddRouteRequest,
389            Ipv4RoutingTableControllerAddRouteResult,
390        >(
391            (addresses, route,),
392            0x6098a90553ef1aed,
393            fidl::encoding::DynamicFlags::empty(),
394            _decode,
395        )
396    }
397
398    type DelRouteResponseFut = fidl::client::QueryResponseFut<
399        Ipv4RoutingTableControllerDelRouteResult,
400        fidl::encoding::DefaultFuchsiaResourceDialect,
401    >;
402    fn r#del_route(
403        &self,
404        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
405    ) -> Self::DelRouteResponseFut {
406        fn _decode(
407            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
408        ) -> Result<Ipv4RoutingTableControllerDelRouteResult, fidl::Error> {
409            let _response = fidl::client::decode_transaction_body::<
410                fidl::encoding::ResultType<
411                    fidl::encoding::EmptyStruct,
412                    Ipv4RoutingTableControllerDelRouteError,
413                >,
414                fidl::encoding::DefaultFuchsiaResourceDialect,
415                0x14a0727b797aff74,
416            >(_buf?)?;
417            Ok(_response.map(|x| x))
418        }
419        self.client.send_query_and_decode::<
420            Ipv4RoutingTableControllerDelRouteRequest,
421            Ipv4RoutingTableControllerDelRouteResult,
422        >(
423            (addresses,),
424            0x14a0727b797aff74,
425            fidl::encoding::DynamicFlags::empty(),
426            _decode,
427        )
428    }
429
430    type GetRouteStatsResponseFut = fidl::client::QueryResponseFut<
431        Ipv4RoutingTableControllerGetRouteStatsResult,
432        fidl::encoding::DefaultFuchsiaResourceDialect,
433    >;
434    fn r#get_route_stats(
435        &self,
436        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
437    ) -> Self::GetRouteStatsResponseFut {
438        fn _decode(
439            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
440        ) -> Result<Ipv4RoutingTableControllerGetRouteStatsResult, fidl::Error> {
441            let _response = fidl::client::decode_transaction_body::<
442                fidl::encoding::ResultType<
443                    Ipv4RoutingTableControllerGetRouteStatsResponse,
444                    Ipv4RoutingTableControllerGetRouteStatsError,
445                >,
446                fidl::encoding::DefaultFuchsiaResourceDialect,
447                0x176ad8488370c1e9,
448            >(_buf?)?;
449            Ok(_response.map(|x| x.stats))
450        }
451        self.client.send_query_and_decode::<
452            Ipv4RoutingTableControllerGetRouteStatsRequest,
453            Ipv4RoutingTableControllerGetRouteStatsResult,
454        >(
455            (addresses,),
456            0x176ad8488370c1e9,
457            fidl::encoding::DynamicFlags::empty(),
458            _decode,
459        )
460    }
461
462    type WatchRoutingEventsResponseFut = fidl::client::QueryResponseFut<
463        (u64, Ipv4UnicastSourceAndMulticastDestination, u64, RoutingEvent),
464        fidl::encoding::DefaultFuchsiaResourceDialect,
465    >;
466    fn r#watch_routing_events(&self) -> Self::WatchRoutingEventsResponseFut {
467        fn _decode(
468            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
469        ) -> Result<(u64, Ipv4UnicastSourceAndMulticastDestination, u64, RoutingEvent), fidl::Error>
470        {
471            let _response = fidl::client::decode_transaction_body::<
472                Ipv4RoutingTableControllerWatchRoutingEventsResponse,
473                fidl::encoding::DefaultFuchsiaResourceDialect,
474                0x3e4336c50718d7f9,
475            >(_buf?)?;
476            Ok((
477                _response.dropped_events,
478                _response.addresses,
479                _response.input_interface,
480                _response.event,
481            ))
482        }
483        self.client.send_query_and_decode::<
484            fidl::encoding::EmptyPayload,
485            (u64, Ipv4UnicastSourceAndMulticastDestination, u64, RoutingEvent),
486        >(
487            (),
488            0x3e4336c50718d7f9,
489            fidl::encoding::DynamicFlags::empty(),
490            _decode,
491        )
492    }
493}
494
495pub struct Ipv4RoutingTableControllerEventStream {
496    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
497}
498
499impl std::marker::Unpin for Ipv4RoutingTableControllerEventStream {}
500
501impl futures::stream::FusedStream for Ipv4RoutingTableControllerEventStream {
502    fn is_terminated(&self) -> bool {
503        self.event_receiver.is_terminated()
504    }
505}
506
507impl futures::Stream for Ipv4RoutingTableControllerEventStream {
508    type Item = Result<Ipv4RoutingTableControllerEvent, fidl::Error>;
509
510    fn poll_next(
511        mut self: std::pin::Pin<&mut Self>,
512        cx: &mut std::task::Context<'_>,
513    ) -> std::task::Poll<Option<Self::Item>> {
514        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
515            &mut self.event_receiver,
516            cx
517        )?) {
518            Some(buf) => std::task::Poll::Ready(Some(Ipv4RoutingTableControllerEvent::decode(buf))),
519            None => std::task::Poll::Ready(None),
520        }
521    }
522}
523
524#[derive(Debug)]
525pub enum Ipv4RoutingTableControllerEvent {
526    OnClose { error: TableControllerCloseReason },
527}
528
529impl Ipv4RoutingTableControllerEvent {
530    #[allow(irrefutable_let_patterns)]
531    pub fn into_on_close(self) -> Option<TableControllerCloseReason> {
532        if let Ipv4RoutingTableControllerEvent::OnClose { error } = self {
533            Some((error))
534        } else {
535            None
536        }
537    }
538
539    /// Decodes a message buffer as a [`Ipv4RoutingTableControllerEvent`].
540    fn decode(
541        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
542    ) -> Result<Ipv4RoutingTableControllerEvent, fidl::Error> {
543        let (bytes, _handles) = buf.split_mut();
544        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
545        debug_assert_eq!(tx_header.tx_id, 0);
546        match tx_header.ordinal {
547            0x3dec49c6c2070f14 => {
548                let mut out = fidl::new_empty!(Ipv4RoutingTableControllerOnCloseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
549                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv4RoutingTableControllerOnCloseRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
550                Ok((
551                    Ipv4RoutingTableControllerEvent::OnClose {error: out.error,
552
553                    }
554                ))
555            }
556            _ => Err(fidl::Error::UnknownOrdinal {
557                ordinal: tx_header.ordinal,
558                protocol_name: <Ipv4RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
559            })
560        }
561    }
562}
563
564/// A Stream of incoming requests for fuchsia.net.multicast.admin/Ipv4RoutingTableController.
565pub struct Ipv4RoutingTableControllerRequestStream {
566    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
567    is_terminated: bool,
568}
569
570impl std::marker::Unpin for Ipv4RoutingTableControllerRequestStream {}
571
572impl futures::stream::FusedStream for Ipv4RoutingTableControllerRequestStream {
573    fn is_terminated(&self) -> bool {
574        self.is_terminated
575    }
576}
577
578impl fidl::endpoints::RequestStream for Ipv4RoutingTableControllerRequestStream {
579    type Protocol = Ipv4RoutingTableControllerMarker;
580    type ControlHandle = Ipv4RoutingTableControllerControlHandle;
581
582    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
583        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
584    }
585
586    fn control_handle(&self) -> Self::ControlHandle {
587        Ipv4RoutingTableControllerControlHandle { inner: self.inner.clone() }
588    }
589
590    fn into_inner(
591        self,
592    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
593    {
594        (self.inner, self.is_terminated)
595    }
596
597    fn from_inner(
598        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
599        is_terminated: bool,
600    ) -> Self {
601        Self { inner, is_terminated }
602    }
603}
604
605impl futures::Stream for Ipv4RoutingTableControllerRequestStream {
606    type Item = Result<Ipv4RoutingTableControllerRequest, fidl::Error>;
607
608    fn poll_next(
609        mut self: std::pin::Pin<&mut Self>,
610        cx: &mut std::task::Context<'_>,
611    ) -> std::task::Poll<Option<Self::Item>> {
612        let this = &mut *self;
613        if this.inner.check_shutdown(cx) {
614            this.is_terminated = true;
615            return std::task::Poll::Ready(None);
616        }
617        if this.is_terminated {
618            panic!("polled Ipv4RoutingTableControllerRequestStream after completion");
619        }
620        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
621            |bytes, handles| {
622                match this.inner.channel().read_etc(cx, bytes, handles) {
623                    std::task::Poll::Ready(Ok(())) => {}
624                    std::task::Poll::Pending => return std::task::Poll::Pending,
625                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
626                        this.is_terminated = true;
627                        return std::task::Poll::Ready(None);
628                    }
629                    std::task::Poll::Ready(Err(e)) => {
630                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
631                            e.into(),
632                        ))))
633                    }
634                }
635
636                // A message has been received from the channel
637                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
638
639                std::task::Poll::Ready(Some(match header.ordinal {
640                0x6098a90553ef1aed => {
641                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
642                    let mut req = fidl::new_empty!(Ipv4RoutingTableControllerAddRouteRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
643                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv4RoutingTableControllerAddRouteRequest>(&header, _body_bytes, handles, &mut req)?;
644                    let control_handle = Ipv4RoutingTableControllerControlHandle {
645                        inner: this.inner.clone(),
646                    };
647                    Ok(Ipv4RoutingTableControllerRequest::AddRoute {addresses: req.addresses,
648route: req.route,
649
650                        responder: Ipv4RoutingTableControllerAddRouteResponder {
651                            control_handle: std::mem::ManuallyDrop::new(control_handle),
652                            tx_id: header.tx_id,
653                        },
654                    })
655                }
656                0x14a0727b797aff74 => {
657                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
658                    let mut req = fidl::new_empty!(Ipv4RoutingTableControllerDelRouteRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
659                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv4RoutingTableControllerDelRouteRequest>(&header, _body_bytes, handles, &mut req)?;
660                    let control_handle = Ipv4RoutingTableControllerControlHandle {
661                        inner: this.inner.clone(),
662                    };
663                    Ok(Ipv4RoutingTableControllerRequest::DelRoute {addresses: req.addresses,
664
665                        responder: Ipv4RoutingTableControllerDelRouteResponder {
666                            control_handle: std::mem::ManuallyDrop::new(control_handle),
667                            tx_id: header.tx_id,
668                        },
669                    })
670                }
671                0x176ad8488370c1e9 => {
672                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
673                    let mut req = fidl::new_empty!(Ipv4RoutingTableControllerGetRouteStatsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
674                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv4RoutingTableControllerGetRouteStatsRequest>(&header, _body_bytes, handles, &mut req)?;
675                    let control_handle = Ipv4RoutingTableControllerControlHandle {
676                        inner: this.inner.clone(),
677                    };
678                    Ok(Ipv4RoutingTableControllerRequest::GetRouteStats {addresses: req.addresses,
679
680                        responder: Ipv4RoutingTableControllerGetRouteStatsResponder {
681                            control_handle: std::mem::ManuallyDrop::new(control_handle),
682                            tx_id: header.tx_id,
683                        },
684                    })
685                }
686                0x3e4336c50718d7f9 => {
687                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
688                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
689                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
690                    let control_handle = Ipv4RoutingTableControllerControlHandle {
691                        inner: this.inner.clone(),
692                    };
693                    Ok(Ipv4RoutingTableControllerRequest::WatchRoutingEvents {
694                        responder: Ipv4RoutingTableControllerWatchRoutingEventsResponder {
695                            control_handle: std::mem::ManuallyDrop::new(control_handle),
696                            tx_id: header.tx_id,
697                        },
698                    })
699                }
700                _ => Err(fidl::Error::UnknownOrdinal {
701                    ordinal: header.ordinal,
702                    protocol_name: <Ipv4RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
703                }),
704            }))
705            },
706        )
707    }
708}
709
710/// The IPv4 multicast routing controller.
711///
712/// Closing the client-end of the controller will disable multicast routing and
713/// clear the multicast routing table.
714#[derive(Debug)]
715pub enum Ipv4RoutingTableControllerRequest {
716    /// Adds a route such that packets matching the addresses will be forwarded
717    /// accordingly.
718    ///
719    /// The provided addresses act as the key for the route; any existing route
720    /// with the same addresses will be overwritten when this route is
721    /// installed.
722    ///
723    /// If a packet arrives at an interface different from the expected input
724    /// interface set in the route, the packet will not be forwarded and a
725    /// [`RoutingEvent.wrong_input_interface`] event will be sent to the client.
726    /// See [`WatchRoutingEvents`] for more details.
727    ///
728    /// + request `addresses` the addresses used to identify a route.
729    /// + request `route` the multicast route.
730    AddRoute {
731        addresses: Ipv4UnicastSourceAndMulticastDestination,
732        route: Route,
733        responder: Ipv4RoutingTableControllerAddRouteResponder,
734    },
735    /// Delete a route.
736    ///
737    /// + request `addresses` the addresses used to identify a route.
738    DelRoute {
739        addresses: Ipv4UnicastSourceAndMulticastDestination,
740        responder: Ipv4RoutingTableControllerDelRouteResponder,
741    },
742    /// Get a snapshot of statistics about a specific route.
743    ///
744    /// + request `addresses` the addresses used to identify a route.
745    GetRouteStats {
746        addresses: Ipv4UnicastSourceAndMulticastDestination,
747        responder: Ipv4RoutingTableControllerGetRouteStatsResponder,
748    },
749    /// Watch for events triggered by multicast packets.
750    ///
751    /// The server will queue events to return when this method is called. If no
752    /// events are ready, the call will block until an event is ready. The
753    /// server will drop new events if the client is not consuming them fast
754    /// enough and return the number of events dropped in-between events.
755    ///
756    /// It is invalid to call this method while a previous call is pending.
757    /// Doing so will cause the server end of the protocol to be closed.
758    ///
759    /// - response `dropped_events` the number of events that were dropped
760    ///   _immediately before_ the returned event was queued.
761    ///   returned event.
762    /// - response `addresses` the addresses in the multicast packet triggering
763    ///   the event.
764    /// - response `input_interface` the interface the multicast packet
765    ///   triggering the event arrived at.
766    /// - response `event` the event.
767    WatchRoutingEvents { responder: Ipv4RoutingTableControllerWatchRoutingEventsResponder },
768}
769
770impl Ipv4RoutingTableControllerRequest {
771    #[allow(irrefutable_let_patterns)]
772    pub fn into_add_route(
773        self,
774    ) -> Option<(
775        Ipv4UnicastSourceAndMulticastDestination,
776        Route,
777        Ipv4RoutingTableControllerAddRouteResponder,
778    )> {
779        if let Ipv4RoutingTableControllerRequest::AddRoute { addresses, route, responder } = self {
780            Some((addresses, route, responder))
781        } else {
782            None
783        }
784    }
785
786    #[allow(irrefutable_let_patterns)]
787    pub fn into_del_route(
788        self,
789    ) -> Option<(
790        Ipv4UnicastSourceAndMulticastDestination,
791        Ipv4RoutingTableControllerDelRouteResponder,
792    )> {
793        if let Ipv4RoutingTableControllerRequest::DelRoute { addresses, responder } = self {
794            Some((addresses, responder))
795        } else {
796            None
797        }
798    }
799
800    #[allow(irrefutable_let_patterns)]
801    pub fn into_get_route_stats(
802        self,
803    ) -> Option<(
804        Ipv4UnicastSourceAndMulticastDestination,
805        Ipv4RoutingTableControllerGetRouteStatsResponder,
806    )> {
807        if let Ipv4RoutingTableControllerRequest::GetRouteStats { addresses, responder } = self {
808            Some((addresses, responder))
809        } else {
810            None
811        }
812    }
813
814    #[allow(irrefutable_let_patterns)]
815    pub fn into_watch_routing_events(
816        self,
817    ) -> Option<(Ipv4RoutingTableControllerWatchRoutingEventsResponder)> {
818        if let Ipv4RoutingTableControllerRequest::WatchRoutingEvents { responder } = self {
819            Some((responder))
820        } else {
821            None
822        }
823    }
824
825    /// Name of the method defined in FIDL
826    pub fn method_name(&self) -> &'static str {
827        match *self {
828            Ipv4RoutingTableControllerRequest::AddRoute { .. } => "add_route",
829            Ipv4RoutingTableControllerRequest::DelRoute { .. } => "del_route",
830            Ipv4RoutingTableControllerRequest::GetRouteStats { .. } => "get_route_stats",
831            Ipv4RoutingTableControllerRequest::WatchRoutingEvents { .. } => "watch_routing_events",
832        }
833    }
834}
835
836#[derive(Debug, Clone)]
837pub struct Ipv4RoutingTableControllerControlHandle {
838    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
839}
840
841impl fidl::endpoints::ControlHandle for Ipv4RoutingTableControllerControlHandle {
842    fn shutdown(&self) {
843        self.inner.shutdown()
844    }
845    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
846        self.inner.shutdown_with_epitaph(status)
847    }
848
849    fn is_closed(&self) -> bool {
850        self.inner.channel().is_closed()
851    }
852    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
853        self.inner.channel().on_closed()
854    }
855
856    #[cfg(target_os = "fuchsia")]
857    fn signal_peer(
858        &self,
859        clear_mask: zx::Signals,
860        set_mask: zx::Signals,
861    ) -> Result<(), zx_status::Status> {
862        use fidl::Peered;
863        self.inner.channel().signal_peer(clear_mask, set_mask)
864    }
865}
866
867impl Ipv4RoutingTableControllerControlHandle {
868    pub fn send_on_close(&self, mut error: TableControllerCloseReason) -> Result<(), fidl::Error> {
869        self.inner.send::<Ipv4RoutingTableControllerOnCloseRequest>(
870            (error,),
871            0,
872            0x3dec49c6c2070f14,
873            fidl::encoding::DynamicFlags::empty(),
874        )
875    }
876}
877
878#[must_use = "FIDL methods require a response to be sent"]
879#[derive(Debug)]
880pub struct Ipv4RoutingTableControllerAddRouteResponder {
881    control_handle: std::mem::ManuallyDrop<Ipv4RoutingTableControllerControlHandle>,
882    tx_id: u32,
883}
884
885/// Set the the channel to be shutdown (see [`Ipv4RoutingTableControllerControlHandle::shutdown`])
886/// if the responder is dropped without sending a response, so that the client
887/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
888impl std::ops::Drop for Ipv4RoutingTableControllerAddRouteResponder {
889    fn drop(&mut self) {
890        self.control_handle.shutdown();
891        // Safety: drops once, never accessed again
892        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
893    }
894}
895
896impl fidl::endpoints::Responder for Ipv4RoutingTableControllerAddRouteResponder {
897    type ControlHandle = Ipv4RoutingTableControllerControlHandle;
898
899    fn control_handle(&self) -> &Ipv4RoutingTableControllerControlHandle {
900        &self.control_handle
901    }
902
903    fn drop_without_shutdown(mut self) {
904        // Safety: drops once, never accessed again due to mem::forget
905        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
906        // Prevent Drop from running (which would shut down the channel)
907        std::mem::forget(self);
908    }
909}
910
911impl Ipv4RoutingTableControllerAddRouteResponder {
912    /// Sends a response to the FIDL transaction.
913    ///
914    /// Sets the channel to shutdown if an error occurs.
915    pub fn send(
916        self,
917        mut result: Result<(), Ipv4RoutingTableControllerAddRouteError>,
918    ) -> Result<(), fidl::Error> {
919        let _result = self.send_raw(result);
920        if _result.is_err() {
921            self.control_handle.shutdown();
922        }
923        self.drop_without_shutdown();
924        _result
925    }
926
927    /// Similar to "send" but does not shutdown the channel if an error occurs.
928    pub fn send_no_shutdown_on_err(
929        self,
930        mut result: Result<(), Ipv4RoutingTableControllerAddRouteError>,
931    ) -> Result<(), fidl::Error> {
932        let _result = self.send_raw(result);
933        self.drop_without_shutdown();
934        _result
935    }
936
937    fn send_raw(
938        &self,
939        mut result: Result<(), Ipv4RoutingTableControllerAddRouteError>,
940    ) -> Result<(), fidl::Error> {
941        self.control_handle.inner.send::<fidl::encoding::ResultType<
942            fidl::encoding::EmptyStruct,
943            Ipv4RoutingTableControllerAddRouteError,
944        >>(
945            result,
946            self.tx_id,
947            0x6098a90553ef1aed,
948            fidl::encoding::DynamicFlags::empty(),
949        )
950    }
951}
952
953#[must_use = "FIDL methods require a response to be sent"]
954#[derive(Debug)]
955pub struct Ipv4RoutingTableControllerDelRouteResponder {
956    control_handle: std::mem::ManuallyDrop<Ipv4RoutingTableControllerControlHandle>,
957    tx_id: u32,
958}
959
960/// Set the the channel to be shutdown (see [`Ipv4RoutingTableControllerControlHandle::shutdown`])
961/// if the responder is dropped without sending a response, so that the client
962/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
963impl std::ops::Drop for Ipv4RoutingTableControllerDelRouteResponder {
964    fn drop(&mut self) {
965        self.control_handle.shutdown();
966        // Safety: drops once, never accessed again
967        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
968    }
969}
970
971impl fidl::endpoints::Responder for Ipv4RoutingTableControllerDelRouteResponder {
972    type ControlHandle = Ipv4RoutingTableControllerControlHandle;
973
974    fn control_handle(&self) -> &Ipv4RoutingTableControllerControlHandle {
975        &self.control_handle
976    }
977
978    fn drop_without_shutdown(mut self) {
979        // Safety: drops once, never accessed again due to mem::forget
980        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
981        // Prevent Drop from running (which would shut down the channel)
982        std::mem::forget(self);
983    }
984}
985
986impl Ipv4RoutingTableControllerDelRouteResponder {
987    /// Sends a response to the FIDL transaction.
988    ///
989    /// Sets the channel to shutdown if an error occurs.
990    pub fn send(
991        self,
992        mut result: Result<(), Ipv4RoutingTableControllerDelRouteError>,
993    ) -> Result<(), fidl::Error> {
994        let _result = self.send_raw(result);
995        if _result.is_err() {
996            self.control_handle.shutdown();
997        }
998        self.drop_without_shutdown();
999        _result
1000    }
1001
1002    /// Similar to "send" but does not shutdown the channel if an error occurs.
1003    pub fn send_no_shutdown_on_err(
1004        self,
1005        mut result: Result<(), Ipv4RoutingTableControllerDelRouteError>,
1006    ) -> Result<(), fidl::Error> {
1007        let _result = self.send_raw(result);
1008        self.drop_without_shutdown();
1009        _result
1010    }
1011
1012    fn send_raw(
1013        &self,
1014        mut result: Result<(), Ipv4RoutingTableControllerDelRouteError>,
1015    ) -> Result<(), fidl::Error> {
1016        self.control_handle.inner.send::<fidl::encoding::ResultType<
1017            fidl::encoding::EmptyStruct,
1018            Ipv4RoutingTableControllerDelRouteError,
1019        >>(
1020            result,
1021            self.tx_id,
1022            0x14a0727b797aff74,
1023            fidl::encoding::DynamicFlags::empty(),
1024        )
1025    }
1026}
1027
1028#[must_use = "FIDL methods require a response to be sent"]
1029#[derive(Debug)]
1030pub struct Ipv4RoutingTableControllerGetRouteStatsResponder {
1031    control_handle: std::mem::ManuallyDrop<Ipv4RoutingTableControllerControlHandle>,
1032    tx_id: u32,
1033}
1034
1035/// Set the the channel to be shutdown (see [`Ipv4RoutingTableControllerControlHandle::shutdown`])
1036/// if the responder is dropped without sending a response, so that the client
1037/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1038impl std::ops::Drop for Ipv4RoutingTableControllerGetRouteStatsResponder {
1039    fn drop(&mut self) {
1040        self.control_handle.shutdown();
1041        // Safety: drops once, never accessed again
1042        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1043    }
1044}
1045
1046impl fidl::endpoints::Responder for Ipv4RoutingTableControllerGetRouteStatsResponder {
1047    type ControlHandle = Ipv4RoutingTableControllerControlHandle;
1048
1049    fn control_handle(&self) -> &Ipv4RoutingTableControllerControlHandle {
1050        &self.control_handle
1051    }
1052
1053    fn drop_without_shutdown(mut self) {
1054        // Safety: drops once, never accessed again due to mem::forget
1055        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1056        // Prevent Drop from running (which would shut down the channel)
1057        std::mem::forget(self);
1058    }
1059}
1060
1061impl Ipv4RoutingTableControllerGetRouteStatsResponder {
1062    /// Sends a response to the FIDL transaction.
1063    ///
1064    /// Sets the channel to shutdown if an error occurs.
1065    pub fn send(
1066        self,
1067        mut result: Result<&RouteStats, Ipv4RoutingTableControllerGetRouteStatsError>,
1068    ) -> Result<(), fidl::Error> {
1069        let _result = self.send_raw(result);
1070        if _result.is_err() {
1071            self.control_handle.shutdown();
1072        }
1073        self.drop_without_shutdown();
1074        _result
1075    }
1076
1077    /// Similar to "send" but does not shutdown the channel if an error occurs.
1078    pub fn send_no_shutdown_on_err(
1079        self,
1080        mut result: Result<&RouteStats, Ipv4RoutingTableControllerGetRouteStatsError>,
1081    ) -> Result<(), fidl::Error> {
1082        let _result = self.send_raw(result);
1083        self.drop_without_shutdown();
1084        _result
1085    }
1086
1087    fn send_raw(
1088        &self,
1089        mut result: Result<&RouteStats, Ipv4RoutingTableControllerGetRouteStatsError>,
1090    ) -> Result<(), fidl::Error> {
1091        self.control_handle.inner.send::<fidl::encoding::ResultType<
1092            Ipv4RoutingTableControllerGetRouteStatsResponse,
1093            Ipv4RoutingTableControllerGetRouteStatsError,
1094        >>(
1095            result.map(|stats| (stats,)),
1096            self.tx_id,
1097            0x176ad8488370c1e9,
1098            fidl::encoding::DynamicFlags::empty(),
1099        )
1100    }
1101}
1102
1103#[must_use = "FIDL methods require a response to be sent"]
1104#[derive(Debug)]
1105pub struct Ipv4RoutingTableControllerWatchRoutingEventsResponder {
1106    control_handle: std::mem::ManuallyDrop<Ipv4RoutingTableControllerControlHandle>,
1107    tx_id: u32,
1108}
1109
1110/// Set the the channel to be shutdown (see [`Ipv4RoutingTableControllerControlHandle::shutdown`])
1111/// if the responder is dropped without sending a response, so that the client
1112/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1113impl std::ops::Drop for Ipv4RoutingTableControllerWatchRoutingEventsResponder {
1114    fn drop(&mut self) {
1115        self.control_handle.shutdown();
1116        // Safety: drops once, never accessed again
1117        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1118    }
1119}
1120
1121impl fidl::endpoints::Responder for Ipv4RoutingTableControllerWatchRoutingEventsResponder {
1122    type ControlHandle = Ipv4RoutingTableControllerControlHandle;
1123
1124    fn control_handle(&self) -> &Ipv4RoutingTableControllerControlHandle {
1125        &self.control_handle
1126    }
1127
1128    fn drop_without_shutdown(mut self) {
1129        // Safety: drops once, never accessed again due to mem::forget
1130        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1131        // Prevent Drop from running (which would shut down the channel)
1132        std::mem::forget(self);
1133    }
1134}
1135
1136impl Ipv4RoutingTableControllerWatchRoutingEventsResponder {
1137    /// Sends a response to the FIDL transaction.
1138    ///
1139    /// Sets the channel to shutdown if an error occurs.
1140    pub fn send(
1141        self,
1142        mut dropped_events: u64,
1143        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
1144        mut input_interface: u64,
1145        mut event: &RoutingEvent,
1146    ) -> Result<(), fidl::Error> {
1147        let _result = self.send_raw(dropped_events, addresses, input_interface, event);
1148        if _result.is_err() {
1149            self.control_handle.shutdown();
1150        }
1151        self.drop_without_shutdown();
1152        _result
1153    }
1154
1155    /// Similar to "send" but does not shutdown the channel if an error occurs.
1156    pub fn send_no_shutdown_on_err(
1157        self,
1158        mut dropped_events: u64,
1159        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
1160        mut input_interface: u64,
1161        mut event: &RoutingEvent,
1162    ) -> Result<(), fidl::Error> {
1163        let _result = self.send_raw(dropped_events, addresses, input_interface, event);
1164        self.drop_without_shutdown();
1165        _result
1166    }
1167
1168    fn send_raw(
1169        &self,
1170        mut dropped_events: u64,
1171        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
1172        mut input_interface: u64,
1173        mut event: &RoutingEvent,
1174    ) -> Result<(), fidl::Error> {
1175        self.control_handle.inner.send::<Ipv4RoutingTableControllerWatchRoutingEventsResponse>(
1176            (dropped_events, addresses, input_interface, event),
1177            self.tx_id,
1178            0x3e4336c50718d7f9,
1179            fidl::encoding::DynamicFlags::empty(),
1180        )
1181    }
1182}
1183
1184#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1185pub struct Ipv6RoutingTableControllerMarker;
1186
1187impl fidl::endpoints::ProtocolMarker for Ipv6RoutingTableControllerMarker {
1188    type Proxy = Ipv6RoutingTableControllerProxy;
1189    type RequestStream = Ipv6RoutingTableControllerRequestStream;
1190    #[cfg(target_os = "fuchsia")]
1191    type SynchronousProxy = Ipv6RoutingTableControllerSynchronousProxy;
1192
1193    const DEBUG_NAME: &'static str = "fuchsia.net.multicast.admin.Ipv6RoutingTableController";
1194}
1195impl fidl::endpoints::DiscoverableProtocolMarker for Ipv6RoutingTableControllerMarker {}
1196pub type Ipv6RoutingTableControllerAddRouteResult =
1197    Result<(), Ipv6RoutingTableControllerAddRouteError>;
1198pub type Ipv6RoutingTableControllerDelRouteResult =
1199    Result<(), Ipv6RoutingTableControllerDelRouteError>;
1200pub type Ipv6RoutingTableControllerGetRouteStatsResult =
1201    Result<RouteStats, Ipv6RoutingTableControllerGetRouteStatsError>;
1202
1203pub trait Ipv6RoutingTableControllerProxyInterface: Send + Sync {
1204    type AddRouteResponseFut: std::future::Future<Output = Result<Ipv6RoutingTableControllerAddRouteResult, fidl::Error>>
1205        + Send;
1206    fn r#add_route(
1207        &self,
1208        addresses: &Ipv6UnicastSourceAndMulticastDestination,
1209        route: &Route,
1210    ) -> Self::AddRouteResponseFut;
1211    type DelRouteResponseFut: std::future::Future<Output = Result<Ipv6RoutingTableControllerDelRouteResult, fidl::Error>>
1212        + Send;
1213    fn r#del_route(
1214        &self,
1215        addresses: &Ipv6UnicastSourceAndMulticastDestination,
1216    ) -> Self::DelRouteResponseFut;
1217    type GetRouteStatsResponseFut: std::future::Future<
1218            Output = Result<Ipv6RoutingTableControllerGetRouteStatsResult, fidl::Error>,
1219        > + Send;
1220    fn r#get_route_stats(
1221        &self,
1222        addresses: &Ipv6UnicastSourceAndMulticastDestination,
1223    ) -> Self::GetRouteStatsResponseFut;
1224    type WatchRoutingEventsResponseFut: std::future::Future<
1225            Output = Result<
1226                (u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent),
1227                fidl::Error,
1228            >,
1229        > + Send;
1230    fn r#watch_routing_events(&self) -> Self::WatchRoutingEventsResponseFut;
1231}
1232#[derive(Debug)]
1233#[cfg(target_os = "fuchsia")]
1234pub struct Ipv6RoutingTableControllerSynchronousProxy {
1235    client: fidl::client::sync::Client,
1236}
1237
1238#[cfg(target_os = "fuchsia")]
1239impl fidl::endpoints::SynchronousProxy for Ipv6RoutingTableControllerSynchronousProxy {
1240    type Proxy = Ipv6RoutingTableControllerProxy;
1241    type Protocol = Ipv6RoutingTableControllerMarker;
1242
1243    fn from_channel(inner: fidl::Channel) -> Self {
1244        Self::new(inner)
1245    }
1246
1247    fn into_channel(self) -> fidl::Channel {
1248        self.client.into_channel()
1249    }
1250
1251    fn as_channel(&self) -> &fidl::Channel {
1252        self.client.as_channel()
1253    }
1254}
1255
1256#[cfg(target_os = "fuchsia")]
1257impl Ipv6RoutingTableControllerSynchronousProxy {
1258    pub fn new(channel: fidl::Channel) -> Self {
1259        let protocol_name =
1260            <Ipv6RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1261        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1262    }
1263
1264    pub fn into_channel(self) -> fidl::Channel {
1265        self.client.into_channel()
1266    }
1267
1268    /// Waits until an event arrives and returns it. It is safe for other
1269    /// threads to make concurrent requests while waiting for an event.
1270    pub fn wait_for_event(
1271        &self,
1272        deadline: zx::MonotonicInstant,
1273    ) -> Result<Ipv6RoutingTableControllerEvent, fidl::Error> {
1274        Ipv6RoutingTableControllerEvent::decode(self.client.wait_for_event(deadline)?)
1275    }
1276
1277    /// Adds a route such that packets matching the addresses will be forwarded
1278    /// accordingly.
1279    ///
1280    /// The provided addresses act as the key for the route; any existing route
1281    /// with the same addresses will be overwritten when this route is
1282    /// installed.
1283    ///
1284    /// If a packet arrives at an interface different from the expected input
1285    /// interface set in the route, the packet will not be forwarded and a
1286    /// [`RoutingEvent.wrong_input_interface`] event will be sent to the client.
1287    /// See [`WatchRoutingEvents`] for more details.
1288    ///
1289    /// + request `addresses` the addresses used to identify a route.
1290    /// + request `route` the multicast route.
1291    pub fn r#add_route(
1292        &self,
1293        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1294        mut route: &Route,
1295        ___deadline: zx::MonotonicInstant,
1296    ) -> Result<Ipv6RoutingTableControllerAddRouteResult, fidl::Error> {
1297        let _response = self
1298            .client
1299            .send_query::<Ipv6RoutingTableControllerAddRouteRequest, fidl::encoding::ResultType<
1300                fidl::encoding::EmptyStruct,
1301                Ipv6RoutingTableControllerAddRouteError,
1302            >>(
1303                (addresses, route),
1304                0x71ca1f54a716de90,
1305                fidl::encoding::DynamicFlags::empty(),
1306                ___deadline,
1307            )?;
1308        Ok(_response.map(|x| x))
1309    }
1310
1311    /// Delete a route.
1312    ///
1313    /// + request `addresses` the addresses used to identify a route.
1314    pub fn r#del_route(
1315        &self,
1316        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1317        ___deadline: zx::MonotonicInstant,
1318    ) -> Result<Ipv6RoutingTableControllerDelRouteResult, fidl::Error> {
1319        let _response = self
1320            .client
1321            .send_query::<Ipv6RoutingTableControllerDelRouteRequest, fidl::encoding::ResultType<
1322                fidl::encoding::EmptyStruct,
1323                Ipv6RoutingTableControllerDelRouteError,
1324            >>(
1325                (addresses,),
1326                0x35b6c2ce4a7b3f13,
1327                fidl::encoding::DynamicFlags::empty(),
1328                ___deadline,
1329            )?;
1330        Ok(_response.map(|x| x))
1331    }
1332
1333    /// Get a snapshot of statistics about a specific route.
1334    ///
1335    /// + request `addresses` the addresses used to identify a route.
1336    pub fn r#get_route_stats(
1337        &self,
1338        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1339        ___deadline: zx::MonotonicInstant,
1340    ) -> Result<Ipv6RoutingTableControllerGetRouteStatsResult, fidl::Error> {
1341        let _response = self.client.send_query::<
1342            Ipv6RoutingTableControllerGetRouteStatsRequest,
1343            fidl::encoding::ResultType<Ipv6RoutingTableControllerGetRouteStatsResponse, Ipv6RoutingTableControllerGetRouteStatsError>,
1344        >(
1345            (addresses,),
1346            0x6d7fa5e9f18ef79f,
1347            fidl::encoding::DynamicFlags::empty(),
1348            ___deadline,
1349        )?;
1350        Ok(_response.map(|x| x.stats))
1351    }
1352
1353    /// Watch for events triggered by multicast packets.
1354    ///
1355    /// The server will queue events to return when this method is called. If no
1356    /// events are ready, the call will block until an event is ready. The
1357    /// server will drop new events if the client is not consuming them fast
1358    /// enough and return the number of events dropped in-between events.
1359    ///
1360    /// It is invalid to call this method while a previous call is pending.
1361    /// Doing so will cause the server end of the protocol to be closed.
1362    ///
1363    /// - response `dropped_events` the number of events that were dropped
1364    ///   _immediately before_ the returned event was queued.
1365    ///   returned event.
1366    /// - response `addresses` the addresses in the multicast packet triggering
1367    ///   the event.
1368    /// - response `input_interface` the interface the multicast packet
1369    ///   triggering the event arrived at.
1370    /// - response `event` the event.
1371    pub fn r#watch_routing_events(
1372        &self,
1373        ___deadline: zx::MonotonicInstant,
1374    ) -> Result<(u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent), fidl::Error>
1375    {
1376        let _response = self.client.send_query::<
1377            fidl::encoding::EmptyPayload,
1378            Ipv6RoutingTableControllerWatchRoutingEventsResponse,
1379        >(
1380            (),
1381            0x22a94526a0ea1078,
1382            fidl::encoding::DynamicFlags::empty(),
1383            ___deadline,
1384        )?;
1385        Ok((
1386            _response.dropped_events,
1387            _response.addresses,
1388            _response.input_interface,
1389            _response.event,
1390        ))
1391    }
1392}
1393
1394#[cfg(target_os = "fuchsia")]
1395impl From<Ipv6RoutingTableControllerSynchronousProxy> for zx::Handle {
1396    fn from(value: Ipv6RoutingTableControllerSynchronousProxy) -> Self {
1397        value.into_channel().into()
1398    }
1399}
1400
1401#[cfg(target_os = "fuchsia")]
1402impl From<fidl::Channel> for Ipv6RoutingTableControllerSynchronousProxy {
1403    fn from(value: fidl::Channel) -> Self {
1404        Self::new(value)
1405    }
1406}
1407
1408#[cfg(target_os = "fuchsia")]
1409impl fidl::endpoints::FromClient for Ipv6RoutingTableControllerSynchronousProxy {
1410    type Protocol = Ipv6RoutingTableControllerMarker;
1411
1412    fn from_client(value: fidl::endpoints::ClientEnd<Ipv6RoutingTableControllerMarker>) -> Self {
1413        Self::new(value.into_channel())
1414    }
1415}
1416
1417#[derive(Debug, Clone)]
1418pub struct Ipv6RoutingTableControllerProxy {
1419    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1420}
1421
1422impl fidl::endpoints::Proxy for Ipv6RoutingTableControllerProxy {
1423    type Protocol = Ipv6RoutingTableControllerMarker;
1424
1425    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1426        Self::new(inner)
1427    }
1428
1429    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1430        self.client.into_channel().map_err(|client| Self { client })
1431    }
1432
1433    fn as_channel(&self) -> &::fidl::AsyncChannel {
1434        self.client.as_channel()
1435    }
1436}
1437
1438impl Ipv6RoutingTableControllerProxy {
1439    /// Create a new Proxy for fuchsia.net.multicast.admin/Ipv6RoutingTableController.
1440    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1441        let protocol_name =
1442            <Ipv6RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1443        Self { client: fidl::client::Client::new(channel, protocol_name) }
1444    }
1445
1446    /// Get a Stream of events from the remote end of the protocol.
1447    ///
1448    /// # Panics
1449    ///
1450    /// Panics if the event stream was already taken.
1451    pub fn take_event_stream(&self) -> Ipv6RoutingTableControllerEventStream {
1452        Ipv6RoutingTableControllerEventStream { event_receiver: self.client.take_event_receiver() }
1453    }
1454
1455    /// Adds a route such that packets matching the addresses will be forwarded
1456    /// accordingly.
1457    ///
1458    /// The provided addresses act as the key for the route; any existing route
1459    /// with the same addresses will be overwritten when this route is
1460    /// installed.
1461    ///
1462    /// If a packet arrives at an interface different from the expected input
1463    /// interface set in the route, the packet will not be forwarded and a
1464    /// [`RoutingEvent.wrong_input_interface`] event will be sent to the client.
1465    /// See [`WatchRoutingEvents`] for more details.
1466    ///
1467    /// + request `addresses` the addresses used to identify a route.
1468    /// + request `route` the multicast route.
1469    pub fn r#add_route(
1470        &self,
1471        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1472        mut route: &Route,
1473    ) -> fidl::client::QueryResponseFut<
1474        Ipv6RoutingTableControllerAddRouteResult,
1475        fidl::encoding::DefaultFuchsiaResourceDialect,
1476    > {
1477        Ipv6RoutingTableControllerProxyInterface::r#add_route(self, addresses, route)
1478    }
1479
1480    /// Delete a route.
1481    ///
1482    /// + request `addresses` the addresses used to identify a route.
1483    pub fn r#del_route(
1484        &self,
1485        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1486    ) -> fidl::client::QueryResponseFut<
1487        Ipv6RoutingTableControllerDelRouteResult,
1488        fidl::encoding::DefaultFuchsiaResourceDialect,
1489    > {
1490        Ipv6RoutingTableControllerProxyInterface::r#del_route(self, addresses)
1491    }
1492
1493    /// Get a snapshot of statistics about a specific route.
1494    ///
1495    /// + request `addresses` the addresses used to identify a route.
1496    pub fn r#get_route_stats(
1497        &self,
1498        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1499    ) -> fidl::client::QueryResponseFut<
1500        Ipv6RoutingTableControllerGetRouteStatsResult,
1501        fidl::encoding::DefaultFuchsiaResourceDialect,
1502    > {
1503        Ipv6RoutingTableControllerProxyInterface::r#get_route_stats(self, addresses)
1504    }
1505
1506    /// Watch for events triggered by multicast packets.
1507    ///
1508    /// The server will queue events to return when this method is called. If no
1509    /// events are ready, the call will block until an event is ready. The
1510    /// server will drop new events if the client is not consuming them fast
1511    /// enough and return the number of events dropped in-between events.
1512    ///
1513    /// It is invalid to call this method while a previous call is pending.
1514    /// Doing so will cause the server end of the protocol to be closed.
1515    ///
1516    /// - response `dropped_events` the number of events that were dropped
1517    ///   _immediately before_ the returned event was queued.
1518    ///   returned event.
1519    /// - response `addresses` the addresses in the multicast packet triggering
1520    ///   the event.
1521    /// - response `input_interface` the interface the multicast packet
1522    ///   triggering the event arrived at.
1523    /// - response `event` the event.
1524    pub fn r#watch_routing_events(
1525        &self,
1526    ) -> fidl::client::QueryResponseFut<
1527        (u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent),
1528        fidl::encoding::DefaultFuchsiaResourceDialect,
1529    > {
1530        Ipv6RoutingTableControllerProxyInterface::r#watch_routing_events(self)
1531    }
1532}
1533
1534impl Ipv6RoutingTableControllerProxyInterface for Ipv6RoutingTableControllerProxy {
1535    type AddRouteResponseFut = fidl::client::QueryResponseFut<
1536        Ipv6RoutingTableControllerAddRouteResult,
1537        fidl::encoding::DefaultFuchsiaResourceDialect,
1538    >;
1539    fn r#add_route(
1540        &self,
1541        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1542        mut route: &Route,
1543    ) -> Self::AddRouteResponseFut {
1544        fn _decode(
1545            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1546        ) -> Result<Ipv6RoutingTableControllerAddRouteResult, fidl::Error> {
1547            let _response = fidl::client::decode_transaction_body::<
1548                fidl::encoding::ResultType<
1549                    fidl::encoding::EmptyStruct,
1550                    Ipv6RoutingTableControllerAddRouteError,
1551                >,
1552                fidl::encoding::DefaultFuchsiaResourceDialect,
1553                0x71ca1f54a716de90,
1554            >(_buf?)?;
1555            Ok(_response.map(|x| x))
1556        }
1557        self.client.send_query_and_decode::<
1558            Ipv6RoutingTableControllerAddRouteRequest,
1559            Ipv6RoutingTableControllerAddRouteResult,
1560        >(
1561            (addresses, route,),
1562            0x71ca1f54a716de90,
1563            fidl::encoding::DynamicFlags::empty(),
1564            _decode,
1565        )
1566    }
1567
1568    type DelRouteResponseFut = fidl::client::QueryResponseFut<
1569        Ipv6RoutingTableControllerDelRouteResult,
1570        fidl::encoding::DefaultFuchsiaResourceDialect,
1571    >;
1572    fn r#del_route(
1573        &self,
1574        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1575    ) -> Self::DelRouteResponseFut {
1576        fn _decode(
1577            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1578        ) -> Result<Ipv6RoutingTableControllerDelRouteResult, fidl::Error> {
1579            let _response = fidl::client::decode_transaction_body::<
1580                fidl::encoding::ResultType<
1581                    fidl::encoding::EmptyStruct,
1582                    Ipv6RoutingTableControllerDelRouteError,
1583                >,
1584                fidl::encoding::DefaultFuchsiaResourceDialect,
1585                0x35b6c2ce4a7b3f13,
1586            >(_buf?)?;
1587            Ok(_response.map(|x| x))
1588        }
1589        self.client.send_query_and_decode::<
1590            Ipv6RoutingTableControllerDelRouteRequest,
1591            Ipv6RoutingTableControllerDelRouteResult,
1592        >(
1593            (addresses,),
1594            0x35b6c2ce4a7b3f13,
1595            fidl::encoding::DynamicFlags::empty(),
1596            _decode,
1597        )
1598    }
1599
1600    type GetRouteStatsResponseFut = fidl::client::QueryResponseFut<
1601        Ipv6RoutingTableControllerGetRouteStatsResult,
1602        fidl::encoding::DefaultFuchsiaResourceDialect,
1603    >;
1604    fn r#get_route_stats(
1605        &self,
1606        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1607    ) -> Self::GetRouteStatsResponseFut {
1608        fn _decode(
1609            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1610        ) -> Result<Ipv6RoutingTableControllerGetRouteStatsResult, fidl::Error> {
1611            let _response = fidl::client::decode_transaction_body::<
1612                fidl::encoding::ResultType<
1613                    Ipv6RoutingTableControllerGetRouteStatsResponse,
1614                    Ipv6RoutingTableControllerGetRouteStatsError,
1615                >,
1616                fidl::encoding::DefaultFuchsiaResourceDialect,
1617                0x6d7fa5e9f18ef79f,
1618            >(_buf?)?;
1619            Ok(_response.map(|x| x.stats))
1620        }
1621        self.client.send_query_and_decode::<
1622            Ipv6RoutingTableControllerGetRouteStatsRequest,
1623            Ipv6RoutingTableControllerGetRouteStatsResult,
1624        >(
1625            (addresses,),
1626            0x6d7fa5e9f18ef79f,
1627            fidl::encoding::DynamicFlags::empty(),
1628            _decode,
1629        )
1630    }
1631
1632    type WatchRoutingEventsResponseFut = fidl::client::QueryResponseFut<
1633        (u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent),
1634        fidl::encoding::DefaultFuchsiaResourceDialect,
1635    >;
1636    fn r#watch_routing_events(&self) -> Self::WatchRoutingEventsResponseFut {
1637        fn _decode(
1638            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1639        ) -> Result<(u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent), fidl::Error>
1640        {
1641            let _response = fidl::client::decode_transaction_body::<
1642                Ipv6RoutingTableControllerWatchRoutingEventsResponse,
1643                fidl::encoding::DefaultFuchsiaResourceDialect,
1644                0x22a94526a0ea1078,
1645            >(_buf?)?;
1646            Ok((
1647                _response.dropped_events,
1648                _response.addresses,
1649                _response.input_interface,
1650                _response.event,
1651            ))
1652        }
1653        self.client.send_query_and_decode::<
1654            fidl::encoding::EmptyPayload,
1655            (u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent),
1656        >(
1657            (),
1658            0x22a94526a0ea1078,
1659            fidl::encoding::DynamicFlags::empty(),
1660            _decode,
1661        )
1662    }
1663}
1664
1665pub struct Ipv6RoutingTableControllerEventStream {
1666    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1667}
1668
1669impl std::marker::Unpin for Ipv6RoutingTableControllerEventStream {}
1670
1671impl futures::stream::FusedStream for Ipv6RoutingTableControllerEventStream {
1672    fn is_terminated(&self) -> bool {
1673        self.event_receiver.is_terminated()
1674    }
1675}
1676
1677impl futures::Stream for Ipv6RoutingTableControllerEventStream {
1678    type Item = Result<Ipv6RoutingTableControllerEvent, fidl::Error>;
1679
1680    fn poll_next(
1681        mut self: std::pin::Pin<&mut Self>,
1682        cx: &mut std::task::Context<'_>,
1683    ) -> std::task::Poll<Option<Self::Item>> {
1684        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1685            &mut self.event_receiver,
1686            cx
1687        )?) {
1688            Some(buf) => std::task::Poll::Ready(Some(Ipv6RoutingTableControllerEvent::decode(buf))),
1689            None => std::task::Poll::Ready(None),
1690        }
1691    }
1692}
1693
1694#[derive(Debug)]
1695pub enum Ipv6RoutingTableControllerEvent {
1696    OnClose { error: TableControllerCloseReason },
1697}
1698
1699impl Ipv6RoutingTableControllerEvent {
1700    #[allow(irrefutable_let_patterns)]
1701    pub fn into_on_close(self) -> Option<TableControllerCloseReason> {
1702        if let Ipv6RoutingTableControllerEvent::OnClose { error } = self {
1703            Some((error))
1704        } else {
1705            None
1706        }
1707    }
1708
1709    /// Decodes a message buffer as a [`Ipv6RoutingTableControllerEvent`].
1710    fn decode(
1711        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1712    ) -> Result<Ipv6RoutingTableControllerEvent, fidl::Error> {
1713        let (bytes, _handles) = buf.split_mut();
1714        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1715        debug_assert_eq!(tx_header.tx_id, 0);
1716        match tx_header.ordinal {
1717            0x2d3a353489d1e0be => {
1718                let mut out = fidl::new_empty!(Ipv6RoutingTableControllerOnCloseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1719                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv6RoutingTableControllerOnCloseRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1720                Ok((
1721                    Ipv6RoutingTableControllerEvent::OnClose {error: out.error,
1722
1723                    }
1724                ))
1725            }
1726            _ => Err(fidl::Error::UnknownOrdinal {
1727                ordinal: tx_header.ordinal,
1728                protocol_name: <Ipv6RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1729            })
1730        }
1731    }
1732}
1733
1734/// A Stream of incoming requests for fuchsia.net.multicast.admin/Ipv6RoutingTableController.
1735pub struct Ipv6RoutingTableControllerRequestStream {
1736    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1737    is_terminated: bool,
1738}
1739
1740impl std::marker::Unpin for Ipv6RoutingTableControllerRequestStream {}
1741
1742impl futures::stream::FusedStream for Ipv6RoutingTableControllerRequestStream {
1743    fn is_terminated(&self) -> bool {
1744        self.is_terminated
1745    }
1746}
1747
1748impl fidl::endpoints::RequestStream for Ipv6RoutingTableControllerRequestStream {
1749    type Protocol = Ipv6RoutingTableControllerMarker;
1750    type ControlHandle = Ipv6RoutingTableControllerControlHandle;
1751
1752    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1753        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1754    }
1755
1756    fn control_handle(&self) -> Self::ControlHandle {
1757        Ipv6RoutingTableControllerControlHandle { inner: self.inner.clone() }
1758    }
1759
1760    fn into_inner(
1761        self,
1762    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1763    {
1764        (self.inner, self.is_terminated)
1765    }
1766
1767    fn from_inner(
1768        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1769        is_terminated: bool,
1770    ) -> Self {
1771        Self { inner, is_terminated }
1772    }
1773}
1774
1775impl futures::Stream for Ipv6RoutingTableControllerRequestStream {
1776    type Item = Result<Ipv6RoutingTableControllerRequest, fidl::Error>;
1777
1778    fn poll_next(
1779        mut self: std::pin::Pin<&mut Self>,
1780        cx: &mut std::task::Context<'_>,
1781    ) -> std::task::Poll<Option<Self::Item>> {
1782        let this = &mut *self;
1783        if this.inner.check_shutdown(cx) {
1784            this.is_terminated = true;
1785            return std::task::Poll::Ready(None);
1786        }
1787        if this.is_terminated {
1788            panic!("polled Ipv6RoutingTableControllerRequestStream after completion");
1789        }
1790        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1791            |bytes, handles| {
1792                match this.inner.channel().read_etc(cx, bytes, handles) {
1793                    std::task::Poll::Ready(Ok(())) => {}
1794                    std::task::Poll::Pending => return std::task::Poll::Pending,
1795                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1796                        this.is_terminated = true;
1797                        return std::task::Poll::Ready(None);
1798                    }
1799                    std::task::Poll::Ready(Err(e)) => {
1800                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1801                            e.into(),
1802                        ))))
1803                    }
1804                }
1805
1806                // A message has been received from the channel
1807                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1808
1809                std::task::Poll::Ready(Some(match header.ordinal {
1810                0x71ca1f54a716de90 => {
1811                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1812                    let mut req = fidl::new_empty!(Ipv6RoutingTableControllerAddRouteRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1813                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv6RoutingTableControllerAddRouteRequest>(&header, _body_bytes, handles, &mut req)?;
1814                    let control_handle = Ipv6RoutingTableControllerControlHandle {
1815                        inner: this.inner.clone(),
1816                    };
1817                    Ok(Ipv6RoutingTableControllerRequest::AddRoute {addresses: req.addresses,
1818route: req.route,
1819
1820                        responder: Ipv6RoutingTableControllerAddRouteResponder {
1821                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1822                            tx_id: header.tx_id,
1823                        },
1824                    })
1825                }
1826                0x35b6c2ce4a7b3f13 => {
1827                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1828                    let mut req = fidl::new_empty!(Ipv6RoutingTableControllerDelRouteRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1829                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv6RoutingTableControllerDelRouteRequest>(&header, _body_bytes, handles, &mut req)?;
1830                    let control_handle = Ipv6RoutingTableControllerControlHandle {
1831                        inner: this.inner.clone(),
1832                    };
1833                    Ok(Ipv6RoutingTableControllerRequest::DelRoute {addresses: req.addresses,
1834
1835                        responder: Ipv6RoutingTableControllerDelRouteResponder {
1836                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1837                            tx_id: header.tx_id,
1838                        },
1839                    })
1840                }
1841                0x6d7fa5e9f18ef79f => {
1842                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1843                    let mut req = fidl::new_empty!(Ipv6RoutingTableControllerGetRouteStatsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1844                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv6RoutingTableControllerGetRouteStatsRequest>(&header, _body_bytes, handles, &mut req)?;
1845                    let control_handle = Ipv6RoutingTableControllerControlHandle {
1846                        inner: this.inner.clone(),
1847                    };
1848                    Ok(Ipv6RoutingTableControllerRequest::GetRouteStats {addresses: req.addresses,
1849
1850                        responder: Ipv6RoutingTableControllerGetRouteStatsResponder {
1851                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1852                            tx_id: header.tx_id,
1853                        },
1854                    })
1855                }
1856                0x22a94526a0ea1078 => {
1857                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1858                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1859                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1860                    let control_handle = Ipv6RoutingTableControllerControlHandle {
1861                        inner: this.inner.clone(),
1862                    };
1863                    Ok(Ipv6RoutingTableControllerRequest::WatchRoutingEvents {
1864                        responder: Ipv6RoutingTableControllerWatchRoutingEventsResponder {
1865                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1866                            tx_id: header.tx_id,
1867                        },
1868                    })
1869                }
1870                _ => Err(fidl::Error::UnknownOrdinal {
1871                    ordinal: header.ordinal,
1872                    protocol_name: <Ipv6RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1873                }),
1874            }))
1875            },
1876        )
1877    }
1878}
1879
1880/// The IPv6 multicast routing controller.
1881///
1882/// Closing the client-end of the controller will disable multicast routing and
1883/// clear the multicast routing table.
1884#[derive(Debug)]
1885pub enum Ipv6RoutingTableControllerRequest {
1886    /// Adds a route such that packets matching the addresses will be forwarded
1887    /// accordingly.
1888    ///
1889    /// The provided addresses act as the key for the route; any existing route
1890    /// with the same addresses will be overwritten when this route is
1891    /// installed.
1892    ///
1893    /// If a packet arrives at an interface different from the expected input
1894    /// interface set in the route, the packet will not be forwarded and a
1895    /// [`RoutingEvent.wrong_input_interface`] event will be sent to the client.
1896    /// See [`WatchRoutingEvents`] for more details.
1897    ///
1898    /// + request `addresses` the addresses used to identify a route.
1899    /// + request `route` the multicast route.
1900    AddRoute {
1901        addresses: Ipv6UnicastSourceAndMulticastDestination,
1902        route: Route,
1903        responder: Ipv6RoutingTableControllerAddRouteResponder,
1904    },
1905    /// Delete a route.
1906    ///
1907    /// + request `addresses` the addresses used to identify a route.
1908    DelRoute {
1909        addresses: Ipv6UnicastSourceAndMulticastDestination,
1910        responder: Ipv6RoutingTableControllerDelRouteResponder,
1911    },
1912    /// Get a snapshot of statistics about a specific route.
1913    ///
1914    /// + request `addresses` the addresses used to identify a route.
1915    GetRouteStats {
1916        addresses: Ipv6UnicastSourceAndMulticastDestination,
1917        responder: Ipv6RoutingTableControllerGetRouteStatsResponder,
1918    },
1919    /// Watch for events triggered by multicast packets.
1920    ///
1921    /// The server will queue events to return when this method is called. If no
1922    /// events are ready, the call will block until an event is ready. The
1923    /// server will drop new events if the client is not consuming them fast
1924    /// enough and return the number of events dropped in-between events.
1925    ///
1926    /// It is invalid to call this method while a previous call is pending.
1927    /// Doing so will cause the server end of the protocol to be closed.
1928    ///
1929    /// - response `dropped_events` the number of events that were dropped
1930    ///   _immediately before_ the returned event was queued.
1931    ///   returned event.
1932    /// - response `addresses` the addresses in the multicast packet triggering
1933    ///   the event.
1934    /// - response `input_interface` the interface the multicast packet
1935    ///   triggering the event arrived at.
1936    /// - response `event` the event.
1937    WatchRoutingEvents { responder: Ipv6RoutingTableControllerWatchRoutingEventsResponder },
1938}
1939
1940impl Ipv6RoutingTableControllerRequest {
1941    #[allow(irrefutable_let_patterns)]
1942    pub fn into_add_route(
1943        self,
1944    ) -> Option<(
1945        Ipv6UnicastSourceAndMulticastDestination,
1946        Route,
1947        Ipv6RoutingTableControllerAddRouteResponder,
1948    )> {
1949        if let Ipv6RoutingTableControllerRequest::AddRoute { addresses, route, responder } = self {
1950            Some((addresses, route, responder))
1951        } else {
1952            None
1953        }
1954    }
1955
1956    #[allow(irrefutable_let_patterns)]
1957    pub fn into_del_route(
1958        self,
1959    ) -> Option<(
1960        Ipv6UnicastSourceAndMulticastDestination,
1961        Ipv6RoutingTableControllerDelRouteResponder,
1962    )> {
1963        if let Ipv6RoutingTableControllerRequest::DelRoute { addresses, responder } = self {
1964            Some((addresses, responder))
1965        } else {
1966            None
1967        }
1968    }
1969
1970    #[allow(irrefutable_let_patterns)]
1971    pub fn into_get_route_stats(
1972        self,
1973    ) -> Option<(
1974        Ipv6UnicastSourceAndMulticastDestination,
1975        Ipv6RoutingTableControllerGetRouteStatsResponder,
1976    )> {
1977        if let Ipv6RoutingTableControllerRequest::GetRouteStats { addresses, responder } = self {
1978            Some((addresses, responder))
1979        } else {
1980            None
1981        }
1982    }
1983
1984    #[allow(irrefutable_let_patterns)]
1985    pub fn into_watch_routing_events(
1986        self,
1987    ) -> Option<(Ipv6RoutingTableControllerWatchRoutingEventsResponder)> {
1988        if let Ipv6RoutingTableControllerRequest::WatchRoutingEvents { responder } = self {
1989            Some((responder))
1990        } else {
1991            None
1992        }
1993    }
1994
1995    /// Name of the method defined in FIDL
1996    pub fn method_name(&self) -> &'static str {
1997        match *self {
1998            Ipv6RoutingTableControllerRequest::AddRoute { .. } => "add_route",
1999            Ipv6RoutingTableControllerRequest::DelRoute { .. } => "del_route",
2000            Ipv6RoutingTableControllerRequest::GetRouteStats { .. } => "get_route_stats",
2001            Ipv6RoutingTableControllerRequest::WatchRoutingEvents { .. } => "watch_routing_events",
2002        }
2003    }
2004}
2005
2006#[derive(Debug, Clone)]
2007pub struct Ipv6RoutingTableControllerControlHandle {
2008    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2009}
2010
2011impl fidl::endpoints::ControlHandle for Ipv6RoutingTableControllerControlHandle {
2012    fn shutdown(&self) {
2013        self.inner.shutdown()
2014    }
2015    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2016        self.inner.shutdown_with_epitaph(status)
2017    }
2018
2019    fn is_closed(&self) -> bool {
2020        self.inner.channel().is_closed()
2021    }
2022    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2023        self.inner.channel().on_closed()
2024    }
2025
2026    #[cfg(target_os = "fuchsia")]
2027    fn signal_peer(
2028        &self,
2029        clear_mask: zx::Signals,
2030        set_mask: zx::Signals,
2031    ) -> Result<(), zx_status::Status> {
2032        use fidl::Peered;
2033        self.inner.channel().signal_peer(clear_mask, set_mask)
2034    }
2035}
2036
2037impl Ipv6RoutingTableControllerControlHandle {
2038    pub fn send_on_close(&self, mut error: TableControllerCloseReason) -> Result<(), fidl::Error> {
2039        self.inner.send::<Ipv6RoutingTableControllerOnCloseRequest>(
2040            (error,),
2041            0,
2042            0x2d3a353489d1e0be,
2043            fidl::encoding::DynamicFlags::empty(),
2044        )
2045    }
2046}
2047
2048#[must_use = "FIDL methods require a response to be sent"]
2049#[derive(Debug)]
2050pub struct Ipv6RoutingTableControllerAddRouteResponder {
2051    control_handle: std::mem::ManuallyDrop<Ipv6RoutingTableControllerControlHandle>,
2052    tx_id: u32,
2053}
2054
2055/// Set the the channel to be shutdown (see [`Ipv6RoutingTableControllerControlHandle::shutdown`])
2056/// if the responder is dropped without sending a response, so that the client
2057/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2058impl std::ops::Drop for Ipv6RoutingTableControllerAddRouteResponder {
2059    fn drop(&mut self) {
2060        self.control_handle.shutdown();
2061        // Safety: drops once, never accessed again
2062        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2063    }
2064}
2065
2066impl fidl::endpoints::Responder for Ipv6RoutingTableControllerAddRouteResponder {
2067    type ControlHandle = Ipv6RoutingTableControllerControlHandle;
2068
2069    fn control_handle(&self) -> &Ipv6RoutingTableControllerControlHandle {
2070        &self.control_handle
2071    }
2072
2073    fn drop_without_shutdown(mut self) {
2074        // Safety: drops once, never accessed again due to mem::forget
2075        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2076        // Prevent Drop from running (which would shut down the channel)
2077        std::mem::forget(self);
2078    }
2079}
2080
2081impl Ipv6RoutingTableControllerAddRouteResponder {
2082    /// Sends a response to the FIDL transaction.
2083    ///
2084    /// Sets the channel to shutdown if an error occurs.
2085    pub fn send(
2086        self,
2087        mut result: Result<(), Ipv6RoutingTableControllerAddRouteError>,
2088    ) -> Result<(), fidl::Error> {
2089        let _result = self.send_raw(result);
2090        if _result.is_err() {
2091            self.control_handle.shutdown();
2092        }
2093        self.drop_without_shutdown();
2094        _result
2095    }
2096
2097    /// Similar to "send" but does not shutdown the channel if an error occurs.
2098    pub fn send_no_shutdown_on_err(
2099        self,
2100        mut result: Result<(), Ipv6RoutingTableControllerAddRouteError>,
2101    ) -> Result<(), fidl::Error> {
2102        let _result = self.send_raw(result);
2103        self.drop_without_shutdown();
2104        _result
2105    }
2106
2107    fn send_raw(
2108        &self,
2109        mut result: Result<(), Ipv6RoutingTableControllerAddRouteError>,
2110    ) -> Result<(), fidl::Error> {
2111        self.control_handle.inner.send::<fidl::encoding::ResultType<
2112            fidl::encoding::EmptyStruct,
2113            Ipv6RoutingTableControllerAddRouteError,
2114        >>(
2115            result,
2116            self.tx_id,
2117            0x71ca1f54a716de90,
2118            fidl::encoding::DynamicFlags::empty(),
2119        )
2120    }
2121}
2122
2123#[must_use = "FIDL methods require a response to be sent"]
2124#[derive(Debug)]
2125pub struct Ipv6RoutingTableControllerDelRouteResponder {
2126    control_handle: std::mem::ManuallyDrop<Ipv6RoutingTableControllerControlHandle>,
2127    tx_id: u32,
2128}
2129
2130/// Set the the channel to be shutdown (see [`Ipv6RoutingTableControllerControlHandle::shutdown`])
2131/// if the responder is dropped without sending a response, so that the client
2132/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2133impl std::ops::Drop for Ipv6RoutingTableControllerDelRouteResponder {
2134    fn drop(&mut self) {
2135        self.control_handle.shutdown();
2136        // Safety: drops once, never accessed again
2137        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2138    }
2139}
2140
2141impl fidl::endpoints::Responder for Ipv6RoutingTableControllerDelRouteResponder {
2142    type ControlHandle = Ipv6RoutingTableControllerControlHandle;
2143
2144    fn control_handle(&self) -> &Ipv6RoutingTableControllerControlHandle {
2145        &self.control_handle
2146    }
2147
2148    fn drop_without_shutdown(mut self) {
2149        // Safety: drops once, never accessed again due to mem::forget
2150        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2151        // Prevent Drop from running (which would shut down the channel)
2152        std::mem::forget(self);
2153    }
2154}
2155
2156impl Ipv6RoutingTableControllerDelRouteResponder {
2157    /// Sends a response to the FIDL transaction.
2158    ///
2159    /// Sets the channel to shutdown if an error occurs.
2160    pub fn send(
2161        self,
2162        mut result: Result<(), Ipv6RoutingTableControllerDelRouteError>,
2163    ) -> Result<(), fidl::Error> {
2164        let _result = self.send_raw(result);
2165        if _result.is_err() {
2166            self.control_handle.shutdown();
2167        }
2168        self.drop_without_shutdown();
2169        _result
2170    }
2171
2172    /// Similar to "send" but does not shutdown the channel if an error occurs.
2173    pub fn send_no_shutdown_on_err(
2174        self,
2175        mut result: Result<(), Ipv6RoutingTableControllerDelRouteError>,
2176    ) -> Result<(), fidl::Error> {
2177        let _result = self.send_raw(result);
2178        self.drop_without_shutdown();
2179        _result
2180    }
2181
2182    fn send_raw(
2183        &self,
2184        mut result: Result<(), Ipv6RoutingTableControllerDelRouteError>,
2185    ) -> Result<(), fidl::Error> {
2186        self.control_handle.inner.send::<fidl::encoding::ResultType<
2187            fidl::encoding::EmptyStruct,
2188            Ipv6RoutingTableControllerDelRouteError,
2189        >>(
2190            result,
2191            self.tx_id,
2192            0x35b6c2ce4a7b3f13,
2193            fidl::encoding::DynamicFlags::empty(),
2194        )
2195    }
2196}
2197
2198#[must_use = "FIDL methods require a response to be sent"]
2199#[derive(Debug)]
2200pub struct Ipv6RoutingTableControllerGetRouteStatsResponder {
2201    control_handle: std::mem::ManuallyDrop<Ipv6RoutingTableControllerControlHandle>,
2202    tx_id: u32,
2203}
2204
2205/// Set the the channel to be shutdown (see [`Ipv6RoutingTableControllerControlHandle::shutdown`])
2206/// if the responder is dropped without sending a response, so that the client
2207/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2208impl std::ops::Drop for Ipv6RoutingTableControllerGetRouteStatsResponder {
2209    fn drop(&mut self) {
2210        self.control_handle.shutdown();
2211        // Safety: drops once, never accessed again
2212        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2213    }
2214}
2215
2216impl fidl::endpoints::Responder for Ipv6RoutingTableControllerGetRouteStatsResponder {
2217    type ControlHandle = Ipv6RoutingTableControllerControlHandle;
2218
2219    fn control_handle(&self) -> &Ipv6RoutingTableControllerControlHandle {
2220        &self.control_handle
2221    }
2222
2223    fn drop_without_shutdown(mut self) {
2224        // Safety: drops once, never accessed again due to mem::forget
2225        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2226        // Prevent Drop from running (which would shut down the channel)
2227        std::mem::forget(self);
2228    }
2229}
2230
2231impl Ipv6RoutingTableControllerGetRouteStatsResponder {
2232    /// Sends a response to the FIDL transaction.
2233    ///
2234    /// Sets the channel to shutdown if an error occurs.
2235    pub fn send(
2236        self,
2237        mut result: Result<&RouteStats, Ipv6RoutingTableControllerGetRouteStatsError>,
2238    ) -> Result<(), fidl::Error> {
2239        let _result = self.send_raw(result);
2240        if _result.is_err() {
2241            self.control_handle.shutdown();
2242        }
2243        self.drop_without_shutdown();
2244        _result
2245    }
2246
2247    /// Similar to "send" but does not shutdown the channel if an error occurs.
2248    pub fn send_no_shutdown_on_err(
2249        self,
2250        mut result: Result<&RouteStats, Ipv6RoutingTableControllerGetRouteStatsError>,
2251    ) -> Result<(), fidl::Error> {
2252        let _result = self.send_raw(result);
2253        self.drop_without_shutdown();
2254        _result
2255    }
2256
2257    fn send_raw(
2258        &self,
2259        mut result: Result<&RouteStats, Ipv6RoutingTableControllerGetRouteStatsError>,
2260    ) -> Result<(), fidl::Error> {
2261        self.control_handle.inner.send::<fidl::encoding::ResultType<
2262            Ipv6RoutingTableControllerGetRouteStatsResponse,
2263            Ipv6RoutingTableControllerGetRouteStatsError,
2264        >>(
2265            result.map(|stats| (stats,)),
2266            self.tx_id,
2267            0x6d7fa5e9f18ef79f,
2268            fidl::encoding::DynamicFlags::empty(),
2269        )
2270    }
2271}
2272
2273#[must_use = "FIDL methods require a response to be sent"]
2274#[derive(Debug)]
2275pub struct Ipv6RoutingTableControllerWatchRoutingEventsResponder {
2276    control_handle: std::mem::ManuallyDrop<Ipv6RoutingTableControllerControlHandle>,
2277    tx_id: u32,
2278}
2279
2280/// Set the the channel to be shutdown (see [`Ipv6RoutingTableControllerControlHandle::shutdown`])
2281/// if the responder is dropped without sending a response, so that the client
2282/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2283impl std::ops::Drop for Ipv6RoutingTableControllerWatchRoutingEventsResponder {
2284    fn drop(&mut self) {
2285        self.control_handle.shutdown();
2286        // Safety: drops once, never accessed again
2287        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2288    }
2289}
2290
2291impl fidl::endpoints::Responder for Ipv6RoutingTableControllerWatchRoutingEventsResponder {
2292    type ControlHandle = Ipv6RoutingTableControllerControlHandle;
2293
2294    fn control_handle(&self) -> &Ipv6RoutingTableControllerControlHandle {
2295        &self.control_handle
2296    }
2297
2298    fn drop_without_shutdown(mut self) {
2299        // Safety: drops once, never accessed again due to mem::forget
2300        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2301        // Prevent Drop from running (which would shut down the channel)
2302        std::mem::forget(self);
2303    }
2304}
2305
2306impl Ipv6RoutingTableControllerWatchRoutingEventsResponder {
2307    /// Sends a response to the FIDL transaction.
2308    ///
2309    /// Sets the channel to shutdown if an error occurs.
2310    pub fn send(
2311        self,
2312        mut dropped_events: u64,
2313        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
2314        mut input_interface: u64,
2315        mut event: &RoutingEvent,
2316    ) -> Result<(), fidl::Error> {
2317        let _result = self.send_raw(dropped_events, addresses, input_interface, event);
2318        if _result.is_err() {
2319            self.control_handle.shutdown();
2320        }
2321        self.drop_without_shutdown();
2322        _result
2323    }
2324
2325    /// Similar to "send" but does not shutdown the channel if an error occurs.
2326    pub fn send_no_shutdown_on_err(
2327        self,
2328        mut dropped_events: u64,
2329        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
2330        mut input_interface: u64,
2331        mut event: &RoutingEvent,
2332    ) -> Result<(), fidl::Error> {
2333        let _result = self.send_raw(dropped_events, addresses, input_interface, event);
2334        self.drop_without_shutdown();
2335        _result
2336    }
2337
2338    fn send_raw(
2339        &self,
2340        mut dropped_events: u64,
2341        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
2342        mut input_interface: u64,
2343        mut event: &RoutingEvent,
2344    ) -> Result<(), fidl::Error> {
2345        self.control_handle.inner.send::<Ipv6RoutingTableControllerWatchRoutingEventsResponse>(
2346            (dropped_events, addresses, input_interface, event),
2347            self.tx_id,
2348            0x22a94526a0ea1078,
2349            fidl::encoding::DynamicFlags::empty(),
2350        )
2351    }
2352}
2353
2354mod internal {
2355    use super::*;
2356}