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_name__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
15pub struct DnsServerWatcherMarker;
16
17impl fidl::endpoints::ProtocolMarker for DnsServerWatcherMarker {
18 type Proxy = DnsServerWatcherProxy;
19 type RequestStream = DnsServerWatcherRequestStream;
20 #[cfg(target_os = "fuchsia")]
21 type SynchronousProxy = DnsServerWatcherSynchronousProxy;
22
23 const DEBUG_NAME: &'static str = "fuchsia.net.name.DnsServerWatcher";
24}
25impl fidl::endpoints::DiscoverableProtocolMarker for DnsServerWatcherMarker {}
26
27pub trait DnsServerWatcherProxyInterface: Send + Sync {
28 type WatchServersResponseFut: std::future::Future<Output = Result<Vec<DnsServer_>, fidl::Error>>
29 + Send;
30 fn r#watch_servers(&self) -> Self::WatchServersResponseFut;
31}
32#[derive(Debug)]
33#[cfg(target_os = "fuchsia")]
34pub struct DnsServerWatcherSynchronousProxy {
35 client: fidl::client::sync::Client,
36}
37
38#[cfg(target_os = "fuchsia")]
39impl fidl::endpoints::SynchronousProxy for DnsServerWatcherSynchronousProxy {
40 type Proxy = DnsServerWatcherProxy;
41 type Protocol = DnsServerWatcherMarker;
42
43 fn from_channel(inner: fidl::Channel) -> Self {
44 Self::new(inner)
45 }
46
47 fn into_channel(self) -> fidl::Channel {
48 self.client.into_channel()
49 }
50
51 fn as_channel(&self) -> &fidl::Channel {
52 self.client.as_channel()
53 }
54}
55
56#[cfg(target_os = "fuchsia")]
57impl DnsServerWatcherSynchronousProxy {
58 pub fn new(channel: fidl::Channel) -> Self {
59 let protocol_name = <DnsServerWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
60 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
61 }
62
63 pub fn into_channel(self) -> fidl::Channel {
64 self.client.into_channel()
65 }
66
67 pub fn wait_for_event(
70 &self,
71 deadline: zx::MonotonicInstant,
72 ) -> Result<DnsServerWatcherEvent, fidl::Error> {
73 DnsServerWatcherEvent::decode(self.client.wait_for_event(deadline)?)
74 }
75
76 pub fn r#watch_servers(
90 &self,
91 ___deadline: zx::MonotonicInstant,
92 ) -> Result<Vec<DnsServer_>, fidl::Error> {
93 let _response = self
94 .client
95 .send_query::<fidl::encoding::EmptyPayload, DnsServerWatcherWatchServersResponse>(
96 (),
97 0x5748907e7f11b632,
98 fidl::encoding::DynamicFlags::empty(),
99 ___deadline,
100 )?;
101 Ok(_response.servers)
102 }
103}
104
105#[cfg(target_os = "fuchsia")]
106impl From<DnsServerWatcherSynchronousProxy> for zx::NullableHandle {
107 fn from(value: DnsServerWatcherSynchronousProxy) -> Self {
108 value.into_channel().into()
109 }
110}
111
112#[cfg(target_os = "fuchsia")]
113impl From<fidl::Channel> for DnsServerWatcherSynchronousProxy {
114 fn from(value: fidl::Channel) -> Self {
115 Self::new(value)
116 }
117}
118
119#[cfg(target_os = "fuchsia")]
120impl fidl::endpoints::FromClient for DnsServerWatcherSynchronousProxy {
121 type Protocol = DnsServerWatcherMarker;
122
123 fn from_client(value: fidl::endpoints::ClientEnd<DnsServerWatcherMarker>) -> Self {
124 Self::new(value.into_channel())
125 }
126}
127
128#[derive(Debug, Clone)]
129pub struct DnsServerWatcherProxy {
130 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
131}
132
133impl fidl::endpoints::Proxy for DnsServerWatcherProxy {
134 type Protocol = DnsServerWatcherMarker;
135
136 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
137 Self::new(inner)
138 }
139
140 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
141 self.client.into_channel().map_err(|client| Self { client })
142 }
143
144 fn as_channel(&self) -> &::fidl::AsyncChannel {
145 self.client.as_channel()
146 }
147}
148
149impl DnsServerWatcherProxy {
150 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
152 let protocol_name = <DnsServerWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
153 Self { client: fidl::client::Client::new(channel, protocol_name) }
154 }
155
156 pub fn take_event_stream(&self) -> DnsServerWatcherEventStream {
162 DnsServerWatcherEventStream { event_receiver: self.client.take_event_receiver() }
163 }
164
165 pub fn r#watch_servers(
179 &self,
180 ) -> fidl::client::QueryResponseFut<
181 Vec<DnsServer_>,
182 fidl::encoding::DefaultFuchsiaResourceDialect,
183 > {
184 DnsServerWatcherProxyInterface::r#watch_servers(self)
185 }
186}
187
188impl DnsServerWatcherProxyInterface for DnsServerWatcherProxy {
189 type WatchServersResponseFut = fidl::client::QueryResponseFut<
190 Vec<DnsServer_>,
191 fidl::encoding::DefaultFuchsiaResourceDialect,
192 >;
193 fn r#watch_servers(&self) -> Self::WatchServersResponseFut {
194 fn _decode(
195 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
196 ) -> Result<Vec<DnsServer_>, fidl::Error> {
197 let _response = fidl::client::decode_transaction_body::<
198 DnsServerWatcherWatchServersResponse,
199 fidl::encoding::DefaultFuchsiaResourceDialect,
200 0x5748907e7f11b632,
201 >(_buf?)?;
202 Ok(_response.servers)
203 }
204 self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, Vec<DnsServer_>>(
205 (),
206 0x5748907e7f11b632,
207 fidl::encoding::DynamicFlags::empty(),
208 _decode,
209 )
210 }
211}
212
213pub struct DnsServerWatcherEventStream {
214 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
215}
216
217impl std::marker::Unpin for DnsServerWatcherEventStream {}
218
219impl futures::stream::FusedStream for DnsServerWatcherEventStream {
220 fn is_terminated(&self) -> bool {
221 self.event_receiver.is_terminated()
222 }
223}
224
225impl futures::Stream for DnsServerWatcherEventStream {
226 type Item = Result<DnsServerWatcherEvent, fidl::Error>;
227
228 fn poll_next(
229 mut self: std::pin::Pin<&mut Self>,
230 cx: &mut std::task::Context<'_>,
231 ) -> std::task::Poll<Option<Self::Item>> {
232 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
233 &mut self.event_receiver,
234 cx
235 )?) {
236 Some(buf) => std::task::Poll::Ready(Some(DnsServerWatcherEvent::decode(buf))),
237 None => std::task::Poll::Ready(None),
238 }
239 }
240}
241
242#[derive(Debug)]
243pub enum DnsServerWatcherEvent {}
244
245impl DnsServerWatcherEvent {
246 fn decode(
248 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
249 ) -> Result<DnsServerWatcherEvent, fidl::Error> {
250 let (bytes, _handles) = buf.split_mut();
251 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
252 debug_assert_eq!(tx_header.tx_id, 0);
253 match tx_header.ordinal {
254 _ => Err(fidl::Error::UnknownOrdinal {
255 ordinal: tx_header.ordinal,
256 protocol_name:
257 <DnsServerWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
258 }),
259 }
260 }
261}
262
263pub struct DnsServerWatcherRequestStream {
265 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
266 is_terminated: bool,
267}
268
269impl std::marker::Unpin for DnsServerWatcherRequestStream {}
270
271impl futures::stream::FusedStream for DnsServerWatcherRequestStream {
272 fn is_terminated(&self) -> bool {
273 self.is_terminated
274 }
275}
276
277impl fidl::endpoints::RequestStream for DnsServerWatcherRequestStream {
278 type Protocol = DnsServerWatcherMarker;
279 type ControlHandle = DnsServerWatcherControlHandle;
280
281 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
282 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
283 }
284
285 fn control_handle(&self) -> Self::ControlHandle {
286 DnsServerWatcherControlHandle { inner: self.inner.clone() }
287 }
288
289 fn into_inner(
290 self,
291 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
292 {
293 (self.inner, self.is_terminated)
294 }
295
296 fn from_inner(
297 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
298 is_terminated: bool,
299 ) -> Self {
300 Self { inner, is_terminated }
301 }
302}
303
304impl futures::Stream for DnsServerWatcherRequestStream {
305 type Item = Result<DnsServerWatcherRequest, fidl::Error>;
306
307 fn poll_next(
308 mut self: std::pin::Pin<&mut Self>,
309 cx: &mut std::task::Context<'_>,
310 ) -> std::task::Poll<Option<Self::Item>> {
311 let this = &mut *self;
312 if this.inner.check_shutdown(cx) {
313 this.is_terminated = true;
314 return std::task::Poll::Ready(None);
315 }
316 if this.is_terminated {
317 panic!("polled DnsServerWatcherRequestStream after completion");
318 }
319 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
320 |bytes, handles| {
321 match this.inner.channel().read_etc(cx, bytes, handles) {
322 std::task::Poll::Ready(Ok(())) => {}
323 std::task::Poll::Pending => return std::task::Poll::Pending,
324 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
325 this.is_terminated = true;
326 return std::task::Poll::Ready(None);
327 }
328 std::task::Poll::Ready(Err(e)) => {
329 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
330 e.into(),
331 ))));
332 }
333 }
334
335 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
337
338 std::task::Poll::Ready(Some(match header.ordinal {
339 0x5748907e7f11b632 => {
340 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
341 let mut req = fidl::new_empty!(
342 fidl::encoding::EmptyPayload,
343 fidl::encoding::DefaultFuchsiaResourceDialect
344 );
345 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
346 let control_handle =
347 DnsServerWatcherControlHandle { inner: this.inner.clone() };
348 Ok(DnsServerWatcherRequest::WatchServers {
349 responder: DnsServerWatcherWatchServersResponder {
350 control_handle: std::mem::ManuallyDrop::new(control_handle),
351 tx_id: header.tx_id,
352 },
353 })
354 }
355 _ => Err(fidl::Error::UnknownOrdinal {
356 ordinal: header.ordinal,
357 protocol_name:
358 <DnsServerWatcherMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
359 }),
360 }))
361 },
362 )
363 }
364}
365
366#[derive(Debug)]
368pub enum DnsServerWatcherRequest {
369 WatchServers { responder: DnsServerWatcherWatchServersResponder },
383}
384
385impl DnsServerWatcherRequest {
386 #[allow(irrefutable_let_patterns)]
387 pub fn into_watch_servers(self) -> Option<(DnsServerWatcherWatchServersResponder)> {
388 if let DnsServerWatcherRequest::WatchServers { responder } = self {
389 Some((responder))
390 } else {
391 None
392 }
393 }
394
395 pub fn method_name(&self) -> &'static str {
397 match *self {
398 DnsServerWatcherRequest::WatchServers { .. } => "watch_servers",
399 }
400 }
401}
402
403#[derive(Debug, Clone)]
404pub struct DnsServerWatcherControlHandle {
405 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
406}
407
408impl fidl::endpoints::ControlHandle for DnsServerWatcherControlHandle {
409 fn shutdown(&self) {
410 self.inner.shutdown()
411 }
412
413 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
414 self.inner.shutdown_with_epitaph(status)
415 }
416
417 fn is_closed(&self) -> bool {
418 self.inner.channel().is_closed()
419 }
420 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
421 self.inner.channel().on_closed()
422 }
423
424 #[cfg(target_os = "fuchsia")]
425 fn signal_peer(
426 &self,
427 clear_mask: zx::Signals,
428 set_mask: zx::Signals,
429 ) -> Result<(), zx_status::Status> {
430 use fidl::Peered;
431 self.inner.channel().signal_peer(clear_mask, set_mask)
432 }
433}
434
435impl DnsServerWatcherControlHandle {}
436
437#[must_use = "FIDL methods require a response to be sent"]
438#[derive(Debug)]
439pub struct DnsServerWatcherWatchServersResponder {
440 control_handle: std::mem::ManuallyDrop<DnsServerWatcherControlHandle>,
441 tx_id: u32,
442}
443
444impl std::ops::Drop for DnsServerWatcherWatchServersResponder {
448 fn drop(&mut self) {
449 self.control_handle.shutdown();
450 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
452 }
453}
454
455impl fidl::endpoints::Responder for DnsServerWatcherWatchServersResponder {
456 type ControlHandle = DnsServerWatcherControlHandle;
457
458 fn control_handle(&self) -> &DnsServerWatcherControlHandle {
459 &self.control_handle
460 }
461
462 fn drop_without_shutdown(mut self) {
463 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
465 std::mem::forget(self);
467 }
468}
469
470impl DnsServerWatcherWatchServersResponder {
471 pub fn send(self, mut servers: &[DnsServer_]) -> Result<(), fidl::Error> {
475 let _result = self.send_raw(servers);
476 if _result.is_err() {
477 self.control_handle.shutdown();
478 }
479 self.drop_without_shutdown();
480 _result
481 }
482
483 pub fn send_no_shutdown_on_err(self, mut servers: &[DnsServer_]) -> Result<(), fidl::Error> {
485 let _result = self.send_raw(servers);
486 self.drop_without_shutdown();
487 _result
488 }
489
490 fn send_raw(&self, mut servers: &[DnsServer_]) -> Result<(), fidl::Error> {
491 self.control_handle.inner.send::<DnsServerWatcherWatchServersResponse>(
492 (servers,),
493 self.tx_id,
494 0x5748907e7f11b632,
495 fidl::encoding::DynamicFlags::empty(),
496 )
497 }
498}
499
500#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
501pub struct LookupMarker;
502
503impl fidl::endpoints::ProtocolMarker for LookupMarker {
504 type Proxy = LookupProxy;
505 type RequestStream = LookupRequestStream;
506 #[cfg(target_os = "fuchsia")]
507 type SynchronousProxy = LookupSynchronousProxy;
508
509 const DEBUG_NAME: &'static str = "fuchsia.net.name.Lookup";
510}
511impl fidl::endpoints::DiscoverableProtocolMarker for LookupMarker {}
512pub type LookupLookupIpResult = Result<LookupResult, LookupError>;
513pub type LookupLookupHostnameResult = Result<String, LookupError>;
514
515pub trait LookupProxyInterface: Send + Sync {
516 type LookupIpResponseFut: std::future::Future<Output = Result<LookupLookupIpResult, fidl::Error>>
517 + Send;
518 fn r#lookup_ip(&self, hostname: &str, options: &LookupIpOptions) -> Self::LookupIpResponseFut;
519 type LookupHostnameResponseFut: std::future::Future<Output = Result<LookupLookupHostnameResult, fidl::Error>>
520 + Send;
521 fn r#lookup_hostname(
522 &self,
523 addr: &fidl_fuchsia_net::IpAddress,
524 ) -> Self::LookupHostnameResponseFut;
525}
526#[derive(Debug)]
527#[cfg(target_os = "fuchsia")]
528pub struct LookupSynchronousProxy {
529 client: fidl::client::sync::Client,
530}
531
532#[cfg(target_os = "fuchsia")]
533impl fidl::endpoints::SynchronousProxy for LookupSynchronousProxy {
534 type Proxy = LookupProxy;
535 type Protocol = LookupMarker;
536
537 fn from_channel(inner: fidl::Channel) -> Self {
538 Self::new(inner)
539 }
540
541 fn into_channel(self) -> fidl::Channel {
542 self.client.into_channel()
543 }
544
545 fn as_channel(&self) -> &fidl::Channel {
546 self.client.as_channel()
547 }
548}
549
550#[cfg(target_os = "fuchsia")]
551impl LookupSynchronousProxy {
552 pub fn new(channel: fidl::Channel) -> Self {
553 let protocol_name = <LookupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
554 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
555 }
556
557 pub fn into_channel(self) -> fidl::Channel {
558 self.client.into_channel()
559 }
560
561 pub fn wait_for_event(
564 &self,
565 deadline: zx::MonotonicInstant,
566 ) -> Result<LookupEvent, fidl::Error> {
567 LookupEvent::decode(self.client.wait_for_event(deadline)?)
568 }
569
570 pub fn r#lookup_ip(
572 &self,
573 mut hostname: &str,
574 mut options: &LookupIpOptions,
575 ___deadline: zx::MonotonicInstant,
576 ) -> Result<LookupLookupIpResult, fidl::Error> {
577 let _response = self.client.send_query::<
578 LookupLookupIpRequest,
579 fidl::encoding::ResultType<LookupLookupIpResponse, LookupError>,
580 >(
581 (hostname, options,),
582 0x59247caf7560c1d0,
583 fidl::encoding::DynamicFlags::empty(),
584 ___deadline,
585 )?;
586 Ok(_response.map(|x| x.result))
587 }
588
589 pub fn r#lookup_hostname(
591 &self,
592 mut addr: &fidl_fuchsia_net::IpAddress,
593 ___deadline: zx::MonotonicInstant,
594 ) -> Result<LookupLookupHostnameResult, fidl::Error> {
595 let _response = self.client.send_query::<
596 LookupLookupHostnameRequest,
597 fidl::encoding::ResultType<LookupLookupHostnameResponse, LookupError>,
598 >(
599 (addr,),
600 0x1b456b0e84888324,
601 fidl::encoding::DynamicFlags::empty(),
602 ___deadline,
603 )?;
604 Ok(_response.map(|x| x.hostname))
605 }
606}
607
608#[cfg(target_os = "fuchsia")]
609impl From<LookupSynchronousProxy> for zx::NullableHandle {
610 fn from(value: LookupSynchronousProxy) -> Self {
611 value.into_channel().into()
612 }
613}
614
615#[cfg(target_os = "fuchsia")]
616impl From<fidl::Channel> for LookupSynchronousProxy {
617 fn from(value: fidl::Channel) -> Self {
618 Self::new(value)
619 }
620}
621
622#[cfg(target_os = "fuchsia")]
623impl fidl::endpoints::FromClient for LookupSynchronousProxy {
624 type Protocol = LookupMarker;
625
626 fn from_client(value: fidl::endpoints::ClientEnd<LookupMarker>) -> Self {
627 Self::new(value.into_channel())
628 }
629}
630
631#[derive(Debug, Clone)]
632pub struct LookupProxy {
633 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
634}
635
636impl fidl::endpoints::Proxy for LookupProxy {
637 type Protocol = LookupMarker;
638
639 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
640 Self::new(inner)
641 }
642
643 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
644 self.client.into_channel().map_err(|client| Self { client })
645 }
646
647 fn as_channel(&self) -> &::fidl::AsyncChannel {
648 self.client.as_channel()
649 }
650}
651
652impl LookupProxy {
653 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
655 let protocol_name = <LookupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
656 Self { client: fidl::client::Client::new(channel, protocol_name) }
657 }
658
659 pub fn take_event_stream(&self) -> LookupEventStream {
665 LookupEventStream { event_receiver: self.client.take_event_receiver() }
666 }
667
668 pub fn r#lookup_ip(
670 &self,
671 mut hostname: &str,
672 mut options: &LookupIpOptions,
673 ) -> fidl::client::QueryResponseFut<
674 LookupLookupIpResult,
675 fidl::encoding::DefaultFuchsiaResourceDialect,
676 > {
677 LookupProxyInterface::r#lookup_ip(self, hostname, options)
678 }
679
680 pub fn r#lookup_hostname(
682 &self,
683 mut addr: &fidl_fuchsia_net::IpAddress,
684 ) -> fidl::client::QueryResponseFut<
685 LookupLookupHostnameResult,
686 fidl::encoding::DefaultFuchsiaResourceDialect,
687 > {
688 LookupProxyInterface::r#lookup_hostname(self, addr)
689 }
690}
691
692impl LookupProxyInterface for LookupProxy {
693 type LookupIpResponseFut = fidl::client::QueryResponseFut<
694 LookupLookupIpResult,
695 fidl::encoding::DefaultFuchsiaResourceDialect,
696 >;
697 fn r#lookup_ip(
698 &self,
699 mut hostname: &str,
700 mut options: &LookupIpOptions,
701 ) -> Self::LookupIpResponseFut {
702 fn _decode(
703 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
704 ) -> Result<LookupLookupIpResult, fidl::Error> {
705 let _response = fidl::client::decode_transaction_body::<
706 fidl::encoding::ResultType<LookupLookupIpResponse, LookupError>,
707 fidl::encoding::DefaultFuchsiaResourceDialect,
708 0x59247caf7560c1d0,
709 >(_buf?)?;
710 Ok(_response.map(|x| x.result))
711 }
712 self.client.send_query_and_decode::<LookupLookupIpRequest, LookupLookupIpResult>(
713 (hostname, options),
714 0x59247caf7560c1d0,
715 fidl::encoding::DynamicFlags::empty(),
716 _decode,
717 )
718 }
719
720 type LookupHostnameResponseFut = fidl::client::QueryResponseFut<
721 LookupLookupHostnameResult,
722 fidl::encoding::DefaultFuchsiaResourceDialect,
723 >;
724 fn r#lookup_hostname(
725 &self,
726 mut addr: &fidl_fuchsia_net::IpAddress,
727 ) -> Self::LookupHostnameResponseFut {
728 fn _decode(
729 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
730 ) -> Result<LookupLookupHostnameResult, fidl::Error> {
731 let _response = fidl::client::decode_transaction_body::<
732 fidl::encoding::ResultType<LookupLookupHostnameResponse, LookupError>,
733 fidl::encoding::DefaultFuchsiaResourceDialect,
734 0x1b456b0e84888324,
735 >(_buf?)?;
736 Ok(_response.map(|x| x.hostname))
737 }
738 self.client
739 .send_query_and_decode::<LookupLookupHostnameRequest, LookupLookupHostnameResult>(
740 (addr,),
741 0x1b456b0e84888324,
742 fidl::encoding::DynamicFlags::empty(),
743 _decode,
744 )
745 }
746}
747
748pub struct LookupEventStream {
749 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
750}
751
752impl std::marker::Unpin for LookupEventStream {}
753
754impl futures::stream::FusedStream for LookupEventStream {
755 fn is_terminated(&self) -> bool {
756 self.event_receiver.is_terminated()
757 }
758}
759
760impl futures::Stream for LookupEventStream {
761 type Item = Result<LookupEvent, fidl::Error>;
762
763 fn poll_next(
764 mut self: std::pin::Pin<&mut Self>,
765 cx: &mut std::task::Context<'_>,
766 ) -> std::task::Poll<Option<Self::Item>> {
767 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
768 &mut self.event_receiver,
769 cx
770 )?) {
771 Some(buf) => std::task::Poll::Ready(Some(LookupEvent::decode(buf))),
772 None => std::task::Poll::Ready(None),
773 }
774 }
775}
776
777#[derive(Debug)]
778pub enum LookupEvent {}
779
780impl LookupEvent {
781 fn decode(
783 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
784 ) -> Result<LookupEvent, fidl::Error> {
785 let (bytes, _handles) = buf.split_mut();
786 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
787 debug_assert_eq!(tx_header.tx_id, 0);
788 match tx_header.ordinal {
789 _ => Err(fidl::Error::UnknownOrdinal {
790 ordinal: tx_header.ordinal,
791 protocol_name: <LookupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
792 }),
793 }
794 }
795}
796
797pub struct LookupRequestStream {
799 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
800 is_terminated: bool,
801}
802
803impl std::marker::Unpin for LookupRequestStream {}
804
805impl futures::stream::FusedStream for LookupRequestStream {
806 fn is_terminated(&self) -> bool {
807 self.is_terminated
808 }
809}
810
811impl fidl::endpoints::RequestStream for LookupRequestStream {
812 type Protocol = LookupMarker;
813 type ControlHandle = LookupControlHandle;
814
815 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
816 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
817 }
818
819 fn control_handle(&self) -> Self::ControlHandle {
820 LookupControlHandle { inner: self.inner.clone() }
821 }
822
823 fn into_inner(
824 self,
825 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
826 {
827 (self.inner, self.is_terminated)
828 }
829
830 fn from_inner(
831 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
832 is_terminated: bool,
833 ) -> Self {
834 Self { inner, is_terminated }
835 }
836}
837
838impl futures::Stream for LookupRequestStream {
839 type Item = Result<LookupRequest, fidl::Error>;
840
841 fn poll_next(
842 mut self: std::pin::Pin<&mut Self>,
843 cx: &mut std::task::Context<'_>,
844 ) -> std::task::Poll<Option<Self::Item>> {
845 let this = &mut *self;
846 if this.inner.check_shutdown(cx) {
847 this.is_terminated = true;
848 return std::task::Poll::Ready(None);
849 }
850 if this.is_terminated {
851 panic!("polled LookupRequestStream after completion");
852 }
853 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
854 |bytes, handles| {
855 match this.inner.channel().read_etc(cx, bytes, handles) {
856 std::task::Poll::Ready(Ok(())) => {}
857 std::task::Poll::Pending => return std::task::Poll::Pending,
858 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
859 this.is_terminated = true;
860 return std::task::Poll::Ready(None);
861 }
862 std::task::Poll::Ready(Err(e)) => {
863 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
864 e.into(),
865 ))));
866 }
867 }
868
869 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
871
872 std::task::Poll::Ready(Some(match header.ordinal {
873 0x59247caf7560c1d0 => {
874 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
875 let mut req = fidl::new_empty!(
876 LookupLookupIpRequest,
877 fidl::encoding::DefaultFuchsiaResourceDialect
878 );
879 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LookupLookupIpRequest>(&header, _body_bytes, handles, &mut req)?;
880 let control_handle = LookupControlHandle { inner: this.inner.clone() };
881 Ok(LookupRequest::LookupIp {
882 hostname: req.hostname,
883 options: req.options,
884
885 responder: LookupLookupIpResponder {
886 control_handle: std::mem::ManuallyDrop::new(control_handle),
887 tx_id: header.tx_id,
888 },
889 })
890 }
891 0x1b456b0e84888324 => {
892 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
893 let mut req = fidl::new_empty!(
894 LookupLookupHostnameRequest,
895 fidl::encoding::DefaultFuchsiaResourceDialect
896 );
897 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LookupLookupHostnameRequest>(&header, _body_bytes, handles, &mut req)?;
898 let control_handle = LookupControlHandle { inner: this.inner.clone() };
899 Ok(LookupRequest::LookupHostname {
900 addr: req.addr,
901
902 responder: LookupLookupHostnameResponder {
903 control_handle: std::mem::ManuallyDrop::new(control_handle),
904 tx_id: header.tx_id,
905 },
906 })
907 }
908 _ => Err(fidl::Error::UnknownOrdinal {
909 ordinal: header.ordinal,
910 protocol_name:
911 <LookupMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
912 }),
913 }))
914 },
915 )
916 }
917}
918
919#[derive(Debug)]
921pub enum LookupRequest {
922 LookupIp { hostname: String, options: LookupIpOptions, responder: LookupLookupIpResponder },
924 LookupHostname { addr: fidl_fuchsia_net::IpAddress, responder: LookupLookupHostnameResponder },
926}
927
928impl LookupRequest {
929 #[allow(irrefutable_let_patterns)]
930 pub fn into_lookup_ip(self) -> Option<(String, LookupIpOptions, LookupLookupIpResponder)> {
931 if let LookupRequest::LookupIp { hostname, options, responder } = self {
932 Some((hostname, options, responder))
933 } else {
934 None
935 }
936 }
937
938 #[allow(irrefutable_let_patterns)]
939 pub fn into_lookup_hostname(
940 self,
941 ) -> Option<(fidl_fuchsia_net::IpAddress, LookupLookupHostnameResponder)> {
942 if let LookupRequest::LookupHostname { addr, responder } = self {
943 Some((addr, responder))
944 } else {
945 None
946 }
947 }
948
949 pub fn method_name(&self) -> &'static str {
951 match *self {
952 LookupRequest::LookupIp { .. } => "lookup_ip",
953 LookupRequest::LookupHostname { .. } => "lookup_hostname",
954 }
955 }
956}
957
958#[derive(Debug, Clone)]
959pub struct LookupControlHandle {
960 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
961}
962
963impl fidl::endpoints::ControlHandle for LookupControlHandle {
964 fn shutdown(&self) {
965 self.inner.shutdown()
966 }
967
968 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
969 self.inner.shutdown_with_epitaph(status)
970 }
971
972 fn is_closed(&self) -> bool {
973 self.inner.channel().is_closed()
974 }
975 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
976 self.inner.channel().on_closed()
977 }
978
979 #[cfg(target_os = "fuchsia")]
980 fn signal_peer(
981 &self,
982 clear_mask: zx::Signals,
983 set_mask: zx::Signals,
984 ) -> Result<(), zx_status::Status> {
985 use fidl::Peered;
986 self.inner.channel().signal_peer(clear_mask, set_mask)
987 }
988}
989
990impl LookupControlHandle {}
991
992#[must_use = "FIDL methods require a response to be sent"]
993#[derive(Debug)]
994pub struct LookupLookupIpResponder {
995 control_handle: std::mem::ManuallyDrop<LookupControlHandle>,
996 tx_id: u32,
997}
998
999impl std::ops::Drop for LookupLookupIpResponder {
1003 fn drop(&mut self) {
1004 self.control_handle.shutdown();
1005 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1007 }
1008}
1009
1010impl fidl::endpoints::Responder for LookupLookupIpResponder {
1011 type ControlHandle = LookupControlHandle;
1012
1013 fn control_handle(&self) -> &LookupControlHandle {
1014 &self.control_handle
1015 }
1016
1017 fn drop_without_shutdown(mut self) {
1018 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1020 std::mem::forget(self);
1022 }
1023}
1024
1025impl LookupLookupIpResponder {
1026 pub fn send(self, mut result: Result<&LookupResult, LookupError>) -> Result<(), fidl::Error> {
1030 let _result = self.send_raw(result);
1031 if _result.is_err() {
1032 self.control_handle.shutdown();
1033 }
1034 self.drop_without_shutdown();
1035 _result
1036 }
1037
1038 pub fn send_no_shutdown_on_err(
1040 self,
1041 mut result: Result<&LookupResult, LookupError>,
1042 ) -> Result<(), fidl::Error> {
1043 let _result = self.send_raw(result);
1044 self.drop_without_shutdown();
1045 _result
1046 }
1047
1048 fn send_raw(&self, mut result: Result<&LookupResult, LookupError>) -> Result<(), fidl::Error> {
1049 self.control_handle
1050 .inner
1051 .send::<fidl::encoding::ResultType<LookupLookupIpResponse, LookupError>>(
1052 result.map(|result| (result,)),
1053 self.tx_id,
1054 0x59247caf7560c1d0,
1055 fidl::encoding::DynamicFlags::empty(),
1056 )
1057 }
1058}
1059
1060#[must_use = "FIDL methods require a response to be sent"]
1061#[derive(Debug)]
1062pub struct LookupLookupHostnameResponder {
1063 control_handle: std::mem::ManuallyDrop<LookupControlHandle>,
1064 tx_id: u32,
1065}
1066
1067impl std::ops::Drop for LookupLookupHostnameResponder {
1071 fn drop(&mut self) {
1072 self.control_handle.shutdown();
1073 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1075 }
1076}
1077
1078impl fidl::endpoints::Responder for LookupLookupHostnameResponder {
1079 type ControlHandle = LookupControlHandle;
1080
1081 fn control_handle(&self) -> &LookupControlHandle {
1082 &self.control_handle
1083 }
1084
1085 fn drop_without_shutdown(mut self) {
1086 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1088 std::mem::forget(self);
1090 }
1091}
1092
1093impl LookupLookupHostnameResponder {
1094 pub fn send(self, mut result: Result<&str, LookupError>) -> Result<(), fidl::Error> {
1098 let _result = self.send_raw(result);
1099 if _result.is_err() {
1100 self.control_handle.shutdown();
1101 }
1102 self.drop_without_shutdown();
1103 _result
1104 }
1105
1106 pub fn send_no_shutdown_on_err(
1108 self,
1109 mut result: Result<&str, LookupError>,
1110 ) -> Result<(), fidl::Error> {
1111 let _result = self.send_raw(result);
1112 self.drop_without_shutdown();
1113 _result
1114 }
1115
1116 fn send_raw(&self, mut result: Result<&str, LookupError>) -> Result<(), fidl::Error> {
1117 self.control_handle.inner.send::<fidl::encoding::ResultType<
1118 LookupLookupHostnameResponse,
1119 LookupError,
1120 >>(
1121 result.map(|hostname| (hostname,)),
1122 self.tx_id,
1123 0x1b456b0e84888324,
1124 fidl::encoding::DynamicFlags::empty(),
1125 )
1126 }
1127}
1128
1129#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
1130pub struct LookupAdminMarker;
1131
1132impl fidl::endpoints::ProtocolMarker for LookupAdminMarker {
1133 type Proxy = LookupAdminProxy;
1134 type RequestStream = LookupAdminRequestStream;
1135 #[cfg(target_os = "fuchsia")]
1136 type SynchronousProxy = LookupAdminSynchronousProxy;
1137
1138 const DEBUG_NAME: &'static str = "fuchsia.net.name.LookupAdmin";
1139}
1140impl fidl::endpoints::DiscoverableProtocolMarker for LookupAdminMarker {}
1141pub type LookupAdminSetDnsServersResult = Result<(), i32>;
1142
1143pub trait LookupAdminProxyInterface: Send + Sync {
1144 type SetDnsServersResponseFut: std::future::Future<Output = Result<LookupAdminSetDnsServersResult, fidl::Error>>
1145 + Send;
1146 fn r#set_dns_servers(
1147 &self,
1148 servers: &[fidl_fuchsia_net::SocketAddress],
1149 ) -> Self::SetDnsServersResponseFut;
1150 type GetDnsServersResponseFut: std::future::Future<Output = Result<Vec<fidl_fuchsia_net::SocketAddress>, fidl::Error>>
1151 + Send;
1152 fn r#get_dns_servers(&self) -> Self::GetDnsServersResponseFut;
1153}
1154#[derive(Debug)]
1155#[cfg(target_os = "fuchsia")]
1156pub struct LookupAdminSynchronousProxy {
1157 client: fidl::client::sync::Client,
1158}
1159
1160#[cfg(target_os = "fuchsia")]
1161impl fidl::endpoints::SynchronousProxy for LookupAdminSynchronousProxy {
1162 type Proxy = LookupAdminProxy;
1163 type Protocol = LookupAdminMarker;
1164
1165 fn from_channel(inner: fidl::Channel) -> Self {
1166 Self::new(inner)
1167 }
1168
1169 fn into_channel(self) -> fidl::Channel {
1170 self.client.into_channel()
1171 }
1172
1173 fn as_channel(&self) -> &fidl::Channel {
1174 self.client.as_channel()
1175 }
1176}
1177
1178#[cfg(target_os = "fuchsia")]
1179impl LookupAdminSynchronousProxy {
1180 pub fn new(channel: fidl::Channel) -> Self {
1181 let protocol_name = <LookupAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1182 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
1183 }
1184
1185 pub fn into_channel(self) -> fidl::Channel {
1186 self.client.into_channel()
1187 }
1188
1189 pub fn wait_for_event(
1192 &self,
1193 deadline: zx::MonotonicInstant,
1194 ) -> Result<LookupAdminEvent, fidl::Error> {
1195 LookupAdminEvent::decode(self.client.wait_for_event(deadline)?)
1196 }
1197
1198 pub fn r#set_dns_servers(
1207 &self,
1208 mut servers: &[fidl_fuchsia_net::SocketAddress],
1209 ___deadline: zx::MonotonicInstant,
1210 ) -> Result<LookupAdminSetDnsServersResult, fidl::Error> {
1211 let _response = self.client.send_query::<
1212 LookupAdminSetDnsServersRequest,
1213 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1214 >(
1215 (servers,),
1216 0x55e2b9fcc777be96,
1217 fidl::encoding::DynamicFlags::empty(),
1218 ___deadline,
1219 )?;
1220 Ok(_response.map(|x| x))
1221 }
1222
1223 pub fn r#get_dns_servers(
1226 &self,
1227 ___deadline: zx::MonotonicInstant,
1228 ) -> Result<Vec<fidl_fuchsia_net::SocketAddress>, fidl::Error> {
1229 let _response = self
1230 .client
1231 .send_query::<fidl::encoding::EmptyPayload, LookupAdminGetDnsServersResponse>(
1232 (),
1233 0x614303bf6e72f80f,
1234 fidl::encoding::DynamicFlags::empty(),
1235 ___deadline,
1236 )?;
1237 Ok(_response.servers)
1238 }
1239}
1240
1241#[cfg(target_os = "fuchsia")]
1242impl From<LookupAdminSynchronousProxy> for zx::NullableHandle {
1243 fn from(value: LookupAdminSynchronousProxy) -> Self {
1244 value.into_channel().into()
1245 }
1246}
1247
1248#[cfg(target_os = "fuchsia")]
1249impl From<fidl::Channel> for LookupAdminSynchronousProxy {
1250 fn from(value: fidl::Channel) -> Self {
1251 Self::new(value)
1252 }
1253}
1254
1255#[cfg(target_os = "fuchsia")]
1256impl fidl::endpoints::FromClient for LookupAdminSynchronousProxy {
1257 type Protocol = LookupAdminMarker;
1258
1259 fn from_client(value: fidl::endpoints::ClientEnd<LookupAdminMarker>) -> Self {
1260 Self::new(value.into_channel())
1261 }
1262}
1263
1264#[derive(Debug, Clone)]
1265pub struct LookupAdminProxy {
1266 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
1267}
1268
1269impl fidl::endpoints::Proxy for LookupAdminProxy {
1270 type Protocol = LookupAdminMarker;
1271
1272 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
1273 Self::new(inner)
1274 }
1275
1276 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
1277 self.client.into_channel().map_err(|client| Self { client })
1278 }
1279
1280 fn as_channel(&self) -> &::fidl::AsyncChannel {
1281 self.client.as_channel()
1282 }
1283}
1284
1285impl LookupAdminProxy {
1286 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
1288 let protocol_name = <LookupAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
1289 Self { client: fidl::client::Client::new(channel, protocol_name) }
1290 }
1291
1292 pub fn take_event_stream(&self) -> LookupAdminEventStream {
1298 LookupAdminEventStream { event_receiver: self.client.take_event_receiver() }
1299 }
1300
1301 pub fn r#set_dns_servers(
1310 &self,
1311 mut servers: &[fidl_fuchsia_net::SocketAddress],
1312 ) -> fidl::client::QueryResponseFut<
1313 LookupAdminSetDnsServersResult,
1314 fidl::encoding::DefaultFuchsiaResourceDialect,
1315 > {
1316 LookupAdminProxyInterface::r#set_dns_servers(self, servers)
1317 }
1318
1319 pub fn r#get_dns_servers(
1322 &self,
1323 ) -> fidl::client::QueryResponseFut<
1324 Vec<fidl_fuchsia_net::SocketAddress>,
1325 fidl::encoding::DefaultFuchsiaResourceDialect,
1326 > {
1327 LookupAdminProxyInterface::r#get_dns_servers(self)
1328 }
1329}
1330
1331impl LookupAdminProxyInterface for LookupAdminProxy {
1332 type SetDnsServersResponseFut = fidl::client::QueryResponseFut<
1333 LookupAdminSetDnsServersResult,
1334 fidl::encoding::DefaultFuchsiaResourceDialect,
1335 >;
1336 fn r#set_dns_servers(
1337 &self,
1338 mut servers: &[fidl_fuchsia_net::SocketAddress],
1339 ) -> Self::SetDnsServersResponseFut {
1340 fn _decode(
1341 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1342 ) -> Result<LookupAdminSetDnsServersResult, fidl::Error> {
1343 let _response = fidl::client::decode_transaction_body::<
1344 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
1345 fidl::encoding::DefaultFuchsiaResourceDialect,
1346 0x55e2b9fcc777be96,
1347 >(_buf?)?;
1348 Ok(_response.map(|x| x))
1349 }
1350 self.client.send_query_and_decode::<
1351 LookupAdminSetDnsServersRequest,
1352 LookupAdminSetDnsServersResult,
1353 >(
1354 (servers,),
1355 0x55e2b9fcc777be96,
1356 fidl::encoding::DynamicFlags::empty(),
1357 _decode,
1358 )
1359 }
1360
1361 type GetDnsServersResponseFut = fidl::client::QueryResponseFut<
1362 Vec<fidl_fuchsia_net::SocketAddress>,
1363 fidl::encoding::DefaultFuchsiaResourceDialect,
1364 >;
1365 fn r#get_dns_servers(&self) -> Self::GetDnsServersResponseFut {
1366 fn _decode(
1367 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
1368 ) -> Result<Vec<fidl_fuchsia_net::SocketAddress>, fidl::Error> {
1369 let _response = fidl::client::decode_transaction_body::<
1370 LookupAdminGetDnsServersResponse,
1371 fidl::encoding::DefaultFuchsiaResourceDialect,
1372 0x614303bf6e72f80f,
1373 >(_buf?)?;
1374 Ok(_response.servers)
1375 }
1376 self.client.send_query_and_decode::<
1377 fidl::encoding::EmptyPayload,
1378 Vec<fidl_fuchsia_net::SocketAddress>,
1379 >(
1380 (),
1381 0x614303bf6e72f80f,
1382 fidl::encoding::DynamicFlags::empty(),
1383 _decode,
1384 )
1385 }
1386}
1387
1388pub struct LookupAdminEventStream {
1389 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
1390}
1391
1392impl std::marker::Unpin for LookupAdminEventStream {}
1393
1394impl futures::stream::FusedStream for LookupAdminEventStream {
1395 fn is_terminated(&self) -> bool {
1396 self.event_receiver.is_terminated()
1397 }
1398}
1399
1400impl futures::Stream for LookupAdminEventStream {
1401 type Item = Result<LookupAdminEvent, fidl::Error>;
1402
1403 fn poll_next(
1404 mut self: std::pin::Pin<&mut Self>,
1405 cx: &mut std::task::Context<'_>,
1406 ) -> std::task::Poll<Option<Self::Item>> {
1407 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
1408 &mut self.event_receiver,
1409 cx
1410 )?) {
1411 Some(buf) => std::task::Poll::Ready(Some(LookupAdminEvent::decode(buf))),
1412 None => std::task::Poll::Ready(None),
1413 }
1414 }
1415}
1416
1417#[derive(Debug)]
1418pub enum LookupAdminEvent {}
1419
1420impl LookupAdminEvent {
1421 fn decode(
1423 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
1424 ) -> Result<LookupAdminEvent, fidl::Error> {
1425 let (bytes, _handles) = buf.split_mut();
1426 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1427 debug_assert_eq!(tx_header.tx_id, 0);
1428 match tx_header.ordinal {
1429 _ => Err(fidl::Error::UnknownOrdinal {
1430 ordinal: tx_header.ordinal,
1431 protocol_name: <LookupAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1432 }),
1433 }
1434 }
1435}
1436
1437pub struct LookupAdminRequestStream {
1439 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1440 is_terminated: bool,
1441}
1442
1443impl std::marker::Unpin for LookupAdminRequestStream {}
1444
1445impl futures::stream::FusedStream for LookupAdminRequestStream {
1446 fn is_terminated(&self) -> bool {
1447 self.is_terminated
1448 }
1449}
1450
1451impl fidl::endpoints::RequestStream for LookupAdminRequestStream {
1452 type Protocol = LookupAdminMarker;
1453 type ControlHandle = LookupAdminControlHandle;
1454
1455 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
1456 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
1457 }
1458
1459 fn control_handle(&self) -> Self::ControlHandle {
1460 LookupAdminControlHandle { inner: self.inner.clone() }
1461 }
1462
1463 fn into_inner(
1464 self,
1465 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
1466 {
1467 (self.inner, self.is_terminated)
1468 }
1469
1470 fn from_inner(
1471 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1472 is_terminated: bool,
1473 ) -> Self {
1474 Self { inner, is_terminated }
1475 }
1476}
1477
1478impl futures::Stream for LookupAdminRequestStream {
1479 type Item = Result<LookupAdminRequest, fidl::Error>;
1480
1481 fn poll_next(
1482 mut self: std::pin::Pin<&mut Self>,
1483 cx: &mut std::task::Context<'_>,
1484 ) -> std::task::Poll<Option<Self::Item>> {
1485 let this = &mut *self;
1486 if this.inner.check_shutdown(cx) {
1487 this.is_terminated = true;
1488 return std::task::Poll::Ready(None);
1489 }
1490 if this.is_terminated {
1491 panic!("polled LookupAdminRequestStream after completion");
1492 }
1493 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
1494 |bytes, handles| {
1495 match this.inner.channel().read_etc(cx, bytes, handles) {
1496 std::task::Poll::Ready(Ok(())) => {}
1497 std::task::Poll::Pending => return std::task::Poll::Pending,
1498 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
1499 this.is_terminated = true;
1500 return std::task::Poll::Ready(None);
1501 }
1502 std::task::Poll::Ready(Err(e)) => {
1503 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
1504 e.into(),
1505 ))));
1506 }
1507 }
1508
1509 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
1511
1512 std::task::Poll::Ready(Some(match header.ordinal {
1513 0x55e2b9fcc777be96 => {
1514 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1515 let mut req = fidl::new_empty!(
1516 LookupAdminSetDnsServersRequest,
1517 fidl::encoding::DefaultFuchsiaResourceDialect
1518 );
1519 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LookupAdminSetDnsServersRequest>(&header, _body_bytes, handles, &mut req)?;
1520 let control_handle = LookupAdminControlHandle { inner: this.inner.clone() };
1521 Ok(LookupAdminRequest::SetDnsServers {
1522 servers: req.servers,
1523
1524 responder: LookupAdminSetDnsServersResponder {
1525 control_handle: std::mem::ManuallyDrop::new(control_handle),
1526 tx_id: header.tx_id,
1527 },
1528 })
1529 }
1530 0x614303bf6e72f80f => {
1531 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1532 let mut req = fidl::new_empty!(
1533 fidl::encoding::EmptyPayload,
1534 fidl::encoding::DefaultFuchsiaResourceDialect
1535 );
1536 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
1537 let control_handle = LookupAdminControlHandle { inner: this.inner.clone() };
1538 Ok(LookupAdminRequest::GetDnsServers {
1539 responder: LookupAdminGetDnsServersResponder {
1540 control_handle: std::mem::ManuallyDrop::new(control_handle),
1541 tx_id: header.tx_id,
1542 },
1543 })
1544 }
1545 _ => Err(fidl::Error::UnknownOrdinal {
1546 ordinal: header.ordinal,
1547 protocol_name:
1548 <LookupAdminMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1549 }),
1550 }))
1551 },
1552 )
1553 }
1554}
1555
1556#[derive(Debug)]
1558pub enum LookupAdminRequest {
1559 SetDnsServers {
1568 servers: Vec<fidl_fuchsia_net::SocketAddress>,
1569 responder: LookupAdminSetDnsServersResponder,
1570 },
1571 GetDnsServers { responder: LookupAdminGetDnsServersResponder },
1574}
1575
1576impl LookupAdminRequest {
1577 #[allow(irrefutable_let_patterns)]
1578 pub fn into_set_dns_servers(
1579 self,
1580 ) -> Option<(Vec<fidl_fuchsia_net::SocketAddress>, LookupAdminSetDnsServersResponder)> {
1581 if let LookupAdminRequest::SetDnsServers { servers, responder } = self {
1582 Some((servers, responder))
1583 } else {
1584 None
1585 }
1586 }
1587
1588 #[allow(irrefutable_let_patterns)]
1589 pub fn into_get_dns_servers(self) -> Option<(LookupAdminGetDnsServersResponder)> {
1590 if let LookupAdminRequest::GetDnsServers { responder } = self {
1591 Some((responder))
1592 } else {
1593 None
1594 }
1595 }
1596
1597 pub fn method_name(&self) -> &'static str {
1599 match *self {
1600 LookupAdminRequest::SetDnsServers { .. } => "set_dns_servers",
1601 LookupAdminRequest::GetDnsServers { .. } => "get_dns_servers",
1602 }
1603 }
1604}
1605
1606#[derive(Debug, Clone)]
1607pub struct LookupAdminControlHandle {
1608 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1609}
1610
1611impl fidl::endpoints::ControlHandle for LookupAdminControlHandle {
1612 fn shutdown(&self) {
1613 self.inner.shutdown()
1614 }
1615
1616 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1617 self.inner.shutdown_with_epitaph(status)
1618 }
1619
1620 fn is_closed(&self) -> bool {
1621 self.inner.channel().is_closed()
1622 }
1623 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1624 self.inner.channel().on_closed()
1625 }
1626
1627 #[cfg(target_os = "fuchsia")]
1628 fn signal_peer(
1629 &self,
1630 clear_mask: zx::Signals,
1631 set_mask: zx::Signals,
1632 ) -> Result<(), zx_status::Status> {
1633 use fidl::Peered;
1634 self.inner.channel().signal_peer(clear_mask, set_mask)
1635 }
1636}
1637
1638impl LookupAdminControlHandle {}
1639
1640#[must_use = "FIDL methods require a response to be sent"]
1641#[derive(Debug)]
1642pub struct LookupAdminSetDnsServersResponder {
1643 control_handle: std::mem::ManuallyDrop<LookupAdminControlHandle>,
1644 tx_id: u32,
1645}
1646
1647impl std::ops::Drop for LookupAdminSetDnsServersResponder {
1651 fn drop(&mut self) {
1652 self.control_handle.shutdown();
1653 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1655 }
1656}
1657
1658impl fidl::endpoints::Responder for LookupAdminSetDnsServersResponder {
1659 type ControlHandle = LookupAdminControlHandle;
1660
1661 fn control_handle(&self) -> &LookupAdminControlHandle {
1662 &self.control_handle
1663 }
1664
1665 fn drop_without_shutdown(mut self) {
1666 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1668 std::mem::forget(self);
1670 }
1671}
1672
1673impl LookupAdminSetDnsServersResponder {
1674 pub fn send(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1678 let _result = self.send_raw(result);
1679 if _result.is_err() {
1680 self.control_handle.shutdown();
1681 }
1682 self.drop_without_shutdown();
1683 _result
1684 }
1685
1686 pub fn send_no_shutdown_on_err(self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1688 let _result = self.send_raw(result);
1689 self.drop_without_shutdown();
1690 _result
1691 }
1692
1693 fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
1694 self.control_handle
1695 .inner
1696 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
1697 result,
1698 self.tx_id,
1699 0x55e2b9fcc777be96,
1700 fidl::encoding::DynamicFlags::empty(),
1701 )
1702 }
1703}
1704
1705#[must_use = "FIDL methods require a response to be sent"]
1706#[derive(Debug)]
1707pub struct LookupAdminGetDnsServersResponder {
1708 control_handle: std::mem::ManuallyDrop<LookupAdminControlHandle>,
1709 tx_id: u32,
1710}
1711
1712impl std::ops::Drop for LookupAdminGetDnsServersResponder {
1716 fn drop(&mut self) {
1717 self.control_handle.shutdown();
1718 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1720 }
1721}
1722
1723impl fidl::endpoints::Responder for LookupAdminGetDnsServersResponder {
1724 type ControlHandle = LookupAdminControlHandle;
1725
1726 fn control_handle(&self) -> &LookupAdminControlHandle {
1727 &self.control_handle
1728 }
1729
1730 fn drop_without_shutdown(mut self) {
1731 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1733 std::mem::forget(self);
1735 }
1736}
1737
1738impl LookupAdminGetDnsServersResponder {
1739 pub fn send(self, mut servers: &[fidl_fuchsia_net::SocketAddress]) -> Result<(), fidl::Error> {
1743 let _result = self.send_raw(servers);
1744 if _result.is_err() {
1745 self.control_handle.shutdown();
1746 }
1747 self.drop_without_shutdown();
1748 _result
1749 }
1750
1751 pub fn send_no_shutdown_on_err(
1753 self,
1754 mut servers: &[fidl_fuchsia_net::SocketAddress],
1755 ) -> Result<(), fidl::Error> {
1756 let _result = self.send_raw(servers);
1757 self.drop_without_shutdown();
1758 _result
1759 }
1760
1761 fn send_raw(&self, mut servers: &[fidl_fuchsia_net::SocketAddress]) -> Result<(), fidl::Error> {
1762 self.control_handle.inner.send::<LookupAdminGetDnsServersResponse>(
1763 (servers,),
1764 self.tx_id,
1765 0x614303bf6e72f80f,
1766 fidl::encoding::DynamicFlags::empty(),
1767 )
1768 }
1769}
1770
1771mod internal {
1772 use super::*;
1773}