1*6a739773SCodeforEvolution /* 2*6a739773SCodeforEvolution * Copyright 1998-1999 Be, Inc. All Rights Reserved. 3*6a739773SCodeforEvolution * Copyright 2003-2019 Haiku, Inc. All rights reserved. 4*6a739773SCodeforEvolution * Distributed under the terms of the MIT License. 5*6a739773SCodeforEvolution */ 642b2e5d5SFrançois Revol #ifndef SPAWNING_UPLOAD_CLIENT_H 742b2e5d5SFrançois Revol #define SPAWNING_UPLOAD_CLIENT_H 842b2e5d5SFrançois Revol 942b2e5d5SFrançois Revol #include "FileUploadClient.h" 1042b2e5d5SFrançois Revol 1142b2e5d5SFrançois Revol #include <stdio.h> 12*6a739773SCodeforEvolution #include <string.h> 13*6a739773SCodeforEvolution 14*6a739773SCodeforEvolution #include <OS.h> 15*6a739773SCodeforEvolution #include <String.h> 1642b2e5d5SFrançois Revol 1742b2e5d5SFrançois Revol 1842b2e5d5SFrançois Revol class SpawningUploadClient : public FileUploadClient { 1942b2e5d5SFrançois Revol public: 2042b2e5d5SFrançois Revol SpawningUploadClient(); 2142b2e5d5SFrançois Revol virtual ~SpawningUploadClient(); 2242b2e5d5SFrançois Revol 23*6a739773SCodeforEvolution virtual bool Connect(const string& server, 24*6a739773SCodeforEvolution const string& login, 2542b2e5d5SFrançois Revol const string& passwd); 2642b2e5d5SFrançois Revol 27*6a739773SCodeforEvolution virtual bool PutFile(const string& local, 28*6a739773SCodeforEvolution const string& remote, 2942b2e5d5SFrançois Revol ftp_mode mode = binary_mode); 3042b2e5d5SFrançois Revol 31*6a739773SCodeforEvolution virtual bool GetFile(const string& remote, 32*6a739773SCodeforEvolution const string& local, 3342b2e5d5SFrançois Revol ftp_mode mode = binary_mode); 3442b2e5d5SFrançois Revol 35*6a739773SCodeforEvolution virtual bool MoveFile(const string& oldPath, 36*6a739773SCodeforEvolution const string& newPath); 3742b2e5d5SFrançois Revol virtual bool ChangeDir(const string& dir); 3842b2e5d5SFrançois Revol virtual bool PrintWorkingDir(string& dir); 3942b2e5d5SFrançois Revol virtual bool ListDirContents(string& listing); 4042b2e5d5SFrançois Revol virtual bool Chmod(const string& path, const string& mod); 4142b2e5d5SFrançois Revol 4242b2e5d5SFrançois Revol virtual void SetPassive(bool on); 4342b2e5d5SFrançois Revol 4442b2e5d5SFrançois Revol protected: 4542b2e5d5SFrançois Revol status_t SetCommandLine(const char* command); 4642b2e5d5SFrançois Revol ssize_t SendCommand(const char* cmd); 4742b2e5d5SFrançois Revol ssize_t ReadReply(BString* to); 4842b2e5d5SFrançois Revol virtual status_t ParseReply(); 49586cf6aeSFrançois Revol int getpty(char* pty, char* tty); 5042b2e5d5SFrançois Revol InputPipe()5142b2e5d5SFrançois Revol int InputPipe() const { return fPty; }; OutputPipe()5242b2e5d5SFrançois Revol int OutputPipe() const { return fPty; }; 5342b2e5d5SFrançois Revol 5442b2e5d5SFrançois Revol private: 5542b2e5d5SFrançois Revol bool SpawnCommand(); 56*6a739773SCodeforEvolution 57*6a739773SCodeforEvolution private: 5842b2e5d5SFrançois Revol string fCommand; 5942b2e5d5SFrançois Revol pid_t fCommandPid; 6042b2e5d5SFrançois Revol int fPty; 6142b2e5d5SFrançois Revol }; 6242b2e5d5SFrançois Revol 6342b2e5d5SFrançois Revol #endif // SPAWNING_UPLOAD_CLIENT_H 64