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_stack__common::*;
11use futures::future::{self, MaybeDone, TryFutureExt};
12use zx_status;
13
14#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
15pub struct StackBridgeInterfacesRequest {
16 pub interfaces: Vec<u64>,
17 pub bridge: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
18}
19
20impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
21 for StackBridgeInterfacesRequest
22{
23}
24
25#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
26pub struct StackSetDhcpClientEnabledRequest {
27 pub id: u64,
28 pub enable: bool,
29}
30
31impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
32 for StackSetDhcpClientEnabledRequest
33{
34}
35
36#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
37pub struct LogMarker;
38
39impl fidl::endpoints::ProtocolMarker for LogMarker {
40 type Proxy = LogProxy;
41 type RequestStream = LogRequestStream;
42 #[cfg(target_os = "fuchsia")]
43 type SynchronousProxy = LogSynchronousProxy;
44
45 const DEBUG_NAME: &'static str = "fuchsia.net.stack.Log";
46}
47impl fidl::endpoints::DiscoverableProtocolMarker for LogMarker {}
48
49pub trait LogProxyInterface: Send + Sync {
50 type SetLogPacketsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
51 fn r#set_log_packets(&self, enabled: bool) -> Self::SetLogPacketsResponseFut;
52}
53#[derive(Debug)]
54#[cfg(target_os = "fuchsia")]
55pub struct LogSynchronousProxy {
56 client: fidl::client::sync::Client,
57}
58
59#[cfg(target_os = "fuchsia")]
60impl fidl::endpoints::SynchronousProxy for LogSynchronousProxy {
61 type Proxy = LogProxy;
62 type Protocol = LogMarker;
63
64 fn from_channel(inner: fidl::Channel) -> Self {
65 Self::new(inner)
66 }
67
68 fn into_channel(self) -> fidl::Channel {
69 self.client.into_channel()
70 }
71
72 fn as_channel(&self) -> &fidl::Channel {
73 self.client.as_channel()
74 }
75}
76
77#[cfg(target_os = "fuchsia")]
78impl LogSynchronousProxy {
79 pub fn new(channel: fidl::Channel) -> Self {
80 let protocol_name = <LogMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
81 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
82 }
83
84 pub fn into_channel(self) -> fidl::Channel {
85 self.client.into_channel()
86 }
87
88 pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<LogEvent, fidl::Error> {
91 LogEvent::decode(self.client.wait_for_event(deadline)?)
92 }
93
94 pub fn r#set_log_packets(
96 &self,
97 mut enabled: bool,
98 ___deadline: zx::MonotonicInstant,
99 ) -> Result<(), fidl::Error> {
100 let _response =
101 self.client.send_query::<LogSetLogPacketsRequest, fidl::encoding::EmptyPayload>(
102 (enabled,),
103 0x2176044cba5f378e,
104 fidl::encoding::DynamicFlags::empty(),
105 ___deadline,
106 )?;
107 Ok(_response)
108 }
109}
110
111#[cfg(target_os = "fuchsia")]
112impl From<LogSynchronousProxy> for zx::Handle {
113 fn from(value: LogSynchronousProxy) -> Self {
114 value.into_channel().into()
115 }
116}
117
118#[cfg(target_os = "fuchsia")]
119impl From<fidl::Channel> for LogSynchronousProxy {
120 fn from(value: fidl::Channel) -> Self {
121 Self::new(value)
122 }
123}
124
125#[cfg(target_os = "fuchsia")]
126impl fidl::endpoints::FromClient for LogSynchronousProxy {
127 type Protocol = LogMarker;
128
129 fn from_client(value: fidl::endpoints::ClientEnd<LogMarker>) -> Self {
130 Self::new(value.into_channel())
131 }
132}
133
134#[derive(Debug, Clone)]
135pub struct LogProxy {
136 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
137}
138
139impl fidl::endpoints::Proxy for LogProxy {
140 type Protocol = LogMarker;
141
142 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
143 Self::new(inner)
144 }
145
146 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
147 self.client.into_channel().map_err(|client| Self { client })
148 }
149
150 fn as_channel(&self) -> &::fidl::AsyncChannel {
151 self.client.as_channel()
152 }
153}
154
155impl LogProxy {
156 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
158 let protocol_name = <LogMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
159 Self { client: fidl::client::Client::new(channel, protocol_name) }
160 }
161
162 pub fn take_event_stream(&self) -> LogEventStream {
168 LogEventStream { event_receiver: self.client.take_event_receiver() }
169 }
170
171 pub fn r#set_log_packets(
173 &self,
174 mut enabled: bool,
175 ) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
176 LogProxyInterface::r#set_log_packets(self, enabled)
177 }
178}
179
180impl LogProxyInterface for LogProxy {
181 type SetLogPacketsResponseFut =
182 fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
183 fn r#set_log_packets(&self, mut enabled: bool) -> Self::SetLogPacketsResponseFut {
184 fn _decode(
185 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
186 ) -> Result<(), fidl::Error> {
187 let _response = fidl::client::decode_transaction_body::<
188 fidl::encoding::EmptyPayload,
189 fidl::encoding::DefaultFuchsiaResourceDialect,
190 0x2176044cba5f378e,
191 >(_buf?)?;
192 Ok(_response)
193 }
194 self.client.send_query_and_decode::<LogSetLogPacketsRequest, ()>(
195 (enabled,),
196 0x2176044cba5f378e,
197 fidl::encoding::DynamicFlags::empty(),
198 _decode,
199 )
200 }
201}
202
203pub struct LogEventStream {
204 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
205}
206
207impl std::marker::Unpin for LogEventStream {}
208
209impl futures::stream::FusedStream for LogEventStream {
210 fn is_terminated(&self) -> bool {
211 self.event_receiver.is_terminated()
212 }
213}
214
215impl futures::Stream for LogEventStream {
216 type Item = Result<LogEvent, fidl::Error>;
217
218 fn poll_next(
219 mut self: std::pin::Pin<&mut Self>,
220 cx: &mut std::task::Context<'_>,
221 ) -> std::task::Poll<Option<Self::Item>> {
222 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
223 &mut self.event_receiver,
224 cx
225 )?) {
226 Some(buf) => std::task::Poll::Ready(Some(LogEvent::decode(buf))),
227 None => std::task::Poll::Ready(None),
228 }
229 }
230}
231
232#[derive(Debug)]
233pub enum LogEvent {}
234
235impl LogEvent {
236 fn decode(
238 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
239 ) -> Result<LogEvent, fidl::Error> {
240 let (bytes, _handles) = buf.split_mut();
241 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
242 debug_assert_eq!(tx_header.tx_id, 0);
243 match tx_header.ordinal {
244 _ => Err(fidl::Error::UnknownOrdinal {
245 ordinal: tx_header.ordinal,
246 protocol_name: <LogMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
247 }),
248 }
249 }
250}
251
252pub struct LogRequestStream {
254 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
255 is_terminated: bool,
256}
257
258impl std::marker::Unpin for LogRequestStream {}
259
260impl futures::stream::FusedStream for LogRequestStream {
261 fn is_terminated(&self) -> bool {
262 self.is_terminated
263 }
264}
265
266impl fidl::endpoints::RequestStream for LogRequestStream {
267 type Protocol = LogMarker;
268 type ControlHandle = LogControlHandle;
269
270 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
271 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
272 }
273
274 fn control_handle(&self) -> Self::ControlHandle {
275 LogControlHandle { inner: self.inner.clone() }
276 }
277
278 fn into_inner(
279 self,
280 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
281 {
282 (self.inner, self.is_terminated)
283 }
284
285 fn from_inner(
286 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
287 is_terminated: bool,
288 ) -> Self {
289 Self { inner, is_terminated }
290 }
291}
292
293impl futures::Stream for LogRequestStream {
294 type Item = Result<LogRequest, fidl::Error>;
295
296 fn poll_next(
297 mut self: std::pin::Pin<&mut Self>,
298 cx: &mut std::task::Context<'_>,
299 ) -> std::task::Poll<Option<Self::Item>> {
300 let this = &mut *self;
301 if this.inner.check_shutdown(cx) {
302 this.is_terminated = true;
303 return std::task::Poll::Ready(None);
304 }
305 if this.is_terminated {
306 panic!("polled LogRequestStream after completion");
307 }
308 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
309 |bytes, handles| {
310 match this.inner.channel().read_etc(cx, bytes, handles) {
311 std::task::Poll::Ready(Ok(())) => {}
312 std::task::Poll::Pending => return std::task::Poll::Pending,
313 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
314 this.is_terminated = true;
315 return std::task::Poll::Ready(None);
316 }
317 std::task::Poll::Ready(Err(e)) => {
318 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
319 e.into(),
320 ))))
321 }
322 }
323
324 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
326
327 std::task::Poll::Ready(Some(match header.ordinal {
328 0x2176044cba5f378e => {
329 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
330 let mut req = fidl::new_empty!(
331 LogSetLogPacketsRequest,
332 fidl::encoding::DefaultFuchsiaResourceDialect
333 );
334 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogSetLogPacketsRequest>(&header, _body_bytes, handles, &mut req)?;
335 let control_handle = LogControlHandle { inner: this.inner.clone() };
336 Ok(LogRequest::SetLogPackets {
337 enabled: req.enabled,
338
339 responder: LogSetLogPacketsResponder {
340 control_handle: std::mem::ManuallyDrop::new(control_handle),
341 tx_id: header.tx_id,
342 },
343 })
344 }
345 _ => Err(fidl::Error::UnknownOrdinal {
346 ordinal: header.ordinal,
347 protocol_name: <LogMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
348 }),
349 }))
350 },
351 )
352 }
353}
354
355#[derive(Debug)]
356pub enum LogRequest {
357 SetLogPackets { enabled: bool, responder: LogSetLogPacketsResponder },
359}
360
361impl LogRequest {
362 #[allow(irrefutable_let_patterns)]
363 pub fn into_set_log_packets(self) -> Option<(bool, LogSetLogPacketsResponder)> {
364 if let LogRequest::SetLogPackets { enabled, responder } = self {
365 Some((enabled, responder))
366 } else {
367 None
368 }
369 }
370
371 pub fn method_name(&self) -> &'static str {
373 match *self {
374 LogRequest::SetLogPackets { .. } => "set_log_packets",
375 }
376 }
377}
378
379#[derive(Debug, Clone)]
380pub struct LogControlHandle {
381 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
382}
383
384impl fidl::endpoints::ControlHandle for LogControlHandle {
385 fn shutdown(&self) {
386 self.inner.shutdown()
387 }
388 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
389 self.inner.shutdown_with_epitaph(status)
390 }
391
392 fn is_closed(&self) -> bool {
393 self.inner.channel().is_closed()
394 }
395 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
396 self.inner.channel().on_closed()
397 }
398
399 #[cfg(target_os = "fuchsia")]
400 fn signal_peer(
401 &self,
402 clear_mask: zx::Signals,
403 set_mask: zx::Signals,
404 ) -> Result<(), zx_status::Status> {
405 use fidl::Peered;
406 self.inner.channel().signal_peer(clear_mask, set_mask)
407 }
408}
409
410impl LogControlHandle {}
411
412#[must_use = "FIDL methods require a response to be sent"]
413#[derive(Debug)]
414pub struct LogSetLogPacketsResponder {
415 control_handle: std::mem::ManuallyDrop<LogControlHandle>,
416 tx_id: u32,
417}
418
419impl std::ops::Drop for LogSetLogPacketsResponder {
423 fn drop(&mut self) {
424 self.control_handle.shutdown();
425 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
427 }
428}
429
430impl fidl::endpoints::Responder for LogSetLogPacketsResponder {
431 type ControlHandle = LogControlHandle;
432
433 fn control_handle(&self) -> &LogControlHandle {
434 &self.control_handle
435 }
436
437 fn drop_without_shutdown(mut self) {
438 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
440 std::mem::forget(self);
442 }
443}
444
445impl LogSetLogPacketsResponder {
446 pub fn send(self) -> Result<(), fidl::Error> {
450 let _result = self.send_raw();
451 if _result.is_err() {
452 self.control_handle.shutdown();
453 }
454 self.drop_without_shutdown();
455 _result
456 }
457
458 pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
460 let _result = self.send_raw();
461 self.drop_without_shutdown();
462 _result
463 }
464
465 fn send_raw(&self) -> Result<(), fidl::Error> {
466 self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
467 (),
468 self.tx_id,
469 0x2176044cba5f378e,
470 fidl::encoding::DynamicFlags::empty(),
471 )
472 }
473}
474
475#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
476pub struct StackMarker;
477
478impl fidl::endpoints::ProtocolMarker for StackMarker {
479 type Proxy = StackProxy;
480 type RequestStream = StackRequestStream;
481 #[cfg(target_os = "fuchsia")]
482 type SynchronousProxy = StackSynchronousProxy;
483
484 const DEBUG_NAME: &'static str = "fuchsia.net.stack.Stack";
485}
486impl fidl::endpoints::DiscoverableProtocolMarker for StackMarker {}
487pub type StackAddForwardingEntryResult = Result<(), Error>;
488pub type StackDelForwardingEntryResult = Result<(), Error>;
489pub type StackSetDhcpClientEnabledResult = Result<(), Error>;
490
491pub trait StackProxyInterface: Send + Sync {
492 type AddForwardingEntryResponseFut: std::future::Future<Output = Result<StackAddForwardingEntryResult, fidl::Error>>
493 + Send;
494 fn r#add_forwarding_entry(
495 &self,
496 entry: &ForwardingEntry,
497 ) -> Self::AddForwardingEntryResponseFut;
498 type DelForwardingEntryResponseFut: std::future::Future<Output = Result<StackDelForwardingEntryResult, fidl::Error>>
499 + Send;
500 fn r#del_forwarding_entry(
501 &self,
502 entry: &ForwardingEntry,
503 ) -> Self::DelForwardingEntryResponseFut;
504 type SetDhcpClientEnabledResponseFut: std::future::Future<Output = Result<StackSetDhcpClientEnabledResult, fidl::Error>>
505 + Send;
506 fn r#set_dhcp_client_enabled(
507 &self,
508 id: u64,
509 enable: bool,
510 ) -> Self::SetDhcpClientEnabledResponseFut;
511 fn r#bridge_interfaces(
512 &self,
513 interfaces: &[u64],
514 bridge: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
515 ) -> Result<(), fidl::Error>;
516}
517#[derive(Debug)]
518#[cfg(target_os = "fuchsia")]
519pub struct StackSynchronousProxy {
520 client: fidl::client::sync::Client,
521}
522
523#[cfg(target_os = "fuchsia")]
524impl fidl::endpoints::SynchronousProxy for StackSynchronousProxy {
525 type Proxy = StackProxy;
526 type Protocol = StackMarker;
527
528 fn from_channel(inner: fidl::Channel) -> Self {
529 Self::new(inner)
530 }
531
532 fn into_channel(self) -> fidl::Channel {
533 self.client.into_channel()
534 }
535
536 fn as_channel(&self) -> &fidl::Channel {
537 self.client.as_channel()
538 }
539}
540
541#[cfg(target_os = "fuchsia")]
542impl StackSynchronousProxy {
543 pub fn new(channel: fidl::Channel) -> Self {
544 let protocol_name = <StackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
545 Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
546 }
547
548 pub fn into_channel(self) -> fidl::Channel {
549 self.client.into_channel()
550 }
551
552 pub fn wait_for_event(
555 &self,
556 deadline: zx::MonotonicInstant,
557 ) -> Result<StackEvent, fidl::Error> {
558 StackEvent::decode(self.client.wait_for_event(deadline)?)
559 }
560
561 pub fn r#add_forwarding_entry(
566 &self,
567 mut entry: &ForwardingEntry,
568 ___deadline: zx::MonotonicInstant,
569 ) -> Result<StackAddForwardingEntryResult, fidl::Error> {
570 let _response = self.client.send_query::<
571 StackAddForwardingEntryRequest,
572 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
573 >(
574 (entry,),
575 0x5fe2020877107909,
576 fidl::encoding::DynamicFlags::empty(),
577 ___deadline,
578 )?;
579 Ok(_response.map(|x| x))
580 }
581
582 pub fn r#del_forwarding_entry(
586 &self,
587 mut entry: &ForwardingEntry,
588 ___deadline: zx::MonotonicInstant,
589 ) -> Result<StackDelForwardingEntryResult, fidl::Error> {
590 let _response = self.client.send_query::<
591 StackDelForwardingEntryRequest,
592 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
593 >(
594 (entry,),
595 0x560f3944c4cb51bd,
596 fidl::encoding::DynamicFlags::empty(),
597 ___deadline,
598 )?;
599 Ok(_response.map(|x| x))
600 }
601
602 pub fn r#set_dhcp_client_enabled(
606 &self,
607 mut id: u64,
608 mut enable: bool,
609 ___deadline: zx::MonotonicInstant,
610 ) -> Result<StackSetDhcpClientEnabledResult, fidl::Error> {
611 let _response = self.client.send_query::<
612 StackSetDhcpClientEnabledRequest,
613 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
614 >(
615 (id, enable,),
616 0x6dead3a6025b0543,
617 fidl::encoding::DynamicFlags::empty(),
618 ___deadline,
619 )?;
620 Ok(_response.map(|x| x))
621 }
622
623 pub fn r#bridge_interfaces(
635 &self,
636 mut interfaces: &[u64],
637 mut bridge: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
638 ) -> Result<(), fidl::Error> {
639 self.client.send::<StackBridgeInterfacesRequest>(
640 (interfaces, bridge),
641 0x60509044a41ac976,
642 fidl::encoding::DynamicFlags::empty(),
643 )
644 }
645}
646
647#[cfg(target_os = "fuchsia")]
648impl From<StackSynchronousProxy> for zx::Handle {
649 fn from(value: StackSynchronousProxy) -> Self {
650 value.into_channel().into()
651 }
652}
653
654#[cfg(target_os = "fuchsia")]
655impl From<fidl::Channel> for StackSynchronousProxy {
656 fn from(value: fidl::Channel) -> Self {
657 Self::new(value)
658 }
659}
660
661#[cfg(target_os = "fuchsia")]
662impl fidl::endpoints::FromClient for StackSynchronousProxy {
663 type Protocol = StackMarker;
664
665 fn from_client(value: fidl::endpoints::ClientEnd<StackMarker>) -> Self {
666 Self::new(value.into_channel())
667 }
668}
669
670#[derive(Debug, Clone)]
671pub struct StackProxy {
672 client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
673}
674
675impl fidl::endpoints::Proxy for StackProxy {
676 type Protocol = StackMarker;
677
678 fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
679 Self::new(inner)
680 }
681
682 fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
683 self.client.into_channel().map_err(|client| Self { client })
684 }
685
686 fn as_channel(&self) -> &::fidl::AsyncChannel {
687 self.client.as_channel()
688 }
689}
690
691impl StackProxy {
692 pub fn new(channel: ::fidl::AsyncChannel) -> Self {
694 let protocol_name = <StackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
695 Self { client: fidl::client::Client::new(channel, protocol_name) }
696 }
697
698 pub fn take_event_stream(&self) -> StackEventStream {
704 StackEventStream { event_receiver: self.client.take_event_receiver() }
705 }
706
707 pub fn r#add_forwarding_entry(
712 &self,
713 mut entry: &ForwardingEntry,
714 ) -> fidl::client::QueryResponseFut<
715 StackAddForwardingEntryResult,
716 fidl::encoding::DefaultFuchsiaResourceDialect,
717 > {
718 StackProxyInterface::r#add_forwarding_entry(self, entry)
719 }
720
721 pub fn r#del_forwarding_entry(
725 &self,
726 mut entry: &ForwardingEntry,
727 ) -> fidl::client::QueryResponseFut<
728 StackDelForwardingEntryResult,
729 fidl::encoding::DefaultFuchsiaResourceDialect,
730 > {
731 StackProxyInterface::r#del_forwarding_entry(self, entry)
732 }
733
734 pub fn r#set_dhcp_client_enabled(
738 &self,
739 mut id: u64,
740 mut enable: bool,
741 ) -> fidl::client::QueryResponseFut<
742 StackSetDhcpClientEnabledResult,
743 fidl::encoding::DefaultFuchsiaResourceDialect,
744 > {
745 StackProxyInterface::r#set_dhcp_client_enabled(self, id, enable)
746 }
747
748 pub fn r#bridge_interfaces(
760 &self,
761 mut interfaces: &[u64],
762 mut bridge: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
763 ) -> Result<(), fidl::Error> {
764 StackProxyInterface::r#bridge_interfaces(self, interfaces, bridge)
765 }
766}
767
768impl StackProxyInterface for StackProxy {
769 type AddForwardingEntryResponseFut = fidl::client::QueryResponseFut<
770 StackAddForwardingEntryResult,
771 fidl::encoding::DefaultFuchsiaResourceDialect,
772 >;
773 fn r#add_forwarding_entry(
774 &self,
775 mut entry: &ForwardingEntry,
776 ) -> Self::AddForwardingEntryResponseFut {
777 fn _decode(
778 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
779 ) -> Result<StackAddForwardingEntryResult, fidl::Error> {
780 let _response = fidl::client::decode_transaction_body::<
781 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
782 fidl::encoding::DefaultFuchsiaResourceDialect,
783 0x5fe2020877107909,
784 >(_buf?)?;
785 Ok(_response.map(|x| x))
786 }
787 self.client
788 .send_query_and_decode::<StackAddForwardingEntryRequest, StackAddForwardingEntryResult>(
789 (entry,),
790 0x5fe2020877107909,
791 fidl::encoding::DynamicFlags::empty(),
792 _decode,
793 )
794 }
795
796 type DelForwardingEntryResponseFut = fidl::client::QueryResponseFut<
797 StackDelForwardingEntryResult,
798 fidl::encoding::DefaultFuchsiaResourceDialect,
799 >;
800 fn r#del_forwarding_entry(
801 &self,
802 mut entry: &ForwardingEntry,
803 ) -> Self::DelForwardingEntryResponseFut {
804 fn _decode(
805 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
806 ) -> Result<StackDelForwardingEntryResult, fidl::Error> {
807 let _response = fidl::client::decode_transaction_body::<
808 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
809 fidl::encoding::DefaultFuchsiaResourceDialect,
810 0x560f3944c4cb51bd,
811 >(_buf?)?;
812 Ok(_response.map(|x| x))
813 }
814 self.client
815 .send_query_and_decode::<StackDelForwardingEntryRequest, StackDelForwardingEntryResult>(
816 (entry,),
817 0x560f3944c4cb51bd,
818 fidl::encoding::DynamicFlags::empty(),
819 _decode,
820 )
821 }
822
823 type SetDhcpClientEnabledResponseFut = fidl::client::QueryResponseFut<
824 StackSetDhcpClientEnabledResult,
825 fidl::encoding::DefaultFuchsiaResourceDialect,
826 >;
827 fn r#set_dhcp_client_enabled(
828 &self,
829 mut id: u64,
830 mut enable: bool,
831 ) -> Self::SetDhcpClientEnabledResponseFut {
832 fn _decode(
833 mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
834 ) -> Result<StackSetDhcpClientEnabledResult, fidl::Error> {
835 let _response = fidl::client::decode_transaction_body::<
836 fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
837 fidl::encoding::DefaultFuchsiaResourceDialect,
838 0x6dead3a6025b0543,
839 >(_buf?)?;
840 Ok(_response.map(|x| x))
841 }
842 self.client.send_query_and_decode::<
843 StackSetDhcpClientEnabledRequest,
844 StackSetDhcpClientEnabledResult,
845 >(
846 (id, enable,),
847 0x6dead3a6025b0543,
848 fidl::encoding::DynamicFlags::empty(),
849 _decode,
850 )
851 }
852
853 fn r#bridge_interfaces(
854 &self,
855 mut interfaces: &[u64],
856 mut bridge: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
857 ) -> Result<(), fidl::Error> {
858 self.client.send::<StackBridgeInterfacesRequest>(
859 (interfaces, bridge),
860 0x60509044a41ac976,
861 fidl::encoding::DynamicFlags::empty(),
862 )
863 }
864}
865
866pub struct StackEventStream {
867 event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
868}
869
870impl std::marker::Unpin for StackEventStream {}
871
872impl futures::stream::FusedStream for StackEventStream {
873 fn is_terminated(&self) -> bool {
874 self.event_receiver.is_terminated()
875 }
876}
877
878impl futures::Stream for StackEventStream {
879 type Item = Result<StackEvent, fidl::Error>;
880
881 fn poll_next(
882 mut self: std::pin::Pin<&mut Self>,
883 cx: &mut std::task::Context<'_>,
884 ) -> std::task::Poll<Option<Self::Item>> {
885 match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
886 &mut self.event_receiver,
887 cx
888 )?) {
889 Some(buf) => std::task::Poll::Ready(Some(StackEvent::decode(buf))),
890 None => std::task::Poll::Ready(None),
891 }
892 }
893}
894
895#[derive(Debug)]
896pub enum StackEvent {}
897
898impl StackEvent {
899 fn decode(
901 mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
902 ) -> Result<StackEvent, fidl::Error> {
903 let (bytes, _handles) = buf.split_mut();
904 let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
905 debug_assert_eq!(tx_header.tx_id, 0);
906 match tx_header.ordinal {
907 _ => Err(fidl::Error::UnknownOrdinal {
908 ordinal: tx_header.ordinal,
909 protocol_name: <StackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
910 }),
911 }
912 }
913}
914
915pub struct StackRequestStream {
917 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
918 is_terminated: bool,
919}
920
921impl std::marker::Unpin for StackRequestStream {}
922
923impl futures::stream::FusedStream for StackRequestStream {
924 fn is_terminated(&self) -> bool {
925 self.is_terminated
926 }
927}
928
929impl fidl::endpoints::RequestStream for StackRequestStream {
930 type Protocol = StackMarker;
931 type ControlHandle = StackControlHandle;
932
933 fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
934 Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
935 }
936
937 fn control_handle(&self) -> Self::ControlHandle {
938 StackControlHandle { inner: self.inner.clone() }
939 }
940
941 fn into_inner(
942 self,
943 ) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
944 {
945 (self.inner, self.is_terminated)
946 }
947
948 fn from_inner(
949 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
950 is_terminated: bool,
951 ) -> Self {
952 Self { inner, is_terminated }
953 }
954}
955
956impl futures::Stream for StackRequestStream {
957 type Item = Result<StackRequest, fidl::Error>;
958
959 fn poll_next(
960 mut self: std::pin::Pin<&mut Self>,
961 cx: &mut std::task::Context<'_>,
962 ) -> std::task::Poll<Option<Self::Item>> {
963 let this = &mut *self;
964 if this.inner.check_shutdown(cx) {
965 this.is_terminated = true;
966 return std::task::Poll::Ready(None);
967 }
968 if this.is_terminated {
969 panic!("polled StackRequestStream after completion");
970 }
971 fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
972 |bytes, handles| {
973 match this.inner.channel().read_etc(cx, bytes, handles) {
974 std::task::Poll::Ready(Ok(())) => {}
975 std::task::Poll::Pending => return std::task::Poll::Pending,
976 std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
977 this.is_terminated = true;
978 return std::task::Poll::Ready(None);
979 }
980 std::task::Poll::Ready(Err(e)) => {
981 return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
982 e.into(),
983 ))))
984 }
985 }
986
987 let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
989
990 std::task::Poll::Ready(Some(match header.ordinal {
991 0x5fe2020877107909 => {
992 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
993 let mut req = fidl::new_empty!(
994 StackAddForwardingEntryRequest,
995 fidl::encoding::DefaultFuchsiaResourceDialect
996 );
997 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackAddForwardingEntryRequest>(&header, _body_bytes, handles, &mut req)?;
998 let control_handle = StackControlHandle { inner: this.inner.clone() };
999 Ok(StackRequest::AddForwardingEntry {
1000 entry: req.entry,
1001
1002 responder: StackAddForwardingEntryResponder {
1003 control_handle: std::mem::ManuallyDrop::new(control_handle),
1004 tx_id: header.tx_id,
1005 },
1006 })
1007 }
1008 0x560f3944c4cb51bd => {
1009 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1010 let mut req = fidl::new_empty!(
1011 StackDelForwardingEntryRequest,
1012 fidl::encoding::DefaultFuchsiaResourceDialect
1013 );
1014 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackDelForwardingEntryRequest>(&header, _body_bytes, handles, &mut req)?;
1015 let control_handle = StackControlHandle { inner: this.inner.clone() };
1016 Ok(StackRequest::DelForwardingEntry {
1017 entry: req.entry,
1018
1019 responder: StackDelForwardingEntryResponder {
1020 control_handle: std::mem::ManuallyDrop::new(control_handle),
1021 tx_id: header.tx_id,
1022 },
1023 })
1024 }
1025 0x6dead3a6025b0543 => {
1026 header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
1027 let mut req = fidl::new_empty!(
1028 StackSetDhcpClientEnabledRequest,
1029 fidl::encoding::DefaultFuchsiaResourceDialect
1030 );
1031 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackSetDhcpClientEnabledRequest>(&header, _body_bytes, handles, &mut req)?;
1032 let control_handle = StackControlHandle { inner: this.inner.clone() };
1033 Ok(StackRequest::SetDhcpClientEnabled {
1034 id: req.id,
1035 enable: req.enable,
1036
1037 responder: StackSetDhcpClientEnabledResponder {
1038 control_handle: std::mem::ManuallyDrop::new(control_handle),
1039 tx_id: header.tx_id,
1040 },
1041 })
1042 }
1043 0x60509044a41ac976 => {
1044 header.validate_request_tx_id(fidl::MethodType::OneWay)?;
1045 let mut req = fidl::new_empty!(
1046 StackBridgeInterfacesRequest,
1047 fidl::encoding::DefaultFuchsiaResourceDialect
1048 );
1049 fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackBridgeInterfacesRequest>(&header, _body_bytes, handles, &mut req)?;
1050 let control_handle = StackControlHandle { inner: this.inner.clone() };
1051 Ok(StackRequest::BridgeInterfaces {
1052 interfaces: req.interfaces,
1053 bridge: req.bridge,
1054
1055 control_handle,
1056 })
1057 }
1058 _ => Err(fidl::Error::UnknownOrdinal {
1059 ordinal: header.ordinal,
1060 protocol_name: <StackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
1061 }),
1062 }))
1063 },
1064 )
1065 }
1066}
1067
1068#[derive(Debug)]
1069pub enum StackRequest {
1070 AddForwardingEntry { entry: ForwardingEntry, responder: StackAddForwardingEntryResponder },
1075 DelForwardingEntry { entry: ForwardingEntry, responder: StackDelForwardingEntryResponder },
1079 SetDhcpClientEnabled { id: u64, enable: bool, responder: StackSetDhcpClientEnabledResponder },
1083 BridgeInterfaces {
1095 interfaces: Vec<u64>,
1096 bridge: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
1097 control_handle: StackControlHandle,
1098 },
1099}
1100
1101impl StackRequest {
1102 #[allow(irrefutable_let_patterns)]
1103 pub fn into_add_forwarding_entry(
1104 self,
1105 ) -> Option<(ForwardingEntry, StackAddForwardingEntryResponder)> {
1106 if let StackRequest::AddForwardingEntry { entry, responder } = self {
1107 Some((entry, responder))
1108 } else {
1109 None
1110 }
1111 }
1112
1113 #[allow(irrefutable_let_patterns)]
1114 pub fn into_del_forwarding_entry(
1115 self,
1116 ) -> Option<(ForwardingEntry, StackDelForwardingEntryResponder)> {
1117 if let StackRequest::DelForwardingEntry { entry, responder } = self {
1118 Some((entry, responder))
1119 } else {
1120 None
1121 }
1122 }
1123
1124 #[allow(irrefutable_let_patterns)]
1125 pub fn into_set_dhcp_client_enabled(
1126 self,
1127 ) -> Option<(u64, bool, StackSetDhcpClientEnabledResponder)> {
1128 if let StackRequest::SetDhcpClientEnabled { id, enable, responder } = self {
1129 Some((id, enable, responder))
1130 } else {
1131 None
1132 }
1133 }
1134
1135 #[allow(irrefutable_let_patterns)]
1136 pub fn into_bridge_interfaces(
1137 self,
1138 ) -> Option<(
1139 Vec<u64>,
1140 fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
1141 StackControlHandle,
1142 )> {
1143 if let StackRequest::BridgeInterfaces { interfaces, bridge, control_handle } = self {
1144 Some((interfaces, bridge, control_handle))
1145 } else {
1146 None
1147 }
1148 }
1149
1150 pub fn method_name(&self) -> &'static str {
1152 match *self {
1153 StackRequest::AddForwardingEntry { .. } => "add_forwarding_entry",
1154 StackRequest::DelForwardingEntry { .. } => "del_forwarding_entry",
1155 StackRequest::SetDhcpClientEnabled { .. } => "set_dhcp_client_enabled",
1156 StackRequest::BridgeInterfaces { .. } => "bridge_interfaces",
1157 }
1158 }
1159}
1160
1161#[derive(Debug, Clone)]
1162pub struct StackControlHandle {
1163 inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
1164}
1165
1166impl fidl::endpoints::ControlHandle for StackControlHandle {
1167 fn shutdown(&self) {
1168 self.inner.shutdown()
1169 }
1170 fn shutdown_with_epitaph(&self, status: zx_status::Status) {
1171 self.inner.shutdown_with_epitaph(status)
1172 }
1173
1174 fn is_closed(&self) -> bool {
1175 self.inner.channel().is_closed()
1176 }
1177 fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
1178 self.inner.channel().on_closed()
1179 }
1180
1181 #[cfg(target_os = "fuchsia")]
1182 fn signal_peer(
1183 &self,
1184 clear_mask: zx::Signals,
1185 set_mask: zx::Signals,
1186 ) -> Result<(), zx_status::Status> {
1187 use fidl::Peered;
1188 self.inner.channel().signal_peer(clear_mask, set_mask)
1189 }
1190}
1191
1192impl StackControlHandle {}
1193
1194#[must_use = "FIDL methods require a response to be sent"]
1195#[derive(Debug)]
1196pub struct StackAddForwardingEntryResponder {
1197 control_handle: std::mem::ManuallyDrop<StackControlHandle>,
1198 tx_id: u32,
1199}
1200
1201impl std::ops::Drop for StackAddForwardingEntryResponder {
1205 fn drop(&mut self) {
1206 self.control_handle.shutdown();
1207 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1209 }
1210}
1211
1212impl fidl::endpoints::Responder for StackAddForwardingEntryResponder {
1213 type ControlHandle = StackControlHandle;
1214
1215 fn control_handle(&self) -> &StackControlHandle {
1216 &self.control_handle
1217 }
1218
1219 fn drop_without_shutdown(mut self) {
1220 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1222 std::mem::forget(self);
1224 }
1225}
1226
1227impl StackAddForwardingEntryResponder {
1228 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1232 let _result = self.send_raw(result);
1233 if _result.is_err() {
1234 self.control_handle.shutdown();
1235 }
1236 self.drop_without_shutdown();
1237 _result
1238 }
1239
1240 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1242 let _result = self.send_raw(result);
1243 self.drop_without_shutdown();
1244 _result
1245 }
1246
1247 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1248 self.control_handle
1249 .inner
1250 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1251 result,
1252 self.tx_id,
1253 0x5fe2020877107909,
1254 fidl::encoding::DynamicFlags::empty(),
1255 )
1256 }
1257}
1258
1259#[must_use = "FIDL methods require a response to be sent"]
1260#[derive(Debug)]
1261pub struct StackDelForwardingEntryResponder {
1262 control_handle: std::mem::ManuallyDrop<StackControlHandle>,
1263 tx_id: u32,
1264}
1265
1266impl std::ops::Drop for StackDelForwardingEntryResponder {
1270 fn drop(&mut self) {
1271 self.control_handle.shutdown();
1272 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1274 }
1275}
1276
1277impl fidl::endpoints::Responder for StackDelForwardingEntryResponder {
1278 type ControlHandle = StackControlHandle;
1279
1280 fn control_handle(&self) -> &StackControlHandle {
1281 &self.control_handle
1282 }
1283
1284 fn drop_without_shutdown(mut self) {
1285 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1287 std::mem::forget(self);
1289 }
1290}
1291
1292impl StackDelForwardingEntryResponder {
1293 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1297 let _result = self.send_raw(result);
1298 if _result.is_err() {
1299 self.control_handle.shutdown();
1300 }
1301 self.drop_without_shutdown();
1302 _result
1303 }
1304
1305 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1307 let _result = self.send_raw(result);
1308 self.drop_without_shutdown();
1309 _result
1310 }
1311
1312 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1313 self.control_handle
1314 .inner
1315 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1316 result,
1317 self.tx_id,
1318 0x560f3944c4cb51bd,
1319 fidl::encoding::DynamicFlags::empty(),
1320 )
1321 }
1322}
1323
1324#[must_use = "FIDL methods require a response to be sent"]
1325#[derive(Debug)]
1326pub struct StackSetDhcpClientEnabledResponder {
1327 control_handle: std::mem::ManuallyDrop<StackControlHandle>,
1328 tx_id: u32,
1329}
1330
1331impl std::ops::Drop for StackSetDhcpClientEnabledResponder {
1335 fn drop(&mut self) {
1336 self.control_handle.shutdown();
1337 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1339 }
1340}
1341
1342impl fidl::endpoints::Responder for StackSetDhcpClientEnabledResponder {
1343 type ControlHandle = StackControlHandle;
1344
1345 fn control_handle(&self) -> &StackControlHandle {
1346 &self.control_handle
1347 }
1348
1349 fn drop_without_shutdown(mut self) {
1350 unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
1352 std::mem::forget(self);
1354 }
1355}
1356
1357impl StackSetDhcpClientEnabledResponder {
1358 pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1362 let _result = self.send_raw(result);
1363 if _result.is_err() {
1364 self.control_handle.shutdown();
1365 }
1366 self.drop_without_shutdown();
1367 _result
1368 }
1369
1370 pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1372 let _result = self.send_raw(result);
1373 self.drop_without_shutdown();
1374 _result
1375 }
1376
1377 fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
1378 self.control_handle
1379 .inner
1380 .send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
1381 result,
1382 self.tx_id,
1383 0x6dead3a6025b0543,
1384 fidl::encoding::DynamicFlags::empty(),
1385 )
1386 }
1387}
1388
1389mod internal {
1390 use super::*;
1391
1392 impl fidl::encoding::ResourceTypeMarker for StackBridgeInterfacesRequest {
1393 type Borrowed<'a> = &'a mut Self;
1394 fn take_or_borrow<'a>(
1395 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1396 ) -> Self::Borrowed<'a> {
1397 value
1398 }
1399 }
1400
1401 unsafe impl fidl::encoding::TypeMarker for StackBridgeInterfacesRequest {
1402 type Owned = Self;
1403
1404 #[inline(always)]
1405 fn inline_align(_context: fidl::encoding::Context) -> usize {
1406 8
1407 }
1408
1409 #[inline(always)]
1410 fn inline_size(_context: fidl::encoding::Context) -> usize {
1411 24
1412 }
1413 }
1414
1415 unsafe impl
1416 fidl::encoding::Encode<
1417 StackBridgeInterfacesRequest,
1418 fidl::encoding::DefaultFuchsiaResourceDialect,
1419 > for &mut StackBridgeInterfacesRequest
1420 {
1421 #[inline]
1422 unsafe fn encode(
1423 self,
1424 encoder: &mut fidl::encoding::Encoder<
1425 '_,
1426 fidl::encoding::DefaultFuchsiaResourceDialect,
1427 >,
1428 offset: usize,
1429 _depth: fidl::encoding::Depth,
1430 ) -> fidl::Result<()> {
1431 encoder.debug_check_bounds::<StackBridgeInterfacesRequest>(offset);
1432 fidl::encoding::Encode::<StackBridgeInterfacesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
1434 (
1435 <fidl::encoding::UnboundedVector<u64> as fidl::encoding::ValueTypeMarker>::borrow(&self.interfaces),
1436 <fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.bridge),
1437 ),
1438 encoder, offset, _depth
1439 )
1440 }
1441 }
1442 unsafe impl<
1443 T0: fidl::encoding::Encode<
1444 fidl::encoding::UnboundedVector<u64>,
1445 fidl::encoding::DefaultFuchsiaResourceDialect,
1446 >,
1447 T1: fidl::encoding::Encode<
1448 fidl::encoding::Endpoint<
1449 fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
1450 >,
1451 fidl::encoding::DefaultFuchsiaResourceDialect,
1452 >,
1453 >
1454 fidl::encoding::Encode<
1455 StackBridgeInterfacesRequest,
1456 fidl::encoding::DefaultFuchsiaResourceDialect,
1457 > for (T0, T1)
1458 {
1459 #[inline]
1460 unsafe fn encode(
1461 self,
1462 encoder: &mut fidl::encoding::Encoder<
1463 '_,
1464 fidl::encoding::DefaultFuchsiaResourceDialect,
1465 >,
1466 offset: usize,
1467 depth: fidl::encoding::Depth,
1468 ) -> fidl::Result<()> {
1469 encoder.debug_check_bounds::<StackBridgeInterfacesRequest>(offset);
1470 unsafe {
1473 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
1474 (ptr as *mut u64).write_unaligned(0);
1475 }
1476 self.0.encode(encoder, offset + 0, depth)?;
1478 self.1.encode(encoder, offset + 16, depth)?;
1479 Ok(())
1480 }
1481 }
1482
1483 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1484 for StackBridgeInterfacesRequest
1485 {
1486 #[inline(always)]
1487 fn new_empty() -> Self {
1488 Self {
1489 interfaces: fidl::new_empty!(
1490 fidl::encoding::UnboundedVector<u64>,
1491 fidl::encoding::DefaultFuchsiaResourceDialect
1492 ),
1493 bridge: fidl::new_empty!(
1494 fidl::encoding::Endpoint<
1495 fidl::endpoints::ServerEnd<
1496 fidl_fuchsia_net_interfaces_admin::ControlMarker,
1497 >,
1498 >,
1499 fidl::encoding::DefaultFuchsiaResourceDialect
1500 ),
1501 }
1502 }
1503
1504 #[inline]
1505 unsafe fn decode(
1506 &mut self,
1507 decoder: &mut fidl::encoding::Decoder<
1508 '_,
1509 fidl::encoding::DefaultFuchsiaResourceDialect,
1510 >,
1511 offset: usize,
1512 _depth: fidl::encoding::Depth,
1513 ) -> fidl::Result<()> {
1514 decoder.debug_check_bounds::<Self>(offset);
1515 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
1517 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1518 let mask = 0xffffffff00000000u64;
1519 let maskedval = padval & mask;
1520 if maskedval != 0 {
1521 return Err(fidl::Error::NonZeroPadding {
1522 padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
1523 });
1524 }
1525 fidl::decode!(
1526 fidl::encoding::UnboundedVector<u64>,
1527 fidl::encoding::DefaultFuchsiaResourceDialect,
1528 &mut self.interfaces,
1529 decoder,
1530 offset + 0,
1531 _depth
1532 )?;
1533 fidl::decode!(
1534 fidl::encoding::Endpoint<
1535 fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
1536 >,
1537 fidl::encoding::DefaultFuchsiaResourceDialect,
1538 &mut self.bridge,
1539 decoder,
1540 offset + 16,
1541 _depth
1542 )?;
1543 Ok(())
1544 }
1545 }
1546
1547 impl fidl::encoding::ResourceTypeMarker for StackSetDhcpClientEnabledRequest {
1548 type Borrowed<'a> = &'a mut Self;
1549 fn take_or_borrow<'a>(
1550 value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
1551 ) -> Self::Borrowed<'a> {
1552 value
1553 }
1554 }
1555
1556 unsafe impl fidl::encoding::TypeMarker for StackSetDhcpClientEnabledRequest {
1557 type Owned = Self;
1558
1559 #[inline(always)]
1560 fn inline_align(_context: fidl::encoding::Context) -> usize {
1561 8
1562 }
1563
1564 #[inline(always)]
1565 fn inline_size(_context: fidl::encoding::Context) -> usize {
1566 16
1567 }
1568 }
1569
1570 unsafe impl
1571 fidl::encoding::Encode<
1572 StackSetDhcpClientEnabledRequest,
1573 fidl::encoding::DefaultFuchsiaResourceDialect,
1574 > for &mut StackSetDhcpClientEnabledRequest
1575 {
1576 #[inline]
1577 unsafe fn encode(
1578 self,
1579 encoder: &mut fidl::encoding::Encoder<
1580 '_,
1581 fidl::encoding::DefaultFuchsiaResourceDialect,
1582 >,
1583 offset: usize,
1584 _depth: fidl::encoding::Depth,
1585 ) -> fidl::Result<()> {
1586 encoder.debug_check_bounds::<StackSetDhcpClientEnabledRequest>(offset);
1587 fidl::encoding::Encode::<
1589 StackSetDhcpClientEnabledRequest,
1590 fidl::encoding::DefaultFuchsiaResourceDialect,
1591 >::encode(
1592 (
1593 <u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
1594 <bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable),
1595 ),
1596 encoder,
1597 offset,
1598 _depth,
1599 )
1600 }
1601 }
1602 unsafe impl<
1603 T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
1604 T1: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
1605 >
1606 fidl::encoding::Encode<
1607 StackSetDhcpClientEnabledRequest,
1608 fidl::encoding::DefaultFuchsiaResourceDialect,
1609 > for (T0, T1)
1610 {
1611 #[inline]
1612 unsafe fn encode(
1613 self,
1614 encoder: &mut fidl::encoding::Encoder<
1615 '_,
1616 fidl::encoding::DefaultFuchsiaResourceDialect,
1617 >,
1618 offset: usize,
1619 depth: fidl::encoding::Depth,
1620 ) -> fidl::Result<()> {
1621 encoder.debug_check_bounds::<StackSetDhcpClientEnabledRequest>(offset);
1622 unsafe {
1625 let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
1626 (ptr as *mut u64).write_unaligned(0);
1627 }
1628 self.0.encode(encoder, offset + 0, depth)?;
1630 self.1.encode(encoder, offset + 8, depth)?;
1631 Ok(())
1632 }
1633 }
1634
1635 impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
1636 for StackSetDhcpClientEnabledRequest
1637 {
1638 #[inline(always)]
1639 fn new_empty() -> Self {
1640 Self {
1641 id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
1642 enable: fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect),
1643 }
1644 }
1645
1646 #[inline]
1647 unsafe fn decode(
1648 &mut self,
1649 decoder: &mut fidl::encoding::Decoder<
1650 '_,
1651 fidl::encoding::DefaultFuchsiaResourceDialect,
1652 >,
1653 offset: usize,
1654 _depth: fidl::encoding::Depth,
1655 ) -> fidl::Result<()> {
1656 decoder.debug_check_bounds::<Self>(offset);
1657 let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
1659 let padval = unsafe { (ptr as *const u64).read_unaligned() };
1660 let mask = 0xffffffffffffff00u64;
1661 let maskedval = padval & mask;
1662 if maskedval != 0 {
1663 return Err(fidl::Error::NonZeroPadding {
1664 padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
1665 });
1666 }
1667 fidl::decode!(
1668 u64,
1669 fidl::encoding::DefaultFuchsiaResourceDialect,
1670 &mut self.id,
1671 decoder,
1672 offset + 0,
1673 _depth
1674 )?;
1675 fidl::decode!(
1676 bool,
1677 fidl::encoding::DefaultFuchsiaResourceDialect,
1678 &mut self.enable,
1679 decoder,
1680 offset + 8,
1681 _depth
1682 )?;
1683 Ok(())
1684 }
1685 }
1686}