Exiv2
List of all members
Exiv2::SSH Class Reference

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>

Public Member Functions

Creators
 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.
 
Manipulators
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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ 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
hostThe host name of ssh server.
userThe username used to connect to ssh server.
passThe password used to connect to ssh server.
portThe port to connect to ssh server. Set empty string to use the default port.
Exceptions
Errorif it fails to connect the server.

Member Function Documentation

◆ 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
filePathThe path of the file on the remote machine.
handleThe container for the file handle.
Exceptions
Errorif 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
cmdThe command
outputThe 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
filePathThe path of the new file on the remote machine where the data is saved.
dataThe data copied to the remote machine.
sizeThe size of the data.
Returns
0 (SSH_OK) if there is no error.
Exceptions
Errorif it is unable to copy the data.

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