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::NullableHandle {
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
846    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
847        self.inner.shutdown_with_epitaph(status)
848    }
849
850    fn is_closed(&self) -> bool {
851        self.inner.channel().is_closed()
852    }
853    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
854        self.inner.channel().on_closed()
855    }
856
857    #[cfg(target_os = "fuchsia")]
858    fn signal_peer(
859        &self,
860        clear_mask: zx::Signals,
861        set_mask: zx::Signals,
862    ) -> Result<(), zx_status::Status> {
863        use fidl::Peered;
864        self.inner.channel().signal_peer(clear_mask, set_mask)
865    }
866}
867
868impl Ipv4RoutingTableControllerControlHandle {
869    pub fn send_on_close(&self, mut error: TableControllerCloseReason) -> Result<(), fidl::Error> {
870        self.inner.send::<Ipv4RoutingTableControllerOnCloseRequest>(
871            (error,),
872            0,
873            0x3dec49c6c2070f14,
874            fidl::encoding::DynamicFlags::empty(),
875        )
876    }
877}
878
879#[must_use = "FIDL methods require a response to be sent"]
880#[derive(Debug)]
881pub struct Ipv4RoutingTableControllerAddRouteResponder {
882    control_handle: std::mem::ManuallyDrop<Ipv4RoutingTableControllerControlHandle>,
883    tx_id: u32,
884}
885
886/// Set the the channel to be shutdown (see [`Ipv4RoutingTableControllerControlHandle::shutdown`])
887/// if the responder is dropped without sending a response, so that the client
888/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
889impl std::ops::Drop for Ipv4RoutingTableControllerAddRouteResponder {
890    fn drop(&mut self) {
891        self.control_handle.shutdown();
892        // Safety: drops once, never accessed again
893        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
894    }
895}
896
897impl fidl::endpoints::Responder for Ipv4RoutingTableControllerAddRouteResponder {
898    type ControlHandle = Ipv4RoutingTableControllerControlHandle;
899
900    fn control_handle(&self) -> &Ipv4RoutingTableControllerControlHandle {
901        &self.control_handle
902    }
903
904    fn drop_without_shutdown(mut self) {
905        // Safety: drops once, never accessed again due to mem::forget
906        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
907        // Prevent Drop from running (which would shut down the channel)
908        std::mem::forget(self);
909    }
910}
911
912impl Ipv4RoutingTableControllerAddRouteResponder {
913    /// Sends a response to the FIDL transaction.
914    ///
915    /// Sets the channel to shutdown if an error occurs.
916    pub fn send(
917        self,
918        mut result: Result<(), Ipv4RoutingTableControllerAddRouteError>,
919    ) -> Result<(), fidl::Error> {
920        let _result = self.send_raw(result);
921        if _result.is_err() {
922            self.control_handle.shutdown();
923        }
924        self.drop_without_shutdown();
925        _result
926    }
927
928    /// Similar to "send" but does not shutdown the channel if an error occurs.
929    pub fn send_no_shutdown_on_err(
930        self,
931        mut result: Result<(), Ipv4RoutingTableControllerAddRouteError>,
932    ) -> Result<(), fidl::Error> {
933        let _result = self.send_raw(result);
934        self.drop_without_shutdown();
935        _result
936    }
937
938    fn send_raw(
939        &self,
940        mut result: Result<(), Ipv4RoutingTableControllerAddRouteError>,
941    ) -> Result<(), fidl::Error> {
942        self.control_handle.inner.send::<fidl::encoding::ResultType<
943            fidl::encoding::EmptyStruct,
944            Ipv4RoutingTableControllerAddRouteError,
945        >>(
946            result,
947            self.tx_id,
948            0x6098a90553ef1aed,
949            fidl::encoding::DynamicFlags::empty(),
950        )
951    }
952}
953
954#[must_use = "FIDL methods require a response to be sent"]
955#[derive(Debug)]
956pub struct Ipv4RoutingTableControllerDelRouteResponder {
957    control_handle: std::mem::ManuallyDrop<Ipv4RoutingTableControllerControlHandle>,
958    tx_id: u32,
959}
960
961/// Set the the channel to be shutdown (see [`Ipv4RoutingTableControllerControlHandle::shutdown`])
962/// if the responder is dropped without sending a response, so that the client
963/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
964impl std::ops::Drop for Ipv4RoutingTableControllerDelRouteResponder {
965    fn drop(&mut self) {
966        self.control_handle.shutdown();
967        // Safety: drops once, never accessed again
968        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
969    }
970}
971
972impl fidl::endpoints::Responder for Ipv4RoutingTableControllerDelRouteResponder {
973    type ControlHandle = Ipv4RoutingTableControllerControlHandle;
974
975    fn control_handle(&self) -> &Ipv4RoutingTableControllerControlHandle {
976        &self.control_handle
977    }
978
979    fn drop_without_shutdown(mut self) {
980        // Safety: drops once, never accessed again due to mem::forget
981        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
982        // Prevent Drop from running (which would shut down the channel)
983        std::mem::forget(self);
984    }
985}
986
987impl Ipv4RoutingTableControllerDelRouteResponder {
988    /// Sends a response to the FIDL transaction.
989    ///
990    /// Sets the channel to shutdown if an error occurs.
991    pub fn send(
992        self,
993        mut result: Result<(), Ipv4RoutingTableControllerDelRouteError>,
994    ) -> Result<(), fidl::Error> {
995        let _result = self.send_raw(result);
996        if _result.is_err() {
997            self.control_handle.shutdown();
998        }
999        self.drop_without_shutdown();
1000        _result
1001    }
1002
1003    /// Similar to "send" but does not shutdown the channel if an error occurs.
1004    pub fn send_no_shutdown_on_err(
1005        self,
1006        mut result: Result<(), Ipv4RoutingTableControllerDelRouteError>,
1007    ) -> Result<(), fidl::Error> {
1008        let _result = self.send_raw(result);
1009        self.drop_without_shutdown();
1010        _result
1011    }
1012
1013    fn send_raw(
1014        &self,
1015        mut result: Result<(), Ipv4RoutingTableControllerDelRouteError>,
1016    ) -> Result<(), fidl::Error> {
1017        self.control_handle.inner.send::<fidl::encoding::ResultType<
1018            fidl::encoding::EmptyStruct,
1019            Ipv4RoutingTableControllerDelRouteError,
1020        >>(
1021            result,
1022            self.tx_id,
1023            0x14a0727b797aff74,
1024            fidl::encoding::DynamicFlags::empty(),
1025        )
1026    }
1027}
1028
1029#[must_use = "FIDL methods require a response to be sent"]
1030#[derive(Debug)]
1031pub struct Ipv4RoutingTableControllerGetRouteStatsResponder {
1032    control_handle: std::mem::ManuallyDrop<Ipv4RoutingTableControllerControlHandle>,
1033    tx_id: u32,
1034}
1035
1036/// Set the the channel to be shutdown (see [`Ipv4RoutingTableControllerControlHandle::shutdown`])
1037/// if the responder is dropped without sending a response, so that the client
1038/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1039impl std::ops::Drop for Ipv4RoutingTableControllerGetRouteStatsResponder {
1040    fn drop(&mut self) {
1041        self.control_handle.shutdown();
1042        // Safety: drops once, never accessed again
1043        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1044    }
1045}
1046
1047impl fidl::endpoints::Responder for Ipv4RoutingTableControllerGetRouteStatsResponder {
1048    type ControlHandle = Ipv4RoutingTableControllerControlHandle;
1049
1050    fn control_handle(&self) -> &Ipv4RoutingTableControllerControlHandle {
1051        &self.control_handle
1052    }
1053
1054    fn drop_without_shutdown(mut self) {
1055        // Safety: drops once, never accessed again due to mem::forget
1056        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1057        // Prevent Drop from running (which would shut down the channel)
1058        std::mem::forget(self);
1059    }
1060}
1061
1062impl Ipv4RoutingTableControllerGetRouteStatsResponder {
1063    /// Sends a response to the FIDL transaction.
1064    ///
1065    /// Sets the channel to shutdown if an error occurs.
1066    pub fn send(
1067        self,
1068        mut result: Result<&RouteStats, Ipv4RoutingTableControllerGetRouteStatsError>,
1069    ) -> Result<(), fidl::Error> {
1070        let _result = self.send_raw(result);
1071        if _result.is_err() {
1072            self.control_handle.shutdown();
1073        }
1074        self.drop_without_shutdown();
1075        _result
1076    }
1077
1078    /// Similar to "send" but does not shutdown the channel if an error occurs.
1079    pub fn send_no_shutdown_on_err(
1080        self,
1081        mut result: Result<&RouteStats, Ipv4RoutingTableControllerGetRouteStatsError>,
1082    ) -> Result<(), fidl::Error> {
1083        let _result = self.send_raw(result);
1084        self.drop_without_shutdown();
1085        _result
1086    }
1087
1088    fn send_raw(
1089        &self,
1090        mut result: Result<&RouteStats, Ipv4RoutingTableControllerGetRouteStatsError>,
1091    ) -> Result<(), fidl::Error> {
1092        self.control_handle.inner.send::<fidl::encoding::ResultType<
1093            Ipv4RoutingTableControllerGetRouteStatsResponse,
1094            Ipv4RoutingTableControllerGetRouteStatsError,
1095        >>(
1096            result.map(|stats| (stats,)),
1097            self.tx_id,
1098            0x176ad8488370c1e9,
1099            fidl::encoding::DynamicFlags::empty(),
1100        )
1101    }
1102}
1103
1104#[must_use = "FIDL methods require a response to be sent"]
1105#[derive(Debug)]
1106pub struct Ipv4RoutingTableControllerWatchRoutingEventsResponder {
1107    control_handle: std::mem::ManuallyDrop<Ipv4RoutingTableControllerControlHandle>,
1108    tx_id: u32,
1109}
1110
1111/// Set the the channel to be shutdown (see [`Ipv4RoutingTableControllerControlHandle::shutdown`])
1112/// if the responder is dropped without sending a response, so that the client
1113/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
1114impl std::ops::Drop for Ipv4RoutingTableControllerWatchRoutingEventsResponder {
1115    fn drop(&mut self) {
1116        self.control_handle.shutdown();
1117        // Safety: drops once, never accessed again
1118        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1119    }
1120}
1121
1122impl fidl::endpoints::Responder for Ipv4RoutingTableControllerWatchRoutingEventsResponder {
1123    type ControlHandle = Ipv4RoutingTableControllerControlHandle;
1124
1125    fn control_handle(&self) -> &Ipv4RoutingTableControllerControlHandle {
1126        &self.control_handle
1127    }
1128
1129    fn drop_without_shutdown(mut self) {
1130        // Safety: drops once, never accessed again due to mem::forget
1131        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1132        // Prevent Drop from running (which would shut down the channel)
1133        std::mem::forget(self);
1134    }
1135}
1136
1137impl Ipv4RoutingTableControllerWatchRoutingEventsResponder {
1138    /// Sends a response to the FIDL transaction.
1139    ///
1140    /// Sets the channel to shutdown if an error occurs.
1141    pub fn send(
1142        self,
1143        mut dropped_events: u64,
1144        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
1145        mut input_interface: u64,
1146        mut event: &RoutingEvent,
1147    ) -> Result<(), fidl::Error> {
1148        let _result = self.send_raw(dropped_events, addresses, input_interface, event);
1149        if _result.is_err() {
1150            self.control_handle.shutdown();
1151        }
1152        self.drop_without_shutdown();
1153        _result
1154    }
1155
1156    /// Similar to "send" but does not shutdown the channel if an error occurs.
1157    pub fn send_no_shutdown_on_err(
1158        self,
1159        mut dropped_events: u64,
1160        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
1161        mut input_interface: u64,
1162        mut event: &RoutingEvent,
1163    ) -> Result<(), fidl::Error> {
1164        let _result = self.send_raw(dropped_events, addresses, input_interface, event);
1165        self.drop_without_shutdown();
1166        _result
1167    }
1168
1169    fn send_raw(
1170        &self,
1171        mut dropped_events: u64,
1172        mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
1173        mut input_interface: u64,
1174        mut event: &RoutingEvent,
1175    ) -> Result<(), fidl::Error> {
1176        self.control_handle.inner.send::<Ipv4RoutingTableControllerWatchRoutingEventsResponse>(
1177            (dropped_events, addresses, input_interface, event),
1178            self.tx_id,
1179            0x3e4336c50718d7f9,
1180            fidl::encoding::DynamicFlags::empty(),
1181        )
1182    }
1183}
1184
1185#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1186pub struct Ipv6RoutingTableControllerMarker;
1187
1188impl fidl::endpoints::ProtocolMarker for Ipv6RoutingTableControllerMarker {
1189    type Proxy = Ipv6RoutingTableControllerProxy;
1190    type RequestStream = Ipv6RoutingTableControllerRequestStream;
1191    #[cfg(target_os = "fuchsia")]
1192    type SynchronousProxy = Ipv6RoutingTableControllerSynchronousProxy;
1193
1194    const DEBUG_NAME: &'static str = "fuchsia.net.multicast.admin.Ipv6RoutingTableController";
1195}
1196impl fidl::endpoints::DiscoverableProtocolMarker for Ipv6RoutingTableControllerMarker {}
1197pub type Ipv6RoutingTableControllerAddRouteResult =
1198    Result<(), Ipv6RoutingTableControllerAddRouteError>;
1199pub type Ipv6RoutingTableControllerDelRouteResult =
1200    Result<(), Ipv6RoutingTableControllerDelRouteError>;
1201pub type Ipv6RoutingTableControllerGetRouteStatsResult =
1202    Result<RouteStats, Ipv6RoutingTableControllerGetRouteStatsError>;
1203
1204pub trait Ipv6RoutingTableControllerProxyInterface: Send + Sync {
1205    type AddRouteResponseFut: std::future::Future<Output = Result<Ipv6RoutingTableControllerAddRouteResult, fidl::Error>>
1206        + Send;
1207    fn r#add_route(
1208        &self,
1209        addresses: &Ipv6UnicastSourceAndMulticastDestination,
1210        route: &Route,
1211    ) -> Self::AddRouteResponseFut;
1212    type DelRouteResponseFut: std::future::Future<Output = Result<Ipv6RoutingTableControllerDelRouteResult, fidl::Error>>
1213        + Send;
1214    fn r#del_route(
1215        &self,
1216        addresses: &Ipv6UnicastSourceAndMulticastDestination,
1217    ) -> Self::DelRouteResponseFut;
1218    type GetRouteStatsResponseFut: std::future::Future<
1219            Output = Result<Ipv6RoutingTableControllerGetRouteStatsResult, fidl::Error>,
1220        > + Send;
1221    fn r#get_route_stats(
1222        &self,
1223        addresses: &Ipv6UnicastSourceAndMulticastDestination,
1224    ) -> Self::GetRouteStatsResponseFut;
1225    type WatchRoutingEventsResponseFut: std::future::Future<
1226            Output = Result<
1227                (u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent),
1228                fidl::Error,
1229            >,
1230        > + Send;
1231    fn r#watch_routing_events(&self) -> Self::WatchRoutingEventsResponseFut;
1232}
1233#[derive(Debug)]
1234#[cfg(target_os = "fuchsia")]
1235pub struct Ipv6RoutingTableControllerSynchronousProxy {
1236    client: fidl::client::sync::Client,
1237}
1238
1239#[cfg(target_os = "fuchsia")]
1240impl fidl::endpoints::SynchronousProxy for Ipv6RoutingTableControllerSynchronousProxy {
1241    type Proxy = Ipv6RoutingTableControllerProxy;
1242    type Protocol = Ipv6RoutingTableControllerMarker;
1243
1244    fn from_channel(inner: fidl::Channel) -> Self {
1245        Self::new(inner)
1246    }
1247
1248    fn into_channel(self) -> fidl::Channel {
1249        self.client.into_channel()
1250    }
1251
1252    fn as_channel(&self) -> &fidl::Channel {
1253        self.client.as_channel()
1254    }
1255}
1256
1257#[cfg(target_os = "fuchsia")]
1258impl Ipv6RoutingTableControllerSynchronousProxy {
1259    pub fn new(channel: fidl::Channel) -> Self {
1260        let protocol_name =
1261            <Ipv6RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1262        Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1263    }
1264
1265    pub fn into_channel(self) -> fidl::Channel {
1266        self.client.into_channel()
1267    }
1268
1269    /// Waits until an event arrives and returns it. It is safe for other
1270    /// threads to make concurrent requests while waiting for an event.
1271    pub fn wait_for_event(
1272        &self,
1273        deadline: zx::MonotonicInstant,
1274    ) -> Result<Ipv6RoutingTableControllerEvent, fidl::Error> {
1275        Ipv6RoutingTableControllerEvent::decode(self.client.wait_for_event(deadline)?)
1276    }
1277
1278    /// Adds a route such that packets matching the addresses will be forwarded
1279    /// accordingly.
1280    ///
1281    /// The provided addresses act as the key for the route; any existing route
1282    /// with the same addresses will be overwritten when this route is
1283    /// installed.
1284    ///
1285    /// If a packet arrives at an interface different from the expected input
1286    /// interface set in the route, the packet will not be forwarded and a
1287    /// [`RoutingEvent.wrong_input_interface`] event will be sent to the client.
1288    /// See [`WatchRoutingEvents`] for more details.
1289    ///
1290    /// + request `addresses` the addresses used to identify a route.
1291    /// + request `route` the multicast route.
1292    pub fn r#add_route(
1293        &self,
1294        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1295        mut route: &Route,
1296        ___deadline: zx::MonotonicInstant,
1297    ) -> Result<Ipv6RoutingTableControllerAddRouteResult, fidl::Error> {
1298        let _response = self
1299            .client
1300            .send_query::<Ipv6RoutingTableControllerAddRouteRequest, fidl::encoding::ResultType<
1301                fidl::encoding::EmptyStruct,
1302                Ipv6RoutingTableControllerAddRouteError,
1303            >>(
1304                (addresses, route),
1305                0x71ca1f54a716de90,
1306                fidl::encoding::DynamicFlags::empty(),
1307                ___deadline,
1308            )?;
1309        Ok(_response.map(|x| x))
1310    }
1311
1312    /// Delete a route.
1313    ///
1314    /// + request `addresses` the addresses used to identify a route.
1315    pub fn r#del_route(
1316        &self,
1317        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1318        ___deadline: zx::MonotonicInstant,
1319    ) -> Result<Ipv6RoutingTableControllerDelRouteResult, fidl::Error> {
1320        let _response = self
1321            .client
1322            .send_query::<Ipv6RoutingTableControllerDelRouteRequest, fidl::encoding::ResultType<
1323                fidl::encoding::EmptyStruct,
1324                Ipv6RoutingTableControllerDelRouteError,
1325            >>(
1326                (addresses,),
1327                0x35b6c2ce4a7b3f13,
1328                fidl::encoding::DynamicFlags::empty(),
1329                ___deadline,
1330            )?;
1331        Ok(_response.map(|x| x))
1332    }
1333
1334    /// Get a snapshot of statistics about a specific route.
1335    ///
1336    /// + request `addresses` the addresses used to identify a route.
1337    pub fn r#get_route_stats(
1338        &self,
1339        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1340        ___deadline: zx::MonotonicInstant,
1341    ) -> Result<Ipv6RoutingTableControllerGetRouteStatsResult, fidl::Error> {
1342        let _response = self.client.send_query::<
1343            Ipv6RoutingTableControllerGetRouteStatsRequest,
1344            fidl::encoding::ResultType<Ipv6RoutingTableControllerGetRouteStatsResponse, Ipv6RoutingTableControllerGetRouteStatsError>,
1345        >(
1346            (addresses,),
1347            0x6d7fa5e9f18ef79f,
1348            fidl::encoding::DynamicFlags::empty(),
1349            ___deadline,
1350        )?;
1351        Ok(_response.map(|x| x.stats))
1352    }
1353
1354    /// Watch for events triggered by multicast packets.
1355    ///
1356    /// The server will queue events to return when this method is called. If no
1357    /// events are ready, the call will block until an event is ready. The
1358    /// server will drop new events if the client is not consuming them fast
1359    /// enough and return the number of events dropped in-between events.
1360    ///
1361    /// It is invalid to call this method while a previous call is pending.
1362    /// Doing so will cause the server end of the protocol to be closed.
1363    ///
1364    /// - response `dropped_events` the number of events that were dropped
1365    ///   _immediately before_ the returned event was queued.
1366    ///   returned event.
1367    /// - response `addresses` the addresses in the multicast packet triggering
1368    ///   the event.
1369    /// - response `input_interface` the interface the multicast packet
1370    ///   triggering the event arrived at.
1371    /// - response `event` the event.
1372    pub fn r#watch_routing_events(
1373        &self,
1374        ___deadline: zx::MonotonicInstant,
1375    ) -> Result<(u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent), fidl::Error>
1376    {
1377        let _response = self.client.send_query::<
1378            fidl::encoding::EmptyPayload,
1379            Ipv6RoutingTableControllerWatchRoutingEventsResponse,
1380        >(
1381            (),
1382            0x22a94526a0ea1078,
1383            fidl::encoding::DynamicFlags::empty(),
1384            ___deadline,
1385        )?;
1386        Ok((
1387            _response.dropped_events,
1388            _response.addresses,
1389            _response.input_interface,
1390            _response.event,
1391        ))
1392    }
1393}
1394
1395#[cfg(target_os = "fuchsia")]
1396impl From<Ipv6RoutingTableControllerSynchronousProxy> for zx::NullableHandle {
1397    fn from(value: Ipv6RoutingTableControllerSynchronousProxy) -> Self {
1398        value.into_channel().into()
1399    }
1400}
1401
1402#[cfg(target_os = "fuchsia")]
1403impl From<fidl::Channel> for Ipv6RoutingTableControllerSynchronousProxy {
1404    fn from(value: fidl::Channel) -> Self {
1405        Self::new(value)
1406    }
1407}
1408
1409#[cfg(target_os = "fuchsia")]
1410impl fidl::endpoints::FromClient for Ipv6RoutingTableControllerSynchronousProxy {
1411    type Protocol = Ipv6RoutingTableControllerMarker;
1412
1413    fn from_client(value: fidl::endpoints::ClientEnd<Ipv6RoutingTableControllerMarker>) -> Self {
1414        Self::new(value.into_channel())
1415    }
1416}
1417
1418#[derive(Debug, Clone)]
1419pub struct Ipv6RoutingTableControllerProxy {
1420    client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1421}
1422
1423impl fidl::endpoints::Proxy for Ipv6RoutingTableControllerProxy {
1424    type Protocol = Ipv6RoutingTableControllerMarker;
1425
1426    fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1427        Self::new(inner)
1428    }
1429
1430    fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1431        self.client.into_channel().map_err(|client| Self { client })
1432    }
1433
1434    fn as_channel(&self) -> &::fidl::AsyncChannel {
1435        self.client.as_channel()
1436    }
1437}
1438
1439impl Ipv6RoutingTableControllerProxy {
1440    /// Create a new Proxy for fuchsia.net.multicast.admin/Ipv6RoutingTableController.
1441    pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1442        let protocol_name =
1443            <Ipv6RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1444        Self { client: fidl::client::Client::new(channel, protocol_name) }
1445    }
1446
1447    /// Get a Stream of events from the remote end of the protocol.
1448    ///
1449    /// # Panics
1450    ///
1451    /// Panics if the event stream was already taken.
1452    pub fn take_event_stream(&self) -> Ipv6RoutingTableControllerEventStream {
1453        Ipv6RoutingTableControllerEventStream { event_receiver: self.client.take_event_receiver() }
1454    }
1455
1456    /// Adds a route such that packets matching the addresses will be forwarded
1457    /// accordingly.
1458    ///
1459    /// The provided addresses act as the key for the route; any existing route
1460    /// with the same addresses will be overwritten when this route is
1461    /// installed.
1462    ///
1463    /// If a packet arrives at an interface different from the expected input
1464    /// interface set in the route, the packet will not be forwarded and a
1465    /// [`RoutingEvent.wrong_input_interface`] event will be sent to the client.
1466    /// See [`WatchRoutingEvents`] for more details.
1467    ///
1468    /// + request `addresses` the addresses used to identify a route.
1469    /// + request `route` the multicast route.
1470    pub fn r#add_route(
1471        &self,
1472        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1473        mut route: &Route,
1474    ) -> fidl::client::QueryResponseFut<
1475        Ipv6RoutingTableControllerAddRouteResult,
1476        fidl::encoding::DefaultFuchsiaResourceDialect,
1477    > {
1478        Ipv6RoutingTableControllerProxyInterface::r#add_route(self, addresses, route)
1479    }
1480
1481    /// Delete a route.
1482    ///
1483    /// + request `addresses` the addresses used to identify a route.
1484    pub fn r#del_route(
1485        &self,
1486        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1487    ) -> fidl::client::QueryResponseFut<
1488        Ipv6RoutingTableControllerDelRouteResult,
1489        fidl::encoding::DefaultFuchsiaResourceDialect,
1490    > {
1491        Ipv6RoutingTableControllerProxyInterface::r#del_route(self, addresses)
1492    }
1493
1494    /// Get a snapshot of statistics about a specific route.
1495    ///
1496    /// + request `addresses` the addresses used to identify a route.
1497    pub fn r#get_route_stats(
1498        &self,
1499        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1500    ) -> fidl::client::QueryResponseFut<
1501        Ipv6RoutingTableControllerGetRouteStatsResult,
1502        fidl::encoding::DefaultFuchsiaResourceDialect,
1503    > {
1504        Ipv6RoutingTableControllerProxyInterface::r#get_route_stats(self, addresses)
1505    }
1506
1507    /// Watch for events triggered by multicast packets.
1508    ///
1509    /// The server will queue events to return when this method is called. If no
1510    /// events are ready, the call will block until an event is ready. The
1511    /// server will drop new events if the client is not consuming them fast
1512    /// enough and return the number of events dropped in-between events.
1513    ///
1514    /// It is invalid to call this method while a previous call is pending.
1515    /// Doing so will cause the server end of the protocol to be closed.
1516    ///
1517    /// - response `dropped_events` the number of events that were dropped
1518    ///   _immediately before_ the returned event was queued.
1519    ///   returned event.
1520    /// - response `addresses` the addresses in the multicast packet triggering
1521    ///   the event.
1522    /// - response `input_interface` the interface the multicast packet
1523    ///   triggering the event arrived at.
1524    /// - response `event` the event.
1525    pub fn r#watch_routing_events(
1526        &self,
1527    ) -> fidl::client::QueryResponseFut<
1528        (u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent),
1529        fidl::encoding::DefaultFuchsiaResourceDialect,
1530    > {
1531        Ipv6RoutingTableControllerProxyInterface::r#watch_routing_events(self)
1532    }
1533}
1534
1535impl Ipv6RoutingTableControllerProxyInterface for Ipv6RoutingTableControllerProxy {
1536    type AddRouteResponseFut = fidl::client::QueryResponseFut<
1537        Ipv6RoutingTableControllerAddRouteResult,
1538        fidl::encoding::DefaultFuchsiaResourceDialect,
1539    >;
1540    fn r#add_route(
1541        &self,
1542        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1543        mut route: &Route,
1544    ) -> Self::AddRouteResponseFut {
1545        fn _decode(
1546            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1547        ) -> Result<Ipv6RoutingTableControllerAddRouteResult, fidl::Error> {
1548            let _response = fidl::client::decode_transaction_body::<
1549                fidl::encoding::ResultType<
1550                    fidl::encoding::EmptyStruct,
1551                    Ipv6RoutingTableControllerAddRouteError,
1552                >,
1553                fidl::encoding::DefaultFuchsiaResourceDialect,
1554                0x71ca1f54a716de90,
1555            >(_buf?)?;
1556            Ok(_response.map(|x| x))
1557        }
1558        self.client.send_query_and_decode::<
1559            Ipv6RoutingTableControllerAddRouteRequest,
1560            Ipv6RoutingTableControllerAddRouteResult,
1561        >(
1562            (addresses, route,),
1563            0x71ca1f54a716de90,
1564            fidl::encoding::DynamicFlags::empty(),
1565            _decode,
1566        )
1567    }
1568
1569    type DelRouteResponseFut = fidl::client::QueryResponseFut<
1570        Ipv6RoutingTableControllerDelRouteResult,
1571        fidl::encoding::DefaultFuchsiaResourceDialect,
1572    >;
1573    fn r#del_route(
1574        &self,
1575        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1576    ) -> Self::DelRouteResponseFut {
1577        fn _decode(
1578            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1579        ) -> Result<Ipv6RoutingTableControllerDelRouteResult, fidl::Error> {
1580            let _response = fidl::client::decode_transaction_body::<
1581                fidl::encoding::ResultType<
1582                    fidl::encoding::EmptyStruct,
1583                    Ipv6RoutingTableControllerDelRouteError,
1584                >,
1585                fidl::encoding::DefaultFuchsiaResourceDialect,
1586                0x35b6c2ce4a7b3f13,
1587            >(_buf?)?;
1588            Ok(_response.map(|x| x))
1589        }
1590        self.client.send_query_and_decode::<
1591            Ipv6RoutingTableControllerDelRouteRequest,
1592            Ipv6RoutingTableControllerDelRouteResult,
1593        >(
1594            (addresses,),
1595            0x35b6c2ce4a7b3f13,
1596            fidl::encoding::DynamicFlags::empty(),
1597            _decode,
1598        )
1599    }
1600
1601    type GetRouteStatsResponseFut = fidl::client::QueryResponseFut<
1602        Ipv6RoutingTableControllerGetRouteStatsResult,
1603        fidl::encoding::DefaultFuchsiaResourceDialect,
1604    >;
1605    fn r#get_route_stats(
1606        &self,
1607        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
1608    ) -> Self::GetRouteStatsResponseFut {
1609        fn _decode(
1610            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1611        ) -> Result<Ipv6RoutingTableControllerGetRouteStatsResult, fidl::Error> {
1612            let _response = fidl::client::decode_transaction_body::<
1613                fidl::encoding::ResultType<
1614                    Ipv6RoutingTableControllerGetRouteStatsResponse,
1615                    Ipv6RoutingTableControllerGetRouteStatsError,
1616                >,
1617                fidl::encoding::DefaultFuchsiaResourceDialect,
1618                0x6d7fa5e9f18ef79f,
1619            >(_buf?)?;
1620            Ok(_response.map(|x| x.stats))
1621        }
1622        self.client.send_query_and_decode::<
1623            Ipv6RoutingTableControllerGetRouteStatsRequest,
1624            Ipv6RoutingTableControllerGetRouteStatsResult,
1625        >(
1626            (addresses,),
1627            0x6d7fa5e9f18ef79f,
1628            fidl::encoding::DynamicFlags::empty(),
1629            _decode,
1630        )
1631    }
1632
1633    type WatchRoutingEventsResponseFut = fidl::client::QueryResponseFut<
1634        (u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent),
1635        fidl::encoding::DefaultFuchsiaResourceDialect,
1636    >;
1637    fn r#watch_routing_events(&self) -> Self::WatchRoutingEventsResponseFut {
1638        fn _decode(
1639            mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1640        ) -> Result<(u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent), fidl::Error>
1641        {
1642            let _response = fidl::client::decode_transaction_body::<
1643                Ipv6RoutingTableControllerWatchRoutingEventsResponse,
1644                fidl::encoding::DefaultFuchsiaResourceDialect,
1645                0x22a94526a0ea1078,
1646            >(_buf?)?;
1647            Ok((
1648                _response.dropped_events,
1649                _response.addresses,
1650                _response.input_interface,
1651                _response.event,
1652            ))
1653        }
1654        self.client.send_query_and_decode::<
1655            fidl::encoding::EmptyPayload,
1656            (u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent),
1657        >(
1658            (),
1659            0x22a94526a0ea1078,
1660            fidl::encoding::DynamicFlags::empty(),
1661            _decode,
1662        )
1663    }
1664}
1665
1666pub struct Ipv6RoutingTableControllerEventStream {
1667    event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1668}
1669
1670impl std::marker::Unpin for Ipv6RoutingTableControllerEventStream {}
1671
1672impl futures::stream::FusedStream for Ipv6RoutingTableControllerEventStream {
1673    fn is_terminated(&self) -> bool {
1674        self.event_receiver.is_terminated()
1675    }
1676}
1677
1678impl futures::Stream for Ipv6RoutingTableControllerEventStream {
1679    type Item = Result<Ipv6RoutingTableControllerEvent, fidl::Error>;
1680
1681    fn poll_next(
1682        mut self: std::pin::Pin<&mut Self>,
1683        cx: &mut std::task::Context<'_>,
1684    ) -> std::task::Poll<Option<Self::Item>> {
1685        match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1686            &mut self.event_receiver,
1687            cx
1688        )?) {
1689            Some(buf) => std::task::Poll::Ready(Some(Ipv6RoutingTableControllerEvent::decode(buf))),
1690            None => std::task::Poll::Ready(None),
1691        }
1692    }
1693}
1694
1695#[derive(Debug)]
1696pub enum Ipv6RoutingTableControllerEvent {
1697    OnClose { error: TableControllerCloseReason },
1698}
1699
1700impl Ipv6RoutingTableControllerEvent {
1701    #[allow(irrefutable_let_patterns)]
1702    pub fn into_on_close(self) -> Option<TableControllerCloseReason> {
1703        if let Ipv6RoutingTableControllerEvent::OnClose { error } = self {
1704            Some((error))
1705        } else {
1706            None
1707        }
1708    }
1709
1710    /// Decodes a message buffer as a [`Ipv6RoutingTableControllerEvent`].
1711    fn decode(
1712        mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1713    ) -> Result<Ipv6RoutingTableControllerEvent, fidl::Error> {
1714        let (bytes, _handles) = buf.split_mut();
1715        let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1716        debug_assert_eq!(tx_header.tx_id, 0);
1717        match tx_header.ordinal {
1718            0x2d3a353489d1e0be => {
1719                let mut out = fidl::new_empty!(Ipv6RoutingTableControllerOnCloseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1720                fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv6RoutingTableControllerOnCloseRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
1721                Ok((
1722                    Ipv6RoutingTableControllerEvent::OnClose {error: out.error,
1723
1724                    }
1725                ))
1726            }
1727            _ => Err(fidl::Error::UnknownOrdinal {
1728                ordinal: tx_header.ordinal,
1729                protocol_name: <Ipv6RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1730            })
1731        }
1732    }
1733}
1734
1735/// A Stream of incoming requests for fuchsia.net.multicast.admin/Ipv6RoutingTableController.
1736pub struct Ipv6RoutingTableControllerRequestStream {
1737    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1738    is_terminated: bool,
1739}
1740
1741impl std::marker::Unpin for Ipv6RoutingTableControllerRequestStream {}
1742
1743impl futures::stream::FusedStream for Ipv6RoutingTableControllerRequestStream {
1744    fn is_terminated(&self) -> bool {
1745        self.is_terminated
1746    }
1747}
1748
1749impl fidl::endpoints::RequestStream for Ipv6RoutingTableControllerRequestStream {
1750    type Protocol = Ipv6RoutingTableControllerMarker;
1751    type ControlHandle = Ipv6RoutingTableControllerControlHandle;
1752
1753    fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1754        Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1755    }
1756
1757    fn control_handle(&self) -> Self::ControlHandle {
1758        Ipv6RoutingTableControllerControlHandle { inner: self.inner.clone() }
1759    }
1760
1761    fn into_inner(
1762        self,
1763    ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1764    {
1765        (self.inner, self.is_terminated)
1766    }
1767
1768    fn from_inner(
1769        inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1770        is_terminated: bool,
1771    ) -> Self {
1772        Self { inner, is_terminated }
1773    }
1774}
1775
1776impl futures::Stream for Ipv6RoutingTableControllerRequestStream {
1777    type Item = Result<Ipv6RoutingTableControllerRequest, fidl::Error>;
1778
1779    fn poll_next(
1780        mut self: std::pin::Pin<&mut Self>,
1781        cx: &mut std::task::Context<'_>,
1782    ) -> std::task::Poll<Option<Self::Item>> {
1783        let this = &mut *self;
1784        if this.inner.check_shutdown(cx) {
1785            this.is_terminated = true;
1786            return std::task::Poll::Ready(None);
1787        }
1788        if this.is_terminated {
1789            panic!("polled Ipv6RoutingTableControllerRequestStream after completion");
1790        }
1791        fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1792            |bytes, handles| {
1793                match this.inner.channel().read_etc(cx, bytes, handles) {
1794                    std::task::Poll::Ready(Ok(())) => {}
1795                    std::task::Poll::Pending => return std::task::Poll::Pending,
1796                    std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1797                        this.is_terminated = true;
1798                        return std::task::Poll::Ready(None);
1799                    }
1800                    std::task::Poll::Ready(Err(e)) => {
1801                        return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1802                            e.into(),
1803                        ))));
1804                    }
1805                }
1806
1807                // A message has been received from the channel
1808                let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1809
1810                std::task::Poll::Ready(Some(match header.ordinal {
1811                0x71ca1f54a716de90 => {
1812                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1813                    let mut req = fidl::new_empty!(Ipv6RoutingTableControllerAddRouteRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1814                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv6RoutingTableControllerAddRouteRequest>(&header, _body_bytes, handles, &mut req)?;
1815                    let control_handle = Ipv6RoutingTableControllerControlHandle {
1816                        inner: this.inner.clone(),
1817                    };
1818                    Ok(Ipv6RoutingTableControllerRequest::AddRoute {addresses: req.addresses,
1819route: req.route,
1820
1821                        responder: Ipv6RoutingTableControllerAddRouteResponder {
1822                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1823                            tx_id: header.tx_id,
1824                        },
1825                    })
1826                }
1827                0x35b6c2ce4a7b3f13 => {
1828                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1829                    let mut req = fidl::new_empty!(Ipv6RoutingTableControllerDelRouteRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1830                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv6RoutingTableControllerDelRouteRequest>(&header, _body_bytes, handles, &mut req)?;
1831                    let control_handle = Ipv6RoutingTableControllerControlHandle {
1832                        inner: this.inner.clone(),
1833                    };
1834                    Ok(Ipv6RoutingTableControllerRequest::DelRoute {addresses: req.addresses,
1835
1836                        responder: Ipv6RoutingTableControllerDelRouteResponder {
1837                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1838                            tx_id: header.tx_id,
1839                        },
1840                    })
1841                }
1842                0x6d7fa5e9f18ef79f => {
1843                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1844                    let mut req = fidl::new_empty!(Ipv6RoutingTableControllerGetRouteStatsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
1845                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv6RoutingTableControllerGetRouteStatsRequest>(&header, _body_bytes, handles, &mut req)?;
1846                    let control_handle = Ipv6RoutingTableControllerControlHandle {
1847                        inner: this.inner.clone(),
1848                    };
1849                    Ok(Ipv6RoutingTableControllerRequest::GetRouteStats {addresses: req.addresses,
1850
1851                        responder: Ipv6RoutingTableControllerGetRouteStatsResponder {
1852                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1853                            tx_id: header.tx_id,
1854                        },
1855                    })
1856                }
1857                0x22a94526a0ea1078 => {
1858                    header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1859                    let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
1860                    fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1861                    let control_handle = Ipv6RoutingTableControllerControlHandle {
1862                        inner: this.inner.clone(),
1863                    };
1864                    Ok(Ipv6RoutingTableControllerRequest::WatchRoutingEvents {
1865                        responder: Ipv6RoutingTableControllerWatchRoutingEventsResponder {
1866                            control_handle: std::mem::ManuallyDrop::new(control_handle),
1867                            tx_id: header.tx_id,
1868                        },
1869                    })
1870                }
1871                _ => Err(fidl::Error::UnknownOrdinal {
1872                    ordinal: header.ordinal,
1873                    protocol_name: <Ipv6RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1874                }),
1875            }))
1876            },
1877        )
1878    }
1879}
1880
1881/// The IPv6 multicast routing controller.
1882///
1883/// Closing the client-end of the controller will disable multicast routing and
1884/// clear the multicast routing table.
1885#[derive(Debug)]
1886pub enum Ipv6RoutingTableControllerRequest {
1887    /// Adds a route such that packets matching the addresses will be forwarded
1888    /// accordingly.
1889    ///
1890    /// The provided addresses act as the key for the route; any existing route
1891    /// with the same addresses will be overwritten when this route is
1892    /// installed.
1893    ///
1894    /// If a packet arrives at an interface different from the expected input
1895    /// interface set in the route, the packet will not be forwarded and a
1896    /// [`RoutingEvent.wrong_input_interface`] event will be sent to the client.
1897    /// See [`WatchRoutingEvents`] for more details.
1898    ///
1899    /// + request `addresses` the addresses used to identify a route.
1900    /// + request `route` the multicast route.
1901    AddRoute {
1902        addresses: Ipv6UnicastSourceAndMulticastDestination,
1903        route: Route,
1904        responder: Ipv6RoutingTableControllerAddRouteResponder,
1905    },
1906    /// Delete a route.
1907    ///
1908    /// + request `addresses` the addresses used to identify a route.
1909    DelRoute {
1910        addresses: Ipv6UnicastSourceAndMulticastDestination,
1911        responder: Ipv6RoutingTableControllerDelRouteResponder,
1912    },
1913    /// Get a snapshot of statistics about a specific route.
1914    ///
1915    /// + request `addresses` the addresses used to identify a route.
1916    GetRouteStats {
1917        addresses: Ipv6UnicastSourceAndMulticastDestination,
1918        responder: Ipv6RoutingTableControllerGetRouteStatsResponder,
1919    },
1920    /// Watch for events triggered by multicast packets.
1921    ///
1922    /// The server will queue events to return when this method is called. If no
1923    /// events are ready, the call will block until an event is ready. The
1924    /// server will drop new events if the client is not consuming them fast
1925    /// enough and return the number of events dropped in-between events.
1926    ///
1927    /// It is invalid to call this method while a previous call is pending.
1928    /// Doing so will cause the server end of the protocol to be closed.
1929    ///
1930    /// - response `dropped_events` the number of events that were dropped
1931    ///   _immediately before_ the returned event was queued.
1932    ///   returned event.
1933    /// - response `addresses` the addresses in the multicast packet triggering
1934    ///   the event.
1935    /// - response `input_interface` the interface the multicast packet
1936    ///   triggering the event arrived at.
1937    /// - response `event` the event.
1938    WatchRoutingEvents { responder: Ipv6RoutingTableControllerWatchRoutingEventsResponder },
1939}
1940
1941impl Ipv6RoutingTableControllerRequest {
1942    #[allow(irrefutable_let_patterns)]
1943    pub fn into_add_route(
1944        self,
1945    ) -> Option<(
1946        Ipv6UnicastSourceAndMulticastDestination,
1947        Route,
1948        Ipv6RoutingTableControllerAddRouteResponder,
1949    )> {
1950        if let Ipv6RoutingTableControllerRequest::AddRoute { addresses, route, responder } = self {
1951            Some((addresses, route, responder))
1952        } else {
1953            None
1954        }
1955    }
1956
1957    #[allow(irrefutable_let_patterns)]
1958    pub fn into_del_route(
1959        self,
1960    ) -> Option<(
1961        Ipv6UnicastSourceAndMulticastDestination,
1962        Ipv6RoutingTableControllerDelRouteResponder,
1963    )> {
1964        if let Ipv6RoutingTableControllerRequest::DelRoute { addresses, responder } = self {
1965            Some((addresses, responder))
1966        } else {
1967            None
1968        }
1969    }
1970
1971    #[allow(irrefutable_let_patterns)]
1972    pub fn into_get_route_stats(
1973        self,
1974    ) -> Option<(
1975        Ipv6UnicastSourceAndMulticastDestination,
1976        Ipv6RoutingTableControllerGetRouteStatsResponder,
1977    )> {
1978        if let Ipv6RoutingTableControllerRequest::GetRouteStats { addresses, responder } = self {
1979            Some((addresses, responder))
1980        } else {
1981            None
1982        }
1983    }
1984
1985    #[allow(irrefutable_let_patterns)]
1986    pub fn into_watch_routing_events(
1987        self,
1988    ) -> Option<(Ipv6RoutingTableControllerWatchRoutingEventsResponder)> {
1989        if let Ipv6RoutingTableControllerRequest::WatchRoutingEvents { responder } = self {
1990            Some((responder))
1991        } else {
1992            None
1993        }
1994    }
1995
1996    /// Name of the method defined in FIDL
1997    pub fn method_name(&self) -> &'static str {
1998        match *self {
1999            Ipv6RoutingTableControllerRequest::AddRoute { .. } => "add_route",
2000            Ipv6RoutingTableControllerRequest::DelRoute { .. } => "del_route",
2001            Ipv6RoutingTableControllerRequest::GetRouteStats { .. } => "get_route_stats",
2002            Ipv6RoutingTableControllerRequest::WatchRoutingEvents { .. } => "watch_routing_events",
2003        }
2004    }
2005}
2006
2007#[derive(Debug, Clone)]
2008pub struct Ipv6RoutingTableControllerControlHandle {
2009    inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
2010}
2011
2012impl fidl::endpoints::ControlHandle for Ipv6RoutingTableControllerControlHandle {
2013    fn shutdown(&self) {
2014        self.inner.shutdown()
2015    }
2016
2017    fn shutdown_with_epitaph(&self, status: zx_status::Status) {
2018        self.inner.shutdown_with_epitaph(status)
2019    }
2020
2021    fn is_closed(&self) -> bool {
2022        self.inner.channel().is_closed()
2023    }
2024    fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
2025        self.inner.channel().on_closed()
2026    }
2027
2028    #[cfg(target_os = "fuchsia")]
2029    fn signal_peer(
2030        &self,
2031        clear_mask: zx::Signals,
2032        set_mask: zx::Signals,
2033    ) -> Result<(), zx_status::Status> {
2034        use fidl::Peered;
2035        self.inner.channel().signal_peer(clear_mask, set_mask)
2036    }
2037}
2038
2039impl Ipv6RoutingTableControllerControlHandle {
2040    pub fn send_on_close(&self, mut error: TableControllerCloseReason) -> Result<(), fidl::Error> {
2041        self.inner.send::<Ipv6RoutingTableControllerOnCloseRequest>(
2042            (error,),
2043            0,
2044            0x2d3a353489d1e0be,
2045            fidl::encoding::DynamicFlags::empty(),
2046        )
2047    }
2048}
2049
2050#[must_use = "FIDL methods require a response to be sent"]
2051#[derive(Debug)]
2052pub struct Ipv6RoutingTableControllerAddRouteResponder {
2053    control_handle: std::mem::ManuallyDrop<Ipv6RoutingTableControllerControlHandle>,
2054    tx_id: u32,
2055}
2056
2057/// Set the the channel to be shutdown (see [`Ipv6RoutingTableControllerControlHandle::shutdown`])
2058/// if the responder is dropped without sending a response, so that the client
2059/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2060impl std::ops::Drop for Ipv6RoutingTableControllerAddRouteResponder {
2061    fn drop(&mut self) {
2062        self.control_handle.shutdown();
2063        // Safety: drops once, never accessed again
2064        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2065    }
2066}
2067
2068impl fidl::endpoints::Responder for Ipv6RoutingTableControllerAddRouteResponder {
2069    type ControlHandle = Ipv6RoutingTableControllerControlHandle;
2070
2071    fn control_handle(&self) -> &Ipv6RoutingTableControllerControlHandle {
2072        &self.control_handle
2073    }
2074
2075    fn drop_without_shutdown(mut self) {
2076        // Safety: drops once, never accessed again due to mem::forget
2077        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2078        // Prevent Drop from running (which would shut down the channel)
2079        std::mem::forget(self);
2080    }
2081}
2082
2083impl Ipv6RoutingTableControllerAddRouteResponder {
2084    /// Sends a response to the FIDL transaction.
2085    ///
2086    /// Sets the channel to shutdown if an error occurs.
2087    pub fn send(
2088        self,
2089        mut result: Result<(), Ipv6RoutingTableControllerAddRouteError>,
2090    ) -> Result<(), fidl::Error> {
2091        let _result = self.send_raw(result);
2092        if _result.is_err() {
2093            self.control_handle.shutdown();
2094        }
2095        self.drop_without_shutdown();
2096        _result
2097    }
2098
2099    /// Similar to "send" but does not shutdown the channel if an error occurs.
2100    pub fn send_no_shutdown_on_err(
2101        self,
2102        mut result: Result<(), Ipv6RoutingTableControllerAddRouteError>,
2103    ) -> Result<(), fidl::Error> {
2104        let _result = self.send_raw(result);
2105        self.drop_without_shutdown();
2106        _result
2107    }
2108
2109    fn send_raw(
2110        &self,
2111        mut result: Result<(), Ipv6RoutingTableControllerAddRouteError>,
2112    ) -> Result<(), fidl::Error> {
2113        self.control_handle.inner.send::<fidl::encoding::ResultType<
2114            fidl::encoding::EmptyStruct,
2115            Ipv6RoutingTableControllerAddRouteError,
2116        >>(
2117            result,
2118            self.tx_id,
2119            0x71ca1f54a716de90,
2120            fidl::encoding::DynamicFlags::empty(),
2121        )
2122    }
2123}
2124
2125#[must_use = "FIDL methods require a response to be sent"]
2126#[derive(Debug)]
2127pub struct Ipv6RoutingTableControllerDelRouteResponder {
2128    control_handle: std::mem::ManuallyDrop<Ipv6RoutingTableControllerControlHandle>,
2129    tx_id: u32,
2130}
2131
2132/// Set the the channel to be shutdown (see [`Ipv6RoutingTableControllerControlHandle::shutdown`])
2133/// if the responder is dropped without sending a response, so that the client
2134/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2135impl std::ops::Drop for Ipv6RoutingTableControllerDelRouteResponder {
2136    fn drop(&mut self) {
2137        self.control_handle.shutdown();
2138        // Safety: drops once, never accessed again
2139        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2140    }
2141}
2142
2143impl fidl::endpoints::Responder for Ipv6RoutingTableControllerDelRouteResponder {
2144    type ControlHandle = Ipv6RoutingTableControllerControlHandle;
2145
2146    fn control_handle(&self) -> &Ipv6RoutingTableControllerControlHandle {
2147        &self.control_handle
2148    }
2149
2150    fn drop_without_shutdown(mut self) {
2151        // Safety: drops once, never accessed again due to mem::forget
2152        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2153        // Prevent Drop from running (which would shut down the channel)
2154        std::mem::forget(self);
2155    }
2156}
2157
2158impl Ipv6RoutingTableControllerDelRouteResponder {
2159    /// Sends a response to the FIDL transaction.
2160    ///
2161    /// Sets the channel to shutdown if an error occurs.
2162    pub fn send(
2163        self,
2164        mut result: Result<(), Ipv6RoutingTableControllerDelRouteError>,
2165    ) -> Result<(), fidl::Error> {
2166        let _result = self.send_raw(result);
2167        if _result.is_err() {
2168            self.control_handle.shutdown();
2169        }
2170        self.drop_without_shutdown();
2171        _result
2172    }
2173
2174    /// Similar to "send" but does not shutdown the channel if an error occurs.
2175    pub fn send_no_shutdown_on_err(
2176        self,
2177        mut result: Result<(), Ipv6RoutingTableControllerDelRouteError>,
2178    ) -> Result<(), fidl::Error> {
2179        let _result = self.send_raw(result);
2180        self.drop_without_shutdown();
2181        _result
2182    }
2183
2184    fn send_raw(
2185        &self,
2186        mut result: Result<(), Ipv6RoutingTableControllerDelRouteError>,
2187    ) -> Result<(), fidl::Error> {
2188        self.control_handle.inner.send::<fidl::encoding::ResultType<
2189            fidl::encoding::EmptyStruct,
2190            Ipv6RoutingTableControllerDelRouteError,
2191        >>(
2192            result,
2193            self.tx_id,
2194            0x35b6c2ce4a7b3f13,
2195            fidl::encoding::DynamicFlags::empty(),
2196        )
2197    }
2198}
2199
2200#[must_use = "FIDL methods require a response to be sent"]
2201#[derive(Debug)]
2202pub struct Ipv6RoutingTableControllerGetRouteStatsResponder {
2203    control_handle: std::mem::ManuallyDrop<Ipv6RoutingTableControllerControlHandle>,
2204    tx_id: u32,
2205}
2206
2207/// Set the the channel to be shutdown (see [`Ipv6RoutingTableControllerControlHandle::shutdown`])
2208/// if the responder is dropped without sending a response, so that the client
2209/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2210impl std::ops::Drop for Ipv6RoutingTableControllerGetRouteStatsResponder {
2211    fn drop(&mut self) {
2212        self.control_handle.shutdown();
2213        // Safety: drops once, never accessed again
2214        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2215    }
2216}
2217
2218impl fidl::endpoints::Responder for Ipv6RoutingTableControllerGetRouteStatsResponder {
2219    type ControlHandle = Ipv6RoutingTableControllerControlHandle;
2220
2221    fn control_handle(&self) -> &Ipv6RoutingTableControllerControlHandle {
2222        &self.control_handle
2223    }
2224
2225    fn drop_without_shutdown(mut self) {
2226        // Safety: drops once, never accessed again due to mem::forget
2227        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2228        // Prevent Drop from running (which would shut down the channel)
2229        std::mem::forget(self);
2230    }
2231}
2232
2233impl Ipv6RoutingTableControllerGetRouteStatsResponder {
2234    /// Sends a response to the FIDL transaction.
2235    ///
2236    /// Sets the channel to shutdown if an error occurs.
2237    pub fn send(
2238        self,
2239        mut result: Result<&RouteStats, Ipv6RoutingTableControllerGetRouteStatsError>,
2240    ) -> Result<(), fidl::Error> {
2241        let _result = self.send_raw(result);
2242        if _result.is_err() {
2243            self.control_handle.shutdown();
2244        }
2245        self.drop_without_shutdown();
2246        _result
2247    }
2248
2249    /// Similar to "send" but does not shutdown the channel if an error occurs.
2250    pub fn send_no_shutdown_on_err(
2251        self,
2252        mut result: Result<&RouteStats, Ipv6RoutingTableControllerGetRouteStatsError>,
2253    ) -> Result<(), fidl::Error> {
2254        let _result = self.send_raw(result);
2255        self.drop_without_shutdown();
2256        _result
2257    }
2258
2259    fn send_raw(
2260        &self,
2261        mut result: Result<&RouteStats, Ipv6RoutingTableControllerGetRouteStatsError>,
2262    ) -> Result<(), fidl::Error> {
2263        self.control_handle.inner.send::<fidl::encoding::ResultType<
2264            Ipv6RoutingTableControllerGetRouteStatsResponse,
2265            Ipv6RoutingTableControllerGetRouteStatsError,
2266        >>(
2267            result.map(|stats| (stats,)),
2268            self.tx_id,
2269            0x6d7fa5e9f18ef79f,
2270            fidl::encoding::DynamicFlags::empty(),
2271        )
2272    }
2273}
2274
2275#[must_use = "FIDL methods require a response to be sent"]
2276#[derive(Debug)]
2277pub struct Ipv6RoutingTableControllerWatchRoutingEventsResponder {
2278    control_handle: std::mem::ManuallyDrop<Ipv6RoutingTableControllerControlHandle>,
2279    tx_id: u32,
2280}
2281
2282/// Set the the channel to be shutdown (see [`Ipv6RoutingTableControllerControlHandle::shutdown`])
2283/// if the responder is dropped without sending a response, so that the client
2284/// doesn't hang. To prevent this behavior, call `drop_without_shutdown`.
2285impl std::ops::Drop for Ipv6RoutingTableControllerWatchRoutingEventsResponder {
2286    fn drop(&mut self) {
2287        self.control_handle.shutdown();
2288        // Safety: drops once, never accessed again
2289        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2290    }
2291}
2292
2293impl fidl::endpoints::Responder for Ipv6RoutingTableControllerWatchRoutingEventsResponder {
2294    type ControlHandle = Ipv6RoutingTableControllerControlHandle;
2295
2296    fn control_handle(&self) -> &Ipv6RoutingTableControllerControlHandle {
2297        &self.control_handle
2298    }
2299
2300    fn drop_without_shutdown(mut self) {
2301        // Safety: drops once, never accessed again due to mem::forget
2302        unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
2303        // Prevent Drop from running (which would shut down the channel)
2304        std::mem::forget(self);
2305    }
2306}
2307
2308impl Ipv6RoutingTableControllerWatchRoutingEventsResponder {
2309    /// Sends a response to the FIDL transaction.
2310    ///
2311    /// Sets the channel to shutdown if an error occurs.
2312    pub fn send(
2313        self,
2314        mut dropped_events: u64,
2315        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
2316        mut input_interface: u64,
2317        mut event: &RoutingEvent,
2318    ) -> Result<(), fidl::Error> {
2319        let _result = self.send_raw(dropped_events, addresses, input_interface, event);
2320        if _result.is_err() {
2321            self.control_handle.shutdown();
2322        }
2323        self.drop_without_shutdown();
2324        _result
2325    }
2326
2327    /// Similar to "send" but does not shutdown the channel if an error occurs.
2328    pub fn send_no_shutdown_on_err(
2329        self,
2330        mut dropped_events: u64,
2331        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
2332        mut input_interface: u64,
2333        mut event: &RoutingEvent,
2334    ) -> Result<(), fidl::Error> {
2335        let _result = self.send_raw(dropped_events, addresses, input_interface, event);
2336        self.drop_without_shutdown();
2337        _result
2338    }
2339
2340    fn send_raw(
2341        &self,
2342        mut dropped_events: u64,
2343        mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
2344        mut input_interface: u64,
2345        mut event: &RoutingEvent,
2346    ) -> Result<(), fidl::Error> {
2347        self.control_handle.inner.send::<Ipv6RoutingTableControllerWatchRoutingEventsResponse>(
2348            (dropped_events, addresses, input_interface, event),
2349            self.tx_id,
2350            0x22a94526a0ea1078,
2351            fidl::encoding::DynamicFlags::empty(),
2352        )
2353    }
2354}
2355
2356mod internal {
2357    use super::*;
2358}