Skip to main content

ControlChannelServer

Trait ControlChannelServer 

pub trait ControlChannelServer: Send {
    type Error: Error + Send + Sync + 'static;

    // Required methods
    fn accept(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send;
    fn send(
        &mut self,
        frame: &[u8],
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
    fn recv(
        &mut self,
        buf: &mut [u8],
    ) -> impl Future<Output = Result<usize, Self::Error>> + Send;
}
Expand description

Server endpoint of the daemon-to-client control channel for one client connection.

The daemon owns one ControlChannelServer per connected client and uses it to push framed messages defined in cssh-rs-protocol.

Required Associated Types§

type Error: Error + Send + Sync + 'static

Error type returned by control-channel operations.

Required Methods§

fn accept(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send

Wait for the client process to connect.

§Returns

Ok(()) once a client has connected, or an error if the underlying endpoint failed.

fn send( &mut self, frame: &[u8], ) -> impl Future<Output = Result<(), Self::Error>> + Send

Send an already-framed control message to the connected client.

§Arguments
  • frame - Bytes produced by cssh-rs-protocol serialization helpers; the trait performs no framing of its own.

fn recv( &mut self, buf: &mut [u8], ) -> impl Future<Output = Result<usize, Self::Error>> + Send

Read up to buf.len() bytes from the connected client into buf.

§Arguments
  • buf - Destination buffer.
§Returns

Number of bytes written into buf. Ok(0) signals EOF (the peer closed the connection cleanly); any transport-level failure is reported as Err.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§