#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, Allison Vacanti
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.
◆ isPersistent()
| bool isPersistent |
( |
| ) |
const |
- Returns
- If the SSH connection is set as persistent or not.
◆ userName()
| QString userName |
( |
| ) |
const |
- Returns
- The user name that will be used.
◆ hostName()
| QString hostName |
( |
| ) |
const |
- Returns
- The host that will be used.
◆ identityFile()
| QString identityFile |
( |
| ) |
const |
- Returns
- The path to the identity file that will be used.
◆ portNumber()
- Returns
- The port that will be used.
◆ isValid()
| virtual bool isValid |
( |
| ) |
const |
|
virtual |
- Returns
- Whether the connection is valid, at a minimum need a host name.
◆ output()
| virtual QString output |
( |
| ) |
const |
|
virtual |
- Returns
- The merged stdout and stderr of the remote command.
Reimplemented in SshCommand.
◆ exitCode()
| virtual int exitCode |
( |
| ) |
const |
|
virtual |
- Returns
- The exit code returned from a remote command.
Reimplemented in SshCommand.
◆ waitForCompletion()
| 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.
◆ isComplete()
| virtual bool isComplete |
( |
| ) |
const |
|
virtual |
- Returns
- True if the request has completed. False otherwise.
Reimplemented in SshCommand.
◆ data() [1/2]
- Returns
- A reference to arbitrary data stored in the command.
◆ data() [2/2]
| const QVariant & data |
( |
| ) |
const |
- Returns
- A reference to arbitrary data stored in the command.
◆ setData()
| void setData |
( |
const QVariant & | newData | ) |
|
- Parameters
-
| newData | Arbitrary data to store in the command. |
◆ setPersistent
| 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@host ls
◆ setUserName
| void setUserName |
( |
const QString & | newUserName | ) |
|
|
slot |
Set the user name to use for the connection.
◆ setHostName
| void setHostName |
( |
const QString & | newHostName | ) |
|
|
slot |
Set the host name to use for the connection.
◆ setIdentityFile
| 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.
◆ setPortNumber
| void setPortNumber |
( |
int | newPortNumber | ) |
|
|
slot |
Set the host name to use for the connection.
◆ execute
| 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.
◆ copyTo
| 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.
◆ copyFrom
| 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.
◆ copyDirTo
| 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.
◆ copyDirFrom
| 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.
◆ requestSent
Emitted when the request has been sent to the server.
◆ requestComplete
Emitted when the request has been sent and the reply (if any) received.
The documentation for this class was generated from the following file: