pub struct TestEndpoint<'a> { /* private fields */ }
Expand description
A virtual network endpoint backed by Netemul.
Implementations§
Source§impl<'a> TestEndpoint<'a>
impl<'a> TestEndpoint<'a>
Sourcepub fn into_proxy(self) -> EndpointProxy
pub fn into_proxy(self) -> EndpointProxy
Extracts the proxy to the backing endpoint.
Note that this defeats the lifetime semantics that ensure the sandbox in
which this endpoint was created lives as long as the endpoint. The caller of
TestEndpoint::into_proxy
is responsible for ensuring that the sandbox
outlives the endpoint.
Sourcepub async fn get_netdevice(
&self,
) -> Result<(ClientEnd<DeviceMarker>, PortId), Error>
pub async fn get_netdevice( &self, ) -> Result<(ClientEnd<DeviceMarker>, PortId), Error>
Gets access to this device’s virtual Network device.
Note that an error is returned if the Endpoint is not a
[fnetemul_network::DeviceConnection::NetworkDevice
].
Sourcepub async fn install(
&self,
installer: InstallerProxy,
__arg2: InterfaceConfig<'_>,
) -> Result<(u64, Control, DeviceControlProxy), Error>
pub async fn install( &self, installer: InstallerProxy, __arg2: InterfaceConfig<'_>, ) -> Result<(u64, Control, DeviceControlProxy), Error>
Installs the TestEndpoint
via the provided fnet_interfaces_admin::InstallerProxy
.
Returns the interface ID, and the associated interface
[Control
] and fnet_interfaces_admin::DeviceControlProxy
on
success.
Sourcepub async fn add_to_stack(
&self,
realm: &TestRealm<'a>,
config: InterfaceConfig<'a>,
) -> Result<(u64, Control, DeviceControlProxy), Error>
pub async fn add_to_stack( &self, realm: &TestRealm<'a>, config: InterfaceConfig<'a>, ) -> Result<(u64, Control, DeviceControlProxy), Error>
Adds the TestEndpoint
to the provided realm
with an optional
interface name.
Returns the interface ID and control protocols on success.
Sourcepub async fn into_interface_in_realm(
self,
realm: &TestRealm<'a>,
) -> Result<TestInterface<'a>, Error>
pub async fn into_interface_in_realm( self, realm: &TestRealm<'a>, ) -> Result<TestInterface<'a>, Error>
Like into_interface_realm_with_name
but with default parameters.
Sourcepub async fn into_interface_in_realm_with_name(
self,
realm: &TestRealm<'a>,
config: InterfaceConfig<'a>,
) -> Result<TestInterface<'a>, Error>
pub async fn into_interface_in_realm_with_name( self, realm: &TestRealm<'a>, config: InterfaceConfig<'a>, ) -> Result<TestInterface<'a>, Error>
Consumes this TestEndpoint
and tries to add it to the Netstack in
realm
, returning a TestInterface
on success.
Methods from Deref<Target = EndpointProxy>§
Sourcepub fn take_event_stream(&self) -> EndpointEventStream
pub fn take_event_stream(&self) -> EndpointEventStream
Get a Stream of events from the remote end of the protocol.
§Panics
Panics if the event stream was already taken.
pub fn get_config(&self) -> QueryResponseFut<EndpointConfig>
Sourcepub fn set_link_up(&self, up: bool) -> QueryResponseFut<()>
pub fn set_link_up(&self, up: bool) -> QueryResponseFut<()>
Sends link up or down signal
Sourcepub fn get_port(&self, port: ServerEnd<PortMarker>) -> Result<(), Error>
pub fn get_port(&self, port: ServerEnd<PortMarker>) -> Result<(), Error>
Connects to the underlying device port.
Sourcepub fn get_proxy_(
&self,
proxy: ServerEnd<DeviceProxy_Marker>,
) -> Result<(), Error>
pub fn get_proxy_( &self, proxy: ServerEnd<DeviceProxy_Marker>, ) -> Result<(), Error>
Gets a proxy to open requests with zircon ethernet device.