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