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