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_sockets_common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, PartialEq)]
15pub struct DiagnosticsIterateIpRequest {
16 pub s: fidl::endpoints::ServerEnd<IpIteratorMarker>,
18 pub extensions: Extensions,
22 pub matchers: Vec<IpSocketMatcher>,
54}
55
56impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
57 for DiagnosticsIterateIpRequest
58{
59}
60
61#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
62pub struct ControlMarker;
63
64impl fidl::endpoints::ProtocolMarker for ControlMarker {
65 type Proxy = ControlProxy;
66 type RequestStream = ControlRequestStream;
67 #[cfg(target_os = "fuchsia")]
68 type SynchronousProxy = ControlSynchronousProxy;
69
70 const DEBUG_NAME: &'static str = "fuchsia.net.sockets.Control";
71}
72impl fidl::endpoints::DiscoverableProtocolMarker for ControlMarker {}
73
74pub trait ControlProxyInterface: Send + Sync {
75 type DisconnectIpResponseFut: std::future::Future<Output = Result<DisconnectIpResult, fidl::Error>>
76 + Send;
77 fn r#disconnect_ip(
78 &self,
79 payload: &ControlDisconnectIpRequest,
80 ) -> Self::DisconnectIpResponseFut;
81}
82#[derive(Debug)]
83#[cfg(target_os = "fuchsia")]
84pub struct ControlSynchronousProxy {
85 client: fidl::client::sync::Client,
86}
87
88#[cfg(target_os = "fuchsia")]
89impl fidl::endpoints::SynchronousProxy for ControlSynchronousProxy {
90 type Proxy = ControlProxy;
91 type Protocol = ControlMarker;
92
93 fn from_channel(inner: fidl::Channel) -> Self {
94 Self::new(inner)
95 }
96
97 fn into_channel(self) -> fidl::Channel {
98 self.client.into_channel()
99 }
100
101 fn as_channel(&self) -> &fidl::Channel {
102 self.client.as_channel()
103 }
104}
105
106#[cfg(target_os = "fuchsia")]
107impl ControlSynchronousProxy {
108 pub fn new(channel: fidl::Channel) -> Self {
109 Self { client: fidl::client::sync::Client::new(channel) }
110 }
111
112 pub fn into_channel(self) -> fidl::Channel {
113 self.client.into_channel()
114 }
115
116 pub fn wait_for_event(
119 &self,
120 deadline: zx::MonotonicInstant,
121 ) -> Result<ControlEvent, fidl::Error> {
122 ControlEvent::decode(self.client.wait_for_event::<ControlMarker>(deadline)?)
123 }
124
125 pub fn r#disconnect_ip(
152 &self,
153 mut payload: &ControlDisconnectIpRequest,
154 ___deadline: zx::MonotonicInstant,
155 ) -> Result<DisconnectIpResult, fidl::Error> {
156 let _response = self
157 .client
158 .send_query::<ControlDisconnectIpRequest, DisconnectIpResult, ControlMarker>(
159 payload,
160 0xbdaa66fbb4241a4,
161 fidl::encoding::DynamicFlags::empty(),
162 ___deadline,
163 )?;
164 Ok(_response)
165 }
166}
167
168#[cfg(target_os = "fuchsia")]
169impl From<ControlSynchronousProxy> for zx::NullableHandle {
170 fn from(value: ControlSynchronousProxy) -> Self {
171 value.into_channel().into()
172 }
173}
174
175#[cfg(target_os = "fuchsia")]
176impl From<fidl::Channel> for ControlSynchronousProxy {
177 fn from(value: fidl::Channel) -> Self {
178 Self::new(value)
179 }
180}
181
182#[cfg(target_os = "fuchsia")]
183impl fidl::endpoints::FromClient for ControlSynchronousProxy {
184 type Protocol = ControlMarker;
185
186 fn from_client(value: fidl::endpoints::ClientEnd<ControlMarker>) -> Self {
187 Self::new(value.into_channel())
188 }
189}
190
191#[derive(Debug, Clone)]
192pub struct ControlProxy {
193 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
194}
195
196impl fidl::endpoints::Proxy for ControlProxy {
197 type Protocol = ControlMarker;
198
199 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
200 Self::new(inner)
201 }
202
203 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
204 self.client.into_channel().map_err(|client| Self { client })
205 }
206
207 fn as_channel(&self) -> &::fidl::AsyncChannel {
208 self.client.as_channel()
209 }
210}
211
212impl ControlProxy {
213 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
215 let protocol_name = <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
216 Self { client: fidl::client::Client::new(channel, protocol_name) }
217 }
218
219 pub fn take_event_stream(&self) -> ControlEventStream {
225 ControlEventStream { event_receiver: self.client.take_event_receiver() }
226 }
227
228 pub fn r#disconnect_ip(
255 &self,
256 mut payload: &ControlDisconnectIpRequest,
257 ) -> fidl::client::QueryResponseFut<
258 DisconnectIpResult,
259 fidl::encoding::DefaultFuchsiaResourceDialect,
260 > {
261 ControlProxyInterface::r#disconnect_ip(self, payload)
262 }
263}
264
265impl ControlProxyInterface for ControlProxy {
266 type DisconnectIpResponseFut = fidl::client::QueryResponseFut<
267 DisconnectIpResult,
268 fidl::encoding::DefaultFuchsiaResourceDialect,
269 >;
270 fn r#disconnect_ip(
271 &self,
272 mut payload: &ControlDisconnectIpRequest,
273 ) -> Self::DisconnectIpResponseFut {
274 fn _decode(
275 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
276 ) -> Result<DisconnectIpResult, fidl::Error> {
277 let _response = fidl::client::decode_transaction_body::<
278 DisconnectIpResult,
279 fidl::encoding::DefaultFuchsiaResourceDialect,
280 0xbdaa66fbb4241a4,
281 >(_buf?)?;
282 Ok(_response)
283 }
284 self.client.send_query_and_decode::<ControlDisconnectIpRequest, DisconnectIpResult>(
285 payload,
286 0xbdaa66fbb4241a4,
287 fidl::encoding::DynamicFlags::empty(),
288 _decode,
289 )
290 }
291}
292
293pub struct ControlEventStream {
294 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
295}
296
297impl std::marker::Unpin for ControlEventStream {}
298
299impl futures::stream::FusedStream for ControlEventStream {
300 fn is_terminated(&self) -> bool {
301 self.event_receiver.is_terminated()
302 }
303}
304
305impl futures::Stream for ControlEventStream {
306 type Item = Result<ControlEvent, fidl::Error>;
307
308 fn poll_next(
309 mut self: std::pin::Pin<&mut Self>,
310 cx: &mut std::task::Context<'_>,
311 ) -> std::task::Poll<Option<Self::Item>> {
312 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
313 &mut self.event_receiver,
314 cx
315 )?) {
316 Some(buf) => std::task::Poll::Ready(Some(ControlEvent::decode(buf))),
317 None => std::task::Poll::Ready(None),
318 }
319 }
320}
321
322#[derive(Debug)]
323pub enum ControlEvent {}
324
325impl ControlEvent {
326 fn decode(
328 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
329 ) -> Result<ControlEvent, fidl::Error> {
330 let (bytes, _handles) = buf.split_mut();
331 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
332 debug_assert_eq!(tx_header.tx_id, 0);
333 match tx_header.ordinal {
334 _ => Err(fidl::Error::UnknownOrdinal {
335 ordinal: tx_header.ordinal,
336 protocol_name: <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
337 }),
338 }
339 }
340}
341
342pub struct ControlRequestStream {
344 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
345 is_terminated: bool,
346}
347
348impl std::marker::Unpin for ControlRequestStream {}
349
350impl futures::stream::FusedStream for ControlRequestStream {
351 fn is_terminated(&self) -> bool {
352 self.is_terminated
353 }
354}
355
356impl fidl::endpoints::RequestStream for ControlRequestStream {
357 type Protocol = ControlMarker;
358 type ControlHandle = ControlControlHandle;
359
360 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
361 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
362 }
363
364 fn control_handle(&self) -> Self::ControlHandle {
365 ControlControlHandle { inner: self.inner.clone() }
366 }
367
368 fn into_inner(
369 self,
370 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
371 {
372 (self.inner, self.is_terminated)
373 }
374
375 fn from_inner(
376 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
377 is_terminated: bool,
378 ) -> Self {
379 Self { inner, is_terminated }
380 }
381}
382
383impl futures::Stream for ControlRequestStream {
384 type Item = Result<ControlRequest, fidl::Error>;
385
386 fn poll_next(
387 mut self: std::pin::Pin<&mut Self>,
388 cx: &mut std::task::Context<'_>,
389 ) -> std::task::Poll<Option<Self::Item>> {
390 let this = &mut *self;
391 if this.inner.check_shutdown(cx) {
392 this.is_terminated = true;
393 return std::task::Poll::Ready(None);
394 }
395 if this.is_terminated {
396 panic!("polled ControlRequestStream after completion");
397 }
398 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
399 |bytes, handles| {
400 match this.inner.channel().read_etc(cx, bytes, handles) {
401 std::task::Poll::Ready(Ok(())) => {}
402 std::task::Poll::Pending => return std::task::Poll::Pending,
403 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
404 this.is_terminated = true;
405 return std::task::Poll::Ready(None);
406 }
407 std::task::Poll::Ready(Err(e)) => {
408 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
409 e.into(),
410 ))));
411 }
412 }
413
414 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
416
417 std::task::Poll::Ready(Some(match header.ordinal {
418 0xbdaa66fbb4241a4 => {
419 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
420 let mut req = fidl::new_empty!(
421 ControlDisconnectIpRequest,
422 fidl::encoding::DefaultFuchsiaResourceDialect
423 );
424 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ControlDisconnectIpRequest>(&header, _body_bytes, handles, &mut req)?;
425 let control_handle = ControlControlHandle { inner: this.inner.clone() };
426 Ok(ControlRequest::DisconnectIp {
427 payload: req,
428 responder: ControlDisconnectIpResponder {
429 control_handle: std::mem::ManuallyDrop::new(control_handle),
430 tx_id: header.tx_id,
431 },
432 })
433 }
434 _ => Err(fidl::Error::UnknownOrdinal {
435 ordinal: header.ordinal,
436 protocol_name:
437 <ControlMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
438 }),
439 }))
440 },
441 )
442 }
443}
444
445#[derive(Debug)]
447pub enum ControlRequest {
448 DisconnectIp { payload: ControlDisconnectIpRequest, responder: ControlDisconnectIpResponder },
475}
476
477impl ControlRequest {
478 #[allow(irrefutable_let_patterns)]
479 pub fn into_disconnect_ip(
480 self,
481 ) -> Option<(ControlDisconnectIpRequest, ControlDisconnectIpResponder)> {
482 if let ControlRequest::DisconnectIp { payload, responder } = self {
483 Some((payload, responder))
484 } else {
485 None
486 }
487 }
488
489 pub fn method_name(&self) -> &'static str {
491 match *self {
492 ControlRequest::DisconnectIp { .. } => "disconnect_ip",
493 }
494 }
495}
496
497#[derive(Debug, Clone)]
498pub struct ControlControlHandle {
499 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
500}
501
502impl fidl::endpoints::ControlHandle for ControlControlHandle {
503 fn shutdown(&self) {
504 self.inner.shutdown()
505 }
506
507 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
508 self.inner.shutdown_with_epitaph(status)
509 }
510
511 fn is_closed(&self) -> bool {
512 self.inner.channel().is_closed()
513 }
514 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
515 self.inner.channel().on_closed()
516 }
517
518 #[cfg(target_os = "fuchsia")]
519 fn signal_peer(
520 &self,
521 clear_mask: zx::Signals,
522 set_mask: zx::Signals,
523 ) -> Result<(), zx_status::Status> {
524 use fidl::Peered;
525 self.inner.channel().signal_peer(clear_mask, set_mask)
526 }
527}
528
529impl ControlControlHandle {}
530
531#[must_use = "FIDL methods require a response to be sent"]
532#[derive(Debug)]
533pub struct ControlDisconnectIpResponder {
534 control_handle: std::mem::ManuallyDrop<ControlControlHandle>,
535 tx_id: u32,
536}
537
538impl std::ops::Drop for ControlDisconnectIpResponder {
542 fn drop(&mut self) {
543 self.control_handle.shutdown();
544 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
546 }
547}
548
549impl fidl::endpoints::Responder for ControlDisconnectIpResponder {
550 type ControlHandle = ControlControlHandle;
551
552 fn control_handle(&self) -> &ControlControlHandle {
553 &self.control_handle
554 }
555
556 fn drop_without_shutdown(mut self) {
557 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
559 std::mem::forget(self);
561 }
562}
563
564impl ControlDisconnectIpResponder {
565 pub fn send(self, mut payload: &DisconnectIpResult) -> Result<(), fidl::Error> {
569 let _result = self.send_raw(payload);
570 if _result.is_err() {
571 self.control_handle.shutdown();
572 }
573 self.drop_without_shutdown();
574 _result
575 }
576
577 pub fn send_no_shutdown_on_err(
579 self,
580 mut payload: &DisconnectIpResult,
581 ) -> Result<(), fidl::Error> {
582 let _result = self.send_raw(payload);
583 self.drop_without_shutdown();
584 _result
585 }
586
587 fn send_raw(&self, mut payload: &DisconnectIpResult) -> Result<(), fidl::Error> {
588 self.control_handle.inner.send::<DisconnectIpResult>(
589 payload,
590 self.tx_id,
591 0xbdaa66fbb4241a4,
592 fidl::encoding::DynamicFlags::empty(),
593 )
594 }
595}
596
597#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
598pub struct DiagnosticsMarker;
599
600impl fidl::endpoints::ProtocolMarker for DiagnosticsMarker {
601 type Proxy = DiagnosticsProxy;
602 type RequestStream = DiagnosticsRequestStream;
603 #[cfg(target_os = "fuchsia")]
604 type SynchronousProxy = DiagnosticsSynchronousProxy;
605
606 const DEBUG_NAME: &'static str = "fuchsia.net.sockets.Diagnostics";
607}
608impl fidl::endpoints::DiscoverableProtocolMarker for DiagnosticsMarker {}
609
610pub trait DiagnosticsProxyInterface: Send + Sync {
611 type IterateIpResponseFut: std::future::Future<Output = Result<IterateIpResult, fidl::Error>>
612 + Send;
613 fn r#iterate_ip(
614 &self,
615 s: fidl::endpoints::ServerEnd<IpIteratorMarker>,
616 extensions: Extensions,
617 matchers: &[IpSocketMatcher],
618 ) -> Self::IterateIpResponseFut;
619}
620#[derive(Debug)]
621#[cfg(target_os = "fuchsia")]
622pub struct DiagnosticsSynchronousProxy {
623 client: fidl::client::sync::Client,
624}
625
626#[cfg(target_os = "fuchsia")]
627impl fidl::endpoints::SynchronousProxy for DiagnosticsSynchronousProxy {
628 type Proxy = DiagnosticsProxy;
629 type Protocol = DiagnosticsMarker;
630
631 fn from_channel(inner: fidl::Channel) -> Self {
632 Self::new(inner)
633 }
634
635 fn into_channel(self) -> fidl::Channel {
636 self.client.into_channel()
637 }
638
639 fn as_channel(&self) -> &fidl::Channel {
640 self.client.as_channel()
641 }
642}
643
644#[cfg(target_os = "fuchsia")]
645impl DiagnosticsSynchronousProxy {
646 pub fn new(channel: fidl::Channel) -> Self {
647 Self { client: fidl::client::sync::Client::new(channel) }
648 }
649
650 pub fn into_channel(self) -> fidl::Channel {
651 self.client.into_channel()
652 }
653
654 pub fn wait_for_event(
657 &self,
658 deadline: zx::MonotonicInstant,
659 ) -> Result<DiagnosticsEvent, fidl::Error> {
660 DiagnosticsEvent::decode(self.client.wait_for_event::<DiagnosticsMarker>(deadline)?)
661 }
662
663 pub fn r#iterate_ip(
668 &self,
669 mut s: fidl::endpoints::ServerEnd<IpIteratorMarker>,
670 mut extensions: Extensions,
671 mut matchers: &[IpSocketMatcher],
672 ___deadline: zx::MonotonicInstant,
673 ) -> Result<IterateIpResult, fidl::Error> {
674 let _response = self
675 .client
676 .send_query::<DiagnosticsIterateIpRequest, IterateIpResult, DiagnosticsMarker>(
677 (s, extensions, matchers),
678 0x7b05425e48d07605,
679 fidl::encoding::DynamicFlags::empty(),
680 ___deadline,
681 )?;
682 Ok(_response)
683 }
684}
685
686#[cfg(target_os = "fuchsia")]
687impl From<DiagnosticsSynchronousProxy> for zx::NullableHandle {
688 fn from(value: DiagnosticsSynchronousProxy) -> Self {
689 value.into_channel().into()
690 }
691}
692
693#[cfg(target_os = "fuchsia")]
694impl From<fidl::Channel> for DiagnosticsSynchronousProxy {
695 fn from(value: fidl::Channel) -> Self {
696 Self::new(value)
697 }
698}
699
700#[cfg(target_os = "fuchsia")]
701impl fidl::endpoints::FromClient for DiagnosticsSynchronousProxy {
702 type Protocol = DiagnosticsMarker;
703
704 fn from_client(value: fidl::endpoints::ClientEnd<DiagnosticsMarker>) -> Self {
705 Self::new(value.into_channel())
706 }
707}
708
709#[derive(Debug, Clone)]
710pub struct DiagnosticsProxy {
711 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
712}
713
714impl fidl::endpoints::Proxy for DiagnosticsProxy {
715 type Protocol = DiagnosticsMarker;
716
717 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
718 Self::new(inner)
719 }
720
721 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
722 self.client.into_channel().map_err(|client| Self { client })
723 }
724
725 fn as_channel(&self) -> &::fidl::AsyncChannel {
726 self.client.as_channel()
727 }
728}
729
730impl DiagnosticsProxy {
731 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
733 let protocol_name = <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
734 Self { client: fidl::client::Client::new(channel, protocol_name) }
735 }
736
737 pub fn take_event_stream(&self) -> DiagnosticsEventStream {
743 DiagnosticsEventStream { event_receiver: self.client.take_event_receiver() }
744 }
745
746 pub fn r#iterate_ip(
751 &self,
752 mut s: fidl::endpoints::ServerEnd<IpIteratorMarker>,
753 mut extensions: Extensions,
754 mut matchers: &[IpSocketMatcher],
755 ) -> fidl::client::QueryResponseFut<
756 IterateIpResult,
757 fidl::encoding::DefaultFuchsiaResourceDialect,
758 > {
759 DiagnosticsProxyInterface::r#iterate_ip(self, s, extensions, matchers)
760 }
761}
762
763impl DiagnosticsProxyInterface for DiagnosticsProxy {
764 type IterateIpResponseFut = fidl::client::QueryResponseFut<
765 IterateIpResult,
766 fidl::encoding::DefaultFuchsiaResourceDialect,
767 >;
768 fn r#iterate_ip(
769 &self,
770 mut s: fidl::endpoints::ServerEnd<IpIteratorMarker>,
771 mut extensions: Extensions,
772 mut matchers: &[IpSocketMatcher],
773 ) -> Self::IterateIpResponseFut {
774 fn _decode(
775 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
776 ) -> Result<IterateIpResult, fidl::Error> {
777 let _response = fidl::client::decode_transaction_body::<
778 IterateIpResult,
779 fidl::encoding::DefaultFuchsiaResourceDialect,
780 0x7b05425e48d07605,
781 >(_buf?)?;
782 Ok(_response)
783 }
784 self.client.send_query_and_decode::<DiagnosticsIterateIpRequest, IterateIpResult>(
785 (s, extensions, matchers),
786 0x7b05425e48d07605,
787 fidl::encoding::DynamicFlags::empty(),
788 _decode,
789 )
790 }
791}
792
793pub struct DiagnosticsEventStream {
794 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
795}
796
797impl std::marker::Unpin for DiagnosticsEventStream {}
798
799impl futures::stream::FusedStream for DiagnosticsEventStream {
800 fn is_terminated(&self) -> bool {
801 self.event_receiver.is_terminated()
802 }
803}
804
805impl futures::Stream for DiagnosticsEventStream {
806 type Item = Result<DiagnosticsEvent, fidl::Error>;
807
808 fn poll_next(
809 mut self: std::pin::Pin<&mut Self>,
810 cx: &mut std::task::Context<'_>,
811 ) -> std::task::Poll<Option<Self::Item>> {
812 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
813 &mut self.event_receiver,
814 cx
815 )?) {
816 Some(buf) => std::task::Poll::Ready(Some(DiagnosticsEvent::decode(buf))),
817 None => std::task::Poll::Ready(None),
818 }
819 }
820}
821
822#[derive(Debug)]
823pub enum DiagnosticsEvent {}
824
825impl DiagnosticsEvent {
826 fn decode(
828 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
829 ) -> Result<DiagnosticsEvent, fidl::Error> {
830 let (bytes, _handles) = buf.split_mut();
831 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
832 debug_assert_eq!(tx_header.tx_id, 0);
833 match tx_header.ordinal {
834 _ => Err(fidl::Error::UnknownOrdinal {
835 ordinal: tx_header.ordinal,
836 protocol_name: <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
837 }),
838 }
839 }
840}
841
842pub struct DiagnosticsRequestStream {
844 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
845 is_terminated: bool,
846}
847
848impl std::marker::Unpin for DiagnosticsRequestStream {}
849
850impl futures::stream::FusedStream for DiagnosticsRequestStream {
851 fn is_terminated(&self) -> bool {
852 self.is_terminated
853 }
854}
855
856impl fidl::endpoints::RequestStream for DiagnosticsRequestStream {
857 type Protocol = DiagnosticsMarker;
858 type ControlHandle = DiagnosticsControlHandle;
859
860 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
861 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
862 }
863
864 fn control_handle(&self) -> Self::ControlHandle {
865 DiagnosticsControlHandle { inner: self.inner.clone() }
866 }
867
868 fn into_inner(
869 self,
870 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
871 {
872 (self.inner, self.is_terminated)
873 }
874
875 fn from_inner(
876 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
877 is_terminated: bool,
878 ) -> Self {
879 Self { inner, is_terminated }
880 }
881}
882
883impl futures::Stream for DiagnosticsRequestStream {
884 type Item = Result<DiagnosticsRequest, fidl::Error>;
885
886 fn poll_next(
887 mut self: std::pin::Pin<&mut Self>,
888 cx: &mut std::task::Context<'_>,
889 ) -> std::task::Poll<Option<Self::Item>> {
890 let this = &mut *self;
891 if this.inner.check_shutdown(cx) {
892 this.is_terminated = true;
893 return std::task::Poll::Ready(None);
894 }
895 if this.is_terminated {
896 panic!("polled DiagnosticsRequestStream after completion");
897 }
898 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
899 |bytes, handles| {
900 match this.inner.channel().read_etc(cx, bytes, handles) {
901 std::task::Poll::Ready(Ok(())) => {}
902 std::task::Poll::Pending => return std::task::Poll::Pending,
903 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
904 this.is_terminated = true;
905 return std::task::Poll::Ready(None);
906 }
907 std::task::Poll::Ready(Err(e)) => {
908 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
909 e.into(),
910 ))));
911 }
912 }
913
914 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
916
917 std::task::Poll::Ready(Some(match header.ordinal {
918 0x7b05425e48d07605 => {
919 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
920 let mut req = fidl::new_empty!(
921 DiagnosticsIterateIpRequest,
922 fidl::encoding::DefaultFuchsiaResourceDialect
923 );
924 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DiagnosticsIterateIpRequest>(&header, _body_bytes, handles, &mut req)?;
925 let control_handle = DiagnosticsControlHandle { inner: this.inner.clone() };
926 Ok(DiagnosticsRequest::IterateIp {
927 s: req.s,
928 extensions: req.extensions,
929 matchers: req.matchers,
930
931 responder: DiagnosticsIterateIpResponder {
932 control_handle: std::mem::ManuallyDrop::new(control_handle),
933 tx_id: header.tx_id,
934 },
935 })
936 }
937 _ => Err(fidl::Error::UnknownOrdinal {
938 ordinal: header.ordinal,
939 protocol_name:
940 <DiagnosticsMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
941 }),
942 }))
943 },
944 )
945 }
946}
947
948#[derive(Debug)]
950pub enum DiagnosticsRequest {
951 IterateIp {
956 s: fidl::endpoints::ServerEnd<IpIteratorMarker>,
957 extensions: Extensions,
958 matchers: Vec<IpSocketMatcher>,
959 responder: DiagnosticsIterateIpResponder,
960 },
961}
962
963impl DiagnosticsRequest {
964 #[allow(irrefutable_let_patterns)]
965 pub fn into_iterate_ip(
966 self,
967 ) -> Option<(
968 fidl::endpoints::ServerEnd<IpIteratorMarker>,
969 Extensions,
970 Vec<IpSocketMatcher>,
971 DiagnosticsIterateIpResponder,
972 )> {
973 if let DiagnosticsRequest::IterateIp { s, extensions, matchers, responder } = self {
974 Some((s, extensions, matchers, responder))
975 } else {
976 None
977 }
978 }
979
980 pub fn method_name(&self) -> &'static str {
982 match *self {
983 DiagnosticsRequest::IterateIp { .. } => "iterate_ip",
984 }
985 }
986}
987
988#[derive(Debug, Clone)]
989pub struct DiagnosticsControlHandle {
990 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
991}
992
993impl fidl::endpoints::ControlHandle for DiagnosticsControlHandle {
994 fn shutdown(&self) {
995 self.inner.shutdown()
996 }
997
998 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
999 self.inner.shutdown_with_epitaph(status)
1000 }
1001
1002 fn is_closed(&self) -> bool {
1003 self.inner.channel().is_closed()
1004 }
1005 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1006 self.inner.channel().on_closed()
1007 }
1008
1009 #[cfg(target_os = "fuchsia")]
1010 fn signal_peer(
1011 &self,
1012 clear_mask: zx::Signals,
1013 set_mask: zx::Signals,
1014 ) -> Result<(), zx_status::Status> {
1015 use fidl::Peered;
1016 self.inner.channel().signal_peer(clear_mask, set_mask)
1017 }
1018}
1019
1020impl DiagnosticsControlHandle {}
1021
1022#[must_use = "FIDL methods require a response to be sent"]
1023#[derive(Debug)]
1024pub struct DiagnosticsIterateIpResponder {
1025 control_handle: std::mem::ManuallyDrop<DiagnosticsControlHandle>,
1026 tx_id: u32,
1027}
1028
1029impl std::ops::Drop for DiagnosticsIterateIpResponder {
1033 fn drop(&mut self) {
1034 self.control_handle.shutdown();
1035 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1037 }
1038}
1039
1040impl fidl::endpoints::Responder for DiagnosticsIterateIpResponder {
1041 type ControlHandle = DiagnosticsControlHandle;
1042
1043 fn control_handle(&self) -> &DiagnosticsControlHandle {
1044 &self.control_handle
1045 }
1046
1047 fn drop_without_shutdown(mut self) {
1048 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1050 std::mem::forget(self);
1052 }
1053}
1054
1055impl DiagnosticsIterateIpResponder {
1056 pub fn send(self, mut payload: &IterateIpResult) -> Result<(), fidl::Error> {
1060 let _result = self.send_raw(payload);
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(self, mut payload: &IterateIpResult) -> Result<(), fidl::Error> {
1070 let _result = self.send_raw(payload);
1071 self.drop_without_shutdown();
1072 _result
1073 }
1074
1075 fn send_raw(&self, mut payload: &IterateIpResult) -> Result<(), fidl::Error> {
1076 self.control_handle.inner.send::<IterateIpResult>(
1077 payload,
1078 self.tx_id,
1079 0x7b05425e48d07605,
1080 fidl::encoding::DynamicFlags::empty(),
1081 )
1082 }
1083}
1084
1085#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1086pub struct IpIteratorMarker;
1087
1088impl fidl::endpoints::ProtocolMarker for IpIteratorMarker {
1089 type Proxy = IpIteratorProxy;
1090 type RequestStream = IpIteratorRequestStream;
1091 #[cfg(target_os = "fuchsia")]
1092 type SynchronousProxy = IpIteratorSynchronousProxy;
1093
1094 const DEBUG_NAME: &'static str = "(anonymous) IpIterator";
1095}
1096
1097pub trait IpIteratorProxyInterface: Send + Sync {
1098 type NextResponseFut: std::future::Future<Output = Result<(Vec<IpSocketState>, bool), fidl::Error>>
1099 + Send;
1100 fn r#next(&self) -> Self::NextResponseFut;
1101}
1102#[derive(Debug)]
1103#[cfg(target_os = "fuchsia")]
1104pub struct IpIteratorSynchronousProxy {
1105 client: fidl::client::sync::Client,
1106}
1107
1108#[cfg(target_os = "fuchsia")]
1109impl fidl::endpoints::SynchronousProxy for IpIteratorSynchronousProxy {
1110 type Proxy = IpIteratorProxy;
1111 type Protocol = IpIteratorMarker;
1112
1113 fn from_channel(inner: fidl::Channel) -> Self {
1114 Self::new(inner)
1115 }
1116
1117 fn into_channel(self) -> fidl::Channel {
1118 self.client.into_channel()
1119 }
1120
1121 fn as_channel(&self) -> &fidl::Channel {
1122 self.client.as_channel()
1123 }
1124}
1125
1126#[cfg(target_os = "fuchsia")]
1127impl IpIteratorSynchronousProxy {
1128 pub fn new(channel: fidl::Channel) -> Self {
1129 Self { client: fidl::client::sync::Client::new(channel) }
1130 }
1131
1132 pub fn into_channel(self) -> fidl::Channel {
1133 self.client.into_channel()
1134 }
1135
1136 pub fn wait_for_event(
1139 &self,
1140 deadline: zx::MonotonicInstant,
1141 ) -> Result<IpIteratorEvent, fidl::Error> {
1142 IpIteratorEvent::decode(self.client.wait_for_event::<IpIteratorMarker>(deadline)?)
1143 }
1144
1145 pub fn r#next(
1157 &self,
1158 ___deadline: zx::MonotonicInstant,
1159 ) -> Result<(Vec<IpSocketState>, bool), fidl::Error> {
1160 let _response = self
1161 .client
1162 .send_query::<fidl::encoding::EmptyPayload, IpIteratorNextResponse, IpIteratorMarker>(
1163 (),
1164 0x3d50aa08ce641a6b,
1165 fidl::encoding::DynamicFlags::empty(),
1166 ___deadline,
1167 )?;
1168 Ok((_response.sockets, _response.has_more))
1169 }
1170}
1171
1172#[cfg(target_os = "fuchsia")]
1173impl From<IpIteratorSynchronousProxy> for zx::NullableHandle {
1174 fn from(value: IpIteratorSynchronousProxy) -> Self {
1175 value.into_channel().into()
1176 }
1177}
1178
1179#[cfg(target_os = "fuchsia")]
1180impl From<fidl::Channel> for IpIteratorSynchronousProxy {
1181 fn from(value: fidl::Channel) -> Self {
1182 Self::new(value)
1183 }
1184}
1185
1186#[cfg(target_os = "fuchsia")]
1187impl fidl::endpoints::FromClient for IpIteratorSynchronousProxy {
1188 type Protocol = IpIteratorMarker;
1189
1190 fn from_client(value: fidl::endpoints::ClientEnd<IpIteratorMarker>) -> Self {
1191 Self::new(value.into_channel())
1192 }
1193}
1194
1195#[derive(Debug, Clone)]
1196pub struct IpIteratorProxy {
1197 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1198}
1199
1200impl fidl::endpoints::Proxy for IpIteratorProxy {
1201 type Protocol = IpIteratorMarker;
1202
1203 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1204 Self::new(inner)
1205 }
1206
1207 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1208 self.client.into_channel().map_err(|client| Self { client })
1209 }
1210
1211 fn as_channel(&self) -> &::fidl::AsyncChannel {
1212 self.client.as_channel()
1213 }
1214}
1215
1216impl IpIteratorProxy {
1217 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1219 let protocol_name = <IpIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1220 Self { client: fidl::client::Client::new(channel, protocol_name) }
1221 }
1222
1223 pub fn take_event_stream(&self) -> IpIteratorEventStream {
1229 IpIteratorEventStream { event_receiver: self.client.take_event_receiver() }
1230 }
1231
1232 pub fn r#next(
1244 &self,
1245 ) -> fidl::client::QueryResponseFut<
1246 (Vec<IpSocketState>, bool),
1247 fidl::encoding::DefaultFuchsiaResourceDialect,
1248 > {
1249 IpIteratorProxyInterface::r#next(self)
1250 }
1251}
1252
1253impl IpIteratorProxyInterface for IpIteratorProxy {
1254 type NextResponseFut = fidl::client::QueryResponseFut<
1255 (Vec<IpSocketState>, bool),
1256 fidl::encoding::DefaultFuchsiaResourceDialect,
1257 >;
1258 fn r#next(&self) -> Self::NextResponseFut {
1259 fn _decode(
1260 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1261 ) -> Result<(Vec<IpSocketState>, bool), fidl::Error> {
1262 let _response = fidl::client::decode_transaction_body::<
1263 IpIteratorNextResponse,
1264 fidl::encoding::DefaultFuchsiaResourceDialect,
1265 0x3d50aa08ce641a6b,
1266 >(_buf?)?;
1267 Ok((_response.sockets, _response.has_more))
1268 }
1269 self.client
1270 .send_query_and_decode::<fidl::encoding::EmptyPayload, (Vec<IpSocketState>, bool)>(
1271 (),
1272 0x3d50aa08ce641a6b,
1273 fidl::encoding::DynamicFlags::empty(),
1274 _decode,
1275 )
1276 }
1277}
1278
1279pub struct IpIteratorEventStream {
1280 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1281}
1282
1283impl std::marker::Unpin for IpIteratorEventStream {}
1284
1285impl futures::stream::FusedStream for IpIteratorEventStream {
1286 fn is_terminated(&self) -> bool {
1287 self.event_receiver.is_terminated()
1288 }
1289}
1290
1291impl futures::Stream for IpIteratorEventStream {
1292 type Item = Result<IpIteratorEvent, fidl::Error>;
1293
1294 fn poll_next(
1295 mut self: std::pin::Pin<&mut Self>,
1296 cx: &mut std::task::Context<'_>,
1297 ) -> std::task::Poll<Option<Self::Item>> {
1298 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1299 &mut self.event_receiver,
1300 cx
1301 )?) {
1302 Some(buf) => std::task::Poll::Ready(Some(IpIteratorEvent::decode(buf))),
1303 None => std::task::Poll::Ready(None),
1304 }
1305 }
1306}
1307
1308#[derive(Debug)]
1309pub enum IpIteratorEvent {
1310 #[non_exhaustive]
1311 _UnknownEvent {
1312 ordinal: u64,
1314 },
1315}
1316
1317impl IpIteratorEvent {
1318 fn decode(
1320 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1321 ) -> Result<IpIteratorEvent, fidl::Error> {
1322 let (bytes, _handles) = buf.split_mut();
1323 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1324 debug_assert_eq!(tx_header.tx_id, 0);
1325 match tx_header.ordinal {
1326 _ if tx_header.dynamic_flags().contains(fidl::encoding::DynamicFlags::FLEXIBLE) => {
1327 Ok(IpIteratorEvent::_UnknownEvent { ordinal: tx_header.ordinal })
1328 }
1329 _ => Err(fidl::Error::UnknownOrdinal {
1330 ordinal: tx_header.ordinal,
1331 protocol_name: <IpIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1332 }),
1333 }
1334 }
1335}
1336
1337pub struct IpIteratorRequestStream {
1339 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1340 is_terminated: bool,
1341}
1342
1343impl std::marker::Unpin for IpIteratorRequestStream {}
1344
1345impl futures::stream::FusedStream for IpIteratorRequestStream {
1346 fn is_terminated(&self) -> bool {
1347 self.is_terminated
1348 }
1349}
1350
1351impl fidl::endpoints::RequestStream for IpIteratorRequestStream {
1352 type Protocol = IpIteratorMarker;
1353 type ControlHandle = IpIteratorControlHandle;
1354
1355 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1356 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1357 }
1358
1359 fn control_handle(&self) -> Self::ControlHandle {
1360 IpIteratorControlHandle { inner: self.inner.clone() }
1361 }
1362
1363 fn into_inner(
1364 self,
1365 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1366 {
1367 (self.inner, self.is_terminated)
1368 }
1369
1370 fn from_inner(
1371 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1372 is_terminated: bool,
1373 ) -> Self {
1374 Self { inner, is_terminated }
1375 }
1376}
1377
1378impl futures::Stream for IpIteratorRequestStream {
1379 type Item = Result<IpIteratorRequest, fidl::Error>;
1380
1381 fn poll_next(
1382 mut self: std::pin::Pin<&mut Self>,
1383 cx: &mut std::task::Context<'_>,
1384 ) -> std::task::Poll<Option<Self::Item>> {
1385 let this = &mut *self;
1386 if this.inner.check_shutdown(cx) {
1387 this.is_terminated = true;
1388 return std::task::Poll::Ready(None);
1389 }
1390 if this.is_terminated {
1391 panic!("polled IpIteratorRequestStream after completion");
1392 }
1393 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1394 |bytes, handles| {
1395 match this.inner.channel().read_etc(cx, bytes, handles) {
1396 std::task::Poll::Ready(Ok(())) => {}
1397 std::task::Poll::Pending => return std::task::Poll::Pending,
1398 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1399 this.is_terminated = true;
1400 return std::task::Poll::Ready(None);
1401 }
1402 std::task::Poll::Ready(Err(e)) => {
1403 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1404 e.into(),
1405 ))));
1406 }
1407 }
1408
1409 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1411
1412 std::task::Poll::Ready(Some(match header.ordinal {
1413 0x3d50aa08ce641a6b => {
1414 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1415 let mut req = fidl::new_empty!(
1416 fidl::encoding::EmptyPayload,
1417 fidl::encoding::DefaultFuchsiaResourceDialect
1418 );
1419 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1420 let control_handle = IpIteratorControlHandle { inner: this.inner.clone() };
1421 Ok(IpIteratorRequest::Next {
1422 responder: IpIteratorNextResponder {
1423 control_handle: std::mem::ManuallyDrop::new(control_handle),
1424 tx_id: header.tx_id,
1425 },
1426 })
1427 }
1428 _ if header.tx_id == 0
1429 && header
1430 .dynamic_flags()
1431 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1432 {
1433 Ok(IpIteratorRequest::_UnknownMethod {
1434 ordinal: header.ordinal,
1435 control_handle: IpIteratorControlHandle { inner: this.inner.clone() },
1436 method_type: fidl::MethodType::OneWay,
1437 })
1438 }
1439 _ if header
1440 .dynamic_flags()
1441 .contains(fidl::encoding::DynamicFlags::FLEXIBLE) =>
1442 {
1443 this.inner.send_framework_err(
1444 fidl::encoding::FrameworkErr::UnknownMethod,
1445 header.tx_id,
1446 header.ordinal,
1447 header.dynamic_flags(),
1448 (bytes, handles),
1449 )?;
1450 Ok(IpIteratorRequest::_UnknownMethod {
1451 ordinal: header.ordinal,
1452 control_handle: IpIteratorControlHandle { inner: this.inner.clone() },
1453 method_type: fidl::MethodType::TwoWay,
1454 })
1455 }
1456 _ => Err(fidl::Error::UnknownOrdinal {
1457 ordinal: header.ordinal,
1458 protocol_name:
1459 <IpIteratorMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1460 }),
1461 }))
1462 },
1463 )
1464 }
1465}
1466
1467#[derive(Debug)]
1469pub enum IpIteratorRequest {
1470 Next { responder: IpIteratorNextResponder },
1482 #[non_exhaustive]
1484 _UnknownMethod {
1485 ordinal: u64,
1487 control_handle: IpIteratorControlHandle,
1488 method_type: fidl::MethodType,
1489 },
1490}
1491
1492impl IpIteratorRequest {
1493 #[allow(irrefutable_let_patterns)]
1494 pub fn into_next(self) -> Option<(IpIteratorNextResponder)> {
1495 if let IpIteratorRequest::Next { responder } = self { Some((responder)) } else { None }
1496 }
1497
1498 pub fn method_name(&self) -> &'static str {
1500 match *self {
1501 IpIteratorRequest::Next { .. } => "next",
1502 IpIteratorRequest::_UnknownMethod { method_type: fidl::MethodType::OneWay, .. } => {
1503 "unknown one-way method"
1504 }
1505 IpIteratorRequest::_UnknownMethod { method_type: fidl::MethodType::TwoWay, .. } => {
1506 "unknown two-way method"
1507 }
1508 }
1509 }
1510}
1511
1512#[derive(Debug, Clone)]
1513pub struct IpIteratorControlHandle {
1514 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1515}
1516
1517impl fidl::endpoints::ControlHandle for IpIteratorControlHandle {
1518 fn shutdown(&self) {
1519 self.inner.shutdown()
1520 }
1521
1522 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1523 self.inner.shutdown_with_epitaph(status)
1524 }
1525
1526 fn is_closed(&self) -> bool {
1527 self.inner.channel().is_closed()
1528 }
1529 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1530 self.inner.channel().on_closed()
1531 }
1532
1533 #[cfg(target_os = "fuchsia")]
1534 fn signal_peer(
1535 &self,
1536 clear_mask: zx::Signals,
1537 set_mask: zx::Signals,
1538 ) -> Result<(), zx_status::Status> {
1539 use fidl::Peered;
1540 self.inner.channel().signal_peer(clear_mask, set_mask)
1541 }
1542}
1543
1544impl IpIteratorControlHandle {}
1545
1546#[must_use = "FIDL methods require a response to be sent"]
1547#[derive(Debug)]
1548pub struct IpIteratorNextResponder {
1549 control_handle: std::mem::ManuallyDrop<IpIteratorControlHandle>,
1550 tx_id: u32,
1551}
1552
1553impl std::ops::Drop for IpIteratorNextResponder {
1557 fn drop(&mut self) {
1558 self.control_handle.shutdown();
1559 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1561 }
1562}
1563
1564impl fidl::endpoints::Responder for IpIteratorNextResponder {
1565 type ControlHandle = IpIteratorControlHandle;
1566
1567 fn control_handle(&self) -> &IpIteratorControlHandle {
1568 &self.control_handle
1569 }
1570
1571 fn drop_without_shutdown(mut self) {
1572 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1574 std::mem::forget(self);
1576 }
1577}
1578
1579impl IpIteratorNextResponder {
1580 pub fn send(
1584 self,
1585 mut sockets: &[IpSocketState],
1586 mut has_more: bool,
1587 ) -> Result<(), fidl::Error> {
1588 let _result = self.send_raw(sockets, has_more);
1589 if _result.is_err() {
1590 self.control_handle.shutdown();
1591 }
1592 self.drop_without_shutdown();
1593 _result
1594 }
1595
1596 pub fn send_no_shutdown_on_err(
1598 self,
1599 mut sockets: &[IpSocketState],
1600 mut has_more: bool,
1601 ) -> Result<(), fidl::Error> {
1602 let _result = self.send_raw(sockets, has_more);
1603 self.drop_without_shutdown();
1604 _result
1605 }
1606
1607 fn send_raw(
1608 &self,
1609 mut sockets: &[IpSocketState],
1610 mut has_more: bool,
1611 ) -> Result<(), fidl::Error> {
1612 self.control_handle.inner.send::<IpIteratorNextResponse>(
1613 (sockets, has_more),
1614 self.tx_id,
1615 0x3d50aa08ce641a6b,
1616 fidl::encoding::DynamicFlags::empty(),
1617 )
1618 }
1619}
1620
1621mod internal {
1622 use super::*;
1623
1624 impl fidl::encoding::ResourceTypeMarker for DiagnosticsIterateIpRequest {
1625 type Borrowed<'a> = &'a mut Self;
1626 fn take_or_borrow<'a>(
1627 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1628 ) -> Self::Borrowed<'a> {
1629 value
1630 }
1631 }
1632
1633 unsafe impl fidl::encoding::TypeMarker for DiagnosticsIterateIpRequest {
1634 type Owned = Self;
1635
1636 #[inline(always)]
1637 fn inline_align(_context: fidl::encoding::Context) -> usize {
1638 8
1639 }
1640
1641 #[inline(always)]
1642 fn inline_size(_context: fidl::encoding::Context) -> usize {
1643 24
1644 }
1645 }
1646
1647 unsafe impl
1648 fidl::encoding::Encode<
1649 DiagnosticsIterateIpRequest,
1650 fidl::encoding::DefaultFuchsiaResourceDialect,
1651 > for &mut DiagnosticsIterateIpRequest
1652 {
1653 #[inline]
1654 unsafe fn encode(
1655 self,
1656 encoder: &mut fidl::encoding::Encoder<
1657 '_,
1658 fidl::encoding::DefaultFuchsiaResourceDialect,
1659 >,
1660 offset: usize,
1661 _depth: fidl::encoding::Depth,
1662 ) -> fidl::Result<()> {
1663 encoder.debug_check_bounds::<DiagnosticsIterateIpRequest>(offset);
1664 fidl::encoding::Encode::<DiagnosticsIterateIpRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1666 (
1667 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IpIteratorMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.s),
1668 <Extensions as fidl::encoding::ValueTypeMarker>::borrow(&self.extensions),
1669 <fidl::encoding::Vector<IpSocketMatcher, 128> as fidl::encoding::ValueTypeMarker>::borrow(&self.matchers),
1670 ),
1671 encoder, offset, _depth
1672 )
1673 }
1674 }
1675 unsafe impl<
1676 T0: fidl::encoding::Encode<
1677 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IpIteratorMarker>>,
1678 fidl::encoding::DefaultFuchsiaResourceDialect,
1679 >,
1680 T1: fidl::encoding::Encode<Extensions, fidl::encoding::DefaultFuchsiaResourceDialect>,
1681 T2: fidl::encoding::Encode<
1682 fidl::encoding::Vector<IpSocketMatcher, 128>,
1683 fidl::encoding::DefaultFuchsiaResourceDialect,
1684 >,
1685 >
1686 fidl::encoding::Encode<
1687 DiagnosticsIterateIpRequest,
1688 fidl::encoding::DefaultFuchsiaResourceDialect,
1689 > for (T0, T1, T2)
1690 {
1691 #[inline]
1692 unsafe fn encode(
1693 self,
1694 encoder: &mut fidl::encoding::Encoder<
1695 '_,
1696 fidl::encoding::DefaultFuchsiaResourceDialect,
1697 >,
1698 offset: usize,
1699 depth: fidl::encoding::Depth,
1700 ) -> fidl::Result<()> {
1701 encoder.debug_check_bounds::<DiagnosticsIterateIpRequest>(offset);
1702 self.0.encode(encoder, offset + 0, depth)?;
1706 self.1.encode(encoder, offset + 4, depth)?;
1707 self.2.encode(encoder, offset + 8, depth)?;
1708 Ok(())
1709 }
1710 }
1711
1712 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1713 for DiagnosticsIterateIpRequest
1714 {
1715 #[inline(always)]
1716 fn new_empty() -> Self {
1717 Self {
1718 s: fidl::new_empty!(
1719 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IpIteratorMarker>>,
1720 fidl::encoding::DefaultFuchsiaResourceDialect
1721 ),
1722 extensions: fidl::new_empty!(
1723 Extensions,
1724 fidl::encoding::DefaultFuchsiaResourceDialect
1725 ),
1726 matchers: fidl::new_empty!(fidl::encoding::Vector<IpSocketMatcher, 128>, fidl::encoding::DefaultFuchsiaResourceDialect),
1727 }
1728 }
1729
1730 #[inline]
1731 unsafe fn decode(
1732 &mut self,
1733 decoder: &mut fidl::encoding::Decoder<
1734 '_,
1735 fidl::encoding::DefaultFuchsiaResourceDialect,
1736 >,
1737 offset: usize,
1738 _depth: fidl::encoding::Depth,
1739 ) -> fidl::Result<()> {
1740 decoder.debug_check_bounds::<Self>(offset);
1741 fidl::decode!(
1743 fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<IpIteratorMarker>>,
1744 fidl::encoding::DefaultFuchsiaResourceDialect,
1745 &mut self.s,
1746 decoder,
1747 offset + 0,
1748 _depth
1749 )?;
1750 fidl::decode!(
1751 Extensions,
1752 fidl::encoding::DefaultFuchsiaResourceDialect,
1753 &mut self.extensions,
1754 decoder,
1755 offset + 4,
1756 _depth
1757 )?;
1758 fidl::decode!(fidl::encoding::Vector<IpSocketMatcher, 128>, fidl::encoding::DefaultFuchsiaResourceDialect, &mut self.matchers, decoder, offset + 8, _depth)?;
1759 Ok(())
1760 }
1761 }
1762}