libsshpp v0.1.7
Modern C++17 wrapper for libssh
Loading...
Searching...
No Matches
sshpp::Channel Class Reference

#include <channel.hpp>

Public Member Functions

 Channel ()=default
 
 ~Channel ()
 
 Channel (Channel &&) noexcept
 
Channeloperator= (Channel &&) noexcept
 
 Channel (const Channel &)=delete
 
Channeloperator= (const Channel &)=delete
 
 operator bool () const noexcept
 
native_channel native_handle () const noexcept
 
std::recursive_mutex & session_mutex () const noexcept
 
Result< void > try_open_session ()
 
bool is_open () const noexcept
 
Result< void > try_request_pty (std::string_view term="xterm-256color", PtySize={})
 
Result< void > try_change_pty_size (PtySize)
 
Result< void > try_request_shell ()
 
Result< void > try_request_exec (std::string_view command)
 
Result< void > try_request_subsystem (std::string_view name)
 
Result< void > try_request_env (std::string_view name, std::string_view value)
 
Result< void > try_send_signal (Signal)
 
Result< std::size_t > try_read_some (MutableByteView buf, Stream=Stream::stdout_)
 
Result< std::size_t > try_read_some (MutableByteView buf, Stream, std::chrono::milliseconds timeout)
 
Result< std::string > try_read_all (Stream=Stream::stdout_, std::size_t limit=64u<< 20)
 
Result< std::size_t > try_write_some (ByteView data)
 
Result< std::size_t > try_write_some (ByteView data, Stream stream)
 
Result< void > try_write_all (ByteView data)
 
Result< void > try_write_all (ByteView data, Stream stream)
 
Result< void > try_write_all (std::string_view data)
 
Result< void > try_write_all (std::string_view data, Stream stream)
 
Result< std::size_t > try_bytes_available (Stream=Stream::stdout_) const
 
Result< bool > try_wait_readable (std::chrono::milliseconds, Stream=Stream::stdout_)
 
Result< void > try_send_eof ()
 
bool is_eof () const noexcept
 
Result< void > try_close ()
 
bool is_closed () const noexcept
 
Result< ExitStatetry_wait_exit (std::chrono::milliseconds timeout=std::chrono::milliseconds::max())
 
ExitState exit_state () const noexcept
 

Static Public Member Functions

static Channel from_native (native_channel, detail::SessionCorePtr, Ownership)
 

Friends

class Session
 

Detailed Description

A single SSH channel: exec/shell/pty/subsystem I/O multiplexed over a Session. See docs/design/05 ยง5.1.

Constructor & Destructor Documentation

◆ Channel() [1/3]

sshpp::Channel::Channel ( )
default

◆ ~Channel()

SSHPP_INLINE sshpp::Channel::~Channel ( )

◆ Channel() [2/3]

SSHPP_INLINE sshpp::Channel::Channel ( Channel &&  other)
noexcept

◆ Channel() [3/3]

sshpp::Channel::Channel ( const Channel )
delete

Member Function Documentation

◆ operator=() [1/2]

SSHPP_INLINE Channel & sshpp::Channel::operator= ( Channel &&  other)
noexcept

◆ operator=() [2/2]

Channel & sshpp::Channel::operator= ( const Channel )
delete

◆ operator bool()

sshpp::Channel::operator bool ( ) const
inlineexplicitnoexcept

◆ native_handle()

native_channel sshpp::Channel::native_handle ( ) const
inlinenoexcept

◆ from_native()

SSHPP_INLINE Channel sshpp::Channel::from_native ( native_channel  n,
detail::SessionCorePtr  core,
Ownership  o 
)
static

◆ session_mutex()

std::recursive_mutex & sshpp::Channel::session_mutex ( ) const
inlinenoexcept

The owning Session's recursive mutex. For advanced multi-threaded use only (e.g. a dedicated per-subsystem thread doing raw, synchronous libssh calls that must not interleave with a concurrent Event/message poll loop on the same underlying ssh_session - see SftpSubsystemHandler).

◆ try_open_session()

SSHPP_INLINE Result< void > sshpp::Channel::try_open_session ( )

◆ is_open()

bool sshpp::Channel::is_open ( ) const
inlinenoexcept

◆ try_request_pty()

SSHPP_INLINE Result< void > sshpp::Channel::try_request_pty ( std::string_view  term = "xterm-256color",
PtySize  size = {} 
)

◆ try_change_pty_size()

SSHPP_INLINE Result< void > sshpp::Channel::try_change_pty_size ( PtySize  size)

◆ try_request_shell()

SSHPP_INLINE Result< void > sshpp::Channel::try_request_shell ( )

◆ try_request_exec()

SSHPP_INLINE Result< void > sshpp::Channel::try_request_exec ( std::string_view  command)

◆ try_request_subsystem()

SSHPP_INLINE Result< void > sshpp::Channel::try_request_subsystem ( std::string_view  name)

◆ try_request_env()

SSHPP_INLINE Result< void > sshpp::Channel::try_request_env ( std::string_view  name,
std::string_view  value 
)

◆ try_send_signal()

SSHPP_INLINE Result< void > sshpp::Channel::try_send_signal ( Signal  s)

◆ try_read_some() [1/2]

SSHPP_INLINE Result< std::size_t > sshpp::Channel::try_read_some ( MutableByteView  buf,
Stream  stream = Stream::stdout_ 
)

◆ try_read_some() [2/2]

SSHPP_INLINE Result< std::size_t > sshpp::Channel::try_read_some ( MutableByteView  buf,
Stream  stream,
std::chrono::milliseconds  timeout 
)

◆ try_read_all()

SSHPP_INLINE Result< std::string > sshpp::Channel::try_read_all ( Stream  stream = Stream::stdout_,
std::size_t  limit = 64u << 20 
)

◆ try_write_some() [1/2]

SSHPP_INLINE Result< std::size_t > sshpp::Channel::try_write_some ( ByteView  data)

◆ try_write_some() [2/2]

SSHPP_INLINE Result< std::size_t > sshpp::Channel::try_write_some ( ByteView  data,
Stream  stream 
)

◆ try_write_all() [1/4]

SSHPP_INLINE Result< void > sshpp::Channel::try_write_all ( ByteView  data)

◆ try_write_all() [2/4]

SSHPP_INLINE Result< void > sshpp::Channel::try_write_all ( ByteView  data,
Stream  stream 
)

◆ try_write_all() [3/4]

SSHPP_INLINE Result< void > sshpp::Channel::try_write_all ( std::string_view  data)

◆ try_write_all() [4/4]

SSHPP_INLINE Result< void > sshpp::Channel::try_write_all ( std::string_view  data,
Stream  stream 
)

◆ try_bytes_available()

SSHPP_INLINE Result< std::size_t > sshpp::Channel::try_bytes_available ( Stream  stream = Stream::stdout_) const

◆ try_wait_readable()

SSHPP_INLINE Result< bool > sshpp::Channel::try_wait_readable ( std::chrono::milliseconds  timeout,
Stream  stream = Stream::stdout_ 
)

◆ try_send_eof()

SSHPP_INLINE Result< void > sshpp::Channel::try_send_eof ( )

◆ is_eof()

SSHPP_INLINE bool sshpp::Channel::is_eof ( ) const
noexcept

◆ try_close()

SSHPP_INLINE Result< void > sshpp::Channel::try_close ( )

◆ is_closed()

bool sshpp::Channel::is_closed ( ) const
inlinenoexcept

◆ try_wait_exit()

SSHPP_INLINE Result< ExitState > sshpp::Channel::try_wait_exit ( std::chrono::milliseconds  timeout = std::chrono::milliseconds::max())

◆ exit_state()

SSHPP_INLINE ExitState sshpp::Channel::exit_state ( ) const
noexcept

Friends And Related Symbol Documentation

◆ Session

friend class Session
friend

The documentation for this class was generated from the following files: