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