Struct fidl_fuchsia_net_test_realm::ControllerProxy

source ·
pub struct ControllerProxy { /* private fields */ }

Implementations§

source§

impl ControllerProxy

source

pub fn new(channel: AsyncChannel) -> Self

Create a new Proxy for fuchsia.net.test.realm/Controller.

source

pub fn take_event_stream(&self) -> ControllerEventStream

Get a Stream of events from the remote end of the protocol.

§Panics

Panics if the event stream was already taken.

source

pub fn start_hermetic_network_realm( &self, netstack: Netstack, ) -> QueryResponseFut<ControllerStartHermeticNetworkRealmResult, DefaultFuchsiaResourceDialect>

Starts a hermetic network realm corresponding to netstack.

Any previously running hermetic network realm will be terminated before the new realm is started. The configured realm will contain a subset of the components in the standard network realm. In particular, it will contain:

  • A Netstack instance that corresponds to the provided netstack
  • A DHCP server
  • A DHCPv6 client
  • A DNS resolver
  • request netstack the type of Netstack that will be run.
  • error INTERNAL for internal errors, including failure to start the specified netstack.
source

pub fn stop_hermetic_network_realm( &self, ) -> QueryResponseFut<ControllerStopHermeticNetworkRealmResult, DefaultFuchsiaResourceDialect>

Stops any running hermetic network realm.

All components in the hermetic network realm will be stopped. Similarly, any interfaces that were previously disabled on the system’s Netstack will be re-enabled on a best-effort basis. That is, a failure to re-enable an interface will not result in this method returning an error.

  • error HERMETIC_NETWORK_REALM_NOT_RUNNING if a hermetic network realm is not running.
  • error INTERNAL for internal errors, including failure to destroy the realm.
source

pub fn add_interface( &self, mac_address: &MacAddress, name: &str, wait_any_ip_address: bool, ) -> QueryResponseFut<ControllerAddInterfaceResult, DefaultFuchsiaResourceDialect>

Attaches an interface to the hermetic Netstack.

The interface that corresponds to mac_address will disabled on the system’s Netstack, but enabled on the hermetic Netstack.

  • request mac_address address of the interface to be added to the hermetic Netstack.
  • request name the name to assign to the new interface.
  • request wait_any_ip_address whether to wait for any IP address to be assigned to the interface before returning. This is helpful for tests that want to ensure the autoconfigured IP address is assigned and has completed duplicate address detection before proceeding.
  • error ALREADY_EXISTS if an interface with name already exists on the hermetic Netstack.
  • error HERMETIC_NETWORK_REALM_NOT_RUNNING if there is no running hermetic network realm.
  • error INTERFACE_NOT_FOUND if an interface with mac_address could not be found on the system.
  • error INTERNAL for internal errors, including failure to read the system’s interfaces or configure an interface.
source

pub fn start_stub( &self, component_url: &str, ) -> QueryResponseFut<ControllerStartStubResult, DefaultFuchsiaResourceDialect>

Starts a test stub.

Any previously running stub will be terminated before the provided stub corresponding to component_url is started.

  • request component_url the URL of the component to run.
  • error COMPONENT_NOT_FOUND if a component correspodning to component_url could not be resolved.
  • error HERMETIC_NETWORK_REALM_NOT_RUNNING if there is no running hermetic network realm.
  • error INTERNAL for internal errors, including failure to add the desired stub within the hermetic network realm.
  • error INVALID_ARGUMENTS if the component_url is malformed.
source

pub fn stop_stub( &self, ) -> QueryResponseFut<ControllerStopStubResult, DefaultFuchsiaResourceDialect>

Stops the currently running stub.

Other existing hermetic network realm components will continue to be run after this is invoked.

  • error HERMETIC_NETWORK_REALM_NOT_RUNNING if there is no running hermetic network realm.
  • error STUB_NOT_RUNNING if there is no running stub.
  • error INTERNAL for internal errors, including failure to destroy the stub component.
source

pub fn ping( &self, target: &IpAddress, payload_length: u16, interface_name: Option<&str>, timeout: i64, ) -> QueryResponseFut<ControllerPingResult, DefaultFuchsiaResourceDialect>

Sends an ICMP echo request to the target using a socket provided by the hermetic Netstack.

  • request target the address to ping.
  • request payload_length the body size of the ICMP packet. Specifically, the packet body will be filled with zeros of payload_length.
  • request interface_name an optional interface to bind the socket to.
  • request timeout a timeout in nanoseconds to wait for a reply. If less than or equal to 0, then returns success immediately after the ping is sent.
  • error HERMETIC_NETWORK_REALM_NOT_RUNNING if there is no running hermetic network realm.
  • error INTERFACE_NOT_FOUND if interface_name does not exist in the hermetic Netstack.
  • error INTERNAL for internal errors, including failure to create a socket or generate the ping request and response.
  • error INVALID_ARGUMENTS if target corresponds to a link-local address and an interface_name is not specified or the payload_length exceeds the maximum allowable size.
  • error PING_FAILED if there was an error sending or receiving the ping.
  • error TIMEOUT_EXCEEDED if the ping reply is not received before the specifed timeout.
source

pub fn poll_udp( &self, target: &SocketAddress, payload: &[u8], timeout: i64, num_retries: u16, ) -> QueryResponseFut<ControllerPollUdpResult, DefaultFuchsiaResourceDialect>

Polls the specified socket address with UDP datagrams containing the specified payload using a socket provided by the hermetic Netstack.

Waits for a single reply from the target address and returns it.

  • request target the socket address to poll.
  • request payload the content to place in the UDP datagram.
  • request timeout a timeout in nanoseconds to wait for a reply, per retry.
  • request num_retries the number of poll attempts to make before giving up and returning an error.
  • error HERMETIC_NETWORK_REALM_NOT_RUNNING if there is no running hermetic network realm.
  • error ADDRESS_UNREACHABLE if all poll attempts expire without successfully receiving a reply from the target address, and no route was found to the target address.
  • error TIMEOUT_EXCEEDED if the target address was routable, but all of the retry attempts expire without successfully receiving a reply from the target address.
  • error INTERNAL for internal errors, including failure to create a socket or other failures to send/receive datagrams from the target address.
source

pub fn join_multicast_group( &self, address: &IpAddress, interface_id: u64, ) -> QueryResponseFut<ControllerJoinMulticastGroupResult, DefaultFuchsiaResourceDialect>

Joins a multicast group.

Membership will be maintained until LeaveMulticastGroup or StopHermeticNetworkRealm is invoked.

  • request address the group address to join.
  • request interface_id the interface that should be used to join the group. A value of 0 indicates that any interface may be used.
  • error ADDRESS_IN_USE if the provided address was previously joined.
  • error HERMETIC_NETWORK_REALM_NOT_RUNNING if there is no running hermetic network realm.
  • error INTERNAL for internal errors.
  • error INVALID_ARGUMENTS if the specified interface_id does not exist or the address does not correspond to a valid multicast address.
source

pub fn leave_multicast_group( &self, address: &IpAddress, interface_id: u64, ) -> QueryResponseFut<ControllerLeaveMulticastGroupResult, DefaultFuchsiaResourceDialect>

Leaves a multicast group that was previously joined using the JoinMulticastGroup method.

  • request address the group address to leave.
  • request interface_id the interface that was previously used to join the multicast group.
  • error ADDRESS_NOT_AVAILABLE if the provided address was not previously joined.
  • error HERMETIC_NETWORK_REALM_NOT_RUNNING if there is no running hermetic network realm.
  • error INTERNAL for internal errors, including failure to connect to hermetic network realm services.
  • error INVALID_ARGUMENTS if the specified interface_id does not exist or the address does not correspond to a valid multicast address.
source

pub fn start_dhcpv6_client( &self, params: &NewClientParams, ) -> QueryResponseFut<ControllerStartDhcpv6ClientResult, DefaultFuchsiaResourceDialect>

Starts a DHCPv6 client with the provided parameters.

  • request params parameters to start this DHCPv6 client with. Required.
  • error HERMETIC_NETWORK_REALM_NOT_RUNNING if there is no running hermetic network realm.
  • error INTERNAL for internal errors, including failure to connect to hermetic network realm services.
  • error INVALID_ARGUMENTS if any required parameters are omitted.
  • error ALREADY_EXISTS if there is a client running on the interface identified by params.interface_id already.
source

pub fn stop_dhcpv6_client( &self, ) -> QueryResponseFut<ControllerStopDhcpv6ClientResult, DefaultFuchsiaResourceDialect>

Stops all DHCPv6 clients.

  • error DHCPV6_CLIENT_NOT_RUNNING if no DHCPv6 client is running.
source

pub fn start_out_of_stack_dhcpv4_client( &self, payload: &ControllerStartOutOfStackDhcpv4ClientRequest, ) -> QueryResponseFut<ControllerStartOutOfStackDhcpv4ClientResult, DefaultFuchsiaResourceDialect>

Starts a DHCPv4 client on the provided interface.

  • request interface_id the interface to start a DHCPv4 client on. Required.
source

pub fn stop_out_of_stack_dhcpv4_client( &self, payload: &ControllerStopOutOfStackDhcpv4ClientRequest, ) -> QueryResponseFut<ControllerStopOutOfStackDhcpv4ClientResult, DefaultFuchsiaResourceDialect>

Stops the DHCPv4 client on the provided interface.

  • request interface_id the interface to stop a DHCPv4 client client on. Required.
  • error DHCPV4_CLIENT_NOT_RUNNING if no DHCPv4 client is running.
  • error DHCPV4_CLIENT_SHUTDOWN_FAILED if shutting down the DHCPv4 client failed.

Trait Implementations§

source§

impl Clone for ControllerProxy

source§

fn clone(&self) -> ControllerProxy

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl ControllerProxyInterface for ControllerProxy

§

type StartHermeticNetworkRealmResponseFut = QueryResponseFut<Result<(), Error>>

source§

fn start_hermetic_network_realm( &self, netstack: Netstack, ) -> Self::StartHermeticNetworkRealmResponseFut

§

type StopHermeticNetworkRealmResponseFut = QueryResponseFut<Result<(), Error>>

source§

fn stop_hermetic_network_realm( &self, ) -> Self::StopHermeticNetworkRealmResponseFut

§

type AddInterfaceResponseFut = QueryResponseFut<Result<(), Error>>

source§

fn add_interface( &self, mac_address: &MacAddress, name: &str, wait_any_ip_address: bool, ) -> Self::AddInterfaceResponseFut

§

type StartStubResponseFut = QueryResponseFut<Result<(), Error>>

source§

fn start_stub(&self, component_url: &str) -> Self::StartStubResponseFut

§

type StopStubResponseFut = QueryResponseFut<Result<(), Error>>

source§

fn stop_stub(&self) -> Self::StopStubResponseFut

§

type PingResponseFut = QueryResponseFut<Result<(), Error>>

source§

fn ping( &self, target: &IpAddress, payload_length: u16, interface_name: Option<&str>, timeout: i64, ) -> Self::PingResponseFut

§

type PollUdpResponseFut = QueryResponseFut<Result<Vec<u8>, Error>>

source§

fn poll_udp( &self, target: &SocketAddress, payload: &[u8], timeout: i64, num_retries: u16, ) -> Self::PollUdpResponseFut

§

type JoinMulticastGroupResponseFut = QueryResponseFut<Result<(), Error>>

source§

fn join_multicast_group( &self, address: &IpAddress, interface_id: u64, ) -> Self::JoinMulticastGroupResponseFut

§

type LeaveMulticastGroupResponseFut = QueryResponseFut<Result<(), Error>>

source§

fn leave_multicast_group( &self, address: &IpAddress, interface_id: u64, ) -> Self::LeaveMulticastGroupResponseFut

§

type StartDhcpv6ClientResponseFut = QueryResponseFut<Result<(), Error>>

source§

fn start_dhcpv6_client( &self, params: &NewClientParams, ) -> Self::StartDhcpv6ClientResponseFut

§

type StopDhcpv6ClientResponseFut = QueryResponseFut<Result<(), Error>>

source§

fn stop_dhcpv6_client(&self) -> Self::StopDhcpv6ClientResponseFut

§

type StartOutOfStackDhcpv4ClientResponseFut = QueryResponseFut<Result<(), Error>>

source§

fn start_out_of_stack_dhcpv4_client( &self, payload: &ControllerStartOutOfStackDhcpv4ClientRequest, ) -> Self::StartOutOfStackDhcpv4ClientResponseFut

§

type StopOutOfStackDhcpv4ClientResponseFut = QueryResponseFut<Result<(), Error>>

source§

fn stop_out_of_stack_dhcpv4_client( &self, payload: &ControllerStopOutOfStackDhcpv4ClientRequest, ) -> Self::StopOutOfStackDhcpv4ClientResponseFut

source§

impl Debug for ControllerProxy

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Proxy for ControllerProxy

§

type Protocol = ControllerMarker

The protocol which this Proxy controls.
source§

fn from_channel(inner: AsyncChannel) -> Self

Create a proxy over the given channel.
source§

fn into_channel(self) -> Result<AsyncChannel, Self>

Attempt to convert the proxy back into a channel. Read more
source§

fn as_channel(&self) -> &AsyncChannel

Get a reference to the proxy’s underlying channel. Read more
§

fn into_client_end(self) -> Result<ClientEnd<Self::Protocol>, Self>

Attempt to convert the proxy back into a client end. Read more
§

fn is_closed(&self) -> bool

Returns true if the proxy has received the PEER_CLOSED signal.
§

fn on_closed(&self) -> OnSignals<'_, Unowned<'_, Handle>>

Returns a future that completes when the proxy receives the PEER_CLOSED signal.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

default unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
§

impl<T, D> Encode<Ambiguous1, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
§

impl<T, D> Encode<Ambiguous2, D> for T
where D: ResourceDialect,

§

unsafe fn encode( self, _encoder: &mut Encoder<'_, D>, _offset: usize, _depth: Depth, ) -> Result<(), Error>

Encodes the object into the encoder’s buffers. Any handles stored in the object are swapped for Handle::INVALID. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more