目录
1 概述
libssh是一个在客户端和服务器端实现SSHv2协议的多平台C库。使用libssh,您可以远程执行程序、传输文件、使用安全透明的隧道、管理公钥等等。本文描述的对libssh客户端功能的C++封装。
libssh下载地址
3 实现
3.2 Channel
Channel是SSH隧道功能,可以执行远程程序,运行远程Shell和读取远程文件。
3.2.1 Channel定义
class ChannelPrivate;
class Session;
class Channel
{
public:
Channel(Session const& session);
~Channel();
bool open();
bool close();
bool send_eof();
bool run_shell(int cols, int rows);
bool is_open();
bool is_eof();
bool shell_size(int cols, int rows);
bool exec(const char* command);
int poll(bool isStderr = false);
int poll(int timeout, bool isStderr = false);
void set_blocking(bool enable);
int read(void *dest, uint32_t count, bool isStderr = false);
int read_nonblocking(void *dest, uint32_t count, bool isStderr = false);
int write(void *dest, uint32_t count);
private:
friend class SFtp;
Channel(Channel const&);
Channel & operator == (Channel const