Changeset View
Changeset View
Standalone View
Standalone View
sftp/kio_sftp.h
Show All 16 Lines | |||||
17 | * along with this library; see the file COPYING.LIB. If not, write to | 17 | * along with this library; see the file COPYING.LIB. If not, write to | ||
18 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | 18 | * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, | ||
19 | * Boston, MA 02110-1301, USA. | 19 | * Boston, MA 02110-1301, USA. | ||
20 | */ | 20 | */ | ||
21 | 21 | | |||
22 | #ifndef __kio_sftp_h__ | 22 | #ifndef __kio_sftp_h__ | ||
23 | #define __kio_sftp_h__ | 23 | #define __kio_sftp_h__ | ||
24 | 24 | | |||
25 | #include <kurl.h> | | |||
26 | #include <kio/global.h> | 25 | #include <kio/global.h> | ||
27 | #include <kio/slavebase.h> | 26 | #include <kio/slavebase.h> | ||
28 | 27 | | |||
29 | #include <libssh/libssh.h> | 28 | #include <libssh/libssh.h> | ||
30 | #include <libssh/sftp.h> | 29 | #include <libssh/sftp.h> | ||
31 | #include <libssh/callbacks.h> | 30 | #include <libssh/callbacks.h> | ||
32 | 31 | | |||
33 | #include <QtCore/QQueue> | 32 | #include <QtCore/QQueue> | ||
▲ Show 20 Lines • Show All 66 Lines • ▼ Show 20 Line(s) | 81 | private: // Private variables | |||
100 | 99 | | |||
101 | /** User's password */ | 100 | /** User's password */ | ||
102 | QString mPassword; | 101 | QString mPassword; | ||
103 | 102 | | |||
104 | /** The open file */ | 103 | /** The open file */ | ||
105 | sftp_file mOpenFile; | 104 | sftp_file mOpenFile; | ||
106 | 105 | | |||
107 | /** The open URL */ | 106 | /** The open URL */ | ||
108 | KUrl mOpenUrl; | 107 | QUrl mOpenUrl; | ||
109 | 108 | | |||
110 | ssh_callbacks mCallbacks; | 109 | ssh_callbacks mCallbacks; | ||
111 | 110 | | |||
112 | /** Version of the sftp protocol we are using. */ | 111 | /** Version of the sftp protocol we are using. */ | ||
113 | int sftpVersion; | 112 | int sftpVersion; | ||
114 | 113 | | |||
115 | struct Status | 114 | struct Status | ||
116 | { | 115 | { | ||
117 | int code; | 116 | int code; | ||
118 | KIO::filesize_t size; | 117 | KIO::filesize_t size; | ||
119 | QString text; | 118 | QString text; | ||
120 | }; | 119 | }; | ||
121 | 120 | | |||
122 | // KIO::FileJob interface | 121 | // KIO::FileJob interface | ||
123 | /** The opened handle */ | 122 | /** The opened handle */ | ||
124 | QByteArray openHandle; | 123 | QByteArray openHandle; | ||
125 | KUrl openUrl; | 124 | QUrl openUrl; | ||
126 | KIO::filesize_t openOffset; | 125 | KIO::filesize_t openOffset; | ||
127 | 126 | | |||
128 | /** | 127 | /** | ||
129 | * Holds public key authentication info for proper retry handling. | 128 | * Holds public key authentication info for proper retry handling. | ||
130 | */ | 129 | */ | ||
131 | KIO::AuthInfo* mPublicKeyAuthInfo; | 130 | KIO::AuthInfo* mPublicKeyAuthInfo; | ||
132 | 131 | | |||
133 | /** | 132 | /** | ||
▲ Show 20 Lines • Show All 45 Lines • ▼ Show 20 Line(s) | 174 | private: | |||
179 | QQueue<Request> pendingRequests; | 178 | QQueue<Request> pendingRequests; | ||
180 | }; | 179 | }; | ||
181 | 180 | | |||
182 | 181 | | |||
183 | private: // private methods | 182 | private: // private methods | ||
184 | 183 | | |||
185 | int authenticateKeyboardInteractive(KIO::AuthInfo &info); | 184 | int authenticateKeyboardInteractive(KIO::AuthInfo &info); | ||
186 | 185 | | |||
187 | void reportError(const KUrl &url, const int err); | 186 | void reportError(const QUrl &url, const int err); | ||
188 | 187 | | |||
189 | bool createUDSEntry(const QString &filename, const QByteArray &path, | 188 | bool createUDSEntry(const QString &filename, const QByteArray &path, | ||
190 | KIO::UDSEntry &entry, short int details); | 189 | KIO::UDSEntry &entry, short int details); | ||
191 | 190 | | |||
192 | QString canonicalizePath(const QString &path); | 191 | QString canonicalizePath(const QString &path); | ||
193 | void requiresUserNameRedirection(); | 192 | void requiresUserNameRedirection(); | ||
194 | void clearPubKeyAuthInfo(); | 193 | void clearPubKeyAuthInfo(); | ||
195 | bool sftpLogin(); | 194 | bool sftpLogin(); | ||
196 | bool sftpOpenConnection(const KIO::AuthInfo&); | 195 | bool sftpOpenConnection(const KIO::AuthInfo&); | ||
197 | void sftpSendWarning(int errorCode, const QString& url); | 196 | void sftpSendWarning(int errorCode, const QString& url); | ||
198 | 197 | | |||
199 | /** | 198 | /** | ||
200 | * Status Code returned from ftpPut() and ftpGet(), used to select | 199 | * Status Code returned from ftpPut() and ftpGet(), used to select | ||
201 | * source or destination url for error messages | 200 | * source or destination url for error messages | ||
202 | */ | 201 | */ | ||
203 | typedef enum { | 202 | typedef enum { | ||
204 | Success, | 203 | Success, | ||
205 | ClientError, | 204 | ClientError, | ||
206 | ServerError | 205 | ServerError | ||
207 | } StatusCode; | 206 | } StatusCode; | ||
208 | 207 | | |||
209 | StatusCode sftpGet(const KUrl& url, int& errorCode, KIO::fileoffset_t offset = -1, int fd = -1); | 208 | StatusCode sftpGet(const QUrl& url, int& errorCode, KIO::fileoffset_t offset = -1, int fd = -1); | ||
210 | StatusCode sftpPut(const KUrl& url, int permissions, KIO::JobFlags flags, int& errorCode, int fd = -1); | 209 | StatusCode sftpPut(const QUrl& url, int permissions, KIO::JobFlags flags, int& errorCode, int fd = -1); | ||
211 | 210 | | |||
212 | StatusCode sftpCopyGet(const KUrl& url, const QString& src, int permissions, KIO::JobFlags flags, int& errorCode); | 211 | StatusCode sftpCopyGet(const QUrl& url, const QString& src, int permissions, KIO::JobFlags flags, int& errorCode); | ||
213 | StatusCode sftpCopyPut(const KUrl& url, const QString& dest, int permissions, KIO::JobFlags flags, int& errorCode); | 212 | StatusCode sftpCopyPut(const QUrl& url, const QString& dest, int permissions, KIO::JobFlags flags, int& errorCode); | ||
214 | 213 | | |||
215 | void fileSystemFreeSpace(const QUrl& url); // KF6 TODO: Once a virtual fileSystemFreeSpace method in SlaveBase exists, override it | 214 | void fileSystemFreeSpace(const QUrl& url); // KF6 TODO: Once a virtual fileSystemFreeSpace method in SlaveBase exists, override it | ||
216 | }; | 215 | }; | ||
217 | 216 | | |||
218 | #endif | 217 | #endif |