libssh 0.11.1 The SSH library

Loading...
Searching...
No Matches
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>`

## Public Member Functions
| Channel (Session &ssh_session)
Channel * | acceptX11 (int timeout_ms)
| accept an incoming X11 connection
void_throwable | changePtySize (int cols, int rows)
| change the size of a pseudoterminal
void_throwable | close ()
| closes a channel
int | getExitStatus ()
void_throwable | getExitState (uint32_t &pexit_code, char **pexit_signal, int &pcore_dumped)
Session & | getSession ()
bool | isClosed ()
| returns true if channel is in closed state
bool | isEof ()
| returns true if channel is in EOF state
bool | isOpen ()
| returns true if channel is in open state
int | openForward (const char *remotehost, int remoteport, const char *sourcehost, 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, const unsigned char *modes=NULL, size_t modes_len=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.
ssh_session | getCSession ()
ssh_channel | getCChannel ()

## Protected Attributes
Session * | session
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_ms | timeout 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] | cols | number of columns
  [in] | rows | number of rows

Exceptions

  SshException | on error

See also
  ssh_channel_change_pty_size

## ◆ close()

void_throwable ssh::Channel::close | ( |  | ) |
| inline

closes a channel

Exceptions

  SshException | on 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

  data | data to write.
  len | number of bytes to write.
  is_stderr | write should be done on the stderr channel (server only)

Returns
  number of bytes written

Exceptions

  SshException | in case of error

See also
  ssh_channel_write
  ssh_channel_write_stderr

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

- libsshpp.hpp