#![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 TpmRc = u16;
pub const MAX_COMMAND_LEN: u32 = 65535;
pub const MAX_TPM_COMMAND_LEN: u32 = 20000;
pub const MAX_VENDOR_COMMAND_LEN: u32 = 65535;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum OwnershipStatus {
Unowned,
Owned,
PreOwned,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u8 },
}
#[macro_export]
macro_rules! OwnershipStatusUnknown {
() => {
_
};
}
impl OwnershipStatus {
#[inline]
pub fn from_primitive(prim: u8) -> Option<Self> {
match prim {
1 => Some(Self::Unowned),
2 => Some(Self::Owned),
3 => Some(Self::PreOwned),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u8) -> Self {
match prim {
1 => Self::Unowned,
2 => Self::Owned,
3 => Self::PreOwned,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xff }
}
#[inline]
pub const fn into_primitive(self) -> u8 {
match self {
Self::Unowned => 1,
Self::Owned => 2,
Self::PreOwned => 3,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct CommandTransmitRequest {
pub data: Vec<u8>,
}
impl fidl::Persistable for CommandTransmitRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct CommandTransmitResponse {
pub data: Vec<u8>,
}
impl fidl::Persistable for CommandTransmitResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ProvisionIsOwnedResponse {
pub ownership: OwnershipStatus,
}
impl fidl::Persistable for ProvisionIsOwnedResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TpmDeviceExecuteCommandRequest {
pub data: Vec<u8>,
}
impl fidl::Persistable for TpmDeviceExecuteCommandRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TpmDeviceExecuteVendorCommandRequest {
pub command_code: u16,
pub data: Vec<u8>,
}
impl fidl::Persistable for TpmDeviceExecuteVendorCommandRequest {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TpmDeviceExecuteCommandResponse {
pub data: Vec<u8>,
}
impl fidl::Persistable for TpmDeviceExecuteCommandResponse {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct TpmDeviceExecuteVendorCommandResponse {
pub result: u16,
pub data: Vec<u8>,
}
impl fidl::Persistable for TpmDeviceExecuteVendorCommandResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct TpmDeviceGetDeviceIdResponse {
pub vendor_id: u16,
pub device_id: u16,
pub revision_id: u8,
}
impl fidl::Persistable for TpmDeviceGetDeviceIdResponse {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct DeprovisionRemoveOwnershipRequest {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for DeprovisionRemoveOwnershipRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct ProvisionTakeOwnershipRequest {
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for ProvisionTakeOwnershipRequest {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct CommandMarker;
impl fidl::endpoints::ProtocolMarker for CommandMarker {
type Proxy = CommandProxy;
type RequestStream = CommandRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = CommandSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.tpm.Command";
}
impl fidl::endpoints::DiscoverableProtocolMarker for CommandMarker {}
pub type CommandTransmitResult = Result<Vec<u8>, i32>;
pub trait CommandProxyInterface: Send + Sync {
type TransmitResponseFut: std::future::Future<Output = Result<CommandTransmitResult, fidl::Error>>
+ Send;
fn r#transmit(&self, data: &[u8]) -> Self::TransmitResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct CommandSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for CommandSynchronousProxy {
type Proxy = CommandProxy;
type Protocol = CommandMarker;
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 CommandSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <CommandMarker 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<CommandEvent, fidl::Error> {
CommandEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#transmit(
&self,
mut data: &[u8],
___deadline: zx::MonotonicInstant,
) -> Result<CommandTransmitResult, fidl::Error> {
let _response = self.client.send_query::<
CommandTransmitRequest,
fidl::encoding::ResultType<CommandTransmitResponse, i32>,
>(
(data,),
0x41b9838a593e6def,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.data))
}
}
#[derive(Debug, Clone)]
pub struct CommandProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for CommandProxy {
type Protocol = CommandMarker;
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 CommandProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <CommandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> CommandEventStream {
CommandEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#transmit(
&self,
mut data: &[u8],
) -> fidl::client::QueryResponseFut<
CommandTransmitResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
CommandProxyInterface::r#transmit(self, data)
}
}
impl CommandProxyInterface for CommandProxy {
type TransmitResponseFut = fidl::client::QueryResponseFut<
CommandTransmitResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#transmit(&self, mut data: &[u8]) -> Self::TransmitResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<CommandTransmitResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<CommandTransmitResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x41b9838a593e6def,
>(_buf?)?;
Ok(_response.map(|x| x.data))
}
self.client.send_query_and_decode::<CommandTransmitRequest, CommandTransmitResult>(
(data,),
0x41b9838a593e6def,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct CommandEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for CommandEventStream {}
impl futures::stream::FusedStream for CommandEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for CommandEventStream {
type Item = Result<CommandEvent, 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(CommandEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum CommandEvent {}
impl CommandEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<CommandEvent, 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: <CommandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct CommandRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for CommandRequestStream {}
impl futures::stream::FusedStream for CommandRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for CommandRequestStream {
type Protocol = CommandMarker;
type ControlHandle = CommandControlHandle;
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 {
CommandControlHandle { 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 CommandRequestStream {
type Item = Result<CommandRequest, 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 CommandRequestStream 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 {
0x41b9838a593e6def => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
CommandTransmitRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<CommandTransmitRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = CommandControlHandle { inner: this.inner.clone() };
Ok(CommandRequest::Transmit {
data: req.data,
responder: CommandTransmitResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<CommandMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum CommandRequest {
Transmit { data: Vec<u8>, responder: CommandTransmitResponder },
}
impl CommandRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_transmit(self) -> Option<(Vec<u8>, CommandTransmitResponder)> {
if let CommandRequest::Transmit { data, responder } = self {
Some((data, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
CommandRequest::Transmit { .. } => "transmit",
}
}
}
#[derive(Debug, Clone)]
pub struct CommandControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for CommandControlHandle {
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 CommandControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct CommandTransmitResponder {
control_handle: std::mem::ManuallyDrop<CommandControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for CommandTransmitResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for CommandTransmitResponder {
type ControlHandle = CommandControlHandle;
fn control_handle(&self) -> &CommandControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl CommandTransmitResponder {
pub fn send(self, mut result: Result<&[u8], i32>) -> 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<&[u8], i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<CommandTransmitResponse, i32>>(
result.map(|data| (data,)),
self.tx_id,
0x41b9838a593e6def,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct DeprovisionMarker;
impl fidl::endpoints::ProtocolMarker for DeprovisionMarker {
type Proxy = DeprovisionProxy;
type RequestStream = DeprovisionRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = DeprovisionSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.tpm.Deprovision";
}
impl fidl::endpoints::DiscoverableProtocolMarker for DeprovisionMarker {}
pub type DeprovisionRemoveOwnershipResult = Result<(), i32>;
pub trait DeprovisionProxyInterface: Send + Sync {
type RemoveOwnershipResponseFut: std::future::Future<Output = Result<DeprovisionRemoveOwnershipResult, fidl::Error>>
+ Send;
fn r#remove_ownership(
&self,
payload: &DeprovisionRemoveOwnershipRequest,
) -> Self::RemoveOwnershipResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct DeprovisionSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for DeprovisionSynchronousProxy {
type Proxy = DeprovisionProxy;
type Protocol = DeprovisionMarker;
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 DeprovisionSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <DeprovisionMarker 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<DeprovisionEvent, fidl::Error> {
DeprovisionEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#remove_ownership(
&self,
mut payload: &DeprovisionRemoveOwnershipRequest,
___deadline: zx::MonotonicInstant,
) -> Result<DeprovisionRemoveOwnershipResult, fidl::Error> {
let _response = self.client.send_query::<
DeprovisionRemoveOwnershipRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
payload,
0x3e438294248f0c15,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct DeprovisionProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for DeprovisionProxy {
type Protocol = DeprovisionMarker;
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 DeprovisionProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <DeprovisionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> DeprovisionEventStream {
DeprovisionEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#remove_ownership(
&self,
mut payload: &DeprovisionRemoveOwnershipRequest,
) -> fidl::client::QueryResponseFut<
DeprovisionRemoveOwnershipResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
DeprovisionProxyInterface::r#remove_ownership(self, payload)
}
}
impl DeprovisionProxyInterface for DeprovisionProxy {
type RemoveOwnershipResponseFut = fidl::client::QueryResponseFut<
DeprovisionRemoveOwnershipResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#remove_ownership(
&self,
mut payload: &DeprovisionRemoveOwnershipRequest,
) -> Self::RemoveOwnershipResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<DeprovisionRemoveOwnershipResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3e438294248f0c15,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
DeprovisionRemoveOwnershipRequest,
DeprovisionRemoveOwnershipResult,
>(
payload,
0x3e438294248f0c15,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct DeprovisionEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for DeprovisionEventStream {}
impl futures::stream::FusedStream for DeprovisionEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for DeprovisionEventStream {
type Item = Result<DeprovisionEvent, 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(DeprovisionEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum DeprovisionEvent {}
impl DeprovisionEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<DeprovisionEvent, 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: <DeprovisionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct DeprovisionRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for DeprovisionRequestStream {}
impl futures::stream::FusedStream for DeprovisionRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for DeprovisionRequestStream {
type Protocol = DeprovisionMarker;
type ControlHandle = DeprovisionControlHandle;
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 {
DeprovisionControlHandle { 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 DeprovisionRequestStream {
type Item = Result<DeprovisionRequest, 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 DeprovisionRequestStream 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 {
0x3e438294248f0c15 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
DeprovisionRemoveOwnershipRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<DeprovisionRemoveOwnershipRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = DeprovisionControlHandle { inner: this.inner.clone() };
Ok(DeprovisionRequest::RemoveOwnership {
payload: req,
responder: DeprovisionRemoveOwnershipResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<DeprovisionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum DeprovisionRequest {
RemoveOwnership {
payload: DeprovisionRemoveOwnershipRequest,
responder: DeprovisionRemoveOwnershipResponder,
},
}
impl DeprovisionRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_remove_ownership(
self,
) -> Option<(DeprovisionRemoveOwnershipRequest, DeprovisionRemoveOwnershipResponder)> {
if let DeprovisionRequest::RemoveOwnership { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
DeprovisionRequest::RemoveOwnership { .. } => "remove_ownership",
}
}
}
#[derive(Debug, Clone)]
pub struct DeprovisionControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for DeprovisionControlHandle {
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 DeprovisionControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct DeprovisionRemoveOwnershipResponder {
control_handle: std::mem::ManuallyDrop<DeprovisionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for DeprovisionRemoveOwnershipResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for DeprovisionRemoveOwnershipResponder {
type ControlHandle = DeprovisionControlHandle;
fn control_handle(&self) -> &DeprovisionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl DeprovisionRemoveOwnershipResponder {
pub fn send(self, mut result: Result<(), i32>) -> 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<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x3e438294248f0c15,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct ProvisionMarker;
impl fidl::endpoints::ProtocolMarker for ProvisionMarker {
type Proxy = ProvisionProxy;
type RequestStream = ProvisionRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = ProvisionSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.tpm.Provision";
}
impl fidl::endpoints::DiscoverableProtocolMarker for ProvisionMarker {}
pub type ProvisionIsOwnedResult = Result<OwnershipStatus, i32>;
pub type ProvisionTakeOwnershipResult = Result<(), i32>;
pub trait ProvisionProxyInterface: Send + Sync {
type IsOwnedResponseFut: std::future::Future<Output = Result<ProvisionIsOwnedResult, fidl::Error>>
+ Send;
fn r#is_owned(&self) -> Self::IsOwnedResponseFut;
type TakeOwnershipResponseFut: std::future::Future<Output = Result<ProvisionTakeOwnershipResult, fidl::Error>>
+ Send;
fn r#take_ownership(
&self,
payload: &ProvisionTakeOwnershipRequest,
) -> Self::TakeOwnershipResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct ProvisionSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for ProvisionSynchronousProxy {
type Proxy = ProvisionProxy;
type Protocol = ProvisionMarker;
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 ProvisionSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <ProvisionMarker 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<ProvisionEvent, fidl::Error> {
ProvisionEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#is_owned(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<ProvisionIsOwnedResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<ProvisionIsOwnedResponse, i32>,
>(
(),
0x13981a8d4c9ee253,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.ownership))
}
pub fn r#take_ownership(
&self,
mut payload: &ProvisionTakeOwnershipRequest,
___deadline: zx::MonotonicInstant,
) -> Result<ProvisionTakeOwnershipResult, fidl::Error> {
let _response = self.client.send_query::<
ProvisionTakeOwnershipRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
>(
payload,
0x59063e992fa676a6,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct ProvisionProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for ProvisionProxy {
type Protocol = ProvisionMarker;
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 ProvisionProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <ProvisionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> ProvisionEventStream {
ProvisionEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#is_owned(
&self,
) -> fidl::client::QueryResponseFut<
ProvisionIsOwnedResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ProvisionProxyInterface::r#is_owned(self)
}
pub fn r#take_ownership(
&self,
mut payload: &ProvisionTakeOwnershipRequest,
) -> fidl::client::QueryResponseFut<
ProvisionTakeOwnershipResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
ProvisionProxyInterface::r#take_ownership(self, payload)
}
}
impl ProvisionProxyInterface for ProvisionProxy {
type IsOwnedResponseFut = fidl::client::QueryResponseFut<
ProvisionIsOwnedResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#is_owned(&self) -> Self::IsOwnedResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ProvisionIsOwnedResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<ProvisionIsOwnedResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x13981a8d4c9ee253,
>(_buf?)?;
Ok(_response.map(|x| x.ownership))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, ProvisionIsOwnedResult>(
(),
0x13981a8d4c9ee253,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type TakeOwnershipResponseFut = fidl::client::QueryResponseFut<
ProvisionTakeOwnershipResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#take_ownership(
&self,
mut payload: &ProvisionTakeOwnershipRequest,
) -> Self::TakeOwnershipResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<ProvisionTakeOwnershipResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x59063e992fa676a6,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<ProvisionTakeOwnershipRequest, ProvisionTakeOwnershipResult>(
payload,
0x59063e992fa676a6,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct ProvisionEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for ProvisionEventStream {}
impl futures::stream::FusedStream for ProvisionEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for ProvisionEventStream {
type Item = Result<ProvisionEvent, 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(ProvisionEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum ProvisionEvent {}
impl ProvisionEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<ProvisionEvent, 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: <ProvisionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct ProvisionRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for ProvisionRequestStream {}
impl futures::stream::FusedStream for ProvisionRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for ProvisionRequestStream {
type Protocol = ProvisionMarker;
type ControlHandle = ProvisionControlHandle;
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 {
ProvisionControlHandle { 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 ProvisionRequestStream {
type Item = Result<ProvisionRequest, 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 ProvisionRequestStream 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 {
0x13981a8d4c9ee253 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ProvisionControlHandle { inner: this.inner.clone() };
Ok(ProvisionRequest::IsOwned {
responder: ProvisionIsOwnedResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x59063e992fa676a6 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
ProvisionTakeOwnershipRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<ProvisionTakeOwnershipRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = ProvisionControlHandle { inner: this.inner.clone() };
Ok(ProvisionRequest::TakeOwnership {
payload: req,
responder: ProvisionTakeOwnershipResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<ProvisionMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum ProvisionRequest {
IsOwned { responder: ProvisionIsOwnedResponder },
TakeOwnership {
payload: ProvisionTakeOwnershipRequest,
responder: ProvisionTakeOwnershipResponder,
},
}
impl ProvisionRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_is_owned(self) -> Option<(ProvisionIsOwnedResponder)> {
if let ProvisionRequest::IsOwned { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_take_ownership(
self,
) -> Option<(ProvisionTakeOwnershipRequest, ProvisionTakeOwnershipResponder)> {
if let ProvisionRequest::TakeOwnership { payload, responder } = self {
Some((payload, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
ProvisionRequest::IsOwned { .. } => "is_owned",
ProvisionRequest::TakeOwnership { .. } => "take_ownership",
}
}
}
#[derive(Debug, Clone)]
pub struct ProvisionControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for ProvisionControlHandle {
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 ProvisionControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProvisionIsOwnedResponder {
control_handle: std::mem::ManuallyDrop<ProvisionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProvisionIsOwnedResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProvisionIsOwnedResponder {
type ControlHandle = ProvisionControlHandle;
fn control_handle(&self) -> &ProvisionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProvisionIsOwnedResponder {
pub fn send(self, mut result: Result<OwnershipStatus, i32>) -> 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<OwnershipStatus, i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<OwnershipStatus, i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<ProvisionIsOwnedResponse, i32>>(
result.map(|ownership| (ownership,)),
self.tx_id,
0x13981a8d4c9ee253,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct ProvisionTakeOwnershipResponder {
control_handle: std::mem::ManuallyDrop<ProvisionControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for ProvisionTakeOwnershipResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for ProvisionTakeOwnershipResponder {
type ControlHandle = ProvisionControlHandle;
fn control_handle(&self) -> &ProvisionControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl ProvisionTakeOwnershipResponder {
pub fn send(self, mut result: Result<(), i32>) -> 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<(), i32>) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<fidl::encoding::EmptyStruct, i32>>(
result,
self.tx_id,
0x59063e992fa676a6,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct TpmDeviceMarker;
impl fidl::endpoints::ProtocolMarker for TpmDeviceMarker {
type Proxy = TpmDeviceProxy;
type RequestStream = TpmDeviceRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = TpmDeviceSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) TpmDevice";
}
pub type TpmDeviceGetDeviceIdResult = Result<(u16, u16, u8), i32>;
pub type TpmDeviceExecuteVendorCommandResult = Result<(u16, Vec<u8>), i32>;
pub type TpmDeviceExecuteCommandResult = Result<Vec<u8>, i32>;
pub trait TpmDeviceProxyInterface: Send + Sync {
type GetDeviceIdResponseFut: std::future::Future<Output = Result<TpmDeviceGetDeviceIdResult, fidl::Error>>
+ Send;
fn r#get_device_id(&self) -> Self::GetDeviceIdResponseFut;
type ExecuteVendorCommandResponseFut: std::future::Future<Output = Result<TpmDeviceExecuteVendorCommandResult, fidl::Error>>
+ Send;
fn r#execute_vendor_command(
&self,
command_code: u16,
data: &[u8],
) -> Self::ExecuteVendorCommandResponseFut;
type ExecuteCommandResponseFut: std::future::Future<Output = Result<TpmDeviceExecuteCommandResult, fidl::Error>>
+ Send;
fn r#execute_command(&self, data: &[u8]) -> Self::ExecuteCommandResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct TpmDeviceSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for TpmDeviceSynchronousProxy {
type Proxy = TpmDeviceProxy;
type Protocol = TpmDeviceMarker;
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 TpmDeviceSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <TpmDeviceMarker 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<TpmDeviceEvent, fidl::Error> {
TpmDeviceEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_device_id(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<TpmDeviceGetDeviceIdResult, fidl::Error> {
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
fidl::encoding::ResultType<TpmDeviceGetDeviceIdResponse, i32>,
>(
(),
0x4ec80a133cf8a1e1,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| (x.vendor_id, x.device_id, x.revision_id)))
}
pub fn r#execute_vendor_command(
&self,
mut command_code: u16,
mut data: &[u8],
___deadline: zx::MonotonicInstant,
) -> Result<TpmDeviceExecuteVendorCommandResult, fidl::Error> {
let _response = self.client.send_query::<
TpmDeviceExecuteVendorCommandRequest,
fidl::encoding::ResultType<TpmDeviceExecuteVendorCommandResponse, i32>,
>(
(command_code, data,),
0x2b3f741032c2447d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| (x.result, x.data)))
}
pub fn r#execute_command(
&self,
mut data: &[u8],
___deadline: zx::MonotonicInstant,
) -> Result<TpmDeviceExecuteCommandResult, fidl::Error> {
let _response = self.client.send_query::<
TpmDeviceExecuteCommandRequest,
fidl::encoding::ResultType<TpmDeviceExecuteCommandResponse, i32>,
>(
(data,),
0x357a156a2b955660,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.data))
}
}
#[derive(Debug, Clone)]
pub struct TpmDeviceProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for TpmDeviceProxy {
type Protocol = TpmDeviceMarker;
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 TpmDeviceProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name = <TpmDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> TpmDeviceEventStream {
TpmDeviceEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_device_id(
&self,
) -> fidl::client::QueryResponseFut<
TpmDeviceGetDeviceIdResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
TpmDeviceProxyInterface::r#get_device_id(self)
}
pub fn r#execute_vendor_command(
&self,
mut command_code: u16,
mut data: &[u8],
) -> fidl::client::QueryResponseFut<
TpmDeviceExecuteVendorCommandResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
TpmDeviceProxyInterface::r#execute_vendor_command(self, command_code, data)
}
pub fn r#execute_command(
&self,
mut data: &[u8],
) -> fidl::client::QueryResponseFut<
TpmDeviceExecuteCommandResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
TpmDeviceProxyInterface::r#execute_command(self, data)
}
}
impl TpmDeviceProxyInterface for TpmDeviceProxy {
type GetDeviceIdResponseFut = fidl::client::QueryResponseFut<
TpmDeviceGetDeviceIdResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_device_id(&self) -> Self::GetDeviceIdResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<TpmDeviceGetDeviceIdResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<TpmDeviceGetDeviceIdResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x4ec80a133cf8a1e1,
>(_buf?)?;
Ok(_response.map(|x| (x.vendor_id, x.device_id, x.revision_id)))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, TpmDeviceGetDeviceIdResult>(
(),
0x4ec80a133cf8a1e1,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ExecuteVendorCommandResponseFut = fidl::client::QueryResponseFut<
TpmDeviceExecuteVendorCommandResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#execute_vendor_command(
&self,
mut command_code: u16,
mut data: &[u8],
) -> Self::ExecuteVendorCommandResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<TpmDeviceExecuteVendorCommandResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<TpmDeviceExecuteVendorCommandResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x2b3f741032c2447d,
>(_buf?)?;
Ok(_response.map(|x| (x.result, x.data)))
}
self.client.send_query_and_decode::<
TpmDeviceExecuteVendorCommandRequest,
TpmDeviceExecuteVendorCommandResult,
>(
(command_code, data,),
0x2b3f741032c2447d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type ExecuteCommandResponseFut = fidl::client::QueryResponseFut<
TpmDeviceExecuteCommandResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#execute_command(&self, mut data: &[u8]) -> Self::ExecuteCommandResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<TpmDeviceExecuteCommandResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<TpmDeviceExecuteCommandResponse, i32>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x357a156a2b955660,
>(_buf?)?;
Ok(_response.map(|x| x.data))
}
self.client
.send_query_and_decode::<TpmDeviceExecuteCommandRequest, TpmDeviceExecuteCommandResult>(
(data,),
0x357a156a2b955660,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct TpmDeviceEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for TpmDeviceEventStream {}
impl futures::stream::FusedStream for TpmDeviceEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for TpmDeviceEventStream {
type Item = Result<TpmDeviceEvent, 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(TpmDeviceEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum TpmDeviceEvent {}
impl TpmDeviceEvent {
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<TpmDeviceEvent, 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: <TpmDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct TpmDeviceRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for TpmDeviceRequestStream {}
impl futures::stream::FusedStream for TpmDeviceRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for TpmDeviceRequestStream {
type Protocol = TpmDeviceMarker;
type ControlHandle = TpmDeviceControlHandle;
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 {
TpmDeviceControlHandle { 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 TpmDeviceRequestStream {
type Item = Result<TpmDeviceRequest, 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 TpmDeviceRequestStream 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 {
0x4ec80a133cf8a1e1 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
fidl::encoding::EmptyPayload,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = TpmDeviceControlHandle { inner: this.inner.clone() };
Ok(TpmDeviceRequest::GetDeviceId {
responder: TpmDeviceGetDeviceIdResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2b3f741032c2447d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
TpmDeviceExecuteVendorCommandRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TpmDeviceExecuteVendorCommandRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = TpmDeviceControlHandle { inner: this.inner.clone() };
Ok(TpmDeviceRequest::ExecuteVendorCommand {
command_code: req.command_code,
data: req.data,
responder: TpmDeviceExecuteVendorCommandResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x357a156a2b955660 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(
TpmDeviceExecuteCommandRequest,
fidl::encoding::DefaultFuchsiaResourceDialect
);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<TpmDeviceExecuteCommandRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = TpmDeviceControlHandle { inner: this.inner.clone() };
Ok(TpmDeviceRequest::ExecuteCommand {
data: req.data,
responder: TpmDeviceExecuteCommandResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<TpmDeviceMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum TpmDeviceRequest {
GetDeviceId { responder: TpmDeviceGetDeviceIdResponder },
ExecuteVendorCommand {
command_code: u16,
data: Vec<u8>,
responder: TpmDeviceExecuteVendorCommandResponder,
},
ExecuteCommand { data: Vec<u8>, responder: TpmDeviceExecuteCommandResponder },
}
impl TpmDeviceRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_device_id(self) -> Option<(TpmDeviceGetDeviceIdResponder)> {
if let TpmDeviceRequest::GetDeviceId { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_execute_vendor_command(
self,
) -> Option<(u16, Vec<u8>, TpmDeviceExecuteVendorCommandResponder)> {
if let TpmDeviceRequest::ExecuteVendorCommand { command_code, data, responder } = self {
Some((command_code, data, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_execute_command(self) -> Option<(Vec<u8>, TpmDeviceExecuteCommandResponder)> {
if let TpmDeviceRequest::ExecuteCommand { data, responder } = self {
Some((data, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
TpmDeviceRequest::GetDeviceId { .. } => "get_device_id",
TpmDeviceRequest::ExecuteVendorCommand { .. } => "execute_vendor_command",
TpmDeviceRequest::ExecuteCommand { .. } => "execute_command",
}
}
}
#[derive(Debug, Clone)]
pub struct TpmDeviceControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for TpmDeviceControlHandle {
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 TpmDeviceControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct TpmDeviceGetDeviceIdResponder {
control_handle: std::mem::ManuallyDrop<TpmDeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for TpmDeviceGetDeviceIdResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for TpmDeviceGetDeviceIdResponder {
type ControlHandle = TpmDeviceControlHandle;
fn control_handle(&self) -> &TpmDeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl TpmDeviceGetDeviceIdResponder {
pub fn send(self, mut result: Result<(u16, u16, u8), i32>) -> 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<(u16, u16, u8), i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(u16, u16, u8), i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<TpmDeviceGetDeviceIdResponse, i32>>(
result,
self.tx_id,
0x4ec80a133cf8a1e1,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct TpmDeviceExecuteVendorCommandResponder {
control_handle: std::mem::ManuallyDrop<TpmDeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for TpmDeviceExecuteVendorCommandResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for TpmDeviceExecuteVendorCommandResponder {
type ControlHandle = TpmDeviceControlHandle;
fn control_handle(&self) -> &TpmDeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl TpmDeviceExecuteVendorCommandResponder {
pub fn send(self, mut result: Result<(u16, &[u8]), i32>) -> 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<(u16, &[u8]), i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(u16, &[u8]), i32>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
TpmDeviceExecuteVendorCommandResponse,
i32,
>>(
result,
self.tx_id,
0x2b3f741032c2447d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct TpmDeviceExecuteCommandResponder {
control_handle: std::mem::ManuallyDrop<TpmDeviceControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for TpmDeviceExecuteCommandResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for TpmDeviceExecuteCommandResponder {
type ControlHandle = TpmDeviceControlHandle;
fn control_handle(&self) -> &TpmDeviceControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl TpmDeviceExecuteCommandResponder {
pub fn send(self, mut result: Result<&[u8], i32>) -> 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<&[u8], i32>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<&[u8], i32>) -> Result<(), fidl::Error> {
self.control_handle
.inner
.send::<fidl::encoding::ResultType<TpmDeviceExecuteCommandResponse, i32>>(
result.map(|data| (data,)),
self.tx_id,
0x357a156a2b955660,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for OwnershipStatus {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u8>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u8>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for OwnershipStatus {
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 OwnershipStatus
{
#[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 OwnershipStatus {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[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::<u8>(offset);
*self = Self::from_primitive_allow_unknown(prim);
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for CommandTransmitRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CommandTransmitRequest {
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<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<CommandTransmitRequest, D> for &CommandTransmitRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CommandTransmitRequest>(offset);
fidl::encoding::Encode::<CommandTransmitRequest, D>::encode(
(<fidl::encoding::Vector<u8, 20000> as fidl::encoding::ValueTypeMarker>::borrow(
&self.data,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 20000>, D>,
> fidl::encoding::Encode<CommandTransmitRequest, 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::<CommandTransmitRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for CommandTransmitRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { data: fidl::new_empty!(fidl::encoding::Vector<u8, 20000>, 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!(fidl::encoding::Vector<u8, 20000>, D, &mut self.data, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for CommandTransmitResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for CommandTransmitResponse {
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<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<CommandTransmitResponse, D> for &CommandTransmitResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<CommandTransmitResponse>(offset);
fidl::encoding::Encode::<CommandTransmitResponse, D>::encode(
(<fidl::encoding::Vector<u8, 20000> as fidl::encoding::ValueTypeMarker>::borrow(
&self.data,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 20000>, D>,
> fidl::encoding::Encode<CommandTransmitResponse, 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::<CommandTransmitResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for CommandTransmitResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { data: fidl::new_empty!(fidl::encoding::Vector<u8, 20000>, 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!(fidl::encoding::Vector<u8, 20000>, D, &mut self.data, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for ProvisionIsOwnedResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProvisionIsOwnedResponse {
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<ProvisionIsOwnedResponse, D> for &ProvisionIsOwnedResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProvisionIsOwnedResponse>(offset);
fidl::encoding::Encode::<ProvisionIsOwnedResponse, D>::encode(
(<OwnershipStatus as fidl::encoding::ValueTypeMarker>::borrow(&self.ownership),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<OwnershipStatus, D>>
fidl::encoding::Encode<ProvisionIsOwnedResponse, 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::<ProvisionIsOwnedResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ProvisionIsOwnedResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { ownership: fidl::new_empty!(OwnershipStatus, 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!(OwnershipStatus, D, &mut self.ownership, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for TpmDeviceExecuteCommandRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for TpmDeviceExecuteCommandRequest {
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<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<TpmDeviceExecuteCommandRequest, D>
for &TpmDeviceExecuteCommandRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TpmDeviceExecuteCommandRequest>(offset);
fidl::encoding::Encode::<TpmDeviceExecuteCommandRequest, D>::encode(
(<fidl::encoding::Vector<u8, 65535> as fidl::encoding::ValueTypeMarker>::borrow(
&self.data,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 65535>, D>,
> fidl::encoding::Encode<TpmDeviceExecuteCommandRequest, 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::<TpmDeviceExecuteCommandRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for TpmDeviceExecuteCommandRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { data: fidl::new_empty!(fidl::encoding::Vector<u8, 65535>, 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!(fidl::encoding::Vector<u8, 65535>, D, &mut self.data, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for TpmDeviceExecuteVendorCommandRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for TpmDeviceExecuteVendorCommandRequest {
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<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<TpmDeviceExecuteVendorCommandRequest, D>
for &TpmDeviceExecuteVendorCommandRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TpmDeviceExecuteVendorCommandRequest>(offset);
fidl::encoding::Encode::<TpmDeviceExecuteVendorCommandRequest, D>::encode(
(
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.command_code),
<fidl::encoding::Vector<u8, 65535> as fidl::encoding::ValueTypeMarker>::borrow(
&self.data,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u16, D>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 65535>, D>,
> fidl::encoding::Encode<TpmDeviceExecuteVendorCommandRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TpmDeviceExecuteVendorCommandRequest>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for TpmDeviceExecuteVendorCommandRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
command_code: fidl::new_empty!(u16, D),
data: fidl::new_empty!(fidl::encoding::Vector<u8, 65535>, 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(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffff0000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u16, D, &mut self.command_code, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::Vector<u8, 65535>, D, &mut self.data, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for TpmDeviceExecuteCommandResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for TpmDeviceExecuteCommandResponse {
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<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<TpmDeviceExecuteCommandResponse, D>
for &TpmDeviceExecuteCommandResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TpmDeviceExecuteCommandResponse>(offset);
fidl::encoding::Encode::<TpmDeviceExecuteCommandResponse, D>::encode(
(<fidl::encoding::Vector<u8, 65535> as fidl::encoding::ValueTypeMarker>::borrow(
&self.data,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl::encoding::Vector<u8, 65535>, D>,
> fidl::encoding::Encode<TpmDeviceExecuteCommandResponse, 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::<TpmDeviceExecuteCommandResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for TpmDeviceExecuteCommandResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { data: fidl::new_empty!(fidl::encoding::Vector<u8, 65535>, 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!(fidl::encoding::Vector<u8, 65535>, D, &mut self.data, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for TpmDeviceExecuteVendorCommandResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for TpmDeviceExecuteVendorCommandResponse {
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<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<TpmDeviceExecuteVendorCommandResponse, D>
for &TpmDeviceExecuteVendorCommandResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TpmDeviceExecuteVendorCommandResponse>(offset);
fidl::encoding::Encode::<TpmDeviceExecuteVendorCommandResponse, D>::encode(
(
<u16 as fidl::encoding::ValueTypeMarker>::borrow(&self.result),
<fidl::encoding::Vector<u8, 65535> as fidl::encoding::ValueTypeMarker>::borrow(
&self.data,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u16, D>,
T1: fidl::encoding::Encode<fidl::encoding::Vector<u8, 65535>, D>,
> fidl::encoding::Encode<TpmDeviceExecuteVendorCommandResponse, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TpmDeviceExecuteVendorCommandResponse>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(0);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for TpmDeviceExecuteVendorCommandResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
result: fidl::new_empty!(u16, D),
data: fidl::new_empty!(fidl::encoding::Vector<u8, 65535>, 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(0) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffff0000u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 0 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
fidl::decode!(u16, D, &mut self.result, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::Vector<u8, 65535>, D, &mut self.data, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for TpmDeviceGetDeviceIdResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for TpmDeviceGetDeviceIdResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
2
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
6
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<TpmDeviceGetDeviceIdResponse, D> for &TpmDeviceGetDeviceIdResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TpmDeviceGetDeviceIdResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut TpmDeviceGetDeviceIdResponse)
.write_unaligned((self as *const TpmDeviceGetDeviceIdResponse).read());
let padding_ptr = buf_ptr.offset(4) as *mut u16;
let padding_mask = 0xff00u16;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u16, D>,
T1: fidl::encoding::Encode<u16, D>,
T2: fidl::encoding::Encode<u8, D>,
> fidl::encoding::Encode<TpmDeviceGetDeviceIdResponse, D> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<TpmDeviceGetDeviceIdResponse>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(4);
(ptr as *mut u16).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 2, depth)?;
self.2.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for TpmDeviceGetDeviceIdResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
vendor_id: fidl::new_empty!(u16, D),
device_id: fidl::new_empty!(u16, D),
revision_id: fidl::new_empty!(u8, 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 buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(4) };
let padval = unsafe { (ptr as *const u16).read_unaligned() };
let mask = 0xff00u16;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 4 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 6);
}
Ok(())
}
}
impl DeprovisionRemoveOwnershipRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
impl fidl::encoding::ValueTypeMarker for DeprovisionRemoveOwnershipRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for DeprovisionRemoveOwnershipRequest {
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<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<DeprovisionRemoveOwnershipRequest, D>
for &DeprovisionRemoveOwnershipRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<DeprovisionRemoveOwnershipRequest>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for DeprovisionRemoveOwnershipRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
impl ProvisionTakeOwnershipRequest {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
0
}
}
impl fidl::encoding::ValueTypeMarker for ProvisionTakeOwnershipRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for ProvisionTakeOwnershipRequest {
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<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<ProvisionTakeOwnershipRequest, D>
for &ProvisionTakeOwnershipRequest
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProvisionTakeOwnershipRequest>(offset);
let max_ordinal: u64 = self.max_ordinal_present();
encoder.write_num(max_ordinal, offset);
encoder.write_num(fidl::encoding::ALLOC_PRESENT_U64, offset + 8);
if max_ordinal == 0 {
return Ok(());
}
depth.increment()?;
let envelope_size = 8;
let bytes_len = max_ordinal as usize * envelope_size;
#[allow(unused_variables)]
let offset = encoder.out_of_line_offset(bytes_len);
let mut _prev_end_offset: usize = 0;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for ProvisionTakeOwnershipRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
}