Trait thrussh::server::Handler [] [src]

pub trait Handler {
    fn auth_none(&mut self, user: &str) -> bool { ... }
    fn auth_password(&mut self, user: &str, password: &str) -> bool { ... }
    fn auth_publickey(&mut self, user: &str, public_key: &PublicKey) -> bool { ... }
    fn channel_close(&mut self, channel: u32, session: &mut Session) -> Result<()Error> { ... }
    fn channel_eof(&mut self, channel: u32, session: &mut Session) -> Result<()Error> { ... }
    fn channel_open_session(&mut self, channel: u32, session: &mut Session) { ... }
    fn channel_open_x11(&mut self, channel: u32, originator_address: &str, originator_port: u32, session: &mut Session) { ... }
    fn channel_open_direct_tcpip(&mut self, channel: u32, host_to_connect: &str, port_to_connect: u32, originator_address: &str, originator_port: u32, session: &mut Session) { ... }
    fn data(&mut self, channel: u32, data: &[u8], session: &mut Session) -> Result<()Error> { ... }
    fn extended_data(&mut self, channel: u32, code: u32, data: &[u8], session: &mut Session) -> Result<()Error> { ... }
    fn window_adjusted(&mut self, channel: u32, session: &mut Session) -> Result<()Error> { ... }
    fn pty_request(&mut self, channel: u32, term: &str, col_width: u32, row_height: u32, pix_width: u32, pix_height: u32, modes: &[(Pty, u32)], session: &mut Session) -> Result<()Error> { ... }
    fn x11_request(&mut self, channel: u32, single_connection: bool, x11_auth_protocol: &str, x11_auth_cookie: &str, x11_screen_number: u32, session: &mut Session) -> Result<()Error> { ... }
    fn env_request(&mut self, channel: u32, variable_name: &str, variable_value: &str, session: &mut Session) -> Result<()Error> { ... }
    fn shell_request(&mut self, channel: u32, session: &mut Session) -> Result<()Error> { ... }
    fn exec_request(&mut self, channel: u32, data: &[u8], session: &mut Session) -> Result<()Error> { ... }
    fn subsystem_request(&mut self, channel: u32, name: &str, session: &mut Session) -> Result<()Error> { ... }
    fn window_change_request(&mut self, channel: u32, col_width: u32, row_height: u32, pix_width: u32, pix_height: u32, session: &mut Session) -> Result<()Error> { ... }
    fn signal(&mut self, channel: u32, signal_name: Sig, session: &mut Session) -> Result<()Error> { ... }
    fn tcpip_forward(&mut self, address: &str, port: u32, session: &mut Session) -> Result<()Error> { ... }
    fn cancel_tcpip_forward(&mut self, address: &str, port: u32, session: &mut Session) -> Result<()Error> { ... }
}

Provided Methods

fn auth_none(&mut self, user: &str) -> bool

Check authentication using the "none" method. Thrussh makes sure rejection happens in time config.auth_rejection_time, except if this method takes more than that.

fn auth_password(&mut self, user: &str, password: &str) -> bool

Check authentication using the "password" method. Thrussh makes sure rejection happens in time config.auth_rejection_time, except if this method takes more than that.

fn auth_publickey(&mut self, user: &str, public_key: &PublicKey) -> bool

Check authentication using the "publickey" method. Thrussh makes sure rejection happens in time config.auth_rejection_time, except if this method takes more than that.

fn channel_close(&mut self, channel: u32, session: &mut Session) -> Result<()Error>

Called when the client closes a channel.

fn channel_eof(&mut self, channel: u32, session: &mut Session) -> Result<()Error>

Called when the client sends EOF to a channel.

fn channel_open_session(&mut self, channel: u32, session: &mut Session)

Called when a new session channel is created.

fn channel_open_x11(&mut self, channel: u32, originator_address: &str, originator_port: u32, session: &mut Session)

Called when a new X11 channel is created.

fn channel_open_direct_tcpip(&mut self, channel: u32, host_to_connect: &str, port_to_connect: u32, originator_address: &str, originator_port: u32, session: &mut Session)

Called when a new channel is created.

fn data(&mut self, channel: u32, data: &[u8], session: &mut Session) -> Result<()Error>

Called when a data packet is received. A response can be written to the response argument.

fn extended_data(&mut self, channel: u32, code: u32, data: &[u8], session: &mut Session) -> Result<()Error>

Called when an extended data packet is received. Code 1 means that this packet comes from stderr, other codes are not defined (see RFC4254).

fn window_adjusted(&mut self, channel: u32, session: &mut Session) -> Result<()Error>

Called when the network window is adjusted, meaning that we can send more bytes.

fn pty_request(&mut self, channel: u32, term: &str, col_width: u32, row_height: u32, pix_width: u32, pix_height: u32, modes: &[(Pty, u32)], session: &mut Session) -> Result<()Error>

The client requests a pseudo-terminal with the given specifications.

fn x11_request(&mut self, channel: u32, single_connection: bool, x11_auth_protocol: &str, x11_auth_cookie: &str, x11_screen_number: u32, session: &mut Session) -> Result<()Error>

The client requests an X11 connection.

fn env_request(&mut self, channel: u32, variable_name: &str, variable_value: &str, session: &mut Session) -> Result<()Error>

The client wants to set the given environment variable. Check these carefully, as it is dangerous to allow any variable environment to be set.

fn shell_request(&mut self, channel: u32, session: &mut Session) -> Result<()Error>

The client requests a shell.

fn exec_request(&mut self, channel: u32, data: &[u8], session: &mut Session) -> Result<()Error>

The client sends a command to execute, to be passed to a shell. Make sure to check the command before doing so.

fn subsystem_request(&mut self, channel: u32, name: &str, session: &mut Session) -> Result<()Error>

The client asks to start the subsystem with the given name (such as sftp).

fn window_change_request(&mut self, channel: u32, col_width: u32, row_height: u32, pix_width: u32, pix_height: u32, session: &mut Session) -> Result<()Error>

The client's pseudo-terminal window size has changed.

fn signal(&mut self, channel: u32, signal_name: Sig, session: &mut Session) -> Result<()Error>

The client is sending a signal (usually to pass to the currently running process).

fn tcpip_forward(&mut self, address: &str, port: u32, session: &mut Session) -> Result<()Error>

Used for reverse-forwarding ports, see RFC4254.

fn cancel_tcpip_forward(&mut self, address: &str, port: u32, session: &mut Session) -> Result<()Error>

Used to stop the reverse-forwarding of a port, see RFC4254.

Implementors