pub struct MobileVirtualRadio { /* private fields */ }Expand description
A running virtual radio. Dropping it, or calling Self::stop, stops
the device and releases its state directory.
Implementations§
Source§impl MobileVirtualRadio
impl MobileVirtualRadio
Sourcepub fn start(
state_dir: String,
enable_phy: bool,
listener: Arc<dyn MobileVirtualRadioListener>,
) -> Result<Arc<Self>, MobileVirtualRadioError>
pub fn start( state_dir: String, enable_phy: bool, listener: Arc<dyn MobileVirtualRadioListener>, ) -> Result<Arc<Self>, MobileVirtualRadioError>
Start a virtual radio keeping its saved configuration under
state_dir, for a host in this process.
With enable_phy, the device comes up listening whatever it saved:
starting it is choosing the LAN. Without, its saved state decides,
so a host that turned the PHY off and saved keeps it off across
restarts.
Sourcepub fn serve(
state_dir: String,
socket_path: String,
enable_phy: bool,
listener: Arc<dyn MobileVirtualRadioListener>,
) -> Result<Arc<Self>, MobileVirtualRadioError>
pub fn serve( state_dir: String, socket_path: String, enable_phy: bool, listener: Arc<dyn MobileVirtualRadioListener>, ) -> Result<Arc<Self>, MobileVirtualRadioError>
Start a virtual radio as Self::start does, for hosts that
connect to the local socket at socket_path: connecting attaches,
closing detaches, and a new connection replaces the current one.
The socket is placed where only processes entitled to the radio
can reach it, and is removed when the radio stops.
Sourcepub fn attach(&self, sink: Arc<dyn MobileWireSink>)
pub fn attach(&self, sink: Arc<dyn MobileWireSink>)
A host in this process attached, taking replies at sink: the
device starts a session, announcing it with CMD_SESSION_RESET.