[][src]Trait thrussh::client::Handler

pub trait Handler: Sized {
    type Error: Debug;
    type FutureBool: Future<Item = (Self, bool), Error = Self::Error> + FromFinished<(Self, bool), Self::Error>;
    type FutureUnit: Future<Item = Self, Error = Self::Error> + FromFinished<Self, Self::Error>;
    type FutureSign: Future<Item = (Self, CryptoVec), Error = Self::Error> + FromFinished<(Self, CryptoVec), Self::Error>;
    type SessionUnit: Future<Item = (Self, Session), Error = Self::Error> + FromFinished<(Self, Session), Self::Error>;
    fn auth_banner(self, banner: &str) -> Self::FutureUnit { ... }
fn auth_publickey_sign(
        self,
        key: &PublicKey,
        to_sign: CryptoVec
    ) -> Self::FutureSign { ... }
fn check_server_key(self, server_public_key: &PublicKey) -> Self::FutureBool { ... }
fn channel_open_confirmation(
        self,
        channel: ChannelId,
        session: Session
    ) -> Self::SessionUnit { ... }
fn channel_close(
        self,
        channel: ChannelId,
        session: Session
    ) -> Self::SessionUnit { ... }
fn channel_eof(
        self,
        channel: ChannelId,
        session: Session
    ) -> Self::SessionUnit { ... }
fn channel_open_failure(
        self,
        channel: ChannelId,
        reason: ChannelOpenFailure,
        description: &str,
        language: &str,
        session: Session
    ) -> Self::SessionUnit { ... }
fn channel_open_forwarded_tcpip(
        self,
        channel: ChannelId,
        connected_address: &str,
        connected_port: u32,
        originator_address: &str,
        originator_port: u32,
        session: Session
    ) -> Self::SessionUnit { ... }
fn data(
        self,
        channel: ChannelId,
        extended_code: Option<u32>,
        data: &[u8],
        session: Session
    ) -> Self::SessionUnit { ... }
fn xon_xoff(
        self,
        channel: ChannelId,
        client_can_do: bool,
        session: Session
    ) -> Self::SessionUnit { ... }
fn exit_status(
        self,
        channel: ChannelId,
        exit_status: u32,
        session: Session
    ) -> Self::SessionUnit { ... }
fn exit_signal(
        self,
        channel: ChannelId,
        signal_name: Sig,
        core_dumped: bool,
        error_message: &str,
        lang_tag: &str,
        session: Session
    ) -> Self::SessionUnit { ... }
fn window_adjusted(
        self,
        channel: ChannelId,
        new_window_size: usize,
        session: Session
    ) -> Self::SessionUnit { ... } }

A client handler. Note that messages can be received from the server at any time during a session.

Associated Types

type Error: Debug

Error type returned by the futures.

type FutureBool: Future<Item = (Self, bool), Error = Self::Error> + FromFinished<(Self, bool), Self::Error>

A future ultimately resolving into a boolean, which can be returned by some parts of this handler.

type FutureUnit: Future<Item = Self, Error = Self::Error> + FromFinished<Self, Self::Error>

A future ultimately resolving into a boolean, which can be returned by some parts of this handler.

type FutureSign: Future<Item = (Self, CryptoVec), Error = Self::Error> + FromFinished<(Self, CryptoVec), Self::Error>

A future that computes the signature of a CryptoVec, appends that signature to that CryptoVec, and resolves to the CryptoVec. Useful for instance to implement SSH agent clients.

type SessionUnit: Future<Item = (Self, Session), Error = Self::Error> + FromFinished<(Self, Session), Self::Error>

A future ultimately resolving into unit, which can be returned by some parts of this handler.

Loading content...

Provided methods

fn auth_banner(self, banner: &str) -> Self::FutureUnit

Called when the server sends us an authentication banner. This is usually meant to be shown to the user, see RFC4252 for more details.

fn auth_publickey_sign(
    self,
    key: &PublicKey,
    to_sign: CryptoVec
) -> Self::FutureSign

Called when using the FuturePublicKey method, used for instance to implement SSH agent. This can be used for instance to implement an interface to SSH agents. The default implementation returns the supplied CryptoVec without touching it.

fn check_server_key(self, server_public_key: &PublicKey) -> Self::FutureBool

Called to check the server's public key. This is a very important step to help prevent man-in-the-middle attacks. The default implementation rejects all keys.

fn channel_open_confirmation(
    self,
    channel: ChannelId,
    session: Session
) -> Self::SessionUnit

Called when the server confirmed our request to open a channel. A channel can only be written to after receiving this message (this library panics otherwise).

fn channel_close(
    self,
    channel: ChannelId,
    session: Session
) -> Self::SessionUnit

Called when the server closes a channel.

fn channel_eof(self, channel: ChannelId, session: Session) -> Self::SessionUnit

Called when the server sends EOF to a channel.

fn channel_open_failure(
    self,
    channel: ChannelId,
    reason: ChannelOpenFailure,
    description: &str,
    language: &str,
    session: Session
) -> Self::SessionUnit

Called when the server rejected our request to open a channel.

fn channel_open_forwarded_tcpip(
    self,
    channel: ChannelId,
    connected_address: &str,
    connected_port: u32,
    originator_address: &str,
    originator_port: u32,
    session: Session
) -> Self::SessionUnit

Called when a new channel is created.

fn data(
    self,
    channel: ChannelId,
    extended_code: Option<u32>,
    data: &[u8],
    session: Session
) -> Self::SessionUnit

Called when the server sends us data. The extended_code parameter is a stream identifier, None is usually the standard output, and Some(1) is the standard error. See RFC4254.

fn xon_xoff(
    self,
    channel: ChannelId,
    client_can_do: bool,
    session: Session
) -> Self::SessionUnit

The server informs this client of whether the client may perform control-S/control-Q flow control. See RFC4254.

fn exit_status(
    self,
    channel: ChannelId,
    exit_status: u32,
    session: Session
) -> Self::SessionUnit

The remote process has exited, with the given exit status.

fn exit_signal(
    self,
    channel: ChannelId,
    signal_name: Sig,
    core_dumped: bool,
    error_message: &str,
    lang_tag: &str,
    session: Session
) -> Self::SessionUnit

The remote process exited upon receiving a signal.

fn window_adjusted(
    self,
    channel: ChannelId,
    new_window_size: usize,
    session: Session
) -> Self::SessionUnit

Called when the network window is adjusted, meaning that we can send more bytes. This is useful if this client wants to send huge amounts of data, for instance if we have called Session::data before, and it returned less than the full amount of data.

Loading content...

Implementors

Loading content...