Struct thrussh::client::Connection
[−]
[src]
pub struct Connection { pub session: Session, // some fields omitted }
Client connection.
Fields
session: Session
Methods
impl Connection
[src]
fn new(config: Arc<Config>) -> Self
fn read<R: BufRead, C: Handler>(&mut self, client: &mut C, stream: &mut R, buffer: &mut CryptoBuf, buffer2: &mut CryptoBuf) -> Result<bool, Error>
Process all packets available in the buffer, and returns
whether at least one complete packet was read.
buffer
and buffer2
are work spaces mostly used to compute keys. They are cleared before using, hence nothing is expected from them.
fn write<W: Write>(&mut self, stream: &mut W) -> Result<bool, Error>
Write all computed packets to the stream. Returns whether all packets have been sent.
Methods from Deref<Target=Session>
fn config(&self) -> &Config
Retrieves the configuration of this session.
fn auth_user(&self) -> &str
Retrieves the current user.
fn disconnect(&mut self, reason: Disconnect, description: &str, language_tag: &str)
Sends a disconnect message.
fn set_auth_user(&mut self, user: &str)
Set the user.
fn set_auth_public_key(&mut self, key: Algorithm)
Set the authentication method.
fn set_auth_password(&mut self, password: String)
Set the authentication method.
fn is_authenticated(&self) -> bool
Whether the client is authenticated.
fn channel_is_open(&self, channel: u32) -> bool
Check whether a channel has been confirmed.
fn has_auth_method(&self) -> bool
Tests whether we need an authentication method (for instance if the last attempt failed).
fn valid_auth_methods(&self) -> Option<MethodSet>
Returns the set of authentication methods that can continue, or None if this is not valid.
fn channel_open_session(&mut self) -> Option<u32>
Request a session channel (the most basic type of
channel). This function returns Some(..)
immediately if the
connection is authenticated, but the channel only becomes
usable when it's confirmed by the server, as indicated by the
confirmed
field of the corresponding Channel
.
fn channel_open_x11(&mut self, originator_address: &str, originator_port: u32) -> Option<u32>
Request an X11 channel, on which the X11 protocol may be tunneled.
fn channel_open_direct_tcpip(&mut self, host_to_connect: &str, port_to_connect: u32, originator_address: &str, originator_port: u32) -> Option<u32>
Open a TCP/IP forwarding channel. This is usually done when a connection comes to a locally forwarded TCP/IP port. See RFC4254. The TCP/IP packets can then be tunneled through the channel using .data()
.
fn close(&mut self, channel: u32)
Close a channel.
fn eof(&mut self, channel: u32)
Send EOF to a channel
fn data(&mut self, channel: u32, extended: Option<u32>, data: &[u8]) -> Result<usize, Error>
Send data or "extended data" to the given channel. Extended data can be used to multiplex different data streams into a single channel.
fn request_pty(&mut self, channel: u32, want_reply: bool, term: &str, col_width: u32, row_height: u32, pix_width: u32, pix_height: u32, terminal_modes: &[(Pty, u32)])
Request a pseudo-terminal with the given characteristics.
fn request_x11(&mut self, channel: u32, want_reply: bool, single_connection: bool, x11_authentication_protocol: &str, x11_authentication_cookie: &str, x11_screen_number: u32)
Request X11 forwarding through an already opened X11 channel. See RFC4254 for security issues related to cookies.
fn set_env(&mut self, channel: u32, want_reply: bool, variable_name: &str, variable_value: &str)
Set a remote environment variable.
fn request_shell(&mut self, want_reply: bool, channel: u32)
Request a remote shell.
fn exec(&mut self, channel: u32, want_reply: bool, command: &str)
Execute a remote program (will be passed to a shell). This can be used to implement scp (by calling a remote scp and tunneling to its standard input).
fn signal(&mut self, channel: u32, signal: Sig)
Signal a remote process.
fn request_subsystem(&mut self, want_reply: bool, channel: u32, name: &str)
Request the start of a subsystem with the given name.
fn window_change(&mut self, channel: u32, col_width: u32, row_height: u32, pix_width: u32, pix_height: u32)
Inform the server that our window size has changed.
fn tcpip_forward(&mut self, want_reply: bool, address: &str, port: u32)
Request the forwarding of a remote port to the client. The server will then open forwarding channels (which cause the client to call .channel_open_forwarded_tcpip()
).
fn cancel_tcpip_forward(&mut self, want_reply: bool, address: &str, port: u32)
Cancel a previous forwarding request.
Trait Implementations
impl Debug for Connection
[src]
impl Deref for Connection
[src]
type Target = Session
The resulting type after dereferencing
fn deref(&self) -> &Session
The method called to dereference a value