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