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

pub trait Handler: Sized {
    type Error: From<Error> + Send;
    type FutureBool: Future<Output = Result<(Self, bool), Self::Error>> + Send;
    type FutureUnit: Future<Output = Result<(Self, Session), Self::Error>> + Send;
    fn finished_bool(self, b: bool) -> Self::FutureBool;
fn finished(self, session: Session) -> Self::FutureUnit; fn auth_banner(self, banner: &str, session: Session) -> Self::FutureUnit { ... }
fn check_server_key(self, server_public_key: &PublicKey) -> Self::FutureBool { ... }
fn channel_open_confirmation(
        self,
        id: ChannelId,
        max_packet_size: u32,
        window_size: u32,
        session: Session
    ) -> Self::FutureUnit { ... }
fn channel_success(
        self,
        channel: ChannelId,
        session: Session
    ) -> Self::FutureUnit { ... }
fn channel_close(
        self,
        channel: ChannelId,
        session: Session
    ) -> Self::FutureUnit { ... }
fn channel_eof(
        self,
        channel: ChannelId,
        session: Session
    ) -> Self::FutureUnit { ... }
fn channel_open_failure(
        self,
        channel: ChannelId,
        reason: ChannelOpenFailure,
        description: &str,
        language: &str,
        session: Session
    ) -> Self::FutureUnit { ... }
fn channel_open_forwarded_tcpip(
        self,
        channel: ChannelId,
        connected_address: &str,
        connected_port: u32,
        originator_address: &str,
        originator_port: u32,
        session: Session
    ) -> Self::FutureUnit { ... }
fn data(
        self,
        channel: ChannelId,
        data: &[u8],
        session: Session
    ) -> Self::FutureUnit { ... }
fn extended_data(
        self,
        channel: ChannelId,
        ext: u32,
        data: &[u8],
        session: Session
    ) -> Self::FutureUnit { ... }
fn xon_xoff(
        self,
        channel: ChannelId,
        client_can_do: bool,
        session: Session
    ) -> Self::FutureUnit { ... }
fn exit_status(
        self,
        channel: ChannelId,
        exit_status: u32,
        session: Session
    ) -> Self::FutureUnit { ... }
fn exit_signal(
        self,
        channel: ChannelId,
        signal_name: Sig,
        core_dumped: bool,
        error_message: &str,
        lang_tag: &str,
        session: Session
    ) -> Self::FutureUnit { ... }
fn window_adjusted(
        self,
        channel: ChannelId,
        new_size: u32,
        session: Session
    ) -> Self::FutureUnit { ... }
fn adjust_window(&mut self, channel: ChannelId, window: u32) -> u32 { ... } }

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

Associated Types

type Error: From<Error> + Send[src]

type FutureBool: Future<Output = Result<(Self, bool), Self::Error>> + Send[src]

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

type FutureUnit: Future<Output = Result<(Self, Session), Self::Error>> + Send[src]

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

Loading content...

Required methods

fn finished_bool(self, b: bool) -> Self::FutureBool[src]

Convert a bool to Self::FutureBool. This is used to produce the default handlers.

fn finished(self, session: Session) -> Self::FutureUnit[src]

Produce a Self::FutureUnit. This is used to produce the default handlers.

Loading content...

Provided methods

fn auth_banner(self, banner: &str, session: Session) -> Self::FutureUnit[src]

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

The returned Boolean is ignored.

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

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,
    id: ChannelId,
    max_packet_size: u32,
    window_size: u32,
    session: Session
) -> Self::FutureUnit
[src]

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_success(
    self,
    channel: ChannelId,
    session: Session
) -> Self::FutureUnit
[src]

Called when the server signals success.

fn channel_close(self, channel: ChannelId, session: Session) -> Self::FutureUnit[src]

Called when the server closes a channel.

fn channel_eof(self, channel: ChannelId, session: Session) -> Self::FutureUnit[src]

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::FutureUnit
[src]

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::FutureUnit
[src]

Called when a new channel is created.

fn data(
    self,
    channel: ChannelId,
    data: &[u8],
    session: Session
) -> Self::FutureUnit
[src]

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 extended_data(
    self,
    channel: ChannelId,
    ext: u32,
    data: &[u8],
    session: Session
) -> Self::FutureUnit
[src]

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::FutureUnit
[src]

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::FutureUnit
[src]

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::FutureUnit
[src]

The remote process exited upon receiving a signal.

fn window_adjusted(
    self,
    channel: ChannelId,
    new_size: u32,
    session: Session
) -> Self::FutureUnit
[src]

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.

fn adjust_window(&mut self, channel: ChannelId, window: u32) -> u32[src]

Called when this client adjusts the network window. Return the next target window and maximum packet size.

Loading content...

Implementors

Loading content...