1 #ifndef SFTP_CLIENT_H 2 #define SFTP_CLIENT_H 3 4 5 #include <stdio.h> 6 #include <string> 7 8 #include <Catalog.h> 9 #include <File.h> 10 #include <Locale.h> 11 12 #include "SpawningUploadClient.h" 13 14 15 #undef B_TRANSLATION_CONTEXT 16 #define B_TRANSLATION_CONTEXT "SftpClient" 17 18 19 using std::string; 20 21 22 class SftpClient : public SpawningUploadClient { 23 public: 24 SftpClient(); 25 virtual ~SftpClient(); 26 27 virtual bool Connect(const string& server, 28 const string& login, 29 const string& passwd); 30 31 bool PutFile(const string& local, 32 const string& remote, 33 ftp_mode mode = binary_mode); 34 35 bool GetFile(const string& remote, 36 const string& local, 37 ftp_mode mode = binary_mode); 38 39 bool MoveFile(const string& oldPath, 40 const string& newPath); 41 bool ChangeDir(const string& dir); 42 bool PrintWorkingDir(string& dir); 43 bool ListDirContents(string& listing); 44 bool Chmod(const string& path, const string& mod); 45 46 void SetPassive(bool on); 47 48 private: 49 const char* _GetLongReadText() const; 50 const char* _GetReadText() const; 51 const char* _GetReplyText() const; 52 }; 53 54 #endif // SFTP_CLIENT_H 55