#include <molequeue/sshconnection.h>
|
void | setPersistent (bool persist) |
|
void | setUserName (const QString &newUserName) |
|
void | setHostName (const QString &newHostName) |
|
void | setIdentityFile (const QString &newIdentityFile) |
|
void | setPortNumber (int newPortNumber) |
|
virtual bool | execute (const QString &command) |
|
virtual bool | copyTo (const QString &localFile, const QString &remoteFile) |
|
virtual bool | copyFrom (const QString &remoteFile, const QString &localFile) |
|
virtual bool | copyDirTo (const QString &localDir, const QString &remoteDir) |
|
virtual bool | copyDirFrom (const QString &remoteDir, const QString &localDir) |
|
|
bool | m_persistent |
|
QVariant | m_data |
|
QString | m_userName |
|
QString | m_hostName |
|
QString | m_identityFile |
|
int | m_portNumber |
|
Abstract base class defining remote execution and file transfer operations over the ssh protocol.
- Author
- Marcus D. Hanwell, David C. Lonie
The SshConnection is the interface to use when writing code that requires interactions with a remote host. Subclasses provide concrete implementations of the interface, e.g. SshCommand, which calls the ssh and scp commands in a TerminalProcess.
bool isPersistent |
( |
| ) |
const |
- Returns
- If the SSH connection is set as persistent or not.
QString userName |
( |
| ) |
const |
- Returns
- The user name that will be used.
QString hostName |
( |
| ) |
const |
- Returns
- The host that will be used.
QString identityFile |
( |
| ) |
const |
- Returns
- The path to the identity file that will be used.
- Returns
- The port that will be used.
virtual bool isValid |
( |
| ) |
const |
|
virtual |
- Returns
- Whether the connection is valid, at a minimum need a host name.
virtual QString output |
( |
| ) |
const |
|
virtual |
- Returns
- The merged stdout and stderr of the remote command.
Reimplemented in SshCommand.
virtual int exitCode |
( |
| ) |
const |
|
virtual |
- Returns
- The exit code returned from a remote command.
Reimplemented in SshCommand.
virtual bool waitForCompletion |
( |
int |
msecs = 30000 | ) |
|
|
virtual |
Wait until the request has been completed.
- Parameters
-
msecs | Timeout in milliseconds. Default is 30 seconds. |
- Returns
- True if request finished, false on timeout.
Reimplemented in SshCommand.
virtual bool isComplete |
( |
| ) |
const |
|
virtual |
- Returns
- True if the request has completed. False otherwise.
Reimplemented in SshCommand.
- Returns
- A reference to arbitrary data stored in the command.
const QVariant& data |
( |
| ) |
const |
- Returns
- A reference to arbitrary data stored in the command.
void setData |
( |
const QVariant & |
newData | ) |
|
- Parameters
-
newData | Arbitrary data to store in the command. |
void setPersistent |
( |
bool |
persist | ) |
|
|
slot |
Set whether the connection should be persistent, or each issuesd command uses a short-lived connection, e.g. on the command line a non-persistent connection would be the equivalent of,
ssh user ls
void setUserName |
( |
const QString & |
newUserName | ) |
|
|
slot |
Set the user name to use for the connection.
void setHostName |
( |
const QString & |
newHostName | ) |
|
|
slot |
Set the host name to use for the connection.
void setIdentityFile |
( |
const QString & |
newIdentityFile | ) |
|
|
slot |
Set the identity file to use for the connection. This is the path to the private key to be used when establishing the connection.
void setPortNumber |
( |
int |
newPortNumber | ) |
|
|
slot |
Set the host name to use for the connection.
virtual bool execute |
( |
const QString & |
command | ) |
|
|
virtualslot |
Execute the supplied command on the remote host.
- Note
- The command is executed asynchronously, see requestComplete() or waitForCompletion() for results.
- See Also
- requestSent() requestCompleted() waitForCompeletion()
- Parameters
-
command | The command to execute. |
- Returns
- True on success, false on failure.
virtual bool copyTo |
( |
const QString & |
localFile, |
|
|
const QString & |
remoteFile |
|
) |
| |
|
virtualslot |
Copy a local file to the remote system.
- Note
- The command is executed asynchronously, see requestComplete() or waitForCompletion() for results.
- See Also
- requestSent() requestCompleted() waitForCompeletion()
- Parameters
-
localFile | The path of the local file. |
remoteFile | The path of the file on the remote system. |
- Returns
- True on success, false on failure.
virtual bool copyFrom |
( |
const QString & |
remoteFile, |
|
|
const QString & |
localFile |
|
) |
| |
|
virtualslot |
Copy a remote file to the local system.
- Note
- The command is executed asynchronously, see requestComplete() or waitForCompletion() for results.
- See Also
- requestSent() requestCompleted() waitForCompeletion()
- Parameters
-
remoteFile | The path of the file on the remote system. |
localFile | The path of the local file. |
- Returns
- True on success, false on failure.
virtual bool copyDirTo |
( |
const QString & |
localDir, |
|
|
const QString & |
remoteDir |
|
) |
| |
|
virtualslot |
Copy a local directory recursively to the remote system.
- Note
- The command is executed asynchronously, see requestComplete() or waitForCompletion() for results.
- See Also
- requestSent() requestCompleted() waitForCompeletion()
- Parameters
-
localDir | The path of the local directory. |
remoteDir | The path of the directory on the remote system. |
- Returns
- True on success, false on failure.
virtual bool copyDirFrom |
( |
const QString & |
remoteDir, |
|
|
const QString & |
localDir |
|
) |
| |
|
virtualslot |
Copy a remote directory recursively to the local system.
- Note
- The command is executed asynchronously, see requestComplete() or waitForCompletion() for results.
- See Also
- requestSent() requestCompleted() waitForCompeletion()
- Parameters
-
remoteDir | The path of the directory on the remote system. |
localFile | The path of the local directory. |
- Returns
- True on success, false on failure.
Emitted when the request has been sent to the server.
Emitted when the request has been sent and the reply (if any) received.
The documentation for this class was generated from the following file: