libssh  0.8.4
The SSH library
Public Member Functions | Protected Attributes | Friends
ssh::Channel Class Reference

the ssh::Channel class describes the state of an SSH channel. More...

#include <libsshpp.hpp>

Collaboration diagram for ssh::Channel:
Collaboration graph
[legend]

Public Member Functions

 Channel (Session &ssh_session)
 
ChannelacceptX11 (int timeout_ms)
 accept an incoming X11 connection More...
 
void_throwable changePtySize (int cols, int rows)
 change the size of a pseudoterminal More...
 
void_throwable close ()
 closes a channel More...
 
int getExitStatus ()
 
SessiongetSession ()
 
bool isClosed ()
 returns true if channel is in closed state More...
 
bool isEof ()
 returns true if channel is in EOF state More...
 
bool isOpen ()
 returns true if channel is in open state More...
 
int openForward (const char *remotehost, int remoteport, const char *sourcehost=NULL, int localport=0)
 
void_throwable openSession ()
 
int poll (bool is_stderr=false)
 
int read (void *dest, size_t count)
 
int read (void *dest, size_t count, int timeout)
 
int read (void *dest, size_t count, bool is_stderr=false, int timeout=-1)
 
int readNonblocking (void *dest, size_t count, bool is_stderr=false)
 
void_throwable requestEnv (const char *name, const char *value)
 
void_throwable requestExec (const char *cmd)
 
void_throwable requestPty (const char *term=NULL, int cols=0, int rows=0)
 
void_throwable requestShell ()
 
void_throwable requestSendSignal (const char *signum)
 
void_throwable requestSubsystem (const char *subsystem)
 
int requestX11 (bool single_connection, const char *protocol, const char *cookie, int screen_number)
 
void_throwable sendEof ()
 
int write (const void *data, size_t len, bool is_stderr=false)
 Writes on a channel. More...
 
ssh_session getCSession ()
 
ssh_channel getCChannel ()
 

Protected Attributes

Sessionsession
 
ssh_channel channel
 

Friends

class Session
 

Detailed Description

the ssh::Channel class describes the state of an SSH channel.

See also
ssh_channel

Member Function Documentation

◆ acceptX11()

Channel* ssh::Channel::acceptX11 ( int  timeout_ms)
inline

accept an incoming X11 connection

Parameters
[in]timeout_mstimeout for waiting, in ms
Returns
new Channel pointer on the X11 connection
NULL in case of error
Warning
you have to delete this pointer after use
See also
ssh_channel_accept_x11
Channel::requestX11

◆ changePtySize()

void_throwable ssh::Channel::changePtySize ( int  cols,
int  rows 
)
inline

change the size of a pseudoterminal

Parameters
[in]colsnumber of columns
[in]rowsnumber of rows
Exceptions
SshExceptionon error
See also
ssh_channel_change_pty_size

◆ close()

void_throwable ssh::Channel::close ( )
inline

closes a channel

Exceptions
SshExceptionon error
See also
ssh_channel_close

◆ isClosed()

bool ssh::Channel::isClosed ( )
inline

returns true if channel is in closed state

See also
ssh_channel_is_closed

◆ isEof()

bool ssh::Channel::isEof ( )
inline

returns true if channel is in EOF state

See also
ssh_channel_is_eof

◆ isOpen()

bool ssh::Channel::isOpen ( )
inline

returns true if channel is in open state

See also
ssh_channel_is_open

◆ write()

int ssh::Channel::write ( const void *  data,
size_t  len,
bool  is_stderr = false 
)
inline

Writes on a channel.

Parameters
datadata to write.
lennumber of bytes to write.
is_stderrwrite should be done on the stderr channel (server only)
Returns
number of bytes written
Exceptions
SshExceptionin case of error
See also
channel_write
channel_write_stderr

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