Struct thrussh::server::Session

source ·
pub struct Session { /* private fields */ }
Expand description

A connected server session. This type is unique to a client.

Implementations§

source§

impl Session

source

pub fn handle(&self) -> Handle

Get a handle to this session.

source

pub fn writable_packet_size(&self, channel: &ChannelId) -> u32

source

pub fn window_size(&self, channel: &ChannelId) -> u32

source

pub fn max_packet_size(&self, channel: &ChannelId) -> u32

source

pub fn flush(&mut self) -> Result<(), Error>

Flush the session, i.e. encrypt the pending buffer.

source

pub fn flush_pending(&mut self, channel: ChannelId) -> usize

source

pub fn sender_window_size(&self, channel: ChannelId) -> usize

source

pub fn has_pending_data(&self, channel: ChannelId) -> bool

source

pub fn config(&self) -> &Config

Retrieves the configuration of this session.

source

pub fn disconnect( &mut self, reason: Disconnect, description: &str, language_tag: &str )

Sends a disconnect message.

source

pub fn request_success(&mut self)

Send a “success” reply to a /global/ request (requests without a channel number, such as TCP/IP forwarding or cancelling). Always call this function if the request was successful (it checks whether the client expects an answer).

source

pub fn request_failure(&mut self)

Send a “failure” reply to a global request.

source

pub fn channel_success(&mut self, channel: ChannelId)

Send a “success” reply to a channel request. Always call this function if the request was successful (it checks whether the client expects an answer).

source

pub fn channel_failure(&mut self, channel: ChannelId)

Send a “failure” reply to a global request.

source

pub fn channel_open_failure( &mut self, channel: ChannelId, reason: ChannelOpenFailure, description: &str, language: &str )

Send a “failure” reply to a request to open a channel open.

source

pub fn close(&mut self, channel: ChannelId)

Close a channel.

source

pub fn eof(&mut self, channel: ChannelId)

Send EOF to a channel

source

pub fn data(&mut self, channel: ChannelId, data: CryptoVec)

Send data to a channel. On session channels, extended can be used to encode standard error by passing Some(1), and stdout by passing None.

The number of bytes added to the “sending pipeline” (to be processed by the event loop) is returned.

source

pub fn extended_data( &mut self, channel: ChannelId, extended: u32, data: CryptoVec )

Send data to a channel. On session channels, extended can be used to encode standard error by passing Some(1), and stdout by passing None.

The number of bytes added to the “sending pipeline” (to be processed by the event loop) is returned.

source

pub fn xon_xoff_request(&mut self, channel: ChannelId, client_can_do: bool)

Inform the client of whether they may perform control-S/control-Q flow control. See RFC4254.

source

pub fn exit_status_request(&mut self, channel: ChannelId, exit_status: u32)

Send the exit status of a program.

source

pub fn exit_signal_request( &mut self, channel: ChannelId, signal: Sig, core_dumped: bool, error_message: &str, language_tag: &str )

If the program was killed by a signal, send the details about the signal to the client.

source

pub fn channel_open_forwarded_tcpip( &mut self, connected_address: &str, connected_port: u32, originator_address: &str, originator_port: u32 ) -> Result<ChannelId, Error>

Open a TCP/IP forwarding channel, when a connection comes to a local port for which forwarding has been requested. See RFC4254. The TCP/IP packets can then be tunneled through the channel using .data().

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V