00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef SSHCONNECTIONCLI_H
00016 #define SSHCONNECTIONCLI_H
00017
00018 #ifdef ENABLE_SSH
00019
00020 #include <globalsearch/sshconnection.h>
00021
00022 #include <QtCore/QString>
00023 #include <QtCore/QStringList>
00024
00025 namespace GlobalSearch {
00026 class OptBase;
00027 class SSHManager;
00028 class SSHManagerCLI;
00029
00040 class SSHConnectionCLI : public SSHConnection
00041 {
00042 Q_OBJECT
00043
00044 public:
00050 explicit SSHConnectionCLI(SSHManagerCLI *parent = 0);
00051
00055 virtual ~SSHConnectionCLI();
00056
00057 public slots:
00068 bool execute(const QString &command,
00069 QString &stdout_str,
00070 QString &stderr_str,
00071 int &exitcode);
00072
00081 bool copyFileToServer(const QString & localpath,
00082 const QString & remotepath);
00083
00092 bool copyFileFromServer(const QString & remotepath,
00093 const QString & localpath);
00094
00104 bool readRemoteFile(const QString &filename,
00105 QString &contents);
00106
00114 bool removeRemoteFile(const QString &filename);
00115
00124 bool copyDirectoryToServer(const QString & localpath,
00125 const QString & remotepath);
00126
00135 bool copyDirectoryFromServer(const QString & remotepath,
00136 const QString & localpath);
00137
00146 bool readRemoteDirectoryContents(const QString & remotepath,
00147 QStringList & contents);
00148
00158 bool removeRemoteDirectory(const QString & remotepath,
00159 bool onlyDeleteContents = false);
00160
00161 protected:
00162 bool executeSSH(const QString &command,
00163 const QStringList &args = QStringList(),
00164 QString *stdout_str = NULL,
00165 QString *stderr_str = NULL,
00166 int *ec = NULL);
00167 bool executeSCPTo(const QString &source,
00168 const QString &dest,
00169 const QStringList &args = QStringList(),
00170 QString *stdout_str = NULL,
00171 QString *stderr_str = NULL,
00172 int *ec = NULL);
00173 bool executeSCPFrom(const QString &source,
00174 const QString &dest,
00175 const QStringList &args = QStringList(),
00176 QString *stdout_str = NULL,
00177 QString *stderr_str = NULL,
00178 int *ec = NULL);
00179
00180 };
00181
00182 }
00183
00184
00185 #endif // ENABLE_SSH
00186 #endif // SSHCONNECTION_H