pub struct ControllerSynchronousProxy { /* private fields */ }
Implementations§
Source§impl ControllerSynchronousProxy
impl ControllerSynchronousProxy
pub fn new(channel: Channel) -> Self
pub fn into_channel(self) -> Channel
Sourcepub fn wait_for_event(
&self,
deadline: MonotonicInstant,
) -> Result<ControllerEvent, Error>
pub fn wait_for_event( &self, deadline: MonotonicInstant, ) -> Result<ControllerEvent, Error>
Waits until an event arrives and returns it. It is safe for other threads to make concurrent requests while waiting for an event.
Sourcepub fn start_hermetic_network_realm(
&self,
netstack: Netstack,
___deadline: MonotonicInstant,
) -> Result<ControllerStartHermeticNetworkRealmResult, Error>
pub fn start_hermetic_network_realm( &self, netstack: Netstack, ___deadline: MonotonicInstant, ) -> Result<ControllerStartHermeticNetworkRealmResult, Error>
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 specifiednetstack
.
Sourcepub fn stop_hermetic_network_realm(
&self,
___deadline: MonotonicInstant,
) -> Result<ControllerStopHermeticNetworkRealmResult, Error>
pub fn stop_hermetic_network_realm( &self, ___deadline: MonotonicInstant, ) -> Result<ControllerStopHermeticNetworkRealmResult, Error>
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.
Sourcepub fn add_interface(
&self,
mac_address: &MacAddress,
name: &str,
wait_any_ip_address: bool,
___deadline: MonotonicInstant,
) -> Result<ControllerAddInterfaceResult, Error>
pub fn add_interface( &self, mac_address: &MacAddress, name: &str, wait_any_ip_address: bool, ___deadline: MonotonicInstant, ) -> Result<ControllerAddInterfaceResult, Error>
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 withname
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 withmac_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.
Sourcepub fn start_stub(
&self,
component_url: &str,
___deadline: MonotonicInstant,
) -> Result<ControllerStartStubResult, Error>
pub fn start_stub( &self, component_url: &str, ___deadline: MonotonicInstant, ) -> Result<ControllerStartStubResult, Error>
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 tocomponent_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 thecomponent_url
is malformed.
Sourcepub fn stop_stub(
&self,
___deadline: MonotonicInstant,
) -> Result<ControllerStopStubResult, Error>
pub fn stop_stub( &self, ___deadline: MonotonicInstant, ) -> Result<ControllerStopStubResult, Error>
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.
Sourcepub fn ping(
&self,
target: &IpAddress,
payload_length: u16,
interface_name: Option<&str>,
timeout: i64,
___deadline: MonotonicInstant,
) -> Result<ControllerPingResult, Error>
pub fn ping( &self, target: &IpAddress, payload_length: u16, interface_name: Option<&str>, timeout: i64, ___deadline: MonotonicInstant, ) -> Result<ControllerPingResult, Error>
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 ofpayload_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
ifinterface_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
iftarget
corresponds to a link-local address and aninterface_name
is not specified or thepayload_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 specifedtimeout
.
Sourcepub fn poll_udp(
&self,
target: &SocketAddress,
payload: &[u8],
timeout: i64,
num_retries: u16,
___deadline: MonotonicInstant,
) -> Result<ControllerPollUdpResult, Error>
pub fn poll_udp( &self, target: &SocketAddress, payload: &[u8], timeout: i64, num_retries: u16, ___deadline: MonotonicInstant, ) -> Result<ControllerPollUdpResult, Error>
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.
Sourcepub fn join_multicast_group(
&self,
address: &IpAddress,
interface_id: u64,
___deadline: MonotonicInstant,
) -> Result<ControllerJoinMulticastGroupResult, Error>
pub fn join_multicast_group( &self, address: &IpAddress, interface_id: u64, ___deadline: MonotonicInstant, ) -> Result<ControllerJoinMulticastGroupResult, Error>
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 providedaddress
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 specifiedinterface_id
does not exist or theaddress
does not correspond to a valid multicast address.
Sourcepub fn leave_multicast_group(
&self,
address: &IpAddress,
interface_id: u64,
___deadline: MonotonicInstant,
) -> Result<ControllerLeaveMulticastGroupResult, Error>
pub fn leave_multicast_group( &self, address: &IpAddress, interface_id: u64, ___deadline: MonotonicInstant, ) -> Result<ControllerLeaveMulticastGroupResult, Error>
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 providedaddress
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 specifiedinterface_id
does not exist or theaddress
does not correspond to a valid multicast address.
Sourcepub fn start_dhcpv6_client(
&self,
params: &NewClientParams,
___deadline: MonotonicInstant,
) -> Result<ControllerStartDhcpv6ClientResult, Error>
pub fn start_dhcpv6_client( &self, params: &NewClientParams, ___deadline: MonotonicInstant, ) -> Result<ControllerStartDhcpv6ClientResult, Error>
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 byparams.interface_id
already.
Sourcepub fn stop_dhcpv6_client(
&self,
___deadline: MonotonicInstant,
) -> Result<ControllerStopDhcpv6ClientResult, Error>
pub fn stop_dhcpv6_client( &self, ___deadline: MonotonicInstant, ) -> Result<ControllerStopDhcpv6ClientResult, Error>
Stops all DHCPv6 clients.
- error
DHCPV6_CLIENT_NOT_RUNNING
if no DHCPv6 client is running.
Sourcepub fn start_out_of_stack_dhcpv4_client(
&self,
payload: &ControllerStartOutOfStackDhcpv4ClientRequest,
___deadline: MonotonicInstant,
) -> Result<ControllerStartOutOfStackDhcpv4ClientResult, Error>
pub fn start_out_of_stack_dhcpv4_client( &self, payload: &ControllerStartOutOfStackDhcpv4ClientRequest, ___deadline: MonotonicInstant, ) -> Result<ControllerStartOutOfStackDhcpv4ClientResult, Error>
Starts a DHCPv4 client on the provided interface.
- request
interface_id
the interface to start a DHCPv4 client on. Required.
Sourcepub fn stop_out_of_stack_dhcpv4_client(
&self,
payload: &ControllerStopOutOfStackDhcpv4ClientRequest,
___deadline: MonotonicInstant,
) -> Result<ControllerStopOutOfStackDhcpv4ClientResult, Error>
pub fn stop_out_of_stack_dhcpv4_client( &self, payload: &ControllerStopOutOfStackDhcpv4ClientRequest, ___deadline: MonotonicInstant, ) -> Result<ControllerStopOutOfStackDhcpv4ClientResult, Error>
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 Debug for ControllerSynchronousProxy
impl Debug for ControllerSynchronousProxy
Source§impl SynchronousProxy for ControllerSynchronousProxy
impl SynchronousProxy for ControllerSynchronousProxy
Source§type Proxy = ControllerProxy
type Proxy = ControllerProxy
Source§type Protocol = ControllerMarker
type Protocol = ControllerMarker
Proxy
controls.