#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
pub type DevicePath = String;
pub const UNSPECIFIED_METRIC: u32 = 0;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum Error {
Internal = 1,
NotSupported = 2,
InvalidArgs = 3,
BadState = 4,
TimeOut = 5,
NotFound = 6,
AlreadyExists = 7,
Io = 8,
}
impl Error {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Internal),
2 => Some(Self::NotSupported),
3 => Some(Self::InvalidArgs),
4 => Some(Self::BadState),
5 => Some(Self::TimeOut),
6 => Some(Self::NotFound),
7 => Some(Self::AlreadyExists),
8 => Some(Self::Io),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Clone, Debug, PartialEq)]
pub struct ForwardingEntry {
pub subnet: fidl_fuchsia_net::Subnet,
pub device_id: u64,
pub next_hop: Option<Box<fidl_fuchsia_net::IpAddress>>,
pub metric: u32,
}
impl fidl::Persistable for ForwardingEntry {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct LogSetLogPacketsRequest {
pub enabled: bool,
}
impl fidl::Persistable for LogSetLogPacketsRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct StackAddForwardingEntryRequest {
pub entry: ForwardingEntry,
}
impl fidl::Persistable for StackAddForwardingEntryRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StackBridgeInterfacesRequest {
pub interfaces: Vec<u64>,
pub bridge: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for StackBridgeInterfacesRequest
{
}
#[derive(Clone, Debug, PartialEq)]
pub struct StackDelForwardingEntryRequest {
pub entry: ForwardingEntry,
}
impl fidl::Persistable for StackDelForwardingEntryRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct StackSetDhcpClientEnabledRequest {
pub id: u64,
pub enable: bool,
}
impl fidl::Standalone<fidl::encoding::DefaultFuchsiaResourceDialect>
for StackSetDhcpClientEnabledRequest
{
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct LogMarker;
impl fidl::endpoints::ProtocolMarker for LogMarker {
type Proxy = LogProxy;
type RequestStream = LogRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = LogSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.stack.Log";
}
impl fidl::endpoints::DiscoverableProtocolMarker for LogMarker {}
pub trait LogProxyInterface: Send + Sync {
type SetLogPacketsResponseFut: std::future::Future<Output = Result<(), fidl::Error>> + Send;
fn r#set_log_packets(&self, enabled: bool) -> Self::SetLogPacketsResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct LogSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for LogSynchronousProxy {
type Proxy = LogProxy;
type Protocol = LogMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl LogSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <LogMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(&self, deadline: zx::MonotonicInstant) -> Result<LogEvent, fidl::Error> {
LogEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#set_log_packets(
&self,
mut enabled: bool,
___deadline: zx::MonotonicInstant,
) -> Result<(), fidl::Error> {
let _response =
self.client.send_query::<LogSetLogPacketsRequest, fidl::encoding::EmptyPayload>(
(enabled,),
0x2176044cba5f378e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response)
}
}
#[derive(Debug, Clone)]
pub struct LogProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for LogProxy {
type Protocol = LogMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl LogProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <LogMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> LogEventStream {
LogEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#set_log_packets(
&self,
mut enabled: bool,
) -> fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect> {
LogProxyInterface::r#set_log_packets(self, enabled)
}
}
impl LogProxyInterface for LogProxy {
type SetLogPacketsResponseFut =
fidl::client::QueryResponseFut<(), fidl::encoding::DefaultFuchsiaResourceDialect>;
fn r#set_log_packets(&self, mut enabled: bool) -> Self::SetLogPacketsResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2176044cba5f378e,
>(_buf?)?;
Ok(_response)
}
self.client.send_query_and_decode::<LogSetLogPacketsRequest, ()>(
(enabled,),
0x2176044cba5f378e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct LogEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for LogEventStream {}
impl futures::stream::FusedStream for LogEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for LogEventStream {
type Item = Result<LogEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(LogEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum LogEvent {}
impl LogEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<LogEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <LogMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct LogRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for LogRequestStream {}
impl futures::stream::FusedStream for LogRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for LogRequestStream {
type Protocol = LogMarker;
type ControlHandle = LogControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
LogControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for LogRequestStream {
type Item = Result<LogRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled LogRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x2176044cba5f378e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
LogSetLogPacketsRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<LogSetLogPacketsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = LogControlHandle { inner: this.inner.clone() };
Ok(LogRequest::SetLogPackets {
enabled: req.enabled,
responder: LogSetLogPacketsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <LogMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum LogRequest {
SetLogPackets { enabled: bool, responder: LogSetLogPacketsResponder },
}
impl LogRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_set_log_packets(self) -> Option<(bool, LogSetLogPacketsResponder)> {
if let LogRequest::SetLogPackets { enabled, responder } = self {
Some((enabled, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
LogRequest::SetLogPackets { .. } => "set_log_packets",
}
}
}
#[derive(Debug, Clone)]
pub struct LogControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for LogControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl LogControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct LogSetLogPacketsResponder {
control_handle: std::mem::ManuallyDrop<LogControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for LogSetLogPacketsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for LogSetLogPacketsResponder {
type ControlHandle = LogControlHandle;
fn control_handle(&self) -> &LogControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl LogSetLogPacketsResponder {
pub fn send(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self) -> Result<(), fidl::Error> {
let _result = self.send_raw();
self.drop_without_shutdown();
_result
}
fn send_raw(&self) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::EmptyPayload>(
(),
self.tx_id,
0x2176044cba5f378e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct StackMarker;
impl fidl::endpoints::ProtocolMarker for StackMarker {
type Proxy = StackProxy;
type RequestStream = StackRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = StackSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.stack.Stack";
}
impl fidl::endpoints::DiscoverableProtocolMarker for StackMarker {}
pub type StackAddForwardingEntryResult = Result<(), Error>;
pub type StackDelForwardingEntryResult = Result<(), Error>;
pub type StackSetDhcpClientEnabledResult = Result<(), Error>;
pub trait StackProxyInterface: Send + Sync {
type AddForwardingEntryResponseFut: std::future::Future<Output = Result<StackAddForwardingEntryResult, fidl::Error>>
+ Send;
fn r#add_forwarding_entry(
&self,
entry: &ForwardingEntry,
) -> Self::AddForwardingEntryResponseFut;
type DelForwardingEntryResponseFut: std::future::Future<Output = Result<StackDelForwardingEntryResult, fidl::Error>>
+ Send;
fn r#del_forwarding_entry(
&self,
entry: &ForwardingEntry,
) -> Self::DelForwardingEntryResponseFut;
type SetDhcpClientEnabledResponseFut: std::future::Future<Output = Result<StackSetDhcpClientEnabledResult, fidl::Error>>
+ Send;
fn r#set_dhcp_client_enabled(
&self,
id: u64,
enable: bool,
) -> Self::SetDhcpClientEnabledResponseFut;
fn r#bridge_interfaces(
&self,
interfaces: &[u64],
bridge: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct StackSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for StackSynchronousProxy {
type Proxy = StackProxy;
type Protocol = StackMarker;
fn from_channel(inner: fidl::Channel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
fn as_channel(&self) -> &fidl::Channel {
self.client.as_channel()
}
}
#[cfg(target_os = "fuchsia")]
impl StackSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <StackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<StackEvent, fidl::Error> {
StackEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#add_forwarding_entry(
&self,
mut entry: &ForwardingEntry,
___deadline: zx::MonotonicInstant,
) -> Result<StackAddForwardingEntryResult, fidl::Error> {
let _response = self.client.send_query::<
StackAddForwardingEntryRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(entry,),
0x5fe2020877107909,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#del_forwarding_entry(
&self,
mut entry: &ForwardingEntry,
___deadline: zx::MonotonicInstant,
) -> Result<StackDelForwardingEntryResult, fidl::Error> {
let _response = self.client.send_query::<
StackDelForwardingEntryRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(entry,),
0x560f3944c4cb51bd,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#set_dhcp_client_enabled(
&self,
mut id: u64,
mut enable: bool,
___deadline: zx::MonotonicInstant,
) -> Result<StackSetDhcpClientEnabledResult, fidl::Error> {
let _response = self.client.send_query::<
StackSetDhcpClientEnabledRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
>(
(id, enable,),
0x6dead3a6025b0543,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#bridge_interfaces(
&self,
mut interfaces: &[u64],
mut bridge: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StackBridgeInterfacesRequest>(
(interfaces, bridge),
0x60509044a41ac976,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct StackProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for StackProxy {
type Protocol = StackMarker;
fn from_channel(inner: ::fidl::AsyncChannel) -> Self {
Self::new(inner)
}
fn into_channel(self) -> Result<::fidl::AsyncChannel, Self> {
self.client.into_channel().map_err(|client| Self { client })
}
fn as_channel(&self) -> &::fidl::AsyncChannel {
self.client.as_channel()
}
}
impl StackProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <StackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> StackEventStream {
StackEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#add_forwarding_entry(
&self,
mut entry: &ForwardingEntry,
) -> fidl::client::QueryResponseFut<
StackAddForwardingEntryResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
StackProxyInterface::r#add_forwarding_entry(self, entry)
}
pub fn r#del_forwarding_entry(
&self,
mut entry: &ForwardingEntry,
) -> fidl::client::QueryResponseFut<
StackDelForwardingEntryResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
StackProxyInterface::r#del_forwarding_entry(self, entry)
}
pub fn r#set_dhcp_client_enabled(
&self,
mut id: u64,
mut enable: bool,
) -> fidl::client::QueryResponseFut<
StackSetDhcpClientEnabledResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
StackProxyInterface::r#set_dhcp_client_enabled(self, id, enable)
}
pub fn r#bridge_interfaces(
&self,
mut interfaces: &[u64],
mut bridge: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
) -> Result<(), fidl::Error> {
StackProxyInterface::r#bridge_interfaces(self, interfaces, bridge)
}
}
impl StackProxyInterface for StackProxy {
type AddForwardingEntryResponseFut = fidl::client::QueryResponseFut<
StackAddForwardingEntryResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#add_forwarding_entry(
&self,
mut entry: &ForwardingEntry,
) -> Self::AddForwardingEntryResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<StackAddForwardingEntryResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x5fe2020877107909,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<StackAddForwardingEntryRequest, StackAddForwardingEntryResult>(
(entry,),
0x5fe2020877107909,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type DelForwardingEntryResponseFut = fidl::client::QueryResponseFut<
StackDelForwardingEntryResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#del_forwarding_entry(
&self,
mut entry: &ForwardingEntry,
) -> Self::DelForwardingEntryResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<StackDelForwardingEntryResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x560f3944c4cb51bd,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<StackDelForwardingEntryRequest, StackDelForwardingEntryResult>(
(entry,),
0x560f3944c4cb51bd,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type SetDhcpClientEnabledResponseFut = fidl::client::QueryResponseFut<
StackSetDhcpClientEnabledResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#set_dhcp_client_enabled(
&self,
mut id: u64,
mut enable: bool,
) -> Self::SetDhcpClientEnabledResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<StackSetDhcpClientEnabledResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6dead3a6025b0543,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
StackSetDhcpClientEnabledRequest,
StackSetDhcpClientEnabledResult,
>(
(id, enable,),
0x6dead3a6025b0543,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#bridge_interfaces(
&self,
mut interfaces: &[u64],
mut bridge: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
) -> Result<(), fidl::Error> {
self.client.send::<StackBridgeInterfacesRequest>(
(interfaces, bridge),
0x60509044a41ac976,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct StackEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for StackEventStream {}
impl futures::stream::FusedStream for StackEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for StackEventStream {
type Item = Result<StackEvent, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
match futures::ready!(futures::stream::StreamExt::poll_next_unpin(
&mut self.event_receiver,
cx
)?) {
Some(buf) => std::task::Poll::Ready(Some(StackEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum StackEvent {}
impl StackEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<StackEvent, fidl::Error> {
let (bytes, _handles) = buf.split_mut();
let (tx_header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
debug_assert_eq!(tx_header.tx_id, 0);
match tx_header.ordinal {
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <StackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct StackRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for StackRequestStream {}
impl futures::stream::FusedStream for StackRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for StackRequestStream {
type Protocol = StackMarker;
type ControlHandle = StackControlHandle;
fn from_channel(channel: ::fidl::AsyncChannel) -> Self {
Self { inner: std::sync::Arc::new(fidl::ServeInner::new(channel)), is_terminated: false }
}
fn control_handle(&self) -> Self::ControlHandle {
StackControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for StackRequestStream {
type Item = Result<StackRequest, fidl::Error>;
fn poll_next(
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> std::task::Poll<Option<Self::Item>> {
let this = &mut *self;
if this.inner.check_shutdown(cx) {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
if this.is_terminated {
panic!("polled StackRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x5fe2020877107909 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
StackAddForwardingEntryRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackAddForwardingEntryRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = StackControlHandle { inner: this.inner.clone() };
Ok(StackRequest::AddForwardingEntry {
entry: req.entry,
responder: StackAddForwardingEntryResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x560f3944c4cb51bd => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
StackDelForwardingEntryRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackDelForwardingEntryRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = StackControlHandle { inner: this.inner.clone() };
Ok(StackRequest::DelForwardingEntry {
entry: req.entry,
responder: StackDelForwardingEntryResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6dead3a6025b0543 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
StackSetDhcpClientEnabledRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackSetDhcpClientEnabledRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = StackControlHandle { inner: this.inner.clone() };
Ok(StackRequest::SetDhcpClientEnabled {
id: req.id,
enable: req.enable,
responder: StackSetDhcpClientEnabledResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x60509044a41ac976 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(
StackBridgeInterfacesRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<StackBridgeInterfacesRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = StackControlHandle { inner: this.inner.clone() };
Ok(StackRequest::BridgeInterfaces {
interfaces: req.interfaces,
bridge: req.bridge,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <StackMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum StackRequest {
AddForwardingEntry { entry: ForwardingEntry, responder: StackAddForwardingEntryResponder },
DelForwardingEntry { entry: ForwardingEntry, responder: StackDelForwardingEntryResponder },
SetDhcpClientEnabled { id: u64, enable: bool, responder: StackSetDhcpClientEnabledResponder },
BridgeInterfaces {
interfaces: Vec<u64>,
bridge: fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
control_handle: StackControlHandle,
},
}
impl StackRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_add_forwarding_entry(
self,
) -> Option<(ForwardingEntry, StackAddForwardingEntryResponder)> {
if let StackRequest::AddForwardingEntry { entry, responder } = self {
Some((entry, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_del_forwarding_entry(
self,
) -> Option<(ForwardingEntry, StackDelForwardingEntryResponder)> {
if let StackRequest::DelForwardingEntry { entry, responder } = self {
Some((entry, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_set_dhcp_client_enabled(
self,
) -> Option<(u64, bool, StackSetDhcpClientEnabledResponder)> {
if let StackRequest::SetDhcpClientEnabled { id, enable, responder } = self {
Some((id, enable, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_bridge_interfaces(
self,
) -> Option<(
Vec<u64>,
fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
StackControlHandle,
)> {
if let StackRequest::BridgeInterfaces { interfaces, bridge, control_handle } = self {
Some((interfaces, bridge, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
StackRequest::AddForwardingEntry { .. } => "add_forwarding_entry",
StackRequest::DelForwardingEntry { .. } => "del_forwarding_entry",
StackRequest::SetDhcpClientEnabled { .. } => "set_dhcp_client_enabled",
StackRequest::BridgeInterfaces { .. } => "bridge_interfaces",
}
}
}
#[derive(Debug, Clone)]
pub struct StackControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for StackControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl StackControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct StackAddForwardingEntryResponder {
control_handle: std::mem::ManuallyDrop<StackControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for StackAddForwardingEntryResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for StackAddForwardingEntryResponder {
type ControlHandle = StackControlHandle;
fn control_handle(&self) -> &StackControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl StackAddForwardingEntryResponder {
pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x5fe2020877107909,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct StackDelForwardingEntryResponder {
control_handle: std::mem::ManuallyDrop<StackControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for StackDelForwardingEntryResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for StackDelForwardingEntryResponder {
type ControlHandle = StackControlHandle;
fn control_handle(&self) -> &StackControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl StackDelForwardingEntryResponder {
pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x560f3944c4cb51bd,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct StackSetDhcpClientEnabledResponder {
control_handle: std::mem::ManuallyDrop<StackControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for StackSetDhcpClientEnabledResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for StackSetDhcpClientEnabledResponder {
type ControlHandle = StackControlHandle;
fn control_handle(&self) -> &StackControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl StackSetDhcpClientEnabledResponder {
pub fn send(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), Error>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, Error>>(
result,
self.tx_id,
0x6dead3a6025b0543,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for Error {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for Error {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D> for Error {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Error {
#[inline(always)]
fn new_empty() -> Self {
Self::Internal
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ForwardingEntry {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ForwardingEntry {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<ForwardingEntry, D>
for &ForwardingEntry
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ForwardingEntry>(offset);
fidl::encoding::Encode::<ForwardingEntry, D>::encode(
(
<fidl_fuchsia_net::Subnet as fidl::encoding::ValueTypeMarker>::borrow(&self.subnet),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.device_id),
<fidl::encoding::OptionalUnion<fidl_fuchsia_net::IpAddress> as fidl::encoding::ValueTypeMarker>::borrow(&self.next_hop),
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.metric),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_net::Subnet, D>,
T1: fidl::encoding::Encode<u64, D>,
T2: fidl::encoding::Encode<fidl::encoding::OptionalUnion<fidl_fuchsia_net::IpAddress>, D>,
T3: fidl::encoding::Encode<u32, D>,
> fidl::encoding::Encode<ForwardingEntry, D> for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ForwardingEntry>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(48);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 24, depth)?;
self.2.encode(encoder, offset + 32, depth)?;
self.3.encode(encoder, offset + 48, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for ForwardingEntry {
#[inline(always)]
fn new_empty() -> Self {
Self {
subnet: fidl::new_empty!(fidl_fuchsia_net::Subnet, D),
device_id: fidl::new_empty!(u64, D),
next_hop: fidl::new_empty!(
fidl::encoding::OptionalUnion<fidl_fuchsia_net::IpAddress>,
D
),
metric: fidl::new_empty!(u32, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(48) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 48 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl_fuchsia_net::Subnet,
D,
&mut self.subnet,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(u64, D, &mut self.device_id, decoder, offset + 24, _depth)?;
fidl::decode!(
fidl::encoding::OptionalUnion<fidl_fuchsia_net::IpAddress>,
D,
&mut self.next_hop,
decoder,
offset + 32,
_depth
)?;
fidl::decode!(u32, D, &mut self.metric, decoder, offset + 48, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for LogSetLogPacketsRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for LogSetLogPacketsRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<LogSetLogPacketsRequest, D> for &LogSetLogPacketsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LogSetLogPacketsRequest>(offset);
fidl::encoding::Encode::<LogSetLogPacketsRequest, D>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enabled),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<bool, D>>
fidl::encoding::Encode<LogSetLogPacketsRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<LogSetLogPacketsRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for LogSetLogPacketsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { enabled: fidl::new_empty!(bool, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, D, &mut self.enabled, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StackAddForwardingEntryRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StackAddForwardingEntryRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<StackAddForwardingEntryRequest, D>
for &StackAddForwardingEntryRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StackAddForwardingEntryRequest>(offset);
fidl::encoding::Encode::<StackAddForwardingEntryRequest, D>::encode(
(<ForwardingEntry as fidl::encoding::ValueTypeMarker>::borrow(&self.entry),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ForwardingEntry, D>>
fidl::encoding::Encode<StackAddForwardingEntryRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StackAddForwardingEntryRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StackAddForwardingEntryRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { entry: fidl::new_empty!(ForwardingEntry, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(ForwardingEntry, D, &mut self.entry, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for StackBridgeInterfacesRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StackBridgeInterfacesRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl
fidl::encoding::Encode<
StackBridgeInterfacesRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut StackBridgeInterfacesRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StackBridgeInterfacesRequest>(offset);
fidl::encoding::Encode::<StackBridgeInterfacesRequest, fidl::encoding::DefaultFuchsiaResourceDialect>::encode(
(
<fidl::encoding::UnboundedVector<u64> as fidl::encoding::ValueTypeMarker>::borrow(&self.interfaces),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.bridge),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::UnboundedVector<u64>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
>
fidl::encoding::Encode<
StackBridgeInterfacesRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StackBridgeInterfacesRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(16);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for StackBridgeInterfacesRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
interfaces: fidl::new_empty!(
fidl::encoding::UnboundedVector<u64>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
bridge: fidl::new_empty!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<
fidl_fuchsia_net_interfaces_admin::ControlMarker,
>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(16) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffff00000000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 16 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
fidl::encoding::UnboundedVector<u64>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.interfaces,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl::encoding::Endpoint<
fidl::endpoints::ServerEnd<fidl_fuchsia_net_interfaces_admin::ControlMarker>,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.bridge,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for StackDelForwardingEntryRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StackDelForwardingEntryRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
56
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<StackDelForwardingEntryRequest, D>
for &StackDelForwardingEntryRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StackDelForwardingEntryRequest>(offset);
fidl::encoding::Encode::<StackDelForwardingEntryRequest, D>::encode(
(<ForwardingEntry as fidl::encoding::ValueTypeMarker>::borrow(&self.entry),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<ForwardingEntry, D>>
fidl::encoding::Encode<StackDelForwardingEntryRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StackDelForwardingEntryRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for StackDelForwardingEntryRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { entry: fidl::new_empty!(ForwardingEntry, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(ForwardingEntry, D, &mut self.entry, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ResourceTypeMarker for StackSetDhcpClientEnabledRequest {
type Borrowed<'a> = &'a mut Self;
fn take_or_borrow<'a>(
value: &'a mut <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for StackSetDhcpClientEnabledRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl
fidl::encoding::Encode<
StackSetDhcpClientEnabledRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for &mut StackSetDhcpClientEnabledRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StackSetDhcpClientEnabledRequest>(offset);
fidl::encoding::Encode::<
StackSetDhcpClientEnabledRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.id),
<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.enable),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u64, fidl::encoding::DefaultFuchsiaResourceDialect>,
T1: fidl::encoding::Encode<bool, fidl::encoding::DefaultFuchsiaResourceDialect>,
>
fidl::encoding::Encode<
StackSetDhcpClientEnabledRequest,
fidl::encoding::DefaultFuchsiaResourceDialect,
> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<StackSetDhcpClientEnabledRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self, fidl::encoding::DefaultFuchsiaResourceDialect>
for StackSetDhcpClientEnabledRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
id: fidl::new_empty!(u64, fidl::encoding::DefaultFuchsiaResourceDialect),
enable: fidl::new_empty!(bool, fidl::encoding::DefaultFuchsiaResourceDialect),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<
'_,
fidl::encoding::DefaultFuchsiaResourceDialect,
>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let ptr = unsafe { decoder.buf.as_ptr().add(offset).offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(
u64,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.id,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
bool,
fidl::encoding::DefaultFuchsiaResourceDialect,
&mut self.enable,
decoder,
offset + 8,
_depth
)?;
Ok(())
}
}
}