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