xref: /haiku/src/apps/codycam/SftpClient.h (revision cbe0a0c436162d78cc3f92a305b64918c839d079)
1 /*
2  * Copyright 1998-1999 Be, Inc. All Rights Reserved.
3  * Copyright 2003-2019 Haiku, Inc. All rights reserved.
4  * Distributed under the terms of the MIT License.
5  */
6 #ifndef SFTP_CLIENT_H
7 #define SFTP_CLIENT_H
8 
9 
10 #include <stdio.h>
11 #include <string>
12 
13 #include <Catalog.h>
14 #include <File.h>
15 #include <Locale.h>
16 
17 #include "SpawningUploadClient.h"
18 
19 
20 #undef B_TRANSLATION_CONTEXT
21 #define B_TRANSLATION_CONTEXT "SftpClient"
22 
23 
24 using std::string;
25 
26 
27 class SftpClient : public SpawningUploadClient {
28 public:
29 								SftpClient();
30 	virtual						~SftpClient();
31 
32 	virtual	bool				Connect(const string& server,
33 									const string& login,
34 									const string& passwd);
35 
36 			bool				PutFile(const string& local,
37 									const string& remote,
38 									ftp_mode mode = binary_mode);
39 
40 			bool				GetFile(const string& remote,
41 									const string& local,
42 									ftp_mode mode = binary_mode);
43 
44 			bool				MoveFile(const string& oldPath,
45 									const string& newPath);
46 			bool				ChangeDir(const string& dir);
47 			bool				PrintWorkingDir(string& dir);
48 			bool				ListDirContents(string& listing);
49 			bool				Chmod(const string& path, const string& mod);
50 
51 			void				SetPassive(bool on);
52 
53 private:
54 			const char*			_GetLongReadText() const;
55 			const char*			_GetReadText() const;
56 			const char*			_GetReplyText() const;
57 };
58 
59 #endif	// SFTP_CLIENT_H
60