pub struct Session(_);
Expand description
A connected server session. This type is unique to a client.
Implementations
sourceimpl Session
impl Session
sourcepub fn flush(&mut self) -> Result<(), Error>
pub fn flush(&mut self) -> Result<(), Error>
Flush the session, i.e. encrypt the pending buffer.
sourcepub fn disconnect(
&mut self,
reason: Disconnect,
description: &str,
language_tag: &str
)
pub fn disconnect(
&mut self,
reason: Disconnect,
description: &str,
language_tag: &str
)
Sends a disconnect message.
sourcepub fn request_success(&mut self)
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).
sourcepub fn request_failure(&mut self)
pub fn request_failure(&mut self)
Send a “failure” reply to a global request.
sourcepub fn channel_success(&mut self, channel: ChannelId)
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).
sourcepub fn channel_failure(&mut self, channel: ChannelId)
pub fn channel_failure(&mut self, channel: ChannelId)
Send a “failure” reply to a global request.
sourcepub fn channel_open_failure(
&mut self,
channel: ChannelId,
reason: ChannelOpenFailure,
description: &str,
language: &str
)
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.
sourcepub fn data(
&mut self,
channel: ChannelId,
extended: Option<u32>,
data: &[u8]
) -> usize
pub fn data(
&mut self,
channel: ChannelId,
extended: Option<u32>,
data: &[u8]
) -> usize
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.
sourcepub fn xon_xoff_request(&mut self, channel: ChannelId, client_can_do: bool)
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.
sourcepub fn exit_status_request(&mut self, channel: ChannelId, exit_status: u32)
pub fn exit_status_request(&mut self, channel: ChannelId, exit_status: u32)
Send the exit status of a program.
sourcepub fn exit_signal_request(
&mut self,
channel: ChannelId,
signal: Sig<'_>,
core_dumped: bool,
error_message: &str,
language_tag: &str
)
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.
sourcepub fn channel_open_forwarded_tcpip(
&mut self,
connected_address: &str,
connected_port: u32,
originator_address: &str,
originator_port: u32
) -> Result<ChannelId, Error>
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()
.