#![warn(clippy::all)]
#![allow(unused_parens, unused_mut, unused_imports, nonstandard_style)]
use bitflags::bitflags;
use fidl::client::QueryResponseFut;
use fidl::encoding::{MessageBufFor, ProxyChannelBox, ResourceDialect};
use fidl::endpoints::{ControlHandle as _, Responder as _};
use futures::future::{self, MaybeDone, TryFutureExt};
use zx_status;
pub const MAX_MULTICAST_INTERFACES: u8 = 32;
pub const MAX_ROUTING_EVENTS: u16 = 128;
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum Ipv4RoutingTableControllerAddRouteError {
InvalidAddress = 1,
RequiredRouteFieldsMissing = 2,
InterfaceNotFound = 3,
InputCannotBeOutput = 4,
DuplicateOutput = 5,
}
impl Ipv4RoutingTableControllerAddRouteError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::InvalidAddress),
2 => Some(Self::RequiredRouteFieldsMissing),
3 => Some(Self::InterfaceNotFound),
4 => Some(Self::InputCannotBeOutput),
5 => Some(Self::DuplicateOutput),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum Ipv4RoutingTableControllerDelRouteError {
InvalidAddress = 1,
NotFound = 2,
}
impl Ipv4RoutingTableControllerDelRouteError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::InvalidAddress),
2 => Some(Self::NotFound),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum Ipv4RoutingTableControllerGetRouteStatsError {
InvalidAddress = 1,
NotFound = 2,
}
impl Ipv4RoutingTableControllerGetRouteStatsError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::InvalidAddress),
2 => Some(Self::NotFound),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum Ipv6RoutingTableControllerAddRouteError {
InvalidAddress = 1,
RequiredRouteFieldsMissing = 2,
InterfaceNotFound = 3,
InputCannotBeOutput = 4,
DuplicateOutput = 5,
}
impl Ipv6RoutingTableControllerAddRouteError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::InvalidAddress),
2 => Some(Self::RequiredRouteFieldsMissing),
3 => Some(Self::InterfaceNotFound),
4 => Some(Self::InputCannotBeOutput),
5 => Some(Self::DuplicateOutput),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum Ipv6RoutingTableControllerDelRouteError {
InvalidAddress = 1,
NotFound = 2,
}
impl Ipv6RoutingTableControllerDelRouteError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::InvalidAddress),
2 => Some(Self::NotFound),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum Ipv6RoutingTableControllerGetRouteStatsError {
InvalidAddress = 1,
NotFound = 2,
}
impl Ipv6RoutingTableControllerGetRouteStatsError {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::InvalidAddress),
2 => Some(Self::NotFound),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Copy, Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Hash)]
#[repr(u32)]
pub enum TableControllerCloseReason {
AlreadyInUse = 1,
HangingGetError = 2,
}
impl TableControllerCloseReason {
#[inline]
pub fn from_primitive(prim: u32) -> Option<Self> {
match prim {
1 => Some(Self::AlreadyInUse),
2 => Some(Self::HangingGetError),
_ => None,
}
}
#[inline]
pub const fn into_primitive(self) -> u32 {
self as u32
}
#[deprecated = "Strict enums should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Empty;
impl fidl::Persistable for Empty {}
#[derive(Clone, Debug, PartialEq)]
pub struct Ipv4RoutingTableControllerAddRouteRequest {
pub addresses: Ipv4UnicastSourceAndMulticastDestination,
pub route: Route,
}
impl fidl::Persistable for Ipv4RoutingTableControllerAddRouteRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct Ipv4RoutingTableControllerDelRouteRequest {
pub addresses: Ipv4UnicastSourceAndMulticastDestination,
}
impl fidl::Persistable for Ipv4RoutingTableControllerDelRouteRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct Ipv4RoutingTableControllerGetRouteStatsRequest {
pub addresses: Ipv4UnicastSourceAndMulticastDestination,
}
impl fidl::Persistable for Ipv4RoutingTableControllerGetRouteStatsRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Ipv4RoutingTableControllerOnCloseRequest {
pub error: TableControllerCloseReason,
}
impl fidl::Persistable for Ipv4RoutingTableControllerOnCloseRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct Ipv4RoutingTableControllerWatchRoutingEventsResponse {
pub dropped_events: u64,
pub addresses: Ipv4UnicastSourceAndMulticastDestination,
pub input_interface: u64,
pub event: RoutingEvent,
}
impl fidl::Persistable for Ipv4RoutingTableControllerWatchRoutingEventsResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct Ipv4RoutingTableControllerGetRouteStatsResponse {
pub stats: RouteStats,
}
impl fidl::Persistable for Ipv4RoutingTableControllerGetRouteStatsResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct Ipv4UnicastSourceAndMulticastDestination {
pub unicast_source: fidl_fuchsia_net::Ipv4Address,
pub multicast_destination: fidl_fuchsia_net::Ipv4Address,
}
impl fidl::Persistable for Ipv4UnicastSourceAndMulticastDestination {}
#[derive(Clone, Debug, PartialEq)]
pub struct Ipv6RoutingTableControllerAddRouteRequest {
pub addresses: Ipv6UnicastSourceAndMulticastDestination,
pub route: Route,
}
impl fidl::Persistable for Ipv6RoutingTableControllerAddRouteRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct Ipv6RoutingTableControllerDelRouteRequest {
pub addresses: Ipv6UnicastSourceAndMulticastDestination,
}
impl fidl::Persistable for Ipv6RoutingTableControllerDelRouteRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct Ipv6RoutingTableControllerGetRouteStatsRequest {
pub addresses: Ipv6UnicastSourceAndMulticastDestination,
}
impl fidl::Persistable for Ipv6RoutingTableControllerGetRouteStatsRequest {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct Ipv6RoutingTableControllerOnCloseRequest {
pub error: TableControllerCloseReason,
}
impl fidl::Persistable for Ipv6RoutingTableControllerOnCloseRequest {}
#[derive(Clone, Debug, PartialEq)]
pub struct Ipv6RoutingTableControllerWatchRoutingEventsResponse {
pub dropped_events: u64,
pub addresses: Ipv6UnicastSourceAndMulticastDestination,
pub input_interface: u64,
pub event: RoutingEvent,
}
impl fidl::Persistable for Ipv6RoutingTableControllerWatchRoutingEventsResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct Ipv6RoutingTableControllerGetRouteStatsResponse {
pub stats: RouteStats,
}
impl fidl::Persistable for Ipv6RoutingTableControllerGetRouteStatsResponse {}
#[derive(Clone, Debug, PartialEq)]
pub struct Ipv6UnicastSourceAndMulticastDestination {
pub unicast_source: fidl_fuchsia_net::Ipv6Address,
pub multicast_destination: fidl_fuchsia_net::Ipv6Address,
}
impl fidl::Persistable for Ipv6UnicastSourceAndMulticastDestination {}
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
#[repr(C)]
pub struct OutgoingInterfaces {
pub id: u64,
pub min_ttl: u8,
}
impl fidl::Persistable for OutgoingInterfaces {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct Route {
pub expected_input_interface: Option<u64>,
pub action: Option<Action>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for Route {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct RouteStats {
pub last_used: Option<i64>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for RouteStats {}
#[derive(Clone, Debug, Default, PartialEq)]
pub struct WrongInputInterface {
pub expected_input_interface: Option<u64>,
#[doc(hidden)]
pub __source_breaking: fidl::marker::SourceBreaking,
}
impl fidl::Persistable for WrongInputInterface {}
#[derive(Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub enum Action {
OutgoingInterfaces(Vec<OutgoingInterfaces>),
}
impl Action {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::OutgoingInterfaces(_) => 1,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for Action {}
#[derive(Clone, Debug, PartialEq)]
pub enum RoutingEvent {
MissingRoute(Empty),
WrongInputInterface(WrongInputInterface),
}
impl RoutingEvent {
#[inline]
pub fn ordinal(&self) -> u64 {
match *self {
Self::MissingRoute(_) => 1,
Self::WrongInputInterface(_) => 2,
}
}
#[deprecated = "Strict unions should not use `is_unknown`"]
#[inline]
pub fn is_unknown(&self) -> bool {
false
}
}
impl fidl::Persistable for RoutingEvent {}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct Ipv4RoutingTableControllerMarker;
impl fidl::endpoints::ProtocolMarker for Ipv4RoutingTableControllerMarker {
type Proxy = Ipv4RoutingTableControllerProxy;
type RequestStream = Ipv4RoutingTableControllerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = Ipv4RoutingTableControllerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.multicast.admin.Ipv4RoutingTableController";
}
impl fidl::endpoints::DiscoverableProtocolMarker for Ipv4RoutingTableControllerMarker {}
pub type Ipv4RoutingTableControllerAddRouteResult =
Result<(), Ipv4RoutingTableControllerAddRouteError>;
pub type Ipv4RoutingTableControllerDelRouteResult =
Result<(), Ipv4RoutingTableControllerDelRouteError>;
pub type Ipv4RoutingTableControllerGetRouteStatsResult =
Result<RouteStats, Ipv4RoutingTableControllerGetRouteStatsError>;
pub trait Ipv4RoutingTableControllerProxyInterface: Send + Sync {
type AddRouteResponseFut: std::future::Future<Output = Result<Ipv4RoutingTableControllerAddRouteResult, fidl::Error>>
+ Send;
fn r#add_route(
&self,
addresses: &Ipv4UnicastSourceAndMulticastDestination,
route: &Route,
) -> Self::AddRouteResponseFut;
type DelRouteResponseFut: std::future::Future<Output = Result<Ipv4RoutingTableControllerDelRouteResult, fidl::Error>>
+ Send;
fn r#del_route(
&self,
addresses: &Ipv4UnicastSourceAndMulticastDestination,
) -> Self::DelRouteResponseFut;
type GetRouteStatsResponseFut: std::future::Future<
Output = Result<Ipv4RoutingTableControllerGetRouteStatsResult, fidl::Error>,
> + Send;
fn r#get_route_stats(
&self,
addresses: &Ipv4UnicastSourceAndMulticastDestination,
) -> Self::GetRouteStatsResponseFut;
type WatchRoutingEventsResponseFut: std::future::Future<
Output = Result<
(u64, Ipv4UnicastSourceAndMulticastDestination, u64, RoutingEvent),
fidl::Error,
>,
> + Send;
fn r#watch_routing_events(&self) -> Self::WatchRoutingEventsResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct Ipv4RoutingTableControllerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for Ipv4RoutingTableControllerSynchronousProxy {
type Proxy = Ipv4RoutingTableControllerProxy;
type Protocol = Ipv4RoutingTableControllerMarker;
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 Ipv4RoutingTableControllerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<Ipv4RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<Ipv4RoutingTableControllerEvent, fidl::Error> {
Ipv4RoutingTableControllerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#add_route(
&self,
mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
mut route: &Route,
___deadline: zx::MonotonicInstant,
) -> Result<Ipv4RoutingTableControllerAddRouteResult, fidl::Error> {
let _response = self
.client
.send_query::<Ipv4RoutingTableControllerAddRouteRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
Ipv4RoutingTableControllerAddRouteError,
>>(
(addresses, route),
0x6098a90553ef1aed,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#del_route(
&self,
mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
___deadline: zx::MonotonicInstant,
) -> Result<Ipv4RoutingTableControllerDelRouteResult, fidl::Error> {
let _response = self
.client
.send_query::<Ipv4RoutingTableControllerDelRouteRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
Ipv4RoutingTableControllerDelRouteError,
>>(
(addresses,),
0x14a0727b797aff74,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_route_stats(
&self,
mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
___deadline: zx::MonotonicInstant,
) -> Result<Ipv4RoutingTableControllerGetRouteStatsResult, fidl::Error> {
let _response = self.client.send_query::<
Ipv4RoutingTableControllerGetRouteStatsRequest,
fidl::encoding::ResultType<Ipv4RoutingTableControllerGetRouteStatsResponse, Ipv4RoutingTableControllerGetRouteStatsError>,
>(
(addresses,),
0x176ad8488370c1e9,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.stats))
}
pub fn r#watch_routing_events(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<(u64, Ipv4UnicastSourceAndMulticastDestination, u64, RoutingEvent), fidl::Error>
{
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
Ipv4RoutingTableControllerWatchRoutingEventsResponse,
>(
(),
0x3e4336c50718d7f9,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((
_response.dropped_events,
_response.addresses,
_response.input_interface,
_response.event,
))
}
}
#[derive(Debug, Clone)]
pub struct Ipv4RoutingTableControllerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for Ipv4RoutingTableControllerProxy {
type Protocol = Ipv4RoutingTableControllerMarker;
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 Ipv4RoutingTableControllerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<Ipv4RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> Ipv4RoutingTableControllerEventStream {
Ipv4RoutingTableControllerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#add_route(
&self,
mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
mut route: &Route,
) -> fidl::client::QueryResponseFut<
Ipv4RoutingTableControllerAddRouteResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
Ipv4RoutingTableControllerProxyInterface::r#add_route(self, addresses, route)
}
pub fn r#del_route(
&self,
mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
) -> fidl::client::QueryResponseFut<
Ipv4RoutingTableControllerDelRouteResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
Ipv4RoutingTableControllerProxyInterface::r#del_route(self, addresses)
}
pub fn r#get_route_stats(
&self,
mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
) -> fidl::client::QueryResponseFut<
Ipv4RoutingTableControllerGetRouteStatsResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
Ipv4RoutingTableControllerProxyInterface::r#get_route_stats(self, addresses)
}
pub fn r#watch_routing_events(
&self,
) -> fidl::client::QueryResponseFut<
(u64, Ipv4UnicastSourceAndMulticastDestination, u64, RoutingEvent),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
Ipv4RoutingTableControllerProxyInterface::r#watch_routing_events(self)
}
}
impl Ipv4RoutingTableControllerProxyInterface for Ipv4RoutingTableControllerProxy {
type AddRouteResponseFut = fidl::client::QueryResponseFut<
Ipv4RoutingTableControllerAddRouteResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#add_route(
&self,
mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
mut route: &Route,
) -> Self::AddRouteResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Ipv4RoutingTableControllerAddRouteResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
Ipv4RoutingTableControllerAddRouteError,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6098a90553ef1aed,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
Ipv4RoutingTableControllerAddRouteRequest,
Ipv4RoutingTableControllerAddRouteResult,
>(
(addresses, route,),
0x6098a90553ef1aed,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type DelRouteResponseFut = fidl::client::QueryResponseFut<
Ipv4RoutingTableControllerDelRouteResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#del_route(
&self,
mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
) -> Self::DelRouteResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Ipv4RoutingTableControllerDelRouteResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
Ipv4RoutingTableControllerDelRouteError,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x14a0727b797aff74,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
Ipv4RoutingTableControllerDelRouteRequest,
Ipv4RoutingTableControllerDelRouteResult,
>(
(addresses,),
0x14a0727b797aff74,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetRouteStatsResponseFut = fidl::client::QueryResponseFut<
Ipv4RoutingTableControllerGetRouteStatsResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_route_stats(
&self,
mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
) -> Self::GetRouteStatsResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Ipv4RoutingTableControllerGetRouteStatsResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<
Ipv4RoutingTableControllerGetRouteStatsResponse,
Ipv4RoutingTableControllerGetRouteStatsError,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x176ad8488370c1e9,
>(_buf?)?;
Ok(_response.map(|x| x.stats))
}
self.client.send_query_and_decode::<
Ipv4RoutingTableControllerGetRouteStatsRequest,
Ipv4RoutingTableControllerGetRouteStatsResult,
>(
(addresses,),
0x176ad8488370c1e9,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WatchRoutingEventsResponseFut = fidl::client::QueryResponseFut<
(u64, Ipv4UnicastSourceAndMulticastDestination, u64, RoutingEvent),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_routing_events(&self) -> Self::WatchRoutingEventsResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(u64, Ipv4UnicastSourceAndMulticastDestination, u64, RoutingEvent), fidl::Error>
{
let _response = fidl::client::decode_transaction_body::<
Ipv4RoutingTableControllerWatchRoutingEventsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x3e4336c50718d7f9,
>(_buf?)?;
Ok((
_response.dropped_events,
_response.addresses,
_response.input_interface,
_response.event,
))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
(u64, Ipv4UnicastSourceAndMulticastDestination, u64, RoutingEvent),
>(
(),
0x3e4336c50718d7f9,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct Ipv4RoutingTableControllerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for Ipv4RoutingTableControllerEventStream {}
impl futures::stream::FusedStream for Ipv4RoutingTableControllerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for Ipv4RoutingTableControllerEventStream {
type Item = Result<Ipv4RoutingTableControllerEvent, 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(Ipv4RoutingTableControllerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum Ipv4RoutingTableControllerEvent {
OnClose { error: TableControllerCloseReason },
}
impl Ipv4RoutingTableControllerEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_close(self) -> Option<TableControllerCloseReason> {
if let Ipv4RoutingTableControllerEvent::OnClose { error } = self {
Some((error))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<Ipv4RoutingTableControllerEvent, 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 {
0x3dec49c6c2070f14 => {
let mut out = fidl::new_empty!(Ipv4RoutingTableControllerOnCloseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv4RoutingTableControllerOnCloseRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((
Ipv4RoutingTableControllerEvent::OnClose {error: out.error,
}
))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <Ipv4RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
})
}
}
}
pub struct Ipv4RoutingTableControllerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for Ipv4RoutingTableControllerRequestStream {}
impl futures::stream::FusedStream for Ipv4RoutingTableControllerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for Ipv4RoutingTableControllerRequestStream {
type Protocol = Ipv4RoutingTableControllerMarker;
type ControlHandle = Ipv4RoutingTableControllerControlHandle;
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 {
Ipv4RoutingTableControllerControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for Ipv4RoutingTableControllerRequestStream {
type Item = Result<Ipv4RoutingTableControllerRequest, 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 Ipv4RoutingTableControllerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x6098a90553ef1aed => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(Ipv4RoutingTableControllerAddRouteRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv4RoutingTableControllerAddRouteRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = Ipv4RoutingTableControllerControlHandle {
inner: this.inner.clone(),
};
Ok(Ipv4RoutingTableControllerRequest::AddRoute {addresses: req.addresses,
route: req.route,
responder: Ipv4RoutingTableControllerAddRouteResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x14a0727b797aff74 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(Ipv4RoutingTableControllerDelRouteRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv4RoutingTableControllerDelRouteRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = Ipv4RoutingTableControllerControlHandle {
inner: this.inner.clone(),
};
Ok(Ipv4RoutingTableControllerRequest::DelRoute {addresses: req.addresses,
responder: Ipv4RoutingTableControllerDelRouteResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x176ad8488370c1e9 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(Ipv4RoutingTableControllerGetRouteStatsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv4RoutingTableControllerGetRouteStatsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = Ipv4RoutingTableControllerControlHandle {
inner: this.inner.clone(),
};
Ok(Ipv4RoutingTableControllerRequest::GetRouteStats {addresses: req.addresses,
responder: Ipv4RoutingTableControllerGetRouteStatsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x3e4336c50718d7f9 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = Ipv4RoutingTableControllerControlHandle {
inner: this.inner.clone(),
};
Ok(Ipv4RoutingTableControllerRequest::WatchRoutingEvents {
responder: Ipv4RoutingTableControllerWatchRoutingEventsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <Ipv4RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum Ipv4RoutingTableControllerRequest {
AddRoute {
addresses: Ipv4UnicastSourceAndMulticastDestination,
route: Route,
responder: Ipv4RoutingTableControllerAddRouteResponder,
},
DelRoute {
addresses: Ipv4UnicastSourceAndMulticastDestination,
responder: Ipv4RoutingTableControllerDelRouteResponder,
},
GetRouteStats {
addresses: Ipv4UnicastSourceAndMulticastDestination,
responder: Ipv4RoutingTableControllerGetRouteStatsResponder,
},
WatchRoutingEvents { responder: Ipv4RoutingTableControllerWatchRoutingEventsResponder },
}
impl Ipv4RoutingTableControllerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_add_route(
self,
) -> Option<(
Ipv4UnicastSourceAndMulticastDestination,
Route,
Ipv4RoutingTableControllerAddRouteResponder,
)> {
if let Ipv4RoutingTableControllerRequest::AddRoute { addresses, route, responder } = self {
Some((addresses, route, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_del_route(
self,
) -> Option<(
Ipv4UnicastSourceAndMulticastDestination,
Ipv4RoutingTableControllerDelRouteResponder,
)> {
if let Ipv4RoutingTableControllerRequest::DelRoute { addresses, responder } = self {
Some((addresses, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_route_stats(
self,
) -> Option<(
Ipv4UnicastSourceAndMulticastDestination,
Ipv4RoutingTableControllerGetRouteStatsResponder,
)> {
if let Ipv4RoutingTableControllerRequest::GetRouteStats { addresses, responder } = self {
Some((addresses, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_routing_events(
self,
) -> Option<(Ipv4RoutingTableControllerWatchRoutingEventsResponder)> {
if let Ipv4RoutingTableControllerRequest::WatchRoutingEvents { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
Ipv4RoutingTableControllerRequest::AddRoute { .. } => "add_route",
Ipv4RoutingTableControllerRequest::DelRoute { .. } => "del_route",
Ipv4RoutingTableControllerRequest::GetRouteStats { .. } => "get_route_stats",
Ipv4RoutingTableControllerRequest::WatchRoutingEvents { .. } => "watch_routing_events",
}
}
}
#[derive(Debug, Clone)]
pub struct Ipv4RoutingTableControllerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for Ipv4RoutingTableControllerControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl Ipv4RoutingTableControllerControlHandle {
pub fn send_on_close(&self, mut error: TableControllerCloseReason) -> Result<(), fidl::Error> {
self.inner.send::<Ipv4RoutingTableControllerOnCloseRequest>(
(error,),
0,
0x3dec49c6c2070f14,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct Ipv4RoutingTableControllerAddRouteResponder {
control_handle: std::mem::ManuallyDrop<Ipv4RoutingTableControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for Ipv4RoutingTableControllerAddRouteResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for Ipv4RoutingTableControllerAddRouteResponder {
type ControlHandle = Ipv4RoutingTableControllerControlHandle;
fn control_handle(&self) -> &Ipv4RoutingTableControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl Ipv4RoutingTableControllerAddRouteResponder {
pub fn send(
self,
mut result: Result<(), Ipv4RoutingTableControllerAddRouteError>,
) -> 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<(), Ipv4RoutingTableControllerAddRouteError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), Ipv4RoutingTableControllerAddRouteError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
Ipv4RoutingTableControllerAddRouteError,
>>(
result,
self.tx_id,
0x6098a90553ef1aed,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct Ipv4RoutingTableControllerDelRouteResponder {
control_handle: std::mem::ManuallyDrop<Ipv4RoutingTableControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for Ipv4RoutingTableControllerDelRouteResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for Ipv4RoutingTableControllerDelRouteResponder {
type ControlHandle = Ipv4RoutingTableControllerControlHandle;
fn control_handle(&self) -> &Ipv4RoutingTableControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl Ipv4RoutingTableControllerDelRouteResponder {
pub fn send(
self,
mut result: Result<(), Ipv4RoutingTableControllerDelRouteError>,
) -> 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<(), Ipv4RoutingTableControllerDelRouteError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), Ipv4RoutingTableControllerDelRouteError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
Ipv4RoutingTableControllerDelRouteError,
>>(
result,
self.tx_id,
0x14a0727b797aff74,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct Ipv4RoutingTableControllerGetRouteStatsResponder {
control_handle: std::mem::ManuallyDrop<Ipv4RoutingTableControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for Ipv4RoutingTableControllerGetRouteStatsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for Ipv4RoutingTableControllerGetRouteStatsResponder {
type ControlHandle = Ipv4RoutingTableControllerControlHandle;
fn control_handle(&self) -> &Ipv4RoutingTableControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl Ipv4RoutingTableControllerGetRouteStatsResponder {
pub fn send(
self,
mut result: Result<&RouteStats, Ipv4RoutingTableControllerGetRouteStatsError>,
) -> 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<&RouteStats, Ipv4RoutingTableControllerGetRouteStatsError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<&RouteStats, Ipv4RoutingTableControllerGetRouteStatsError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
Ipv4RoutingTableControllerGetRouteStatsResponse,
Ipv4RoutingTableControllerGetRouteStatsError,
>>(
result.map(|stats| (stats,)),
self.tx_id,
0x176ad8488370c1e9,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct Ipv4RoutingTableControllerWatchRoutingEventsResponder {
control_handle: std::mem::ManuallyDrop<Ipv4RoutingTableControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for Ipv4RoutingTableControllerWatchRoutingEventsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for Ipv4RoutingTableControllerWatchRoutingEventsResponder {
type ControlHandle = Ipv4RoutingTableControllerControlHandle;
fn control_handle(&self) -> &Ipv4RoutingTableControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl Ipv4RoutingTableControllerWatchRoutingEventsResponder {
pub fn send(
self,
mut dropped_events: u64,
mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
mut input_interface: u64,
mut event: &RoutingEvent,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(dropped_events, addresses, input_interface, event);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut dropped_events: u64,
mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
mut input_interface: u64,
mut event: &RoutingEvent,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(dropped_events, addresses, input_interface, event);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut dropped_events: u64,
mut addresses: &Ipv4UnicastSourceAndMulticastDestination,
mut input_interface: u64,
mut event: &RoutingEvent,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<Ipv4RoutingTableControllerWatchRoutingEventsResponse>(
(dropped_events, addresses, input_interface, event),
self.tx_id,
0x3e4336c50718d7f9,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
pub struct Ipv6RoutingTableControllerMarker;
impl fidl::endpoints::ProtocolMarker for Ipv6RoutingTableControllerMarker {
type Proxy = Ipv6RoutingTableControllerProxy;
type RequestStream = Ipv6RoutingTableControllerRequestStream;
#[cfg(target_os = "fuchsia")]
type SynchronousProxy = Ipv6RoutingTableControllerSynchronousProxy;
const DEBUG_NAME: &'static str = "fuchsia.net.multicast.admin.Ipv6RoutingTableController";
}
impl fidl::endpoints::DiscoverableProtocolMarker for Ipv6RoutingTableControllerMarker {}
pub type Ipv6RoutingTableControllerAddRouteResult =
Result<(), Ipv6RoutingTableControllerAddRouteError>;
pub type Ipv6RoutingTableControllerDelRouteResult =
Result<(), Ipv6RoutingTableControllerDelRouteError>;
pub type Ipv6RoutingTableControllerGetRouteStatsResult =
Result<RouteStats, Ipv6RoutingTableControllerGetRouteStatsError>;
pub trait Ipv6RoutingTableControllerProxyInterface: Send + Sync {
type AddRouteResponseFut: std::future::Future<Output = Result<Ipv6RoutingTableControllerAddRouteResult, fidl::Error>>
+ Send;
fn r#add_route(
&self,
addresses: &Ipv6UnicastSourceAndMulticastDestination,
route: &Route,
) -> Self::AddRouteResponseFut;
type DelRouteResponseFut: std::future::Future<Output = Result<Ipv6RoutingTableControllerDelRouteResult, fidl::Error>>
+ Send;
fn r#del_route(
&self,
addresses: &Ipv6UnicastSourceAndMulticastDestination,
) -> Self::DelRouteResponseFut;
type GetRouteStatsResponseFut: std::future::Future<
Output = Result<Ipv6RoutingTableControllerGetRouteStatsResult, fidl::Error>,
> + Send;
fn r#get_route_stats(
&self,
addresses: &Ipv6UnicastSourceAndMulticastDestination,
) -> Self::GetRouteStatsResponseFut;
type WatchRoutingEventsResponseFut: std::future::Future<
Output = Result<
(u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent),
fidl::Error,
>,
> + Send;
fn r#watch_routing_events(&self) -> Self::WatchRoutingEventsResponseFut;
}
#[derive(Debug)]
#[cfg(target_os = "fuchsia")]
pub struct Ipv6RoutingTableControllerSynchronousProxy {
client: fidl::client::sync::Client,
}
#[cfg(target_os = "fuchsia")]
impl fidl::endpoints::SynchronousProxy for Ipv6RoutingTableControllerSynchronousProxy {
type Proxy = Ipv6RoutingTableControllerProxy;
type Protocol = Ipv6RoutingTableControllerMarker;
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 Ipv6RoutingTableControllerSynchronousProxy {
pub fn new(channel: fidl::Channel) -> Self {
let protocol_name =
<Ipv6RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::sync::Client::new(channel, protocol_name) }
}
pub fn into_channel(self) -> fidl::Channel {
self.client.into_channel()
}
pub fn wait_for_event(
&self,
deadline: zx::MonotonicInstant,
) -> Result<Ipv6RoutingTableControllerEvent, fidl::Error> {
Ipv6RoutingTableControllerEvent::decode(self.client.wait_for_event(deadline)?)
}
pub fn r#add_route(
&self,
mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
mut route: &Route,
___deadline: zx::MonotonicInstant,
) -> Result<Ipv6RoutingTableControllerAddRouteResult, fidl::Error> {
let _response = self
.client
.send_query::<Ipv6RoutingTableControllerAddRouteRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
Ipv6RoutingTableControllerAddRouteError,
>>(
(addresses, route),
0x71ca1f54a716de90,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#del_route(
&self,
mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
___deadline: zx::MonotonicInstant,
) -> Result<Ipv6RoutingTableControllerDelRouteResult, fidl::Error> {
let _response = self
.client
.send_query::<Ipv6RoutingTableControllerDelRouteRequest, fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
Ipv6RoutingTableControllerDelRouteError,
>>(
(addresses,),
0x35b6c2ce4a7b3f13,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x))
}
pub fn r#get_route_stats(
&self,
mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
___deadline: zx::MonotonicInstant,
) -> Result<Ipv6RoutingTableControllerGetRouteStatsResult, fidl::Error> {
let _response = self.client.send_query::<
Ipv6RoutingTableControllerGetRouteStatsRequest,
fidl::encoding::ResultType<Ipv6RoutingTableControllerGetRouteStatsResponse, Ipv6RoutingTableControllerGetRouteStatsError>,
>(
(addresses,),
0x6d7fa5e9f18ef79f,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok(_response.map(|x| x.stats))
}
pub fn r#watch_routing_events(
&self,
___deadline: zx::MonotonicInstant,
) -> Result<(u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent), fidl::Error>
{
let _response = self.client.send_query::<
fidl::encoding::EmptyPayload,
Ipv6RoutingTableControllerWatchRoutingEventsResponse,
>(
(),
0x22a94526a0ea1078,
fidl::encoding::DynamicFlags::empty(),
___deadline,
)?;
Ok((
_response.dropped_events,
_response.addresses,
_response.input_interface,
_response.event,
))
}
}
#[derive(Debug, Clone)]
pub struct Ipv6RoutingTableControllerProxy {
client: fidl::client::Client<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl fidl::endpoints::Proxy for Ipv6RoutingTableControllerProxy {
type Protocol = Ipv6RoutingTableControllerMarker;
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 Ipv6RoutingTableControllerProxy {
pub fn new(channel: ::fidl::AsyncChannel) -> Self {
let protocol_name =
<Ipv6RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME;
Self { client: fidl::client::Client::new(channel, protocol_name) }
}
pub fn take_event_stream(&self) -> Ipv6RoutingTableControllerEventStream {
Ipv6RoutingTableControllerEventStream { event_receiver: self.client.take_event_receiver() }
}
pub fn r#add_route(
&self,
mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
mut route: &Route,
) -> fidl::client::QueryResponseFut<
Ipv6RoutingTableControllerAddRouteResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
Ipv6RoutingTableControllerProxyInterface::r#add_route(self, addresses, route)
}
pub fn r#del_route(
&self,
mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
) -> fidl::client::QueryResponseFut<
Ipv6RoutingTableControllerDelRouteResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
Ipv6RoutingTableControllerProxyInterface::r#del_route(self, addresses)
}
pub fn r#get_route_stats(
&self,
mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
) -> fidl::client::QueryResponseFut<
Ipv6RoutingTableControllerGetRouteStatsResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
Ipv6RoutingTableControllerProxyInterface::r#get_route_stats(self, addresses)
}
pub fn r#watch_routing_events(
&self,
) -> fidl::client::QueryResponseFut<
(u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent),
fidl::encoding::DefaultFuchsiaResourceDialect,
> {
Ipv6RoutingTableControllerProxyInterface::r#watch_routing_events(self)
}
}
impl Ipv6RoutingTableControllerProxyInterface for Ipv6RoutingTableControllerProxy {
type AddRouteResponseFut = fidl::client::QueryResponseFut<
Ipv6RoutingTableControllerAddRouteResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#add_route(
&self,
mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
mut route: &Route,
) -> Self::AddRouteResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Ipv6RoutingTableControllerAddRouteResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
Ipv6RoutingTableControllerAddRouteError,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x71ca1f54a716de90,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
Ipv6RoutingTableControllerAddRouteRequest,
Ipv6RoutingTableControllerAddRouteResult,
>(
(addresses, route,),
0x71ca1f54a716de90,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type DelRouteResponseFut = fidl::client::QueryResponseFut<
Ipv6RoutingTableControllerDelRouteResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#del_route(
&self,
mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
) -> Self::DelRouteResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Ipv6RoutingTableControllerDelRouteResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
Ipv6RoutingTableControllerDelRouteError,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x35b6c2ce4a7b3f13,
>(_buf?)?;
Ok(_response.map(|x| x))
}
self.client.send_query_and_decode::<
Ipv6RoutingTableControllerDelRouteRequest,
Ipv6RoutingTableControllerDelRouteResult,
>(
(addresses,),
0x35b6c2ce4a7b3f13,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type GetRouteStatsResponseFut = fidl::client::QueryResponseFut<
Ipv6RoutingTableControllerGetRouteStatsResult,
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#get_route_stats(
&self,
mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
) -> Self::GetRouteStatsResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<Ipv6RoutingTableControllerGetRouteStatsResult, fidl::Error> {
let _response = fidl::client::decode_transaction_body::<
fidl::encoding::ResultType<
Ipv6RoutingTableControllerGetRouteStatsResponse,
Ipv6RoutingTableControllerGetRouteStatsError,
>,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x6d7fa5e9f18ef79f,
>(_buf?)?;
Ok(_response.map(|x| x.stats))
}
self.client.send_query_and_decode::<
Ipv6RoutingTableControllerGetRouteStatsRequest,
Ipv6RoutingTableControllerGetRouteStatsResult,
>(
(addresses,),
0x6d7fa5e9f18ef79f,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
type WatchRoutingEventsResponseFut = fidl::client::QueryResponseFut<
(u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent),
fidl::encoding::DefaultFuchsiaResourceDialect,
>;
fn r#watch_routing_events(&self) -> Self::WatchRoutingEventsResponseFut {
fn _decode(
mut _buf: Result<<fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc, fidl::Error>,
) -> Result<(u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent), fidl::Error>
{
let _response = fidl::client::decode_transaction_body::<
Ipv6RoutingTableControllerWatchRoutingEventsResponse,
fidl::encoding::DefaultFuchsiaResourceDialect,
0x22a94526a0ea1078,
>(_buf?)?;
Ok((
_response.dropped_events,
_response.addresses,
_response.input_interface,
_response.event,
))
}
self.client.send_query_and_decode::<
fidl::encoding::EmptyPayload,
(u64, Ipv6UnicastSourceAndMulticastDestination, u64, RoutingEvent),
>(
(),
0x22a94526a0ea1078,
fidl::encoding::DynamicFlags::empty(),
_decode,
)
}
}
pub struct Ipv6RoutingTableControllerEventStream {
event_receiver: fidl::client::EventReceiver<fidl::encoding::DefaultFuchsiaResourceDialect>,
}
impl std::marker::Unpin for Ipv6RoutingTableControllerEventStream {}
impl futures::stream::FusedStream for Ipv6RoutingTableControllerEventStream {
fn is_terminated(&self) -> bool {
self.event_receiver.is_terminated()
}
}
impl futures::Stream for Ipv6RoutingTableControllerEventStream {
type Item = Result<Ipv6RoutingTableControllerEvent, 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(Ipv6RoutingTableControllerEvent::decode(buf))),
None => std::task::Poll::Ready(None),
}
}
}
#[derive(Debug)]
pub enum Ipv6RoutingTableControllerEvent {
OnClose { error: TableControllerCloseReason },
}
impl Ipv6RoutingTableControllerEvent {
#[allow(irrefutable_let_patterns)]
pub fn into_on_close(self) -> Option<TableControllerCloseReason> {
if let Ipv6RoutingTableControllerEvent::OnClose { error } = self {
Some((error))
} else {
None
}
}
fn decode(
mut buf: <fidl::encoding::DefaultFuchsiaResourceDialect as fidl::encoding::ResourceDialect>::MessageBufEtc,
) -> Result<Ipv6RoutingTableControllerEvent, 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 {
0x2d3a353489d1e0be => {
let mut out = fidl::new_empty!(Ipv6RoutingTableControllerOnCloseRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv6RoutingTableControllerOnCloseRequest>(&tx_header, _body_bytes, _handles, &mut out)?;
Ok((
Ipv6RoutingTableControllerEvent::OnClose {error: out.error,
}
))
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: tx_header.ordinal,
protocol_name: <Ipv6RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
})
}
}
}
pub struct Ipv6RoutingTableControllerRequestStream {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
}
impl std::marker::Unpin for Ipv6RoutingTableControllerRequestStream {}
impl futures::stream::FusedStream for Ipv6RoutingTableControllerRequestStream {
fn is_terminated(&self) -> bool {
self.is_terminated
}
}
impl fidl::endpoints::RequestStream for Ipv6RoutingTableControllerRequestStream {
type Protocol = Ipv6RoutingTableControllerMarker;
type ControlHandle = Ipv6RoutingTableControllerControlHandle;
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 {
Ipv6RoutingTableControllerControlHandle { inner: self.inner.clone() }
}
fn into_inner(
self,
) -> (::std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>, bool)
{
(self.inner, self.is_terminated)
}
fn from_inner(
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
is_terminated: bool,
) -> Self {
Self { inner, is_terminated }
}
}
impl futures::Stream for Ipv6RoutingTableControllerRequestStream {
type Item = Result<Ipv6RoutingTableControllerRequest, 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 Ipv6RoutingTableControllerRequestStream after completion");
}
fidl::encoding::with_tls_decode_buf::<_, fidl::encoding::DefaultFuchsiaResourceDialect>(
|bytes, handles| {
match this.inner.channel().read_etc(cx, bytes, handles) {
std::task::Poll::Ready(Ok(())) => {}
std::task::Poll::Pending => return std::task::Poll::Pending,
std::task::Poll::Ready(Err(zx_status::Status::PEER_CLOSED)) => {
this.is_terminated = true;
return std::task::Poll::Ready(None);
}
std::task::Poll::Ready(Err(e)) => {
return std::task::Poll::Ready(Some(Err(fidl::Error::ServerRequestRead(
e.into(),
))))
}
}
let (header, _body_bytes) = fidl::encoding::decode_transaction_header(bytes)?;
std::task::Poll::Ready(Some(match header.ordinal {
0x71ca1f54a716de90 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(Ipv6RoutingTableControllerAddRouteRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv6RoutingTableControllerAddRouteRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = Ipv6RoutingTableControllerControlHandle {
inner: this.inner.clone(),
};
Ok(Ipv6RoutingTableControllerRequest::AddRoute {addresses: req.addresses,
route: req.route,
responder: Ipv6RoutingTableControllerAddRouteResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x35b6c2ce4a7b3f13 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(Ipv6RoutingTableControllerDelRouteRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv6RoutingTableControllerDelRouteRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = Ipv6RoutingTableControllerControlHandle {
inner: this.inner.clone(),
};
Ok(Ipv6RoutingTableControllerRequest::DelRoute {addresses: req.addresses,
responder: Ipv6RoutingTableControllerDelRouteResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x6d7fa5e9f18ef79f => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(Ipv6RoutingTableControllerGetRouteStatsRequest, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<Ipv6RoutingTableControllerGetRouteStatsRequest>(&header, _body_bytes, handles, &mut req)?;
let control_handle = Ipv6RoutingTableControllerControlHandle {
inner: this.inner.clone(),
};
Ok(Ipv6RoutingTableControllerRequest::GetRouteStats {addresses: req.addresses,
responder: Ipv6RoutingTableControllerGetRouteStatsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
0x22a94526a0ea1078 => {
header.validate_request_tx_id(fidl::MethodType::TwoWay)?;
let mut req = fidl::new_empty!(fidl::encoding::EmptyPayload, fidl::encoding::DefaultFuchsiaResourceDialect);
fidl::encoding::Decoder::<fidl::encoding::DefaultFuchsiaResourceDialect>::decode_into::<fidl::encoding::EmptyPayload>(&header, _body_bytes, handles, &mut req)?;
let control_handle = Ipv6RoutingTableControllerControlHandle {
inner: this.inner.clone(),
};
Ok(Ipv6RoutingTableControllerRequest::WatchRoutingEvents {
responder: Ipv6RoutingTableControllerWatchRoutingEventsResponder {
control_handle: std::mem::ManuallyDrop::new(control_handle),
tx_id: header.tx_id,
},
})
}
_ => Err(fidl::Error::UnknownOrdinal {
ordinal: header.ordinal,
protocol_name: <Ipv6RoutingTableControllerMarker as fidl::endpoints::ProtocolMarker>::DEBUG_NAME,
}),
}))
},
)
}
}
#[derive(Debug)]
pub enum Ipv6RoutingTableControllerRequest {
AddRoute {
addresses: Ipv6UnicastSourceAndMulticastDestination,
route: Route,
responder: Ipv6RoutingTableControllerAddRouteResponder,
},
DelRoute {
addresses: Ipv6UnicastSourceAndMulticastDestination,
responder: Ipv6RoutingTableControllerDelRouteResponder,
},
GetRouteStats {
addresses: Ipv6UnicastSourceAndMulticastDestination,
responder: Ipv6RoutingTableControllerGetRouteStatsResponder,
},
WatchRoutingEvents { responder: Ipv6RoutingTableControllerWatchRoutingEventsResponder },
}
impl Ipv6RoutingTableControllerRequest {
#[allow(irrefutable_let_patterns)]
pub fn into_add_route(
self,
) -> Option<(
Ipv6UnicastSourceAndMulticastDestination,
Route,
Ipv6RoutingTableControllerAddRouteResponder,
)> {
if let Ipv6RoutingTableControllerRequest::AddRoute { addresses, route, responder } = self {
Some((addresses, route, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_del_route(
self,
) -> Option<(
Ipv6UnicastSourceAndMulticastDestination,
Ipv6RoutingTableControllerDelRouteResponder,
)> {
if let Ipv6RoutingTableControllerRequest::DelRoute { addresses, responder } = self {
Some((addresses, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_get_route_stats(
self,
) -> Option<(
Ipv6UnicastSourceAndMulticastDestination,
Ipv6RoutingTableControllerGetRouteStatsResponder,
)> {
if let Ipv6RoutingTableControllerRequest::GetRouteStats { addresses, responder } = self {
Some((addresses, responder))
} else {
None
}
}
#[allow(irrefutable_let_patterns)]
pub fn into_watch_routing_events(
self,
) -> Option<(Ipv6RoutingTableControllerWatchRoutingEventsResponder)> {
if let Ipv6RoutingTableControllerRequest::WatchRoutingEvents { responder } = self {
Some((responder))
} else {
None
}
}
pub fn method_name(&self) -> &'static str {
match *self {
Ipv6RoutingTableControllerRequest::AddRoute { .. } => "add_route",
Ipv6RoutingTableControllerRequest::DelRoute { .. } => "del_route",
Ipv6RoutingTableControllerRequest::GetRouteStats { .. } => "get_route_stats",
Ipv6RoutingTableControllerRequest::WatchRoutingEvents { .. } => "watch_routing_events",
}
}
}
#[derive(Debug, Clone)]
pub struct Ipv6RoutingTableControllerControlHandle {
inner: std::sync::Arc<fidl::ServeInner<fidl::encoding::DefaultFuchsiaResourceDialect>>,
}
impl fidl::endpoints::ControlHandle for Ipv6RoutingTableControllerControlHandle {
fn shutdown(&self) {
self.inner.shutdown()
}
fn shutdown_with_epitaph(&self, status: zx_status::Status) {
self.inner.shutdown_with_epitaph(status)
}
fn is_closed(&self) -> bool {
self.inner.channel().is_closed()
}
fn on_closed(&self) -> fidl::OnSignalsRef<'_> {
self.inner.channel().on_closed()
}
#[cfg(target_os = "fuchsia")]
fn signal_peer(
&self,
clear_mask: zx::Signals,
set_mask: zx::Signals,
) -> Result<(), zx_status::Status> {
use fidl::Peered;
self.inner.channel().signal_peer(clear_mask, set_mask)
}
}
impl Ipv6RoutingTableControllerControlHandle {
pub fn send_on_close(&self, mut error: TableControllerCloseReason) -> Result<(), fidl::Error> {
self.inner.send::<Ipv6RoutingTableControllerOnCloseRequest>(
(error,),
0,
0x2d3a353489d1e0be,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct Ipv6RoutingTableControllerAddRouteResponder {
control_handle: std::mem::ManuallyDrop<Ipv6RoutingTableControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for Ipv6RoutingTableControllerAddRouteResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for Ipv6RoutingTableControllerAddRouteResponder {
type ControlHandle = Ipv6RoutingTableControllerControlHandle;
fn control_handle(&self) -> &Ipv6RoutingTableControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl Ipv6RoutingTableControllerAddRouteResponder {
pub fn send(
self,
mut result: Result<(), Ipv6RoutingTableControllerAddRouteError>,
) -> 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<(), Ipv6RoutingTableControllerAddRouteError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), Ipv6RoutingTableControllerAddRouteError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
Ipv6RoutingTableControllerAddRouteError,
>>(
result,
self.tx_id,
0x71ca1f54a716de90,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct Ipv6RoutingTableControllerDelRouteResponder {
control_handle: std::mem::ManuallyDrop<Ipv6RoutingTableControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for Ipv6RoutingTableControllerDelRouteResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for Ipv6RoutingTableControllerDelRouteResponder {
type ControlHandle = Ipv6RoutingTableControllerControlHandle;
fn control_handle(&self) -> &Ipv6RoutingTableControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl Ipv6RoutingTableControllerDelRouteResponder {
pub fn send(
self,
mut result: Result<(), Ipv6RoutingTableControllerDelRouteError>,
) -> 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<(), Ipv6RoutingTableControllerDelRouteError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<(), Ipv6RoutingTableControllerDelRouteError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
fidl::encoding::EmptyStruct,
Ipv6RoutingTableControllerDelRouteError,
>>(
result,
self.tx_id,
0x35b6c2ce4a7b3f13,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct Ipv6RoutingTableControllerGetRouteStatsResponder {
control_handle: std::mem::ManuallyDrop<Ipv6RoutingTableControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for Ipv6RoutingTableControllerGetRouteStatsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for Ipv6RoutingTableControllerGetRouteStatsResponder {
type ControlHandle = Ipv6RoutingTableControllerControlHandle;
fn control_handle(&self) -> &Ipv6RoutingTableControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl Ipv6RoutingTableControllerGetRouteStatsResponder {
pub fn send(
self,
mut result: Result<&RouteStats, Ipv6RoutingTableControllerGetRouteStatsError>,
) -> 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<&RouteStats, Ipv6RoutingTableControllerGetRouteStatsError>,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(result);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut result: Result<&RouteStats, Ipv6RoutingTableControllerGetRouteStatsError>,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<fidl::encoding::ResultType<
Ipv6RoutingTableControllerGetRouteStatsResponse,
Ipv6RoutingTableControllerGetRouteStatsError,
>>(
result.map(|stats| (stats,)),
self.tx_id,
0x6d7fa5e9f18ef79f,
fidl::encoding::DynamicFlags::empty(),
)
}
}
#[must_use = "FIDL methods require a response to be sent"]
#[derive(Debug)]
pub struct Ipv6RoutingTableControllerWatchRoutingEventsResponder {
control_handle: std::mem::ManuallyDrop<Ipv6RoutingTableControllerControlHandle>,
tx_id: u32,
}
impl std::ops::Drop for Ipv6RoutingTableControllerWatchRoutingEventsResponder {
fn drop(&mut self) {
self.control_handle.shutdown();
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
}
}
impl fidl::endpoints::Responder for Ipv6RoutingTableControllerWatchRoutingEventsResponder {
type ControlHandle = Ipv6RoutingTableControllerControlHandle;
fn control_handle(&self) -> &Ipv6RoutingTableControllerControlHandle {
&self.control_handle
}
fn drop_without_shutdown(mut self) {
unsafe { std::mem::ManuallyDrop::drop(&mut self.control_handle) };
std::mem::forget(self);
}
}
impl Ipv6RoutingTableControllerWatchRoutingEventsResponder {
pub fn send(
self,
mut dropped_events: u64,
mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
mut input_interface: u64,
mut event: &RoutingEvent,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(dropped_events, addresses, input_interface, event);
if _result.is_err() {
self.control_handle.shutdown();
}
self.drop_without_shutdown();
_result
}
pub fn send_no_shutdown_on_err(
self,
mut dropped_events: u64,
mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
mut input_interface: u64,
mut event: &RoutingEvent,
) -> Result<(), fidl::Error> {
let _result = self.send_raw(dropped_events, addresses, input_interface, event);
self.drop_without_shutdown();
_result
}
fn send_raw(
&self,
mut dropped_events: u64,
mut addresses: &Ipv6UnicastSourceAndMulticastDestination,
mut input_interface: u64,
mut event: &RoutingEvent,
) -> Result<(), fidl::Error> {
self.control_handle.inner.send::<Ipv6RoutingTableControllerWatchRoutingEventsResponse>(
(dropped_events, addresses, input_interface, event),
self.tx_id,
0x22a94526a0ea1078,
fidl::encoding::DynamicFlags::empty(),
)
}
}
mod internal {
use super::*;
unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerAddRouteError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerAddRouteError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for Ipv4RoutingTableControllerAddRouteError
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv4RoutingTableControllerAddRouteError
{
#[inline(always)]
fn new_empty() -> Self {
Self::InvalidAddress
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerDelRouteError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerDelRouteError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for Ipv4RoutingTableControllerDelRouteError
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv4RoutingTableControllerDelRouteError
{
#[inline(always)]
fn new_empty() -> Self {
Self::InvalidAddress
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerGetRouteStatsError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerGetRouteStatsError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for Ipv4RoutingTableControllerGetRouteStatsError
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv4RoutingTableControllerGetRouteStatsError
{
#[inline(always)]
fn new_empty() -> Self {
Self::InvalidAddress
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerAddRouteError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerAddRouteError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for Ipv6RoutingTableControllerAddRouteError
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv6RoutingTableControllerAddRouteError
{
#[inline(always)]
fn new_empty() -> Self {
Self::InvalidAddress
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerDelRouteError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerDelRouteError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for Ipv6RoutingTableControllerDelRouteError
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv6RoutingTableControllerDelRouteError
{
#[inline(always)]
fn new_empty() -> Self {
Self::InvalidAddress
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerGetRouteStatsError {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerGetRouteStatsError {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for Ipv6RoutingTableControllerGetRouteStatsError
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv6RoutingTableControllerGetRouteStatsError
{
#[inline(always)]
fn new_empty() -> Self {
Self::InvalidAddress
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
unsafe impl fidl::encoding::TypeMarker for TableControllerCloseReason {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
std::mem::align_of::<u32>()
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
std::mem::size_of::<u32>()
}
#[inline(always)]
fn encode_is_copy() -> bool {
true
}
#[inline(always)]
fn decode_is_copy() -> bool {
false
}
}
impl fidl::encoding::ValueTypeMarker for TableControllerCloseReason {
type Borrowed<'a> = Self;
#[inline(always)]
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
*value
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Self, D>
for TableControllerCloseReason
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Self>(offset);
encoder.write_num(self.into_primitive(), offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for TableControllerCloseReason
{
#[inline(always)]
fn new_empty() -> Self {
Self::AlreadyInUse
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let prim = decoder.read_num::<u32>(offset);
*self = Self::from_primitive(prim).ok_or(fidl::Error::InvalidEnumValue)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Empty {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Empty {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
1
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Empty, D> for &Empty {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Empty>(offset);
encoder.write_num(0u8, offset);
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Empty {
#[inline(always)]
fn new_empty() -> Self {
Self
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
match decoder.read_num::<u8>(offset) {
0 => Ok(()),
_ => Err(fidl::Error::Invalid),
}
}
}
impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerAddRouteRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerAddRouteRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
24
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<Ipv4RoutingTableControllerAddRouteRequest, D>
for &Ipv4RoutingTableControllerAddRouteRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv4RoutingTableControllerAddRouteRequest>(offset);
fidl::encoding::Encode::<Ipv4RoutingTableControllerAddRouteRequest, D>::encode(
(
<Ipv4UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
<Route as fidl::encoding::ValueTypeMarker>::borrow(&self.route),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Ipv4UnicastSourceAndMulticastDestination, D>,
T1: fidl::encoding::Encode<Route, D>,
> fidl::encoding::Encode<Ipv4RoutingTableControllerAddRouteRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv4RoutingTableControllerAddRouteRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv4RoutingTableControllerAddRouteRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
addresses: fidl::new_empty!(Ipv4UnicastSourceAndMulticastDestination, D),
route: fidl::new_empty!(Route, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
Ipv4UnicastSourceAndMulticastDestination,
D,
&mut self.addresses,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(Route, D, &mut self.route, decoder, offset + 8, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerDelRouteRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerDelRouteRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<Ipv4RoutingTableControllerDelRouteRequest, D>
for &Ipv4RoutingTableControllerDelRouteRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv4RoutingTableControllerDelRouteRequest>(offset);
fidl::encoding::Encode::<Ipv4RoutingTableControllerDelRouteRequest, D>::encode(
(
<Ipv4UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Ipv4UnicastSourceAndMulticastDestination, D>,
> fidl::encoding::Encode<Ipv4RoutingTableControllerDelRouteRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv4RoutingTableControllerDelRouteRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv4RoutingTableControllerDelRouteRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { addresses: fidl::new_empty!(Ipv4UnicastSourceAndMulticastDestination, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
Ipv4UnicastSourceAndMulticastDestination,
D,
&mut self.addresses,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerGetRouteStatsRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerGetRouteStatsRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<Ipv4RoutingTableControllerGetRouteStatsRequest, D>
for &Ipv4RoutingTableControllerGetRouteStatsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv4RoutingTableControllerGetRouteStatsRequest>(offset);
fidl::encoding::Encode::<Ipv4RoutingTableControllerGetRouteStatsRequest, D>::encode(
(
<Ipv4UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Ipv4UnicastSourceAndMulticastDestination, D>,
> fidl::encoding::Encode<Ipv4RoutingTableControllerGetRouteStatsRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv4RoutingTableControllerGetRouteStatsRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv4RoutingTableControllerGetRouteStatsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { addresses: fidl::new_empty!(Ipv4UnicastSourceAndMulticastDestination, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
Ipv4UnicastSourceAndMulticastDestination,
D,
&mut self.addresses,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerOnCloseRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerOnCloseRequest {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<Ipv4RoutingTableControllerOnCloseRequest, D>
for &Ipv4RoutingTableControllerOnCloseRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv4RoutingTableControllerOnCloseRequest>(offset);
fidl::encoding::Encode::<Ipv4RoutingTableControllerOnCloseRequest, D>::encode(
(<TableControllerCloseReason as fidl::encoding::ValueTypeMarker>::borrow(
&self.error,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<TableControllerCloseReason, D>,
> fidl::encoding::Encode<Ipv4RoutingTableControllerOnCloseRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv4RoutingTableControllerOnCloseRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv4RoutingTableControllerOnCloseRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { error: fidl::new_empty!(TableControllerCloseReason, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
TableControllerCloseReason,
D,
&mut self.error,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerWatchRoutingEventsResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerWatchRoutingEventsResponse {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<Ipv4RoutingTableControllerWatchRoutingEventsResponse, D>
for &Ipv4RoutingTableControllerWatchRoutingEventsResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<Ipv4RoutingTableControllerWatchRoutingEventsResponse>(offset);
fidl::encoding::Encode::<Ipv4RoutingTableControllerWatchRoutingEventsResponse, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.dropped_events),
<Ipv4UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.input_interface),
<RoutingEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<Ipv4UnicastSourceAndMulticastDestination, D>,
T2: fidl::encoding::Encode<u64, D>,
T3: fidl::encoding::Encode<RoutingEvent, D>,
> fidl::encoding::Encode<Ipv4RoutingTableControllerWatchRoutingEventsResponse, D>
for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<Ipv4RoutingTableControllerWatchRoutingEventsResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 16, depth)?;
self.3.encode(encoder, offset + 24, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv4RoutingTableControllerWatchRoutingEventsResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
dropped_events: fidl::new_empty!(u64, D),
addresses: fidl::new_empty!(Ipv4UnicastSourceAndMulticastDestination, D),
input_interface: fidl::new_empty!(u64, D),
event: fidl::new_empty!(RoutingEvent, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u64, D, &mut self.dropped_events, decoder, offset + 0, _depth)?;
fidl::decode!(
Ipv4UnicastSourceAndMulticastDestination,
D,
&mut self.addresses,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(u64, D, &mut self.input_interface, decoder, offset + 16, _depth)?;
fidl::decode!(RoutingEvent, D, &mut self.event, decoder, offset + 24, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Ipv4RoutingTableControllerGetRouteStatsResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Ipv4RoutingTableControllerGetRouteStatsResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<Ipv4RoutingTableControllerGetRouteStatsResponse, D>
for &Ipv4RoutingTableControllerGetRouteStatsResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv4RoutingTableControllerGetRouteStatsResponse>(offset);
fidl::encoding::Encode::<Ipv4RoutingTableControllerGetRouteStatsResponse, D>::encode(
(<RouteStats as fidl::encoding::ValueTypeMarker>::borrow(&self.stats),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RouteStats, D>>
fidl::encoding::Encode<Ipv4RoutingTableControllerGetRouteStatsResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv4RoutingTableControllerGetRouteStatsResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv4RoutingTableControllerGetRouteStatsResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { stats: fidl::new_empty!(RouteStats, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(RouteStats, D, &mut self.stats, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Ipv4UnicastSourceAndMulticastDestination {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Ipv4UnicastSourceAndMulticastDestination {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
8
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<Ipv4UnicastSourceAndMulticastDestination, D>
for &Ipv4UnicastSourceAndMulticastDestination
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv4UnicastSourceAndMulticastDestination>(offset);
fidl::encoding::Encode::<Ipv4UnicastSourceAndMulticastDestination, D>::encode(
(
<fidl_fuchsia_net::Ipv4Address as fidl::encoding::ValueTypeMarker>::borrow(
&self.unicast_source,
),
<fidl_fuchsia_net::Ipv4Address as fidl::encoding::ValueTypeMarker>::borrow(
&self.multicast_destination,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_net::Ipv4Address, D>,
T1: fidl::encoding::Encode<fidl_fuchsia_net::Ipv4Address, D>,
> fidl::encoding::Encode<Ipv4UnicastSourceAndMulticastDestination, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv4UnicastSourceAndMulticastDestination>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 4, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv4UnicastSourceAndMulticastDestination
{
#[inline(always)]
fn new_empty() -> Self {
Self {
unicast_source: fidl::new_empty!(fidl_fuchsia_net::Ipv4Address, D),
multicast_destination: fidl::new_empty!(fidl_fuchsia_net::Ipv4Address, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_net::Ipv4Address,
D,
&mut self.unicast_source,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl_fuchsia_net::Ipv4Address,
D,
&mut self.multicast_destination,
decoder,
offset + 4,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerAddRouteRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerAddRouteRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
48
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<Ipv6RoutingTableControllerAddRouteRequest, D>
for &Ipv6RoutingTableControllerAddRouteRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv6RoutingTableControllerAddRouteRequest>(offset);
fidl::encoding::Encode::<Ipv6RoutingTableControllerAddRouteRequest, D>::encode(
(
<Ipv6UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
<Route as fidl::encoding::ValueTypeMarker>::borrow(&self.route),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Ipv6UnicastSourceAndMulticastDestination, D>,
T1: fidl::encoding::Encode<Route, D>,
> fidl::encoding::Encode<Ipv6RoutingTableControllerAddRouteRequest, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv6RoutingTableControllerAddRouteRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 32, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv6RoutingTableControllerAddRouteRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self {
addresses: fidl::new_empty!(Ipv6UnicastSourceAndMulticastDestination, D),
route: fidl::new_empty!(Route, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
Ipv6UnicastSourceAndMulticastDestination,
D,
&mut self.addresses,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(Route, D, &mut self.route, decoder, offset + 32, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerDelRouteRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerDelRouteRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<Ipv6RoutingTableControllerDelRouteRequest, D>
for &Ipv6RoutingTableControllerDelRouteRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv6RoutingTableControllerDelRouteRequest>(offset);
fidl::encoding::Encode::<Ipv6RoutingTableControllerDelRouteRequest, D>::encode(
(
<Ipv6UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Ipv6UnicastSourceAndMulticastDestination, D>,
> fidl::encoding::Encode<Ipv6RoutingTableControllerDelRouteRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv6RoutingTableControllerDelRouteRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv6RoutingTableControllerDelRouteRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { addresses: fidl::new_empty!(Ipv6UnicastSourceAndMulticastDestination, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
Ipv6UnicastSourceAndMulticastDestination,
D,
&mut self.addresses,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerGetRouteStatsRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerGetRouteStatsRequest {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<Ipv6RoutingTableControllerGetRouteStatsRequest, D>
for &Ipv6RoutingTableControllerGetRouteStatsRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv6RoutingTableControllerGetRouteStatsRequest>(offset);
fidl::encoding::Encode::<Ipv6RoutingTableControllerGetRouteStatsRequest, D>::encode(
(
<Ipv6UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<Ipv6UnicastSourceAndMulticastDestination, D>,
> fidl::encoding::Encode<Ipv6RoutingTableControllerGetRouteStatsRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv6RoutingTableControllerGetRouteStatsRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv6RoutingTableControllerGetRouteStatsRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { addresses: fidl::new_empty!(Ipv6UnicastSourceAndMulticastDestination, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
Ipv6UnicastSourceAndMulticastDestination,
D,
&mut self.addresses,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerOnCloseRequest {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerOnCloseRequest {
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
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<Ipv6RoutingTableControllerOnCloseRequest, D>
for &Ipv6RoutingTableControllerOnCloseRequest
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv6RoutingTableControllerOnCloseRequest>(offset);
fidl::encoding::Encode::<Ipv6RoutingTableControllerOnCloseRequest, D>::encode(
(<TableControllerCloseReason as fidl::encoding::ValueTypeMarker>::borrow(
&self.error,
),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<TableControllerCloseReason, D>,
> fidl::encoding::Encode<Ipv6RoutingTableControllerOnCloseRequest, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv6RoutingTableControllerOnCloseRequest>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv6RoutingTableControllerOnCloseRequest
{
#[inline(always)]
fn new_empty() -> Self {
Self { error: fidl::new_empty!(TableControllerCloseReason, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
TableControllerCloseReason,
D,
&mut self.error,
decoder,
offset + 0,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerWatchRoutingEventsResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerWatchRoutingEventsResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
64
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<Ipv6RoutingTableControllerWatchRoutingEventsResponse, D>
for &Ipv6RoutingTableControllerWatchRoutingEventsResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<Ipv6RoutingTableControllerWatchRoutingEventsResponse>(offset);
fidl::encoding::Encode::<Ipv6RoutingTableControllerWatchRoutingEventsResponse, D>::encode(
(
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.dropped_events),
<Ipv6UnicastSourceAndMulticastDestination as fidl::encoding::ValueTypeMarker>::borrow(&self.addresses),
<u64 as fidl::encoding::ValueTypeMarker>::borrow(&self.input_interface),
<RoutingEvent as fidl::encoding::ValueTypeMarker>::borrow(&self.event),
),
encoder, offset, _depth
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<Ipv6UnicastSourceAndMulticastDestination, D>,
T2: fidl::encoding::Encode<u64, D>,
T3: fidl::encoding::Encode<RoutingEvent, D>,
> fidl::encoding::Encode<Ipv6RoutingTableControllerWatchRoutingEventsResponse, D>
for (T0, T1, T2, T3)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder
.debug_check_bounds::<Ipv6RoutingTableControllerWatchRoutingEventsResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
self.2.encode(encoder, offset + 40, depth)?;
self.3.encode(encoder, offset + 48, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv6RoutingTableControllerWatchRoutingEventsResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self {
dropped_events: fidl::new_empty!(u64, D),
addresses: fidl::new_empty!(Ipv6UnicastSourceAndMulticastDestination, D),
input_interface: fidl::new_empty!(u64, D),
event: fidl::new_empty!(RoutingEvent, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(u64, D, &mut self.dropped_events, decoder, offset + 0, _depth)?;
fidl::decode!(
Ipv6UnicastSourceAndMulticastDestination,
D,
&mut self.addresses,
decoder,
offset + 8,
_depth
)?;
fidl::decode!(u64, D, &mut self.input_interface, decoder, offset + 40, _depth)?;
fidl::decode!(RoutingEvent, D, &mut self.event, decoder, offset + 48, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Ipv6RoutingTableControllerGetRouteStatsResponse {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Ipv6RoutingTableControllerGetRouteStatsResponse {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<Ipv6RoutingTableControllerGetRouteStatsResponse, D>
for &Ipv6RoutingTableControllerGetRouteStatsResponse
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv6RoutingTableControllerGetRouteStatsResponse>(offset);
fidl::encoding::Encode::<Ipv6RoutingTableControllerGetRouteStatsResponse, D>::encode(
(<RouteStats as fidl::encoding::ValueTypeMarker>::borrow(&self.stats),),
encoder,
offset,
_depth,
)
}
}
unsafe impl<D: fidl::encoding::ResourceDialect, T0: fidl::encoding::Encode<RouteStats, D>>
fidl::encoding::Encode<Ipv6RoutingTableControllerGetRouteStatsResponse, D> for (T0,)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv6RoutingTableControllerGetRouteStatsResponse>(offset);
self.0.encode(encoder, offset + 0, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv6RoutingTableControllerGetRouteStatsResponse
{
#[inline(always)]
fn new_empty() -> Self {
Self { stats: fidl::new_empty!(RouteStats, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(RouteStats, D, &mut self.stats, decoder, offset + 0, _depth)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for Ipv6UnicastSourceAndMulticastDestination {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Ipv6UnicastSourceAndMulticastDestination {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
1
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
32
}
}
unsafe impl<D: fidl::encoding::ResourceDialect>
fidl::encoding::Encode<Ipv6UnicastSourceAndMulticastDestination, D>
for &Ipv6UnicastSourceAndMulticastDestination
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv6UnicastSourceAndMulticastDestination>(offset);
fidl::encoding::Encode::<Ipv6UnicastSourceAndMulticastDestination, D>::encode(
(
<fidl_fuchsia_net::Ipv6Address as fidl::encoding::ValueTypeMarker>::borrow(
&self.unicast_source,
),
<fidl_fuchsia_net::Ipv6Address as fidl::encoding::ValueTypeMarker>::borrow(
&self.multicast_destination,
),
),
encoder,
offset,
_depth,
)
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<fidl_fuchsia_net::Ipv6Address, D>,
T1: fidl::encoding::Encode<fidl_fuchsia_net::Ipv6Address, D>,
> fidl::encoding::Encode<Ipv6UnicastSourceAndMulticastDestination, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Ipv6UnicastSourceAndMulticastDestination>(offset);
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 16, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D>
for Ipv6UnicastSourceAndMulticastDestination
{
#[inline(always)]
fn new_empty() -> Self {
Self {
unicast_source: fidl::new_empty!(fidl_fuchsia_net::Ipv6Address, D),
multicast_destination: fidl::new_empty!(fidl_fuchsia_net::Ipv6Address, D),
}
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
fidl::decode!(
fidl_fuchsia_net::Ipv6Address,
D,
&mut self.unicast_source,
decoder,
offset + 0,
_depth
)?;
fidl::decode!(
fidl_fuchsia_net::Ipv6Address,
D,
&mut self.multicast_destination,
decoder,
offset + 16,
_depth
)?;
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for OutgoingInterfaces {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for OutgoingInterfaces {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<OutgoingInterfaces, D>
for &OutgoingInterfaces
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<OutgoingInterfaces>(offset);
unsafe {
let buf_ptr = encoder.buf.as_mut_ptr().add(offset);
(buf_ptr as *mut OutgoingInterfaces)
.write_unaligned((self as *const OutgoingInterfaces).read());
let padding_ptr = buf_ptr.offset(8) as *mut u64;
let padding_mask = 0xffffffffffffff00u64;
padding_ptr.write_unaligned(padding_ptr.read_unaligned() & !padding_mask);
}
Ok(())
}
}
unsafe impl<
D: fidl::encoding::ResourceDialect,
T0: fidl::encoding::Encode<u64, D>,
T1: fidl::encoding::Encode<u8, D>,
> fidl::encoding::Encode<OutgoingInterfaces, D> for (T0, T1)
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<OutgoingInterfaces>(offset);
unsafe {
let ptr = encoder.buf.as_mut_ptr().add(offset).offset(8);
(ptr as *mut u64).write_unaligned(0);
}
self.0.encode(encoder, offset + 0, depth)?;
self.1.encode(encoder, offset + 8, depth)?;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for OutgoingInterfaces {
#[inline(always)]
fn new_empty() -> Self {
Self { id: fidl::new_empty!(u64, D), min_ttl: fidl::new_empty!(u8, D) }
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let buf_ptr = unsafe { decoder.buf.as_ptr().add(offset) };
let ptr = unsafe { buf_ptr.offset(8) };
let padval = unsafe { (ptr as *const u64).read_unaligned() };
let mask = 0xffffffffffffff00u64;
let maskedval = padval & mask;
if maskedval != 0 {
return Err(fidl::Error::NonZeroPadding {
padding_start: offset + 8 + ((mask as u64).trailing_zeros() / 8) as usize,
});
}
unsafe {
std::ptr::copy_nonoverlapping(buf_ptr, self as *mut Self as *mut u8, 16);
}
Ok(())
}
}
impl Route {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.action {
return 2;
}
if let Some(_) = self.expected_input_interface {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for Route {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Route {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Route, D> for &Route {
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Route>(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::<u64, D>(
self.expected_input_interface
.as_ref()
.map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
if 2 > max_ordinal {
return Ok(());
}
let cur_offset: usize = (2 - 1) * envelope_size;
encoder.padding(offset + _prev_end_offset, cur_offset - _prev_end_offset);
fidl::encoding::encode_in_envelope_optional::<Action, D>(
self.action.as_ref().map(<Action as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Route {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_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 =
<u64 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.expected_input_interface.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, 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;
_next_ordinal_to_read += 1;
if next_offset >= end_offset {
return Ok(());
}
while _next_ordinal_to_read < 2 {
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 =
<Action 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.action.get_or_insert_with(|| fidl::new_empty!(Action, D));
fidl::decode!(Action, D, 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 RouteStats {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.last_used {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for RouteStats {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RouteStats {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RouteStats, D>
for &RouteStats
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RouteStats>(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::<i64, D>(
self.last_used.as_ref().map(<i64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RouteStats {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_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 =
<i64 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.last_used.get_or_insert_with(|| fidl::new_empty!(i64, D));
fidl::decode!(i64, D, 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 WrongInputInterface {
#[inline(always)]
fn max_ordinal_present(&self) -> u64 {
if let Some(_) = self.expected_input_interface {
return 1;
}
0
}
}
impl fidl::encoding::ValueTypeMarker for WrongInputInterface {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for WrongInputInterface {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<WrongInputInterface, D>
for &WrongInputInterface
{
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<WrongInputInterface>(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::<u64, D>(
self.expected_input_interface
.as_ref()
.map(<u64 as fidl::encoding::ValueTypeMarker>::borrow),
encoder,
offset + cur_offset,
depth,
)?;
_prev_end_offset = cur_offset + envelope_size;
Ok(())
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for WrongInputInterface {
#[inline(always)]
fn new_empty() -> Self {
Self::default()
}
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
let len = match fidl::encoding::decode_vector_header(decoder, offset)? {
None => return Err(fidl::Error::NotNullable),
Some(len) => len,
};
if len == 0 {
return Ok(());
};
depth.increment()?;
let envelope_size = 8;
let bytes_len = len * envelope_size;
let offset = decoder.out_of_line_offset(bytes_len)?;
let mut _next_ordinal_to_read = 0;
let mut next_offset = offset;
let end_offset = offset + bytes_len;
_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 =
<u64 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.expected_input_interface.get_or_insert_with(|| fidl::new_empty!(u64, D));
fidl::decode!(u64, D, 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 fidl::encoding::ValueTypeMarker for Action {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for Action {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<Action, D> for &Action {
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<Action>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
Action::OutgoingInterfaces(ref val) => {
fidl::encoding::encode_in_envelope::<fidl::encoding::Vector<OutgoingInterfaces, 32>, D>(
<fidl::encoding::Vector<OutgoingInterfaces, 32> as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder, offset + 8, _depth
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for Action {
#[inline(always)]
fn new_empty() -> Self {
Self::OutgoingInterfaces(
fidl::new_empty!(fidl::encoding::Vector<OutgoingInterfaces, 32>, D),
)
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <fidl::encoding::Vector<OutgoingInterfaces, 32> as fidl::encoding::TypeMarker>::inline_size(decoder.context),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let Action::OutgoingInterfaces(_) = self {
} else {
*self = Action::OutgoingInterfaces(
fidl::new_empty!(fidl::encoding::Vector<OutgoingInterfaces, 32>, D),
);
}
#[allow(irrefutable_let_patterns)]
if let Action::OutgoingInterfaces(ref mut val) = self {
fidl::decode!(fidl::encoding::Vector<OutgoingInterfaces, 32>, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
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);
}
Ok(())
}
}
impl fidl::encoding::ValueTypeMarker for RoutingEvent {
type Borrowed<'a> = &'a Self;
fn borrow(value: &<Self as fidl::encoding::TypeMarker>::Owned) -> Self::Borrowed<'_> {
value
}
}
unsafe impl fidl::encoding::TypeMarker for RoutingEvent {
type Owned = Self;
#[inline(always)]
fn inline_align(_context: fidl::encoding::Context) -> usize {
8
}
#[inline(always)]
fn inline_size(_context: fidl::encoding::Context) -> usize {
16
}
}
unsafe impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Encode<RoutingEvent, D>
for &RoutingEvent
{
#[inline]
unsafe fn encode(
self,
encoder: &mut fidl::encoding::Encoder<'_, D>,
offset: usize,
_depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
encoder.debug_check_bounds::<RoutingEvent>(offset);
encoder.write_num::<u64>(self.ordinal(), offset);
match self {
RoutingEvent::MissingRoute(ref val) => {
fidl::encoding::encode_in_envelope::<Empty, D>(
<Empty as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
RoutingEvent::WrongInputInterface(ref val) => {
fidl::encoding::encode_in_envelope::<WrongInputInterface, D>(
<WrongInputInterface as fidl::encoding::ValueTypeMarker>::borrow(val),
encoder,
offset + 8,
_depth,
)
}
}
}
}
impl<D: fidl::encoding::ResourceDialect> fidl::encoding::Decode<Self, D> for RoutingEvent {
#[inline(always)]
fn new_empty() -> Self {
Self::MissingRoute(fidl::new_empty!(Empty, D))
}
#[inline]
unsafe fn decode(
&mut self,
decoder: &mut fidl::encoding::Decoder<'_, D>,
offset: usize,
mut depth: fidl::encoding::Depth,
) -> fidl::Result<()> {
decoder.debug_check_bounds::<Self>(offset);
#[allow(unused_variables)]
let next_out_of_line = decoder.next_out_of_line();
let handles_before = decoder.remaining_handles();
let (ordinal, inlined, num_bytes, num_handles) =
fidl::encoding::decode_union_inline_portion(decoder, offset)?;
let member_inline_size = match ordinal {
1 => <Empty as fidl::encoding::TypeMarker>::inline_size(decoder.context),
2 => <WrongInputInterface as fidl::encoding::TypeMarker>::inline_size(
decoder.context,
),
_ => return Err(fidl::Error::UnknownUnionTag),
};
if inlined != (member_inline_size <= 4) {
return Err(fidl::Error::InvalidInlineBitInEnvelope);
}
let _inner_offset;
if inlined {
decoder.check_inline_envelope_padding(offset + 8, member_inline_size)?;
_inner_offset = offset + 8;
} else {
depth.increment()?;
_inner_offset = decoder.out_of_line_offset(member_inline_size)?;
}
match ordinal {
1 => {
#[allow(irrefutable_let_patterns)]
if let RoutingEvent::MissingRoute(_) = self {
} else {
*self = RoutingEvent::MissingRoute(fidl::new_empty!(Empty, D));
}
#[allow(irrefutable_let_patterns)]
if let RoutingEvent::MissingRoute(ref mut val) = self {
fidl::decode!(Empty, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
2 => {
#[allow(irrefutable_let_patterns)]
if let RoutingEvent::WrongInputInterface(_) = self {
} else {
*self = RoutingEvent::WrongInputInterface(fidl::new_empty!(
WrongInputInterface,
D
));
}
#[allow(irrefutable_let_patterns)]
if let RoutingEvent::WrongInputInterface(ref mut val) = self {
fidl::decode!(WrongInputInterface, D, val, decoder, _inner_offset, depth)?;
} else {
unreachable!()
}
}
ordinal => panic!("unexpected ordinal {:?}", ordinal),
}
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);
}
Ok(())
}
}
}