pub struct ControllerProxy { /* private fields */ }Implementations§
Source§impl ControllerProxy
impl ControllerProxy
Sourcepub fn new(channel: AsyncChannel) -> Self
pub fn new(channel: AsyncChannel) -> Self
Create a new Proxy for fuchsia.net.test.realm/Controller.
Sourcepub fn take_event_stream(&self) -> ControllerEventStream
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.
Sourcepub fn start_hermetic_network_realm(
&self,
netstack: Netstack,
) -> QueryResponseFut<ControllerStartHermeticNetworkRealmResult, DefaultFuchsiaResourceDialect>
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
netstackthe type of Netstack that will be run.
- error
INTERNALfor internal errors, including failure to start the specifiednetstack.
Sourcepub fn stop_hermetic_network_realm(
&self,
) -> QueryResponseFut<ControllerStopHermeticNetworkRealmResult, DefaultFuchsiaResourceDialect>
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_RUNNINGif a hermetic network realm is not running. - error
INTERNALfor internal errors, including failure to destroy the realm.
Sourcepub fn add_interface(
&self,
mac_address: &MacAddress,
name: &str,
wait_any_ip_address: bool,
) -> QueryResponseFut<ControllerAddInterfaceResult, DefaultFuchsiaResourceDialect>
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_addressaddress of the interface to be added to the hermetic Netstack. - request
namethe name to assign to the new interface. - request
wait_any_ip_addresswhether 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_EXISTSif an interface withnamealready exists on the hermetic Netstack. - error
HERMETIC_NETWORK_REALM_NOT_RUNNINGif there is no running hermetic network realm. - error
INTERFACE_NOT_FOUNDif an interface withmac_addresscould not be found on the system. - error
INTERNALfor internal errors, including failure to read the system’s interfaces or configure an interface.
Sourcepub fn start_stub(
&self,
component_url: &str,
) -> QueryResponseFut<ControllerStartStubResult, DefaultFuchsiaResourceDialect>
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_urlthe URL of the component to run.
- error
COMPONENT_NOT_FOUNDif a component correspodning tocomponent_urlcould not be resolved. - error
HERMETIC_NETWORK_REALM_NOT_RUNNINGif there is no running hermetic network realm. - error
INTERNALfor internal errors, including failure to add the desired stub within the hermetic network realm. - error
INVALID_ARGUMENTSif thecomponent_urlis malformed.
Sourcepub fn stop_stub(
&self,
) -> QueryResponseFut<ControllerStopStubResult, DefaultFuchsiaResourceDialect>
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_RUNNINGif there is no running hermetic network realm. - error
STUB_NOT_RUNNINGif there is no running stub. - error
INTERNALfor internal errors, including failure to destroy the stub component.
Sourcepub fn ping(
&self,
target: &IpAddress,
payload_length: u16,
interface_name: Option<&str>,
timeout: i64,
) -> QueryResponseFut<ControllerPingResult, DefaultFuchsiaResourceDialect>
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
targetthe address to ping. - request
payload_lengththe body size of the ICMP packet. Specifically, the packet body will be filled with zeros ofpayload_length. - request
interface_namean optional interface to bind the socket to. - request
timeouta 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_RUNNINGif there is no running hermetic network realm. - error
INTERFACE_NOT_FOUNDifinterface_namedoes not exist in the hermetic Netstack. - error
INTERNALfor internal errors, including failure to create a socket or generate the ping request and response. - error
INVALID_ARGUMENTSiftargetcorresponds to a link-local address and aninterface_nameis not specified or thepayload_lengthexceeds the maximum allowable size. - error
PING_FAILEDif there was an error sending or receiving the ping. - error
TIMEOUT_EXCEEDEDif the ping reply is not received before the specifedtimeout.
Sourcepub fn poll_udp(
&self,
target: &SocketAddress,
payload: &[u8],
timeout: i64,
num_retries: u16,
) -> QueryResponseFut<ControllerPollUdpResult, DefaultFuchsiaResourceDialect>
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
targetthe socket address to poll. - request
payloadthe content to place in the UDP datagram. - request
timeouta timeout in nanoseconds to wait for a reply, per retry. - request
num_retriesthe number of poll attempts to make before giving up and returning an error.
- error
HERMETIC_NETWORK_REALM_NOT_RUNNINGif there is no running hermetic network realm. - error
ADDRESS_UNREACHABLEif all poll attempts expire without successfully receiving a reply from the target address, and no route was found to the target address. - error
TIMEOUT_EXCEEDEDif the target address was routable, but all of the retry attempts expire without successfully receiving a reply from the target address. - error
INTERNALfor internal errors, including failure to create a socket or other failures to send/receive datagrams from the target address.
Sourcepub fn join_multicast_group(
&self,
address: &IpAddress,
interface_id: u64,
) -> QueryResponseFut<ControllerJoinMulticastGroupResult, DefaultFuchsiaResourceDialect>
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
addressthe group address to join. - request
interface_idthe interface that should be used to join the group. A value of 0 indicates that any interface may be used.
- error
ADDRESS_IN_USEif the providedaddresswas previously joined. - error
HERMETIC_NETWORK_REALM_NOT_RUNNINGif there is no running hermetic network realm. - error
INTERNALfor internal errors. - error
INVALID_ARGUMENTSif the specifiedinterface_iddoes not exist or theaddressdoes not correspond to a valid multicast address.
Sourcepub fn leave_multicast_group(
&self,
address: &IpAddress,
interface_id: u64,
) -> QueryResponseFut<ControllerLeaveMulticastGroupResult, DefaultFuchsiaResourceDialect>
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
addressthe group address to leave. - request
interface_idthe interface that was previously used to join the multicast group.
- error
ADDRESS_NOT_AVAILABLEif the providedaddresswas not previously joined. - error
HERMETIC_NETWORK_REALM_NOT_RUNNINGif there is no running hermetic network realm. - error
INTERNALfor internal errors, including failure to connect to hermetic network realm services. - error
INVALID_ARGUMENTSif the specifiedinterface_iddoes not exist or theaddressdoes not correspond to a valid multicast address.
Sourcepub fn start_dhcpv6_client(
&self,
params: &NewClientParams,
) -> QueryResponseFut<ControllerStartDhcpv6ClientResult, DefaultFuchsiaResourceDialect>
pub fn start_dhcpv6_client( &self, params: &NewClientParams, ) -> QueryResponseFut<ControllerStartDhcpv6ClientResult, DefaultFuchsiaResourceDialect>
Starts a DHCPv6 client with the provided parameters.
- request
paramsparameters to start this DHCPv6 client with. Required.
- error
HERMETIC_NETWORK_REALM_NOT_RUNNINGif there is no running hermetic network realm. - error
INTERNALfor internal errors, including failure to connect to hermetic network realm services. - error
INVALID_ARGUMENTSif any required parameters are omitted. - error
ALREADY_EXISTSif there is a client running on the interface identified byparams.interface_idalready.
Sourcepub fn stop_dhcpv6_client(
&self,
) -> QueryResponseFut<ControllerStopDhcpv6ClientResult, DefaultFuchsiaResourceDialect>
pub fn stop_dhcpv6_client( &self, ) -> QueryResponseFut<ControllerStopDhcpv6ClientResult, DefaultFuchsiaResourceDialect>
Stops all DHCPv6 clients.
- error
DHCPV6_CLIENT_NOT_RUNNINGif no DHCPv6 client is running.
Sourcepub fn start_out_of_stack_dhcpv4_client(
&self,
payload: &ControllerStartOutOfStackDhcpv4ClientRequest,
) -> QueryResponseFut<ControllerStartOutOfStackDhcpv4ClientResult, DefaultFuchsiaResourceDialect>
pub fn start_out_of_stack_dhcpv4_client( &self, payload: &ControllerStartOutOfStackDhcpv4ClientRequest, ) -> QueryResponseFut<ControllerStartOutOfStackDhcpv4ClientResult, DefaultFuchsiaResourceDialect>
Starts a DHCPv4 client on the provided interface.
- request
interface_idthe interface to start a DHCPv4 client on. Required.
Sourcepub fn stop_out_of_stack_dhcpv4_client(
&self,
payload: &ControllerStopOutOfStackDhcpv4ClientRequest,
) -> QueryResponseFut<ControllerStopOutOfStackDhcpv4ClientResult, DefaultFuchsiaResourceDialect>
pub fn stop_out_of_stack_dhcpv4_client( &self, payload: &ControllerStopOutOfStackDhcpv4ClientRequest, ) -> QueryResponseFut<ControllerStopOutOfStackDhcpv4ClientResult, DefaultFuchsiaResourceDialect>
Stops the DHCPv4 client on the provided interface.
- request
interface_idthe interface to stop a DHCPv4 client client on. Required.
- error
DHCPV4_CLIENT_NOT_RUNNINGif no DHCPv4 client is running. - error
DHCPV4_CLIENT_SHUTDOWN_FAILEDif shutting down the DHCPv4 client failed.
Trait Implementations§
Source§impl Clone for ControllerProxy
impl Clone for ControllerProxy
Source§fn clone(&self) -> ControllerProxy
fn clone(&self) -> ControllerProxy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl ControllerProxyInterface for ControllerProxy
impl ControllerProxyInterface for ControllerProxy
type StartHermeticNetworkRealmResponseFut = QueryResponseFut<Result<(), Error>>
type StopHermeticNetworkRealmResponseFut = QueryResponseFut<Result<(), Error>>
type AddInterfaceResponseFut = QueryResponseFut<Result<(), Error>>
type StartStubResponseFut = QueryResponseFut<Result<(), Error>>
type StopStubResponseFut = QueryResponseFut<Result<(), Error>>
type PingResponseFut = QueryResponseFut<Result<(), Error>>
type PollUdpResponseFut = QueryResponseFut<Result<Vec<u8>, Error>>
type JoinMulticastGroupResponseFut = QueryResponseFut<Result<(), Error>>
type LeaveMulticastGroupResponseFut = QueryResponseFut<Result<(), Error>>
type StartDhcpv6ClientResponseFut = QueryResponseFut<Result<(), Error>>
type StopDhcpv6ClientResponseFut = QueryResponseFut<Result<(), Error>>
type StartOutOfStackDhcpv4ClientResponseFut = QueryResponseFut<Result<(), Error>>
type StopOutOfStackDhcpv4ClientResponseFut = QueryResponseFut<Result<(), Error>>
fn start_hermetic_network_realm( &self, netstack: Netstack, ) -> Self::StartHermeticNetworkRealmResponseFut
fn stop_hermetic_network_realm( &self, ) -> Self::StopHermeticNetworkRealmResponseFut
fn add_interface( &self, mac_address: &MacAddress, name: &str, wait_any_ip_address: bool, ) -> Self::AddInterfaceResponseFut
fn start_stub(&self, component_url: &str) -> Self::StartStubResponseFut
fn stop_stub(&self) -> Self::StopStubResponseFut
fn ping( &self, target: &IpAddress, payload_length: u16, interface_name: Option<&str>, timeout: i64, ) -> Self::PingResponseFut
fn poll_udp( &self, target: &SocketAddress, payload: &[u8], timeout: i64, num_retries: u16, ) -> Self::PollUdpResponseFut
fn join_multicast_group( &self, address: &IpAddress, interface_id: u64, ) -> Self::JoinMulticastGroupResponseFut
fn leave_multicast_group( &self, address: &IpAddress, interface_id: u64, ) -> Self::LeaveMulticastGroupResponseFut
fn start_dhcpv6_client( &self, params: &NewClientParams, ) -> Self::StartDhcpv6ClientResponseFut
fn stop_dhcpv6_client(&self) -> Self::StopDhcpv6ClientResponseFut
fn start_out_of_stack_dhcpv4_client( &self, payload: &ControllerStartOutOfStackDhcpv4ClientRequest, ) -> Self::StartOutOfStackDhcpv4ClientResponseFut
fn stop_out_of_stack_dhcpv4_client( &self, payload: &ControllerStopOutOfStackDhcpv4ClientRequest, ) -> Self::StopOutOfStackDhcpv4ClientResponseFut
Source§impl Debug for ControllerProxy
impl Debug for ControllerProxy
Source§impl Proxy for ControllerProxy
impl Proxy for ControllerProxy
Source§type Protocol = ControllerMarker
type Protocol = ControllerMarker
Proxy controls.