virtual_net

Trait VirtualSocket

Source
pub trait VirtualSocket:
    VirtualIoSource
    + Debug
    + Send
    + Sync
    + 'static {
    // Required methods
    fn set_ttl(&mut self, ttl: u32) -> Result<()>;
    fn ttl(&self) -> Result<u32>;
    fn addr_local(&self) -> Result<SocketAddr>;
    fn status(&self) -> Result<SocketStatus>;
    fn set_handler(
        &mut self,
        handler: Box<dyn InterestHandler + Send + Sync>,
    ) -> Result<()>;
}

Required Methods§

Source

fn set_ttl(&mut self, ttl: u32) -> Result<()>

Sets how many network hops the packets are permitted for new connections

Source

fn ttl(&self) -> Result<u32>

Returns the maximum number of network hops before packets are dropped

Source

fn addr_local(&self) -> Result<SocketAddr>

Returns the local address for this socket

Source

fn status(&self) -> Result<SocketStatus>

Returns the status/state of the socket

Source

fn set_handler( &mut self, handler: Box<dyn InterestHandler + Send + Sync>, ) -> Result<()>

Registers a waker for when this connection is ready to receive more data. Uses a stack machine which means more than one waker can be registered

Implementors§

Source§

impl VirtualSocket for LocalTcpStream

Available on crate feature host-net only.
Source§

impl VirtualSocket for LocalUdpSocket

Available on crate feature host-net only.
Source§

impl VirtualSocket for TcpSocketHalf