pub enum DevicePairRequest {
AddPort {
config: DevicePairPortConfig,
responder: DevicePairAddPortResponder,
},
RemovePort {
id: u8,
responder: DevicePairRemovePortResponder,
},
GetLeft {
device: ServerEnd<DeviceMarker>,
control_handle: DevicePairControlHandle,
},
GetRight {
device: ServerEnd<DeviceMarker>,
control_handle: DevicePairControlHandle,
},
GetLeftPort {
id: u8,
port: ServerEnd<PortMarker>,
control_handle: DevicePairControlHandle,
},
GetRightPort {
id: u8,
port: ServerEnd<PortMarker>,
control_handle: DevicePairControlHandle,
},
}
Expand description
Provides control over a pair of network devices.
A DevicePair
is a simpler version of Device
that “shorts” two network
device interfaces, named its “left” and “right” ends. The internal state of
a DevicePair
is not accessible, like it is for Device
and it provides a
more streamlined (and considerably faster) pair of
[fuchsia.hardware.network/Device
]s. The transmit side of each port of the
left end is connected to the receive side of the port with the same
identifier on the right end, and vice-versa. A DevicePair
’s port online
signal is handled internally (online if any of the ends has an active data
session). If MAC addresses are provided on creation, the only supported MAC
filtering mode is PROMISCUOUS
.
This protocol encodes the underlying object’s lifetime in both directions; the underlying object is alive iff both ends of the protocol are open. That is:
- Closing the client end causes the object to be destroyed.
- Observing a closure of the server end indicates the object no longer exists.
Variants§
AddPort
Adds a logical port to this device pair.
- request
config
port configuration.
- error
ZX_ERR_INVALID_ARGS
ifconfig
is invalid. - error
ZX_ERR_ALREADY_EXISTS
if the provided port identifier is already in use.
RemovePort
Removes a logical port created by
[fuchsia.net.tun/DevicePair.AddPort
].
- request
id
identifier of the port to remove.
- error
ZX_ERR_NOT_FOUND
ifid
does not map to an existing port.
GetLeft
Connects to the underlying left device endpoint.
- request
device
handle serve the left device endpoint on.
GetRight
Connects to the underlying right device endpoint.
- request
device
handle serve the right device endpoint on.
GetLeftPort
Connects to an underlying left port.
- request
id
requested port identifier. - request
port
grants access to the requested port on the left device.
GetRightPort
Connects to an underlying right port.
- request
id
requested port identifier. - request
port
grants access to the requested port on the right device.
Implementations§
Source§impl DevicePairRequest
impl DevicePairRequest
pub fn into_add_port( self, ) -> Option<(DevicePairPortConfig, DevicePairAddPortResponder)>
pub fn into_remove_port(self) -> Option<(u8, DevicePairRemovePortResponder)>
pub fn into_get_left( self, ) -> Option<(ServerEnd<DeviceMarker>, DevicePairControlHandle)>
pub fn into_get_right( self, ) -> Option<(ServerEnd<DeviceMarker>, DevicePairControlHandle)>
pub fn into_get_left_port( self, ) -> Option<(u8, ServerEnd<PortMarker>, DevicePairControlHandle)>
pub fn into_get_right_port( self, ) -> Option<(u8, ServerEnd<PortMarker>, DevicePairControlHandle)>
Sourcepub fn method_name(&self) -> &'static str
pub fn method_name(&self) -> &'static str
Name of the method defined in FIDL