#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use {
bitflags::bitflags,
fidl::{
client::QueryResponseFut,
endpoints::{ControlHandle as _, Responder as _},
},
fuchsia_zircon_status as zx_status,
futures::future::{self, MaybeDone, TryFutureExt},
};
#[cfg(target_os = "fuchsia")]
use fuchsia_zircon as zx;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum AuthenticateForInterfaceError {
InvalidAuthentication,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! AuthenticateForInterfaceErrorUnknown {
() => {
_
};
}
impl AuthenticateForInterfaceError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::InvalidAuthentication),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::InvalidAuthentication,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::InvalidAuthentication => 1,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum BaseRouteTableRemoveError {
InvalidOpOnMainTable,
#[doc(hidden)]
__SourceBreaking {
unknown_ordinal: u32,
},
}
#[macro_export]
macro_rules! BaseRouteTableRemoveErrorUnknown {
() => {
_
};
}
impl BaseRouteTableRemoveError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::InvalidOpOnMainTable),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::InvalidOpOnMainTable,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::InvalidOpOnMainTable => 1,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum RouteSetError {
Unauthenticated,
InvalidDestinationSubnet,
InvalidNextHop,
UnsupportedAction,
PreviouslyAuthenticatedInterfaceNoLongerExists,
MissingRouteProperties,
MissingMetric,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! RouteSetErrorUnknown {
() => {
_
};
}
impl RouteSetError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::Unauthenticated),
2 => Some(Self::InvalidDestinationSubnet),
3 => Some(Self::InvalidNextHop),
4 => Some(Self::UnsupportedAction),
5 => Some(Self::PreviouslyAuthenticatedInterfaceNoLongerExists),
6 => Some(Self::MissingRouteProperties),
7 => Some(Self::MissingMetric),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::Unauthenticated,
2 => Self::InvalidDestinationSubnet,
3 => Self::InvalidNextHop,
4 => Self::UnsupportedAction,
5 => Self::PreviouslyAuthenticatedInterfaceNoLongerExists,
6 => Self::MissingRouteProperties,
7 => Self::MissingMetric,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::Unauthenticated => 1,
Self::InvalidDestinationSubnet => 2,
Self::InvalidNextHop => 3,
Self::UnsupportedAction => 4,
Self::PreviouslyAuthenticatedInterfaceNoLongerExists => 5,
Self::MissingRouteProperties => 6,
Self::MissingMetric => 7,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub enum RuleSetError {
BadAuthentication,
Unauthenticated,
InvalidAction,
RuleAlreadyExists,
RuleDoesNotExist,
#[doc(hidden)]
__SourceBreaking { unknown_ordinal: u32 },
}
#[macro_export]
macro_rules! RuleSetErrorUnknown {
() => {
_
};
}
impl RuleSetError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::BadAuthentication),
2 => Some(Self::Unauthenticated),
3 => Some(Self::InvalidAction),
4 => Some(Self::RuleAlreadyExists),
5 => Some(Self::RuleDoesNotExist),
_ => None,
}
}
#[inline]
pub fn from_primitive_allow_unknown(prim: u32) -> Self {
match prim {
1 => Self::BadAuthentication,
2 => Self::Unauthenticated,
3 => Self::InvalidAction,
4 => Self::RuleAlreadyExists,
5 => Self::RuleDoesNotExist,
unknown_ordinal => Self::__SourceBreaking { unknown_ordinal },
}
}
#[inline]
pub fn unknown() -> Self {
Self::__SourceBreaking { unknown_ordinal: 0xffffffff }
}
#[inline]
pub const fn into_primitive(self) -> u32 {
match self {
Self::BadAuthentication => 1,
Self::Unauthenticated => 2,
Self::InvalidAction => 3,
Self::RuleAlreadyExists => 4,
Self::RuleDoesNotExist => 5,
Self::__SourceBreaking { unknown_ordinal } => unknown_ordinal,
}
}
#[inline]
pub fn is_unknown(&self) -> bool {
match self {
Self::__SourceBreaking { unknown_ordinal: _ } => true,
_ => false,
}
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct BaseRouteTableGetTableIdResponse {
pub table_id: u32,
}
impl fidl::Persistable for BaseRouteTableGetTableIdResponse {}
#[derive(Debug, PartialEq)]
pub struct BaseRuleSetAuthenticateForInterfaceRequest {
pub credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
}
impl fidl::Standalone for BaseRuleSetAuthenticateForInterfaceRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct BaseRuleSetRemoveRuleRequest {
pub index: u32,
}
impl fidl::Persistable for BaseRuleSetRemoveRuleRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct GrantForRouteTableAuthorization {
pub table_id: u32,
pub token: fidl::Event,
}
impl fidl::Standalone for GrantForRouteTableAuthorization {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct ProofOfRouteTableAuthorization {
pub table: u32,
pub token: fidl::Event,
}
impl fidl::Standalone for ProofOfRouteTableAuthorization {}
#[derive(Debug, PartialEq)]
pub struct RouteSetV4AddRouteRequest {
pub route: fidl_fuchsia_net_routes::RouteV4,
}
impl fidl::Standalone for RouteSetV4AddRouteRequest {}
#[derive(Debug, PartialEq)]
pub struct RouteSetV4AuthenticateForInterfaceRequest {
pub credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
}
impl fidl::Standalone for RouteSetV4AuthenticateForInterfaceRequest {}
#[derive(Debug, PartialEq)]
pub struct RouteSetV4RemoveRouteRequest {
pub route: fidl_fuchsia_net_routes::RouteV4,
}
impl fidl::Standalone for RouteSetV4RemoveRouteRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RouteSetV4AddRouteResponse {
pub did_add: bool,
}
impl fidl::Persistable for RouteSetV4AddRouteResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RouteSetV4RemoveRouteResponse {
pub did_remove: bool,
}
impl fidl::Persistable for RouteSetV4RemoveRouteResponse {}
#[derive(Debug, PartialEq)]
pub struct RouteSetV6AddRouteRequest {
pub route: fidl_fuchsia_net_routes::RouteV6,
}
impl fidl::Standalone for RouteSetV6AddRouteRequest {}
#[derive(Debug, PartialEq)]
pub struct RouteSetV6AuthenticateForInterfaceRequest {
pub credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
}
impl fidl::Standalone for RouteSetV6AuthenticateForInterfaceRequest {}
#[derive(Debug, PartialEq)]
pub struct RouteSetV6RemoveRouteRequest {
pub route: fidl_fuchsia_net_routes::RouteV6,
}
impl fidl::Standalone for RouteSetV6RemoveRouteRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RouteSetV6AddRouteResponse {
pub did_add: bool,
}
impl fidl::Persistable for RouteSetV6AddRouteResponse {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RouteSetV6RemoveRouteResponse {
pub did_remove: bool,
}
impl fidl::Persistable for RouteSetV6RemoveRouteResponse {}
#[derive(Debug, PartialEq)]
pub struct RouteTableProviderV4NewRouteTableRequest {
pub provider: fidl::endpoints::ServerEnd<RouteTableV4Marker>,
pub options: RouteTableOptionsV4,
}
impl fidl::Standalone for RouteTableProviderV4NewRouteTableRequest {}
#[derive(Debug, PartialEq)]
pub struct RouteTableProviderV6NewRouteTableRequest {
pub provider: fidl::endpoints::ServerEnd<RouteTableV6Marker>,
pub options: RouteTableOptionsV6,
}
impl fidl::Standalone for RouteTableProviderV6NewRouteTableRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RouteTableV4NewRouteSetRequest {
pub route_set: fidl::endpoints::ServerEnd<RouteSetV4Marker>,
}
impl fidl::Standalone for RouteTableV4NewRouteSetRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RouteTableV6NewRouteSetRequest {
pub route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
}
impl fidl::Standalone for RouteTableV6NewRouteSetRequest {}
#[derive(Debug, PartialEq)]
pub struct RuleSetV4AddRuleRequest {
pub index: u32,
pub selector: fidl_fuchsia_net_routes::RuleSelectorV4,
pub action: fidl_fuchsia_net_routes::RuleAction,
}
impl fidl::Standalone for RuleSetV4AddRuleRequest {}
#[derive(Debug, PartialEq)]
pub struct RuleSetV6AddRuleRequest {
pub index: u32,
pub selector: fidl_fuchsia_net_routes::RuleSelectorV6,
pub action: fidl_fuchsia_net_routes::RuleAction,
}
impl fidl::Standalone for RuleSetV6AddRuleRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RuleTableV4NewRuleSetRequest {
pub priority: u32,
pub rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
}
impl fidl::Standalone for RuleTableV4NewRuleSetRequest {}
#[derive(Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct RuleTableV6NewRuleSetRequest {
pub priority: u32,
pub rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
}
impl fidl::Standalone for RuleTableV6NewRuleSetRequest {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct RouteTableOptionsV4 {
pub name: Option<String>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for RouteTableOptionsV4 {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct RouteTableOptionsV6 {
pub name: Option<String>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for RouteTableOptionsV6 {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct BaseRouteTableMarker;
impl fidl::endpoints::ProtocolMarker for BaseRouteTableMarker {
type Proxy = BaseRouteTableProxy;
type RequestStream = BaseRouteTableRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = BaseRouteTableSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) BaseRouteTable";
}
pub type BaseRouteTableRemoveResult = Result<(), BaseRouteTableRemoveError>;
pub trait BaseRouteTableProxyInterface: Send + Sync {
type GetTableIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
fn r#get_table_id(&self) -> Self::GetTableIdResponseFut;
fn r#detach(&self) -> Result<(), fidl::Error>;
type RemoveResponseFut: std::future::Future<Output = Result<BaseRouteTableRemoveResult, fidl::Error>>
+ Send;
fn r#remove(&self) -> Self::RemoveResponseFut;
type GetAuthorizationForRouteTableResponseFut: std::future::Future<Output = Result<(u32, fidl::Event), fidl::Error>>
+ Send;
fn r#get_authorization_for_route_table(&self)
-> Self::GetAuthorizationForRouteTableResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct BaseRouteTableSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for BaseRouteTableSynchronousProxy {
type Proxy = BaseRouteTableProxy;
type Protocol = BaseRouteTableMarker;
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 BaseRouteTableSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <BaseRouteTableMarker 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::Time) -> Result<BaseRouteTableEvent, fidl::Error> {
BaseRouteTableEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_table_id(&self, ___deadline: zx::Time) -> Result<u32, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, BaseRouteTableGetTableIdResponse>(
(),
0x7eab30c55edbfc15,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.table_id)
}
pub fn r#detach(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x2853ab157285b384,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#remove(
&self,
___deadline: zx::Time,
) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
BaseRouteTableRemoveError,
>>(
(),
0xc42e58a5fc79426,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_authorization_for_route_table(
&self,
___deadline: zx::Time,
) -> Result<(u32, fidl::Event), fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, GrantForRouteTableAuthorization>(
(),
0x56a48c921ff3b6eb,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.table_id, _response.token))
}
}
#[derive(Debug, Clone)]
pub struct BaseRouteTableProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for BaseRouteTableProxy {
type Protocol = BaseRouteTableMarker;
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 BaseRouteTableProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <BaseRouteTableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> BaseRouteTableEventStream {
BaseRouteTableEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_table_id(&self) -> fidl::client::QueryResponseFut<u32> {
BaseRouteTableProxyInterface::r#get_table_id(self)
}
pub fn r#detach(&self) -> Result<(), fidl::Error> {
BaseRouteTableProxyInterface::r#detach(self)
}
pub fn r#remove(&self) -> fidl::client::QueryResponseFut<BaseRouteTableRemoveResult> {
BaseRouteTableProxyInterface::r#remove(self)
}
pub fn r#get_authorization_for_route_table(
&self,
) -> fidl::client::QueryResponseFut<(u32, fidl::Event)> {
BaseRouteTableProxyInterface::r#get_authorization_for_route_table(self)
}
}
impl BaseRouteTableProxyInterface for BaseRouteTableProxy {
type GetTableIdResponseFut = fidl::client::QueryResponseFut<u32>;
fn r#get_table_id(&self) -> Self::GetTableIdResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<u32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
BaseRouteTableGetTableIdResponse,
0x7eab30c55edbfc15,
>(_buf?)?;
Ok(_response.table_id)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
(),
0x7eab30c55edbfc15,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#detach(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x2853ab157285b384,
fidl::encoding::DynamicFlags::empty(),
)
}
type RemoveResponseFut = fidl::client::QueryResponseFut<BaseRouteTableRemoveResult>;
fn r#remove(&self) -> Self::RemoveResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BaseRouteTableRemoveError>,
0xc42e58a5fc79426,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, BaseRouteTableRemoveResult>(
(),
0xc42e58a5fc79426,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetAuthorizationForRouteTableResponseFut =
fidl::client::QueryResponseFut<(u32, fidl::Event)>;
fn r#get_authorization_for_route_table(
&self,
) -> Self::GetAuthorizationForRouteTableResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<(u32, fidl::Event), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
GrantForRouteTableAuthorization,
0x56a48c921ff3b6eb,
>(_buf?)?;
Ok((_response.table_id, _response.token))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (u32, fidl::Event)>(
(),
0x56a48c921ff3b6eb,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct BaseRouteTableEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for BaseRouteTableEventStream {}
impl futures::stream::FusedStream for BaseRouteTableEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for BaseRouteTableEventStream {
type Item = Result<BaseRouteTableEvent, 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(BaseRouteTableEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum BaseRouteTableEvent {}
impl BaseRouteTableEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<BaseRouteTableEvent, 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:
<BaseRouteTableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct BaseRouteTableRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for BaseRouteTableRequestStream {}
impl futures::stream::FusedStream for BaseRouteTableRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for BaseRouteTableRequestStream {
type Protocol = BaseRouteTableMarker;
type ControlHandle = BaseRouteTableControlHandle;
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 {
BaseRouteTableControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for BaseRouteTableRequestStream {
type Item = Result<BaseRouteTableRequest, 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 BaseRouteTableRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x7eab30c55edbfc15 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = BaseRouteTableControlHandle { inner: this.inner.clone() };
Ok(BaseRouteTableRequest::GetTableId {
responder: BaseRouteTableGetTableIdResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2853ab157285b384 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = BaseRouteTableControlHandle { inner: this.inner.clone() };
Ok(BaseRouteTableRequest::Detach { control_handle })
}
0xc42e58a5fc79426 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = BaseRouteTableControlHandle { inner: this.inner.clone() };
Ok(BaseRouteTableRequest::Remove {
responder: BaseRouteTableRemoveResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x56a48c921ff3b6eb => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = BaseRouteTableControlHandle { inner: this.inner.clone() };
Ok(BaseRouteTableRequest::GetAuthorizationForRouteTable {
responder: BaseRouteTableGetAuthorizationForRouteTableResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<BaseRouteTableMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum BaseRouteTableRequest {
GetTableId { responder: BaseRouteTableGetTableIdResponder },
Detach { control_handle: BaseRouteTableControlHandle },
Remove { responder: BaseRouteTableRemoveResponder },
GetAuthorizationForRouteTable {
responder: BaseRouteTableGetAuthorizationForRouteTableResponder,
},
}
impl BaseRouteTableRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_get_table_id(self) -> Option<(BaseRouteTableGetTableIdResponder)> {
if let BaseRouteTableRequest::GetTableId { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_detach(self) -> Option<(BaseRouteTableControlHandle)> {
if let BaseRouteTableRequest::Detach { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_remove(self) -> Option<(BaseRouteTableRemoveResponder)> {
if let BaseRouteTableRequest::Remove { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_authorization_for_route_table(
self,
) -> Option<(BaseRouteTableGetAuthorizationForRouteTableResponder)> {
if let BaseRouteTableRequest::GetAuthorizationForRouteTable { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
BaseRouteTableRequest::GetTableId { .. } => "get_table_id",
BaseRouteTableRequest::Detach { .. } => "detach",
BaseRouteTableRequest::Remove { .. } => "remove",
BaseRouteTableRequest::GetAuthorizationForRouteTable { .. } => {
"get_authorization_for_route_table"
}
}
}
}
#[derive(Debug, Clone)]
pub struct BaseRouteTableControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for BaseRouteTableControlHandle {
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()
}
}
impl BaseRouteTableControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BaseRouteTableGetTableIdResponder {
control_handle: std::mem::ManuallyDrop<BaseRouteTableControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BaseRouteTableGetTableIdResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BaseRouteTableGetTableIdResponder {
type ControlHandle = BaseRouteTableControlHandle;
fn control_handle(&self) -> &BaseRouteTableControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BaseRouteTableGetTableIdResponder {
pub fn send(self, mut table_id: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(table_id);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut table_id: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(table_id);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut table_id: u32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<BaseRouteTableGetTableIdResponse>(
(table_id,),
self.tx_id,
0x7eab30c55edbfc15,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BaseRouteTableRemoveResponder {
control_handle: std::mem::ManuallyDrop<BaseRouteTableControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BaseRouteTableRemoveResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BaseRouteTableRemoveResponder {
type ControlHandle = BaseRouteTableControlHandle;
fn control_handle(&self) -> &BaseRouteTableControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BaseRouteTableRemoveResponder {
pub fn send(
self,
mut result: Result<(), BaseRouteTableRemoveError>,
) -> 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<(), BaseRouteTableRemoveError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), BaseRouteTableRemoveError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
BaseRouteTableRemoveError,
>>(
result,
self.tx_id,
0xc42e58a5fc79426,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BaseRouteTableGetAuthorizationForRouteTableResponder {
control_handle: std::mem::ManuallyDrop<BaseRouteTableControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BaseRouteTableGetAuthorizationForRouteTableResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BaseRouteTableGetAuthorizationForRouteTableResponder {
type ControlHandle = BaseRouteTableControlHandle;
fn control_handle(&self) -> &BaseRouteTableControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BaseRouteTableGetAuthorizationForRouteTableResponder {
pub fn send(self, mut table_id: u32, mut token: fidl::Event) -> Result<(), fidl::Error> {
let _result = self.send_raw(table_id, token);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut table_id: u32,
mut token: fidl::Event,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(table_id, token);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut table_id: u32, mut token: fidl::Event) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<GrantForRouteTableAuthorization>(
(table_id, token),
self.tx_id,
0x56a48c921ff3b6eb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct BaseRuleSetMarker;
impl fidl::endpoints::ProtocolMarker for BaseRuleSetMarker {
type Proxy = BaseRuleSetProxy;
type RequestStream = BaseRuleSetRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = BaseRuleSetSynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) BaseRuleSet";
}
pub type BaseRuleSetAuthenticateForRouteTableResult = Result<(), RuleSetError>;
pub type BaseRuleSetAuthenticateForInterfaceResult = Result<(), RuleSetError>;
pub type BaseRuleSetRemoveRuleResult = Result<(), RuleSetError>;
pub trait BaseRuleSetProxyInterface: Send + Sync {
type AuthenticateForRouteTableResponseFut: std::future::Future<
Output = Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error>,
> + Send;
fn r#authenticate_for_route_table(
&self,
table: u32,
token: fidl::Event,
) -> Self::AuthenticateForRouteTableResponseFut;
type AuthenticateForInterfaceResponseFut: std::future::Future<Output = Result<BaseRuleSetAuthenticateForInterfaceResult, fidl::Error>>
+ Send;
fn r#authenticate_for_interface(
&self,
credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
) -> Self::AuthenticateForInterfaceResponseFut;
type RemoveRuleResponseFut: std::future::Future<Output = Result<BaseRuleSetRemoveRuleResult, fidl::Error>>
+ Send;
fn r#remove_rule(&self, index: u32) -> Self::RemoveRuleResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct BaseRuleSetSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for BaseRuleSetSynchronousProxy {
type Proxy = BaseRuleSetProxy;
type Protocol = BaseRuleSetMarker;
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 BaseRuleSetSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <BaseRuleSetMarker 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::Time) -> Result<BaseRuleSetEvent, fidl::Error> {
BaseRuleSetEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#authenticate_for_route_table(
&self,
mut table: u32,
mut token: fidl::Event,
___deadline: zx::Time,
) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
let _response = self.client.send_query::<
ProofOfRouteTableAuthorization,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
>(
(table, token,),
0x6fd845360ed9bc8f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#authenticate_for_interface(
&self,
mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
___deadline: zx::Time,
) -> Result<BaseRuleSetAuthenticateForInterfaceResult, fidl::Error> {
let _response = self.client.send_query::<
BaseRuleSetAuthenticateForInterfaceRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
>(
(&mut credential,),
0x63f2f24c76ccab3d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#remove_rule(
&self,
mut index: u32,
___deadline: zx::Time,
) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
let _response = self.client.send_query::<
BaseRuleSetRemoveRuleRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
>(
(index,),
0x2ae3d7e817cbff90,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct BaseRuleSetProxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for BaseRuleSetProxy {
type Protocol = BaseRuleSetMarker;
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 BaseRuleSetProxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <BaseRuleSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> BaseRuleSetEventStream {
BaseRuleSetEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#authenticate_for_route_table(
&self,
mut table: u32,
mut token: fidl::Event,
) -> fidl::client::QueryResponseFut<BaseRuleSetAuthenticateForRouteTableResult> {
BaseRuleSetProxyInterface::r#authenticate_for_route_table(self, table, token)
}
pub fn r#authenticate_for_interface(
&self,
mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
) -> fidl::client::QueryResponseFut<BaseRuleSetAuthenticateForInterfaceResult> {
BaseRuleSetProxyInterface::r#authenticate_for_interface(self, credential)
}
pub fn r#remove_rule(
&self,
mut index: u32,
) -> fidl::client::QueryResponseFut<BaseRuleSetRemoveRuleResult> {
BaseRuleSetProxyInterface::r#remove_rule(self, index)
}
}
impl BaseRuleSetProxyInterface for BaseRuleSetProxy {
type AuthenticateForRouteTableResponseFut =
fidl::client::QueryResponseFut<BaseRuleSetAuthenticateForRouteTableResult>;
fn r#authenticate_for_route_table(
&self,
mut table: u32,
mut token: fidl::Event,
) -> Self::AuthenticateForRouteTableResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
0x6fd845360ed9bc8f,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
ProofOfRouteTableAuthorization,
BaseRuleSetAuthenticateForRouteTableResult,
>(
(table, token,),
0x6fd845360ed9bc8f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AuthenticateForInterfaceResponseFut =
fidl::client::QueryResponseFut<BaseRuleSetAuthenticateForInterfaceResult>;
fn r#authenticate_for_interface(
&self,
mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
) -> Self::AuthenticateForInterfaceResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<BaseRuleSetAuthenticateForInterfaceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
0x63f2f24c76ccab3d,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
BaseRuleSetAuthenticateForInterfaceRequest,
BaseRuleSetAuthenticateForInterfaceResult,
>(
(&mut credential,),
0x63f2f24c76ccab3d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type RemoveRuleResponseFut = fidl::client::QueryResponseFut<BaseRuleSetRemoveRuleResult>;
fn r#remove_rule(&self, mut index: u32) -> Self::RemoveRuleResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
0x2ae3d7e817cbff90,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<BaseRuleSetRemoveRuleRequest, BaseRuleSetRemoveRuleResult>(
(index,),
0x2ae3d7e817cbff90,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct BaseRuleSetEventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for BaseRuleSetEventStream {}
impl futures::stream::FusedStream for BaseRuleSetEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for BaseRuleSetEventStream {
type Item = Result<BaseRuleSetEvent, 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(BaseRuleSetEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum BaseRuleSetEvent {}
impl BaseRuleSetEvent {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<BaseRuleSetEvent, 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: <BaseRuleSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct BaseRuleSetRequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for BaseRuleSetRequestStream {}
impl futures::stream::FusedStream for BaseRuleSetRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for BaseRuleSetRequestStream {
type Protocol = BaseRuleSetMarker;
type ControlHandle = BaseRuleSetControlHandle;
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 {
BaseRuleSetControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for BaseRuleSetRequestStream {
type Item = Result<BaseRuleSetRequest, 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 BaseRuleSetRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x6fd845360ed9bc8f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ProofOfRouteTableAuthorization);
fidl::encoding::Decoder::decode_into::<ProofOfRouteTableAuthorization>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = BaseRuleSetControlHandle { inner: this.inner.clone() };
Ok(BaseRuleSetRequest::AuthenticateForRouteTable {
table: req.table,
token: req.token,
responder: BaseRuleSetAuthenticateForRouteTableResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x63f2f24c76ccab3d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(BaseRuleSetAuthenticateForInterfaceRequest);
fidl::encoding::Decoder::decode_into::<
BaseRuleSetAuthenticateForInterfaceRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle = BaseRuleSetControlHandle { inner: this.inner.clone() };
Ok(BaseRuleSetRequest::AuthenticateForInterface {
credential: req.credential,
responder: BaseRuleSetAuthenticateForInterfaceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2ae3d7e817cbff90 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(BaseRuleSetRemoveRuleRequest);
fidl::encoding::Decoder::decode_into::<BaseRuleSetRemoveRuleRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = BaseRuleSetControlHandle { inner: this.inner.clone() };
Ok(BaseRuleSetRequest::RemoveRule {
index: req.index,
responder: BaseRuleSetRemoveRuleResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<BaseRuleSetMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum BaseRuleSetRequest {
AuthenticateForRouteTable {
table: u32,
token: fidl::Event,
responder: BaseRuleSetAuthenticateForRouteTableResponder,
},
AuthenticateForInterface {
credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
responder: BaseRuleSetAuthenticateForInterfaceResponder,
},
RemoveRule { index: u32, responder: BaseRuleSetRemoveRuleResponder },
}
impl BaseRuleSetRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_authenticate_for_route_table(
self,
) -> Option<(u32, fidl::Event, BaseRuleSetAuthenticateForRouteTableResponder)> {
if let BaseRuleSetRequest::AuthenticateForRouteTable { table, token, responder } = self {
Some((table, token, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_authenticate_for_interface(
self,
) -> Option<(
fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
BaseRuleSetAuthenticateForInterfaceResponder,
)> {
if let BaseRuleSetRequest::AuthenticateForInterface { credential, responder } = self {
Some((credential, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_remove_rule(self) -> Option<(u32, BaseRuleSetRemoveRuleResponder)> {
if let BaseRuleSetRequest::RemoveRule { index, responder } = self {
Some((index, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
BaseRuleSetRequest::AuthenticateForRouteTable { .. } => "authenticate_for_route_table",
BaseRuleSetRequest::AuthenticateForInterface { .. } => "authenticate_for_interface",
BaseRuleSetRequest::RemoveRule { .. } => "remove_rule",
}
}
}
#[derive(Debug, Clone)]
pub struct BaseRuleSetControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for BaseRuleSetControlHandle {
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()
}
}
impl BaseRuleSetControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BaseRuleSetAuthenticateForRouteTableResponder {
control_handle: std::mem::ManuallyDrop<BaseRuleSetControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BaseRuleSetAuthenticateForRouteTableResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BaseRuleSetAuthenticateForRouteTableResponder {
type ControlHandle = BaseRuleSetControlHandle;
fn control_handle(&self) -> &BaseRuleSetControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BaseRuleSetAuthenticateForRouteTableResponder {
pub fn send(self, mut result: Result<(), RuleSetError>) -> 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<(), RuleSetError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RuleSetError,
>>(
result,
self.tx_id,
0x6fd845360ed9bc8f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BaseRuleSetAuthenticateForInterfaceResponder {
control_handle: std::mem::ManuallyDrop<BaseRuleSetControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BaseRuleSetAuthenticateForInterfaceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BaseRuleSetAuthenticateForInterfaceResponder {
type ControlHandle = BaseRuleSetControlHandle;
fn control_handle(&self) -> &BaseRuleSetControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BaseRuleSetAuthenticateForInterfaceResponder {
pub fn send(self, mut result: Result<(), RuleSetError>) -> 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<(), RuleSetError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RuleSetError,
>>(
result,
self.tx_id,
0x63f2f24c76ccab3d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct BaseRuleSetRemoveRuleResponder {
control_handle: std::mem::ManuallyDrop<BaseRuleSetControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for BaseRuleSetRemoveRuleResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for BaseRuleSetRemoveRuleResponder {
type ControlHandle = BaseRuleSetControlHandle;
fn control_handle(&self) -> &BaseRuleSetControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl BaseRuleSetRemoveRuleResponder {
pub fn send(self, mut result: Result<(), RuleSetError>) -> 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<(), RuleSetError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RuleSetError,
>>(
result,
self.tx_id,
0x2ae3d7e817cbff90,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RouteSetV4Marker;
impl fidl::endpoints::ProtocolMarker for RouteSetV4Marker {
type Proxy = RouteSetV4Proxy;
type RequestStream = RouteSetV4RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RouteSetV4SynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) RouteSetV4";
}
pub type RouteSetV4AuthenticateForInterfaceResult = Result<(), AuthenticateForInterfaceError>;
pub type RouteSetV4AddRouteResult = Result<bool, RouteSetError>;
pub type RouteSetV4RemoveRouteResult = Result<bool, RouteSetError>;
pub trait RouteSetV4ProxyInterface: Send + Sync {
type AuthenticateForInterfaceResponseFut: std::future::Future<Output = Result<RouteSetV4AuthenticateForInterfaceResult, fidl::Error>>
+ Send;
fn r#authenticate_for_interface(
&self,
credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
) -> Self::AuthenticateForInterfaceResponseFut;
type AddRouteResponseFut: std::future::Future<Output = Result<RouteSetV4AddRouteResult, fidl::Error>>
+ Send;
fn r#add_route(&self, route: &fidl_fuchsia_net_routes::RouteV4) -> Self::AddRouteResponseFut;
type RemoveRouteResponseFut: std::future::Future<Output = Result<RouteSetV4RemoveRouteResult, fidl::Error>>
+ Send;
fn r#remove_route(
&self,
route: &fidl_fuchsia_net_routes::RouteV4,
) -> Self::RemoveRouteResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RouteSetV4SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RouteSetV4SynchronousProxy {
type Proxy = RouteSetV4Proxy;
type Protocol = RouteSetV4Marker;
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 RouteSetV4SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <RouteSetV4Marker 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::Time) -> Result<RouteSetV4Event, fidl::Error> {
RouteSetV4Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#authenticate_for_interface(
&self,
mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
___deadline: zx::Time,
) -> Result<RouteSetV4AuthenticateForInterfaceResult, fidl::Error> {
let _response = self
.client
.send_query::<RouteSetV4AuthenticateForInterfaceRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
AuthenticateForInterfaceError,
>>(
(&mut credential,),
0x74841ceef127518e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#add_route(
&self,
mut route: &fidl_fuchsia_net_routes::RouteV4,
___deadline: zx::Time,
) -> Result<RouteSetV4AddRouteResult, fidl::Error> {
let _response = self.client.send_query::<
RouteSetV4AddRouteRequest,
fidl::encoding::ResultType<RouteSetV4AddRouteResponse, RouteSetError>,
>(
(route,),
0x4bd69e45539e8ec0,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.did_add))
}
pub fn r#remove_route(
&self,
mut route: &fidl_fuchsia_net_routes::RouteV4,
___deadline: zx::Time,
) -> Result<RouteSetV4RemoveRouteResult, fidl::Error> {
let _response = self.client.send_query::<
RouteSetV4RemoveRouteRequest,
fidl::encoding::ResultType<RouteSetV4RemoveRouteResponse, RouteSetError>,
>(
(route,),
0x514f6880232f1665,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.did_remove))
}
}
#[derive(Debug, Clone)]
pub struct RouteSetV4Proxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for RouteSetV4Proxy {
type Protocol = RouteSetV4Marker;
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 RouteSetV4Proxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <RouteSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RouteSetV4EventStream {
RouteSetV4EventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#authenticate_for_interface(
&self,
mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
) -> fidl::client::QueryResponseFut<RouteSetV4AuthenticateForInterfaceResult> {
RouteSetV4ProxyInterface::r#authenticate_for_interface(self, credential)
}
pub fn r#add_route(
&self,
mut route: &fidl_fuchsia_net_routes::RouteV4,
) -> fidl::client::QueryResponseFut<RouteSetV4AddRouteResult> {
RouteSetV4ProxyInterface::r#add_route(self, route)
}
pub fn r#remove_route(
&self,
mut route: &fidl_fuchsia_net_routes::RouteV4,
) -> fidl::client::QueryResponseFut<RouteSetV4RemoveRouteResult> {
RouteSetV4ProxyInterface::r#remove_route(self, route)
}
}
impl RouteSetV4ProxyInterface for RouteSetV4Proxy {
type AuthenticateForInterfaceResponseFut =
fidl::client::QueryResponseFut<RouteSetV4AuthenticateForInterfaceResult>;
fn r#authenticate_for_interface(
&self,
mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
) -> Self::AuthenticateForInterfaceResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RouteSetV4AuthenticateForInterfaceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
AuthenticateForInterfaceError,
>,
0x74841ceef127518e,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
RouteSetV4AuthenticateForInterfaceRequest,
RouteSetV4AuthenticateForInterfaceResult,
>(
(&mut credential,),
0x74841ceef127518e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AddRouteResponseFut = fidl::client::QueryResponseFut<RouteSetV4AddRouteResult>;
fn r#add_route(
&self,
mut route: &fidl_fuchsia_net_routes::RouteV4,
) -> Self::AddRouteResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RouteSetV4AddRouteResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<RouteSetV4AddRouteResponse, RouteSetError>,
0x4bd69e45539e8ec0,
>(_buf?)?;
Ok(_response.map(|x| x.did_add))
}
self.client.send_query_and_decode::<RouteSetV4AddRouteRequest, RouteSetV4AddRouteResult>(
(route,),
0x4bd69e45539e8ec0,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type RemoveRouteResponseFut = fidl::client::QueryResponseFut<RouteSetV4RemoveRouteResult>;
fn r#remove_route(
&self,
mut route: &fidl_fuchsia_net_routes::RouteV4,
) -> Self::RemoveRouteResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RouteSetV4RemoveRouteResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<RouteSetV4RemoveRouteResponse, RouteSetError>,
0x514f6880232f1665,
>(_buf?)?;
Ok(_response.map(|x| x.did_remove))
}
self.client
.send_query_and_decode::<RouteSetV4RemoveRouteRequest, RouteSetV4RemoveRouteResult>(
(route,),
0x514f6880232f1665,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct RouteSetV4EventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for RouteSetV4EventStream {}
impl futures::stream::FusedStream for RouteSetV4EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RouteSetV4EventStream {
type Item = Result<RouteSetV4Event, 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(RouteSetV4Event::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RouteSetV4Event {}
impl RouteSetV4Event {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<RouteSetV4Event, 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: <RouteSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RouteSetV4RequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for RouteSetV4RequestStream {}
impl futures::stream::FusedStream for RouteSetV4RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RouteSetV4RequestStream {
type Protocol = RouteSetV4Marker;
type ControlHandle = RouteSetV4ControlHandle;
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 {
RouteSetV4ControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for RouteSetV4RequestStream {
type Item = Result<RouteSetV4Request, 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 RouteSetV4RequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x74841ceef127518e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RouteSetV4AuthenticateForInterfaceRequest);
fidl::encoding::Decoder::decode_into::<
RouteSetV4AuthenticateForInterfaceRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle = RouteSetV4ControlHandle { inner: this.inner.clone() };
Ok(RouteSetV4Request::AuthenticateForInterface {
credential: req.credential,
responder: RouteSetV4AuthenticateForInterfaceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4bd69e45539e8ec0 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RouteSetV4AddRouteRequest);
fidl::encoding::Decoder::decode_into::<RouteSetV4AddRouteRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RouteSetV4ControlHandle { inner: this.inner.clone() };
Ok(RouteSetV4Request::AddRoute {
route: req.route,
responder: RouteSetV4AddRouteResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x514f6880232f1665 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RouteSetV4RemoveRouteRequest);
fidl::encoding::Decoder::decode_into::<RouteSetV4RemoveRouteRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RouteSetV4ControlHandle { inner: this.inner.clone() };
Ok(RouteSetV4Request::RemoveRoute {
route: req.route,
responder: RouteSetV4RemoveRouteResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<RouteSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum RouteSetV4Request {
AuthenticateForInterface {
credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
responder: RouteSetV4AuthenticateForInterfaceResponder,
},
AddRoute { route: fidl_fuchsia_net_routes::RouteV4, responder: RouteSetV4AddRouteResponder },
RemoveRoute {
route: fidl_fuchsia_net_routes::RouteV4,
responder: RouteSetV4RemoveRouteResponder,
},
}
impl RouteSetV4Request {
#[allow(irrefutable_let_patterns)]
pub fn into_authenticate_for_interface(
self,
) -> Option<(
fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
RouteSetV4AuthenticateForInterfaceResponder,
)> {
if let RouteSetV4Request::AuthenticateForInterface { credential, responder } = self {
Some((credential, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add_route(
self,
) -> Option<(fidl_fuchsia_net_routes::RouteV4, RouteSetV4AddRouteResponder)> {
if let RouteSetV4Request::AddRoute { route, responder } = self {
Some((route, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_remove_route(
self,
) -> Option<(fidl_fuchsia_net_routes::RouteV4, RouteSetV4RemoveRouteResponder)> {
if let RouteSetV4Request::RemoveRoute { route, responder } = self {
Some((route, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RouteSetV4Request::AuthenticateForInterface { .. } => "authenticate_for_interface",
RouteSetV4Request::AddRoute { .. } => "add_route",
RouteSetV4Request::RemoveRoute { .. } => "remove_route",
}
}
}
#[derive(Debug, Clone)]
pub struct RouteSetV4ControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for RouteSetV4ControlHandle {
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()
}
}
impl RouteSetV4ControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RouteSetV4AuthenticateForInterfaceResponder {
control_handle: std::mem::ManuallyDrop<RouteSetV4ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RouteSetV4AuthenticateForInterfaceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RouteSetV4AuthenticateForInterfaceResponder {
type ControlHandle = RouteSetV4ControlHandle;
fn control_handle(&self) -> &RouteSetV4ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RouteSetV4AuthenticateForInterfaceResponder {
pub fn send(
self,
mut result: Result<(), AuthenticateForInterfaceError>,
) -> 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<(), AuthenticateForInterfaceError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), AuthenticateForInterfaceError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
AuthenticateForInterfaceError,
>>(
result,
self.tx_id,
0x74841ceef127518e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RouteSetV4AddRouteResponder {
control_handle: std::mem::ManuallyDrop<RouteSetV4ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RouteSetV4AddRouteResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RouteSetV4AddRouteResponder {
type ControlHandle = RouteSetV4ControlHandle;
fn control_handle(&self) -> &RouteSetV4ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RouteSetV4AddRouteResponder {
pub fn send(self, mut result: Result<bool, RouteSetError>) -> 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<bool, RouteSetError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
RouteSetV4AddRouteResponse,
RouteSetError,
>>(
result.map(|did_add| (did_add,)),
self.tx_id,
0x4bd69e45539e8ec0,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RouteSetV4RemoveRouteResponder {
control_handle: std::mem::ManuallyDrop<RouteSetV4ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RouteSetV4RemoveRouteResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RouteSetV4RemoveRouteResponder {
type ControlHandle = RouteSetV4ControlHandle;
fn control_handle(&self) -> &RouteSetV4ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RouteSetV4RemoveRouteResponder {
pub fn send(self, mut result: Result<bool, RouteSetError>) -> 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<bool, RouteSetError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
RouteSetV4RemoveRouteResponse,
RouteSetError,
>>(
result.map(|did_remove| (did_remove,)),
self.tx_id,
0x514f6880232f1665,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RouteSetV6Marker;
impl fidl::endpoints::ProtocolMarker for RouteSetV6Marker {
type Proxy = RouteSetV6Proxy;
type RequestStream = RouteSetV6RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RouteSetV6SynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) RouteSetV6";
}
pub type RouteSetV6AuthenticateForInterfaceResult = Result<(), AuthenticateForInterfaceError>;
pub type RouteSetV6AddRouteResult = Result<bool, RouteSetError>;
pub type RouteSetV6RemoveRouteResult = Result<bool, RouteSetError>;
pub trait RouteSetV6ProxyInterface: Send + Sync {
type AuthenticateForInterfaceResponseFut: std::future::Future<Output = Result<RouteSetV6AuthenticateForInterfaceResult, fidl::Error>>
+ Send;
fn r#authenticate_for_interface(
&self,
credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
) -> Self::AuthenticateForInterfaceResponseFut;
type AddRouteResponseFut: std::future::Future<Output = Result<RouteSetV6AddRouteResult, fidl::Error>>
+ Send;
fn r#add_route(&self, route: &fidl_fuchsia_net_routes::RouteV6) -> Self::AddRouteResponseFut;
type RemoveRouteResponseFut: std::future::Future<Output = Result<RouteSetV6RemoveRouteResult, fidl::Error>>
+ Send;
fn r#remove_route(
&self,
route: &fidl_fuchsia_net_routes::RouteV6,
) -> Self::RemoveRouteResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RouteSetV6SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RouteSetV6SynchronousProxy {
type Proxy = RouteSetV6Proxy;
type Protocol = RouteSetV6Marker;
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 RouteSetV6SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <RouteSetV6Marker 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::Time) -> Result<RouteSetV6Event, fidl::Error> {
RouteSetV6Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#authenticate_for_interface(
&self,
mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
___deadline: zx::Time,
) -> Result<RouteSetV6AuthenticateForInterfaceResult, fidl::Error> {
let _response = self
.client
.send_query::<RouteSetV6AuthenticateForInterfaceRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
AuthenticateForInterfaceError,
>>(
(&mut credential,),
0x7d63a6a7aed6f640,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#add_route(
&self,
mut route: &fidl_fuchsia_net_routes::RouteV6,
___deadline: zx::Time,
) -> Result<RouteSetV6AddRouteResult, fidl::Error> {
let _response = self.client.send_query::<
RouteSetV6AddRouteRequest,
fidl::encoding::ResultType<RouteSetV6AddRouteResponse, RouteSetError>,
>(
(route,),
0x67a2bd2ee34ace2e,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.did_add))
}
pub fn r#remove_route(
&self,
mut route: &fidl_fuchsia_net_routes::RouteV6,
___deadline: zx::Time,
) -> Result<RouteSetV6RemoveRouteResult, fidl::Error> {
let _response = self.client.send_query::<
RouteSetV6RemoveRouteRequest,
fidl::encoding::ResultType<RouteSetV6RemoveRouteResponse, RouteSetError>,
>(
(route,),
0x4e5b7d4b1112cd82,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.did_remove))
}
}
#[derive(Debug, Clone)]
pub struct RouteSetV6Proxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for RouteSetV6Proxy {
type Protocol = RouteSetV6Marker;
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 RouteSetV6Proxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <RouteSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RouteSetV6EventStream {
RouteSetV6EventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#authenticate_for_interface(
&self,
mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
) -> fidl::client::QueryResponseFut<RouteSetV6AuthenticateForInterfaceResult> {
RouteSetV6ProxyInterface::r#authenticate_for_interface(self, credential)
}
pub fn r#add_route(
&self,
mut route: &fidl_fuchsia_net_routes::RouteV6,
) -> fidl::client::QueryResponseFut<RouteSetV6AddRouteResult> {
RouteSetV6ProxyInterface::r#add_route(self, route)
}
pub fn r#remove_route(
&self,
mut route: &fidl_fuchsia_net_routes::RouteV6,
) -> fidl::client::QueryResponseFut<RouteSetV6RemoveRouteResult> {
RouteSetV6ProxyInterface::r#remove_route(self, route)
}
}
impl RouteSetV6ProxyInterface for RouteSetV6Proxy {
type AuthenticateForInterfaceResponseFut =
fidl::client::QueryResponseFut<RouteSetV6AuthenticateForInterfaceResult>;
fn r#authenticate_for_interface(
&self,
mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
) -> Self::AuthenticateForInterfaceResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RouteSetV6AuthenticateForInterfaceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
AuthenticateForInterfaceError,
>,
0x7d63a6a7aed6f640,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
RouteSetV6AuthenticateForInterfaceRequest,
RouteSetV6AuthenticateForInterfaceResult,
>(
(&mut credential,),
0x7d63a6a7aed6f640,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AddRouteResponseFut = fidl::client::QueryResponseFut<RouteSetV6AddRouteResult>;
fn r#add_route(
&self,
mut route: &fidl_fuchsia_net_routes::RouteV6,
) -> Self::AddRouteResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RouteSetV6AddRouteResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<RouteSetV6AddRouteResponse, RouteSetError>,
0x67a2bd2ee34ace2e,
>(_buf?)?;
Ok(_response.map(|x| x.did_add))
}
self.client.send_query_and_decode::<RouteSetV6AddRouteRequest, RouteSetV6AddRouteResult>(
(route,),
0x67a2bd2ee34ace2e,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type RemoveRouteResponseFut = fidl::client::QueryResponseFut<RouteSetV6RemoveRouteResult>;
fn r#remove_route(
&self,
mut route: &fidl_fuchsia_net_routes::RouteV6,
) -> Self::RemoveRouteResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RouteSetV6RemoveRouteResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<RouteSetV6RemoveRouteResponse, RouteSetError>,
0x4e5b7d4b1112cd82,
>(_buf?)?;
Ok(_response.map(|x| x.did_remove))
}
self.client
.send_query_and_decode::<RouteSetV6RemoveRouteRequest, RouteSetV6RemoveRouteResult>(
(route,),
0x4e5b7d4b1112cd82,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct RouteSetV6EventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for RouteSetV6EventStream {}
impl futures::stream::FusedStream for RouteSetV6EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RouteSetV6EventStream {
type Item = Result<RouteSetV6Event, 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(RouteSetV6Event::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RouteSetV6Event {}
impl RouteSetV6Event {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<RouteSetV6Event, 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: <RouteSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RouteSetV6RequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for RouteSetV6RequestStream {}
impl futures::stream::FusedStream for RouteSetV6RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RouteSetV6RequestStream {
type Protocol = RouteSetV6Marker;
type ControlHandle = RouteSetV6ControlHandle;
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 {
RouteSetV6ControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for RouteSetV6RequestStream {
type Item = Result<RouteSetV6Request, 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 RouteSetV6RequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x7d63a6a7aed6f640 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RouteSetV6AuthenticateForInterfaceRequest);
fidl::encoding::Decoder::decode_into::<
RouteSetV6AuthenticateForInterfaceRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle = RouteSetV6ControlHandle { inner: this.inner.clone() };
Ok(RouteSetV6Request::AuthenticateForInterface {
credential: req.credential,
responder: RouteSetV6AuthenticateForInterfaceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x67a2bd2ee34ace2e => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RouteSetV6AddRouteRequest);
fidl::encoding::Decoder::decode_into::<RouteSetV6AddRouteRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RouteSetV6ControlHandle { inner: this.inner.clone() };
Ok(RouteSetV6Request::AddRoute {
route: req.route,
responder: RouteSetV6AddRouteResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x4e5b7d4b1112cd82 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RouteSetV6RemoveRouteRequest);
fidl::encoding::Decoder::decode_into::<RouteSetV6RemoveRouteRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RouteSetV6ControlHandle { inner: this.inner.clone() };
Ok(RouteSetV6Request::RemoveRoute {
route: req.route,
responder: RouteSetV6RemoveRouteResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<RouteSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum RouteSetV6Request {
AuthenticateForInterface {
credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
responder: RouteSetV6AuthenticateForInterfaceResponder,
},
AddRoute { route: fidl_fuchsia_net_routes::RouteV6, responder: RouteSetV6AddRouteResponder },
RemoveRoute {
route: fidl_fuchsia_net_routes::RouteV6,
responder: RouteSetV6RemoveRouteResponder,
},
}
impl RouteSetV6Request {
#[allow(irrefutable_let_patterns)]
pub fn into_authenticate_for_interface(
self,
) -> Option<(
fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
RouteSetV6AuthenticateForInterfaceResponder,
)> {
if let RouteSetV6Request::AuthenticateForInterface { credential, responder } = self {
Some((credential, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add_route(
self,
) -> Option<(fidl_fuchsia_net_routes::RouteV6, RouteSetV6AddRouteResponder)> {
if let RouteSetV6Request::AddRoute { route, responder } = self {
Some((route, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_remove_route(
self,
) -> Option<(fidl_fuchsia_net_routes::RouteV6, RouteSetV6RemoveRouteResponder)> {
if let RouteSetV6Request::RemoveRoute { route, responder } = self {
Some((route, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RouteSetV6Request::AuthenticateForInterface { .. } => "authenticate_for_interface",
RouteSetV6Request::AddRoute { .. } => "add_route",
RouteSetV6Request::RemoveRoute { .. } => "remove_route",
}
}
}
#[derive(Debug, Clone)]
pub struct RouteSetV6ControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for RouteSetV6ControlHandle {
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()
}
}
impl RouteSetV6ControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RouteSetV6AuthenticateForInterfaceResponder {
control_handle: std::mem::ManuallyDrop<RouteSetV6ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RouteSetV6AuthenticateForInterfaceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RouteSetV6AuthenticateForInterfaceResponder {
type ControlHandle = RouteSetV6ControlHandle;
fn control_handle(&self) -> &RouteSetV6ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RouteSetV6AuthenticateForInterfaceResponder {
pub fn send(
self,
mut result: Result<(), AuthenticateForInterfaceError>,
) -> 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<(), AuthenticateForInterfaceError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), AuthenticateForInterfaceError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
AuthenticateForInterfaceError,
>>(
result,
self.tx_id,
0x7d63a6a7aed6f640,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RouteSetV6AddRouteResponder {
control_handle: std::mem::ManuallyDrop<RouteSetV6ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RouteSetV6AddRouteResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RouteSetV6AddRouteResponder {
type ControlHandle = RouteSetV6ControlHandle;
fn control_handle(&self) -> &RouteSetV6ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RouteSetV6AddRouteResponder {
pub fn send(self, mut result: Result<bool, RouteSetError>) -> 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<bool, RouteSetError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
RouteSetV6AddRouteResponse,
RouteSetError,
>>(
result.map(|did_add| (did_add,)),
self.tx_id,
0x67a2bd2ee34ace2e,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RouteSetV6RemoveRouteResponder {
control_handle: std::mem::ManuallyDrop<RouteSetV6ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RouteSetV6RemoveRouteResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RouteSetV6RemoveRouteResponder {
type ControlHandle = RouteSetV6ControlHandle;
fn control_handle(&self) -> &RouteSetV6ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RouteSetV6RemoveRouteResponder {
pub fn send(self, mut result: Result<bool, RouteSetError>) -> 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<bool, RouteSetError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<bool, RouteSetError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
RouteSetV6RemoveRouteResponse,
RouteSetError,
>>(
result.map(|did_remove| (did_remove,)),
self.tx_id,
0x4e5b7d4b1112cd82,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RouteTableProviderV4Marker;
impl fidl::endpoints::ProtocolMarker for RouteTableProviderV4Marker {
type Proxy = RouteTableProviderV4Proxy;
type RequestStream = RouteTableProviderV4RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RouteTableProviderV4SynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableProviderV4";
}
impl fidl::endpoints::DiscoverableProtocolMarker for RouteTableProviderV4Marker {}
pub trait RouteTableProviderV4ProxyInterface: Send + Sync {
fn r#new_route_table(
&self,
provider: fidl::endpoints::ServerEnd<RouteTableV4Marker>,
options: &RouteTableOptionsV4,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RouteTableProviderV4SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RouteTableProviderV4SynchronousProxy {
type Proxy = RouteTableProviderV4Proxy;
type Protocol = RouteTableProviderV4Marker;
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 RouteTableProviderV4SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<RouteTableProviderV4Marker 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::Time,
) -> Result<RouteTableProviderV4Event, fidl::Error> {
RouteTableProviderV4Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#new_route_table(
&self,
mut provider: fidl::endpoints::ServerEnd<RouteTableV4Marker>,
mut options: &RouteTableOptionsV4,
) -> Result<(), fidl::Error> {
self.client.send::<RouteTableProviderV4NewRouteTableRequest>(
(provider, options),
0x703bc0eaf98f07cf,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct RouteTableProviderV4Proxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for RouteTableProviderV4Proxy {
type Protocol = RouteTableProviderV4Marker;
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 RouteTableProviderV4Proxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name =
<RouteTableProviderV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RouteTableProviderV4EventStream {
RouteTableProviderV4EventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#new_route_table(
&self,
mut provider: fidl::endpoints::ServerEnd<RouteTableV4Marker>,
mut options: &RouteTableOptionsV4,
) -> Result<(), fidl::Error> {
RouteTableProviderV4ProxyInterface::r#new_route_table(self, provider, options)
}
}
impl RouteTableProviderV4ProxyInterface for RouteTableProviderV4Proxy {
fn r#new_route_table(
&self,
mut provider: fidl::endpoints::ServerEnd<RouteTableV4Marker>,
mut options: &RouteTableOptionsV4,
) -> Result<(), fidl::Error> {
self.client.send::<RouteTableProviderV4NewRouteTableRequest>(
(provider, options),
0x703bc0eaf98f07cf,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct RouteTableProviderV4EventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for RouteTableProviderV4EventStream {}
impl futures::stream::FusedStream for RouteTableProviderV4EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RouteTableProviderV4EventStream {
type Item = Result<RouteTableProviderV4Event, 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(RouteTableProviderV4Event::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RouteTableProviderV4Event {}
impl RouteTableProviderV4Event {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<RouteTableProviderV4Event, 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:
<RouteTableProviderV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RouteTableProviderV4RequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for RouteTableProviderV4RequestStream {}
impl futures::stream::FusedStream for RouteTableProviderV4RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RouteTableProviderV4RequestStream {
type Protocol = RouteTableProviderV4Marker;
type ControlHandle = RouteTableProviderV4ControlHandle;
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 {
RouteTableProviderV4ControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for RouteTableProviderV4RequestStream {
type Item = Result<RouteTableProviderV4Request, 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 RouteTableProviderV4RequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x703bc0eaf98f07cf => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(RouteTableProviderV4NewRouteTableRequest);
fidl::encoding::Decoder::decode_into::<RouteTableProviderV4NewRouteTableRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
RouteTableProviderV4ControlHandle { inner: this.inner.clone() };
Ok(RouteTableProviderV4Request::NewRouteTable {
provider: req.provider,
options: req.options,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<RouteTableProviderV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum RouteTableProviderV4Request {
NewRouteTable {
provider: fidl::endpoints::ServerEnd<RouteTableV4Marker>,
options: RouteTableOptionsV4,
control_handle: RouteTableProviderV4ControlHandle,
},
}
impl RouteTableProviderV4Request {
#[allow(irrefutable_let_patterns)]
pub fn into_new_route_table(
self,
) -> Option<(
fidl::endpoints::ServerEnd<RouteTableV4Marker>,
RouteTableOptionsV4,
RouteTableProviderV4ControlHandle,
)> {
if let RouteTableProviderV4Request::NewRouteTable { provider, options, control_handle } =
self
{
Some((provider, options, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RouteTableProviderV4Request::NewRouteTable { .. } => "new_route_table",
}
}
}
#[derive(Debug, Clone)]
pub struct RouteTableProviderV4ControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for RouteTableProviderV4ControlHandle {
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()
}
}
impl RouteTableProviderV4ControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RouteTableProviderV6Marker;
impl fidl::endpoints::ProtocolMarker for RouteTableProviderV6Marker {
type Proxy = RouteTableProviderV6Proxy;
type RequestStream = RouteTableProviderV6RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RouteTableProviderV6SynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableProviderV6";
}
impl fidl::endpoints::DiscoverableProtocolMarker for RouteTableProviderV6Marker {}
pub trait RouteTableProviderV6ProxyInterface: Send + Sync {
fn r#new_route_table(
&self,
provider: fidl::endpoints::ServerEnd<RouteTableV6Marker>,
options: &RouteTableOptionsV6,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RouteTableProviderV6SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RouteTableProviderV6SynchronousProxy {
type Proxy = RouteTableProviderV6Proxy;
type Protocol = RouteTableProviderV6Marker;
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 RouteTableProviderV6SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<RouteTableProviderV6Marker 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::Time,
) -> Result<RouteTableProviderV6Event, fidl::Error> {
RouteTableProviderV6Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#new_route_table(
&self,
mut provider: fidl::endpoints::ServerEnd<RouteTableV6Marker>,
mut options: &RouteTableOptionsV6,
) -> Result<(), fidl::Error> {
self.client.send::<RouteTableProviderV6NewRouteTableRequest>(
(provider, options),
0x152b67b397a31ca,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct RouteTableProviderV6Proxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for RouteTableProviderV6Proxy {
type Protocol = RouteTableProviderV6Marker;
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 RouteTableProviderV6Proxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name =
<RouteTableProviderV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RouteTableProviderV6EventStream {
RouteTableProviderV6EventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#new_route_table(
&self,
mut provider: fidl::endpoints::ServerEnd<RouteTableV6Marker>,
mut options: &RouteTableOptionsV6,
) -> Result<(), fidl::Error> {
RouteTableProviderV6ProxyInterface::r#new_route_table(self, provider, options)
}
}
impl RouteTableProviderV6ProxyInterface for RouteTableProviderV6Proxy {
fn r#new_route_table(
&self,
mut provider: fidl::endpoints::ServerEnd<RouteTableV6Marker>,
mut options: &RouteTableOptionsV6,
) -> Result<(), fidl::Error> {
self.client.send::<RouteTableProviderV6NewRouteTableRequest>(
(provider, options),
0x152b67b397a31ca,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct RouteTableProviderV6EventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for RouteTableProviderV6EventStream {}
impl futures::stream::FusedStream for RouteTableProviderV6EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RouteTableProviderV6EventStream {
type Item = Result<RouteTableProviderV6Event, 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(RouteTableProviderV6Event::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RouteTableProviderV6Event {}
impl RouteTableProviderV6Event {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<RouteTableProviderV6Event, 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:
<RouteTableProviderV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RouteTableProviderV6RequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for RouteTableProviderV6RequestStream {}
impl futures::stream::FusedStream for RouteTableProviderV6RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RouteTableProviderV6RequestStream {
type Protocol = RouteTableProviderV6Marker;
type ControlHandle = RouteTableProviderV6ControlHandle;
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 {
RouteTableProviderV6ControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for RouteTableProviderV6RequestStream {
type Item = Result<RouteTableProviderV6Request, 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 RouteTableProviderV6RequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x152b67b397a31ca => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(RouteTableProviderV6NewRouteTableRequest);
fidl::encoding::Decoder::decode_into::<RouteTableProviderV6NewRouteTableRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle =
RouteTableProviderV6ControlHandle { inner: this.inner.clone() };
Ok(RouteTableProviderV6Request::NewRouteTable {
provider: req.provider,
options: req.options,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<RouteTableProviderV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum RouteTableProviderV6Request {
NewRouteTable {
provider: fidl::endpoints::ServerEnd<RouteTableV6Marker>,
options: RouteTableOptionsV6,
control_handle: RouteTableProviderV6ControlHandle,
},
}
impl RouteTableProviderV6Request {
#[allow(irrefutable_let_patterns)]
pub fn into_new_route_table(
self,
) -> Option<(
fidl::endpoints::ServerEnd<RouteTableV6Marker>,
RouteTableOptionsV6,
RouteTableProviderV6ControlHandle,
)> {
if let RouteTableProviderV6Request::NewRouteTable { provider, options, control_handle } =
self
{
Some((provider, options, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RouteTableProviderV6Request::NewRouteTable { .. } => "new_route_table",
}
}
}
#[derive(Debug, Clone)]
pub struct RouteTableProviderV6ControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for RouteTableProviderV6ControlHandle {
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()
}
}
impl RouteTableProviderV6ControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RouteTableV4Marker;
impl fidl::endpoints::ProtocolMarker for RouteTableV4Marker {
type Proxy = RouteTableV4Proxy;
type RequestStream = RouteTableV4RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RouteTableV4SynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableV4";
}
impl fidl::endpoints::DiscoverableProtocolMarker for RouteTableV4Marker {}
pub trait RouteTableV4ProxyInterface: Send + Sync {
type GetTableIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
fn r#get_table_id(&self) -> Self::GetTableIdResponseFut;
fn r#detach(&self) -> Result<(), fidl::Error>;
type RemoveResponseFut: std::future::Future<Output = Result<BaseRouteTableRemoveResult, fidl::Error>>
+ Send;
fn r#remove(&self) -> Self::RemoveResponseFut;
type GetAuthorizationForRouteTableResponseFut: std::future::Future<Output = Result<(u32, fidl::Event), fidl::Error>>
+ Send;
fn r#get_authorization_for_route_table(&self)
-> Self::GetAuthorizationForRouteTableResponseFut;
fn r#new_route_set(
&self,
route_set: fidl::endpoints::ServerEnd<RouteSetV4Marker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RouteTableV4SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RouteTableV4SynchronousProxy {
type Proxy = RouteTableV4Proxy;
type Protocol = RouteTableV4Marker;
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 RouteTableV4SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <RouteTableV4Marker 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::Time) -> Result<RouteTableV4Event, fidl::Error> {
RouteTableV4Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_table_id(&self, ___deadline: zx::Time) -> Result<u32, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, BaseRouteTableGetTableIdResponse>(
(),
0x7eab30c55edbfc15,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.table_id)
}
pub fn r#detach(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x2853ab157285b384,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#remove(
&self,
___deadline: zx::Time,
) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
BaseRouteTableRemoveError,
>>(
(),
0xc42e58a5fc79426,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_authorization_for_route_table(
&self,
___deadline: zx::Time,
) -> Result<(u32, fidl::Event), fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, GrantForRouteTableAuthorization>(
(),
0x56a48c921ff3b6eb,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.table_id, _response.token))
}
pub fn r#new_route_set(
&self,
mut route_set: fidl::endpoints::ServerEnd<RouteSetV4Marker>,
) -> Result<(), fidl::Error> {
self.client.send::<RouteTableV4NewRouteSetRequest>(
(route_set,),
0x6aeb6d05698abedb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct RouteTableV4Proxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for RouteTableV4Proxy {
type Protocol = RouteTableV4Marker;
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 RouteTableV4Proxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <RouteTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RouteTableV4EventStream {
RouteTableV4EventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_table_id(&self) -> fidl::client::QueryResponseFut<u32> {
RouteTableV4ProxyInterface::r#get_table_id(self)
}
pub fn r#detach(&self) -> Result<(), fidl::Error> {
RouteTableV4ProxyInterface::r#detach(self)
}
pub fn r#remove(&self) -> fidl::client::QueryResponseFut<BaseRouteTableRemoveResult> {
RouteTableV4ProxyInterface::r#remove(self)
}
pub fn r#get_authorization_for_route_table(
&self,
) -> fidl::client::QueryResponseFut<(u32, fidl::Event)> {
RouteTableV4ProxyInterface::r#get_authorization_for_route_table(self)
}
pub fn r#new_route_set(
&self,
mut route_set: fidl::endpoints::ServerEnd<RouteSetV4Marker>,
) -> Result<(), fidl::Error> {
RouteTableV4ProxyInterface::r#new_route_set(self, route_set)
}
}
impl RouteTableV4ProxyInterface for RouteTableV4Proxy {
type GetTableIdResponseFut = fidl::client::QueryResponseFut<u32>;
fn r#get_table_id(&self) -> Self::GetTableIdResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<u32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
BaseRouteTableGetTableIdResponse,
0x7eab30c55edbfc15,
>(_buf?)?;
Ok(_response.table_id)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
(),
0x7eab30c55edbfc15,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#detach(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x2853ab157285b384,
fidl::encoding::DynamicFlags::empty(),
)
}
type RemoveResponseFut = fidl::client::QueryResponseFut<BaseRouteTableRemoveResult>;
fn r#remove(&self) -> Self::RemoveResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BaseRouteTableRemoveError>,
0xc42e58a5fc79426,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, BaseRouteTableRemoveResult>(
(),
0xc42e58a5fc79426,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetAuthorizationForRouteTableResponseFut =
fidl::client::QueryResponseFut<(u32, fidl::Event)>;
fn r#get_authorization_for_route_table(
&self,
) -> Self::GetAuthorizationForRouteTableResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<(u32, fidl::Event), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
GrantForRouteTableAuthorization,
0x56a48c921ff3b6eb,
>(_buf?)?;
Ok((_response.table_id, _response.token))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (u32, fidl::Event)>(
(),
0x56a48c921ff3b6eb,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#new_route_set(
&self,
mut route_set: fidl::endpoints::ServerEnd<RouteSetV4Marker>,
) -> Result<(), fidl::Error> {
self.client.send::<RouteTableV4NewRouteSetRequest>(
(route_set,),
0x6aeb6d05698abedb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct RouteTableV4EventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for RouteTableV4EventStream {}
impl futures::stream::FusedStream for RouteTableV4EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RouteTableV4EventStream {
type Item = Result<RouteTableV4Event, 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(RouteTableV4Event::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RouteTableV4Event {}
impl RouteTableV4Event {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<RouteTableV4Event, 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: <RouteTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RouteTableV4RequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for RouteTableV4RequestStream {}
impl futures::stream::FusedStream for RouteTableV4RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RouteTableV4RequestStream {
type Protocol = RouteTableV4Marker;
type ControlHandle = RouteTableV4ControlHandle;
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 {
RouteTableV4ControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for RouteTableV4RequestStream {
type Item = Result<RouteTableV4Request, 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 RouteTableV4RequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x7eab30c55edbfc15 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RouteTableV4ControlHandle { inner: this.inner.clone() };
Ok(RouteTableV4Request::GetTableId {
responder: RouteTableV4GetTableIdResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2853ab157285b384 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RouteTableV4ControlHandle { inner: this.inner.clone() };
Ok(RouteTableV4Request::Detach { control_handle })
}
0xc42e58a5fc79426 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RouteTableV4ControlHandle { inner: this.inner.clone() };
Ok(RouteTableV4Request::Remove {
responder: RouteTableV4RemoveResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x56a48c921ff3b6eb => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RouteTableV4ControlHandle { inner: this.inner.clone() };
Ok(RouteTableV4Request::GetAuthorizationForRouteTable {
responder: RouteTableV4GetAuthorizationForRouteTableResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6aeb6d05698abedb => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(RouteTableV4NewRouteSetRequest);
fidl::encoding::Decoder::decode_into::<RouteTableV4NewRouteSetRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RouteTableV4ControlHandle { inner: this.inner.clone() };
Ok(RouteTableV4Request::NewRouteSet {
route_set: req.route_set,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<RouteTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum RouteTableV4Request {
GetTableId { responder: RouteTableV4GetTableIdResponder },
Detach { control_handle: RouteTableV4ControlHandle },
Remove { responder: RouteTableV4RemoveResponder },
GetAuthorizationForRouteTable { responder: RouteTableV4GetAuthorizationForRouteTableResponder },
NewRouteSet {
route_set: fidl::endpoints::ServerEnd<RouteSetV4Marker>,
control_handle: RouteTableV4ControlHandle,
},
}
impl RouteTableV4Request {
#[allow(irrefutable_let_patterns)]
pub fn into_get_table_id(self) -> Option<(RouteTableV4GetTableIdResponder)> {
if let RouteTableV4Request::GetTableId { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_detach(self) -> Option<(RouteTableV4ControlHandle)> {
if let RouteTableV4Request::Detach { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_remove(self) -> Option<(RouteTableV4RemoveResponder)> {
if let RouteTableV4Request::Remove { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_authorization_for_route_table(
self,
) -> Option<(RouteTableV4GetAuthorizationForRouteTableResponder)> {
if let RouteTableV4Request::GetAuthorizationForRouteTable { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_new_route_set(
self,
) -> Option<(fidl::endpoints::ServerEnd<RouteSetV4Marker>, RouteTableV4ControlHandle)> {
if let RouteTableV4Request::NewRouteSet { route_set, control_handle } = self {
Some((route_set, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RouteTableV4Request::GetTableId { .. } => "get_table_id",
RouteTableV4Request::Detach { .. } => "detach",
RouteTableV4Request::Remove { .. } => "remove",
RouteTableV4Request::GetAuthorizationForRouteTable { .. } => {
"get_authorization_for_route_table"
}
RouteTableV4Request::NewRouteSet { .. } => "new_route_set",
}
}
}
#[derive(Debug, Clone)]
pub struct RouteTableV4ControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for RouteTableV4ControlHandle {
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()
}
}
impl RouteTableV4ControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RouteTableV4GetTableIdResponder {
control_handle: std::mem::ManuallyDrop<RouteTableV4ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RouteTableV4GetTableIdResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RouteTableV4GetTableIdResponder {
type ControlHandle = RouteTableV4ControlHandle;
fn control_handle(&self) -> &RouteTableV4ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RouteTableV4GetTableIdResponder {
pub fn send(self, mut table_id: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(table_id);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut table_id: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(table_id);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut table_id: u32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<BaseRouteTableGetTableIdResponse>(
(table_id,),
self.tx_id,
0x7eab30c55edbfc15,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RouteTableV4RemoveResponder {
control_handle: std::mem::ManuallyDrop<RouteTableV4ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RouteTableV4RemoveResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RouteTableV4RemoveResponder {
type ControlHandle = RouteTableV4ControlHandle;
fn control_handle(&self) -> &RouteTableV4ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RouteTableV4RemoveResponder {
pub fn send(
self,
mut result: Result<(), BaseRouteTableRemoveError>,
) -> 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<(), BaseRouteTableRemoveError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), BaseRouteTableRemoveError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
BaseRouteTableRemoveError,
>>(
result,
self.tx_id,
0xc42e58a5fc79426,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RouteTableV4GetAuthorizationForRouteTableResponder {
control_handle: std::mem::ManuallyDrop<RouteTableV4ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RouteTableV4GetAuthorizationForRouteTableResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RouteTableV4GetAuthorizationForRouteTableResponder {
type ControlHandle = RouteTableV4ControlHandle;
fn control_handle(&self) -> &RouteTableV4ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RouteTableV4GetAuthorizationForRouteTableResponder {
pub fn send(self, mut table_id: u32, mut token: fidl::Event) -> Result<(), fidl::Error> {
let _result = self.send_raw(table_id, token);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut table_id: u32,
mut token: fidl::Event,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(table_id, token);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut table_id: u32, mut token: fidl::Event) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<GrantForRouteTableAuthorization>(
(table_id, token),
self.tx_id,
0x56a48c921ff3b6eb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RouteTableV6Marker;
impl fidl::endpoints::ProtocolMarker for RouteTableV6Marker {
type Proxy = RouteTableV6Proxy;
type RequestStream = RouteTableV6RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RouteTableV6SynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RouteTableV6";
}
impl fidl::endpoints::DiscoverableProtocolMarker for RouteTableV6Marker {}
pub trait RouteTableV6ProxyInterface: Send + Sync {
type GetTableIdResponseFut: std::future::Future<Output = Result<u32, fidl::Error>> + Send;
fn r#get_table_id(&self) -> Self::GetTableIdResponseFut;
fn r#detach(&self) -> Result<(), fidl::Error>;
type RemoveResponseFut: std::future::Future<Output = Result<BaseRouteTableRemoveResult, fidl::Error>>
+ Send;
fn r#remove(&self) -> Self::RemoveResponseFut;
type GetAuthorizationForRouteTableResponseFut: std::future::Future<Output = Result<(u32, fidl::Event), fidl::Error>>
+ Send;
fn r#get_authorization_for_route_table(&self)
-> Self::GetAuthorizationForRouteTableResponseFut;
fn r#new_route_set(
&self,
route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RouteTableV6SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RouteTableV6SynchronousProxy {
type Proxy = RouteTableV6Proxy;
type Protocol = RouteTableV6Marker;
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 RouteTableV6SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <RouteTableV6Marker 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::Time) -> Result<RouteTableV6Event, fidl::Error> {
RouteTableV6Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#get_table_id(&self, ___deadline: zx::Time) -> Result<u32, fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, BaseRouteTableGetTableIdResponse>(
(),
0x7eab30c55edbfc15,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.table_id)
}
pub fn r#detach(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x2853ab157285b384,
fidl::encoding::DynamicFlags::empty(),
)
}
pub fn r#remove(
&self,
___deadline: zx::Time,
) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
let _response =
self.client.send_query::<fidl::encoding::EmptyPayload, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
BaseRouteTableRemoveError,
>>(
(),
0xc42e58a5fc79426,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_authorization_for_route_table(
&self,
___deadline: zx::Time,
) -> Result<(u32, fidl::Event), fidl::Error> {
let _response = self
.client
.send_query::<fidl::encoding::EmptyPayload, GrantForRouteTableAuthorization>(
(),
0x56a48c921ff3b6eb,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((_response.table_id, _response.token))
}
pub fn r#new_route_set(
&self,
mut route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
) -> Result<(), fidl::Error> {
self.client.send::<RouteTableV6NewRouteSetRequest>(
(route_set,),
0x479aeaf9ad470141,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct RouteTableV6Proxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for RouteTableV6Proxy {
type Protocol = RouteTableV6Marker;
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 RouteTableV6Proxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <RouteTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RouteTableV6EventStream {
RouteTableV6EventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#get_table_id(&self) -> fidl::client::QueryResponseFut<u32> {
RouteTableV6ProxyInterface::r#get_table_id(self)
}
pub fn r#detach(&self) -> Result<(), fidl::Error> {
RouteTableV6ProxyInterface::r#detach(self)
}
pub fn r#remove(&self) -> fidl::client::QueryResponseFut<BaseRouteTableRemoveResult> {
RouteTableV6ProxyInterface::r#remove(self)
}
pub fn r#get_authorization_for_route_table(
&self,
) -> fidl::client::QueryResponseFut<(u32, fidl::Event)> {
RouteTableV6ProxyInterface::r#get_authorization_for_route_table(self)
}
pub fn r#new_route_set(
&self,
mut route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
) -> Result<(), fidl::Error> {
RouteTableV6ProxyInterface::r#new_route_set(self, route_set)
}
}
impl RouteTableV6ProxyInterface for RouteTableV6Proxy {
type GetTableIdResponseFut = fidl::client::QueryResponseFut<u32>;
fn r#get_table_id(&self) -> Self::GetTableIdResponseFut {
fn _decode(mut _buf: Result<fidl::MessageBufEtc, fidl::Error>) -> Result<u32, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
BaseRouteTableGetTableIdResponse,
0x7eab30c55edbfc15,
>(_buf?)?;
Ok(_response.table_id)
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, u32>(
(),
0x7eab30c55edbfc15,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#detach(&self) -> Result<(), fidl::Error> {
self.client.send::<fidl::encoding::EmptyPayload>(
(),
0x2853ab157285b384,
fidl::encoding::DynamicFlags::empty(),
)
}
type RemoveResponseFut = fidl::client::QueryResponseFut<BaseRouteTableRemoveResult>;
fn r#remove(&self) -> Self::RemoveResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<BaseRouteTableRemoveResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, BaseRouteTableRemoveError>,
0xc42e58a5fc79426,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<fidl::encoding::EmptyPayload, BaseRouteTableRemoveResult>(
(),
0xc42e58a5fc79426,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetAuthorizationForRouteTableResponseFut =
fidl::client::QueryResponseFut<(u32, fidl::Event)>;
fn r#get_authorization_for_route_table(
&self,
) -> Self::GetAuthorizationForRouteTableResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<(u32, fidl::Event), fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
GrantForRouteTableAuthorization,
0x56a48c921ff3b6eb,
>(_buf?)?;
Ok((_response.table_id, _response.token))
}
self.client.send_query_and_decode::<fidl::encoding::EmptyPayload, (u32, fidl::Event)>(
(),
0x56a48c921ff3b6eb,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
fn r#new_route_set(
&self,
mut route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
) -> Result<(), fidl::Error> {
self.client.send::<RouteTableV6NewRouteSetRequest>(
(route_set,),
0x479aeaf9ad470141,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct RouteTableV6EventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for RouteTableV6EventStream {}
impl futures::stream::FusedStream for RouteTableV6EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RouteTableV6EventStream {
type Item = Result<RouteTableV6Event, 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(RouteTableV6Event::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RouteTableV6Event {}
impl RouteTableV6Event {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<RouteTableV6Event, 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: <RouteTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RouteTableV6RequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for RouteTableV6RequestStream {}
impl futures::stream::FusedStream for RouteTableV6RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RouteTableV6RequestStream {
type Protocol = RouteTableV6Marker;
type ControlHandle = RouteTableV6ControlHandle;
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 {
RouteTableV6ControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for RouteTableV6RequestStream {
type Item = Result<RouteTableV6Request, 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 RouteTableV6RequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x7eab30c55edbfc15 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RouteTableV6ControlHandle { inner: this.inner.clone() };
Ok(RouteTableV6Request::GetTableId {
responder: RouteTableV6GetTableIdResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2853ab157285b384 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RouteTableV6ControlHandle { inner: this.inner.clone() };
Ok(RouteTableV6Request::Detach { control_handle })
}
0xc42e58a5fc79426 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RouteTableV6ControlHandle { inner: this.inner.clone() };
Ok(RouteTableV6Request::Remove {
responder: RouteTableV6RemoveResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x56a48c921ff3b6eb => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload);
fidl::encoding::Decoder::decode_into::<fidl::encoding::EmptyPayload>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RouteTableV6ControlHandle { inner: this.inner.clone() };
Ok(RouteTableV6Request::GetAuthorizationForRouteTable {
responder: RouteTableV6GetAuthorizationForRouteTableResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x479aeaf9ad470141 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(RouteTableV6NewRouteSetRequest);
fidl::encoding::Decoder::decode_into::<RouteTableV6NewRouteSetRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RouteTableV6ControlHandle { inner: this.inner.clone() };
Ok(RouteTableV6Request::NewRouteSet {
route_set: req.route_set,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<RouteTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum RouteTableV6Request {
GetTableId { responder: RouteTableV6GetTableIdResponder },
Detach { control_handle: RouteTableV6ControlHandle },
Remove { responder: RouteTableV6RemoveResponder },
GetAuthorizationForRouteTable { responder: RouteTableV6GetAuthorizationForRouteTableResponder },
NewRouteSet {
route_set: fidl::endpoints::ServerEnd<RouteSetV6Marker>,
control_handle: RouteTableV6ControlHandle,
},
}
impl RouteTableV6Request {
#[allow(irrefutable_let_patterns)]
pub fn into_get_table_id(self) -> Option<(RouteTableV6GetTableIdResponder)> {
if let RouteTableV6Request::GetTableId { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_detach(self) -> Option<(RouteTableV6ControlHandle)> {
if let RouteTableV6Request::Detach { control_handle } = self {
Some((control_handle))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_remove(self) -> Option<(RouteTableV6RemoveResponder)> {
if let RouteTableV6Request::Remove { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_authorization_for_route_table(
self,
) -> Option<(RouteTableV6GetAuthorizationForRouteTableResponder)> {
if let RouteTableV6Request::GetAuthorizationForRouteTable { responder } = self {
Some((responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_new_route_set(
self,
) -> Option<(fidl::endpoints::ServerEnd<RouteSetV6Marker>, RouteTableV6ControlHandle)> {
if let RouteTableV6Request::NewRouteSet { route_set, control_handle } = self {
Some((route_set, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RouteTableV6Request::GetTableId { .. } => "get_table_id",
RouteTableV6Request::Detach { .. } => "detach",
RouteTableV6Request::Remove { .. } => "remove",
RouteTableV6Request::GetAuthorizationForRouteTable { .. } => {
"get_authorization_for_route_table"
}
RouteTableV6Request::NewRouteSet { .. } => "new_route_set",
}
}
}
#[derive(Debug, Clone)]
pub struct RouteTableV6ControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for RouteTableV6ControlHandle {
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()
}
}
impl RouteTableV6ControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RouteTableV6GetTableIdResponder {
control_handle: std::mem::ManuallyDrop<RouteTableV6ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RouteTableV6GetTableIdResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RouteTableV6GetTableIdResponder {
type ControlHandle = RouteTableV6ControlHandle;
fn control_handle(&self) -> &RouteTableV6ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RouteTableV6GetTableIdResponder {
pub fn send(self, mut table_id: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(table_id);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(self, mut table_id: u32) -> Result<(), fidl::Error> {
let _result = self.send_raw(table_id);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut table_id: u32) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<BaseRouteTableGetTableIdResponse>(
(table_id,),
self.tx_id,
0x7eab30c55edbfc15,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RouteTableV6RemoveResponder {
control_handle: std::mem::ManuallyDrop<RouteTableV6ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RouteTableV6RemoveResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RouteTableV6RemoveResponder {
type ControlHandle = RouteTableV6ControlHandle;
fn control_handle(&self) -> &RouteTableV6ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RouteTableV6RemoveResponder {
pub fn send(
self,
mut result: Result<(), BaseRouteTableRemoveError>,
) -> 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<(), BaseRouteTableRemoveError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), BaseRouteTableRemoveError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
BaseRouteTableRemoveError,
>>(
result,
self.tx_id,
0xc42e58a5fc79426,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RouteTableV6GetAuthorizationForRouteTableResponder {
control_handle: std::mem::ManuallyDrop<RouteTableV6ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RouteTableV6GetAuthorizationForRouteTableResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RouteTableV6GetAuthorizationForRouteTableResponder {
type ControlHandle = RouteTableV6ControlHandle;
fn control_handle(&self) -> &RouteTableV6ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RouteTableV6GetAuthorizationForRouteTableResponder {
pub fn send(self, mut table_id: u32, mut token: fidl::Event) -> Result<(), fidl::Error> {
let _result = self.send_raw(table_id, token);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut table_id: u32,
mut token: fidl::Event,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(table_id, token);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut table_id: u32, mut token: fidl::Event) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<GrantForRouteTableAuthorization>(
(table_id, token),
self.tx_id,
0x56a48c921ff3b6eb,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RuleSetV4Marker;
impl fidl::endpoints::ProtocolMarker for RuleSetV4Marker {
type Proxy = RuleSetV4Proxy;
type RequestStream = RuleSetV4RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RuleSetV4SynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) RuleSetV4";
}
pub type RuleSetV4AddRuleResult = Result<(), RuleSetError>;
pub trait RuleSetV4ProxyInterface: Send + Sync {
type AuthenticateForRouteTableResponseFut: std::future::Future<
Output = Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error>,
> + Send;
fn r#authenticate_for_route_table(
&self,
table: u32,
token: fidl::Event,
) -> Self::AuthenticateForRouteTableResponseFut;
type AuthenticateForInterfaceResponseFut: std::future::Future<Output = Result<BaseRuleSetAuthenticateForInterfaceResult, fidl::Error>>
+ Send;
fn r#authenticate_for_interface(
&self,
credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
) -> Self::AuthenticateForInterfaceResponseFut;
type RemoveRuleResponseFut: std::future::Future<Output = Result<BaseRuleSetRemoveRuleResult, fidl::Error>>
+ Send;
fn r#remove_rule(&self, index: u32) -> Self::RemoveRuleResponseFut;
type AddRuleResponseFut: std::future::Future<Output = Result<RuleSetV4AddRuleResult, fidl::Error>>
+ Send;
fn r#add_rule(
&self,
index: u32,
selector: &fidl_fuchsia_net_routes::RuleSelectorV4,
action: &fidl_fuchsia_net_routes::RuleAction,
) -> Self::AddRuleResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RuleSetV4SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RuleSetV4SynchronousProxy {
type Proxy = RuleSetV4Proxy;
type Protocol = RuleSetV4Marker;
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 RuleSetV4SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <RuleSetV4Marker 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::Time) -> Result<RuleSetV4Event, fidl::Error> {
RuleSetV4Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#authenticate_for_route_table(
&self,
mut table: u32,
mut token: fidl::Event,
___deadline: zx::Time,
) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
let _response = self.client.send_query::<
ProofOfRouteTableAuthorization,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
>(
(table, token,),
0x6fd845360ed9bc8f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#authenticate_for_interface(
&self,
mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
___deadline: zx::Time,
) -> Result<BaseRuleSetAuthenticateForInterfaceResult, fidl::Error> {
let _response = self.client.send_query::<
BaseRuleSetAuthenticateForInterfaceRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
>(
(&mut credential,),
0x63f2f24c76ccab3d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#remove_rule(
&self,
mut index: u32,
___deadline: zx::Time,
) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
let _response = self.client.send_query::<
BaseRuleSetRemoveRuleRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
>(
(index,),
0x2ae3d7e817cbff90,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#add_rule(
&self,
mut index: u32,
mut selector: &fidl_fuchsia_net_routes::RuleSelectorV4,
mut action: &fidl_fuchsia_net_routes::RuleAction,
___deadline: zx::Time,
) -> Result<RuleSetV4AddRuleResult, fidl::Error> {
let _response = self.client.send_query::<
RuleSetV4AddRuleRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
>(
(index, selector, action,),
0x7f68325de94e80,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct RuleSetV4Proxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for RuleSetV4Proxy {
type Protocol = RuleSetV4Marker;
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 RuleSetV4Proxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <RuleSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RuleSetV4EventStream {
RuleSetV4EventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#authenticate_for_route_table(
&self,
mut table: u32,
mut token: fidl::Event,
) -> fidl::client::QueryResponseFut<BaseRuleSetAuthenticateForRouteTableResult> {
RuleSetV4ProxyInterface::r#authenticate_for_route_table(self, table, token)
}
pub fn r#authenticate_for_interface(
&self,
mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
) -> fidl::client::QueryResponseFut<BaseRuleSetAuthenticateForInterfaceResult> {
RuleSetV4ProxyInterface::r#authenticate_for_interface(self, credential)
}
pub fn r#remove_rule(
&self,
mut index: u32,
) -> fidl::client::QueryResponseFut<BaseRuleSetRemoveRuleResult> {
RuleSetV4ProxyInterface::r#remove_rule(self, index)
}
pub fn r#add_rule(
&self,
mut index: u32,
mut selector: &fidl_fuchsia_net_routes::RuleSelectorV4,
mut action: &fidl_fuchsia_net_routes::RuleAction,
) -> fidl::client::QueryResponseFut<RuleSetV4AddRuleResult> {
RuleSetV4ProxyInterface::r#add_rule(self, index, selector, action)
}
}
impl RuleSetV4ProxyInterface for RuleSetV4Proxy {
type AuthenticateForRouteTableResponseFut =
fidl::client::QueryResponseFut<BaseRuleSetAuthenticateForRouteTableResult>;
fn r#authenticate_for_route_table(
&self,
mut table: u32,
mut token: fidl::Event,
) -> Self::AuthenticateForRouteTableResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
0x6fd845360ed9bc8f,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
ProofOfRouteTableAuthorization,
BaseRuleSetAuthenticateForRouteTableResult,
>(
(table, token,),
0x6fd845360ed9bc8f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AuthenticateForInterfaceResponseFut =
fidl::client::QueryResponseFut<BaseRuleSetAuthenticateForInterfaceResult>;
fn r#authenticate_for_interface(
&self,
mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
) -> Self::AuthenticateForInterfaceResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<BaseRuleSetAuthenticateForInterfaceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
0x63f2f24c76ccab3d,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
BaseRuleSetAuthenticateForInterfaceRequest,
BaseRuleSetAuthenticateForInterfaceResult,
>(
(&mut credential,),
0x63f2f24c76ccab3d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type RemoveRuleResponseFut = fidl::client::QueryResponseFut<BaseRuleSetRemoveRuleResult>;
fn r#remove_rule(&self, mut index: u32) -> Self::RemoveRuleResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
0x2ae3d7e817cbff90,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<BaseRuleSetRemoveRuleRequest, BaseRuleSetRemoveRuleResult>(
(index,),
0x2ae3d7e817cbff90,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AddRuleResponseFut = fidl::client::QueryResponseFut<RuleSetV4AddRuleResult>;
fn r#add_rule(
&self,
mut index: u32,
mut selector: &fidl_fuchsia_net_routes::RuleSelectorV4,
mut action: &fidl_fuchsia_net_routes::RuleAction,
) -> Self::AddRuleResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RuleSetV4AddRuleResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
0x7f68325de94e80,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<RuleSetV4AddRuleRequest, RuleSetV4AddRuleResult>(
(index, selector, action),
0x7f68325de94e80,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct RuleSetV4EventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for RuleSetV4EventStream {}
impl futures::stream::FusedStream for RuleSetV4EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RuleSetV4EventStream {
type Item = Result<RuleSetV4Event, 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(RuleSetV4Event::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RuleSetV4Event {}
impl RuleSetV4Event {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<RuleSetV4Event, 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: <RuleSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RuleSetV4RequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for RuleSetV4RequestStream {}
impl futures::stream::FusedStream for RuleSetV4RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RuleSetV4RequestStream {
type Protocol = RuleSetV4Marker;
type ControlHandle = RuleSetV4ControlHandle;
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 {
RuleSetV4ControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for RuleSetV4RequestStream {
type Item = Result<RuleSetV4Request, 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 RuleSetV4RequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x6fd845360ed9bc8f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ProofOfRouteTableAuthorization);
fidl::encoding::Decoder::decode_into::<ProofOfRouteTableAuthorization>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
Ok(RuleSetV4Request::AuthenticateForRouteTable {
table: req.table,
token: req.token,
responder: RuleSetV4AuthenticateForRouteTableResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x63f2f24c76ccab3d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(BaseRuleSetAuthenticateForInterfaceRequest);
fidl::encoding::Decoder::decode_into::<
BaseRuleSetAuthenticateForInterfaceRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
Ok(RuleSetV4Request::AuthenticateForInterface {
credential: req.credential,
responder: RuleSetV4AuthenticateForInterfaceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2ae3d7e817cbff90 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(BaseRuleSetRemoveRuleRequest);
fidl::encoding::Decoder::decode_into::<BaseRuleSetRemoveRuleRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
Ok(RuleSetV4Request::RemoveRule {
index: req.index,
responder: RuleSetV4RemoveRuleResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x7f68325de94e80 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RuleSetV4AddRuleRequest);
fidl::encoding::Decoder::decode_into::<RuleSetV4AddRuleRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RuleSetV4ControlHandle { inner: this.inner.clone() };
Ok(RuleSetV4Request::AddRule {
index: req.index,
selector: req.selector,
action: req.action,
responder: RuleSetV4AddRuleResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <RuleSetV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum RuleSetV4Request {
AuthenticateForRouteTable {
table: u32,
token: fidl::Event,
responder: RuleSetV4AuthenticateForRouteTableResponder,
},
AuthenticateForInterface {
credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
responder: RuleSetV4AuthenticateForInterfaceResponder,
},
RemoveRule { index: u32, responder: RuleSetV4RemoveRuleResponder },
AddRule {
index: u32,
selector: fidl_fuchsia_net_routes::RuleSelectorV4,
action: fidl_fuchsia_net_routes::RuleAction,
responder: RuleSetV4AddRuleResponder,
},
}
impl RuleSetV4Request {
#[allow(irrefutable_let_patterns)]
pub fn into_authenticate_for_route_table(
self,
) -> Option<(u32, fidl::Event, RuleSetV4AuthenticateForRouteTableResponder)> {
if let RuleSetV4Request::AuthenticateForRouteTable { table, token, responder } = self {
Some((table, token, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_authenticate_for_interface(
self,
) -> Option<(
fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
RuleSetV4AuthenticateForInterfaceResponder,
)> {
if let RuleSetV4Request::AuthenticateForInterface { credential, responder } = self {
Some((credential, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_remove_rule(self) -> Option<(u32, RuleSetV4RemoveRuleResponder)> {
if let RuleSetV4Request::RemoveRule { index, responder } = self {
Some((index, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add_rule(
self,
) -> Option<(
u32,
fidl_fuchsia_net_routes::RuleSelectorV4,
fidl_fuchsia_net_routes::RuleAction,
RuleSetV4AddRuleResponder,
)> {
if let RuleSetV4Request::AddRule { index, selector, action, responder } = self {
Some((index, selector, action, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RuleSetV4Request::AuthenticateForRouteTable { .. } => "authenticate_for_route_table",
RuleSetV4Request::AuthenticateForInterface { .. } => "authenticate_for_interface",
RuleSetV4Request::RemoveRule { .. } => "remove_rule",
RuleSetV4Request::AddRule { .. } => "add_rule",
}
}
}
#[derive(Debug, Clone)]
pub struct RuleSetV4ControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for RuleSetV4ControlHandle {
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()
}
}
impl RuleSetV4ControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RuleSetV4AuthenticateForRouteTableResponder {
control_handle: std::mem::ManuallyDrop<RuleSetV4ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RuleSetV4AuthenticateForRouteTableResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RuleSetV4AuthenticateForRouteTableResponder {
type ControlHandle = RuleSetV4ControlHandle;
fn control_handle(&self) -> &RuleSetV4ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RuleSetV4AuthenticateForRouteTableResponder {
pub fn send(self, mut result: Result<(), RuleSetError>) -> 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<(), RuleSetError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RuleSetError,
>>(
result,
self.tx_id,
0x6fd845360ed9bc8f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RuleSetV4AuthenticateForInterfaceResponder {
control_handle: std::mem::ManuallyDrop<RuleSetV4ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RuleSetV4AuthenticateForInterfaceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RuleSetV4AuthenticateForInterfaceResponder {
type ControlHandle = RuleSetV4ControlHandle;
fn control_handle(&self) -> &RuleSetV4ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RuleSetV4AuthenticateForInterfaceResponder {
pub fn send(self, mut result: Result<(), RuleSetError>) -> 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<(), RuleSetError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RuleSetError,
>>(
result,
self.tx_id,
0x63f2f24c76ccab3d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RuleSetV4RemoveRuleResponder {
control_handle: std::mem::ManuallyDrop<RuleSetV4ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RuleSetV4RemoveRuleResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RuleSetV4RemoveRuleResponder {
type ControlHandle = RuleSetV4ControlHandle;
fn control_handle(&self) -> &RuleSetV4ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RuleSetV4RemoveRuleResponder {
pub fn send(self, mut result: Result<(), RuleSetError>) -> 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<(), RuleSetError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RuleSetError,
>>(
result,
self.tx_id,
0x2ae3d7e817cbff90,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RuleSetV4AddRuleResponder {
control_handle: std::mem::ManuallyDrop<RuleSetV4ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RuleSetV4AddRuleResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RuleSetV4AddRuleResponder {
type ControlHandle = RuleSetV4ControlHandle;
fn control_handle(&self) -> &RuleSetV4ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RuleSetV4AddRuleResponder {
pub fn send(self, mut result: Result<(), RuleSetError>) -> 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<(), RuleSetError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RuleSetError,
>>(
result,
self.tx_id,
0x7f68325de94e80,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RuleSetV6Marker;
impl fidl::endpoints::ProtocolMarker for RuleSetV6Marker {
type Proxy = RuleSetV6Proxy;
type RequestStream = RuleSetV6RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RuleSetV6SynchronousProxy;
const DEBUG_NAME: &'static str = "(anonymous) RuleSetV6";
}
pub type RuleSetV6AddRuleResult = Result<(), RuleSetError>;
pub trait RuleSetV6ProxyInterface: Send + Sync {
type AuthenticateForRouteTableResponseFut: std::future::Future<
Output = Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error>,
> + Send;
fn r#authenticate_for_route_table(
&self,
table: u32,
token: fidl::Event,
) -> Self::AuthenticateForRouteTableResponseFut;
type AuthenticateForInterfaceResponseFut: std::future::Future<Output = Result<BaseRuleSetAuthenticateForInterfaceResult, fidl::Error>>
+ Send;
fn r#authenticate_for_interface(
&self,
credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
) -> Self::AuthenticateForInterfaceResponseFut;
type RemoveRuleResponseFut: std::future::Future<Output = Result<BaseRuleSetRemoveRuleResult, fidl::Error>>
+ Send;
fn r#remove_rule(&self, index: u32) -> Self::RemoveRuleResponseFut;
type AddRuleResponseFut: std::future::Future<Output = Result<RuleSetV6AddRuleResult, fidl::Error>>
+ Send;
fn r#add_rule(
&self,
index: u32,
selector: &fidl_fuchsia_net_routes::RuleSelectorV6,
action: &fidl_fuchsia_net_routes::RuleAction,
) -> Self::AddRuleResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RuleSetV6SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RuleSetV6SynchronousProxy {
type Proxy = RuleSetV6Proxy;
type Protocol = RuleSetV6Marker;
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 RuleSetV6SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <RuleSetV6Marker 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::Time) -> Result<RuleSetV6Event, fidl::Error> {
RuleSetV6Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#authenticate_for_route_table(
&self,
mut table: u32,
mut token: fidl::Event,
___deadline: zx::Time,
) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
let _response = self.client.send_query::<
ProofOfRouteTableAuthorization,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
>(
(table, token,),
0x6fd845360ed9bc8f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#authenticate_for_interface(
&self,
mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
___deadline: zx::Time,
) -> Result<BaseRuleSetAuthenticateForInterfaceResult, fidl::Error> {
let _response = self.client.send_query::<
BaseRuleSetAuthenticateForInterfaceRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
>(
(&mut credential,),
0x63f2f24c76ccab3d,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#remove_rule(
&self,
mut index: u32,
___deadline: zx::Time,
) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
let _response = self.client.send_query::<
BaseRuleSetRemoveRuleRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
>(
(index,),
0x2ae3d7e817cbff90,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#add_rule(
&self,
mut index: u32,
mut selector: &fidl_fuchsia_net_routes::RuleSelectorV6,
mut action: &fidl_fuchsia_net_routes::RuleAction,
___deadline: zx::Time,
) -> Result<RuleSetV6AddRuleResult, fidl::Error> {
let _response = self.client.send_query::<
RuleSetV6AddRuleRequest,
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
>(
(index, selector, action,),
0x946cad8f8a726b3,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
}
#[derive(Debug, Clone)]
pub struct RuleSetV6Proxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for RuleSetV6Proxy {
type Protocol = RuleSetV6Marker;
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 RuleSetV6Proxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <RuleSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RuleSetV6EventStream {
RuleSetV6EventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#authenticate_for_route_table(
&self,
mut table: u32,
mut token: fidl::Event,
) -> fidl::client::QueryResponseFut<BaseRuleSetAuthenticateForRouteTableResult> {
RuleSetV6ProxyInterface::r#authenticate_for_route_table(self, table, token)
}
pub fn r#authenticate_for_interface(
&self,
mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
) -> fidl::client::QueryResponseFut<BaseRuleSetAuthenticateForInterfaceResult> {
RuleSetV6ProxyInterface::r#authenticate_for_interface(self, credential)
}
pub fn r#remove_rule(
&self,
mut index: u32,
) -> fidl::client::QueryResponseFut<BaseRuleSetRemoveRuleResult> {
RuleSetV6ProxyInterface::r#remove_rule(self, index)
}
pub fn r#add_rule(
&self,
mut index: u32,
mut selector: &fidl_fuchsia_net_routes::RuleSelectorV6,
mut action: &fidl_fuchsia_net_routes::RuleAction,
) -> fidl::client::QueryResponseFut<RuleSetV6AddRuleResult> {
RuleSetV6ProxyInterface::r#add_rule(self, index, selector, action)
}
}
impl RuleSetV6ProxyInterface for RuleSetV6Proxy {
type AuthenticateForRouteTableResponseFut =
fidl::client::QueryResponseFut<BaseRuleSetAuthenticateForRouteTableResult>;
fn r#authenticate_for_route_table(
&self,
mut table: u32,
mut token: fidl::Event,
) -> Self::AuthenticateForRouteTableResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<BaseRuleSetAuthenticateForRouteTableResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
0x6fd845360ed9bc8f,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
ProofOfRouteTableAuthorization,
BaseRuleSetAuthenticateForRouteTableResult,
>(
(table, token,),
0x6fd845360ed9bc8f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AuthenticateForInterfaceResponseFut =
fidl::client::QueryResponseFut<BaseRuleSetAuthenticateForInterfaceResult>;
fn r#authenticate_for_interface(
&self,
mut credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
) -> Self::AuthenticateForInterfaceResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<BaseRuleSetAuthenticateForInterfaceResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
0x63f2f24c76ccab3d,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
BaseRuleSetAuthenticateForInterfaceRequest,
BaseRuleSetAuthenticateForInterfaceResult,
>(
(&mut credential,),
0x63f2f24c76ccab3d,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type RemoveRuleResponseFut = fidl::client::QueryResponseFut<BaseRuleSetRemoveRuleResult>;
fn r#remove_rule(&self, mut index: u32) -> Self::RemoveRuleResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<BaseRuleSetRemoveRuleResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
0x2ae3d7e817cbff90,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client
.send_query_and_decode::<BaseRuleSetRemoveRuleRequest, BaseRuleSetRemoveRuleResult>(
(index,),
0x2ae3d7e817cbff90,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type AddRuleResponseFut = fidl::client::QueryResponseFut<RuleSetV6AddRuleResult>;
fn r#add_rule(
&self,
mut index: u32,
mut selector: &fidl_fuchsia_net_routes::RuleSelectorV6,
mut action: &fidl_fuchsia_net_routes::RuleAction,
) -> Self::AddRuleResponseFut {
fn _decode(
mut _buf: Result<fidl::MessageBufEtc, fidl::Error>,
) -> Result<RuleSetV6AddRuleResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<fidl::encoding::EmptyStruct, RuleSetError>,
0x946cad8f8a726b3,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<RuleSetV6AddRuleRequest, RuleSetV6AddRuleResult>(
(index, selector, action),
0x946cad8f8a726b3,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct RuleSetV6EventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for RuleSetV6EventStream {}
impl futures::stream::FusedStream for RuleSetV6EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RuleSetV6EventStream {
type Item = Result<RuleSetV6Event, 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(RuleSetV6Event::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RuleSetV6Event {}
impl RuleSetV6Event {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<RuleSetV6Event, 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: <RuleSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RuleSetV6RequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for RuleSetV6RequestStream {}
impl futures::stream::FusedStream for RuleSetV6RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RuleSetV6RequestStream {
type Protocol = RuleSetV6Marker;
type ControlHandle = RuleSetV6ControlHandle;
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 {
RuleSetV6ControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for RuleSetV6RequestStream {
type Item = Result<RuleSetV6Request, 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 RuleSetV6RequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x6fd845360ed9bc8f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(ProofOfRouteTableAuthorization);
fidl::encoding::Decoder::decode_into::<ProofOfRouteTableAuthorization>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
Ok(RuleSetV6Request::AuthenticateForRouteTable {
table: req.table,
token: req.token,
responder: RuleSetV6AuthenticateForRouteTableResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x63f2f24c76ccab3d => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(BaseRuleSetAuthenticateForInterfaceRequest);
fidl::encoding::Decoder::decode_into::<
BaseRuleSetAuthenticateForInterfaceRequest,
>(&header, _body_bytes, handles, &mut req)?;
let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
Ok(RuleSetV6Request::AuthenticateForInterface {
credential: req.credential,
responder: RuleSetV6AuthenticateForInterfaceResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x2ae3d7e817cbff90 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(BaseRuleSetRemoveRuleRequest);
fidl::encoding::Decoder::decode_into::<BaseRuleSetRemoveRuleRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
Ok(RuleSetV6Request::RemoveRule {
index: req.index,
responder: RuleSetV6RemoveRuleResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x946cad8f8a726b3 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(RuleSetV6AddRuleRequest);
fidl::encoding::Decoder::decode_into::<RuleSetV6AddRuleRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RuleSetV6ControlHandle { inner: this.inner.clone() };
Ok(RuleSetV6Request::AddRule {
index: req.index,
selector: req.selector,
action: req.action,
responder: RuleSetV6AddRuleResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <RuleSetV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum RuleSetV6Request {
AuthenticateForRouteTable {
table: u32,
token: fidl::Event,
responder: RuleSetV6AuthenticateForRouteTableResponder,
},
AuthenticateForInterface {
credential: fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
responder: RuleSetV6AuthenticateForInterfaceResponder,
},
RemoveRule { index: u32, responder: RuleSetV6RemoveRuleResponder },
AddRule {
index: u32,
selector: fidl_fuchsia_net_routes::RuleSelectorV6,
action: fidl_fuchsia_net_routes::RuleAction,
responder: RuleSetV6AddRuleResponder,
},
}
impl RuleSetV6Request {
#[allow(irrefutable_let_patterns)]
pub fn into_authenticate_for_route_table(
self,
) -> Option<(u32, fidl::Event, RuleSetV6AuthenticateForRouteTableResponder)> {
if let RuleSetV6Request::AuthenticateForRouteTable { table, token, responder } = self {
Some((table, token, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_authenticate_for_interface(
self,
) -> Option<(
fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
RuleSetV6AuthenticateForInterfaceResponder,
)> {
if let RuleSetV6Request::AuthenticateForInterface { credential, responder } = self {
Some((credential, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_remove_rule(self) -> Option<(u32, RuleSetV6RemoveRuleResponder)> {
if let RuleSetV6Request::RemoveRule { index, responder } = self {
Some((index, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_add_rule(
self,
) -> Option<(
u32,
fidl_fuchsia_net_routes::RuleSelectorV6,
fidl_fuchsia_net_routes::RuleAction,
RuleSetV6AddRuleResponder,
)> {
if let RuleSetV6Request::AddRule { index, selector, action, responder } = self {
Some((index, selector, action, responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RuleSetV6Request::AuthenticateForRouteTable { .. } => "authenticate_for_route_table",
RuleSetV6Request::AuthenticateForInterface { .. } => "authenticate_for_interface",
RuleSetV6Request::RemoveRule { .. } => "remove_rule",
RuleSetV6Request::AddRule { .. } => "add_rule",
}
}
}
#[derive(Debug, Clone)]
pub struct RuleSetV6ControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for RuleSetV6ControlHandle {
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()
}
}
impl RuleSetV6ControlHandle {}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RuleSetV6AuthenticateForRouteTableResponder {
control_handle: std::mem::ManuallyDrop<RuleSetV6ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RuleSetV6AuthenticateForRouteTableResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RuleSetV6AuthenticateForRouteTableResponder {
type ControlHandle = RuleSetV6ControlHandle;
fn control_handle(&self) -> &RuleSetV6ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RuleSetV6AuthenticateForRouteTableResponder {
pub fn send(self, mut result: Result<(), RuleSetError>) -> 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<(), RuleSetError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RuleSetError,
>>(
result,
self.tx_id,
0x6fd845360ed9bc8f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RuleSetV6AuthenticateForInterfaceResponder {
control_handle: std::mem::ManuallyDrop<RuleSetV6ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RuleSetV6AuthenticateForInterfaceResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RuleSetV6AuthenticateForInterfaceResponder {
type ControlHandle = RuleSetV6ControlHandle;
fn control_handle(&self) -> &RuleSetV6ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RuleSetV6AuthenticateForInterfaceResponder {
pub fn send(self, mut result: Result<(), RuleSetError>) -> 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<(), RuleSetError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RuleSetError,
>>(
result,
self.tx_id,
0x63f2f24c76ccab3d,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RuleSetV6RemoveRuleResponder {
control_handle: std::mem::ManuallyDrop<RuleSetV6ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RuleSetV6RemoveRuleResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RuleSetV6RemoveRuleResponder {
type ControlHandle = RuleSetV6ControlHandle;
fn control_handle(&self) -> &RuleSetV6ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RuleSetV6RemoveRuleResponder {
pub fn send(self, mut result: Result<(), RuleSetError>) -> 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<(), RuleSetError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RuleSetError,
>>(
result,
self.tx_id,
0x2ae3d7e817cbff90,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct RuleSetV6AddRuleResponder {
control_handle: std::mem::ManuallyDrop<RuleSetV6ControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for RuleSetV6AddRuleResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for RuleSetV6AddRuleResponder {
type ControlHandle = RuleSetV6ControlHandle;
fn control_handle(&self) -> &RuleSetV6ControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl RuleSetV6AddRuleResponder {
pub fn send(self, mut result: Result<(), RuleSetError>) -> 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<(), RuleSetError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(&self, mut result: Result<(), RuleSetError>) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
RuleSetError,
>>(
result,
self.tx_id,
0x946cad8f8a726b3,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RuleTableV4Marker;
impl fidl::endpoints::ProtocolMarker for RuleTableV4Marker {
type Proxy = RuleTableV4Proxy;
type RequestStream = RuleTableV4RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RuleTableV4SynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RuleTableV4";
}
impl fidl::endpoints::DiscoverableProtocolMarker for RuleTableV4Marker {}
pub trait RuleTableV4ProxyInterface: Send + Sync {
fn r#new_rule_set(
&self,
priority: u32,
rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RuleTableV4SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RuleTableV4SynchronousProxy {
type Proxy = RuleTableV4Proxy;
type Protocol = RuleTableV4Marker;
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 RuleTableV4SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <RuleTableV4Marker 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::Time) -> Result<RuleTableV4Event, fidl::Error> {
RuleTableV4Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#new_rule_set(
&self,
mut priority: u32,
mut rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
) -> Result<(), fidl::Error> {
self.client.send::<RuleTableV4NewRuleSetRequest>(
(priority, rule_set),
0xa32a9097da46f3a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct RuleTableV4Proxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for RuleTableV4Proxy {
type Protocol = RuleTableV4Marker;
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 RuleTableV4Proxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <RuleTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RuleTableV4EventStream {
RuleTableV4EventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#new_rule_set(
&self,
mut priority: u32,
mut rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
) -> Result<(), fidl::Error> {
RuleTableV4ProxyInterface::r#new_rule_set(self, priority, rule_set)
}
}
impl RuleTableV4ProxyInterface for RuleTableV4Proxy {
fn r#new_rule_set(
&self,
mut priority: u32,
mut rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
) -> Result<(), fidl::Error> {
self.client.send::<RuleTableV4NewRuleSetRequest>(
(priority, rule_set),
0xa32a9097da46f3a,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct RuleTableV4EventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for RuleTableV4EventStream {}
impl futures::stream::FusedStream for RuleTableV4EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RuleTableV4EventStream {
type Item = Result<RuleTableV4Event, 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(RuleTableV4Event::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RuleTableV4Event {}
impl RuleTableV4Event {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<RuleTableV4Event, 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: <RuleTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RuleTableV4RequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for RuleTableV4RequestStream {}
impl futures::stream::FusedStream for RuleTableV4RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RuleTableV4RequestStream {
type Protocol = RuleTableV4Marker;
type ControlHandle = RuleTableV4ControlHandle;
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 {
RuleTableV4ControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for RuleTableV4RequestStream {
type Item = Result<RuleTableV4Request, 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 RuleTableV4RequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0xa32a9097da46f3a => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(RuleTableV4NewRuleSetRequest);
fidl::encoding::Decoder::decode_into::<RuleTableV4NewRuleSetRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RuleTableV4ControlHandle { inner: this.inner.clone() };
Ok(RuleTableV4Request::NewRuleSet {
priority: req.priority,
rule_set: req.rule_set,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<RuleTableV4Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum RuleTableV4Request {
NewRuleSet {
priority: u32,
rule_set: fidl::endpoints::ServerEnd<RuleSetV4Marker>,
control_handle: RuleTableV4ControlHandle,
},
}
impl RuleTableV4Request {
#[allow(irrefutable_let_patterns)]
pub fn into_new_rule_set(
self,
) -> Option<(u32, fidl::endpoints::ServerEnd<RuleSetV4Marker>, RuleTableV4ControlHandle)> {
if let RuleTableV4Request::NewRuleSet { priority, rule_set, control_handle } = self {
Some((priority, rule_set, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RuleTableV4Request::NewRuleSet { .. } => "new_rule_set",
}
}
}
#[derive(Debug, Clone)]
pub struct RuleTableV4ControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for RuleTableV4ControlHandle {
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()
}
}
impl RuleTableV4ControlHandle {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct RuleTableV6Marker;
impl fidl::endpoints::ProtocolMarker for RuleTableV6Marker {
type Proxy = RuleTableV6Proxy;
type RequestStream = RuleTableV6RequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = RuleTableV6SynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.routes.admin.RuleTableV6";
}
impl fidl::endpoints::DiscoverableProtocolMarker for RuleTableV6Marker {}
pub trait RuleTableV6ProxyInterface: Send + Sync {
fn r#new_rule_set(
&self,
priority: u32,
rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
) -> Result<(), fidl::Error>;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct RuleTableV6SynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for RuleTableV6SynchronousProxy {
type Proxy = RuleTableV6Proxy;
type Protocol = RuleTableV6Marker;
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 RuleTableV6SynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name = <RuleTableV6Marker 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::Time) -> Result<RuleTableV6Event, fidl::Error> {
RuleTableV6Event::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#new_rule_set(
&self,
mut priority: u32,
mut rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
) -> Result<(), fidl::Error> {
self.client.send::<RuleTableV6NewRuleSetRequest>(
(priority, rule_set),
0x2261cc6eee9726a0,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Clone)]
pub struct RuleTableV6Proxy {
client: fidl::client::Client,
}
impl fidl::endpoints::Proxy for RuleTableV6Proxy {
type Protocol = RuleTableV6Marker;
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 RuleTableV6Proxy {
pub fn new(channel: fidl::AsyncChannel) -> Self {
let protocol_name = <RuleTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> RuleTableV6EventStream {
RuleTableV6EventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#new_rule_set(
&self,
mut priority: u32,
mut rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
) -> Result<(), fidl::Error> {
RuleTableV6ProxyInterface::r#new_rule_set(self, priority, rule_set)
}
}
impl RuleTableV6ProxyInterface for RuleTableV6Proxy {
fn r#new_rule_set(
&self,
mut priority: u32,
mut rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
) -> Result<(), fidl::Error> {
self.client.send::<RuleTableV6NewRuleSetRequest>(
(priority, rule_set),
0x2261cc6eee9726a0,
fidl::encoding::DynamicFlags::empty(),
)
}
}
pub struct RuleTableV6EventStream {
event_receiver: fidl::client::EventReceiver,
}
impl std::marker::Unpin for RuleTableV6EventStream {}
impl futures::stream::FusedStream for RuleTableV6EventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for RuleTableV6EventStream {
type Item = Result<RuleTableV6Event, 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(RuleTableV6Event::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum RuleTableV6Event {}
impl RuleTableV6Event {
fn decode(mut buf: fidl::MessageBufEtc) -> Result<RuleTableV6Event, 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: <RuleTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}
}
}
pub struct RuleTableV6RequestStream {
inner: std::sync::Arc<fidl::ServeInner>,
is_terminated: bool,
}
impl std::marker::Unpin for RuleTableV6RequestStream {}
impl futures::stream::FusedStream for RuleTableV6RequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for RuleTableV6RequestStream {
type Protocol = RuleTableV6Marker;
type ControlHandle = RuleTableV6ControlHandle;
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 {
RuleTableV6ControlHandle { inner: self.inner.clone() }
}
fn into_inner(self) -> (::std::sync::Arc<fidl::ServeInner>, bool) {
(self.inner, self.is_terminated)
}
fn from_inner(inner: std::sync::Arc<fidl::ServeInner>, is_terminated: bool) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for RuleTableV6RequestStream {
type Item = Result<RuleTableV6Request, 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 RuleTableV6RequestStream after completion");
}
fidl::encoding::with_tls_decode_buf(|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))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x2261cc6eee9726a0 => {
header.validate_request_tx_id(fidl::MethodType::OneWay)?;
let mut req = fidl::new_empty!(RuleTableV6NewRuleSetRequest);
fidl::encoding::Decoder::decode_into::<RuleTableV6NewRuleSetRequest>(
&header,
_body_bytes,
handles,
&mut req,
)?;
let control_handle = RuleTableV6ControlHandle { inner: this.inner.clone() };
Ok(RuleTableV6Request::NewRuleSet {
priority: req.priority,
rule_set: req.rule_set,
control_handle,
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name:
<RuleTableV6Marker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
})
}
}
#[derive(Debug)]
pub enum RuleTableV6Request {
NewRuleSet {
priority: u32,
rule_set: fidl::endpoints::ServerEnd<RuleSetV6Marker>,
control_handle: RuleTableV6ControlHandle,
},
}
impl RuleTableV6Request {
#[allow(irrefutable_let_patterns)]
pub fn into_new_rule_set(
self,
) -> Option<(u32, fidl::endpoints::ServerEnd<RuleSetV6Marker>, RuleTableV6ControlHandle)> {
if let RuleTableV6Request::NewRuleSet { priority, rule_set, control_handle } = self {
Some((priority, rule_set, control_handle))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
RuleTableV6Request::NewRuleSet { .. } => "new_rule_set",
}
}
}
#[derive(Debug, Clone)]
pub struct RuleTableV6ControlHandle {
inner: std::sync::Arc<fidl::ServeInner>,
}
impl fidl::endpoints::ControlHandle for RuleTableV6ControlHandle {
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()
}
}
impl RuleTableV6ControlHandle {}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for AuthenticateForInterfaceError {
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 {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for AuthenticateForInterfaceError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for AuthenticateForInterfaceError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for AuthenticateForInterfaceError {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BaseRouteTableRemoveError {
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 {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for BaseRouteTableRemoveError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for BaseRouteTableRemoveError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for BaseRouteTableRemoveError {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RouteSetError {
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 {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for RouteSetError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for RouteSetError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RouteSetError {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RuleSetError {
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 {
false
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for RuleSetError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
*value
}
}
unsafe impl fidl::encoding::Encode<Self> for RuleSetError {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RuleSetError {
#[inline(always)]
fn new_empty() -> Self {
Self::unknown()
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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_allow_unknown(prim);
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BaseRouteTableGetTableIdResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for BaseRouteTableGetTableIdResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<BaseRouteTableGetTableIdResponse>
for &BaseRouteTableGetTableIdResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BaseRouteTableGetTableIdResponse>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut BaseRouteTableGetTableIdResponse)
.write_unaligned((self as *const BaseRouteTableGetTableIdResponse).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u32>>
fidl::encoding::Encode<BaseRouteTableGetTableIdResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BaseRouteTableGetTableIdResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for BaseRouteTableGetTableIdResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { table_id: fidl::new_empty!(u32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BaseRuleSetAuthenticateForInterfaceRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for BaseRuleSetAuthenticateForInterfaceRequest {
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::Encode<BaseRuleSetAuthenticateForInterfaceRequest>
for &mut BaseRuleSetAuthenticateForInterfaceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BaseRuleSetAuthenticateForInterfaceRequest>(offset);
fidl::encoding::Encode::<BaseRuleSetAuthenticateForInterfaceRequest>::encode(
(
<fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
>,
> fidl::encoding::Encode<BaseRuleSetAuthenticateForInterfaceRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BaseRuleSetAuthenticateForInterfaceRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for BaseRuleSetAuthenticateForInterfaceRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
credential: fidl::new_empty!(
fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
&mut self.credential,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for BaseRuleSetRemoveRuleRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
true
}
}
impl fidl::encoding::ValueTypeMarker for BaseRuleSetRemoveRuleRequest {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<BaseRuleSetRemoveRuleRequest> for &BaseRuleSetRemoveRuleRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BaseRuleSetRemoveRuleRequest>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut BaseRuleSetRemoveRuleRequest)
.write_unaligned((self as *const BaseRuleSetRemoveRuleRequest).read());
}
Ok(())
}
}
unsafe impl<T0: fidl::encoding::Encode<u32>>
fidl::encoding::Encode<BaseRuleSetRemoveRuleRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<BaseRuleSetRemoveRuleRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for BaseRuleSetRemoveRuleRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { index: fidl::new_empty!(u32) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 4);
}
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for GrantForRouteTableAuthorization {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
impl fidl::encoding::ResourceTypeMarker for GrantForRouteTableAuthorization {
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::Encode<GrantForRouteTableAuthorization>
for &mut GrantForRouteTableAuthorization
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GrantForRouteTableAuthorization>(offset);
fidl::encoding::Encode::<GrantForRouteTableAuthorization>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.table_id),
<fidl::encoding::HandleType<
fidl::Event,
{ fidl::ObjectType::EVENT.into_raw() },
3,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.token
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u32>,
T1: fidl::encoding::Encode<
fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>,
>,
> fidl::encoding::Encode<GrantForRouteTableAuthorization> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<GrantForRouteTableAuthorization>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for GrantForRouteTableAuthorization {
#[inline(always)]
fn new_empty() -> Self {
Self {
table_id: fidl::new_empty!(u32),
token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u32, &mut self.table_id, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 3>, &mut self.token, decoder, offset + 4, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for ProofOfRouteTableAuthorization {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
impl fidl::encoding::ResourceTypeMarker for ProofOfRouteTableAuthorization {
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::Encode<ProofOfRouteTableAuthorization>
for &mut ProofOfRouteTableAuthorization
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProofOfRouteTableAuthorization>(offset);
fidl::encoding::Encode::<ProofOfRouteTableAuthorization>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.table),
<fidl::encoding::HandleType<
fidl::Event,
{ fidl::ObjectType::EVENT.into_raw() },
2147483648,
> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(
&mut self.token
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u32>,
T1: fidl::encoding::Encode<
fidl::encoding::HandleType<
fidl::Event,
{ fidl::ObjectType::EVENT.into_raw() },
2147483648,
>,
>,
> fidl::encoding::Encode<ProofOfRouteTableAuthorization> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<ProofOfRouteTableAuthorization>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for ProofOfRouteTableAuthorization {
#[inline(always)]
fn new_empty() -> Self {
Self {
table: fidl::new_empty!(u32),
token: fidl::new_empty!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u32, &mut self.table, decoder, offset + 0, _depth)?;
fidl::decode!(fidl::encoding::HandleType<fidl::Event, { fidl::ObjectType::EVENT.into_raw() }, 2147483648>, &mut self.token, decoder, offset + 4, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RouteSetV4AddRouteRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
impl fidl::encoding::ResourceTypeMarker for RouteSetV4AddRouteRequest {
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::Encode<RouteSetV4AddRouteRequest> for &mut RouteSetV4AddRouteRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV4AddRouteRequest>(offset);
fidl::encoding::Encode::<RouteSetV4AddRouteRequest>::encode(
(<fidl_fuchsia_net_routes::RouteV4 as fidl::encoding::ValueTypeMarker>::borrow(
&self.route,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl_fuchsia_net_routes::RouteV4>>
fidl::encoding::Encode<RouteSetV4AddRouteRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV4AddRouteRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RouteSetV4AddRouteRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { route: fidl::new_empty!(fidl_fuchsia_net_routes::RouteV4) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_net_routes::RouteV4,
&mut self.route,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RouteSetV4AuthenticateForInterfaceRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for RouteSetV4AuthenticateForInterfaceRequest {
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::Encode<RouteSetV4AuthenticateForInterfaceRequest>
for &mut RouteSetV4AuthenticateForInterfaceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV4AuthenticateForInterfaceRequest>(offset);
fidl::encoding::Encode::<RouteSetV4AuthenticateForInterfaceRequest>::encode(
(
<fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
>,
> fidl::encoding::Encode<RouteSetV4AuthenticateForInterfaceRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV4AuthenticateForInterfaceRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RouteSetV4AuthenticateForInterfaceRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
credential: fidl::new_empty!(
fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
&mut self.credential,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RouteSetV4RemoveRouteRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
impl fidl::encoding::ResourceTypeMarker for RouteSetV4RemoveRouteRequest {
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::Encode<RouteSetV4RemoveRouteRequest>
for &mut RouteSetV4RemoveRouteRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV4RemoveRouteRequest>(offset);
fidl::encoding::Encode::<RouteSetV4RemoveRouteRequest>::encode(
(<fidl_fuchsia_net_routes::RouteV4 as fidl::encoding::ValueTypeMarker>::borrow(
&self.route,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl_fuchsia_net_routes::RouteV4>>
fidl::encoding::Encode<RouteSetV4RemoveRouteRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV4RemoveRouteRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RouteSetV4RemoveRouteRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { route: fidl::new_empty!(fidl_fuchsia_net_routes::RouteV4) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_net_routes::RouteV4,
&mut self.route,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RouteSetV4AddRouteResponse {
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
}
}
impl fidl::encoding::ValueTypeMarker for RouteSetV4AddRouteResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RouteSetV4AddRouteResponse> for &RouteSetV4AddRouteResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV4AddRouteResponse>(offset);
fidl::encoding::Encode::<RouteSetV4AddRouteResponse>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.did_add),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<bool>> fidl::encoding::Encode<RouteSetV4AddRouteResponse>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV4AddRouteResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RouteSetV4AddRouteResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { did_add: fidl::new_empty!(bool) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, &mut self.did_add, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RouteSetV4RemoveRouteResponse {
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
}
}
impl fidl::encoding::ValueTypeMarker for RouteSetV4RemoveRouteResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RouteSetV4RemoveRouteResponse>
for &RouteSetV4RemoveRouteResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV4RemoveRouteResponse>(offset);
fidl::encoding::Encode::<RouteSetV4RemoveRouteResponse>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.did_remove),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<bool>>
fidl::encoding::Encode<RouteSetV4RemoveRouteResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV4RemoveRouteResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RouteSetV4RemoveRouteResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { did_remove: fidl::new_empty!(bool) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, &mut self.did_remove, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RouteSetV6AddRouteRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for RouteSetV6AddRouteRequest {
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::Encode<RouteSetV6AddRouteRequest> for &mut RouteSetV6AddRouteRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV6AddRouteRequest>(offset);
fidl::encoding::Encode::<RouteSetV6AddRouteRequest>::encode(
(<fidl_fuchsia_net_routes::RouteV6 as fidl::encoding::ValueTypeMarker>::borrow(
&self.route,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl_fuchsia_net_routes::RouteV6>>
fidl::encoding::Encode<RouteSetV6AddRouteRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV6AddRouteRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RouteSetV6AddRouteRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { route: fidl::new_empty!(fidl_fuchsia_net_routes::RouteV6) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_net_routes::RouteV6,
&mut self.route,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RouteSetV6AuthenticateForInterfaceRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for RouteSetV6AuthenticateForInterfaceRequest {
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::Encode<RouteSetV6AuthenticateForInterfaceRequest>
for &mut RouteSetV6AuthenticateForInterfaceRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV6AuthenticateForInterfaceRequest>(offset);
fidl::encoding::Encode::<RouteSetV6AuthenticateForInterfaceRequest>::encode(
(
<fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.credential),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
>,
> fidl::encoding::Encode<RouteSetV6AuthenticateForInterfaceRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV6AuthenticateForInterfaceRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RouteSetV6AuthenticateForInterfaceRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
credential: fidl::new_empty!(
fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_net_interfaces_admin::ProofOfInterfaceAuthorization,
&mut self.credential,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RouteSetV6RemoveRouteRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for RouteSetV6RemoveRouteRequest {
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::Encode<RouteSetV6RemoveRouteRequest>
for &mut RouteSetV6RemoveRouteRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV6RemoveRouteRequest>(offset);
fidl::encoding::Encode::<RouteSetV6RemoveRouteRequest>::encode(
(<fidl_fuchsia_net_routes::RouteV6 as fidl::encoding::ValueTypeMarker>::borrow(
&self.route,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<fidl_fuchsia_net_routes::RouteV6>>
fidl::encoding::Encode<RouteSetV6RemoveRouteRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV6RemoveRouteRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RouteSetV6RemoveRouteRequest {
#[inline(always)]
fn new_empty() -> Self {
Self { route: fidl::new_empty!(fidl_fuchsia_net_routes::RouteV6) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_net_routes::RouteV6,
&mut self.route,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RouteSetV6AddRouteResponse {
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
}
}
impl fidl::encoding::ValueTypeMarker for RouteSetV6AddRouteResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RouteSetV6AddRouteResponse> for &RouteSetV6AddRouteResponse {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV6AddRouteResponse>(offset);
fidl::encoding::Encode::<RouteSetV6AddRouteResponse>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.did_add),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<bool>> fidl::encoding::Encode<RouteSetV6AddRouteResponse>
for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV6AddRouteResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RouteSetV6AddRouteResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { did_add: fidl::new_empty!(bool) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, &mut self.did_add, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RouteSetV6RemoveRouteResponse {
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
}
}
impl fidl::encoding::ValueTypeMarker for RouteSetV6RemoveRouteResponse {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RouteSetV6RemoveRouteResponse>
for &RouteSetV6RemoveRouteResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV6RemoveRouteResponse>(offset);
fidl::encoding::Encode::<RouteSetV6RemoveRouteResponse>::encode(
(<bool as fidl::encoding::ValueTypeMarker>::borrow(&self.did_remove),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<T0: fidl::encoding::Encode<bool>>
fidl::encoding::Encode<RouteSetV6RemoveRouteResponse> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteSetV6RemoveRouteResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RouteSetV6RemoveRouteResponse {
#[inline(always)]
fn new_empty() -> Self {
Self { did_remove: fidl::new_empty!(bool) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(bool, &mut self.did_remove, decoder, offset + 0, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV4NewRouteTableRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV4NewRouteTableRequest {
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::Encode<RouteTableProviderV4NewRouteTableRequest>
for &mut RouteTableProviderV4NewRouteTableRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteTableProviderV4NewRouteTableRequest>(offset);
fidl::encoding::Encode::<RouteTableProviderV4NewRouteTableRequest>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.provider),
<RouteTableOptionsV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV4Marker>>,
>,
T1: fidl::encoding::Encode<RouteTableOptionsV4>,
> fidl::encoding::Encode<RouteTableProviderV4NewRouteTableRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteTableProviderV4NewRouteTableRequest>(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 fidl::encoding::Decode<Self> for RouteTableProviderV4NewRouteTableRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
provider: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV4Marker>>
),
options: fidl::new_empty!(RouteTableOptionsV4),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 = 0xffffffff00000000u64;
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!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV4Marker>>,
&mut self.provider,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(RouteTableOptionsV4, &mut self.options, decoder, offset + 8, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RouteTableProviderV6NewRouteTableRequest {
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
}
}
impl fidl::encoding::ResourceTypeMarker for RouteTableProviderV6NewRouteTableRequest {
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::Encode<RouteTableProviderV6NewRouteTableRequest>
for &mut RouteTableProviderV6NewRouteTableRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteTableProviderV6NewRouteTableRequest>(offset);
fidl::encoding::Encode::<RouteTableProviderV6NewRouteTableRequest>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.provider),
<RouteTableOptionsV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.options),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV6Marker>>,
>,
T1: fidl::encoding::Encode<RouteTableOptionsV6>,
> fidl::encoding::Encode<RouteTableProviderV6NewRouteTableRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteTableProviderV6NewRouteTableRequest>(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 fidl::encoding::Decode<Self> for RouteTableProviderV6NewRouteTableRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
provider: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV6Marker>>
),
options: fidl::new_empty!(RouteTableOptionsV6),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 = 0xffffffff00000000u64;
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!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteTableV6Marker>>,
&mut self.provider,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(RouteTableOptionsV6, &mut self.options, decoder, offset + 8, _depth)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RouteTableV4NewRouteSetRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for RouteTableV4NewRouteSetRequest {
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::Encode<RouteTableV4NewRouteSetRequest>
for &mut RouteTableV4NewRouteSetRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteTableV4NewRouteSetRequest>(offset);
fidl::encoding::Encode::<RouteTableV4NewRouteSetRequest>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_set),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV4Marker>>,
>,
> fidl::encoding::Encode<RouteTableV4NewRouteSetRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteTableV4NewRouteSetRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RouteTableV4NewRouteSetRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
route_set: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV4Marker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV4Marker>>,
&mut self.route_set,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RouteTableV6NewRouteSetRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
4
}
}
impl fidl::encoding::ResourceTypeMarker for RouteTableV6NewRouteSetRequest {
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::Encode<RouteTableV6NewRouteSetRequest>
for &mut RouteTableV6NewRouteSetRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteTableV6NewRouteSetRequest>(offset);
fidl::encoding::Encode::<RouteTableV6NewRouteSetRequest>::encode(
(
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.route_set),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV6Marker>>,
>,
> fidl::encoding::Encode<RouteTableV6NewRouteSetRequest> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteTableV6NewRouteSetRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RouteTableV6NewRouteSetRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
route_set: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV6Marker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RouteSetV6Marker>>,
&mut self.route_set,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RuleSetV4AddRuleRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
impl fidl::encoding::ResourceTypeMarker for RuleSetV4AddRuleRequest {
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::Encode<RuleSetV4AddRuleRequest> for &mut RuleSetV4AddRuleRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RuleSetV4AddRuleRequest>(offset);
fidl::encoding::Encode::<RuleSetV4AddRuleRequest>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
<fidl_fuchsia_net_routes::RuleSelectorV4 as fidl::encoding::ValueTypeMarker>::borrow(&self.selector),
<fidl_fuchsia_net_routes::RuleAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u32>,
T1: fidl::encoding::Encode<fidl_fuchsia_net_routes::RuleSelectorV4>,
T2: fidl::encoding::Encode<fidl_fuchsia_net_routes::RuleAction>,
> fidl::encoding::Encode<RuleSetV4AddRuleRequest> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RuleSetV4AddRuleRequest>(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)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RuleSetV4AddRuleRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
index: fidl::new_empty!(u32),
selector: fidl::new_empty!(fidl_fuchsia_net_routes::RuleSelectorV4),
action: fidl::new_empty!(fidl_fuchsia_net_routes::RuleAction),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 = 0xffffffff00000000u64;
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!(u32, &mut self.index, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl_fuchsia_net_routes::RuleSelectorV4,
&mut self.selector,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl_fuchsia_net_routes::RuleAction,
&mut self.action,
decoder,
offset + 24,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RuleSetV6AddRuleRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
40
}
}
impl fidl::encoding::ResourceTypeMarker for RuleSetV6AddRuleRequest {
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::Encode<RuleSetV6AddRuleRequest> for &mut RuleSetV6AddRuleRequest {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RuleSetV6AddRuleRequest>(offset);
fidl::encoding::Encode::<RuleSetV6AddRuleRequest>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.index),
<fidl_fuchsia_net_routes::RuleSelectorV6 as fidl::encoding::ValueTypeMarker>::borrow(&self.selector),
<fidl_fuchsia_net_routes::RuleAction as fidl::encoding::ValueTypeMarker>::borrow(&self.action),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u32>,
T1: fidl::encoding::Encode<fidl_fuchsia_net_routes::RuleSelectorV6>,
T2: fidl::encoding::Encode<fidl_fuchsia_net_routes::RuleAction>,
> fidl::encoding::Encode<RuleSetV6AddRuleRequest> for (T0, T1, T2)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RuleSetV6AddRuleRequest>(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)?;
self.2.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RuleSetV6AddRuleRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
index: fidl::new_empty!(u32),
selector: fidl::new_empty!(fidl_fuchsia_net_routes::RuleSelectorV6),
action: fidl::new_empty!(fidl_fuchsia_net_routes::RuleAction),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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 = 0xffffffff00000000u64;
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!(u32, &mut self.index, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl_fuchsia_net_routes::RuleSelectorV6,
&mut self.selector,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(
fidl_fuchsia_net_routes::RuleAction,
&mut self.action,
decoder,
offset + 24,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RuleTableV4NewRuleSetRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
impl fidl::encoding::ResourceTypeMarker for RuleTableV4NewRuleSetRequest {
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::Encode<RuleTableV4NewRuleSetRequest>
for &mut RuleTableV4NewRuleSetRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RuleTableV4NewRuleSetRequest>(offset);
fidl::encoding::Encode::<RuleTableV4NewRuleSetRequest>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.priority),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV4Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.rule_set),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u32>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV4Marker>>,
>,
> fidl::encoding::Encode<RuleTableV4NewRuleSetRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RuleTableV4NewRuleSetRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RuleTableV4NewRuleSetRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
priority: fidl::new_empty!(u32),
rule_set: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV4Marker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u32, &mut self.priority, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV4Marker>>,
&mut self.rule_set,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for RuleTableV6NewRuleSetRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
4
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
impl fidl::encoding::ResourceTypeMarker for RuleTableV6NewRuleSetRequest {
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::Encode<RuleTableV6NewRuleSetRequest>
for &mut RuleTableV6NewRuleSetRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RuleTableV6NewRuleSetRequest>(offset);
fidl::encoding::Encode::<RuleTableV6NewRuleSetRequest>::encode(
(
<u32 as fidl::encoding::ValueTypeMarker>::borrow(&self.priority),
<fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV6Marker>> as fidl::encoding::ResourceTypeMarker>::take_or_borrow(&mut self.rule_set),
),
encoder, offset, _depth
)
}
}
unsafe impl<
T0: fidl::encoding::Encode<u32>,
T1: fidl::encoding::Encode<
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV6Marker>>,
>,
> fidl::encoding::Encode<RuleTableV6NewRuleSetRequest> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RuleTableV6NewRuleSetRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RuleTableV6NewRuleSetRequest {
#[inline(always)]
fn new_empty() -> Self {
Self {
priority: fidl::new_empty!(u32),
rule_set: fidl::new_empty!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV6Marker>>
),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u32, &mut self.priority, decoder, offset + 0, _depth)?;
fidl::decode!(
fidl::encoding::Endpoint<fidl::endpoints::ServerEnd<RuleSetV6Marker>>,
&mut self.rule_set,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
impl RouteTableOptionsV4 {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.name {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for RouteTableOptionsV4 {
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
}
}
impl fidl::encoding::ValueTypeMarker for RouteTableOptionsV4 {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RouteTableOptionsV4> for &RouteTableOptionsV4 {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteTableOptionsV4>(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;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.name.as_ref().map(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RouteTableOptionsV4 {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.name
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
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 RouteTableOptionsV6 {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.name {
return 1;
}
0
}
}
unsafe impl fidl::encoding::TypeMarker for RouteTableOptionsV6 {
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
}
}
impl fidl::encoding::ValueTypeMarker for RouteTableOptionsV6 {
type Borrowed<'a> = &'a Self;
fn borrow<'a>(
value: &'a <Self as fidl::encoding::TypeMarker>::Owned,
) -> Self::Borrowed<'a> {
value
}
}
unsafe impl fidl::encoding::Encode<RouteTableOptionsV6> for &RouteTableOptionsV6 {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteTableOptionsV6>(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;
if 1 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (1 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<fidl::encoding::BoundedString<255>>(
self.name.as_ref().map(
<fidl::encoding::BoundedString<255> as fidl::encoding::ValueTypeMarker>::borrow,
),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl fidl::encoding::Decode<Self> for RouteTableOptionsV6 {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_>,
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;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 1 {
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
_next_ordinal_to_read += 1;
next_offset += envelope_size;
}
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
if let Some((inlined, num_bytes, num_handles)) =
fidl::encoding::decode_envelope_header(decoder, next_offset)?
{
let member_inline_size =
<fidl::encoding::BoundedString<255> as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
);
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let inner_offset;
let mut inner_depth = depth.clone();
if inlined {
decoder.check_inline_envelope_padding(next_offset, member_inline_size)?;
inner_offset = next_offset;
} else {
inner_offset = decoder.out_of_line_offset(member_inline_size)?;
inner_depth.increment()?;
}
let val_ref = self
.name
.get_or_insert_with(|| fidl::new_empty!(fidl::encoding::BoundedString<255>));
fidl::decode!(
fidl::encoding::BoundedString<255>,
val_ref,
decoder,
inner_offset,
inner_depth
)?;
if !inlined && decoder.next_out_of_line() != next_out_of_line + (num_bytes as usize)
{
return Err(fidl::Error::InvalidNumBytesInEnvelope);
}
if handles_before != decoder.remaining_handles() + (num_handles as usize) {
return Err(fidl::Error::InvalidNumHandlesInEnvelope);
}
}
next_offset += envelope_size;
while next_offset < end_offset {
_next_ordinal_to_read += 1;
fidl::encoding::decode_unknown_envelope(decoder, next_offset, depth)?;
next_offset += envelope_size;
}
Ok(())
}
}
}