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