00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef SSHMANAGERLIBSSH_H
00016 #define SSHMANAGERLIBSSH_H
00017
00018 #ifdef ENABLE_SSH
00019
00020 #include <globalsearch/sshmanager.h>
00021
00022 #include <QtCore/QHash>
00023 #include <QtCore/QObject>
00024 #include <QtCore/QMutex>
00025 #include <QtCore/QSemaphore>
00026
00027 namespace GlobalSearch {
00028 class OptBase;
00029 class SSHConnection;
00030 class SSHConnectionLibSSH;
00031
00039 class SSHManagerLibSSH : public SSHManager
00040 {
00041 Q_OBJECT
00042
00043 public:
00050 explicit SSHManagerLibSSH(unsigned int connections = 5,
00051 OptBase *parent = 0);
00052
00056 virtual ~SSHManagerLibSSH();
00057
00063 void makeConnections(const QString &host,
00064 const QString &user = "",
00065 const QString &pass = "",
00066 unsigned int port = 22);
00067
00071 bool isValid() {return m_isValid;};
00072
00073 public slots:
00078 SSHConnection *getFreeConnection();
00079
00084 void unlockConnection(SSHConnection* ssh);
00085
00093 QString getServerKeyHash();
00094
00101 bool validateServerKey();
00102
00106 void setServerKey(const QString &hexa);
00107
00108
00109 protected:
00111 QList<SSHConnectionLibSSH*> m_conns;
00112
00114 QMutex m_lock;
00115
00117 QSemaphore m_connSemaphore;
00118
00120 QString m_pass;
00122 QString m_hexa;
00124 unsigned int m_connections;
00126 bool m_isValid;
00127 };
00128
00129 }
00130
00131 #endif // ENABLE_SSH
00132 #endif // SSHMANAGERLIBSSH_H