The class provides the high-level functions related to libssh. It makes the libssh transparent. The functions in this class can be used without the requirement of understanding libssh.
More...
#include <ssh.hpp>
|
|
| SSH (const std::string &host, const std::string &user, const std::string &pass, const std::string port="") |
| Constructor to set up the connection to ssh server. More...
|
|
| ~SSH () |
| Destructor.
|
|
|
int | runCommand (const std::string &cmd, std::string *output) |
| Run the command on the remote machine. More...
|
|
int | scp (const std::string &filePath, const byte *data, size_t size) |
| SCP data to the remote machine. More...
|
|
void | getFileSftp (const std::string &filePath, sftp_file &handle) |
| Return the sftp file handle of the file on the remote machine to read the data. More...
|
|
The class provides the high-level functions related to libssh. It makes the libssh transparent. The functions in this class can be used without the requirement of understanding libssh.
◆ SSH()
Exiv2::SSH::SSH |
( |
const std::string & |
host, |
|
|
const std::string & |
user, |
|
|
const std::string & |
pass, |
|
|
const std::string |
port = "" |
|
) |
| |
Constructor to set up the connection to ssh server.
- Parameters
-
host | The host name of ssh server. |
user | The username used to connect to ssh server. |
pass | The password used to connect to ssh server. |
port | The port to connect to ssh server. Set empty string to use the default port. |
- Exceptions
-
Error | if it fails to connect the server. |
◆ getFileSftp()
void Exiv2::SSH::getFileSftp |
( |
const std::string & |
filePath, |
|
|
sftp_file & |
handle |
|
) |
| |
Return the sftp file handle of the file on the remote machine to read the data.
- Parameters
-
filePath | The path of the file on the remote machine. |
handle | The container for the file handle. |
- Exceptions
-
Error | if it is unable to get the sftp file handle. |
- Note
- Be sure to close() the file handle after use.
◆ runCommand()
int Exiv2::SSH::runCommand |
( |
const std::string & |
cmd, |
|
|
std::string * |
output |
|
) |
| |
Run the command on the remote machine.
- Parameters
-
cmd | The command |
output | The container for the command's output |
- Returns
- 0 (SSH_OK) if there is no error.
◆ scp()
int Exiv2::SSH::scp |
( |
const std::string & |
filePath, |
|
|
const byte * |
data, |
|
|
size_t |
size |
|
) |
| |
SCP data to the remote machine.
- Parameters
-
filePath | The path of the new file on the remote machine where the data is saved. |
data | The data copied to the remote machine. |
size | The size of the data. |
- Returns
- 0 (SSH_OK) if there is no error.
- Exceptions
-
Error | if it is unable to copy the data. |
The documentation for this class was generated from the following file: