1 #ifndef SPAWNING_UPLOAD_CLIENT_H 2 #define SPAWNING_UPLOAD_CLIENT_H 3 4 #include "FileUploadClient.h" 5 6 #include <OS.h> 7 #include <stdio.h> 8 #include <string> 9 10 11 class SpawningUploadClient : public FileUploadClient { 12 public: 13 SpawningUploadClient(); 14 virtual ~SpawningUploadClient(); 15 16 virtual bool Connect(const string& server, const string& login, 17 const string& passwd); 18 19 virtual bool PutFile(const string& local, const string& remote, 20 ftp_mode mode = binary_mode); 21 22 virtual bool GetFile(const string& remote, const string& local, 23 ftp_mode mode = binary_mode); 24 25 virtual bool MoveFile(const string& oldPath, const string& newPath); 26 virtual bool ChangeDir(const string& dir); 27 virtual bool PrintWorkingDir(string& dir); 28 virtual bool ListDirContents(string& listing); 29 virtual bool Chmod(const string& path, const string& mod); 30 31 virtual void SetPassive(bool on); 32 33 protected: 34 status_t SetCommandLine(const char *command); 35 ssize_t SendCommand(const char *cmd); 36 ssize_t ReadReply(BString *to); 37 virtual status_t ParseReply(); 38 int getpty(char *pty, char *tty); 39 40 int InputPipe() const { return fPty; }; 41 int OutputPipe() const { return fPty; }; 42 43 private: 44 bool SpawnCommand(); 45 string fCommand; 46 pid_t fCommandPid; 47 int fPty; 48 }; 49 50 #endif // SPAWNING_UPLOAD_CLIENT_H 51